|
EDA365欢迎您!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑
, v: X4 u% ^/ N8 l1 B
$ M9 {8 @7 J4 v; D5 R! r
q& L# ?1 ]9 V: \8.0 Actual "full_case" design problem
/ l6 r+ r; f3 a4 oThe 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using
0 \ N- _0 [4 r& g0 I. l3 uany synthesis directives. The resultant design was a decoder built from 3-input and gates and
; @8 ]2 @* @% _, U4 |+ z! q* ?, j3 {2 tinverters. No latch is inferred because all outputs are given a default assignment before the case
) P8 q/ F# t6 V$ J5 ostatement. For this example, the pre-synthesis and post-synthesis designs and simulations3 t d% k3 C% ?. I8 V
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the
0 ], {2 O8 K: S4 B1 i+ @5 o5 L"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was% y7 P6 @/ V+ h7 s
optimized away during synthesis and left as a dangling input. The pre-synthesis simulation
' d& D# P( S/ m8 |6 V2 Fresults of modules code4a and code4b matched the post-synthesis simulation results of module
7 M4 `$ N1 [6 s, f4 o/ q& Pcode4a, but did not match the post-synthesis simulation results of module code4b [2].
# r0 L/ \; o* k; K// no full_case
7 ~" ]- m0 G5 |4 B I7 g// Decoder built from four 3-input and gates
( Q4 S( ~+ W* w6 b" K# @2 f; J1 \# X1 h// and two inverters
* l+ J+ r F% B4 _" B( Bmodule code4a (y, a, en);& i% ~9 }, B- R, Q5 V1 f
output [3:0] y;
Z# h/ R, w! k6 cinput [1:0] a;6 M+ z6 d. q5 {4 J1 }
input en;
% ~8 W) J7 o7 t& a+ ^' d% ureg [3:0] y;
! @0 q3 u+ @8 W; ~always @(a or en) begin3 Y! i5 z0 n$ A' f) T
y = 4'h0;+ |7 |9 m5 |# Q+ n* L4 Z3 g* A9 S8 h
case ({en,a})1 r" c' M4 O- e- M- d
3'b1_00: y[a] = 1'b1;9 ]8 C ^% D) F( |* B* v* B) V
3'b1_01: y[a] = 1'b1;1 e& j' q( ]- \* T
3'b1_10: y[a] = 1'b1; q$ u: g- |9 C m5 L0 O9 E! b
3'b1_11: y[a] = 1'b1;
( H8 M- i" g" ?* e* |endcase
3 G7 B1 x; q& o: u% Z- M( xend9 c* T3 B0 U9 H2 }# \3 U' N
endmodule
" l. |9 O8 y1 g1 N% r; oExample 12 - Decoder example with no "full_case" directive
' W2 t8 [' _! h9 _' l0 P3 D* C9 b- h) eStatistics for case statements in always block at line 9 in file4 I; k6 @& S" i
'.../code4a.v'
8 C6 D) Y/ K3 A9 f===============================================
1 V) s& i1 u$ f q| Line | full/ parallel |
5 G8 |6 N$ r6 P; V D===============================================, Y0 y: J! O4 I D2 q+ @
| 12 | no/auto |
: I- o) ~- R. i* r( e===============================================" W/ C- \0 N k" P1 i
Figure 19 - Case statement report for Example 124 W* D/ c* ]; J1 l! D2 C1 N6 m
" e1 x: F6 b* s! J' X) {
+ |: K& q3 e' y// full_case example
* B" O! _3 g3 x9 Q3 [4 O// Decoder built from four 2-input nor gates* g- X, ?6 e$ o+ H2 w& F
// and two inverters
4 B, m) ^4 N A- N# i- R- D// The enable input is dangling (has been optimized away)8 _1 D+ g6 h+ o7 k$ U
module code4b (y, a, en);
* T. q+ S; ]$ ]- i' o2 N. coutput [3:0] y;
4 k# \ w# M% O zinput [1:0] a;1 I) m, F+ T ^7 J
input en;
' Z5 `1 b, u: M8 a( i w9 t qreg [3:0] y;/ a6 j. L% @7 S, r
always @(a or en) begin
; d9 ^7 r2 Z9 u: M9 l% x. u; dy = 4'h0;
]5 r, |) ^* `7 J/ K5 bcase ({en,a}) // synopsys full_case' d" c U% o9 w9 L2 h
3'b1_00: y[a] = 1'b1;
% V+ v9 r b) u; I9 d/ J3'b1_01: y[a] = 1'b1;
+ ?. |. p) c6 w& `! i; e1 {5 F3'b1_10: y[a] = 1'b1;/ Z+ |$ k9 P J9 \/ k& \
3'b1_11: y[a] = 1'b1;1 J8 e+ |, y7 b/ C
endcase
" b5 J& b0 O4 n! H# j; Y2 b5 _end
6 @ N7 U8 u( e2 S1 q# l, Gendmodule$ [0 V$ l6 l# i: ?" S" H
Example 13 - Decoder example with "full_case" directive7 L+ Z( s6 B! X" Z. d' ?, u
Warning: You are using the full_case directive with a case statement in which# o3 |% v# `6 }
not all cases are covered k) A0 ~: Y' u
Statistics for case statements in always block at line 10 in file
. K$ d6 C7 Y4 h3 q& H1 t'.../code4b.v'
4 r7 s6 {& L9 k$ n4 `===============================================
( A- Z# `+ m( s$ O* Z6 }| Line | full/ parallel |
) V. c0 M7 m; [6 w- h ?===============================================
! M1 u0 N5 F4 I. q9 O9 k| 13 | user/auto |# W; ^; }( w l* ?
===============================================
5 W* _6 k! ^2 }* I$ gFigure 20 - Case statement report for Example 13' ~ W& ~: v9 t
* S& Z- i; K: m
谁给解释一下原因呢?
9 e7 t0 l' q( F+ k5 A+ L为啥会有差异? |
|