|
一般dly'event and dly='1'是不能寫在case裡面嗎?
" n4 [. K! W" U+ _' i0 e因編譯會出現以下訊息/ a% f" o/ T* E. N0 _( i
Error (10822): HDL error at CUB.vhd(70): couldn't implement registers for assignments on this clock edge
) u- V; I% P! q6 q+ D/ CError: Can't elaborate top-level user hierarchy
8 M, l& O; s0 V( ^! J! RError: Quartus II Analysis & Synthesis was unsuccessful. 2 errors, 15 warnings
9 h: `+ B+ a% ]- @ Info: Allocated 144 megabytes of memory during processing
9 W U$ j1 Y* |2 D: b. Z9 Q' D: a Error: Processing ended: Fri Oct 18 21:24:23 2013
) K# I6 b: |# x% O4 V# W. } Error: Elapsed time: 00:00:02
: z; S$ B4 {4 f& ~Error: Quartus II Full Compilation was unsuccessful. 2 errors, 15 warnings) z- ?5 X% @/ C! e
7 `. F, c) J0 m* v4 m0 E- d
程序如果寫的不好,可以幫我改寫,因是自學,所以比較少機會可以看到其它人的寫法!/ @* p) `* H$ N! m
) i6 ?* z! v3 T% w9 _, d
. O! j: e; c% C. H5 z# v( h+ Z
0 w7 b r$ p+ h3 W$ [+ v$ p& JLibrary ieee;! p2 s3 w5 t9 U- h# ~
Use ieee.std_logic_1164.all;
: Q/ ^( U, Q. p0 _; k- m- DUse ieee.std_logic_unsigned.all;* q7 d- [6 R. [- I
Use ieee.std_logic_arith.all;
& N2 G p ?% f" p& l! q0 Q
8 b, I! t, O6 \; \4 e( t8 y: \Entity CUB is
# d" |8 s/ s- ]/ ^Port(
( @1 ]* P6 }" `7 g sv_ctrl,coll_manu,coll_auto,count_v2,T1I,T2I,dly:in std_logic;. D5 ^+ y7 V, s4 |3 g$ Y% Q
count_clr,coll_up,coll,cold_pin,T1O,T2O:out std_logic
" b$ N9 ^ c$ {1 D" Y4 R);
, M+ v2 g3 }% V" i9 dend CUB;7 t' C' r" O6 g I) y9 Y. {
[- `4 C+ t1 B! \% X: g i' v! Y
Architecture cub_arc of CUB is& [/ ]3 t! d7 n3 s! U" {" d# R
signal d : std_logic_vector(2 downto 0);- I$ Z* O' k- ?' b. n. l8 h
Begin
# E. Q. H2 T5 l/ S' O1 a0 Z
, X3 y8 [7 p& _) i! rproce1rocess(coll_manu,coll_auto,count_v2)
1 l3 r3 ~/ x$ L: G# [4 ~/ h( YBegin
; A0 t" d: l4 F& t% X. E if coll_auto='0' then1 |5 y8 B: D8 `* X
if coll_manu='0' then! v1 i& B- O: Q5 I! F2 f
if count_v2='1' then1 _* P$ m4 U9 i+ m0 L
count_clr<='1'; & t* v, `7 w; y
else
) e; j- G: c4 @# }' d count_clr<='0';* A# k# W5 Q: J8 E, r9 j5 d
end if;* k) F# n! V/ |4 Z' H( i
coll_up<='0';5 D: U1 M3 z! a' `. W& k. D
coll<='0';
9 r! z! B6 }! m$ C9 ~9 Y$ E cold_pin<='0';; _! C' ?+ N3 H3 H
end if;
7 t4 B, I. Z6 O6 P) j end if;( U7 W# C" H( |5 e1 \$ ^% l5 \
: a! I6 U- \3 d7 m1 v% P! i3 d
if coll_auto='0' then' h1 b+ j. D n+ @
if coll_manu='1' then7 T5 w# `. Y3 j. J+ u0 B# J8 f' w
if count_v2='1' then9 O4 d! s1 p" Y
count_clr<='1'; : f b3 `, ^3 n! M f# I [3 Y2 I1 h
else5 k/ ^! A2 r- w" [0 w5 d1 e
count_clr<='0';0 ]" Z8 }6 q1 c% j/ x7 l, R
end if;( n9 |% X& x) B( H
coll_up<='1';+ q- a, T7 X" J" {1 q- n6 K
coll<='1';
3 i# B, h6 ^0 @$ f' R8 o' i cold_pin<='1';
! e' v. i% p7 l4 c2 a end if;0 x$ k; z# R5 W( d
end if;3 H8 c7 o) v5 i
, L) e$ v5 Z. ]1 a7 |4 G P if coll_auto='1' then2 W( b# V# N/ t7 Q+ k/ t9 x
if coll_manu='0' then1 E* [4 U6 j: i# H9 ~
if (sv_ctrl and count_v2)='1' then
8 N. A, l) Y$ c/ n7 k case d is
`$ Z6 `7 i* ~ when "000"=>3 d i1 b% a# ?4 L1 n
coll_up<='1';
5 O! ~, c3 K: ?5 m* r T1O<='1';8 c, M( x _* \8 Z
d<=d+1;! ~8 P3 |0 r( `, V
when "001"=>) \( p+ J" v0 C: D7 X* c0 v
if T1I='1' then3 [+ R5 t/ ^5 G) r, \* \/ v
T1O<='0';8 d+ h1 K; y& Y8 L( s; n3 s) t
coll<='1';
& a3 K1 H7 [5 x( e7 `7 b- D cold_pin<='1';- }6 q& ~8 X6 v2 q, }5 h
T2O<='1';/ I& E% g3 A0 i
d<=d+1;
, Q. x- y. ?7 |+ a/ p$ i4 D end if;
4 ^' u7 z$ Y% b3 p. ^* i" [4 o when "010"=>
4 ?) I. m4 B* E+ q/ ] if T2I='1' then- {. _5 }& |6 s3 X; ?1 V0 k
T2O<='0';
/ D* s5 n0 k0 i& O6 e* ]5 m coll_up<='0';
% g( }( ~- V) w coll<='0';* q7 z9 [8 r4 \2 F! L
cold_pin<='0';6 n$ `3 `9 d0 B C V2 z. f
d<=d+1;
& P& F; G" }4 p9 o. l; U' o end if;8 }% q# B/ D. F
when "011"=>
8 W; L+ R: J' `4 q! r if (dly'event and dly='1') then6 q2 i. A9 D: I
d<=d+1;& o/ f) S3 B% a! H# y! _$ ?$ @* Y
end if;6 v: v$ l2 v; K# f$ z$ G, K
when "110"=>0 N7 W6 W( U+ W p* G
count_clr<='1';: w$ S. k7 c' n
d<=d+1;
( g! ]. h p \" x" j3 \4 J+ U2 p9 r when "111"=>
. _" S: M) w6 ^& ?# Z# r if count_v2='0' then- Y" c# t5 ?" L0 Q2 C
count_clr<='0';
, F! B# U0 L' [ d<="000";
+ r; j/ [. R, J H1 L O end if;
( E% l& H$ {/ p9 D! P0 \ X' R( c, ` when others=>null;
6 i, s2 G$ d0 r" o% \' i end case;
c- e9 s: i- Y" Y# A end if;
5 x7 Q; {( N$ |7 Z, W end if;3 e/ R5 C: |) {
end if;( g8 Z9 y, b' q
- ^4 }6 [, m9 Z
if coll_auto='1' then
6 H% M) _; a3 w% q* a4 }! Y, n8 y% p if coll_manu='1' then
3 ?2 q4 i- w) I; w" ~ coll_up<='0';
5 J7 T# q g& {: Q% b coll<='0';
9 X' V s3 f; `: ?6 c' q( L# G7 ] cold_pin<='0';
7 i+ |- Z! c# u# P8 t end if;
! t+ N, s2 @- I6 X end if;
! [& a6 p1 D; k$ } {% R( gend process proce1;
* n- @6 y( F7 {* K4 ?, f3 D9 q
$ Q3 _8 Q2 b8 ?9 O8 _; R( zend cub_arc; |
|