ch12.4.htm

来自「介绍asci设计的一本书」· HTM 代码 · 共 1,301 行 · 第 1/3 页

HTM
1,301
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML EXPERIMENTAL 970324//EN">

<HTML>

<HEAD>

<META NAME="GENERATOR" CONTENT="Adobe FrameMaker 5.5/HTML Export Filter">



<TITLE> 12.4&nbsp;Synthesis of the Viterbi Decoder</TITLE></HEAD><!--#include file="top.html"--><!--#include file="header.html"-->



<DIV>

<P>[&nbsp;<A HREF="CH12.htm">Chapter&nbsp;start</A>&nbsp;]&nbsp;[&nbsp;<A HREF="CH12.3.htm">Previous&nbsp;page</A>&nbsp;]&nbsp;[&nbsp;<A HREF="CH12.5.htm">Next&nbsp;page</A>&nbsp;]</P><!--#include file="AmazonAsic.html"--><HR></DIV>

<H1 CLASS="Heading1">

<A NAME="pgfId=263607">

 </A>

12.4&nbsp;<A NAME="29176">

 </A>

Synthesis of the Viterbi Decoder</H1>

<P CLASS="BodyAfterHead">

<A NAME="pgfId=284493">

 </A>

In this section we return to the Viterbi decoder from Chapter&nbsp;11. After an initial synthesis run that shows how logic synthesis works with a real example, we step back and study some of the issues and problems of using HDLs for logic synthesis.</P>

<DIV>

<H2 CLASS="Heading2">

<A NAME="pgfId=284375">

 </A>

12.4.1&nbsp;ASIC I/O</H2>

<P CLASS="BodyAfterHead">

<A NAME="pgfId=284376">

 </A>

Some logic synthesizers can include I/O cells automatically, but the designer may have to use directives to designate special pads (clock buffers, for example). It may also be necessary to use commands to set I/O cell features such as selection of pull-up resistor, slew rate, and so on. Unfortunately there are no standards in this area. Worse, there is currently no accepted way to set these parameters from an HDL. Designers may also use either generic technology-independent I/O models or instantiate I/O cells directly from an I/O cell library. Thus, for example, in the Compass tools the statement</P>

<P CLASS="ComputerOneLine">

<A NAME="pgfId=284378">

 </A>

	asPadIn 					#(3,&quot;1,2,3&quot;) u0 (in0, padin0);</P>

<P CLASS="BodyAfterHead">

<A NAME="pgfId=284379">

 </A>

uses a generic I/O cell model, <SPAN CLASS="BodyComputer">

asPadIn</SPAN>

. This statement will generate three input pads (with pin numbers <SPAN CLASS="BodyComputer">

&quot;1&quot;</SPAN>

, <SPAN CLASS="BodyComputer">

&quot;2&quot;</SPAN>

, and <SPAN CLASS="BodyComputer">

&quot;3&quot;</SPAN>

) if <SPAN CLASS="BodyComputer">

in0</SPAN>

 is a 3-bit-wide bus.</P>

<P CLASS="Body">

<A NAME="pgfId=284380">

 </A>

The next example illustrates the use of generic I/O cells from a standard-component library. These components are technology independent (so they may equally well be used with a 0.6  <SPAN CLASS="Symbol">

m</SPAN>

m or 0.35  <SPAN CLASS="Symbol">

m</SPAN>

m technology).</P>

<P CLASS="ComputerFirstLabelV">

<A NAME="pgfId=284381">

 </A>

<B CLASS="Keyword">

module</B>

 allPads(padTri, padOut, clkOut, padBidir, padIn, padClk);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284382">

 </A>

   <B CLASS="Keyword">

output</B>

 padTri, padOut, clkOut; inout padBidir;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284383">

 </A>

   <B CLASS="Keyword">

input</B>

 [3:0] padIn; <B CLASS="Keyword">

input</B>

 padClk; <B CLASS="Keyword">

