|
EDA365欢迎您!
您需要 登录 才可以下载或查看,没有帐号?注册
x
下面程序中有错误,新手,不知如何解决,求解答7 J0 S- U, O2 S3 N
library ieee;2 G- x% {% ~, h) G/ u( s
use ieee.std_logic_1164.all;
4 {% |) W; `% w4 i7 juse ieee.std_logic_arith.all;1 T, k6 r9 f7 a; n
use ieee.std_logic_unsigned.all;0 E3 Q( l1 z7 m/ M, [/ _
0 J) s3 V) P( N
entity mycounter_60 is
5 ]. e4 P6 V( S7 T7 R! | port(clk,clr,en,bcd1wr,bcd10wr:in std_logic;6 R: b% }1 F! C+ D! a
din:in std_logic_vector(3 downto 0);+ m. P0 T& b& G. x# K9 f. ]7 Y2 b) ?
bcd1: out std_logic_vector(3 downto 0); ~7 G0 G* A' {6 u; t
co: out std_logic;/ c0 E9 F( P* E& [: }
bcd10: out std_logic_vector(2 downto 0));0 q' I2 D% ~0 j. N7 V) ]
end mycounter_60;
9 \+ p) P( c" @ s4 P# r: Q3 r) j% c, I. C3 o D# X2 S
architecture art2 of mycounter_60 is' M5 a% |8 g& m' E- x3 l& S; j# t4 M
signal bcd1n:std_logic_vector(3 downto 0);
7 ]! @; ^1 O* m. Q9 _signal bcd10n:std_logic_vector(2 downto 0);' Q" f1 _, ?6 F) }# g
begin
8 ^" R/ K( ]( }! W PROCESS(clk,clr,en,bcd1wr) is
: J [+ s0 J# C. O begin
, y* i/ ^* n" n0 H+ N: j if(clr='0') then
$ W: K% Q& h; E( O% m bcd1n<=(others=>'0');
, i( D0 I! _3 j+ N9 h- p# c bcd10n<=(others=>'0');4 \. T% q- d. G. J9 ~* m5 H1 Z( |
elsif(clk'event and clk='1') then2 \- j5 n' A- _2 b5 m2 H' Y
if(bcd1wr='1' and en='1') then- i: e# B7 S. c
bcd1n<=din;
+ Q$ P: I6 g& N$ Q" m8 A; Q elsif(en='1') then o- ^: t. |( P5 _) A
bcd1n<=bcd1n+1;. m. M! |- [/ N! a4 c# u
if(bcd1n>=9) then) \; _8 c7 J2 F C7 u% C
bcd1n<="0000";! j& f" l' m/ Y i
end if;2 f1 ^, l7 `. S, V$ D
end if;
% H4 M0 P$ E( z% K end if;. J& U3 P- o% |/ v4 F. Z8 D
end process;2 p- D5 K& G6 ^: {5 i/ Q
( O, V4 W4 v, K0 m) q
process(bcd10wr,en,bcd1n) is: U+ s9 f( V/ o% f
begin
$ m7 a; O' b a; y2 o2 j if(bcd10wr='1' and en='1') then
! n: ?8 `# U5 |! Y bcd10n<=din(2 downto 0);, W! F' |! h% s/ y9 m' Q
elsif(bcd1n=9 and en='1') then
; o7 i I n' I2 y6 | bcd10n<=bcd10n+1;
! ~) @, Y/ K0 k" C# d if(bcd10n=5) then; ]$ n% ~: g- @
bcd10n<="000";, n, b! T+ _) V* f* y/ S
co<='1';
3 R( B8 i- v- D# a# v r C else
; s- `& ~; T! G9 k6 o( S co<='0';) b# d4 D% h1 o- h- E; s6 h' ~
end if; T% b$ _4 A6 a) B n
end if; v: ?. y8 \. ]
end process;/ I7 ^* j0 @ _; ?' n
2 b* `: |7 ] S1 j' p+ b |
bcd1<=bcd1n;
% r/ w2 K6 E1 p( f& o/ ^ _ bcd10<=bcd10n;
5 w6 j, f& j: n( |$ I% Oend art2;' n" T- U$ o- @/ |/ y9 G
5 {9 k; y' y0 l+ F1 e9 j* Y$ Z非常感谢 |
|