找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

巢课
电巢直播8月计划
查看: 3727|回复: 5
打印 上一主题 下一主题

VHDL编译错误,请大家指教

[复制链接]

1

主题

5

帖子

-8984

积分

未知游客(0)

积分
-8984
跳转到指定楼层
1#
发表于 2009-10-26 16:07 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您!

您需要 登录 才可以下载或查看,没有帐号?注册

x
本帖最后由 Annhu 于 2009-10-26 16:08 编辑
3 }( F# c  Z. }9 T& b: }7 \, [
5 c8 I0 m# I8 i' z+ p4 f:) 下面的程序是一款CCD的驱动程序,clk1=2MHZ,enable主要是控制sh的周期是10us还是10ms icg的周期不变始终为10ms,delay用于控制sh、icg的延时0.5us。编译错误见最下方,小弟把clk和enable的位置换了一下即先判断clk1上升沿然后在判断enable问题就解决了,麻烦高手帮忙看一下这到底是什么原因呢?还有j就是程序的代码有没有可以优化的地方呢,谢谢大家!
+ r( x' t2 j5 x$ T; v--CCDshixu
7 j1 W* `' \. @% BLIBRARY IEEE;4 @% _8 X: i- O( n" p: U
USE IEEE.STD_LOGIC_1164.ALL;
3 i" `! I5 ~, t% j# V% FUSE IEEE.STD_LOGIC_UNSIGNED.ALL;0 T" y; b7 M) G2 U
entity divclk is
. B- c  M# f2 o   port(clk: in std_logic;
2 l- o7 [  E8 R6 L: l& B) t4 m        start:in std_logic;4 N2 V  q$ ~  l& o+ R
        enable:in std_logic_vector(1 downto 0);7 [( w8 B9 h  V/ p
        o_m_clk  out std_logic;
% |7 H' x! t5 J3 C2 v        o_sh,o_icg  out std_logic;        
3 f5 p# a- ^6 A# w        stop out std_logic);
" N" `* f: U3 P% Tend divclk;
7 ?" m# z) D5 k- B' w3 N. g+ Varchitecture behave1 of divclk is
2 ]' p. c0 r$ I- T' {( vconstant halftime :std_logic_vector(3 downto 0):="0101";; J7 g: {0 Z% h$ X
signal divcounter: std_logic_vector(3 downto 0);--shizhong fenpinjishu1 f" g1 _/ J' Q6 Z4 W0 l0 ^
signal shcounter : std_logic_vector(13 downto 0);--tiaozheng sh zhouqi he zhan kong bi
' z( S- |& ~) q( I9 P5 |signal icgcounter :std_logic_vector (14 downto 0);--tiao zheng icg zhouqi he zhan kong bi
) C; k. \. y0 W9 M$ |+ @: tsignal delay :std_logic_vector(1 downto 0);--shixian ICG/SH de mai chong jian ge
: {7 x# r; ?: M! b( F" Xsignal clk1: std_logic;
" _3 z/ i, P" ?8 P/ K8 X9 y* ?begin
( f6 j5 H! p( g' B8 BP1:process(clk,start)--24MHZ,12fenpin
* s! h7 H4 X' W   begin
  M$ c& M  x. \% y9 H     if start='1' then0 {1 D  t6 Y. K- w8 ]" l7 J
       clk1<='0';& R/ Z  j/ I- w
       divcounter<="0000";                                                                                                                                                          ; N3 I% j5 X9 P8 d* P/ A
     elsif clk'event and clk='1' then1 d1 ]0 |, J& g2 s$ a( `& R
            if divcounter = halftime then5 |' u; g; j& _0 C8 l, `
               clk1 <= not clk1;
, y% K4 p  k& Q% ], b               divcounter <= "0000";
8 ]! f! k' D; P% o! `            else 6 A9 X+ u2 Z* C) r5 p
               divcounter <= divcounter + 1;
3 \- n8 f- d4 w' f8 P2 Q. u  C. M2 B            end if;$ n, Y9 I6 h1 z) M! ]2 A
        end if;
. D& }2 b; _5 |' ^+ N; D/ |     o_m_clk <= clk1;
+ C4 C& m; G6 P5 i+ T5 m$ [; ^   end process P1;' a  C. k& x% h" W
P2:process(clk1,start,enable)
7 K" V8 J6 m, sbegin4 C# s9 O  O, x4 R# w
     if start = '1' then0 P0 B+ z, @) I. x3 ~
        delay <="00";
# \# N+ a' Z. f2 o3 W        shcounter <= "00000000000000";
$ I' u1 X* a$ J- S# c        icgcounter <= "000000000000000";
; }) ~" D) v1 W8 v$ F" q        o_sh <= '0';
8 {  [9 y; i5 K( D0 |& Q, l        o_icg <='1';' G% K& R. n( l5 y4 F; B
        stop <= '0';) B$ t0 m3 v, s8 {
     elsif enable = "01" then
, i2 u; u* R$ W        if clk1'event and clk1='1' then4 j$ u( N% H% u/ V5 s
           if icgcounter <"100111000100000" then  -- 20000分频产生10ms的周期
, m/ y: C( z/ Z- m- u- @) |              icgcounter <= icgcounter +1;- ~, J+ T* X8 K
              if icgcounter <"000000000010100" then 3 [" r& U  a* l% a
                 o_icg <= '0';               
. m: F0 }- C- O0 Z; j              else
" z! s8 ]1 f9 P- ^2 I. i4 J+ ?                 o_icg <= '1';               
9 P6 N/ k5 c" B+ f3 b              end if;
. Q& h6 o0 q) }% [           else 1 L1 a3 Y' Q9 z$ B
               icgcounter <= "000000000000000"; , `" n8 b! ]: Q" q4 s
               stop<='1';# D$ Y# y: v, t- v
           end if;
+ \# Z; c8 U/ {( X: |           if delay = "01"  then2 ?- E0 {: v# t% ^1 s
              delay <= "00";
1 W( j2 W' B9 p: m$ l              if shcounter < "00000000001001" then  -- delay用于产生ICG、SH的脉冲间隔0.5us,10us SH. C' X! v; n( s! j1 k1 ]& T
                 shcounter <= shcounter +1;% j2 ~  w- D9 H/ ]  U7 k
                  if shcounter <"00000000000101" then  o_sh <= '1';
8 m# s% ^/ _3 r8 T, a- G  c- q' |                    else   o_sh <= '0';                     ) M" v$ {7 H$ b6 v. K
                  end if;              
. J2 G% w. e* \9 @              else5 G( o% e5 }9 L) q
              shcounter<= "00000000000000";
2 ?% z# U+ ^1 M. t, ^: j: y               end if;
- F8 r& C$ m1 S6 y. Z, h% C           else
9 s# i' U/ T1 _4 x! M               delay <= delay +1;5 b2 D2 H) Y) x+ r
           end if;
2 f+ i1 t5 l$ M3 F5 U( F         end if;
) i2 t; y$ d+ m# u; }( h( q      
% Z/ j! a5 ?* S- ~     elsif enable = "10" then1 n! c0 g# c" y
        if clk1'event and clk1='1' then0 g% f/ z. ~, b1 G
           if icgcounter <"100111000100000" then  -- 10ms ICG$ q1 [5 F- E; v- l
              icgcounter <= icgcounter +1;0 M" h+ ?9 l/ w% }
              if icgcounter <"000000000010100" then
4 k: E5 [! H8 ^" |* _+ Q                 o_icg <= '0';                4 Q  v4 @: {; U
              else
0 C# E9 l: B' r                 o_icg <= '1';               
1 t9 U! O7 g/ K0 N2 ~              end if;( }9 w" q' R! o1 z
           else
7 f6 }4 f5 O8 |# ~- F               icgcounter <= "000000000000000"; ) Q# E+ {1 x, x7 B- _) r
               stop<='1';
1 M' v9 ?& g# l           end if;# p8 q5 Y' ?- R0 u4 t! l
           if delay = "01"  then# Y# r) U* X4 O
              delay <= "00";6 l- @9 a9 |4 z" o& [
              if shcounter < "10011100010000" then  -- 2次10000分频delay用于产生ICG、SH的脉冲间隔0.5us,10ms SH
" T' P; L3 [- \! r8 }2 w5 Y* c                 shcounter <= shcounter +1;
1 S, f8 P3 W! S* l) T                  if shcounter <"00000000000101" then2 b; ^5 T! d9 {' r' g- N
                     o_sh <= '1';% _4 ~, M. r$ W
                  else
+ F; T! O) r: Z" K. b; N                     o_sh <= '0'; 9 q3 N' |9 J& d
                  end if;              ; M" H, K3 B7 T; L
              else3 p" s, _6 p! c2 z
                  shcounter<= "00000000000000";, T  h7 K2 F. ?( H
              end if;
# g. U: M+ o! T8 p  r: ]           else
1 E1 J+ L, }* p) a& c5 F2 e# f( N4 W               delay <= delay +1;) l1 p4 [2 |% _6 v: z  x
           end if;      
9 n5 V9 n$ |$ m: p& f& _8 x        end if;" U& y, B3 g5 Y3 [
   end if;  
! ~+ L: A3 {5 C0 B  end process P2;/ o7 @! A; q( e
end behave1;! Y1 v; A8 }% o" d
Error (10821): HDL error at divclk.vhd(42): can't infer register for "stop" because its behavior does not match any supported register model
" z4 b5 y" n8 o/ iError (10821): HDL error at divclk.vhd(42): can't infer register for "o_icg" because its behavior does not match any supported register model
1 n( H0 ?# [% n. BError (10821): HDL error at divclk.vhd(42): can't infer register for "o_sh" because its behavior does not match any supported register model. U- M- r) ~2 Q% n: g; L' T' O& a0 r
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[0]" because its behavior does not match any supported register " s9 r% P+ J$ V8 F9 q$ g
model( X8 M- N* v& T1 e
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[1]" because its behavior does not match any supported register
9 X; D& q5 I$ {" x$ c. s1 bmodel
/ u2 B7 |( l, w0 A: aError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[2]" because its behavior does not match any supported register
5 n( t: D/ q7 {2 ~! N: p) r+ Umodel- Y" l( h: e- R: U/ o1 v2 U
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[3]" because its behavior does not match any supported register
. W! |( J2 `" omodel
  K" R) Y- \1 h* h/ p( T: \$ hError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[4]" because its behavior does not match any supported register
$ m$ ^! x$ I8 F4 p# \: }model% G4 @: E2 |) |7 f9 V
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[5]" because its behavior does not match any supported register
. b5 @% o' H* m$ u" u! X7 dmodel
& S: l7 S9 M: ~Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[6]" because its behavior does not match any supported register ; O  B; j' ^" F
model
) `) V6 W+ W: I/ H7 Q8 dError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[7]" because its behavior does not match any supported register 6 D3 x2 b7 b* x; o$ Q" l. a
model7 S; J# l# Z" q8 K/ K5 X" a* q% B$ Z% N
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[8]" because its behavior does not match any supported register
7 {( B9 t) B- E/ ^2 b0 \! Cmodel+ U  v! K# u* [$ L1 A+ P
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[9]" because its behavior does not match any supported register 1 q* H9 n0 c" i6 ^
model
4 c( s* f+ n3 Z0 T& H/ fError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[10]" because its behavior does not match any supported register
. N' ~( ]$ P" Q+ y6 G# @5 [model: E- C$ `/ a* X. \" ~- h4 w9 a
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[11]" because its behavior does not match any supported register 4 b: h, G8 A) b5 U- a8 _
model
+ j0 c5 o+ B& w( A* R- UError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[12]" because its behavior does not match any supported register , p7 N1 C6 ]. i# A5 q" M1 F$ C
model
/ X3 I6 K4 V( c3 aError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[13]" because its behavior does not match any supported register
1 Y  ^  o6 G! B; M! i! ymodel
% L) t* @- ~/ R1 VError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[14]" because its behavior does not match any supported register . |; T' ~* \7 F; z: i* x2 T
model
) G8 j' e5 A8 \3 U: ?Error (10821): HDL error at divclk.vhd(42): can't infer register for "shcounter[0]" because its behavior does not match any supported register 3 x3 `9 j: M$ {7 q/ r; G
model5 M) O+ v  f3 |# E
Error: Can't elaborate top-level user hierarchy
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 支持!支持! 反对!反对!
天分-速度,勤奋-高度

1

主题

5

帖子

-8984

积分

未知游客(0)

积分
-8984
2#
 楼主| 发表于 2009-10-28 19:32 | 只看该作者
怎么没人理呢?
天分-速度,勤奋-高度

0

主题

7

帖子

-8991

积分

未知游客(0)

积分
-8991
3#
发表于 2009-11-4 19:43 | 只看该作者
错误太多了 得一步一步找 一下是看不出来的 所以没人里

26

主题

141

帖子

1639

积分

四级会员(40)

Rank: 4Rank: 4Rank: 4Rank: 4

积分
1639
4#
发表于 2010-5-15 10:53 | 只看该作者
爱莫能助

6

主题

30

帖子

144

积分

二级会员(20)

Rank: 2Rank: 2

积分
144
5#
发表于 2012-2-24 20:35 | 只看该作者
这么长,自己慢慢找吧,细心点总能找出来的

6

主题

30

帖子

144

积分

二级会员(20)

Rank: 2Rank: 2

积分
144
6#
发表于 2012-2-26 13:58 | 只看该作者
LIBRARY IEEE;
: v- C! E/ _$ u( g USE IEEE.STD_LOGIC_1164.ALL;- {0 e* d% ~; R0 X0 _# o6 o7 z3 F. ~" ]
USE IEEE.STD_LOGIC_UNSIGNED.ALL; 5 K2 @, o4 g0 B9 q
entity divclk is 6 _- S) ?- s2 Z* U8 J
   port(clk: in std_logic;1 U7 }; D& l. o; m: _' N
         start:in std_logic;" Y4 i) \$ T, z: \: r5 o: V4 M8 m
         enable:in std_logic_vector(1 downto 0);
. k& g1 \4 J. o; P         o_m_clk : out std_logic;3 Q8 y6 I$ L' s7 E: e
         o_sh,o_icg:  out std_logic;2 j  L9 G  Y7 t. }
         stop: out std_logic);
& o" X* C- |3 d+ i/ c0 t, A/ z6 K end divclk;
1 l0 ~# p$ H: u- f; r architecture behave1 of divclk is% w( n% O' {) l9 k
constant halftime :std_logic_vector(3 downto 0):="0101";$ B& m% a. M9 d* |& X
signal divcounter: std_logic_vector(3 downto 0);--shizhong fenpinjishu$ v. ^1 x3 g; A! b
signal shcounter : std_logic_vector(13 downto 0);--tiaozheng sh zhouqi he zhan kong bi1 t: s2 {2 }8 h0 F1 o
. q$ n4 X# j1 K. q% r# w signal icgcounter :std_logic_vector (14 downto 0);--tiao zheng icg zhouqi he zhan kong bi% d9 K0 \( Q* D7 ^- g0 Z* s# k& O/ [* ~  E8 \; o9 i+ g
signal delay :std_logic_vector(1 downto 0);--shixian ICG/SH de mai chong jian ge7 o6 n3 \2 a1 H6 K3 O# q4 i$ d7 w" `( O, @1 g
signal clk1: std_logic;0 A3 c3 b# Z% P% @4 Z3 J8 u
begin8 C9 T6 W0 J! v9 L
P1:process(clk,start)--24MHZ,12fenpin
7 B" o: M- ]  n) P; A$ e    begin
3 u' f8 z4 |1 n& @     if start='1' then
$ a0 v- Y4 S# ^% C. D1 ~6 B( q# G7 u        clk1<='0';* L" V  c* q* X7 f( T2 ?  Z- l4 f
        divcounter<="0000";
6 w" _# [4 c3 d! [. ~6 G      elsif clk'event and clk='1' then
+ E6 d6 H7 _( o8 Z             if divcounter = halftime then: y# p, _( a3 J2 Q
                clk1 <= not clk1;
4 l" {% }- ]  j$ o" |8 [                divcounter <= "0000";
( D) r: X5 m4 n4 Z             else ; W+ q( \; F; P& {! _8 R% y2 m8 s
               divcounter <= divcounter + 1;2 q2 A9 D$ h" `$ [
             end if;. }) O2 r2 o" g& y
         end if;
5 R! `4 i, a  r5 A      o_m_clk <= clk1;
- ~6 f+ C. f8 O  H! i    end process P1;: t: V) a4 F: s3 h2 v
P2:process(clk1,start,enable)) K1 e  j, w  ?7 m; h
begin2 S: x7 F: v/ \2 w% B3 c& {) u% s
      if start <= '1' then
" t& e% ?  R6 _# S% t/ O+ D         delay <="00";; U& `+ O3 ?- t: U& O" v
         shcounter <= "00000000000000";
/ q: N  q$ r* C) A: ?6 v) r         icgcounter <= "000000000000000";
* W. X% x: u* j4 V         o_sh <= '0';
) H  D- G* B1 H* S         o_icg <='1';
2 {8 E5 ^! _. ]         stop <= '0';6 G; F  q! n" B% x/ y
      elsif enable = "01" then, S, A# J& F7 O( g" ]: a/ U
         if clk1'event and clk1='1' then# H' a/ X7 a8 x# Y. o1 _* S. p: l
            if icgcounter <"100111000100000" then    --20000....32767
0 @1 x- ~/ f0 E. W9 r" R: ^               icgcounter <= icgcounter +1;
3 I! Q2 U2 p' l               if icgcounter <"000000000010100" then   --201 |# d3 p' L5 p7 @
                  o_icg <= '0';
# g2 e4 ?( Y2 o8 d               else
( f4 `1 X+ W" n                 o_icg <= '1';
# D+ b, E3 D  P% s) ?9 \% t               end if;
  B9 F  L- v% R            else
# ^% x$ O( k+ [                icgcounter <= "000000000000000"; ( X! H) T3 |# P. K
               stop<='1';5 t& _4 v% c9 R, h  w, B) P; M
            end if;
( `$ z/ k1 [4 ], l$ m/ F5 v) L            if delay = "01"  then3 h6 U9 U  U( {* \4 c# G
               delay <= "00";
# Z) l! X0 v1 ]  ^               if shcounter < "00000000001001" then
" q3 t5 a5 a9 B! s% y; A. \" x                  shcounter <= shcounter +1;8 V+ ]6 h( B$ g  q$ M( G- D( n; o
                   if shcounter <"00000000000101" then  o_sh <= '1';/ i8 B  ~( ~9 H" B9 Q
                     else   o_sh <= '0';7 s+ ~! i2 d9 f! N: Y+ @
                   end if;6 X8 m' ?% F/ m) M
               else
( t) r5 O% J) ]               shcounter<= "00000000000000";8 f2 \$ h; c5 i' W
                end if;( y4 Y' a. p6 [3 W& O3 B
            else
) M, C3 u5 m6 t                delay <= delay +1;
1 P; V7 u$ i8 c: P0 Y% P            end if;
) s& A6 C/ g. x5 _2 {& S          end if;$ `- D' R: r9 n* M7 \
        
+ ~- @! V, o. }6 t7 O/ j     elsif enable = "10" then# e: H6 K' P# f& q9 D
         if clk1'event and clk1='1' then
9 f. J' X% A5 H* Q' j6 r            if icgcounter <"100111000100000" then
( T3 b4 ?  v) A  r( e               icgcounter <= icgcounter +1;6 v5 z! O5 @& D" v
               if icgcounter <"000000000010100" then
( s* l2 i. V/ m. p                 o_icg <= '0';
2 \6 a* a- ]0 X5 C* r# }               else
. L* q% \$ M+ `- G/ {$ x% L& L                  o_icg <= '1'; ) p9 o4 h! c- K" S. u/ G7 Z
               end if;
2 ?; `7 V, q9 ?; I/ d1 {6 c            else
7 f* o3 F/ M- P# c% t0 i5 L0 ^               icgcounter <= "000000000000000";
8 }6 z" p6 j) U& l5 O               stop<='1';
( V1 T8 D0 A: x! Z8 b            end if;
% b$ N7 v& ^1 D7 ?7 f2 P) n# l, @            if delay = "01"  then  G6 @1 i4 _( c1 S$ Z' v
               delay <= "00";2 e. {& ^# b8 I6 P* m
               if shcounter < "10011100010000" then
9 y( Z# d6 t& E5 m* I1 i                  shcounter <= shcounter +1;
7 w  A* W; }' u; {8 `1 I( a0 P6 s% j6 s                   if shcounter <"00000000000101" then
+ b8 U: c% d4 [% k& u0 y                      o_sh <= '1';% [5 _6 Q7 |* g0 p0 _* m6 O" Q
                   else
" j$ H5 L! d  J' U# Q* k7 p) i1 v                      o_sh <= '0';4 `( e4 T, r! N0 ?' ?6 @
                   end if;
6 s7 L1 L" v$ [               else
! s1 M; ]; A7 q) P                   shcounter<= "00000000000000";
6 ~3 [$ V* U* [               end if;9 g+ L) j( A; g" E
            else7 x% f. u) l8 l) G3 T, c5 \9 ]
                delay <= delay +1;
9 P8 T: ~  p! }            end if;" a8 Q0 f" i  `$ W3 |: m
         end if;1 I/ P! G) t& {5 n+ c" x/ ?$ E
    end if;
# a/ W* z, r+ g! Z% h0 B; M3 Q   end process P2;
' f) Z2 d! m: B end behave1;
0 x" m1 A1 J1 N) |3 d

未命名.jpg (36.61 KB, 下载次数: 1)

未命名.jpg
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

推荐内容上一条 /1 下一条

巢课

技术风云榜

关于我们|手机版|EDA365 ( 粤ICP备18020198号 )

GMT+8, 2025-2-19 07:09 , Processed in 0.065443 second(s), 36 queries , Gzip On.

深圳市墨知创新科技有限公司

地址:深圳市南山区科技生态园2栋A座805 电话:19926409050

快速回复 返回顶部 返回列表