wire</B>

 [3:0] in;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284384">

 </A>

//compass dontTouch u*</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284385">

 </A>

// asPadIn #(W, N, L, P) I (toCore, Pad) also asPadInInv</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284386">

 </A>

// asPadOut #(W, N, L, P) I (Pad, frCore)</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284387">

 </A>

// asPadTri #(W, N, S, L, P) I (Pad, frCore, OEN)</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284388">

 </A>

// asPadBidir #(W, N, S, L, P) I (Pad, toCore, frCore, OEN)</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284389">

 </A>

// asPadClk #(N, S, L) I (Clk, Pad) also asPadClkInv</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284390">

 </A>

// asPadVxx #(N, subnet) I (Vxx)</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284391">

 </A>

// W = width, integer (default=1)</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284392">

 </A>

// N = pin number string, e.g. &quot;1:3,5:8&quot; </P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284393">

 </A>

// S = strength = {2, 4, 8, 16} in mA drive</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284394">

 </A>

// L = level = {cmos, ttl, schmitt} (default = cmos)</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284395">

 </A>

// P = pull-up resistor = {down, float, none, up} </P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284396">

 </A>

// Vxx = {Vss, Vdd}</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284397">

 </A>

// subnet = connect supply to {pad, core, both} </P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284398">

 </A>

	asPadIn    #(4,&quot;1:4&quot;,&quot;&quot;,&quot;none&quot;) u1 (in, padIn);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284400">

 </A>

<A NAME="42091">

 </A>

	asPadOut   #(1,&quot;5&quot;,13) u2 (padOut, d);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284401">

 </A>

	asPadTri   #(1,&quot;6&quot;,11) u3 (padTri, in[1], in[0]);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284402">

 </A>

	asPadBidir #(1,&quot;7&quot;,2,&quot;&quot;,&quot;&quot;) u4 (d, padBidir, in[3], in[2]);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284404">

 </A>

<A NAME="16055">

 </A>

	asPadClk   #(8) u5 (clk, padClk);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284405">

 </A>

	asPadOut   #(1, &quot;9&quot;) u6 (clkOut, clk);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284406">

 </A>

	asPadVdd   #(&quot;10:11&quot;,&quot;pads&quot;) u7 (vddr);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284407">

 </A>

	asPadVss   #(&quot;12,13&quot;,&quot;pads&quot;) u8 (vssr);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284408">

 </A>

	asPadVdd   #(&quot;14&quot;,&quot;core&quot;) u9 (vddc);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284409">

 </A>

	asPadVss   #(&quot;15&quot;,&quot;core&quot;) u10 (vssc);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284410">

 </A>

	asPadVdd   #(&quot;16&quot;,&quot;both&quot;) u11 (vddb);</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284411">

 </A>

	asPadVss   #(&quot;17&quot;,&quot;both&quot;) u12 (vssb);</P>

<P CLASS="ComputerLastLabelV">

<A NAME="pgfId=284412">

 </A>

<B CLASS="Keyword">

endmodule</B>

 </P>

<P CLASS="Body">

<A NAME="pgfId=284413">

 </A>

The following code is an example of the contents of a generic model for a three-state I/O cell (provided in a standard-component library or in an I/O cell library): </P>

<P CLASS="ComputerFirstLabelV">

<A NAME="pgfId=284414">

 </A>

<B CLASS="Keyword">

module</B>

 PadTri (Pad, I, Oen); // active-low output enable</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284415">

 </A>

<B CLASS="Keyword">

parameter</B>

 width = 1, pinNumbers = &quot;&quot;, \strength = 1, </P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284416">

 </A>

	level = &quot;CMOS&quot;, externalVdd = 5;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284417">

 </A>

<B CLASS="Keyword">

output</B>

 [width-1:0] Pad; <B CLASS="Keyword">

input</B>

  [width-1:0] I; <B CLASS="Keyword">

input</B>

 Oen;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284418">

 </A>

