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

VHDL编译错误,请大家指教

[复制链接]

该用户从未签到

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

EDA365欢迎您登录!

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

x
本帖最后由 Annhu 于 2009-10-26 16:08 编辑 6 A) U: l  S/ e9 `
$ s' Z0 [; s/ h3 m: k: a
:) 下面的程序是一款CCD的驱动程序,clk1=2MHZ,enable主要是控制sh的周期是10us还是10ms icg的周期不变始终为10ms,delay用于控制sh、icg的延时0.5us。编译错误见最下方,小弟把clk和enable的位置换了一下即先判断clk1上升沿然后在判断enable问题就解决了,麻烦高手帮忙看一下这到底是什么原因呢?还有j就是程序的代码有没有可以优化的地方呢,谢谢大家!6 ~' u& B0 ~4 q9 P5 O# o
--CCDshixu + E( f, @% {& M/ f
LIBRARY IEEE;$ D9 K3 `- Q  F+ I( p4 h( f6 A
USE IEEE.STD_LOGIC_1164.ALL;3 Y9 G) h5 R$ q  Y+ k4 j, s7 p9 s
USE IEEE.STD_LOGIC_UNSIGNED.ALL;6 }0 A' }. N3 M+ m/ Q8 t$ [
entity divclk is 0 n0 C9 |3 O6 r4 B! a
   port(clk: in std_logic;
1 l8 |8 _3 s  F  t        start:in std_logic;# c3 W/ w4 }5 I6 G' r
        enable:in std_logic_vector(1 downto 0);
: _+ n# D$ |: S' E5 u        o_m_clk  out std_logic;
' Z" Y2 |# g; n+ z- }* |        o_sh,o_icg  out std_logic;        : z) c& `% Z2 Y+ {) E
        stop out std_logic);  t- S4 V7 Y' F3 X' D
end divclk;9 z9 b/ @( ~2 w9 g/ }
architecture behave1 of divclk is
, A% h  ~2 H6 }9 h0 ~: M7 iconstant halftime :std_logic_vector(3 downto 0):="0101";" D$ C" y0 L3 `% v% K3 [
signal divcounter: std_logic_vector(3 downto 0);--shizhong fenpinjishu
  i# a- M/ X' Q1 n- q; n: ?+ Hsignal shcounter : std_logic_vector(13 downto 0);--tiaozheng sh zhouqi he zhan kong bi% a) E( f( o: W2 \+ r! h1 q$ @
signal icgcounter :std_logic_vector (14 downto 0);--tiao zheng icg zhouqi he zhan kong bi
4 R4 O- X0 B$ G4 q- Xsignal delay :std_logic_vector(1 downto 0);--shixian ICG/SH de mai chong jian ge
- I$ E$ x2 C0 M7 q6 F5 Rsignal clk1: std_logic;9 l7 U' R5 }6 F9 `
begin8 ?! W/ {: q  C- ^- b6 K
P1:process(clk,start)--24MHZ,12fenpin
9 _3 }! [3 T! m$ m- ?8 r. t( }" R2 a   begin 6 E6 k+ I  \0 R7 j9 W
     if start='1' then( _; ^" Z+ M* a6 H
       clk1<='0';. D. y; l! f% N8 j9 B; K
       divcounter<="0000";                                                                                                                                                         
( g  d2 j3 O# x     elsif clk'event and clk='1' then+ C' M7 y5 k. }, O
            if divcounter = halftime then
# j- x! p  \5 t  G0 ^               clk1 <= not clk1;+ h3 j- g/ b. ^- f: A+ M8 y
               divcounter <= "0000";
9 r- l+ g0 X& ~1 F/ c- K            else
8 N7 ~0 K$ I) {; Z               divcounter <= divcounter + 1;6 }5 j) m$ f% z2 _
            end if;
) T- `. Q9 V5 y$ u, C: {6 {0 k        end if;; c3 ~3 y) G# m' L# V- U
     o_m_clk <= clk1;
' l- G$ o, Q" x3 W   end process P1;
$ F; Q, _# ~$ B1 ?P2:process(clk1,start,enable)
; y+ c6 {' \% O$ W: Qbegin
+ ~$ t4 S6 s' Q! f# U     if start = '1' then, z% N# c5 F+ q% t9 F
        delay <="00";/ S9 I1 R* B; J
        shcounter <= "00000000000000";
; n2 {0 [9 p4 O1 g# a8 s; k( A2 y! G, |        icgcounter <= "000000000000000";
3 p* T: ~! X( y7 n        o_sh <= '0';- B4 ~4 ^1 j! N$ N
        o_icg <='1';
6 P& ^0 V/ \1 P$ P        stop <= '0';
" i* w3 E  C! ]( `2 ^# |0 M, U6 m, v     elsif enable = "01" then* O! b6 `% {3 a: M6 S, s
        if clk1'event and clk1='1' then( B3 F2 T$ @% k3 S
           if icgcounter <"100111000100000" then  -- 20000分频产生10ms的周期8 l8 A" D  I  L0 {
              icgcounter <= icgcounter +1;" l% ?. |0 B* I7 X) C
              if icgcounter <"000000000010100" then
  Z" \1 Z* Z2 H7 V                 o_icg <= '0';               
