TA的每日心情 | 擦汗 2020-1-14 15:59 |
|---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑
c# q$ S" _" ]5 d* v4 N' e6 R9 C( U
# v( i# b/ R! u2 M7 V( K0 D$ Y5 K
8.0 Actual "full_case" design problem' b1 e6 ~0 Y6 [0 r* U% T2 C
The 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using# @* K( P7 R8 m% G2 {3 A% q
any synthesis directives. The resultant design was a decoder built from 3-input and gates and+ U d# Y2 H6 ?) \
inverters. No latch is inferred because all outputs are given a default assignment before the case
; x' N9 |8 j5 P9 ~statement. For this example, the pre-synthesis and post-synthesis designs and simulations; }& u/ @3 l6 ?# X/ \% H
matched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the
- T# J3 ^/ V1 R P( h4 D% c"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was; u: u9 i4 j0 r- c, A( w% Y5 d
optimized away during synthesis and left as a dangling input. The pre-synthesis simulation& j& @- u9 B2 ?
results of modules code4a and code4b matched the post-synthesis simulation results of module
/ T% ~4 a0 Q0 L* k0 bcode4a, but did not match the post-synthesis simulation results of module code4b [2].3 F- T* p# o% c: V1 y+ |' f: F7 c$ w
// no full_case
% |( Z) `8 [ S// Decoder built from four 3-input and gates, c, f7 x) f9 j5 d( g2 x
// and two inverters
. j0 a7 w9 E6 F9 F) Qmodule code4a (y, a, en);8 G: |/ B+ p1 K u2 E
output [3:0] y;. e( T4 p: W4 E/ J- {4 o* j# Q7 _' M, {
input [1:0] a;- k4 E/ \- t' o
input en;
* `. |5 q8 A& ~" e$ F/ q9 Areg [3:0] y;/ @2 T. w& k/ r. ~, U
always @(a or en) begin# ~5 L6 i/ u# h
y = 4'h0;/ y* c* s5 A$ v2 J
case ({en,a})
, q) F# X5 t7 N1 n2 P+ j2 E3'b1_00: y[a] = 1'b1;5 s k6 Y2 ]5 F; B# r5 R2 D7 [* X
3'b1_01: y[a] = 1'b1;
8 P4 n+ l, ^, N0 H6 }3'b1_10: y[a] = 1'b1;
7 I3 ~6 G7 E) H- w' ^3'b1_11: y[a] = 1'b1;
+ B9 [ |, X) n# ]$ c( d9 T3 hendcase
+ U- p3 [4 |( u' \- ]+ S9 fend
+ n: _- {' x2 t2 @endmodule
# k3 h7 z, [; u, }6 r1 K3 O- `% gExample 12 - Decoder example with no "full_case" directive
8 S( x7 j- E* p- gStatistics for case statements in always block at line 9 in file( F8 r& W' w8 Z6 b1 l: u) L9 c* i8 n
'.../code4a.v'
: s0 d, V/ I, j===============================================) P, k5 H; I& \9 U3 n& `
| Line | full/ parallel |
4 o2 S6 ~; b) d3 @ i( Z3 m===============================================
% C3 k2 S# n k6 U! r! Z8 a6 e+ k| 12 | no/auto |
g' s; M, e9 l2 p9 q2 f9 N% ?===============================================$ j. c8 ]# G# T& ~
Figure 19 - Case statement report for Example 12 G2 N/ b6 x- `/ y4 D
( G% K, g7 w9 n! o
( {/ T2 S! N; n# t1 D+ S0 H// full_case example
/ c. r9 X5 a+ D& d, k. r3 N// Decoder built from four 2-input nor gates: r" x7 b4 U' b$ [/ ~
// and two inverters
; K; ~+ H& ]1 B8 {. l, R// The enable input is dangling (has been optimized away)
1 ^/ Q3 L" s; }, I! r, q. ]# {module code4b (y, a, en);# T1 k6 j/ y0 W4 ], t, R- Q0 I/ Z
output [3:0] y;% `' d% H# h4 \7 c) K5 B7 d- L
input [1:0] a;, W$ x, ]5 ^. J9 l% M. Y& G1 V
input en;
7 q6 [) z- G7 S3 @- |5 ?reg [3:0] y;$ E+ Z3 {3 E* k* Z; e
always @(a or en) begin7 F9 }( |0 A* ]! L! V0 W/ B4 o4 }
y = 4'h0;7 g" y* }! E- x5 V! w
case ({en,a}) // synopsys full_case2 R% \6 r2 o+ X! Q
3'b1_00: y[a] = 1'b1;( J, u+ m* `7 |% I6 _
3'b1_01: y[a] = 1'b1;
6 t0 w6 m) @, C; ]3'b1_10: y[a] = 1'b1;4 Q4 D, Q5 F3 { r
3'b1_11: y[a] = 1'b1;' H4 F, h1 V( G- S% Z ?
endcase
3 L& q2 W% i- I3 ^: B1 Cend
1 L# y; c' Z7 s3 Nendmodule
. w. R& }6 ?1 Y, CExample 13 - Decoder example with "full_case" directive
4 P* K, a' }- f, B: [Warning: You are using the full_case directive with a case statement in which
2 K3 L5 h1 P G9 Anot all cases are covered
9 t6 @0 s1 H1 h+ R UStatistics for case statements in always block at line 10 in file
* P5 r$ {- A/ M3 d'.../code4b.v'
4 K) K! h5 Z0 M: g3 ?( [2 l; ]===============================================
. g6 c; p. F1 o- K| Line | full/ parallel |
/ w1 \* }6 L) Q5 {+ Y; R=============================================== D& m2 V( C8 \) M: q
| 13 | user/auto |5 M1 w8 u8 I, H+ X1 d
===============================================
+ [" B j( A; [/ S" \Figure 20 - Case statement report for Example 13
* R& d9 n! ^0 B5 O1 k, E. ^. F' G: c, [% V: e* H0 H( X
谁给解释一下原因呢?
$ q# O) e& ~! Q2 L5 k为啥会有差异? |
|