<B CLASS="Keyword">

assign</B>

 #1 Pad = (Oen ? {width{1'bz}} : I);</P>

<P CLASS="ComputerLastLabelV">

<A NAME="pgfId=284419">

 </A>

<B CLASS="Keyword">

endmodule</B>

<A NAME="30561">

 </A>

 </P>

<P CLASS="Body">

<A NAME="pgfId=284420">

 </A>

The module <SPAN CLASS="BodyComputer">

PadTri</SPAN>

 can be used for simulation and as the basis for synthesizing an I/O cell. However, the synthesizer also has to be told to synthesize an I/O cell connected to a bonding pad and the outside world and not just an internal three-state buffer. There is currently no standard mechanism for doing this, and every tool and every ASIC company handles it differently. </P>

<P CLASS="Body">

<A NAME="pgfId=284564">

 </A>

The following model is a generic model for a bidirectional pad. We could use this model as a basis for input-only and output-only I/O cell models.</P>

<P CLASS="ComputerFirstLabelV">

<A NAME="pgfId=284421">

 </A>

<B CLASS="Keyword">

module</B>

 PadBidir (C, Pad, I, Oen); // active-low output enable</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284422">

 </A>

<B CLASS="Keyword">

parameter</B>

 width = 1, pinNumbers = &quot;&quot;, \strength = 1, </P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284423">

 </A>

	level = &quot;CMOS&quot;, pull = &quot;none&quot;, externalVdd = 5;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284424">

 </A>

<B CLASS="Keyword">

output</B>

 [width-1:0] C; <B CLASS="Keyword">

inout </B>

[width-1:0] Pad;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284425">

 </A>

<B CLASS="Keyword">

input </B>

[width-1:0] I; <B CLASS="Keyword">

input</B>

 Oen;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284426">

 </A>

<B CLASS="Keyword">

assign</B>

 #1 Pad = Oen ? {width{1'bz}} : I; <B CLASS="Keyword">

assign</B>

 #1 C = Pad;</P>

<P CLASS="ComputerLastLabelV">

<A NAME="pgfId=284427">

 </A>

<B CLASS="Keyword">

endmodule</B>

 </P>

<P CLASS="Body">

<A NAME="pgfId=284431">

 </A>

In Chapter&nbsp;8 we used the <SPAN CLASS="BodyComputer">

halfgate</SPAN>

 example to demonstrate an FPGA design flow&#8212;including I/O. If the synthesis tool is not capable of synthesizing I/O cells, then we may have to instantiate them by hand; the following code is a hand-instantiated version of lines <A HREF="#42091" CLASS="XRef">

19</A>

&#8211;<A HREF="#16055" CLASS="XRef">

22</A>

 in module <SPAN CLASS="BodyComputer">

allPads</SPAN>

:</P>

<P CLASS="ComputerFirst">

<A NAME="pgfId=284439">

 </A>

pc5o05 u2_2 (.PAD(padOut), .I(d));</P>

<P CLASS="Computer">

<A NAME="pgfId=284440">

 </A>

pc5t04r u3_2 (.PAD(padTri), .I(in[1]), .OEN(in[0]));</P>

<P CLASS="Computer">

<A NAME="pgfId=284441">

 </A>

pc5b01r u4_3 (.PAD(padBidir), .I(in[3]), .CIN(d), .OEN(in[2]));</P>

<P CLASS="ComputerLast">

<A NAME="pgfId=284442">

 </A>

pc5d01r u5_in_1 (.PAD(padClk), .CIN(u5toClkBuf[0]));</P>

<P CLASS="BodyAfterHead">

<A NAME="pgfId=284443">

 </A>

The designer must find the names of the I/O cells (<SPAN CLASS="BodyComputer">

pc5o05</SPAN>

 and so on), and the names, positions, meanings, and defaults for the parameters from the cell-library documentation.</P>

<P CLASS="Body">

