mirror of https://github.com/YosysHQ/yosys.git
Compare commits
3 Commits
72787f52fc
...
a734face3a
Author | SHA1 | Date |
---|---|---|
Claire Xenia Wolf | a734face3a | |
Claire Xenia Wolf | 0ada13cbe2 | |
Claire Xenia Wolf | 92e705cb51 |
2
Makefile
2
Makefile
|
@ -956,7 +956,7 @@ ifeq ($(ENABLE_ABC),1)
|
|||
cp -r $(PROGRAM_PREFIX)yosys-abc.exe abc/lib/x86/pthreadVC2.dll yosys-win32-mxebin-$(YOSYS_VER)/
|
||||
endif
|
||||
echo -en 'This is Yosys $(YOSYS_VER) for Win32.\r\n' > yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
|
||||
echo -en 'Documentation at http://yosyshq.net/yosys/.\r\n' >> yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
|
||||
echo -en 'Documentation at https://yosyshq.net/yosys/.\r\n' >> yosys-win32-mxebin-$(YOSYS_VER)/readme.txt
|
||||
zip -r yosys-win32-mxebin-$(YOSYS_VER).zip yosys-win32-mxebin-$(YOSYS_VER)/
|
||||
endif
|
||||
|
||||
|
|
|
@ -38,11 +38,11 @@ Web Site and Other Resources
|
|||
============================
|
||||
|
||||
More information and documentation can be found on the Yosys web site:
|
||||
- http://yosyshq.net/yosys/
|
||||
- https://yosyshq.net/yosys/
|
||||
|
||||
The "Documentation" page on the web site contains links to more resources,
|
||||
including a manual that even describes some of the Yosys internals:
|
||||
- http://yosyshq.net/yosys/documentation.html
|
||||
- https://yosyshq.net/yosys/documentation.html
|
||||
|
||||
The directory `guidelines` contains additional information
|
||||
for people interested in using the Yosys C++ APIs.
|
||||
|
@ -92,7 +92,7 @@ For Cygwin use the following command to install all prerequisites, or select the
|
|||
|
||||
There are also pre-compiled Yosys binary packages for Ubuntu and Win32 as well
|
||||
as a source distribution for Visual Studio. Visit the Yosys download page for
|
||||
more information: http://yosyshq.net/yosys/download.html
|
||||
more information: https://yosyshq.net/yosys/download.html
|
||||
|
||||
To configure the build system to use a specific compiler, use one of
|
||||
|
||||
|
@ -568,7 +568,7 @@ Building the documentation
|
|||
==========================
|
||||
|
||||
Note that there is no need to build the manual if you just want to read it.
|
||||
Simply download the PDF from http://yosyshq.net/yosys/documentation.html
|
||||
Simply download the PDF from https://yosyshq.net/yosys/documentation.html
|
||||
instead.
|
||||
|
||||
On Ubuntu, texlive needs these packages to be able to build the manual:
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
\begin{document}
|
||||
|
||||
\title{Yosys Application Note 010: \\ Converting Verilog to BLIF}
|
||||
\author{Clifford Wolf \\ November 2013}
|
||||
\author{Claire Xenia Wolf \\ November 2013}
|
||||
\maketitle
|
||||
|
||||
\begin{abstract}
|
||||
|
@ -437,12 +437,12 @@ design to fit a certain need without actually touching the RTL code.
|
|||
\begin{thebibliography}{9}
|
||||
|
||||
\bibitem{yosys}
|
||||
Clifford Wolf. The Yosys Open SYnthesis Suite. \\
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
Claire Xenia Wolf. The Yosys Open SYnthesis Suite. \\
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
|
||||
\bibitem{bigsim}
|
||||
yosys-bigsim, a collection of real-world Verilog designs for regression testing purposes. \\
|
||||
\url{https://github.com/cliffordwolf/yosys-bigsim}
|
||||
\url{https://github.com/YosysHQ/yosys-bigsim}
|
||||
|
||||
\bibitem{navre}
|
||||
Sebastien Bourdeauducq. Navr\'e AVR clone (8-bit RISC). \\
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
\begin{document}
|
||||
|
||||
\title{Yosys Application Note 011: \\ Interactive Design Investigation}
|
||||
\author{Clifford Wolf \\ Original Version December 2013}
|
||||
\author{Claire Xenia Wolf \\ Original Version December 2013}
|
||||
\maketitle
|
||||
|
||||
\begin{abstract}
|
||||
|
@ -1041,8 +1041,8 @@ framework for new algorithms alike.
|
|||
\begin{thebibliography}{9}
|
||||
|
||||
\bibitem{yosys}
|
||||
Clifford Wolf. The Yosys Open SYnthesis Suite.
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
Claire Xenia Wolf. The Yosys Open SYnthesis Suite.
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
|
||||
\bibitem{graphviz}
|
||||
Graphviz - Graph Visualization Software.
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
\begin{document}
|
||||
|
||||
\title{Yosys Application Note 012: \\ Converting Verilog to BTOR}
|
||||
\author{Ahmed Irfan and Clifford Wolf \\ April 2015}
|
||||
\author{Ahmed Irfan and Claire Xenia Wolf \\ April 2015}
|
||||
\maketitle
|
||||
|
||||
\begin{abstract}
|
||||
|
@ -410,8 +410,8 @@ verification benchmarks with or without memories from Verilog designs.
|
|||
\begin{thebibliography}{9}
|
||||
|
||||
\bibitem{yosys}
|
||||
Clifford Wolf. The Yosys Open SYnthesis Suite. \\
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
Claire Xenia Wolf. The Yosys Open SYnthesis Suite. \\
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
|
||||
\bibitem{boolector}
|
||||
Robert Brummayer and Armin Biere, Boolector: An Efficient SMT Solver for Bit-Vectors and Arrays\\
|
||||
|
|
|
@ -22,7 +22,7 @@ ConstEval} class provided in {\tt kernel/consteval.h}.
|
|||
\label{sec:SubCircuit}
|
||||
|
||||
The files in {\tt libs/subcircuit} provide a library for solving the subcircuit
|
||||
isomorphism problem. It is written by Clifford Wolf and based on the Ullmann
|
||||
isomorphism problem. It is written by C. Wolf and based on the Ullmann
|
||||
Subgraph Isomorphism Algorithm \cite{UllmannSubgraphIsomorphism}. It is used by
|
||||
the {\tt extract} pass (see {\tt help extract} or Sec.~\ref{cmd:extract}).
|
||||
|
||||
|
@ -30,6 +30,6 @@ the {\tt extract} pass (see {\tt help extract} or Sec.~\ref{cmd:extract}).
|
|||
|
||||
The files in {\tt libs/ezsat} provide a library for simplifying generating CNF
|
||||
formulas for SAT solvers. It also contains bindings of MiniSAT. The ezSAT
|
||||
library is written by Clifford Wolf. It is used by the {\tt sat} pass (see
|
||||
library is written by C. Wolf. It is used by the {\tt sat} pass (see
|
||||
{\tt help sat} or Sec.~\ref{cmd:sat}).
|
||||
|
||||
|
|
|
@ -890,7 +890,7 @@ Questions?
|
|||
\bigskip
|
||||
\bigskip
|
||||
\begin{center}
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
\end{center}
|
||||
\end{frame}
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ Questions?
|
|||
\bigskip
|
||||
\bigskip
|
||||
\begin{center}
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
\end{center}
|
||||
\end{frame}
|
||||
|
||||
|
|
|
@ -509,7 +509,7 @@ Questions?
|
|||
\bigskip
|
||||
\bigskip
|
||||
\begin{center}
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
\end{center}
|
||||
\end{frame}
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ The following slides cover an example project. This project contains three files
|
|||
\end{itemize}
|
||||
\vfill
|
||||
Direct link to the files: \\ \footnotesize
|
||||
\url{https://github.com/cliffordwolf/yosys/tree/master/manual/PRESENTATION_Intro}
|
||||
\url{https://github.com/YosysHQ/yosys/tree/master/manual/PRESENTATION_Intro}
|
||||
\end{frame}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -476,7 +476,7 @@ Command reference:
|
|||
\begin{itemize}
|
||||
\item Use ``{\tt help}'' for a command list and ``{\tt help \it command}'' for details.
|
||||
\item Or run ``{\tt yosys -H}'' or ``{\tt yosys -h \it command}''.
|
||||
\item Or go to \url{http://yosyshq.net/yosys/documentation.html}.
|
||||
\item Or go to \url{https://yosyshq.net/yosys/documentation.html}.
|
||||
\end{itemize}
|
||||
|
||||
\bigskip
|
||||
|
@ -806,7 +806,7 @@ but also formal verification, reverse engineering, ...}
|
|||
\begin{itemize}
|
||||
\item Ongoing PhD project on coarse grain synthesis \\
|
||||
{\setlength{\parindent}{0.5cm}\footnotesize
|
||||
Johann Glaser and Clifford Wolf. Methodology and Example-Driven Interconnect
|
||||
Johann Glaser and C. Wolf. Methodology and Example-Driven Interconnect
|
||||
Synthesis for Designing Heterogeneous Coarse-Grain Reconfigurable
|
||||
Architectures. In Jan Haase, editor, \it Models, Methods, and Tools for Complex
|
||||
Chip Design. Lecture Notes in Electrical Engineering. Volume 265, 2014, pp
|
||||
|
@ -913,11 +913,11 @@ control logic because it is simpler than setting up a commercial flow.
|
|||
\begin{frame}{\subsecname}
|
||||
\begin{itemize}
|
||||
\item Website: \\
|
||||
\smallskip\hskip1cm\url{http://yosyshq.net/yosys/}
|
||||
\smallskip\hskip1cm\url{https://yosyshq.net/yosys/}
|
||||
|
||||
\bigskip
|
||||
\item Manual, Command Reference, Application Notes: \\
|
||||
\smallskip\hskip1cm\url{http://yosyshq.net/yosys/documentation.html}
|
||||
\smallskip\hskip1cm\url{https://yosyshq.net/yosys/documentation.html}
|
||||
|
||||
\bigskip
|
||||
\item Instead of a mailing list we have a SubReddit: \\
|
||||
|
@ -925,7 +925,7 @@ control logic because it is simpler than setting up a commercial flow.
|
|||
|
||||
\bigskip
|
||||
\item Direct link to the source code: \\
|
||||
\smallskip\hskip1cm\url{https://github.com/cliffordwolf/yosys}
|
||||
\smallskip\hskip1cm\url{https://github.com/YosysHQ/yosys}
|
||||
\end{itemize}
|
||||
\end{frame}
|
||||
|
||||
|
@ -950,7 +950,7 @@ Questions?
|
|||
\bigskip
|
||||
\bigskip
|
||||
\begin{center}
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
\end{center}
|
||||
\end{frame}
|
||||
|
||||
|
|
|
@ -590,7 +590,7 @@ Questions?
|
|||
\bigskip
|
||||
\bigskip
|
||||
\begin{center}
|
||||
\url{http://yosyshq.net/yosys/}
|
||||
\url{https://yosyshq.net/yosys/}
|
||||
\end{center}
|
||||
\end{frame}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
@inproceedings{intersynth,
|
||||
title={Example-driven interconnect synthesis for heterogeneous coarse-grain reconfigurable logic},
|
||||
author={Clifford Wolf and Johann Glaser and Florian Schupfer and Jan Haase and Christoph Grimm},
|
||||
author={C. Wolf and Johann Glaser and Florian Schupfer and Jan Haase and Christoph Grimm},
|
||||
booktitle={FDL Proceeding of the 2012 Forum on Specification and Design Languages},
|
||||
pages={194--201},
|
||||
year={2012}
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
@incollection{intersynthFdlBookChapter,
|
||||
title={Methodology and Example-Driven Interconnect Synthesis for Designing Heterogeneous Coarse-Grain Reconfigurable Architectures},
|
||||
author={Johann Glaser and Clifford Wolf},
|
||||
author={Johann Glaser and C. Wolf},
|
||||
booktitle={Advances in Models, Methods, and Tools for Complex Chip Design --- Selected contributions from FDL'12},
|
||||
editor={Jan Haase},
|
||||
publisher={Springer},
|
||||
|
@ -18,14 +18,14 @@
|
|||
}
|
||||
|
||||
@unpublished{BACC,
|
||||
author = {Clifford Wolf},
|
||||
author = {C. Wolf},
|
||||
title = {Design and Implementation of the Yosys Open SYnthesis Suite},
|
||||
note = {Bachelor Thesis, Vienna University of Technology},
|
||||
year = {2013}
|
||||
}
|
||||
|
||||
@unpublished{VerilogFossEval,
|
||||
author = {Clifford Wolf},
|
||||
author = {C. Wolf},
|
||||
title = {Evaluation of Open Source Verilog Synthesis Tools for Feature-Completeness and Extensibility},
|
||||
note = {Unpublished Student Research Paper, Vienna University of Technology},
|
||||
year = {2012}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
% Hyperlinks
|
||||
\usepackage[colorlinks,hyperindex,plainpages=false,%
|
||||
pdftitle={Yosys Manual},%
|
||||
pdfauthor={Clifford Wolf},%
|
||||
pdfauthor={Claire Xenia Wolf},%
|
||||
%pdfkeywords={keyword},%
|
||||
pdfpagelabels,%
|
||||
pagebackref,%
|
||||
|
@ -137,7 +137,7 @@ bookmarksopen=false%
|
|||
\bf\Huge Yosys Manual
|
||||
|
||||
\bigskip
|
||||
\large Clifford Wolf
|
||||
\large Claire Xenia Wolf
|
||||
\end{center}
|
||||
|
||||
\vfil\null
|
||||
|
|
|
@ -80,8 +80,8 @@
|
|||
\end{centering}}
|
||||
|
||||
\title{Yosys Open SYnthesis Suite}
|
||||
\author{Clifford Wolf}
|
||||
\institute{http://yosyshq.net/yosys/}
|
||||
\author{Claire Xenia Wolf}
|
||||
\institute{https://yosyshq.net/yosys/}
|
||||
|
||||
\usetheme{Madrid}
|
||||
\usecolortheme{seagull}
|
||||
|
@ -124,7 +124,7 @@ writing extensions to Yosys using the C++ API.
|
|||
|
||||
\section{About me}
|
||||
\begin{frame}{About me}
|
||||
Hi! I'm Clifford Wolf.
|
||||
Hi! I'm Claire Xenia Wolf.
|
||||
|
||||
\bigskip
|
||||
I like writing open source software. For example:
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
@misc{YosysGit,
|
||||
author = {Clifford Wolf},
|
||||
author = {Claire Xenia Wolf},
|
||||
title = {{Yosys Open SYnthesis Suite (YOSYS)}},
|
||||
note = {\url{http://github.com/cliffordwolf/yosys}}
|
||||
note = {\url{http://github.com/YosysHQ/yosys}}
|
||||
}
|
||||
|
||||
@misc{YosysTestsGit,
|
||||
author = {Clifford Wolf},
|
||||
author = {Claire Xenia Wolf},
|
||||
title = {{Yosys Test Bench}},
|
||||
note = {\url{http://github.com/cliffordwolf/yosys-tests}}
|
||||
note = {\url{http://github.com/YosysHQ/yosys-tests}}
|
||||
}
|
||||
|
||||
@misc{VlogHammer,
|
||||
author = {Clifford Wolf},
|
||||
author = {Claire Xenia Wolf},
|
||||
title = {{VlogHammer Verilog Synthesis Regression Tests}},
|
||||
note = {\url{http://github.com/cliffordwolf/VlogHammer}}
|
||||
note = {\url{http://github.com/YosysHQ/VlogHammer}}
|
||||
}
|
||||
|
||||
@misc{Icarus,
|
||||
|
|
|
@ -6,7 +6,7 @@ yosysver="$2"
|
|||
gitsha="$3"
|
||||
|
||||
rm -rf YosysVS-Tpl-v2.zip YosysVS
|
||||
wget http://yosyshq.net/yosys/nogit/YosysVS-Tpl-v2.zip
|
||||
wget https://yosyshq.net/yosys/nogit/YosysVS-Tpl-v2.zip
|
||||
|
||||
unzip YosysVS-Tpl-v2.zip
|
||||
rm -f YosysVS-Tpl-v2.zip
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
|
||||
// [[CITE]] VlogHammer Verilog Regression Test Suite
|
||||
// http://yosyshq.net/yosys/vloghammer.html
|
||||
// https://yosyshq.net/yosys/vloghammer.html
|
||||
|
||||
#include "kernel/register.h"
|
||||
#include "kernel/celltypes.h"
|
||||
|
|
|
@ -1,318 +1,318 @@
|
|||
/*
|
||||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
||||
* 2019 Eddie Hung <eddie@fpgeh.com>
|
||||
* 2019 David Shah <dave@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* Tech-mapping rules for decomposing arbitrarily-sized $mul cells
|
||||
* into an equivalent collection of smaller `DSP_NAME cells (with the
|
||||
* same interface as $mul) no larger than `DSP_[AB]_MAXWIDTH, attached
|
||||
* to $shl and $add cells.
|
||||
*
|
||||
*/
|
||||
|
||||
`ifndef DSP_A_MAXWIDTH
|
||||
$fatal(1, "Macro DSP_A_MAXWIDTH must be defined");
|
||||
`endif
|
||||
`ifndef DSP_B_MAXWIDTH
|
||||
$fatal(1, "Macro DSP_B_MAXWIDTH must be defined");
|
||||
`endif
|
||||
`ifndef DSP_B_MAXWIDTH
|
||||
$fatal(1, "Macro DSP_B_MAXWIDTH must be defined");
|
||||
`endif
|
||||
`ifndef DSP_A_MAXWIDTH_PARTIAL
|
||||
`define DSP_A_MAXWIDTH_PARTIAL `DSP_A_MAXWIDTH
|
||||
`endif
|
||||
`ifndef DSP_B_MAXWIDTH_PARTIAL
|
||||
`define DSP_B_MAXWIDTH_PARTIAL `DSP_B_MAXWIDTH
|
||||
`endif
|
||||
|
||||
`ifndef DSP_NAME
|
||||
$fatal(1, "Macro DSP_NAME must be defined");
|
||||
`endif
|
||||
|
||||
`define MAX(a,b) (a > b ? a : b)
|
||||
`define MIN(a,b) (a < b ? a : b)
|
||||
|
||||
(* techmap_celltype = "$mul $__mul" *)
|
||||
module _80_mul (A, B, Y);
|
||||
parameter A_SIGNED = 0;
|
||||
parameter B_SIGNED = 0;
|
||||
parameter A_WIDTH = 1;
|
||||
parameter B_WIDTH = 1;
|
||||
parameter Y_WIDTH = 1;
|
||||
|
||||
(* force_downto *)
|
||||
input [A_WIDTH-1:0] A;
|
||||
(* force_downto *)
|
||||
input [B_WIDTH-1:0] B;
|
||||
(* force_downto *)
|
||||
output [Y_WIDTH-1:0] Y;
|
||||
|
||||
parameter _TECHMAP_CELLTYPE_ = "";
|
||||
|
||||
generate
|
||||
if (0) begin end
|
||||
`ifdef DSP_A_MINWIDTH
|
||||
else if (A_WIDTH < `DSP_A_MINWIDTH)
|
||||
wire _TECHMAP_FAIL_ = 1;
|
||||
`endif
|
||||
`ifdef DSP_B_MINWIDTH
|
||||
else if (B_WIDTH < `DSP_B_MINWIDTH)
|
||||
wire _TECHMAP_FAIL_ = 1;
|
||||
`endif
|
||||
`ifdef DSP_Y_MINWIDTH
|
||||
else if (Y_WIDTH < `DSP_Y_MINWIDTH)
|
||||
wire _TECHMAP_FAIL_ = 1;
|
||||
`endif
|
||||
`ifdef DSP_SIGNEDONLY
|
||||
else if (_TECHMAP_CELLTYPE_ == "$mul" && !A_SIGNED && !B_SIGNED)
|
||||
\$mul #(
|
||||
.A_SIGNED(1),
|
||||
.B_SIGNED(1),
|
||||
.A_WIDTH(A_WIDTH + 1),
|
||||
.B_WIDTH(B_WIDTH + 1),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A({1'b0, A}),
|
||||
.B({1'b0, B}),
|
||||
.Y(Y)
|
||||
);
|
||||
`endif
|
||||
else if (_TECHMAP_CELLTYPE_ == "$mul" && A_WIDTH < B_WIDTH)
|
||||
\$mul #(
|
||||
.A_SIGNED(B_SIGNED),
|
||||
.B_SIGNED(A_SIGNED),
|
||||
.A_WIDTH(B_WIDTH),
|
||||
.B_WIDTH(A_WIDTH),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(B),
|
||||
.B(A),
|
||||
.Y(Y)
|
||||
);
|
||||
else begin
|
||||
wire [1023:0] _TECHMAP_DO_ = "proc; clean";
|
||||
|
||||
`ifdef DSP_SIGNEDONLY
|
||||
localparam sign_headroom = 1;
|
||||
`else
|
||||
localparam sign_headroom = 0;
|
||||
`endif
|
||||
|
||||
genvar i;
|
||||
if (A_WIDTH > `DSP_A_MAXWIDTH) begin
|
||||
localparam n = (A_WIDTH-`DSP_A_MAXWIDTH+`DSP_A_MAXWIDTH_PARTIAL-sign_headroom-1) / (`DSP_A_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam partial_Y_WIDTH = `MIN(Y_WIDTH, B_WIDTH+`DSP_A_MAXWIDTH_PARTIAL);
|
||||
localparam last_A_WIDTH = A_WIDTH-n*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam last_Y_WIDTH = B_WIDTH+last_A_WIDTH;
|
||||
if (A_SIGNED && B_SIGNED) begin : blk
|
||||
(* force_downto *)
|
||||
wire signed [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire signed [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire signed [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
else begin : blk
|
||||
(* force_downto *)
|
||||
wire [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
|
||||
for (i = 0; i < n; i=i+1) begin:sliceA
|
||||
\$__mul #(
|
||||
.A_SIGNED(sign_headroom),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(`DSP_A_MAXWIDTH_PARTIAL),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(partial_Y_WIDTH)
|
||||
) mul (
|
||||
.A({{sign_headroom{1'b0}}, A[i*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom) +: `DSP_A_MAXWIDTH_PARTIAL-sign_headroom]}),
|
||||
.B(B),
|
||||
.Y(blk.partial[i])
|
||||
);
|
||||
// TODO: Currently a 'cascade' approach to summing the partial
|
||||
// products is taken here, but a more efficient 'binary
|
||||
// reduction' approach also exists...
|
||||
if (i == 0)
|
||||
assign blk.partial_sum[i] = blk.partial[i];
|
||||
else
|
||||
assign blk.partial_sum[i] = (blk.partial[i] << (* mul2dsp *) i*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[i-1];
|
||||
end
|
||||
|
||||
\$__mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(last_A_WIDTH),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(last_Y_WIDTH)
|
||||
) sliceA.last (
|
||||
.A(A[A_WIDTH-1 -: last_A_WIDTH]),
|
||||
.B(B),
|
||||
.Y(blk.last_partial)
|
||||
);
|
||||
assign blk.partial_sum[n] = (blk.last_partial << (* mul2dsp *) n*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[n-1];
|
||||
assign Y = blk.partial_sum[n];
|
||||
end
|
||||
else if (B_WIDTH > `DSP_B_MAXWIDTH) begin
|
||||
localparam n = (B_WIDTH-`DSP_B_MAXWIDTH+`DSP_B_MAXWIDTH_PARTIAL-sign_headroom-1) / (`DSP_B_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam partial_Y_WIDTH = `MIN(Y_WIDTH, A_WIDTH+`DSP_B_MAXWIDTH_PARTIAL);
|
||||
localparam last_B_WIDTH = B_WIDTH-n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam last_Y_WIDTH = A_WIDTH+last_B_WIDTH;
|
||||
if (A_SIGNED && B_SIGNED) begin : blk
|
||||
(* force_downto *)
|
||||
wire signed [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire signed [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire signed [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
else begin : blk
|
||||
(* force_downto *)
|
||||
wire [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
|
||||
for (i = 0; i < n; i=i+1) begin:sliceB
|
||||
\$__mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(sign_headroom),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(`DSP_B_MAXWIDTH_PARTIAL),
|
||||
.Y_WIDTH(partial_Y_WIDTH)
|
||||
) mul (
|
||||
.A(A),
|
||||
.B({{sign_headroom{1'b0}}, B[i*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom) +: `DSP_B_MAXWIDTH_PARTIAL-sign_headroom]}),
|
||||
.Y(blk.partial[i])
|
||||
);
|
||||
// TODO: Currently a 'cascade' approach to summing the partial
|
||||
// products is taken here, but a more efficient 'binary
|
||||
// reduction' approach also exists...
|
||||
if (i == 0)
|
||||
assign blk.partial_sum[i] = blk.partial[i];
|
||||
else
|
||||
assign blk.partial_sum[i] = (blk.partial[i] << (* mul2dsp *) i*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[i-1];
|
||||
end
|
||||
|
||||
\$__mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(last_B_WIDTH),
|
||||
.Y_WIDTH(last_Y_WIDTH)
|
||||
) mul_sliceB_last (
|
||||
.A(A),
|
||||
.B(B[B_WIDTH-1 -: last_B_WIDTH]),
|
||||
.Y(blk.last_partial)
|
||||
);
|
||||
assign blk.partial_sum[n] = (blk.last_partial << (* mul2dsp *) n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[n-1];
|
||||
assign Y = blk.partial_sum[n];
|
||||
end
|
||||
else begin
|
||||
if (A_SIGNED) begin : blkA
|
||||
wire signed [`DSP_A_MAXWIDTH-1:0] Aext = $signed(A);
|
||||
end
|
||||
else begin : blkA
|
||||
wire [`DSP_A_MAXWIDTH-1:0] Aext = A;
|
||||
end
|
||||
if (B_SIGNED) begin : blkB
|
||||
wire signed [`DSP_B_MAXWIDTH-1:0] Bext = $signed(B);
|
||||
end
|
||||
else begin : blkB
|
||||
wire [`DSP_B_MAXWIDTH-1:0] Bext = B;
|
||||
end
|
||||
|
||||
`DSP_NAME #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(`DSP_A_MAXWIDTH),
|
||||
.B_WIDTH(`DSP_B_MAXWIDTH),
|
||||
.Y_WIDTH(`MIN(Y_WIDTH,`DSP_A_MAXWIDTH+`DSP_B_MAXWIDTH)),
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(blkA.Aext),
|
||||
.B(blkB.Bext),
|
||||
.Y(Y)
|
||||
);
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
endmodule
|
||||
|
||||
(* techmap_celltype = "$mul $__mul" *)
|
||||
module _90_soft_mul (A, B, Y);
|
||||
parameter A_SIGNED = 0;
|
||||
parameter B_SIGNED = 0;
|
||||
parameter A_WIDTH = 1;
|
||||
parameter B_WIDTH = 1;
|
||||
parameter Y_WIDTH = 1;
|
||||
|
||||
(* force_downto *)
|
||||
input [A_WIDTH-1:0] A;
|
||||
(* force_downto *)
|
||||
input [B_WIDTH-1:0] B;
|
||||
(* force_downto *)
|
||||
output [Y_WIDTH-1:0] Y;
|
||||
|
||||
// Indirection necessary since mapping
|
||||
// back to $mul will cause recursion
|
||||
generate
|
||||
if (A_SIGNED && !B_SIGNED)
|
||||
\$__soft_mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(1),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(B_WIDTH+1),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(A),
|
||||
.B({1'b0,B}),
|
||||
.Y(Y)
|
||||
);
|
||||
else if (!A_SIGNED && B_SIGNED)
|
||||
\$__soft_mul #(
|
||||
.A_SIGNED(1),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(A_WIDTH+1),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A({1'b0,A}),
|
||||
.B(B),
|
||||
.Y(Y)
|
||||
);
|
||||
else
|
||||
\$__soft_mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(A),
|
||||
.B(B),
|
||||
.Y(Y)
|
||||
);
|
||||
endgenerate
|
||||
endmodule
|
||||
/*
|
||||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
||||
* 2019 Eddie Hung <eddie@fpgeh.com>
|
||||
* 2019 gatecat <gatecat@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* ---
|
||||
*
|
||||
* Tech-mapping rules for decomposing arbitrarily-sized $mul cells
|
||||
* into an equivalent collection of smaller `DSP_NAME cells (with the
|
||||
* same interface as $mul) no larger than `DSP_[AB]_MAXWIDTH, attached
|
||||
* to $shl and $add cells.
|
||||
*
|
||||
*/
|
||||
|
||||
`ifndef DSP_A_MAXWIDTH
|
||||
$fatal(1, "Macro DSP_A_MAXWIDTH must be defined");
|
||||
`endif
|
||||
`ifndef DSP_B_MAXWIDTH
|
||||
$fatal(1, "Macro DSP_B_MAXWIDTH must be defined");
|
||||
`endif
|
||||
`ifndef DSP_B_MAXWIDTH
|
||||
$fatal(1, "Macro DSP_B_MAXWIDTH must be defined");
|
||||
`endif
|
||||
`ifndef DSP_A_MAXWIDTH_PARTIAL
|
||||
`define DSP_A_MAXWIDTH_PARTIAL `DSP_A_MAXWIDTH
|
||||
`endif
|
||||
`ifndef DSP_B_MAXWIDTH_PARTIAL
|
||||
`define DSP_B_MAXWIDTH_PARTIAL `DSP_B_MAXWIDTH
|
||||
`endif
|
||||
|
||||
`ifndef DSP_NAME
|
||||
$fatal(1, "Macro DSP_NAME must be defined");
|
||||
`endif
|
||||
|
||||
`define MAX(a,b) (a > b ? a : b)
|
||||
`define MIN(a,b) (a < b ? a : b)
|
||||
|
||||
(* techmap_celltype = "$mul $__mul" *)
|
||||
module _80_mul (A, B, Y);
|
||||
parameter A_SIGNED = 0;
|
||||
parameter B_SIGNED = 0;
|
||||
parameter A_WIDTH = 1;
|
||||
parameter B_WIDTH = 1;
|
||||
parameter Y_WIDTH = 1;
|
||||
|
||||
(* force_downto *)
|
||||
input [A_WIDTH-1:0] A;
|
||||
(* force_downto *)
|
||||
input [B_WIDTH-1:0] B;
|
||||
(* force_downto *)
|
||||
output [Y_WIDTH-1:0] Y;
|
||||
|
||||
parameter _TECHMAP_CELLTYPE_ = "";
|
||||
|
||||
generate
|
||||
if (0) begin end
|
||||
`ifdef DSP_A_MINWIDTH
|
||||
else if (A_WIDTH < `DSP_A_MINWIDTH)
|
||||
wire _TECHMAP_FAIL_ = 1;
|
||||
`endif
|
||||
`ifdef DSP_B_MINWIDTH
|
||||
else if (B_WIDTH < `DSP_B_MINWIDTH)
|
||||
wire _TECHMAP_FAIL_ = 1;
|
||||
`endif
|
||||
`ifdef DSP_Y_MINWIDTH
|
||||
else if (Y_WIDTH < `DSP_Y_MINWIDTH)
|
||||
wire _TECHMAP_FAIL_ = 1;
|
||||
`endif
|
||||
`ifdef DSP_SIGNEDONLY
|
||||
else if (_TECHMAP_CELLTYPE_ == "$mul" && !A_SIGNED && !B_SIGNED)
|
||||
\$mul #(
|
||||
.A_SIGNED(1),
|
||||
.B_SIGNED(1),
|
||||
.A_WIDTH(A_WIDTH + 1),
|
||||
.B_WIDTH(B_WIDTH + 1),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A({1'b0, A}),
|
||||
.B({1'b0, B}),
|
||||
.Y(Y)
|
||||
);
|
||||
`endif
|
||||
else if (_TECHMAP_CELLTYPE_ == "$mul" && A_WIDTH < B_WIDTH)
|
||||
\$mul #(
|
||||
.A_SIGNED(B_SIGNED),
|
||||
.B_SIGNED(A_SIGNED),
|
||||
.A_WIDTH(B_WIDTH),
|
||||
.B_WIDTH(A_WIDTH),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(B),
|
||||
.B(A),
|
||||
.Y(Y)
|
||||
);
|
||||
else begin
|
||||
wire [1023:0] _TECHMAP_DO_ = "proc; clean";
|
||||
|
||||
`ifdef DSP_SIGNEDONLY
|
||||
localparam sign_headroom = 1;
|
||||
`else
|
||||
localparam sign_headroom = 0;
|
||||
`endif
|
||||
|
||||
genvar i;
|
||||
if (A_WIDTH > `DSP_A_MAXWIDTH) begin
|
||||
localparam n = (A_WIDTH-`DSP_A_MAXWIDTH+`DSP_A_MAXWIDTH_PARTIAL-sign_headroom-1) / (`DSP_A_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam partial_Y_WIDTH = `MIN(Y_WIDTH, B_WIDTH+`DSP_A_MAXWIDTH_PARTIAL);
|
||||
localparam last_A_WIDTH = A_WIDTH-n*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam last_Y_WIDTH = B_WIDTH+last_A_WIDTH;
|
||||
if (A_SIGNED && B_SIGNED) begin : blk
|
||||
(* force_downto *)
|
||||
wire signed [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire signed [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire signed [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
else begin : blk
|
||||
(* force_downto *)
|
||||
wire [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
|
||||
for (i = 0; i < n; i=i+1) begin:sliceA
|
||||
\$__mul #(
|
||||
.A_SIGNED(sign_headroom),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(`DSP_A_MAXWIDTH_PARTIAL),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(partial_Y_WIDTH)
|
||||
) mul (
|
||||
.A({{sign_headroom{1'b0}}, A[i*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom) +: `DSP_A_MAXWIDTH_PARTIAL-sign_headroom]}),
|
||||
.B(B),
|
||||
.Y(blk.partial[i])
|
||||
);
|
||||
// TODO: Currently a 'cascade' approach to summing the partial
|
||||
// products is taken here, but a more efficient 'binary
|
||||
// reduction' approach also exists...
|
||||
if (i == 0)
|
||||
assign blk.partial_sum[i] = blk.partial[i];
|
||||
else
|
||||
assign blk.partial_sum[i] = (blk.partial[i] << (* mul2dsp *) i*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[i-1];
|
||||
end
|
||||
|
||||
\$__mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(last_A_WIDTH),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(last_Y_WIDTH)
|
||||
) sliceA.last (
|
||||
.A(A[A_WIDTH-1 -: last_A_WIDTH]),
|
||||
.B(B),
|
||||
.Y(blk.last_partial)
|
||||
);
|
||||
assign blk.partial_sum[n] = (blk.last_partial << (* mul2dsp *) n*(`DSP_A_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[n-1];
|
||||
assign Y = blk.partial_sum[n];
|
||||
end
|
||||
else if (B_WIDTH > `DSP_B_MAXWIDTH) begin
|
||||
localparam n = (B_WIDTH-`DSP_B_MAXWIDTH+`DSP_B_MAXWIDTH_PARTIAL-sign_headroom-1) / (`DSP_B_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam partial_Y_WIDTH = `MIN(Y_WIDTH, A_WIDTH+`DSP_B_MAXWIDTH_PARTIAL);
|
||||
localparam last_B_WIDTH = B_WIDTH-n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom);
|
||||
localparam last_Y_WIDTH = A_WIDTH+last_B_WIDTH;
|
||||
if (A_SIGNED && B_SIGNED) begin : blk
|
||||
(* force_downto *)
|
||||
wire signed [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire signed [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire signed [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
else begin : blk
|
||||
(* force_downto *)
|
||||
wire [partial_Y_WIDTH-1:0] partial [n-1:0];
|
||||
(* force_downto *)
|
||||
wire [last_Y_WIDTH-1:0] last_partial;
|
||||
(* force_downto *)
|
||||
wire [Y_WIDTH-1:0] partial_sum [n:0];
|
||||
end
|
||||
|
||||
for (i = 0; i < n; i=i+1) begin:sliceB
|
||||
\$__mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(sign_headroom),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(`DSP_B_MAXWIDTH_PARTIAL),
|
||||
.Y_WIDTH(partial_Y_WIDTH)
|
||||
) mul (
|
||||
.A(A),
|
||||
.B({{sign_headroom{1'b0}}, B[i*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom) +: `DSP_B_MAXWIDTH_PARTIAL-sign_headroom]}),
|
||||
.Y(blk.partial[i])
|
||||
);
|
||||
// TODO: Currently a 'cascade' approach to summing the partial
|
||||
// products is taken here, but a more efficient 'binary
|
||||
// reduction' approach also exists...
|
||||
if (i == 0)
|
||||
assign blk.partial_sum[i] = blk.partial[i];
|
||||
else
|
||||
assign blk.partial_sum[i] = (blk.partial[i] << (* mul2dsp *) i*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[i-1];
|
||||
end
|
||||
|
||||
\$__mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(last_B_WIDTH),
|
||||
.Y_WIDTH(last_Y_WIDTH)
|
||||
) mul_sliceB_last (
|
||||
.A(A),
|
||||
.B(B[B_WIDTH-1 -: last_B_WIDTH]),
|
||||
.Y(blk.last_partial)
|
||||
);
|
||||
assign blk.partial_sum[n] = (blk.last_partial << (* mul2dsp *) n*(`DSP_B_MAXWIDTH_PARTIAL-sign_headroom)) + (* mul2dsp *) blk.partial_sum[n-1];
|
||||
assign Y = blk.partial_sum[n];
|
||||
end
|
||||
else begin
|
||||
if (A_SIGNED) begin : blkA
|
||||
wire signed [`DSP_A_MAXWIDTH-1:0] Aext = $signed(A);
|
||||
end
|
||||
else begin : blkA
|
||||
wire [`DSP_A_MAXWIDTH-1:0] Aext = A;
|
||||
end
|
||||
if (B_SIGNED) begin : blkB
|
||||
wire signed [`DSP_B_MAXWIDTH-1:0] Bext = $signed(B);
|
||||
end
|
||||
else begin : blkB
|
||||
wire [`DSP_B_MAXWIDTH-1:0] Bext = B;
|
||||
end
|
||||
|
||||
`DSP_NAME #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(`DSP_A_MAXWIDTH),
|
||||
.B_WIDTH(`DSP_B_MAXWIDTH),
|
||||
.Y_WIDTH(`MIN(Y_WIDTH,`DSP_A_MAXWIDTH+`DSP_B_MAXWIDTH)),
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(blkA.Aext),
|
||||
.B(blkB.Bext),
|
||||
.Y(Y)
|
||||
);
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
endmodule
|
||||
|
||||
(* techmap_celltype = "$mul $__mul" *)
|
||||
module _90_soft_mul (A, B, Y);
|
||||
parameter A_SIGNED = 0;
|
||||
parameter B_SIGNED = 0;
|
||||
parameter A_WIDTH = 1;
|
||||
parameter B_WIDTH = 1;
|
||||
parameter Y_WIDTH = 1;
|
||||
|
||||
(* force_downto *)
|
||||
input [A_WIDTH-1:0] A;
|
||||
(* force_downto *)
|
||||
input [B_WIDTH-1:0] B;
|
||||
(* force_downto *)
|
||||
output [Y_WIDTH-1:0] Y;
|
||||
|
||||
// Indirection necessary since mapping
|
||||
// back to $mul will cause recursion
|
||||
generate
|
||||
if (A_SIGNED && !B_SIGNED)
|
||||
\$__soft_mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(1),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(B_WIDTH+1),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(A),
|
||||
.B({1'b0,B}),
|
||||
.Y(Y)
|
||||
);
|
||||
else if (!A_SIGNED && B_SIGNED)
|
||||
\$__soft_mul #(
|
||||
.A_SIGNED(1),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(A_WIDTH+1),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A({1'b0,A}),
|
||||
.B(B),
|
||||
.Y(Y)
|
||||
);
|
||||
else
|
||||
\$__soft_mul #(
|
||||
.A_SIGNED(A_SIGNED),
|
||||
.B_SIGNED(B_SIGNED),
|
||||
.A_WIDTH(A_WIDTH),
|
||||
.B_WIDTH(B_WIDTH),
|
||||
.Y_WIDTH(Y_WIDTH)
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.A(A),
|
||||
.B(B),
|
||||
.Y(Y)
|
||||
);
|
||||
endgenerate
|
||||
endmodule
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
||||
* Copyright (C) 2018 David Shah <dave@ds0.me>
|
||||
* Copyright (C) 2018 gatecat <gatecat@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
||||
* Copyright (C) 2019 David Shah <dave@ds0.me>
|
||||
* Copyright (C) 2019 gatecat <gatecat@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
||||
* Copyright (C) 2018 David Shah <dave@ds0.me>
|
||||
* Copyright (C) 2018 gatecat <gatecat@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
||||
* Copyright (C) 2018 David Shah <dave@ds0.me>
|
||||
* Copyright (C) 2018 gatecat <gatecat@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
module __MISTRAL_M20K_SDP(CLK1, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN);
|
||||
|
||||
parameter CFG_ABITS = 10;
|
||||
parameter CFG_DBITS = 20;
|
||||
parameter CFG_ENABLE_A = 1;
|
||||
parameter CFG_ENABLE_B = 1;
|
||||
|
||||
input CLK1;
|
||||
input [CFG_ABITS-1:0] A1ADDR, B1ADDR;
|
||||
input [CFG_DBITS-1:0] A1DATA;
|
||||
output [CFG_DBITS-1:0] B1DATA;
|
||||
input [CFG_ENABLE_A-1:0] A1EN, B1EN;
|
||||
|
||||
altsyncram #(
|
||||
.operation_mode("dual_port"),
|
||||
.ram_block_type("m20k"),
|
||||
.widthad_a(CFG_ABITS),
|
||||
.width_a(CFG_DBITS),
|
||||
.widthad_b(CFG_ABITS),
|
||||
.width_b(CFG_DBITS),
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.address_a(A1ADDR),
|
||||
.data_a(A1DATA),
|
||||
.wren_a(A1EN),
|
||||
.address_b(B1ADDR),
|
||||
.q_b(B1DATA),
|
||||
.clock0(CLK1),
|
||||
.clock1(CLK1)
|
||||
);
|
||||
|
||||
endmodule
|
||||
module __MISTRAL_M20K_SDP(CLK1, A1ADDR, A1DATA, A1EN, B1ADDR, B1DATA, B1EN);
|
||||
|
||||
parameter CFG_ABITS = 10;
|
||||
parameter CFG_DBITS = 20;
|
||||
parameter CFG_ENABLE_A = 1;
|
||||
parameter CFG_ENABLE_B = 1;
|
||||
|
||||
input CLK1;
|
||||
input [CFG_ABITS-1:0] A1ADDR, B1ADDR;
|
||||
input [CFG_DBITS-1:0] A1DATA;
|
||||
output [CFG_DBITS-1:0] B1DATA;
|
||||
input [CFG_ENABLE_A-1:0] A1EN, B1EN;
|
||||
|
||||
altsyncram #(
|
||||
.operation_mode("dual_port"),
|
||||
.ram_block_type("m20k"),
|
||||
.widthad_a(CFG_ABITS),
|
||||
.width_a(CFG_DBITS),
|
||||
.widthad_b(CFG_ABITS),
|
||||
.width_b(CFG_DBITS),
|
||||
) _TECHMAP_REPLACE_ (
|
||||
.address_a(A1ADDR),
|
||||
.data_a(A1DATA),
|
||||
.wren_a(A1EN),
|
||||
.address_b(B1ADDR),
|
||||
.q_b(B1DATA),
|
||||
.clock0(CLK1),
|
||||
.clock1(CLK1)
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2012 Claire Xenia Wolf <claire@yosyshq.com>
|
||||
* Copyright (C) 2018 David Shah <dave@ds0.me>
|
||||
* Copyright (C) 2018 gatecat <gatecat@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* yosys -- Yosys Open SYnthesis Suite
|
||||
*
|
||||
* Copyright (C) 2020 David Shah <dave@ds0.me>
|
||||
* Copyright (C) 2020 gatecat <gatecat@ds0.me>
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module top ( out, clk, reset );
|
||||
output [7:0] out;
|
||||
input clk, reset;
|
||||
reg [7:0] out;
|
||||
|
||||
always @(posedge clk, posedge reset)
|
||||
if (reset)
|
||||
out <= 8'b0;
|
||||
else
|
||||
out <= out + 1;
|
||||
endmodule
|
||||
module top ( out, clk, reset );
|
||||
output [7:0] out;
|
||||
input clk, reset;
|
||||
reg [7:0] out;
|
||||
|
||||
always @(posedge clk, posedge reset)
|
||||
if (reset)
|
||||
out <= 8'b0;
|
||||
else
|
||||
out <= out + 1;
|
||||
endmodule
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
module fsm ( clock, reset, req_0, req_1, gnt_0, gnt_1 );
|
||||
input clock,reset,req_0,req_1;
|
||||
output gnt_0,gnt_1;
|
||||
wire clock,reset,req_0,req_1;
|
||||
reg gnt_0,gnt_1;
|
||||
|
||||
parameter SIZE = 3;
|
||||
parameter IDLE = 3'b001;
|
||||
parameter GNT0 = 3'b010;
|
||||
parameter GNT1 = 3'b100;
|
||||
parameter GNT2 = 3'b101;
|
||||
|
||||
reg [SIZE-1:0] state;
|
||||
reg [SIZE-1:0] next_state;
|
||||
|
||||
always @ (posedge clock)
|
||||
begin : FSM
|
||||
if (reset == 1'b1) begin
|
||||
state <= #1 IDLE;
|
||||
gnt_0 <= 0;
|
||||
gnt_1 <= 0;
|
||||
end
|
||||
else
|
||||
case(state)
|
||||
IDLE : if (req_0 == 1'b1) begin
|
||||
state <= #1 GNT0;
|
||||
gnt_0 <= 1;
|
||||
end else if (req_1 == 1'b1) begin
|
||||
gnt_1 <= 1;
|
||||
state <= #1 GNT0;
|
||||
end else begin
|
||||
state <= #1 IDLE;
|
||||
end
|
||||
GNT0 : if (req_0 == 1'b1) begin
|
||||
state <= #1 GNT0;
|
||||
end else begin
|
||||
gnt_0 <= 0;
|
||||
state <= #1 IDLE;
|
||||
end
|
||||
GNT1 : if (req_1 == 1'b1) begin
|
||||
state <= #1 GNT2;
|
||||
gnt_1 <= req_0;
|
||||
end
|
||||
GNT2 : if (req_0 == 1'b1) begin
|
||||
state <= #1 GNT1;
|
||||
gnt_1 <= req_1;
|
||||
end
|
||||
default : state <= #1 IDLE;
|
||||
endcase
|
||||
end
|
||||
endmodule
|
||||
module fsm ( clock, reset, req_0, req_1, gnt_0, gnt_1 );
|
||||
input clock,reset,req_0,req_1;
|
||||
output gnt_0,gnt_1;
|
||||
wire clock,reset,req_0,req_1;
|
||||
reg gnt_0,gnt_1;
|
||||
|
||||
parameter SIZE = 3;
|
||||
parameter IDLE = 3'b001;
|
||||
parameter GNT0 = 3'b010;
|
||||
parameter GNT1 = 3'b100;
|
||||
parameter GNT2 = 3'b101;
|
||||
|
||||
reg [SIZE-1:0] state;
|
||||
reg [SIZE-1:0] next_state;
|
||||
|
||||
always @ (posedge clock)
|
||||
begin : FSM
|
||||
if (reset == 1'b1) begin
|
||||
state <= #1 IDLE;
|
||||
gnt_0 <= 0;
|
||||
gnt_1 <= 0;
|
||||
end
|
||||
else
|
||||
case(state)
|
||||
IDLE : if (req_0 == 1'b1) begin
|
||||
state <= #1 GNT0;
|
||||
gnt_0 <= 1;
|
||||
end else if (req_1 == 1'b1) begin
|
||||
gnt_1 <= 1;
|
||||
state <= #1 GNT0;
|
||||
end else begin
|
||||
state <= #1 IDLE;
|
||||
end
|
||||
GNT0 : if (req_0 == 1'b1) begin
|
||||
state <= #1 GNT0;
|
||||
end else begin
|
||||
gnt_0 <= 0;
|
||||
state <= #1 IDLE;
|
||||
end
|
||||
GNT1 : if (req_1 == 1'b1) begin
|
||||
state <= #1 GNT2;
|
||||
gnt_1 <= req_0;
|
||||
end
|
||||
GNT2 : if (req_0 == 1'b1) begin
|
||||
state <= #1 GNT1;
|
||||
gnt_1 <= req_1;
|
||||
end
|
||||
default : state <= #1 IDLE;
|
||||
endcase
|
||||
end
|
||||
endmodule
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
module top(out, clk, in);
|
||||
output [7:0] out;
|
||||
input signed clk, in;
|
||||
reg signed [7:0] out = 0;
|
||||
|
||||
always @(posedge clk)
|
||||
begin
|
||||
out <= out >> 1;
|
||||
out[7] <= in;
|
||||
end
|
||||
endmodule
|
||||
module top(out, clk, in);
|
||||
output [7:0] out;
|
||||
input signed clk, in;
|
||||
reg signed [7:0] out = 0;
|
||||
|
||||
always @(posedge clk)
|
||||
begin
|
||||
out <= out >> 1;
|
||||
out[7] <= in;
|
||||
end
|
||||
endmodule
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
// test cases found using vloghammer
|
||||
// https://github.com/cliffordwolf/VlogHammer
|
||||
// https://github.com/YosysHQ/VlogHammer
|
||||
|
||||
module test01(a, y);
|
||||
input [7:0] a;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
set -ex
|
||||
|
||||
rm -rf Makefile refdat rtl scripts spec
|
||||
wget -N http://yosyshq.net/yosys/nogit/vloghammer_tb.tar.bz2
|
||||
wget -N https://yosyshq.net/yosys/nogit/vloghammer_tb.tar.bz2
|
||||
tar --strip=1 -xjf vloghammer_tb.tar.bz2
|
||||
|
||||
make clean
|
||||
|
|
Loading…
Reference in New Issue