TA的每日心情 | 擦汗 2020-1-14 15:59 |
---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑) |2 }) l" U8 w2 ]) n
; g# b+ I4 X# r. h' [- g/ D: [
( K p7 p% n# p# ]
8.0 Actual "full_case" design problem
, R3 {( Z$ m; E9 ^7 aThe 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using
: ~ H5 J& g# _1 U: lany synthesis directives. The resultant design was a decoder built from 3-input and gates and9 `$ ?) t! K8 M* Z ?# o
inverters. No latch is inferred because all outputs are given a default assignment before the case+ Q- s _9 w" ^* M
statement. For this example, the pre-synthesis and post-synthesis designs and simulations6 q6 k2 M/ \& p4 l2 a
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the
4 m- e1 G& N5 F" t' H8 k3 H"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was
8 T7 l: E7 H; k2 i8 |' y) Coptimized away during synthesis and left as a dangling input. The pre-synthesis simulation8 b" y1 ]9 Z* w9 c7 T- h6 O7 x+ b
results of modules code4a and code4b matched the post-synthesis simulation results of module
( z& t$ x9 f8 y1 I) ^code4a, but did not match the post-synthesis simulation results of module code4b [2].9 O* K7 _$ X9 }6 ]% u
// no full_case) y+ N' C6 M3 H2 ?" c( T
// Decoder built from four 3-input and gates/ B: l: |+ [$ r- O2 P" e5 G* G
// and two inverters* P0 X. k/ }/ I" J: G
module code4a (y, a, en);
- F1 r M! u6 {' Zoutput [3:0] y;/ f0 y5 A0 Z, f
input [1:0] a;$ S2 Y, ^- S' H1 g
input en;2 L" v4 Q+ u7 d
reg [3:0] y; U- R1 ] ^# T0 x7 G* [
always @(a or en) begin1 N- w, a3 v2 g( S- `
y = 4'h0;8 {1 e5 a0 {7 n* {1 y8 b
case ({en,a}) m: S: A: z' ?& K: }; r
3'b1_00: y[a] = 1'b1;
5 \; e: \+ ~0 W5 W: M% W3'b1_01: y[a] = 1'b1;8 W/ t; Q6 n& y% B, g
3'b1_10: y[a] = 1'b1;! M M' X2 _( d1 \* A; A6 y3 M9 s
3'b1_11: y[a] = 1'b1;# @0 X3 B3 {& j5 `; D' j
endcase
5 U2 d$ Y2 @2 c }. H/ D% }0 Bend
4 y5 |# ]& \+ Y+ b" |endmodule
: S+ N, q: S, ?& ?! u# v1 mExample 12 - Decoder example with no "full_case" directive
, ~" j8 A; Y/ P4 q" TStatistics for case statements in always block at line 9 in file! M4 l( j. W C0 M' ]% q; q
'.../code4a.v'
% J$ H) f1 m% u% K" [* V===============================================
" y) D3 z) _' B7 d( k| Line | full/ parallel |0 V3 c4 ?1 M, g5 ]. }% U
===============================================
, ` \+ }$ P, G$ y/ B3 _| 12 | no/auto |1 u1 U- o6 {$ x$ ^
===============================================
- l) d* t- E. q. \5 `: OFigure 19 - Case statement report for Example 12
: h5 _8 G D7 Y7 k+ {
4 e% l9 Y8 ` g5 b8 T K. X1 Y/ _' t
& b7 H9 [& w3 I$ X- m// full_case example
4 n9 z; S2 `8 ~; T% W, U6 }// Decoder built from four 2-input nor gates
- }/ _$ O9 m( { Q* D% g// and two inverters* V0 h4 j4 Y$ V' h* `
// The enable input is dangling (has been optimized away)
: f/ O& o. p$ @2 mmodule code4b (y, a, en);! f- y. S( v& A+ h3 j; w
output [3:0] y;! u) L! z" g6 p) k \$ U. ]
input [1:0] a;! q7 W0 u: J. P# t7 V" j
input en;* v4 h1 P8 U" Y1 ?% X5 ]1 D
reg [3:0] y;
8 V/ a0 V9 c: Calways @(a or en) begin
9 D$ ]4 m5 _; G8 |5 U. p: Hy = 4'h0;
: B" d' B$ H' g2 k% scase ({en,a}) // synopsys full_case! _& Q+ l9 F8 Q8 o6 F m8 G9 d
3'b1_00: y[a] = 1'b1;
0 l1 {$ l6 a x# G4 |7 G% ^) r3'b1_01: y[a] = 1'b1;
$ _) H$ S$ @( N! p: p. Z3 J3'b1_10: y[a] = 1'b1;
0 F! d' u: {. q; ?( }0 S3'b1_11: y[a] = 1'b1;
6 {. w Z! A# ^6 J0 o: R* x8 j5 ^endcase
5 B5 {, b3 d" k* Q/ i3 jend2 v# T* f; M: W, A
endmodule
: _7 E6 q: U) U) ?Example 13 - Decoder example with "full_case" directive
' r2 v" O% X+ x% _* ]# J% C9 rWarning: You are using the full_case directive with a case statement in which) P" O4 z6 R( d& `5 k" z
not all cases are covered* L! V- I1 i, g8 j& L
Statistics for case statements in always block at line 10 in file
7 r" a2 ^8 I3 X'.../code4b.v'
y; m* m5 c' B# Y7 U===============================================
; u2 b5 n: Q- C& l: x; F2 {2 c| Line | full/ parallel |
0 r, D3 @' {" r d2 k( d9 @& {# ]===============================================
8 I% M6 `( F. ?/ E0 W* g, u$ B* Z" A| 13 | user/auto |
5 Z, i5 |4 A. E4 q/ F2 m& y===============================================
* H7 d' G+ B5 c" aFigure 20 - Case statement report for Example 13& b; D) m! S% ?6 y4 Z4 c5 K. k" y ^
1 ~6 V S* j! I& x/ O# k, a. W
谁给解释一下原因呢? o1 o0 y) l3 `, S9 z" @! n
为啥会有差异? |
|