<A NAME="pgfId=284578">

 </A>

I/O cell models allow us to simulate the behavior of the synthesized logic inside an ASIC &#8220;all the way to the pads.&#8221; To simulate &#8220;outside the pads&#8221; at a system level, we should use these same I/O cell models. This is important in ASIC design. For example, the designers forgot to put pull-up resistors on the outputs of some of the SparcStation ASICs. This was one of the very few errors in a complex project, but an error that could have been caught if a system-level simulation had included complete I/O cell models for the ASICs.</P>

</DIV>

<DIV>

<H2 CLASS="Heading2">

<A NAME="pgfId=284444">

 </A>

12.4.2&nbsp;Flip-Flops</H2>

<P CLASS="BodyAfterHead">

<A NAME="pgfId=284448">

 </A>

In Chapter&nbsp;11 we used this D flip-flop model to simulate the Viterbi decoder:</P>

<P CLASS="ComputerFirstLabelV">

<A NAME="pgfId=284449">

 </A>

<B CLASS="Keyword">

module</B>

 dff(D,Q,Clock,Reset); // N.B. reset is active-low</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284450">

 </A>

<B CLASS="Keyword">

output</B>

 Q; <B CLASS="Keyword">

input</B>

 D,Clock,Reset;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284451">

 </A>

<B CLASS="Keyword">

parameter</B>

 CARDINALITY = 1; <B CLASS="Keyword">

reg</B>

 [CARDINALITY-1:0] Q;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284452">

 </A>

<B CLASS="Keyword">

wire</B>

 [CARDINALITY-1:0] D;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284453">

 </A>

<B CLASS="Keyword">

always</B>

 @(<B CLASS="Keyword">

posedge</B>

 Clock) <B CLASS="Keyword">

if</B>

 (Reset!==0) #1 Q=D;</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284454">

 </A>

<B CLASS="Keyword">

always</B>

 <B CLASS="Keyword">

begin</B>

 <B CLASS="Keyword">

wait</B>

 (Reset==0); Q=0; <B CLASS="Keyword">

wait</B>

 (Reset==1); <B CLASS="Keyword">

end</B>

 </P>

<P CLASS="ComputerLastLabelV">

<A NAME="pgfId=284455">

 </A>

<B CLASS="Keyword">

endmodule</B>

<A NAME="39510">

 </A>

 </P>

<P CLASS="Body">

<A NAME="pgfId=284456">

 </A>

Most simulators cannot synthesize this model because there are two <SPAN CLASS="BodyComputer">

wait</SPAN>

 statements in one <SPAN CLASS="BodyComputer">

always</SPAN>

 statement (line <A HREF="#30561" CLASS="XRef">

6</A>

). We could change the code to use flip-flops from the synthesizer standard-component library by using the following code:</P>

<P CLASS="ComputerOneLine">

<A NAME="pgfId=284457">

 </A>

asDff ff1 (.Q(y), .D(x), .Clk(clk), .Rst(vdd));</P>

<P CLASS="Body">

<A NAME="pgfId=284458">

 </A>

Unfortunately we would have to change all the flip-flop models from <SPAN CLASS="BodyComputer">

'dff'</SPAN>

 to <SPAN CLASS="BodyComputer">

'asDff'</SPAN>

 and the code would become dependent on a particular synthesis tool. Instead, to maintain independence from vendors, we shall use the following D flip-flop model for synthesis and simulation:</P>

<P CLASS="ComputerFirstLabelV">

<A NAME="pgfId=284459">

 </A>

<B CLASS="Keyword">

module</B>

 dff(D, Q, Clk, Rst); // new flip-flop for Viterbi decoder</P>

<P CLASS="ComputerLabelV">

<A NAME="pgfId=284460">

 </A>

	<B CLASS="Keyword">

parameter</B>

 width = 1,  reset_value = 0; <B CLASS="Keyword">

input</B>

 [width - 1 : 0] D;</P>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?