Chip123 科技應用創新平台

 找回密碼
 申請會員

QQ登錄

只需一步,快速開始

Login

用FB帳號登入

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

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

  [複製鏈接]
跳轉到指定樓層
1#
發表於 2013-10-18 21:15:06 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
一般dly'event and dly='1'是不能寫在case裡面嗎?2 R: v7 q$ A' }8 h- r9 y
因編譯會出現以下訊息0 t2 y9 M- v7 q& {+ P$ {" H
Error (10822): HDL error at CUB.vhd(70): couldn't implement registers for assignments on this clock edge
/ E$ c: H4 P6 vError: Can't elaborate top-level user hierarchy- m2 `# f, f' P+ Z- J
Error: Quartus II Analysis & Synthesis was unsuccessful. 2 errors, 15 warnings
- f' {: T( H( o: w5 J2 h/ C1 a        Info: Allocated 144 megabytes of memory during processing
6 |) B1 P- b3 R4 ~        Error: Processing ended: Fri Oct 18 21:24:23 2013% n1 d) s! D; p: ~
        Error: Elapsed time: 00:00:02
- C! |5 R3 i1 ^2 k: j# S: d/ g% j* W  vError: Quartus II Full Compilation was unsuccessful. 2 errors, 15 warnings& s$ z/ R' V- `' e& Q
) ^  U, O8 b: W0 {
程序如果寫的不好,可以幫我改寫,因是自學,所以比較少機會可以看到其它人的寫法!! l9 l& Z# P4 c+ F/ k5 O5 u0 @2 {

* f, \! f- ?- y+ L; c
3 ]. P/ @- o* B) p* l& `$ m: Y; {) r. [3 G
" X4 s9 \4 G( `+ u: c6 R* A5 r
Library ieee;
) g) `+ |8 g/ S+ D3 G/ ^Use ieee.std_logic_1164.all;& d9 b- N6 v" }! o) B* l/ j+ M1 E. O
Use ieee.std_logic_unsigned.all;
& L7 t. V* s9 r, TUse ieee.std_logic_arith.all;- r, X) y* ^4 n- S7 ~$ u+ x
6 \$ U4 F$ x% H8 K/ ^
Entity CUB is
* r% m" K# R* P' X8 K6 fPort(0 h# L& R# n4 y
        sv_ctrl,coll_manu,coll_auto,count_v2,T1I,T2I,dly:in std_logic;5 L: T1 z/ T! @: i2 g" _! a: B) A
        count_clr,coll_up,coll,cold_pin,T1O,T2O:out std_logic
# i' r2 b: {3 M9 B( A);
- {3 w& o+ c6 J. v% nend CUB;; m& b4 k, w, k: P
- v9 e9 G- H) K4 ]( E
Architecture cub_arc of CUB is" k& M0 T8 I/ J! \' x7 Q. I6 v8 v* n: R
signal d : std_logic_vector(2 downto 0);
# u* |9 e, x2 p  @! b2 J& uBegin' h# c: I  ]" @% V. V" s# O1 ]/ B: l
0 [0 S3 D% D7 K  t! f/ L
proce1rocess(coll_manu,coll_auto,count_v2)
+ M3 g6 c5 j$ nBegin) [, j1 L& y. Y+ D% v
        if coll_auto='0' then
% r) C( ?2 `9 `" v8 G                if coll_manu='0' then
0 X$ Y, \$ e, D/ j2 l2 q. k                        if count_v2='1' then
" k0 p0 H6 k0 K  y                                count_clr<='1'; 1 _' o; ?: a# r; H2 D
                        else* p% n' d( D! V$ L1 U  j
                                count_clr<='0';; @% W* a+ q. e; g& N8 u( d1 B
                        end if;
. x7 M' l$ T( `3 `! g0 B/ O$ [  Q                        coll_up<='0';
) Y, o, c' r' C% p  n& W                        coll<='0';
+ ^! H! A$ r5 h8 H" h                        cold_pin<='0';% j( |1 w: E, [; B: W9 A& \
                end if;4 L: f+ e6 ~& \  S
        end if;& A2 y2 m& \7 g* R
       
  c6 q6 t' {2 _) O, h* w3 b        if coll_auto='0' then
1 [0 ?  \6 y; I# O1 {1 |" v7 R% i                if coll_manu='1' then. u6 |. ^* _: ]  z
                        if count_v2='1' then
9 u/ [, V+ h. L                                count_clr<='1';
4 b! p6 }$ {  f, Q4 i                        else/ D! T' Q% A) @
                                count_clr<='0';  M1 N( Z4 @! i6 A% N0 V/ A# |
                        end if;
: w3 V! g7 W% L) |7 A                        coll_up<='1';
, Z' x0 J1 T7 C. ~# s9 m: E                        coll<='1';! g- E; t& L/ M9 S; D
                        cold_pin<='1';
6 g* r. \2 l" S; |# i6 R6 V                end if;
# X0 b: h" Z# d5 K        end if;
$ K4 A. }7 ~8 ?7 O( ^        ' M8 I8 f  P7 |  c9 O: C# v2 ?+ L
        if coll_auto='1' then) \5 D" ?; T) W' s
                if coll_manu='0' then  {, P8 b& k' h+ [  S2 ]* F3 v
                        if (sv_ctrl and count_v2)='1' then
, J2 |/ N, c5 P                                case d is7 E7 J0 s6 g' G( h0 e$ |
                                        when "000"=>
2 c6 m2 n% O1 g, p# @7 P) D9 d1 V4 b                                                coll_up<='1';4 x- q$ b  p7 _" a. F
                                                T1O<='1';9 J* t  V5 Z  `8 J8 a; s
                                                d<=d+1;" _( ?" l! V. |) G
                                        when "001"=>4 h" y& k& K" ~: n$ I( r
                                                if T1I='1' then
( t1 x) S  w+ N5 p6 ^5 N5 c                                                        T1O<='0';
- K+ v, O- }. l* ^0 {1 x                                                        coll<='1';
7 [. l, c  G! a                                                        cold_pin<='1';! s* u  q; J# \  _8 I3 F7 S8 `
                                                        T2O<='1';
) R6 }: C! V, I) v" Z                                                        d<=d+1;
3 ]  @6 k7 H* t5 E                                                end if;. y: i6 {- d4 ?
                                        when "010"=>6 j7 f, }3 E, T& g; ^5 m: F) Z+ x% V- Q
                                                if T2I='1' then
