Chip123 科技應用創新平台
標題:
請高手幫忙看一下
[打印本頁]
作者:
jlhl1170
時間:
2008-1-12 10:50 AM
標題:
請高手幫忙看一下
20位元BIN轉BCD的程式
0 x' f6 V0 P- B
LIBRARY IEEE;
& ^; O/ c. x: }; G
use IEEE.std_logic_1164.all;
; x7 S3 @# X4 n1 X9 R, |
- t6 Y7 j( `) ~# w, c7 t. `
entity bin2bcd is
! X; x) T/ L$ Y0 o
port(
$ i l/ e8 `! F
data_in : in std_logic_vector(19 downto 0);
X) U- e2 J0 r
EN : in std_logic;
k5 T- f- G2 f6 u1 q3 }3 e
data_out : out std_logic_vector(23 downto 0)
7 w; A" Y8 j6 s. A. G% y) J' T
);
$ H/ Y# [! t* v2 c! M, h
end entity;
. W8 g% e4 s# m+ X: G
; |1 [1 i, P: E( `# k; p; I" s5 Y
. e1 i5 t$ h8 \ I+ I. m. m h
architecture bin2bcd of bin2bcd is
" [& m6 k* O! U8 Y+ }
begin
/ e! f3 Q' i6 b/ v0 l
. `' m2 ]5 s' ^: H2 y
process(data_in, EN)
& x; R: W/ d/ n! X' w
variable data_in_TEMP : std_logic_vector(2 downto 0);
5 Z8 U( y. T4 g8 O& @. T) d/ c
begin
5 ~# U8 I' f! D( ^) N3 ]! R
data_in_TEMP := data_in(19 downto 1);
% L6 B" k' @& s ?6 x
data_out '0');
" W: @# N' v8 E. I# y
if EN='1' then
4 R( ] m( p- E" V* ?8 Y
case data_in_TEMP is
1 z. s( k% b- G0 j0 U
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');
, r3 a. Z' U7 F }
end case;
( \, e% \4 [0 c8 b
6 h1 N5 [4 X4 U, g. x7 T( ^
data_out(0) <= data_in(0);
9 y" P6 @7 a& T
end if;
0 S5 M5 U4 y- B! j6 C c* J& T! ]4 R# W
end process;
/ c7 l! ^8 T# c: P, r! m4 o
& s, a; T* r+ a; n# ]5 |4 `
end architecture;
2 [8 D1 q4 J' C
: J* ~! Y+ a/ D# P% M& _$ v5 B
+ R! ?' ]- \2 g X; u" m! o
CHECK的時候第一行跟if EN='1' then這行出現錯誤
]( B+ H5 b, I. _. n
會是什麼問題??
作者:
johson
時間:
2008-1-22 05:03 PM
variable data_in_TEMP : std_logic_vector(2 downto 0); ~~資料寬度 3 bits
7 P7 i9 u! w4 _: \# `2 {/ w2 L
data_in_TEMP := data_in(19 downto 1);~~資料寬度 19 bits ??
/ T+ }. h) e& L7 h9 b
data_out '0');~~????????目的為何????
歡迎光臨 Chip123 科技應用創新平台 (http://chip123.com/)
Powered by Discuz! X3.2