+ a4 X) o; a; Q, S9 d9 M  @( l              else ! V; G/ X$ R& }# S7 C
                 o_icg <= '1';                2 D  n& m) p& L5 Y; ]2 M
              end if;3 E$ h" q% v: ^! D( C& i
           else $ e* T$ Y, R5 ~8 m
               icgcounter <= "000000000000000"; 3 x% o* y; a5 @) \" K% `- I
               stop<='1';
$ h7 C+ Q1 ]. i' y2 W) W           end if;# X# d; Q) ~# v9 Y/ b
           if delay = "01"  then
9 }; t" ~0 y' p( L9 u3 z1 X3 L              delay <= "00";
/ D+ s7 ?% q( e# I# \$ @4 X              if shcounter < "00000000001001" then  -- delay用于产生ICG、SH的脉冲间隔0.5us,10us SH1 b9 ]3 E: `* w1 _7 ?5 I
                 shcounter <= shcounter +1;
- I/ E* `/ h, m                  if shcounter <"00000000000101" then  o_sh <= '1';6 x& h: u6 R( x7 I
                    else   o_sh <= '0';                     
2 U! G: o, {* N2 S                  end if;              
: X8 P' S$ P- i; A  l( ~              else
* Z6 F+ w  o2 b. w) p: B              shcounter<= "00000000000000";
8 {/ E# V$ c8 L9 l               end if;
- Z" S  r7 J% t2 O0 I- _           else
- c" _- r& |  i" R               delay <= delay +1;
$ ^7 a1 E) z3 J/ K           end if;
9 Y) X. ~. b9 |) J7 h         end if;
  h7 s2 W; N0 v/ g       2 H* r. A6 w9 M) |3 ]9 f3 t
     elsif enable = "10" then
- X* j+ @# e5 C* _8 f9 o' |        if clk1'event and clk1='1' then4 t+ x1 D, d$ o* o: m0 B
           if icgcounter <"100111000100000" then  -- 10ms ICG7 `/ p( H) ^) T% G5 O
              icgcounter <= icgcounter +1;2 E5 h' E' t) g
              if icgcounter <"000000000010100" then
1 `3 O7 P' ~. t6 I4 V5 u. ~                 o_icg <= '0';               
8 `% t4 q- e: X7 }8 h              else$ F: o. p6 i. H- o- M. W
                 o_icg <= '1';                  e( }2 A) B2 M: P3 s
              end if;
* h2 g& E6 S8 k6 J           else
* t& f, c: B7 {8 N  a5 E' ^2 Y- ?/ r% n               icgcounter <= "000000000000000"; , \1 t, @$ r! u( c1 i' p
               stop<='1';+ k* @( c+ f* C$ v, ]& T) b
           end if;/ i8 |2 g% p" M3 O- F- }3 p8 p
           if delay = "01"  then