- F8 v1 p8 L  G# m; z. w                                                        T2O<='0';
+ {: x7 a/ d  ~- C. {9 M6 @% P) y) f                                                        coll_up<='0';3 l0 q6 ~6 F4 s2 i; L4 y+ J/ I
                                                        coll<='0';
9 P7 ~+ c& M1 o8 S  k                                                        cold_pin<='0';
) b0 m3 ^# U5 @5 t3 q                                                        d<=d+1;  i9 g1 @, H0 S
                                                end if;
: |/ x% B+ l$ P  ]0 P                                        when "011"=>
9 j8 u% f: A" l# T1 Q( ~- h2 }* H                                                if (dly'event and dly='1') then& h/ q" Z& b3 W1 B0 J
                                                        d<=d+1;4 H& ]* _6 @; I! Q) G* Y
                                                end if;
; r+ I) ?5 U$ z7 L; O                                        when "110"=>8 ~0 Y/ A6 a& N. Y/ C
                                                count_clr<='1';
6 J8 A" p9 F$ F                                                d<=d+1;
. Z# D: o: C0 s$ A                                        when "111"=>$ U3 L6 k; ^6 K: j
                                                if count_v2='0' then
7 B7 n- F3 Z8 L                                                        count_clr<='0';
/ f7 f3 Z: F7 b+ R                                                        d<="000";
& k# n2 Z; ~' M: v7 S6 V! y                                                end if;
8 U; }1 i1 O7 M6 C" _                                        when others=>null;+ K; w" b# a! @
                                end case;
/ t$ n3 }7 ^: @$ S' J  Y/ n                        end if;  q- Y+ ]- B! {; l. {& ?
                end if;
