TA的每日心情 | 擦汗 2020-1-14 15:59 |
|---|
签到天数: 1 天 [LV.1]初来乍到
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
对这段文字描述感觉有些困惑
2 V. O: {/ _/ e2 z) T( i) Y1 K% R2 M
+ N) s7 z3 l" o2 \9 l8.0 Actual "full_case" design problem% h8 H+ H. Q9 x, `
The 2-to-4 decoder with enable in Example 12, uses a case statement that is coded without using
1 Y. x' e- I( Many synthesis directives. The resultant design was a decoder built from 3-input and gates and3 c3 x+ k4 V3 w1 Y
inverters. No latch is inferred because all outputs are given a default assignment before the case
: m" f- V4 P% [! Qstatement. For this example, the pre-synthesis and post-synthesis designs and simulations
0 h0 w) N2 K8 R- v2 _3 Tmatched. The 2-to-4 decoder with enable in Example 13, uses a case statement with the
$ E) T* ^0 O8 o! l"full_case" synthesis directive. Because of this synthesis directive, the enable input (en) was; M- [2 i$ @ ]: M
optimized away during synthesis and left as a dangling input. The pre-synthesis simulation
- a8 f m) U/ U }& H5 J; ]results of modules code4a and code4b matched the post-synthesis simulation results of module
! `8 A& v0 A7 G" i( ucode4a, but did not match the post-synthesis simulation results of module code4b [2].
l, y' f4 `6 i. Q! n; Z// no full_case
: l0 }1 z$ \$ h) v r1 W/ Y// Decoder built from four 3-input and gates
! y% s) O9 w2 _/ o O9 b6 D( y// and two inverters
, ` {! y* ?' j" Q+ e5 y- ?, _module code4a (y, a, en); G: i, ^% m+ E3 ~
output [3:0] y;/ X3 Q1 I' Q7 t$ V7 P7 N
input [1:0] a;# d0 |2 h" x. ]1 _- }3 C; P( D
input en;' X" v1 i) ?7 x
reg [3:0] y;
: k3 x. Z$ A6 E) Y1 i3 x1 valways @(a or en) begin8 d6 F5 o% {8 U
y = 4'h0;
; A3 I A7 T" h% V1 vcase ({en,a})
$ ]8 ^* f( a5 K: A1 @$ u3'b1_00: y[a] = 1'b1;
; t! R* R7 D2 h; ?4 Z' @3'b1_01: y[a] = 1'b1;
* z+ ^' z3 u8 j% U" T, v" A3'b1_10: y[a] = 1'b1;% f! T* K5 i/ h; w2 |! I
3'b1_11: y[a] = 1'b1;. W9 `# Q, n$ D) p
endcase& ~: B5 y4 T' z. C
end
5 ^2 j9 b( q7 Iendmodule1 I1 L7 [ _9 U, U
Example 12 - Decoder example with no "full_case" directive$ y" R5 A7 p L" O
Statistics for case statements in always block at line 9 in file& A/ ~+ K- c" u
'.../code4a.v'+ ]" |2 x/ I$ m
===============================================/ j4 \' o) d# N1 U0 r! ^! b
| Line | full/ parallel |
Q; h7 N, @- h; _. G" q6 k( T===============================================" E7 W. }# S' L+ }
| 12 | no/auto |* ]; E% W4 P6 f3 C6 m% A
===============================================( T5 r8 H$ n* V; I
Figure 19 - Case statement report for Example 12
$ ?' O, y: w8 j+ u! w& p
8 `* C4 O9 z2 o7 |/ V- e
% B" @: ?1 @% t* b: I, R2 g n* k// full_case example' h, |' U5 z% k" J) f$ a
// Decoder built from four 2-input nor gates
0 B3 u6 N5 k2 F5 q! K! P// and two inverters* C2 X, }# k6 e8 e
// The enable input is dangling (has been optimized away)6 m4 g: u8 M8 C) A4 C3 U0 \
module code4b (y, a, en);
$ @: H: ]8 ?/ V$ g- M* foutput [3:0] y;* r. A' \) q) q; S7 a
input [1:0] a;6 x, i* s$ i6 o' k# ]. z l7 C; H
input en;% T# G8 ], [8 P' ?3 M
reg [3:0] y;. @7 L* s( k, b! T3 f+ Y& u9 u
always @(a or en) begin: Z* s1 C& X7 X0 K0 o" q
y = 4'h0;
, ] s) e, \. Ocase ({en,a}) // synopsys full_case3 b$ n# r2 d- ?/ j
3'b1_00: y[a] = 1'b1;# k* i9 u$ L( C1 o
3'b1_01: y[a] = 1'b1;" J7 J) a+ [; }( d$ y7 o: n# D# l7 v
3'b1_10: y[a] = 1'b1;
9 W7 `% I2 f4 {, [0 ^" b8 y4 E3'b1_11: y[a] = 1'b1;' a. y0 Y* b0 k% X) N9 p- W9 d
endcase
+ m# w( [! Y7 ~" Qend& s6 e- h5 i8 ~
endmodule
7 _4 Y0 U( N5 d' ?6 h4 s* uExample 13 - Decoder example with "full_case" directive% @% X8 Y9 X, f6 R+ q2 z
Warning: You are using the full_case directive with a case statement in which
# Y0 u$ L7 E" L9 Q5 Enot all cases are covered
$ z0 ?) t) A7 ~4 vStatistics for case statements in always block at line 10 in file% d0 ? R# J; f9 s% v! H$ k
'.../code4b.v'
- d5 M, F* \) E2 V: y. I===============================================2 D* X0 f5 n+ S# {6 i# C; d5 b
| Line | full/ parallel |
$ q, Q" A& l3 z! E===============================================
* e% e& h$ U. b) X| 13 | user/auto |
$ K% B5 b; U- r2 U% _===============================================
, O4 b4 u6 A3 pFigure 20 - Case statement report for Example 136 ?0 B8 R# |% V, b# @9 m
$ q/ @9 |! e6 \1 x# p- e
谁给解释一下原因呢?" S5 m( z3 C" l+ Z! @0 d$ j
为啥会有差异? |
|