+ ^& x* P6 F+ j% m              delay <= "00";
+ S, x4 g, a5 o5 c) b5 [              if shcounter < "10011100010000" then  -- 2次10000分频delay用于产生ICG、SH的脉冲间隔0.5us,10ms SH
5 m+ I2 ]5 d, q4 m$ |) O                 shcounter <= shcounter +1;
, y3 p3 `1 d; }& T% q& F# s                  if shcounter <"00000000000101" then
' @8 h* E0 }4 y) C/ h                     o_sh <= '1';$ {6 ~4 f8 a' b3 }1 U
                  else1 F  n; ]7 w8 D4 U1 _
                     o_sh <= '0'; 4 o1 l$ @6 J! }5 z5 c. r, |/ A) C
                  end if;              & m+ o! F; k8 c& `& [2 J
              else
; {* v% y3 t; U8 X$ \3 _6 t                  shcounter<= "00000000000000";
; _. a7 @1 o9 X+ {$ D4 I; i              end if;
7 k" r. E' N6 {4 e           else
, W% `( Y) n* r; i               delay <= delay +1;; D( U: H" C+ L6 Z
           end if;      
) t! N& a6 h5 @9 g" c        end if;9 W3 D8 W2 i! k" e2 A
   end if;  , \; [* G8 F/ Y2 n( ~+ f0 T
  end process P2;
# l: Y0 ^! K4 _" S$ W) Lend behave1;! R4 \4 L) y" l. Z4 M& q, {
Error (10821): HDL error at divclk.vhd(42): can't infer register for "stop" because its behavior does not match any supported register model5 j3 k! F- x6 R+ U5 {7 P
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! ^0 ?+ A; t& k7 M* v/ j
Error (10821): HDL error at divclk.vhd(42): can't infer register for "o_sh" because its behavior does not match any supported register model3 _$ Q& N' e6 ~$ B4 C
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[0]" because its behavior does not match any supported register
: Z# W! `! s8 }( v- ~3 \model
9 I8 [- s$ {4 f7 P6 x/ Y0 l+ fError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[1]" because its behavior does not match any supported register
- N  r; q- ~4 y: o; b, Vmodel/ K- Q" E1 k( G' ~* A8 n
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[2]" because its behavior does not match any supported register ) H5 l2 i) a( d# d& x
model4 M' ?4 ~& g: r7 r% m
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[3]" because its behavior does not match any supported register
% e  d9 A! w7 e7 rmodel; w, C) B/ G. T; j, P3 t
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[4]" because its behavior does not match any supported register
/ x1 Q$ s- {9 [! W+ F* f- mmodel& d% y. A# J$ F/ r  e7 M
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[5]" because its behavior does not match any supported register & N# [$ L: X( J  v0 D/ T! S
model
2 V. Y4 s/ N9 T5 e1 h8 W3 ?Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[6]" because its behavior does not match any supported register 4 t' w3 C& u5 w6 v0 c% U
model
" b6 q5 E- Z7 z, F0 o+ ^Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[7]" because its behavior does not match any supported register
/ z$ Z0 [6 F' p6 D' k, \% ?- amodel
1 J- J: E3 M' oError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[8]" because its behavior does not match any supported register 4 b; m1 v7 l+ R6 I4 [
model, ]! U) A1 P* a& K! \. z) A
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[9]" because its behavior does not match any supported register 5 n; s  z/ w5 o9 x! |
model
6 N& G4 y) k0 G9 M5 D, X# n( ?$ RError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[10]" because its behavior does not match any supported register
+ k2 Y# ]4 b% N2 }model! K% ^8 x1 N$ z9 F! i9 o
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[11]" because its behavior does not match any supported register
/ i. r6 B' i, u: b: wmodel
& ~4 L5 y; B! j3 i( L3 R# cError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[12]" because its behavior does not match any supported register
8 y7 i0 b6 }! M1 G% Omodel
; H& |+ a& A: ^, kError (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[13]" because its behavior does not match any supported register 6 D  C3 `7 A  f2 H, F5 i0 n
model" F8 s+ N( v( P, }
Error (10821): HDL error at divclk.vhd(42): can't infer register for "icgcounter[14]" because its behavior does not match any supported register
$ i5 g! u; A6 V. [) Wmodel4 T8 R8 K" \- E
Error (10821): HDL error at divclk.vhd(42): can't infer register for "shcounter[0]" because its behavior does not match any supported register 9 v8 e; p3 s! Q/ w
model. l/ ^. Z" J$ R! t' K
Error: 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;
    ( x! x6 [/ H# U& j" v USE IEEE.STD_LOGIC_1164.ALL;: n# Z1 N. Q. R0 C3 X- T# u" R# O
    USE IEEE.STD_LOGIC_UNSIGNED.ALL;
    9 z& X" ^8 |& ?  ]$ p, N entity divclk is ; v+ O. I4 Z5 i9 Y- c
       port(clk: in std_logic;+ `  m3 |2 ]0 {7 ]
             start:in std_logic;
    9 d% Q6 q# F7 _( N1 l+ T2 v         enable:in std_logic_vector(1 downto 0);* ?! ?% B' Z! I0 x
             o_m_clk : out std_logic;
    ' U# Z; J( t0 D* t" e         o_sh,o_icg:  out std_logic;
    - @; O6 D$ ^6 P3 x) Q         stop: out std_logic);2 L. y' n) S8 a# ]; X$ n1 E
    end divclk;
    + V: \$ a' ?4 {4 o% m6 _( V1 z0 A architecture behave1 of divclk is8 x1 M0 \; E2 v
    constant halftime :std_logic_vector(3 downto 0):="0101";
    - A: [: \  J, c& Y signal divcounter: std_logic_vector(3 downto 0);--shizhong fenpinjishu
    # l2 g6 p4 Z) o' Q( s6 H! P% f signal shcounter : std_logic_vector(13 downto 0);--tiaozheng sh zhouqi he zhan kong bi1 t: s2 {2 }8 h0 F1 o  I5 c* l" v/ r! m. Z4 o2 J! A
    signal icgcounter :std_logic_vector (14 downto 0);--tiao zheng icg zhouqi he zhan kong bi% d9 K0 \( Q* D7 ^- g0 Z* s# k7 o8 q  V4 B. g
    signal delay :std_logic_vector(1 downto 0);--shixian ICG/SH de mai chong jian ge7 o6 n3 \2 a1 H6 K
    , q) }: {6 L0 Y( X  Q# S3 c signal clk1: std_logic;1 L  h$ B4 Z" r  k( m
    begin0 \4 Y/ _- }7 m
    P1:process(clk,start)--24MHZ,12fenpin
    ! |$ Z" @; X# s% ?2 @( i% H4 n    begin
    4 M4 N5 w; L# M- `: V9 U6 x$ M  R( z$ K     if start='1' then* a: f3 g% @1 f
            clk1<='0';
    ( [6 h7 }. M* N        divcounter<="0000";
    $ Y5 ?3 I/ t# h' g7 d+ v& g/ Z      elsif clk'event and clk='1' then/ k! f) R: y# y; r5 x) {/ n
                 if divcounter = halftime then
    # O) N% }( a  a                clk1 <= not clk1;
      L2 |- \' \4 B' q  n  Y7 R: i                divcounter <= "0000";6 _' N7 _( R# m$ p/ a2 ?& I! g
                 else
    6 ^6 |. _5 t3 x8 g' @3 D               divcounter <= divcounter + 1;& g. Q) [1 I) h% U. I! [' l
                 end if;4 j, D# u. V& A3 g4 c4 r
             end if;
    : @( u! g' e* `: w      o_m_clk <= clk1;
    * l% y; M; v: C4 H; d5 o    end process P1;5 P1 `3 A7 q# J; _/ s& X  s3 i1 @
    P2:process(clk1,start,enable)
    . S% i0 K8 |+ k, I begin' y$ O( y5 V8 C; q( s* j: S! r( W4 I) [
          if start <= '1' then
    9 d  z$ W9 S" k- |  D         delay <="00";
    ! I9 Z7 g6 t  i/ Q         shcounter <= "00000000000000";) i$ _) e" }5 K# W( a$ E# i
             icgcounter <= "000000000000000";
    ( L! x! x0 E2 K& `         o_sh <= '0';
    5 D7 p$ t  G/ M' }7 i0 G. N6 C$ n9 O         o_icg <='1';5 z5 r" ^% M$ l' i0 g
             stop <= '0';
    % [# c% c8 [! ~" q# z7 L& N      elsif enable = "01" then1 \6 k, d2 c# {% r2 D4 l
             if clk1'event and clk1='1' then
    ( T/ o0 Z1 X* h* Z0 k4 C            if icgcounter <"100111000100000" then    --20000....32767$ N4 K3 J3 A# K6 C* @: h/ O
                   icgcounter <= icgcounter +1;
    ! h  n6 r* ~2 C8 y& ~/ J$ l3 p4 u               if icgcounter <"000000000010100" then   --20
    - @: k5 A: a% |+ n( E                  o_icg <= '0'; * V) Q; I2 _7 v0 V" M7 m( P. Z
                   else % F$ b+ H' V, H% b- _
                     o_icg <= '1';
    # C2 r7 F8 E9 a2 C4 i+ c               end if;9 e( y* V3 _# Y- i
                else
    7 U2 v! Z2 |9 F/ l! Q5 x5 j4 y                icgcounter <= "000000000000000"; ) o0 p0 }7 Z( }+ O4 l+ Z
                   stop<='1';" u: Z6 ^" r* {, z+ [2 r
                end if;6 V* X. q( d. }7 }
                if delay = "01"  then' b7 K7 O, a$ F0 [# s3 K, v
                   delay <= "00";4 }7 A8 c! m( g" b
                   if shcounter < "00000000001001" then6 I* ?' C4 O9 ?% ~6 v
                      shcounter <= shcounter +1;3 s* m  @  s8 @9 m1 J8 K
                       if shcounter <"00000000000101" then  o_sh <= '1';
    * E5 @) d+ i, m" {& [                     else   o_sh <= '0';$ E# x7 E+ N2 P# J3 f
                       end if;) ^0 d2 N5 T& }2 s$ i% P
                   else
    ' g/ g6 u: G7 _/ ?2 Z8 m9 i               shcounter<= "00000000000000";( J- H& F- v, c, }. Y
                    end if;
    8 d- h; \7 O4 Y* g8 T* y# ^$ x% _            else/ q% ]2 s( t6 ~9 s5 R1 O0 y: R
                    delay <= delay +1;
    : X8 \4 T( _' B7 L6 W4 j            end if;
    2 ]# U) R3 K3 O$ E& m( [7 R          end if;. b1 i7 D5 P6 P
            + m0 `/ _9 G( R! h) P: W% `! L
         elsif enable = "10" then( g+ B: \; X- C* T' c! L
             if clk1'event and clk1='1' then
    ; z$ Q0 Z/ F, _, x. h            if icgcounter <"100111000100000" then
    ' F% {2 y, H* u7 X7 b9 O) v2 Y               icgcounter <= icgcounter +1;
    7 A6 r+ `  a  \6 x               if icgcounter <"000000000010100" then
    " j4 O7 E; B# y3 m9 l                 o_icg <= '0';# w6 ]2 x' u9 P$ u8 B/ C: V; F# z
                   else
    8 d/ j6 D6 U- W# M                  o_icg <= '1';
    1 D6 G9 F% \" u( U" ~               end if;: q1 k" b0 D) V( f) u" r& R
                else
    ; N9 l2 y, E8 q" t               icgcounter <= "000000000000000"; . l1 Q2 g% e8 r* y: l
                   stop<='1';
    / |) S7 v* q" F, y            end if;/ D5 e( G" X, c/ a
                if delay = "01"  then0 ?3 `# s2 y6 M3 o) H
                   delay <= "00";
    ' `  m- U' o) X5 d% A               if shcounter < "10011100010000" then+ J/ `) H4 \! E& T0 y$ `
                      shcounter <= shcounter +1;
    - t$ V, K( E- `( G4 f                   if shcounter <"00000000000101" then
    " S1 h9 ]; s4 G8 |: T- s                      o_sh <= '1';2 |% X6 ^1 n( g; o- `
                       else
    0 W. X: W/ ^2 z' ~  p' U6 g* h                      o_sh <= '0';+ K# m, D8 l9 c5 C% H/ u; v
                       end if;1 O- [4 e+ O( z
                   else
    3 D% K4 q7 Y4 a( t/ U# N) U                   shcounter<= "00000000000000";
    3 Y! g3 Z) W! G               end if;
    4 S1 J! @6 `* U4 k( G            else
    . q8 G; E. V- R$ l& E                delay <= delay +1;
    ( S! _& ^; b: E2 d- K            end if;  L8 D# t, g! {/ u/ b& {& H' j8 P/ O7 N6 Y
             end if;
    9 V& R* H: ]8 Z, m# H1 {0 E4 P    end if;
    0 b$ e8 V# h/ U, t* W   end process P2;/ j& T4 X/ W9 b$ N; ~0 c3 S
    end behave1;
    8 a; s7 F# H6 i- v

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

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

    本版积分规则

    关闭

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

    EDA365公众号

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

    GMT+8, 2025-7-21 04:17 , Processed in 0.125000 second(s), 27 queries , Gzip On.

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

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

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