|
EDA365欢迎您!
您需要 登录 才可以下载或查看,没有帐号?注册
x
下面程序中有错误,新手,不知如何解决,求解答0 F/ v4 F& J* k+ W8 T) f
library ieee;* C5 j8 ?! o% W( M
use ieee.std_logic_1164.all;! d) ?. @; f) E! y
use ieee.std_logic_arith.all;
- o2 l6 O4 i& A3 c9 ruse ieee.std_logic_unsigned.all;
$ m$ b2 E. L$ V4 O, w% f" {, k( m0 } |
entity mycounter_60 is
% D, f: d+ M, t$ I& O port(clk,clr,en,bcd1wr,bcd10wr:in std_logic;
" g. w0 v& _$ h" M2 {+ X9 r din:in std_logic_vector(3 downto 0);
6 j% M. w( p! f9 z, N bcd1: out std_logic_vector(3 downto 0);
# y$ C" ~8 X5 n/ L9 Y6 U co: out std_logic;
$ S( V0 R8 A% m! Y1 \ bcd10: out std_logic_vector(2 downto 0));3 n- j3 J$ `6 N
end mycounter_60;1 T Y+ r. j; V6 M' d
, K% B: p3 h% ~( g1 l! E$ Uarchitecture art2 of mycounter_60 is. k. L0 H. |8 a/ ?4 z9 U
signal bcd1n:std_logic_vector(3 downto 0);1 x( X( [, c P' }
signal bcd10n:std_logic_vector(2 downto 0);6 ~' ? S* G( ~7 g! H+ g
begin
3 C, I3 _5 x6 R2 P3 {" h# | PROCESS(clk,clr,en,bcd1wr) is
" a ]* x2 e" O$ v begin
/ m7 p ?6 y% M3 {" ] if(clr='0') then
# d/ {2 H, Q4 Q5 S3 _ bcd1n<=(others=>'0');
9 T$ l ]( w+ r! L* o+ w bcd10n<=(others=>'0');
2 c: K1 Y; X2 E9 i. s2 K" | elsif(clk'event and clk='1') then
& t- ~! B6 v x, u4 ?8 @: S$ Q if(bcd1wr='1' and en='1') then$ ]. T' A ^* m6 K
bcd1n<=din;' I+ O- e6 F/ _$ M
elsif(en='1') then3 S1 v- r& l( h
bcd1n<=bcd1n+1;
6 R0 R9 v( ?- }3 P5 v1 m X if(bcd1n>=9) then8 D4 \, E9 i. ^
bcd1n<="0000";
N% ~5 Y8 Y/ H$ R( Z end if;+ i, T5 V4 j2 ^- [4 s3 L- r
end if;
9 _) \, J# b" _( X% R( A K) n5 b end if;( ` x; A, ?/ @# F* k" j
end process;
$ e! X# L8 N. C* [ * v4 }' q4 t# I0 f
process(bcd10wr,en,bcd1n) is
: ~0 s. A% `. | begin
. n& u2 g4 V0 V- B2 O* a% Q* Y2 K q if(bcd10wr='1' and en='1') then
) _/ k, s" w9 i& J bcd10n<=din(2 downto 0);6 x5 x J6 A7 h
elsif(bcd1n=9 and en='1') then
& w& \$ c) M0 `7 @ bcd10n<=bcd10n+1;+ t8 r8 Y, P/ g3 J/ M. E
if(bcd10n=5) then
$ M4 Q. ?2 z$ B& t3 R1 Z. r bcd10n<="000";5 b5 v2 Z& K: D( f( A0 ]: I& W' F
co<='1';
. N, v! {" w. ^ else
! t y9 C4 i! L) n* N co<='0';7 x7 G) @/ O8 d9 B% J8 Z
end if;
/ M. g$ ]+ r8 z end if;- H* E: @3 y* I
end process;% T4 g4 Y" J$ m
y R, h1 ~* r& c) j) a* p
bcd1<=bcd1n;; e* h" Q/ Z) f
bcd10<=bcd10n;$ N5 L* s: O# C- E) K' ^
end art2;' G& H7 d* `$ ]
8 @4 Q+ A5 a0 v3 m; ~
非常感谢 |
|