mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Progress in presentation
This commit is contained in:
		
							parent
							
								
									7ac524e8e8
								
							
						
					
					
						commit
						9c29969bbc
					
				
					 6 changed files with 114 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -239,6 +239,51 @@ show -color red @cone_ab -color magenta @cone_a -color blue @cone_b
 | 
			
		|||
\subsectionpagesuffix
 | 
			
		||||
\end{frame}
 | 
			
		||||
 | 
			
		||||
\subsubsection{Introduction to techmap}
 | 
			
		||||
 | 
			
		||||
\begin{frame}{\subsubsecname}
 | 
			
		||||
\begin{itemize}
 | 
			
		||||
\item
 | 
			
		||||
The {\tt techmap} command replaces cells in the design with implementations given
 | 
			
		||||
as verilog code (called ``map files''). It can replace Yosys' internal cell
 | 
			
		||||
types (such as {\tt \$or}) as well as user-defined cell types.
 | 
			
		||||
\medskip\item
 | 
			
		||||
Verilog parameters are used extensively to customize the internal cell types.
 | 
			
		||||
\medskip\item
 | 
			
		||||
Additional special parameters are used by techmap to communicate meta-data to the
 | 
			
		||||
map files.
 | 
			
		||||
\medskip\item
 | 
			
		||||
Special wires are used to instruct techmap how to handle a module in the map file.
 | 
			
		||||
\medskip\item
 | 
			
		||||
Generate blocks and recursion are powerful tools for writing map files.
 | 
			
		||||
\end{itemize}
 | 
			
		||||
\end{frame}
 | 
			
		||||
 | 
			
		||||
\begin{frame}[t]{\subsubsecname -- Example 1/2}
 | 
			
		||||
\vskip-0.2cm
 | 
			
		||||
To map the Verilog OR-reduction operator to 3-input OR gates:
 | 
			
		||||
\vskip-0.2cm
 | 
			
		||||
\begin{columns}
 | 
			
		||||
\column[t]{0.35\linewidth}
 | 
			
		||||
\lstinputlisting[xleftmargin=0.5cm, basicstyle=\ttfamily\fontsize{7pt}{8pt}\selectfont, language=verilog, lastline=24]{PRESENTATION_ExAdv/red_or3x1_map.v}
 | 
			
		||||
\column[t]{0.65\linewidth}
 | 
			
		||||
\lstinputlisting[xleftmargin=0.5cm, basicstyle=\ttfamily\fontsize{7pt}{8pt}\selectfont, language=verilog, firstline=25]{PRESENTATION_ExAdv/red_or3x1_map.v}
 | 
			
		||||
\end{columns}
 | 
			
		||||
\end{frame}
 | 
			
		||||
 | 
			
		||||
\begin{frame}[t]{\subsubsecname -- Example 2/2}
 | 
			
		||||
\vbox to 0cm{
 | 
			
		||||
\hfil\includegraphics[width=10cm,trim=0 0cm 0 0cm]{PRESENTATION_ExAdv/red_or3x1.pdf}
 | 
			
		||||
\vss
 | 
			
		||||
}
 | 
			
		||||
\begin{columns}
 | 
			
		||||
\column[t]{6cm}
 | 
			
		||||
\column[t]{4cm}
 | 
			
		||||
\vskip-0.6cm\lstinputlisting[basicstyle=\ttfamily\fontsize{8pt}{10pt}\selectfont, language=ys, firstline=4, lastline=4, frame=single]{PRESENTATION_ExAdv/red_or3x1_test.ys}
 | 
			
		||||
\vskip-0.2cm\lstinputlisting[basicstyle=\ttfamily\fontsize{8pt}{10pt}\selectfont, language=verilog]{PRESENTATION_ExAdv/red_or3x1_test.v}
 | 
			
		||||
\end{columns}
 | 
			
		||||
\end{frame}
 | 
			
		||||
 | 
			
		||||
\subsubsection{TBD}
 | 
			
		||||
 | 
			
		||||
\begin{frame}{\subsubsecname}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,9 @@
 | 
			
		|||
 | 
			
		||||
all: select_01.pdf
 | 
			
		||||
all: select_01.pdf red_or3x1.pdf
 | 
			
		||||
 | 
			
		||||
