Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

搜索
1 2 3 4
查看: 19080|回復: 16
打印 上一主題 下一主題

[問題求助] VHDL新手上路,程序Bug請教

  [複製鏈接]
跳轉到指定樓層
1#
發表於 2013-10-18 21:15:06 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
一般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;
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂9 踩 分享分享
2#
發表於 2014-11-12 10:14:35 | 只看該作者
你有打錯/ E1 _  Q" E! I$ \. U9 U# ]
4 ]2 y0 l" ?5 n+ a

9 I* M4 Y3 v6 ?& i" \* _& OLibrary ieee;8 z" Q* c3 p1 ?) P0 O1 x
Use ieee.std_logic_1164.all;7 a5 A; Y. {' Y, A) r# p8 R0 L
Use ieee.std_logic_unsigned.all;  h- j- k+ a, Y9 V- f
Use ieee.std_logic_arith.all;
$ u. A6 F9 x* U5 A
: f2 A$ O1 a7 FEntity CUB is
6 r8 n/ `$ Y$ l! S+ y, ePort(  I. [' r& x) D- h! s% }; `. ~  n
        sv_ctrl,coll_manu,coll_auto,count_v2,T1I,T2I,dly:in std_logic;/ Q9 z7 S4 T+ ^1 N
        count_clr,coll_up,coll,cold_pin,T1O,T2O:out std_logic; n1 n  ?" h6 |; D+ B) f( W: {
);
# z" r) O% i, ?9 P1 Jend CUB;+ n) D3 ~5 O* F# q4 g0 T  `* |
: N4 u! D# Y5 r) ^9 {. M& v5 P4 v
Architecture cub_arc of CUB is
; ]) {3 ?6 G& E% s" F9 U3 Y5 [5 [! `- j7 \" z
signal d : std_logic_vector(2 downto 0);& K1 q3 `: f% j* P
( s! ]% H  t$ X+ S0 B9 X: a# D
Begin  4 W, E" V2 ]! g2 }, g- D( `# A9 W7 U

/ M) ]) G7 w) Y1 h7 aprocess(coll_manu,coll_auto,count_v2)" c$ j+ F' e  ?: ~; |6 N

, @0 O9 P6 Y5 ^! P0 gBegin
% t9 d. \. M) A  L
* J7 A! h' K& A' _0 S6 @( d    if coll_auto='0' then
/ B& }0 `5 n9 Z4 A, w        if coll_manu='0' then
) @- d7 |9 U9 z& o2 o: h            if count_v2='1' then
; q+ S" k( V' ?- g6 Y8 r                count_clr<='1';
) R8 s$ D: `/ C# u+ e" ~' q            else" h$ ~6 ^% P4 Y8 L% ^
                count_clr<='0';+ u7 {) I4 z5 }9 \% ?
            end if;, ]' _+ `3 X9 L
                coll_up<='0';
4 Z; A* x: A" G7 @6 E                coll<='0';6 u4 i& F& G/ p5 {8 d
                cold_pin<='0';2 p( k- D+ `$ O* |) D
            end if;$ R) t( K- T. Z
        end if;) ]7 t9 `0 q& l
        if coll_auto='0' then
, V" k3 E+ i! m! _4 v. \                if coll_manu='1' then. J1 H' U% P0 c
                        if count_v2='1' then& ?6 ]6 V7 d3 q. D
                                count_clr<='1';
$ s' S7 [/ ^( P; P" {+ n+ [                        else' d3 `7 L" s; F
                                count_clr<='0';# p" p9 R8 R1 p* l. w) W
                        end if;$ B& T7 g; g! j
                        coll_up<='1';- `  v) I0 e5 d6 M8 d
                        coll<='1';1 ?- u/ k9 I- x' I# l  |/ Q
                        cold_pin<='1';7 L) J, O8 y8 K0 A2 W  z
                end if;- C3 F! N3 n6 ~4 H  V
        end if;
" N5 x) D! l. @4 Z  ^/ }* @6 Z) m
        if coll_auto='1' then1 A4 R$ ]$ @) U2 e5 Z' d
                if coll_manu='0' then