# A, l2 Y; V: n! J/ x2 O1 Y" T2 h- Z        end if;
) @  P' C0 w, f$ P6 l0 Y$ b       
, G# K0 _( q; g. P        if coll_auto='1' then
! c2 {* ^' l; Q5 G0 b5 U                if coll_manu='1' then
& ]. _9 ^. b& `4 E                        coll_up<='0';
4 i# x4 p3 B2 Z9 |0 [                        coll<='0';
/ J# ]; Z# V8 z- t: f                        cold_pin<='0';  i4 [$ w3 ^) N" P
                end if;
# y$ t+ x8 q" G8 P        end if;! V% q# O( n5 |" T5 R9 n
end process proce1;
7 w' C. {* r5 Q& W, G
$ d' Z7 H* y4 }7 P. D% q# m$ ^7 oend cub_arc;
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 頂9 踩 分享分享
2#
發表於 2014-11-12 10:14:35 | 只看該作者
你有打錯
# f0 Z) |  J; k: V
9 g& a  p& ]. [% p# b) B1 I4 s( e& b/ Z
Library ieee;
% Y2 _: w7 f! aUse ieee.std_logic_1164.all;; X1 G5 d- E: c0 ~4 j& E; U  V
Use ieee.std_logic_unsigned.all;4 c* d8 a; h, p$ v
Use ieee.std_logic_arith.all;
+ Y( h7 W; g/ H6 B8 q' _0 S, L5 A. i! t  T! M( |0 \4 {( D
Entity CUB is
. M7 q, C# Z5 E1 ?# h- d, k! qPort(& m5 g. J. D9 g) [/ \
        sv_ctrl,coll_manu,coll_auto,count_v2,T1I,T2I,dly:in std_logic;7 ?  Z, l5 k, g2 |2 M1 f
        count_clr,coll_up,coll,cold_pin,T1O,T2O:out std_logic
: s( J- D, }4 l  b4 O6 `);; z$ ?7 u! _/ v" h9 N
end CUB;' G0 k& i& t/ f1 p, q) g4 Y. I6 _
# \( _4 e4 P* Y, J6 e* U. }2 ]7 x
Architecture cub_arc of CUB is+ t2 w& A+ J' ]( u) l

, f- E% ^8 o6 Vsignal d : std_logic_vector(2 downto 0);0 h  c. b& {- `

+ {" ?, G& Y2 k# ]4 ?Begin  
2 z. a/ S3 l1 u
8 T2 ^/ c6 o# y  l8 t5 c6 x& n4 Mprocess(coll_manu,coll_auto,count_v2)( N7 b7 E: b7 d3 f; p9 F9 w
* J4 g$ K# B( L: K9 t6 ?. b3 P
Begin3 z' `7 `* e  w; v+ K
; k/ g% m) B$ h# U! U
    if coll_auto='0' then
4 n' e. t' f2 z+ K8 R& y; L  Z        if coll_manu='0' then
6 M: j! b( ?$ m' O8 ]5 m  o1 g% {# |' |            if count_v2='1' then
6 n7 D* S  M' N# ?6 {& `/ v. ]                count_clr<='1';
: w5 Z- e( p4 \            else
8 Y+ k( R& O1 H% {                count_clr<='0';$ E% @; }" h' h  k3 R
            end if;! ?% C1 M8 I. W- s$ v- @
                coll_up<='0';9 E! r7 u; k* t- ]  I  O
                coll<='0';
% |" F6 k& B2 c: R                cold_pin<='0';+ h" [- n; K4 Z. V1 t  J$ I
            end if;9 D) p* r) \% k% n! w& K: x4 ?
        end if;
8 L, k9 X3 H1 x$ ~4 s% ^        if coll_auto='0' then* f# E' q* p$ t$ d' _* t/ I
                if coll_manu='1' then
5 F: b4 d! o* c4 g. S. A! g                        if count_v2='1' then
8 e1 j# M8 D: d8 |" a" i/ {2 @                                count_clr<='1';
9 u$ H6 ~# `) }* Z& j                        else
/ S+ W* w9 x+ t                                count_clr<='0';
' s1 e% h. F5 Q2 x                        end if;5 C0 T2 q7 _* b# p2 |# l
                        coll_up<='1';- G8 S9 d; T0 j
                        coll<='1';
# F% s0 V* r2 K, p* e! ?# G                        cold_pin<='1';4 O4 c/ Z0 J9 E3 V# y/ F+ a& E0 j: {
                end if;
