TA的每日心情 | 擦汗 2020-1-14 15:59 |
|---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑9 m( B) g, F4 t t
( o7 e O7 U& t9 e) t" b3 _! B3 |
7 F, d) q/ l8 y4 L
8.0 Actual "full_case" design problem4 e4 j0 T6 J9 W/ Z) z! g
The 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using! H. m# l$ B! @0 Z9 T
any synthesis directives. The resultant design was a decoder built from 3-input and gates and
3 H; h% l1 v6 T: [8 f" J z+ vinverters. No latch is inferred because all outputs are given a default assignment before the case
; k) J! ]. w- n% n+ Ystatement. For this example, the pre-synthesis and post-synthesis designs and simulations9 g% h( C) k4 ]
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the
! o+ z+ Y8 P6 f8 U"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was) v o, p! X8 v& W6 O7 k1 y0 j
optimized away during synthesis and left as a dangling input. The pre-synthesis simulation1 z( ^+ ]) V+ I! R- L
results of modules code4a and code4b matched the post-synthesis simulation results of module
3 I6 q$ M! I# K$ |6 \; l2 g. scode4a, but did not match the post-synthesis simulation results of module code4b [2]." j# F s6 U" i( X: m
// no full_case
4 C, x; V8 J6 j: W: ^ m// Decoder built from four 3-input and gates' M( e6 k* w( v; M+ A* p! v
// and two inverters
5 u+ c4 K! B" N, L! B4 o c+ X( Zmodule code4a (y, a, en);+ ~2 j' ~, t$ b4 }( O8 ^
output [3:0] y;1 K" [+ k: Y+ F9 G% b( i! d) I
input [1:0] a;
- e. K. i$ r$ V: ginput en;
& b/ j7 l0 `4 M8 h, mreg [3:0] y;& @0 o- ?; e. c9 q6 L# x% Q* D
always @(a or en) begin7 a, M4 ?) i% {6 o* b
y = 4'h0;
, T# M" ^, o/ k' g6 @- R2 ~case ({en,a}); L( K# q; [" ?/ E X
3'b1_00: y[a] = 1'b1;
9 x) }$ Y- t5 ]. D* {3 L3'b1_01: y[a] = 1'b1;& {1 P% l3 Y/ G, v6 m/ x0 p
3'b1_10: y[a] = 1'b1;
# F: B$ {! ^1 ^% w" E3'b1_11: y[a] = 1'b1;
% g: F+ {4 y& c4 Iendcase
9 M4 o. I: \ {% u! r- b( Mend9 s( K2 j9 a) Q6 O- ^0 b! G a
endmodule O. [! Z% x5 J% A E
Example 12 - Decoder example with no "full_case" directive: ^5 L/ l x9 Q1 ~4 S
Statistics for case statements in always block at line 9 in file2 q1 k3 ?( S& ^' S
'.../code4a.v'6 P6 l) D+ S" K7 S3 L; V+ [
===============================================
1 U5 Y* R7 z9 f: k+ X| Line | full/ parallel |" G& \* w9 u+ @7 u3 q
===============================================
4 V1 I4 {0 r9 z% B2 i| 12 | no/auto |
' q8 @0 o4 n0 B* ^2 @===============================================' s% L& e/ K- n9 F3 i+ @
Figure 19 - Case statement report for Example 125 V; e* Z/ {; F" z) C
7 p/ e9 I' `- i" q! L! }: O
+ L0 a0 P+ H( P! j) ^1 @9 R// full_case example
( ?5 l+ }7 |) \ ~, t// Decoder built from four 2-input nor gates
( J% x2 Y# K9 b: l1 {// and two inverters
8 F, T7 @. s) s+ N3 H! b// The enable input is dangling (has been optimized away)9 F1 A! Q8 S: {5 L; a! C! E
module code4b (y, a, en);( w1 h( ?2 W: @8 K
output [3:0] y;4 d5 U$ V2 ]0 J; u
input [1:0] a;
2 \! Y' [: B" a) C- _, dinput en;" {" D4 D) j8 D3 F9 M7 m: B! S! |
reg [3:0] y;* t* ?0 u' i! h4 _% {& L1 b
always @(a or en) begin: d7 m) i8 V5 J* Q
y = 4'h0;
1 b1 [* n' E8 z$ H- \% ~case ({en,a}) // synopsys full_case
8 \$ A+ \) g* @3 a. p F3'b1_00: y[a] = 1'b1;5 S1 n. Z& K+ n9 X1 B( R, N
3'b1_01: y[a] = 1'b1;8 _5 g2 ?1 |" e, o
3'b1_10: y[a] = 1'b1;% M- a8 m: E# p( E' b% C5 j
3'b1_11: y[a] = 1'b1;+ l* m5 m8 M3 N! o5 ^5 a
endcase
5 N: V9 [4 a" o, D" mend
# F$ \6 P* F* N& S/ qendmodule5 l' K2 Z$ m1 c& O
Example 13 - Decoder example with "full_case" directive
1 S1 J# m; V6 n. ?6 B4 o" wWarning: You are using the full_case directive with a case statement in which
$ O8 W$ Q5 r+ d2 F' T) W3 w* Wnot all cases are covered
# r" j6 z8 F+ [+ U% w. VStatistics for case statements in always block at line 10 in file
4 G+ v' X3 o/ q, s; O'.../code4b.v'+ V+ k3 N; n+ ~! t4 {$ A
===============================================
: K" R; H7 p( s( p6 c| Line | full/ parallel |
4 d/ }$ ~7 y0 B4 R0 V+ p9 D4 }; s===============================================
Q6 l- f- k9 B' R& a| 13 | user/auto |
& p1 _* p- P% s===============================================
& H6 Y. D4 B1 u& ]- UFigure 20 - Case statement report for Example 13
( V# E$ o8 r! \1 U( G2 f% ]6 D" z+ m' U, t) w: L, e, @, z
谁给解释一下原因呢?
0 d6 Q+ |: n3 J0 l( P为啥会有差异? |
|