TA的每日心情 | 擦汗 2020-1-14 15:59 |
---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑! d9 C) c/ z$ I2 D; \9 Q$ r+ }
+ ^. K# d6 C8 p7 k! e! Y: `; H
4 ]5 c; F# Y* t C; Z# D
8.0 Actual "full_case" design problem! P. L' c, X% E8 T* l/ U
The 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using I0 ]# b; c6 b" v
any synthesis directives. The resultant design was a decoder built from 3-input and gates and8 p# h4 V% O" h) E
inverters. No latch is inferred because all outputs are given a default assignment before the case
# T$ ? a! ^: Q/ b/ u [statement. For this example, the pre-synthesis and post-synthesis designs and simulations2 k; I1 a+ J- O( I+ k; ^8 n
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the" a* i; D Z! H+ X7 M
"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was2 x5 k/ f E0 E
optimized away during synthesis and left as a dangling input. The pre-synthesis simulation/ u# @7 n/ u4 S
results of modules code4a and code4b matched the post-synthesis simulation results of module
: j; E3 t8 d g+ J3 w ^) ?code4a, but did not match the post-synthesis simulation results of module code4b [2].
' f# Z y. F0 D/ L2 z* k9 m// no full_case
0 @& G: s9 o3 x// Decoder built from four 3-input and gates( A j9 C4 g# }6 }! _9 X
// and two inverters' }% K' Z9 L; s% `3 r6 U1 h
module code4a (y, a, en);
l. | F. U" \0 k( R* j! Xoutput [3:0] y;7 _8 k9 a0 `/ o
input [1:0] a;& y3 X" x5 \5 _& ? M5 c
input en;; v6 |( J! \/ z- a
reg [3:0] y;
, P: @1 S* }& e+ \8 k; g Oalways @(a or en) begin
8 x, s) {7 ^* u5 p5 q `y = 4'h0;
6 i4 A2 H, A1 J% n5 K4 g5 Ucase ({en,a})
( A }3 ?9 Z' t( l/ h( b3'b1_00: y[a] = 1'b1;
9 O$ c! k: ^0 f$ G) b" N8 ^3'b1_01: y[a] = 1'b1;+ ~, b; ~8 r3 ?1 G
3'b1_10: y[a] = 1'b1;5 ^" V8 |# _# O( g
3'b1_11: y[a] = 1'b1;: H7 K' B# b0 o2 M
endcase, c/ M2 v7 W& l4 Y2 n8 X( `) Y9 }
end
. ^7 N$ z: N% r, H( {endmodule
5 p3 ]. O% f& Y& O( [% ^- I2 I4 `; AExample 12 - Decoder example with no "full_case" directive
3 l/ g0 F% {" p& n& D0 O+ \Statistics for case statements in always block at line 9 in file
. J2 @: h6 a# k- y0 I3 h'.../code4a.v') o6 s4 M" d& i4 _
===============================================1 R( B: K+ f2 h8 F, K D
| Line | full/ parallel |. [8 Z' t& H y1 c b3 H) x
===============================================" i* G5 [$ _. V' Q. T. E+ x9 @2 a
| 12 | no/auto |
, ]/ m$ m H' z5 l1 W" n% E===============================================* T5 P: O% L; g2 A# j: x
Figure 19 - Case statement report for Example 12
/ C- Y$ q, X- C+ z' \$ f' ?3 Y& e7 P+ {9 F. G3 L, M* b
0 R1 [5 v# F, l* z' m7 B! M0 _2 J# ]// full_case example
- t/ Z6 t2 l! k3 f0 W// Decoder built from four 2-input nor gates
3 `; b. d9 d0 n% }3 e+ R* J// and two inverters$ v9 f3 I7 G# K, Y: F
// The enable input is dangling (has been optimized away)
" q0 }8 e J2 n: Y: s2 h- lmodule code4b (y, a, en);) K+ z3 Y/ J9 w" L* N
output [3:0] y;
0 N" h1 A% N6 D, jinput [1:0] a;
# I* x7 m. ?% O9 g, [ |input en;0 _* ?5 l, A6 R+ O0 R
reg [3:0] y;
: j/ j5 D0 u# D3 L$ L$ H$ @always @(a or en) begin; A3 I& F O7 E( O, L& @" w* m O
y = 4'h0;6 C0 c% z1 i W' c+ [
case ({en,a}) // synopsys full_case
9 K$ H8 r* _; i3'b1_00: y[a] = 1'b1;
1 v9 e& z4 A: E. t3'b1_01: y[a] = 1'b1;
& g( ]& a6 v% N3'b1_10: y[a] = 1'b1;
k4 d1 {: w8 s; H) Z; q1 E }3 j3'b1_11: y[a] = 1'b1;7 b9 c: k: n% p$ A7 T$ Q, G7 a
endcase3 V" D) M6 h1 _
end7 |; T% B, |0 g% S1 V
endmodule3 x6 E- X( h. w$ H/ G# c
Example 13 - Decoder example with "full_case" directive, H U% _, h3 c. p0 Y. r
Warning: You are using the full_case directive with a case statement in which$ o( g9 T- { Z- A$ p$ B, d. z
not all cases are covered
1 M. l" G0 h' f1 ?1 Z1 d' u) A8 }Statistics for case statements in always block at line 10 in file
- H# }& m# c) \% k7 O' |7 v'.../code4b.v'
6 a! W! |* G/ F7 e- g! R0 L: \===============================================
9 \- }$ U+ F j% z% k| Line | full/ parallel |7 a; Q& i# Z7 [- ?# U7 N- p# V
===============================================$ ]9 Z1 E8 ^/ o# ~4 h9 v
| 13 | user/auto |
3 }9 L5 |- n; d) S# y===============================================
; W3 f; f1 H! e$ N9 aFigure 20 - Case statement report for Example 139 H" K% c! ^% m1 P2 b, P8 e
: `) v6 s' g: ^! W
谁给解释一下原因呢?" A3 \. l0 `. L, [3 \7 s' o4 ]5 V
为啥会有差异? |
|