TA的每日心情 | 擦汗 2020-1-14 15:59 |
---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑3 V- i4 X2 M6 ^/ b( ~7 q' |% L; Q
/ _! e$ h8 ~7 h; m4 w c' G, h, C v+ Y+ k5 a1 z. r
8.0 Actual "full_case" design problem9 y( J# R0 a/ V) a" v) s* k" b
The 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using0 q. e4 Z% Y& j9 l
any synthesis directives. The resultant design was a decoder built from 3-input and gates and$ y3 J! W. I2 q. G1 t% z
inverters. No latch is inferred because all outputs are given a default assignment before the case. M( P0 ?* V" B9 V
statement. For this example, the pre-synthesis and post-synthesis designs and simulations2 M. g, s% t U7 s8 s
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the" b# Q, e$ } d- [; W, ^, Z, W/ l M
"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was
) [; p, r2 E3 woptimized away during synthesis and left as a dangling input. The pre-synthesis simulation
J$ j7 ^! C }( l& j' f6 F0 ]* rresults of modules code4a and code4b matched the post-synthesis simulation results of module$ ]4 |% C* q/ p) v
code4a, but did not match the post-synthesis simulation results of module code4b [2].8 l( ^& r) @4 m1 C- q" z+ q- K% i
// no full_case' z. h) W, B" K
// Decoder built from four 3-input and gates! Q% [: x, ^- m* Y
// and two inverters- x/ w( w+ f) t4 q( O0 K* c
module code4a (y, a, en);
, a* w( ^' I1 C: T5 }output [3:0] y;5 [2 B. q" f! O0 V& Y q: s& c
input [1:0] a;2 ^; w9 Y# v9 g) e4 H
input en;9 ^/ m. l2 `. y0 Y
reg [3:0] y;
, w" g3 }' u3 z8 T/ U: ]! Yalways @(a or en) begin9 D! m* H" r) V5 u9 u+ ]7 {
y = 4'h0;
7 T; L) o8 e/ y- Z0 R# K* h7 F8 R; Scase ({en,a})* C' {% V* }$ b$ W9 [0 W5 D
3'b1_00: y[a] = 1'b1;$ l$ A7 U3 B N) s
3'b1_01: y[a] = 1'b1;
/ l) K# S- u; q) J4 d3'b1_10: y[a] = 1'b1;
) \( b% H& |/ Z8 k- S9 F3'b1_11: y[a] = 1'b1;( w8 c. H( R! W* ]* \$ ]) z1 q' P
endcase' M3 t, `: H+ g' ]2 {
end/ V0 H. E! Z! n' x# A. h: |" C6 ~
endmodule
* R7 ?! e+ d1 y& f; D% NExample 12 - Decoder example with no "full_case" directive
- r! q# d& H& gStatistics for case statements in always block at line 9 in file
: [$ H0 r1 l! v3 [/ d/ v' X'.../code4a.v'+ w Q5 b! ~& s; {
===============================================9 o: a4 I0 R/ w9 J9 q
| Line | full/ parallel |7 b4 k+ T% }5 `/ I" c' z
===============================================
( [& O/ H2 Y; ~| 12 | no/auto |" z8 `1 J$ ?, t- z6 Q3 N
===============================================% P; B( d1 e2 u0 M3 u) Q( [ A; y
Figure 19 - Case statement report for Example 12
, z+ h5 Z! J$ F F. W
0 H( f4 Y8 y% ^/ c" W/ \. l# u! [5 W
// full_case example
- B/ t& S9 z6 F5 P# H- |// Decoder built from four 2-input nor gates% k4 k3 L3 b8 i2 O
// and two inverters3 }: k1 u. k I- F) e$ d/ V& c
// The enable input is dangling (has been optimized away)$ C5 Z7 [% P" z: ?$ e! b
module code4b (y, a, en);
- t# w, M' r, Q3 | xoutput [3:0] y;; B/ M7 I( E1 M6 }5 [! f" i# r
input [1:0] a;' |; L1 W. f# ^$ E5 U( n- U
input en;' B8 r5 R( E& s2 D" W
reg [3:0] y;
9 a2 W6 ~9 ?. V# b# g+ }3 E! m: q# l6 Aalways @(a or en) begin
- S+ P- M, m$ k3 p. ?# W" s, Ey = 4'h0;
9 G2 r& D4 r& k4 Dcase ({en,a}) // synopsys full_case/ M# p; \! `" f3 ^$ \
3'b1_00: y[a] = 1'b1;
" o3 E/ Y3 T. L0 z3'b1_01: y[a] = 1'b1;
$ _5 @) u, l; Y. O/ M3'b1_10: y[a] = 1'b1;; b: b5 ^- J O; z
3'b1_11: y[a] = 1'b1;
" |: I7 B+ G/ R( qendcase* a+ e8 F, j7 T% J( y* ?: l
end
) r0 p, S' ?) r9 \/ |" Wendmodule
3 q- J* _6 x4 n5 O) KExample 13 - Decoder example with "full_case" directive
2 [9 L% D. d% o* u# IWarning: You are using the full_case directive with a case statement in which) w6 N% r& O/ m! }: R
not all cases are covered% I+ }2 V2 D3 H l2 }
Statistics for case statements in always block at line 10 in file
' a" R h5 y. N, g% i'.../code4b.v'4 ?! I# z" U1 M- K
===============================================( V, l# U8 v. P2 M; c( N
| Line | full/ parallel |$ S) F9 q, x1 h
===============================================
5 V, Z9 z _1 G| 13 | user/auto |
% x) c8 g# _. M9 P, ^$ D7 b===============================================+ _9 j6 q' N5 y0 d. p' Q+ t9 y
Figure 20 - Case statement report for Example 13
, p4 I( e3 f& Q! t5 X6 m8 X( |: ?- R# L3 C
谁给解释一下原因呢?
2 g) F O# ^4 t+ G& T1 e为啥会有差异? |
|