select_01.pdf: select_01.v select_01.ys
 | 
			
		||||
	../../yosys select_01.ys
 | 
			
		||||
 | 
			
		||||
red_or3x1.pdf: red_or3x1_*
 | 
			
		||||
	../../yosys red_or3x1_test.ys
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_cells.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_cells.v
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
module OR3X1(A, B, C, Y);
 | 
			
		||||
    input A, B, C;
 | 
			
		||||
    output Y;
 | 
			
		||||
    assign Y = A | B | C;
 | 
			
		||||
endmodule
 | 
			
		||||
							
								
								
									
										48
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_map.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_map.v
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,48 @@
 | 
			
		|||
module \$reduce_or (A, Y);
 | 
			
		||||
 | 
			
		||||
    parameter A_SIGNED = 0;
 | 
			
		||||
    parameter A_WIDTH = 0;
 | 
			
		||||
    parameter Y_WIDTH = 0;
 | 
			
		||||
    
 | 
			
		||||
    input [A_WIDTH-1:0] A;
 | 
			
		||||
    output [Y_WIDTH-1:0] Y;
 | 
			
		||||
    
 | 
			
		||||
    function integer min;
 | 
			
		||||
        input integer a, b;
 | 
			
		||||
        begin
 | 
			
		||||
            if (a < b)
 | 
			
		||||
                min = a;
 | 
			
		||||
            else
 | 
			
		||||
                min = b;
 | 
			
		||||
        end
 | 
			
		||||
    endfunction
 | 
			
		||||
    
 | 
			
		||||
    genvar i;
 | 
			
		||||
    generate begin
 | 
			
		||||
        if (A_WIDTH == 0) begin
 | 
			
		||||
            assign Y = 0;
 | 
			
		||||
        end
 | 
			
		||||
        if (A_WIDTH == 1) begin
 | 
			
		||||
            assign Y = A;
 | 
			
		||||
        end
 | 
			
		||||
        if (A_WIDTH == 2) begin
 | 
			
		||||
            wire ybuf;
 | 
			
		||||
            OR3X1 g (.A(A[0]), .B(A[1]), .C(1'b0), .Y(ybuf));
 | 
			
		||||
            assign Y = ybuf;
 | 
			
		||||
        end
 | 
			
		||||
        if (A_WIDTH == 3) begin
 | 
			
		||||
            wire ybuf;
 | 
			
		||||
            OR3X1 g (.A(A[0]), .B(A[1]), .C(A[2]), .Y(ybuf));
 | 
			
		||||
            assign Y = ybuf;
 | 
			
		||||
        end
 | 
			
		||||
        if (A_WIDTH > 3) begin
 | 
			
		||||
            localparam next_stage_sz = (A_WIDTH+2) / 3;
 | 
			
		||||
            wire [next_stage_sz-1:0] next_stage;
 | 
			
		||||
            for (i = 0; i < next_stage_sz; i = i+1) begin
 | 
			
		||||
                localparam bits = min(A_WIDTH - 3*i, 3);
 | 
			
		||||
                assign next_stage[i] = |A[3*i +: bits];
 | 
			
		||||
            end
 | 
			
		||||
            assign Y = |next_stage;
 | 
			
		||||
        end
 | 
			
		||||
    end endgenerate
 | 
			
		||||
endmodule
 | 
			
		||||
							
								
								
									
										5
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_test.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_test.v
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
module test (A, Y);
 | 
			
		||||
    input [6:0] A;
 | 
			
		||||
    output Y;
 | 
			
		||||
    assign Y = |A;
 | 
			
		||||
endmodule
 | 
			
		||||
							
								
								
									
										7
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_test.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								manual/PRESENTATION_ExAdv/red_or3x1_test.ys
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,7 @@
 | 
			
		|||
read_verilog red_or3x1_test.v
 | 
			
		||||
hierarchy -check -top test
 | 
			
		||||
 | 
			
		||||
techmap -map red_or3x1_map.v;;
 | 
			
		||||
 | 
			
		||||
splitnets -ports
 | 
			
		||||
show -prefix red_or3x1 -format pdf -notitle -lib red_or3x1_cells.v
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue