|
一般dly'event and dly='1'是不能寫在case裡面嗎?
- p2 c: r N, m9 {& @3 r" a因編譯會出現以下訊息
) w3 K. a0 s+ v$ r) c, G( v. Y7 OError (10822): HDL error at CUB.vhd(70): couldn't implement registers for assignments on this clock edge) H8 v5 [& o- s2 a1 t! s
Error: Can't elaborate top-level user hierarchy
1 B( u1 m I& z, ~Error: Quartus II Analysis & Synthesis was unsuccessful. 2 errors, 15 warnings
# I* e# i P( W% v Info: Allocated 144 megabytes of memory during processing
9 Q; G/ M+ \0 Q. e; [. ?1 r5 g$ R* C+ z Error: Processing ended: Fri Oct 18 21:24:23 2013
8 _0 I+ k: R- U3 ] Error: Elapsed time: 00:00:02
7 x# Y. x3 o8 S$ ZError: Quartus II Full Compilation was unsuccessful. 2 errors, 15 warnings" l% L0 p3 }; i4 @8 R
" N) S0 [0 V4 V程序如果寫的不好,可以幫我改寫,因是自學,所以比較少機會可以看到其它人的寫法!
# c: S8 @7 C$ M: y: V- ]7 ` |' M8 y
1 A- m) j& ~6 H8 p5 B( b3 |! ^" O6 B7 n, X3 p$ s
^) A5 E) p6 K
# M' y+ U0 J& L$ [9 w$ |5 g& fLibrary ieee;
; ?6 `' i. C7 e9 S1 gUse ieee.std_logic_1164.all;2 C$ A2 \8 V9 N& B9 `0 b: ^
Use ieee.std_logic_unsigned.all; U/ p3 q7 U1 n4 G! c: U4 N6 V
Use ieee.std_logic_arith.all;
* B4 x; D2 n2 G0 D' A6 n0 Q4 ~3 _5 b) S) q; a! W$ z
Entity CUB is) b, j l7 X+ ?) h0 s" d
Port(
0 {! }2 g# ^, M7 x: S* t- Q7 [ sv_ctrl,coll_manu,coll_auto,count_v2,T1I,T2I,dly:in std_logic;
5 o4 C3 N) y w& K4 j" Q count_clr,coll_up,coll,cold_pin,T1O,T2O:out std_logic
& e0 Q0 M; `! [);8 P' ~& b2 k+ y/ i
end CUB;
c I0 C8 P6 M0 K# Z/ Z. ~1 y* D4 ^9 u/ X, D/ G: n+ R
Architecture cub_arc of CUB is
" G" @' i* l7 J) Fsignal d : std_logic_vector(2 downto 0);+ ]5 u% F; q9 `& d' Z6 \
Begin
p# q% m, e2 Y/ ?# e1 F' s6 C
Z, d, s/ L' I4 x" W! Yproce1rocess(coll_manu,coll_auto,count_v2)
+ p3 t- ~' H! W9 Z5 V- n( I0 IBegin
9 ?) ?2 c' l; O5 M/ k if coll_auto='0' then8 f: j5 U# _6 A) O# U9 J: `
if coll_manu='0' then1 ~: Z6 d2 A& Z# P; _) v
if count_v2='1' then
1 [* }; \: t9 j9 s i count_clr<='1';
1 d0 w& w- x7 i else9 Z) O$ h, Q( Y) o/ I
count_clr<='0';
2 p2 V# c; I) E& H- V end if;
* P' a7 |# r& s% \3 e9 r; P3 j coll_up<='0';
" C8 g' O \0 z4 u8 Z9 Q. a coll<='0';( Y2 y2 s# Z% o( i& r) M, u. Q
cold_pin<='0';5 w4 G4 k6 F3 V; N, s+ D" S/ _
end if;
- g% v& f/ X( L1 S' c end if;
4 A5 ]" V7 C% x8 W+ P! b- V0 z( E) o
" ~1 W; s1 O! O( Q if coll_auto='0' then# T9 p" |+ e1 f0 n. f, u
if coll_manu='1' then
+ |. j& ~" k1 R5 ^6 f9 n! f* Z5 d if count_v2='1' then
+ U& x6 s- n+ f* I. g( w9 N count_clr<='1';
% b7 I6 y8 G+ _) E; z' V5 U' O; F else5 |: }) H3 G' u2 M
count_clr<='0';
5 o6 B+ ]# O6 b# h. q end if;
0 S+ Q: A8 K' ^% @! a coll_up<='1';& P; z* Z$ }8 |# g
coll<='1';
' P- G/ R0 [$ z/ O/ R7 L0 G cold_pin<='1';
, _1 {+ h! e3 \! @. ` end if;
5 l$ ]# W4 w! w% N1 [ end if;( r b# a6 |' H6 @9 r
4 \% g" H+ o# W' O4 v# Q if coll_auto='1' then8 v, R- b& c2 G! \& z! M
if coll_manu='0' then
; P# Y3 |' V( `4 ^ if (sv_ctrl and count_v2)='1' then9 O `5 }' b5 E: v5 ]+ r4 g2 s2 e
case d is( s- g2 {. `3 v# [7 U$ `
when "000"=>
0 q' h- W: o8 h coll_up<='1';
4 Y, p! h, q5 R5 t! J/ S1 I T1O<='1';, \9 ^( E% E- F; Y; L
d<=d+1;/ p/ @3 D: P- ~0 v! X+ r7 @: {) J
when "001"=>
. ^. w! K) C- ?4 S if T1I='1' then
" c G7 H9 S4 l; s T1O<='0';
! b$ k* m/ k: u; h' l1 O) p coll<='1';3 q" o( T) z4 K6 j& r
cold_pin<='1';: l9 c( \! M2 H: Y
T2O<='1';
+ v; ~1 `8 H' }' B+ Y& L$ |) ` d<=d+1; a% T( {6 Z' a* H* j1 ^- Y( h
end if;2 ^7 y; U. u$ Z0 }( B+ u
when "010"=>$ p' z( ?' Q( w* G8 i, a
if T2I='1' then8 Q# L; Z* R% ^
T2O<='0';
$ Z: V8 g6 e& ]0 A) u8 J" T coll_up<='0';
4 D2 a7 i# ~. m7 N coll<='0';" R0 O L2 L- J1 L% Q8 M
cold_pin<='0';, P- _- J$ h6 ?* \; V7 w
d<=d+1;5 r0 f1 u, _$ F! R9 @
end if;
! x$ x, J) p* [( {# z2 ~ when "011"=>
3 \, i \& d; n# s2 d$ { if (dly'event and dly='1') then
5 z7 E3 `" m4 Y( P& ]/ ]1 h d<=d+1;+ h1 J9 r& g" G( D: C6 C Y& q% P
end if;3 b9 J" M6 H6 S& p/ {
when "110"=>& ^) h; e: b# f9 e7 X
count_clr<='1';: l8 r% A& x: n0 I# u9 t! I% O
d<=d+1;
! c L: Z+ z; a! | when "111"=>' F8 n* d0 F$ X! j) a# w1 g; b* ~
if count_v2='0' then
7 n3 c4 \0 W. o: v" Y) U% J count_clr<='0';0 F0 O% L3 L' t. S: B
d<="000";
]1 D) v0 _' M( H1 e0 W" }) W end if;
- Q: J$ A$ V3 |% |5 D. g, M. J when others=>null;; Q/ ^% _; G- O
end case;
3 x* {7 _1 y5 T/ ?1 \9 _ end if;
: c- D& m" D* m% y5 ]' |' ?0 w end if;" [& h& h' G1 }1 Y* U2 _
end if;7 {/ ]- }& {9 s3 {$ I& S
2 u4 d: k8 ?& c
if coll_auto='1' then' e3 k+ p" N& c F
if coll_manu='1' then4 X4 ?! J/ ]1 t8 u; J' G6 u
coll_up<='0';
, {+ l Y5 o6 F; m coll<='0';& t5 U# M7 \, [
cold_pin<='0';# E4 Y) C1 |( `! B, @
end if;' S6 `. G# {7 l1 H3 z
end if;
( r6 b7 {" T/ X) J) ~7 A) tend process proce1;8 P+ o1 s$ C$ q
% a8 {% k2 W+ {4 s, B+ ?) s5 S
end cub_arc; |
|