|
EDA365欢迎您!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑0 U. r) p' Y9 ?) a4 q
$ O4 g; ^/ h1 [9 J; V ]* Q+ n
& C8 E/ i% b- j3 k) b7 Z8.0 Actual "full_case" design problem$ z8 i; d" H* I+ N. R
The 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using
. p9 {8 x! u# u! P1 k; wany synthesis directives. The resultant design was a decoder built from 3-input and gates and2 q( v% W b$ \6 P
inverters. No latch is inferred because all outputs are given a default assignment before the case3 h* V$ ?( ]; s5 l0 l* J6 h
statement. For this example, the pre-synthesis and post-synthesis designs and simulations* k! ^9 X; q0 a- T: f
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the
9 E# W4 z( a5 O0 ]# j" A- }, }. e9 t% ]"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was
' `, l) x" s f! c3 u/ ], W- zoptimized away during synthesis and left as a dangling input. The pre-synthesis simulation7 R4 h* r0 y, t0 @5 k
results of modules code4a and code4b matched the post-synthesis simulation results of module
' B, d, n& G) Icode4a, but did not match the post-synthesis simulation results of module code4b [2].4 @5 w% m% M7 J/ d
// no full_case V3 m/ f0 b' \. ?
// Decoder built from four 3-input and gates
1 I3 z: k+ w' u% ]8 p- ~% r$ H// and two inverters
9 Y1 v' l% }( s4 imodule code4a (y, a, en);+ k, t. G; g4 I) V2 V
output [3:0] y;
9 B. I% A% m. L& l9 e2 sinput [1:0] a;
$ D% @% N- O$ R" p# o1 x9 M7 n2 ^input en;
7 L1 T: h" v" j9 W( \' s% n9 Ireg [3:0] y;! |% x7 [# E2 N; X6 U/ Q1 P
always @(a or en) begin
[0 ?% Y- u" {$ p; C6 ty = 4'h0;
/ o. m4 f3 [+ n t: B r& T7 b4 rcase ({en,a})6 {/ r* K2 @% e
3'b1_00: y[a] = 1'b1;
* t9 w' E, N6 F& ]- }& b. ^, ?3'b1_01: y[a] = 1'b1;
5 ~6 |2 C( P n2 ?3'b1_10: y[a] = 1'b1;' F0 U- g. E0 A: F" i; r& ^
3'b1_11: y[a] = 1'b1;& Z/ B( H! r) K/ N; q5 T; S
endcase
- X2 J7 C7 a6 _7 Z/ J4 W9 Z% Pend P4 I7 w( D, G6 g& b2 }
endmodule$ W _' s& T7 v" z
Example 12 - Decoder example with no "full_case" directive
3 G% B+ v. C: M4 g' MStatistics for case statements in always block at line 9 in file
2 H9 Z% a% e1 R/ X1 k$ F2 p+ l'.../code4a.v'+ V) p, ?$ q. y
===============================================
+ x" b6 m- i6 F2 b, a7 b7 L8 n| Line | full/ parallel |9 ~4 L" b- D0 A; E* \8 C5 k
===============================================
' ^! D, I5 p1 t3 |4 u% B| 12 | no/auto |
- ?1 z% N" {0 Y. V! }) w6 ]===============================================
! @- Q+ z/ ~0 s$ t9 o1 VFigure 19 - Case statement report for Example 12
V8 N9 c. t; r6 z$ K8 g7 Y$ c$ g: T" [4 g
+ p. l! g# o0 [" P& F) o
// full_case example
% [, N' G+ @1 f" J, Z6 ~7 C5 W ]// Decoder built from four 2-input nor gates. W7 P W& G8 X
// and two inverters
( U R6 x6 ]- C// The enable input is dangling (has been optimized away)
& o+ a5 ^, d5 K! c+ s: j! Gmodule code4b (y, a, en);) g% k% M2 O, j/ f; G
output [3:0] y;& ~2 ?4 @2 T- B! m( x
input [1:0] a;
% ^7 C& x5 `7 g- u4 e- s/ K% O: }input en;7 J6 ?* @$ \8 Z/ j, ]
reg [3:0] y;2 ^( h. h {+ y4 V- I* i
always @(a or en) begin! {" T. d% X+ ~4 r6 |7 h* h
y = 4'h0;
Q3 o9 @3 D6 B: acase ({en,a}) // synopsys full_case# `6 D a9 I/ q; L" F
3'b1_00: y[a] = 1'b1;7 {3 R4 ^. f( K q$ i( I
3'b1_01: y[a] = 1'b1;+ s) ~5 u' L$ q' [
3'b1_10: y[a] = 1'b1;: S2 \- L6 i1 f
3'b1_11: y[a] = 1'b1;
- U) n! g4 V1 L; _9 Y* r% Y6 rendcase6 O7 h) `3 ^7 b% ]8 F
end2 o4 {* g f; M J3 V8 j
endmodule
; Q1 G$ P% ~& P$ h& j0 nExample 13 - Decoder example with "full_case" directive
' w% L8 \2 S d, I# d2 \ w- x( r* OWarning: You are using the full_case directive with a case statement in which) d$ v- s, D3 ]/ }
not all cases are covered
. r+ h7 u) Y, ~- ~6 N# S0 oStatistics for case statements in always block at line 10 in file
n) X- f% ?. t$ x+ h'.../code4b.v' ?/ q+ \( e& x& @
===============================================
& x2 I4 k5 i% Z5 t+ c1 M| Line | full/ parallel |
2 X1 f' m( g$ s H===============================================
3 t7 C! n8 P$ f- o. G0 p! o| 13 | user/auto |8 @6 j7 `% }/ i4 n' b' N7 B
===============================================( y# A6 ^. Y) q5 t+ G/ c6 ?
Figure 20 - Case statement report for Example 139 Z! E7 e& u" T- S& t
" Z3 `. k/ Y# p3 w7 n7 l
谁给解释一下原因呢?
* Z1 ? c0 w4 Y y1 m8 k' h; h为啥会有差异? |
|