找回密码
 注册
关于网站域名变更的通知
查看: 5072|回复: 5
打印 上一主题 下一主题

VHDL编译错误,请大家指教

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
本帖最后由 Annhu 于 2009-10-26 16:08 编辑 ( l/ N) S# V6 H, ~2 A* c
* o1 z) [0 ?, j# \0 |1 n6 I+ h
:) 下面的程序是一款CCD的驱动程序,clk1=2MHZ,enable主要是控制sh的周期是10us还是10ms icg的周期不变始终为10ms,delay用于控制sh、icg的延时0.5us。编译错误见最下方,小弟把clk和enable的位置换了一下即先判断clk1上升沿然后在判断enable问题就解决了,麻烦高手帮忙看一下这到底是什么原因呢?还有j就是程序的代码有没有可以优化的地方呢,谢谢大家!/ p7 j2 w5 M3 W$ y. k6 x
--CCDshixu + z4 m7 x2 N# a/ ]
LIBRARY IEEE;- ^3 F0 S/ a/ ~( j
USE IEEE.STD_LOGIC_1164.ALL;' M* E& T; |( b$ y
USE IEEE.STD_LOGIC_UNSIGNED.ALL;( I/ C. k3 F+ k6 s; I( r
entity divclk is % ]2 X; \9 j+ W% J; u: h4 Y& ^% h3 e
   port(clk: in std_logic;
- v& c/ `0 w6 P        start:in std_logic;
/ a7 T8 ]; m9 S. y3 [0 h        enable:in std_logic_vector(1 downto 0);; K! @1 E$ ^* X( ~; y/ i
        o_m_clk  out std_logic;! X: R/ {7 C$ a% a
        o_sh,o_icg  out std_logic;        
3 r; `9 [. ~/ ?/ o7 ~        stop out std_logic);2 \. {. V( W( \. i& `4 z
end divclk;/ H( e4 a- E- u6 V' E3 {
architecture behave1 of divclk is
/ `6 y) v5 Q9 f3 ^1 U' Iconstant halftime :std_logic_vector(3 downto 0):="0101";0 W. ^+ H. l! u% R! U& s6 d/ ~
signal divcounter: std_logic_vector(3 downto 0);--shizhong fenpinjishu
/ |. D- }* B+ Q3 Wsignal shcounter : std_logic_vector(13 downto 0);--tiaozheng sh zhouqi he zhan kong bi# @* n! \0 f# l; n
signal icgcounter :std_logic_vector (14 downto 0);--tiao zheng icg zhouqi he zhan kong bi
! s$ u& t, M$ K5 p" Zsignal delay :std_logic_vector(1 downto 0);--shixian ICG/SH de mai chong jian ge! ?# k; g& v- j9 p& B& m
signal clk1: std_logic;8 M, I9 b2 v& {4 A
begin
+ X6 r3 v' b& z- [; qP1:process(clk,start)--24MHZ,12fenpin1 A8 W& i, a4 m4 X
   begin # @  s- ?7 L3 ?7 ~. P
     if start='1' then, _5 [$ N' R1 D" x$ J( x
       clk1<='0';2 i7 T7 W- l, d
       divcounter<="0000";                                                                                                                                                         
' o) p! G$ G% H     elsif clk'event and clk='1' then
0 m% i+ m! |1 C  Q* j            if divcounter = halftime then6 y& P7 |1 |  I5 y( \  m2 y
               clk1 <= not clk1;
8 S" L* N9 O; r0 d+ I" y' J               divcounter <= "0000";  ^& C' W8 |. r7 |
            else
  Z9 E' v) X, b# E               divcounter <= divcounter + 1;' Q' N' k% J+ q: `: Y, u
            end if;- w  X( ]0 M6 A+ Z$ r- t" Z" h- w
        end if;6 K% D( v% O0 ]. @! x
     o_m_clk <= clk1;
6 `; @& _7 w7 n   end process P1;
) c+ U7 X$ N7 d1 S( dP2:process(clk1,start,enable)
' ^" P. e" d% M! @begin! _2 F5 {  c; t1 E1 u5 j6 E) F
     if start = '1' then, M0 w* S, \, P9 S0 t6 a2 p4 `" P
        delay <="00";/ Z7 }7 S2 f6 _+ o$ I$ z
        shcounter <= "00000000000000";
2 W7 v  ^( M) W# a2 L7 x, m        icgcounter <= "000000000000000";
- o0 @$ s  u6 |9 j- t        o_sh <= '0';2 l/ T5 U" S# K1 A7 \
        o_icg <='1';
0 K0 @% Z4 z7 t) h: ^* d/ p        stop <= '0';! K2 T- M6 u9 K
     elsif enable = "01" then
( _6 ]0 ?6 S7 }3 ^4 u7 w2 x* P1 ^$ U        if clk1'event and clk1='1' then
/ C2 j! R# Q6 x8 K% W           if icgcounter <"100111000100000" then  -- 20000分频产生10ms的周期3 m9 N6 R; v; B8 r/ D
              icgcounter <= icgcounter +1;+ k( p" B0 _- n3 t. u& O9 V  _
              if icgcounter <"000000000010100" then
/ }- r( e* ]- j6 d  Z# E2 L4 f                 o_icg <= '0';               
: {, O6 T2 q) x1 B& _2 ~2 R& M              else * l- V2 F: X  T/ h
                 o_icg <= '1';                ' e: N3 w/ {3 S
              end if;! Y+ E# E7 E0 F( H8 i/ Q
           else ' M9 R) T& I& @0 S2 r
               icgcounter <= "000000000000000"; & `8 r1 Q- l  C5 o  m2 G2 [8 Y
               stop<='1';
  u; z9 j' }- q' j7 u           end if;
+ i9 d2 Q& s6 G$ _" w: N           if delay = "01"  then: c, Q. U+ h4 R+ t7 z4 Y1 D& q/ ~- y
              delay <= "00";
/ i9 K! _4 W. f* ^9 a& D              if shcounter < "00000000001001" then  -- delay用于产生ICG、SH的脉冲间隔0.5us,10us SH  J. ~# W3 q% [" x0 R9 L
                 shcounter <= shcounter +1;. g" V1 h4 C7 D1 h
                  if shcounter <"00000000000101" then  o_sh <= '1';8 v) m6 C  t0 K- \8 N* c8 O
                    else   o_sh <= '0';                     % L; D) k6 [5 \+ ]; k  t) `
                  end if;              
5 T' G1 k$ X! W0 G: r, n' n              else
/ S0 F7 P) B( g2 K1 C' f              shcounter<= "00000000000000";
5 L4 I. L7 t* s% O3 C* V7 x# t) ~               end if;
5 ~! O5 E$ G) l' w- m3 Q. l           else/ n  T- `( O7 ~( q$ G
               delay <= delay +1;
. J( @0 {3 H6 n9 F           end if;
6 P  P3 t& Q: S' ]& U6 t         end if;0 d7 }, t8 A/ d. B7 G
      
: G* h6 k0 ~% p, B     elsif enable = "10" then  a* K, m/ a9 f6 ?& w! J
        if clk1'event and clk1='1' then. z! L# E; o$ B4 q0 A  ?+ ~/ i  i1 ?
           if icgcounter <"100111000100000" then  -- 10ms ICG6 _0 u" D- K  I: j
              icgcounter <= icgcounter +1;
, d! f; Q! F( `6 [              if icgcounter <"000000000010100" then % w9 `* E+ ^" W! T  q: R* Y
                 o_icg <= '0';                * M/ y. F& P; x8 E
              else
3 d9 |1 w: w  l# f                 o_icg <= '1';               
* O1 |3 O+ m; R# k3 b8 c/ _$ F8 C              end if;
" R' J% o! m+ P, Q5 J6 g) v           else 5 L3 U9 Y. {4 _; J) @
               icgcounter <= "000000000000000"; 1 R4 v# t, h' F
               stop<='1';
4 n* K) Q6 Z9 [) \. w) T           end if;( V6 N6 Z1 X. o
           if delay = "01"  then
! F- Q( m% {; E8 v5 X              delay <= "00";
4 a7 }6 s0 ]  t( l! Z- R- _2 e              if shcounter < "10011100010000" then  -- 2次10000分频delay用于产生ICG、SH的脉冲间隔0.5us,10ms SH. k5 z  h& @5 a! R; f5 o' ]
                 shcounter <= shcounter +1;  ^, e: p; |8 {! m, a9 q9 Y
                  if shcounter <"00000000000101" then* ?  ~0 y; |, ?) f
                     o_sh <= '1';
7 J* X1 V% L. w, q! Z  d9 T, f$ ?                  else
5 f  T) F7 ~* Z+ D6 M; @                     o_sh <= '0'; ' k6 j4 T) [( @8 z1 a. t3 E
                  end if;              : T- \2 U% E! ?& Z+ w
              else8 k/ }- \+ T4 U  I( O
                  shcounter<= "00000000000000";1 r) k! L9 A, h( m; X+ p% g9 I$ a
              end if;
! }$ v4 Q  }" j1 e           else+ t5 f2 [+ [& y  l8 j& {
               delay <= delay +1;. ?: e4 @1 E' [  a
           end if;      
: C4 G7 p" Z- J; ~0 n2 R        end if;9 i- O( u/ q, z
   end if;  + t1 W; J  W- U$ J0 j+ s$ ]$ g6 X
  end process P2;  _1 ?3 b0 A6 |/ v8 u
end behave1;0 N1 i9 o" u  A+ ]
Error (10821): HDL error at divclk.vhd(42): can't infer register for "stop" because its behavior does not match any supported register model1 g7 b: \5 i# ^# _& i" v( W
Error (10821): HDL error at divclk.vhd(42): can't infer register for "o_icg" because its behavior does not match any supported register model
4 G3 }, c" G' ^  p( KError (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$ o) c" Q% Z6 N+ ~. i$ F: ?) {
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[0]" because its behavior does not match any supported register / B+ ~/ s4 R0 {5 \& Z
model  m) d1 n5 U0 @
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 I" H: ^# L8 f$ J% L" Pmodel' v' S$ \- C" k: w+ f& t/ y
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[2]" because its behavior does not match any supported register
, y! a* p/ x% s+ |8 t# `" mmodel' i8 h9 J: a( G' x
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[3]" because its behavior does not match any supported register , {8 e- X5 D) v8 Y
model
3 {0 r; ]5 _* g8 _5 y* `, bError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[4]" because its behavior does not match any supported register
$ W7 @# m* S, g! Qmodel
, E9 S' b' p& ~+ ^Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[5]" because its behavior does not match any supported register
& J/ S) k4 L5 H6 ^0 V5 Mmodel% t7 W; D" g+ d5 T9 u2 g3 r
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[6]" because its behavior does not match any supported register
; ~; D  \5 [  x# xmodel
1 i' _; H+ L/ NError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[7]" because its behavior does not match any supported register + G8 Y1 O( p. X: R0 D% G
model
6 B" p' a) @6 S6 s* _( [4 m% h1 tError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[8]" because its behavior does not match any supported register 4 l# Q- p; I/ c) G
model
( o5 y/ Z- S6 B- W1 m; v. j3 G6 G3 IError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[9]" because its behavior does not match any supported register " [- C% U' X  E, M9 z
model  L' R( Z) _" m  t' e
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[10]" because its behavior does not match any supported register 8 f2 W: f' z6 S: A8 v
model
  i/ b4 `9 E3 G$ _2 @2 kError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[11]" because its behavior does not match any supported register 1 G& v3 a) }* ]9 r  ]  }$ N
model
6 P& H% D/ p" f" _$ y8 XError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[12]" because its behavior does not match any supported register * U+ w, }' P. p$ r1 q+ q$ L7 I
model
: |9 F& ^- n. T) [( v; jError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[13]" because its behavior does not match any supported register
9 y6 |( U0 k7 K9 Dmodel
' W% M. o# F" i% TError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[14]" because its behavior does not match any supported register * Q! u  S7 E0 ]1 n: u! b2 e! `
model1 I; @: J3 L3 b* T
Error (10821): HDL error at divclk.vhd(42): can't infer register for "shcounter[0]" because its behavior does not match any supported register
- _# _- K( X% R- P4 i6 Bmodel
7 V( X* Z; t, ~1 hError: Can't elaborate top-level user hierarchy

该用户从未签到

2#
 楼主| 发表于 2009-10-28 19:32 | 只看该作者
怎么没人理呢?

该用户从未签到

3#
发表于 2009-11-4 19:43 | 只看该作者
错误太多了 得一步一步找 一下是看不出来的 所以没人里
  • TA的每日心情
    无聊
    2019-11-20 15:37
  • 签到天数: 1 天

    [LV.1]初来乍到

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

    该用户从未签到

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

    该用户从未签到

    6#
    发表于 2012-2-26 13:58 | 只看该作者
    LIBRARY IEEE;* D/ Y! E# s  \2 D. o' T9 N
    USE IEEE.STD_LOGIC_1164.ALL;
    - z' \: D# s/ G: {) z, l USE IEEE.STD_LOGIC_UNSIGNED.ALL; ( Q1 ?) g5 ~/ [0 {, N
    entity divclk is - ?  C3 ]8 @- G2 \% J  y
       port(clk: in std_logic;/ R( f. i: e% z% O; F. o7 h
             start:in std_logic;
    9 U6 {6 E3 r' s  g         enable:in std_logic_vector(1 downto 0);
    ; c8 }0 V8 J  m         o_m_clk : out std_logic;( ?+ ?9 R. w4 T* d& O( K
             o_sh,o_icg:  out std_logic;
    & I6 E. W6 K9 G$ m         stop: out std_logic);
    7 }. w3 Y) ]8 A end divclk;
    ( a+ f- Q- {9 c. B# M architecture behave1 of divclk is
    ) A; R! v5 ^- J- Z' v3 T! s, P constant halftime :std_logic_vector(3 downto 0):="0101";0 N+ y5 z6 K& P) |* M$ @6 t
    signal divcounter: std_logic_vector(3 downto 0);--shizhong fenpinjishu9 G4 V, T9 G$ J% o+ g. b
    signal shcounter : std_logic_vector(13 downto 0);--tiaozheng sh zhouqi he zhan kong bi1 t: s2 {2 }8 h0 F1 o) X) Z" C8 f1 ]0 n( 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# k2 Y9 l% l' R, o0 T# X2 O
    signal delay :std_logic_vector(1 downto 0);--shixian ICG/SH de mai chong jian ge7 o6 n3 \2 a1 H6 K
    . l. W4 T% D# R/ p) d# M signal clk1: std_logic;: G# z2 ^5 l  ^! }# ^
    begin& i7 X  |) t* E
    P1:process(clk,start)--24MHZ,12fenpin8 W+ o* `8 D) P' I! ?# j
        begin ( I0 Y* k# [! G, N
         if start='1' then) U" Y( Z* q7 U+ K9 y
            clk1<='0';
    3 S6 N4 ?, K. f- }2 m. D        divcounter<="0000";/ @7 A% H  Y4 A  ~( h- |0 x# }* d1 I
          elsif clk'event and clk='1' then
    ( G( O+ m' P: K& s5 @5 E" C             if divcounter = halftime then
    , I& a7 [; T9 a- ~6 Q9 G$ e6 v+ L+ C' F, Y                clk1 <= not clk1;
    " a+ |7 `. x* w3 q                divcounter <= "0000";
    2 C: j6 f" A( D& B: F# e             else ( c. k& f7 S. ]# w( X, m
                   divcounter <= divcounter + 1;4 _, T- {; _/ I7 ^  O1 `8 }9 W$ A
                 end if;
    9 i0 y5 H; P$ N3 k. [- l5 Q         end if;
    1 m# K& Z; ?" Z. D: k      o_m_clk <= clk1;; D: @, k2 u" T$ N/ G
        end process P1;4 N6 m, U1 Q6 ~2 `/ h
    P2:process(clk1,start,enable)
    & z2 o3 A9 N4 p9 c3 }/ K begin
    5 ~& {: b& h6 J6 v0 S% D, X+ ]* z( v      if start <= '1' then
    ( ~. M) @5 G# u. F( y  {         delay <="00";0 W+ X. U8 [. O: b. H/ `5 u
             shcounter <= "00000000000000";
    ( }# {( j" y  W8 q3 |9 z         icgcounter <= "000000000000000"; 3 l& [# L  \8 h* [% r& ]
             o_sh <= '0';
    . u1 M( C) y; C6 o! H1 L         o_icg <='1';# q: b7 L7 S. g
             stop <= '0';! `9 u* Z+ @7 D
          elsif enable = "01" then; n5 D- l4 Q) h& {2 f; A5 V
             if clk1'event and clk1='1' then! y0 x3 t5 X, q/ s
                if icgcounter <"100111000100000" then    --20000....327678 E6 r5 B, t+ z! [, u; w
                   icgcounter <= icgcounter +1;4 A! `; ?0 l% m/ L; Z
                   if icgcounter <"000000000010100" then   --206 m2 h2 h% X# E3 l/ v
                      o_icg <= '0';
    4 j+ {7 B3 J7 i( }               else , j% w+ C  ~, A: t/ y/ F
                     o_icg <= '1';
    3 F5 k+ r: o$ G: O* ^  ]7 ?               end if;, y% O# T% Q! g1 V6 ~3 U
                else9 H. S& o. y( z
                    icgcounter <= "000000000000000"; 8 D# g: i% H: w6 |# {0 V! P
                   stop<='1';, }+ c! n( H; I$ I* S9 d, [
                end if;) o, }  l( I$ [! p- `  }
                if delay = "01"  then
    ! K: G. m) p; ]  K4 @5 W" f* \               delay <= "00";
    6 K) ^4 U7 p$ i5 M6 W               if shcounter < "00000000001001" then* Z( g' z! ~9 _+ A$ R" i+ I
                      shcounter <= shcounter +1;$ I+ W. H. ?4 F6 _( F1 ]: N5 J
                       if shcounter <"00000000000101" then  o_sh <= '1';
    6 K6 x* k! s9 g6 \+ Q                     else   o_sh <= '0';6 j' `1 [; J; k2 D! l* p$ X
                       end if;
    0 v* Q. D$ a: ]7 X               else
    - e, Q' }; B/ W) ?& ?% a# }% `               shcounter<= "00000000000000";5 f& Z8 [0 j* E  e7 {2 A2 u6 {; N
                    end if;) p$ f) j5 A( h& m' W: M
                else
    " @" v* x+ G4 |  w: e1 p                delay <= delay +1;
    % n8 p) ?1 V/ u8 t            end if;9 [( `' Y1 Y) ?+ ]% ]+ Y. j
              end if;- D$ G5 C) D+ W" c8 k7 [# E0 H1 b
            
    # C# ~' o- l/ \- y; K. q( \     elsif enable = "10" then
    9 J2 `$ G! u  \* Y3 Z. A) D         if clk1'event and clk1='1' then' j; I: O( C+ c) M  t- m2 z
                if icgcounter <"100111000100000" then 4 e/ R: [" V/ r7 Y8 S, _, e5 |
                   icgcounter <= icgcounter +1;
    ! k9 R* ^4 D, o( d6 w/ g               if icgcounter <"000000000010100" then 0 X7 `+ [5 F  ]& i
                     o_icg <= '0';+ ]% W+ _6 {* _
                   else/ T3 E* l: D/ l' \' \
                      o_icg <= '1';
    # {  t: o) {9 w) u; N               end if;& o! \: m: }( u5 t0 S; [% j, [
                else 3 Q: t) q( j& Y" j  k) h& ?; q
                   icgcounter <= "000000000000000";
    ; o) Z9 a+ {% k8 x. \               stop<='1';
    / d  M/ L& V: S! A1 r- P# B            end if;
    0 l4 ~6 i0 s8 L0 \% l3 O  g+ g            if delay = "01"  then; s* S" {; _% F1 i
                   delay <= "00";, S' [3 P2 ^" p: F: Y+ g0 m) ?' Z
                   if shcounter < "10011100010000" then
    " t+ B4 ~! H! {8 N* D                  shcounter <= shcounter +1;! Z7 G. |  B" w* p% J' U
                       if shcounter <"00000000000101" then( r# G9 j/ ]' p1 c: O) w) q& P
                          o_sh <= '1';
    & o: X! B: l3 a- n9 k! I                   else
    $ P( M/ T" D+ \                      o_sh <= '0';. p4 u& J! s# a4 Q% h
                       end if;
    / ?* s, n& e# w               else# \8 a0 S: ]3 {) C+ e9 d, n
                       shcounter<= "00000000000000";8 H/ f, @7 M# N
                   end if;
    - F, d  |* Y& S( q3 N) \* J; u% _! }            else
    ) q/ [5 z/ I( z                delay <= delay +1;& \  s6 N7 Y! c0 p
                end if;. q3 m, n* `- f; m' b% H  t: Q# r
             end if;
    : u& B8 K  ?1 c: E, K( M3 I    end if;
    9 D9 y1 y+ ]- y  s   end process P2;  {2 s+ G! m1 y* t& m
    end behave1;
    * G9 S+ j4 p/ s4 D/ ?- O6 b

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

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

    本版积分规则

    关闭

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

    EDA365公众号

    关于我们|手机版|EDA365电子论坛网 ( 粤ICP备18020198号-1 )

    GMT+8, 2025-10-5 14:16 , Processed in 0.140625 second(s), 27 queries , Gzip On.

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

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

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