EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
下面程序中有错误,新手,不知如何解决,求解答1 a, b0 Y0 o& D. z
library ieee;
+ s& }- e+ N- ~) V G" juse ieee.std_logic_1164.all;: _, g$ q }7 }$ [9 r
use ieee.std_logic_arith.all;0 Q8 i1 I- r; B& v ^+ u, E& Y* |
use ieee.std_logic_unsigned.all;6 q$ ^1 d3 y5 l# V, f! \
, s% M2 ^8 N2 \5 E0 }: e
entity mycounter_60 is5 e) n) M& X3 s, Y. y7 T
port(clk,clr,en,bcd1wr,bcd10wr:in std_logic;" G) |7 D' n9 u) T% `% C9 [; ^( r8 a6 p
din:in std_logic_vector(3 downto 0);: F5 c& t& N. k, h+ W
bcd1: out std_logic_vector(3 downto 0);2 N2 l( y0 H- g5 Y
co: out std_logic;2 v N; ~. x) w9 K5 |" F0 s( K- O" u
bcd10: out std_logic_vector(2 downto 0));
2 h& ]6 {. O$ p+ p( Eend mycounter_60;: }/ | k7 _/ o% g( r( k
& T" J: E ]3 a9 Z g* oarchitecture art2 of mycounter_60 is
2 i1 B5 C# f }. V3 V* z/ ksignal bcd1n:std_logic_vector(3 downto 0);
9 B8 }+ O- O; u' m" H, \8 bsignal bcd10n:std_logic_vector(2 downto 0);
" E9 [: U9 ]! M6 h6 }0 n- `9 Obegin3 [; A/ j- \( s1 j r5 C
PROCESS(clk,clr,en,bcd1wr) is
) r; | R3 k2 o/ `) `$ F' O. I begin2 }$ V: M( s( t- O- z
if(clr='0') then
5 l. h3 _& I1 J/ a! g, s4 U1 y3 D s bcd1n<=(others=>'0');; ~! w+ G) j% Q& }
bcd10n<=(others=>'0');
2 S- |0 T* F. j. [ elsif(clk'event and clk='1') then
3 R7 B6 y# Q* I, T7 y! y/ Q% U- b if(bcd1wr='1' and en='1') then
* j) y# |2 M& K; V% }: G0 @& E. X bcd1n<=din;3 G/ g0 u6 n5 c; D
elsif(en='1') then
# M3 e+ ^* N2 G+ g* `9 a h F" C bcd1n<=bcd1n+1;
2 j* Y+ l2 r* H& M if(bcd1n>=9) then
. ]" U; j% R: a9 Q9 } bcd1n<="0000";
: V$ I& [# ]( | end if;9 L$ I0 g) {0 ^' P8 A
end if;4 S) |' x, R/ d! n, U* b4 @7 b
end if;5 A7 U4 N' l* {. t6 d
end process;
% [8 d! f) z* c- H' S
6 |" _. B8 p9 b) {7 e% }) Q process(bcd10wr,en,bcd1n) is
- X& x3 b' |0 Y( |& R0 S* U begin7 }3 Z! ]% y2 c. o2 }# [
if(bcd10wr='1' and en='1') then* Y* k, t7 D0 L$ f, T! q6 V- r
bcd10n<=din(2 downto 0);% K' W) k: W# X# P+ r
elsif(bcd1n=9 and en='1') then
# P; w& B6 D5 M6 w8 N) Q bcd10n<=bcd10n+1;
3 U y% f+ f! c' c( b$ U( e+ Q9 | if(bcd10n=5) then8 A$ _( X6 X% l/ `2 f$ ?
bcd10n<="000";" M: ?7 L& K; b
co<='1';# w- h( W6 i' j+ o/ e' K' [+ q5 _
else
) A0 ~' j7 G7 \8 z9 K$ P' z! D! n co<='0';
8 b* f3 {/ n# ^8 ^, E end if;
, f9 g5 g3 t7 T7 [! A$ ?9 O; t end if;
2 e/ v) S. g& f+ q" ?$ i3 f end process;
) [: l0 T. d1 U5 I+ U % i; d! A. S( x. M; H( C4 y
bcd1<=bcd1n;: @$ d# {5 g+ d' k n: D8 A' G4 _
bcd10<=bcd10n;
2 s+ X9 e* O6 w. s/ `5 ?/ Uend art2;
3 I8 v9 D9 ?0 S0 C7 y- @
6 U; D# y$ J* L" I- m6 m非常感谢 |