" }" {2 x: T9 c6 A        end if;
2 E0 \& I, t7 @$ `8 u  W5 V( S1 C! e5 r/ o/ q- g6 |- `! a: u
        if coll_auto='1' then
9 [3 _+ e# p; u1 E                if coll_manu='0' then
( q0 j' M' \5 [$ b" ?; O$ X                        if (sv_ctrl and count_v2)='1' then
( T' E9 f+ i3 o! V, j3 S) \                                case d is
; }6 V# P5 V7 K# l! |2 |                                        when "000"=>
" E- e9 Z: z  R, L/ h7 n                                                coll_up<='1';
$ a+ p/ S! p; l7 }  s                                                T1O<='1';
9 H3 S& L" Q' n) D& {0 h, ?  {                                                d<=d+1;6 p0 H) J  f. x
                                        when "001"=>
" z$ Q. f+ m7 E( s  H                                                if T1I='1' then
. o% `) e7 T5 X1 X0 T/ ~, m0 ~- O                                                        T1O<='0';, j+ m: N, l: k$ E# K4 p
                                                        coll<='1';
0 U6 F1 I% e. g: X% t1 R                                                        cold_pin<='1';
6 a2 u! `3 B6 e$ A# S4 G                                                        T2O<='1';: T. \) L. M; G
                                                        d<=d+1;9 b4 n( X9 C" g
                                                end if;3 S. b; i! h8 ~5 b# j3 l
                                        when "010"=>
# r4 @7 m* r! i) z: Q5 t/ [! w                                                if T2I='1' then
& ^2 J- K9 U; b: X! A. W/ H1 g" ]                                                        T2O<='0';
5 O4 b0 x& A6 U, ?" Q                                                        coll_up<='0';
  P- r8 Z+ B/ T9 u# |, j                                                        coll<='0';/ y# [2 x- W* [0 _/ e1 Z+ v
                                                        cold_pin<='0';
1 L5 c1 @& y+ [: W                                                        d<=d+1;- B' R: F# A. r0 _* _9 i
                                                end if;
  ~$ W; m% S! F$ |                                        when "011"=>
! {1 {% H' }: N, G                                                if (dly'event and dly='1') then2 C7 S4 V( V" C- i2 ~) k, R& Q
                                                        d<=d+1;
# \( `; Y) T1 N) s# f/ }, ~                                                end if;. X" `. q* U/ V+ u8 M' w7 f: W; _( ?7 N
                                        when "110"=>5 _- d7 @( G/ W* Y5 V$ W& A
                                                count_clr<='1';# p4 J4 E4 i, [: K
                                                d<=d+1;
; [* u# ]* N% q9 E( x1 P                                        when "111"=>
, N5 [! x$ X9 ~* }$ n                                                if count_v2='0' then
& U; W, S3 f' H# d& O$ B6 W2 {5 w                                                        count_clr<='0';' d9 g8 o# x3 g
                                                        d<="000";
$ A! L0 g$ V# r# _! U                                                end if;$ K9 [; h/ b, ^/ M# P% ~' z- Y
                                        when others=>null;( T$ x6 z" N' G3 {5 f" \; ^
                                end case;
1 a7 Y2 |' t8 w, @/ t: H( j                        end if;- i. @; ^  ]3 \% x1 z
                end if;2 k* {; L# k/ E) m
        end if;% E: n3 F9 Q' @
        if coll_auto='1' then
; L$ ?6 ?4 D* }- \. ^                if coll_manu='1' then8 N. q' u& T- Z( M1 C) O7 S5 F
                        coll_up<='0';$ Q7 a) \. Q6 R% S8 C$ x" N  K
                        coll<='0';
2 ]3 Y, z# U. r9 A9 C# _                        cold_pin<='0';! B9 m; u7 U2 s! w6 _
                end if;
# |, X' L3 Q3 o% y/ B  S( ]        end if;, S. {6 N, G4 E1 Z5 b( g( `
end process ;+ N# ^% Z7 Z2 w5 N3 }+ |
end cub_arc;
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

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

GMT+8, 2024-5-19 09:42 PM , Processed in 0.105514 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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