|
20位元BIN轉BCD的程式
- |; J4 r' c9 H kLIBRARY IEEE;
9 b r0 ?! F$ u- [* C6 z' _# \use IEEE.std_logic_1164.all;
6 u; D1 B$ Y8 D8 ~, X% R' \3 Y) V" ^2 @6 c: U
entity bin2bcd is2 G( b3 B# m1 k
port(
5 R# z! }9 |* h: Y; P) |* B data_in : in std_logic_vector(19 downto 0);
: \+ |0 W; {% ]' J/ } EN : in std_logic;
6 w; ^+ ], M9 |- x; I( P data_out : out std_logic_vector(23 downto 0)5 {) ]# p6 f0 e% v" d
);6 {2 y. y* f: b2 c/ N; a! V- m
end entity;
1 x! n2 d; M7 W- S4 r; @6 o6 k2 E5 a g3 c' B8 P
; V, _& E) X' E1 M5 r5 w# ?, D0 Z
architecture bin2bcd of bin2bcd is
. W3 W- u8 ]$ a! I7 A# o2 n7 Ybegin
7 w- S: R3 v5 g0 P; a, l. H3 L. J3 s- F2 m) j C
process(data_in, EN)! ?6 }0 h2 n6 q1 L# F3 q
variable data_in_TEMP : std_logic_vector(2 downto 0);
: s3 U8 s5 N/ q# O2 mbegin! N3 v4 I4 e( [% c+ I
data_in_TEMP := data_in(19 downto 1);
2 M, x) Z8 b) o( K data_out '0');
! k. H8 b% _) p+ h if EN='1' then
; R+ q4 \3 N3 G9 x2 Q& [1 Z case data_in_TEMP is$ U" T; r. W9 w$ L& y
when "000" => data_out(23 downto 1) data_out(23 downto 1) data_out(23 downto 1) data_out(23 downto 1) data_out(23 downto 1) data_out(23 downto 1) data_out(23 downto 1) data_out(23 downto 1) data_out'0');
, Q- V1 J9 B6 Q6 \ end case;
# z. h2 p, D( d( \+ f& Z; |6 I+ m/ L/ p6 C% G
data_out(0) <= data_in(0);$ {3 f( d) e& R: V7 c8 b
end if;# u4 ^: n# u3 Z9 v1 \! o! q
end process;
& \$ r5 b$ {2 X) J! y. |' G0 T! H+ a7 G4 @1 A
end architecture;
' M6 m- N% n/ j, ?8 f. A$ t- P4 u8 C' D: w v
* v7 A" r; l. i7 l' D! D" x
CHECK的時候第一行跟if EN='1' then這行出現錯誤
( _3 H! y/ w4 Z0 e會是什麼問題?? |
|