TA的每日心情 | 擦汗 2020-1-14 15:59 |
---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑
) g8 O2 D7 D% T4 w# q, n2 K( m# Z( R9 E
4 n% S) `; o" G; w4 O' c) x4 j% x+ |8.0 Actual "full_case" design problem1 b+ A7 {2 H7 E
The 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using
i2 F6 _' |2 oany synthesis directives. The resultant design was a decoder built from 3-input and gates and4 A! S( f8 R1 N# P8 L& N
inverters. No latch is inferred because all outputs are given a default assignment before the case
& E# B Q7 t! ?3 W' Q& c- hstatement. For this example, the pre-synthesis and post-synthesis designs and simulations) u! G, l1 U/ d2 ?
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the3 r/ y/ t- v) y
"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was. Z8 L* s) R2 Z( ]5 y
optimized away during synthesis and left as a dangling input. The pre-synthesis simulation3 h9 |% x6 r# z0 C' d
results of modules code4a and code4b matched the post-synthesis simulation results of module* \2 R" i0 e0 A; l3 Q8 y( z4 B
code4a, but did not match the post-synthesis simulation results of module code4b [2].
8 m8 v6 U# Q! b, B+ Y// no full_case9 ~' M8 H# ^* O. M1 v
// Decoder built from four 3-input and gates4 ]6 D! r- C. v) D [, {5 S
// and two inverters
% J6 s1 J" l7 x2 }module code4a (y, a, en);$ f2 |# v1 {! v% P) ^
output [3:0] y;% @; {/ p) ]# b- b$ X$ `$ |
input [1:0] a;
) H+ |+ D' N% Pinput en;7 _2 F1 f, r- H: k- `
reg [3:0] y;: A$ B% I- n( B; v
always @(a or en) begin
: n0 h2 {. a- }5 W i2 A& Ty = 4'h0;- h- V& Q) Y1 I( p! C; d
case ({en,a})0 d. j: V% p3 ?$ L, p
3'b1_00: y[a] = 1'b1;
) g- H8 e) I7 m3 b' [$ s+ y3'b1_01: y[a] = 1'b1;5 P6 q8 v2 i# M# r
3'b1_10: y[a] = 1'b1;
9 a( `4 X3 f! @3'b1_11: y[a] = 1'b1;
* @$ n+ [! r* e& Z2 Kendcase7 j& D& W; l4 {) a8 g ?) q# l ?% b
end6 v) T# @% j) i; E
endmodule, m- }0 `+ @+ Z( N& b& M3 D
Example 12 - Decoder example with no "full_case" directive
( t+ t( t: N; F+ T, q* MStatistics for case statements in always block at line 9 in file1 N6 ^ P, P$ d* s
'.../code4a.v'* N8 @; o, ?) k' h4 d
===============================================' E9 o+ Y5 g6 _4 w& ]
| Line | full/ parallel |6 ~- j2 T" m5 M5 P. @9 j) C3 h
===============================================' W, D2 Y! ` A( s
| 12 | no/auto | _6 S. R) B% n8 G2 Y
===============================================9 @1 @0 {2 i8 ~0 Z- V+ ]
Figure 19 - Case statement report for Example 12
9 f. n- h" ?5 P' t. B( _( { y) E8 B& ?* J- W3 P
8 e& d2 ]7 p- u: C* p( i, K
// full_case example
% P- l* G1 w* k P% r9 x0 v: f// Decoder built from four 2-input nor gates
$ G! ~( O, U6 f8 f! @9 @// and two inverters$ v$ G. {6 a8 A
// The enable input is dangling (has been optimized away)
- M1 n3 \+ t- \; Emodule code4b (y, a, en);
" E+ g5 O, A6 g V/ }output [3:0] y;
' Q L" v: @. I3 d \ o, W0 g& @" linput [1:0] a;/ w6 [3 z. x* e& B
input en;# Y) N, G) j* \( o! E; B7 K
reg [3:0] y;
+ F A& S3 p" h, w6 @: j) a9 halways @(a or en) begin
9 Y9 s) v! _! L" k9 F- }3 U8 f- c uy = 4'h0;! } I' G( _8 X9 T7 i$ k, E1 d
case ({en,a}) // synopsys full_case
. s8 t2 v2 E$ S3'b1_00: y[a] = 1'b1;9 Q) i) _8 z8 A5 n1 ~+ l1 e6 T
3'b1_01: y[a] = 1'b1;% s: g0 T% \7 S' U/ j' \: b# C- M
3'b1_10: y[a] = 1'b1;9 d; e/ ?' v9 f3 e1 a+ |
3'b1_11: y[a] = 1'b1; s4 A1 M7 D2 _: `. M
endcase. ^. ^7 O2 |) Y6 r! ^( g5 M/ y
end# E" B& O) l `. H
endmodule
' q; p6 o( W8 g& J4 k) qExample 13 - Decoder example with "full_case" directive4 ^; D7 ?7 H6 `( N8 l
Warning: You are using the full_case directive with a case statement in which; M& w6 w% b `: |3 M; Y; x
not all cases are covered
7 ~$ J! k0 M" \, ?* uStatistics for case statements in always block at line 10 in file
' O! [0 D, B# P'.../code4b.v'
$ s7 ?; X2 F- c' G( g! q, f===============================================
8 E7 r) | K# w l| Line | full/ parallel |& L7 {2 L/ X% ~
===============================================
/ T( x) a1 P4 y t, ?" A1 d| 13 | user/auto |& A& Z- y/ U3 N5 d1 l* s4 K% W
===============================================
" }" n4 {1 C+ k( x" P- M m6 EFigure 20 - Case statement report for Example 13
$ s( j; N1 N& H& z6 t) P! M5 [. u+ W+ J
谁给解释一下原因呢? {+ H" u! W6 L
为啥会有差异? |
|