EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
下面程序中有错误,新手,不知如何解决,求解答' E! a f/ M$ t8 t$ F, I
library ieee;+ k: A7 ]/ d8 P b- j
use ieee.std_logic_1164.all;# H. d+ t, w3 {1 K& F5 c
use ieee.std_logic_arith.all;; w0 q/ ^. g, U- ]
use ieee.std_logic_unsigned.all;; w9 G( t3 q d& r: M, Z
) n: b: ?" n* ^( P, x K
entity mycounter_60 is# W9 X7 M( x, H+ [5 X. p
port(clk,clr,en,bcd1wr,bcd10wr:in std_logic;/ m4 p7 M& N; j. i! A W4 c, g
din:in std_logic_vector(3 downto 0);
, Z5 a: ^0 d. I bcd1: out std_logic_vector(3 downto 0);- N" t; \; F( S2 A' f+ W' X. U
co: out std_logic;
* k+ E' v2 L' Y bcd10: out std_logic_vector(2 downto 0));
2 G0 `# B5 X- pend mycounter_60;
' a9 ?) E" i. n- Z! G; \2 F3 Z
! n O M! c/ z- R; P) Carchitecture art2 of mycounter_60 is
9 V$ c, Z2 h% J4 P# v3 Ksignal bcd1n:std_logic_vector(3 downto 0);
5 J0 u" j7 g: L, @signal bcd10n:std_logic_vector(2 downto 0);
; J0 `) c) J5 k* f lbegin0 f' R& s6 o N
PROCESS(clk,clr,en,bcd1wr) is
: `2 S; g& J7 X$ m) F. f begin
8 A1 F; |: G* ^4 b) m" V) K5 z if(clr='0') then8 e7 c7 {5 c5 p9 r6 s
bcd1n<=(others=>'0');
& R& A4 X! @3 P2 A1 O bcd10n<=(others=>'0');: p% J$ Y' d& h! O6 o$ F
elsif(clk'event and clk='1') then6 V# P( x0 l( t6 I3 a2 Y8 q
if(bcd1wr='1' and en='1') then& I. u0 W- Z8 h
bcd1n<=din;" m$ ?+ t0 }, F) ]% t! e; L
elsif(en='1') then
0 |4 X6 K3 q! C9 O bcd1n<=bcd1n+1;# K% d$ `* l: {8 @2 m* U
if(bcd1n>=9) then
1 ^% U5 Q. {9 P2 @# P bcd1n<="0000";+ [! `% k( m$ T# U: ?; N' }: L
end if;
5 D3 V1 p; u& F2 L end if;& i9 {% S: k; _ l' Y F
end if;
3 s4 x: t' A, h5 q% K% | end process;/ k: R/ o! }5 w! `2 b
: ?' K: A+ w+ d- \ process(bcd10wr,en,bcd1n) is7 ?, X% @& A, i. j" G$ \+ r
begin3 m6 h9 g0 V8 _2 m, N! S0 q8 {
if(bcd10wr='1' and en='1') then% E4 [: `2 l6 |
bcd10n<=din(2 downto 0);6 ~9 O0 B0 M6 C; c0 x- f
elsif(bcd1n=9 and en='1') then% Y) g% _6 _: x' n
bcd10n<=bcd10n+1;4 Y+ n+ t4 F [& L6 F; m# u1 j
if(bcd10n=5) then5 V+ a) l! |, u3 j3 S d- ]
bcd10n<="000"; z4 I! q6 r% n; ~
co<='1';
1 c2 o& O3 P( L+ ^- K else0 r# K, {9 }: L X2 U7 c, I
co<='0';% B" c1 s& i, g- ? T/ M, v+ a
end if;" e) t' [( C+ T
end if;8 i/ E) d' _( W1 l! }8 M
end process;
$ x" Y6 |2 D" o" k4 Z
# `4 H" v3 k8 J! B3 Y, ] bcd1<=bcd1n;8 O" I1 s; n3 n
bcd10<=bcd10n;1 n7 |- l' F5 K% t& H/ y6 w
end art2;/ j) v1 b& @# S9 L) M! U! {) F
) M$ t1 o( o% [5 }/ }0 i) a
非常感谢 |