9 v6 n8 a& o. }! w3 ]                        if (sv_ctrl and count_v2)='1' then
( Y7 a# Q/ z. z; x' X                                case d is: |0 S/ C: }" J; u
                                        when "000"=>5 P% B' {: f/ D$ e  h- t4 G
                                                coll_up<='1';
0 s- w: x* `! [" F, i' `  m                                                T1O<='1';& J. v% w+ ^$ w0 Q$ r. V
                                                d<=d+1;
% ^! R& d' _7 t8 T9 |: ?- e- M" E9 J                                        when "001"=>
7 u8 {7 ?. N1 N* C# ^$ z8 z/ \                                                if T1I='1' then
( }: h! F  X3 M# K& n                                                        T1O<='0';
* s# g3 c4 ?: E7 b* x+ a6 z                                                        coll<='1';$ w$ [3 }: ?" q2 ^% @6 z
                                                        cold_pin<='1';
3 e! w8 G* T7 e2 j4 o+ \8 H                                                        T2O<='1';9 `+ V' X7 L  s  \+ ]9 Q+ A& |/ W; k
                                                        d<=d+1;* i- Q/ m- X" e: x" n5 U
                                                end if;
4 X$ \2 e2 B2 n8 u                                        when "010"=>
8 a1 t* s# P4 y                                                if T2I='1' then! T0 u" N4 S8 f, l- a/ k
                                                        T2O<='0';& F* `+ q7 e& |- [4 |# I% e5 {
                                                        coll_up<='0';! \. d3 _- R! C- Y
                                                        coll<='0';
4 s9 Z$ d+ H6 F" Q5 H) |                                                        cold_pin<='0';
. s7 Y1 R( ]1 O1 f( G                                                        d<=d+1;
- [. R3 g+ Z/ Z( U                                                end if;
* ~# A. {! o# E: _0 L1 w9 X                                        when "011"=>
9 a* D9 G5 \4 B3 f7 w6 I- `2 m                                                if (dly'event and dly='1') then
# ?- o7 h1 ^- T3 H5 G                                                        d<=d+1;
8 t# g, X6 b1 S; N                                                end if;
/ q4 q7 q. Y7 q$ l9 C- t                                        when "110"=>
. x3 x7 o) [0 m( [6 W1 \                                                count_clr<='1';
0 u8 H/ z; ]5 G% p% y                                                d<=d+1;
1 W$ |  j6 A! p# }! E* P                                        when "111"=>; {; n4 E* s  R9 x
                                                if count_v2='0' then
( G: }& P5 o5 D& N6 n* b/ O                                                        count_clr<='0';4 M1 S. t9 L" ?' _& h) E# `) J/ E# b
                                                        d<="000";
7 Q8 q+ @  Q; B5 j3 V( x. m                                                end if;. x+ s( W' |3 A0 R( \
                                        when others=>null;3 h9 b8 \! y6 h5 v" e( o9 [
                                end case;/ y; d( m8 d. Y0 b! j
                        end if;" v/ l$ H' p. P, j* W9 E) g' e0 s
                end if;
7 R2 v- |: y: @: c+ b. z) A        end if;4 u/ o) B7 `3 [6 T  q4 O
        if coll_auto='1' then8 S+ g5 n: s8 y! J. v
                if coll_manu='1' then* \0 D5 g$ ?7 N* e; [9 u
                        coll_up<='0';3 |- `: r8 g" L6 l0 H& D: ^
                        coll<='0';
3 j3 {# m0 s: v& P, L# O6 S) i                        cold_pin<='0';( F6 v* i) F' [3 T
                end if;
; }" S' y, k! M' q( j        end if;
2 L$ [, f7 ~3 k; Xend process ;
+ w3 g: W! l9 p/ Z1 }: f3 x  Kend cub_arc;
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

首頁|手機版|Chip123 科技應用創新平台 |新契機國際商機整合股份有限公司

GMT+8, 2024-4-26 10:47 PM , Processed in 0.109006 second(s), 18 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表