TA的每日心情 | 擦汗 2020-1-14 15:59 |
---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑
& F3 [" o' k- A. r3 H& h
- c* K% u" R0 G1 d3 b4 a; ]9 @2 n& |4 @. X" F
8.0 Actual "full_case" design problem
( \8 _/ } _6 m: \6 P, PThe 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using3 u% j$ ]" q& |
any synthesis directives. The resultant design was a decoder built from 3-input and gates and
1 l' v1 Z; r( q* o; e' f7 kinverters. No latch is inferred because all outputs are given a default assignment before the case
' a: B' A# J; j+ O, W/ ^statement. For this example, the pre-synthesis and post-synthesis designs and simulations
+ @/ V& r" X7 _6 V# ^2 S! {matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the
# N: G6 X, }' Q5 |; u5 C0 ]"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was" s$ a- d+ D3 c+ z& w8 C
optimized away during synthesis and left as a dangling input. The pre-synthesis simulation" @( t" p6 g. c. t' u3 K+ n6 E
results of modules code4a and code4b matched the post-synthesis simulation results of module
1 o6 y; d9 [6 V* p- Y+ Ccode4a, but did not match the post-synthesis simulation results of module code4b [2].
' W' \( N# Z0 ?2 T! P- x// no full_case% S6 `. E. b4 s
// Decoder built from four 3-input and gates: Z& F' C# P7 L; b$ ]7 z
// and two inverters. G {1 ]& {# @) Z% x0 ?5 k3 ]
module code4a (y, a, en);/ f& H3 C& d- e/ ~1 M( @8 c
output [3:0] y;
6 i2 V: i. W0 f, X5 W" Ainput [1:0] a;9 h. R! W& [* g8 D
input en;% a9 q( s7 m; y
reg [3:0] y;
6 _+ R6 t1 ^% |2 e, `always @(a or en) begin. n C/ o! j9 U+ ?: z
y = 4'h0; b+ l a2 \" N* w& `
case ({en,a})
! n4 p/ w5 |; W" u) k3'b1_00: y[a] = 1'b1;3 T# K. g$ v3 S- I+ B9 {3 e* p' h1 {
3'b1_01: y[a] = 1'b1;% b. Z" n i2 a& x7 D% b" `/ \
3'b1_10: y[a] = 1'b1;! V- @- T; z" _/ ]& E" ?4 \, V
3'b1_11: y[a] = 1'b1;
' s3 o( R% `6 Q0 Nendcase( u* R2 ^8 I) v" W. p e7 ?6 i' K
end& k4 @- V W( V
endmodule' I0 M# ~* a- g. H
Example 12 - Decoder example with no "full_case" directive1 d' Q0 y& n! x% K: H Z
Statistics for case statements in always block at line 9 in file
( d- t8 u. S$ |, `# S'.../code4a.v'
' [. b( R0 o1 a$ x===============================================# ?1 l: X8 x) B% v" t3 P3 b
| Line | full/ parallel |
1 }8 N: ] h) P2 Z7 Z; a9 N===============================================
\4 x8 ~' a- p| 12 | no/auto |
6 u$ y# I( s0 W===============================================
* `7 Q% O0 ?: zFigure 19 - Case statement report for Example 12; }! v6 K; B& S3 Z
/ |% I' B. i- ]) `+ u& t4 f
; F. _ ?! F2 m6 Y0 R( f// full_case example
. N' ^! c. F! g/ V$ d q. Y! _, h// Decoder built from four 2-input nor gates& l2 W H; d8 B$ D8 f* x6 B
// and two inverters4 g3 G d( I3 n
// The enable input is dangling (has been optimized away)
6 J3 Y6 ^2 e! v: ~# }& Nmodule code4b (y, a, en);
+ B* ]2 c( ~/ e9 f$ d8 v" J1 Foutput [3:0] y;
0 m3 G$ M" I% j& e A$ jinput [1:0] a;/ _5 x' ?1 V/ @4 u
input en;
5 G/ c7 z/ Y8 r i/ I/ N8 S+ ~' u( wreg [3:0] y; Q" y1 W5 s% I
always @(a or en) begin: ?2 ~, a* H8 T4 N6 p. \% X( B
y = 4'h0;3 ?) e7 v" b* L" G3 m% f6 \0 [
case ({en,a}) // synopsys full_case
" S! v2 b1 F0 X- B3'b1_00: y[a] = 1'b1;
. E! k3 w# E. i' V3'b1_01: y[a] = 1'b1;
" _4 p: V( ^" S7 T6 l! @2 b3'b1_10: y[a] = 1'b1;
& a& @/ P/ F9 r2 i7 U# g3'b1_11: y[a] = 1'b1;
3 n, B) z3 k$ i w! c2 [7 Zendcase- e& [* P5 X9 U! C- u7 N! [
end* w* D& p; |' G% w7 L& N) Q; @; ] e
endmodule! k+ c2 ^! B" b1 k# n% v6 c, c
Example 13 - Decoder example with "full_case" directive
( e" L! G' S( E0 b6 c9 d5 GWarning: You are using the full_case directive with a case statement in which
* h" k% _7 p& |& @) z* knot all cases are covered+ O, X. b: c7 R0 p- c4 d
Statistics for case statements in always block at line 10 in file7 m$ ~! M8 l: x) k# B. _5 R
'.../code4b.v'7 U5 H5 o# z' `# n, a) }6 ~
===============================================
" @4 x4 B* d' J- K9 J| Line | full/ parallel |
4 B: _: C: s: _===============================================
' a+ H7 d3 d3 z4 X. R| 13 | user/auto |
: A" s2 _: B' x- W- O- O* h===============================================6 D7 f+ O/ J8 z, v: \. R
Figure 20 - Case statement report for Example 132 {+ W, k# U: y6 _& y
2 j7 ^% s+ |2 o( k谁给解释一下原因呢?
! d; B/ Q+ X5 X8 G为啥会有差异? |
|