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

程序错误,求救

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2011-10-12 15:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

EDA365欢迎您登录!

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

x
下面程序中有错误,新手,不知如何解决,求解答8 U1 y6 i" D" n
library ieee;
- @2 @% O. t6 ^use ieee.std_logic_1164.all;' E9 q6 [' q- T/ }0 C
use ieee.std_logic_arith.all;
3 g4 H! T' f9 Euse ieee.std_logic_unsigned.all;: ]. L6 i" y, V* L

  H) q& W# w) U0 L* v. centity mycounter_60 is- s* ^. ?3 N2 K
    port(clk,clr,en,bcd1wr,bcd10wr:in std_logic;
  ~, I& X/ Q. G2 P# l8 l         din:in std_logic_vector(3 downto 0);/ A/ B  V6 n; x- Z5 m2 E/ ]! |
         bcd1: out std_logic_vector(3 downto 0);" T& P  _2 T7 W' P& K
         co: out std_logic;$ W' O) p  ~. l4 Z
         bcd10: out std_logic_vector(2 downto 0));; T- }8 s* N5 G, }
end mycounter_60;
* F& s! W; T( f' y: @9 G
4 S; P1 i. z# u  ]0 y! darchitecture art2 of mycounter_60 is
6 o# P! t0 p1 s% H1 k" g# rsignal bcd1n:std_logic_vector(3 downto 0);
# q" a& z4 M% U7 K5 xsignal bcd10n:std_logic_vector(2 downto 0);9 Z! [" ]- u' G% u# Q
begin8 U+ |  R  l+ {, ]! E- C
    PROCESS(clk,clr,en,bcd1wr) is8 l9 @/ N" [# x6 {" l! _
    begin
& T3 r, _- s& A8 A' a% U        if(clr='0') then
" p/ t1 z! d1 d/ ^: V% j" P* Y$ L            bcd1n<=(others=>'0');
) w& a: U5 `1 ~2 X& X            bcd10n<=(others=>'0');  o# e  t- K& s: A  v6 c5 z$ e
        elsif(clk'event and clk='1') then/ P- w$ W9 h/ O
            if(bcd1wr='1' and en='1') then
! t0 z4 F0 S4 Z# v! ^3 l; m) t6 a                bcd1n<=din;
# w# K% n# a" r- x/ @8 p# m: W            elsif(en='1') then
  l- H) K2 \& N* g                bcd1n<=bcd1n+1;
' j, j3 d) z! m9 H                if(bcd1n>=9) then
, P8 W+ h) ~  \& F. P/ I                    bcd1n<="0000";
6 U, M! X/ G3 o1 m: @0 x( ~                end if;% r1 T% k8 E5 W8 B4 V6 A
            end if;% D7 D, a0 i1 ]: K; ?3 k# r$ X2 |
        end if;
, q) S# l  @" ?- _! N) t    end process;# P" a6 }1 k$ S3 u
   
5 ?. {2 \2 q- P5 v: v    process(bcd10wr,en,bcd1n) is! @6 K0 |0 l; ^" R) P+ U& m3 p
    begin
4 R: a( R& @. r8 h) o& C        if(bcd10wr='1' and en='1') then
( U: I4 o- u# c* ^$ H2 e5 b            bcd10n<=din(2 downto 0);( \9 O- M+ e% w/ y* m  L
        elsif(bcd1n=9 and en='1') then  c& g9 S/ M0 p
            bcd10n<=bcd10n+1;6 j% x& }" N& j4 b! p8 b
            if(bcd10n=5) then
  z5 G  O; B: g8 Y  B                bcd10n<="000";
( H+ K1 @9 d6 m% V  ~                co<='1';. J* d8 c, V0 ~: b; C
            else
( g" s2 Y! ]2 [/ }7 d( l( ?0 R                co<='0';
2 Y! _7 f5 \( p# F            end if;
" r6 q( F( G: W5 o( H        end if;- {1 v) q# e5 l" C% x: i3 p
    end process;' l$ d4 B8 u0 d& F$ g
   
8 G( i$ U; a9 ]* a- H& X% T    bcd1<=bcd1n;
3 S5 X, r! A, F    bcd10<=bcd10n;) q+ r/ b% }* k" _
end art2;# l3 H  l! u6 S# U$ \
3 m; m- x. w# P+ f
非常感谢

该用户从未签到

2#
发表于 2012-2-24 17:09 | 只看该作者
这些都是小错误,希望细心一点. }7 r  m( Z5 W# H
library ieee;
# X# }5 G3 J- A2 U; W( Nuse ieee.std_logic_1164.all;' m3 H: X8 Y  u8 j! b0 q
use ieee.std_logic_arith.all;) _) A8 u# U0 ]) e6 {6 q7 l
use ieee.std_logic_unsigned.all;
/ T6 c- \) J) Oentity  mycounter_60   is
4 X& X! t8 s$ p7 d4 l4 k; ~$ U4 Mport(  clk,clr,en,bcd1wr,bcd10wr :in std_logic;, h8 S" N* t  _+ B# a
        din:in std_logic_vector(3 downto 0);: S3 X( U8 k( U" T5 ~: I
        cout std_logic;' d5 D# S7 ^' q+ R3 b
       bcd1 ut std_logic_vector(3 downto 0);
* d+ e' G' y' W        bcd10 ut std_logic_vector(2 downto 0)$ x& A  B0 `, J9 u6 ?8 W
       );6 M6 g0 C  ]- V. y, q2 `
end;/ y6 V! N; ^9 |- [( {
architecture behav of  mycounter_60   is
  U& P( `- p1 J, `7 m: q" Asignal bcd1n:std_logic_vector(3 downto 0);
+ `* N9 @& u1 f) d9 t7 Zsignal bcd10n:std_logic_vector(2 downto 0);+ _' D! U. u/ q% q) b" C0 l
4 s; k/ Y, u2 }9 h2 |* ~
begin( L. Z/ Z' R( j7 ]. x
   process(bcd1wr,clr,en,clk)
! L- H% Y1 Y8 G# f6 Q   begin
/ Y8 j1 H& r4 W7 }if(clr='0')then: E0 W' }! B2 h& x: v: X& [
bcd1n<=(others=>'0');
+ n' z& e6 t2 O2 ]/ h: }& s: ~* j
0 U# ^& |- X, {6 A% ?: K! eelsif(clk'event and clk='1')then
2 K9 K. a$ Z5 T& mif (bcd1wr='1' and en='1')then
& t. x/ {& @" E/ b+ ~2 g; U6 Obcd1n<=din;: j! N' I; t( ?+ W
elsif (en='1')then' c/ l" q. l# n# U2 D$ h% j/ V
bcd1n<=bcd1n+1;
# p! G1 a* v# Jif (bcd1n>=9)then2 x, P2 c4 ]3 Y5 m' z
bcd1n<="0000";# X! Y; [! }- \3 c9 d

8 y- T% h9 r2 |  `/ H9 M6 z( n% yend if;4 h0 m  g  p2 M% J6 T6 s! a* T
end if;& g* x8 w2 S- ?' k3 e
end if;+ [& w! k3 F1 n/ A' R' ]5 k
end process;
. y& M* f3 b6 t# w6 x- E
2 l* {0 X7 C5 G' A' @1 V- ^2 z  ^% P
process(bcd10wr,en)
3 k8 i1 q+ a2 a/ i8 |, obegin9 C" s/ T* T7 B" p
if(clr='0')then
# {% V/ O& ^% @bcd10n<=(others=>'0');
1 R8 U0 H+ S5 Q. Iif(bcd10wr='1' and en='1')then9 Z' A( l) ^* I6 D0 I* {& D
bcd10n<=din(2 downto 0);
" K" ~) I4 g% u( L6 Yelsif(bcd1n=9 and en='1') then
1 {$ y' c- u8 f' V" ubcd10n<=bcd10n+1;# c0 S" n* K* f! d1 c
if(bcd10n=5) then
( @0 G- V0 v; _0 \9 I8 R$ @bcd10n<="000";
& d. y+ \% \6 Pco<='1';
/ D* h/ y$ k% g0 t/ selse
5 e4 V: o  W* m1 g  ]" q$ w) Pco<='0';
- M3 B; b' u3 m$ P( G" zend if;
+ Y) J4 M# `. L' m7 Bend if;4 p1 q# O$ \' b1 {9 r& P9 Q, t
end if;
0 A& f4 \  V" L! Mend process;: I% u8 c+ u7 m7 t9 Z

, v3 h; Y, c/ R* e8 i- }bcd1<=bcd1n;7 ?; r+ K/ X0 }% }3 |! \* H/ @
bcd10<=bcd10n;
& e( a, {5 Y, a" Y% y/ Send behav;
" b: c3 q7 R. {      
9 t: m2 O% V3 \  y: B     
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

EDA365公众号

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

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

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

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

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