compilation in VHDL

Thread Starter

Infinity1

Joined Jan 11, 2009
16
Hello Everyone

I have written this code,the code is to convert binary to bcd and to display the result in two(for temperature) 7segment, but the problem is that the compilation fails, maybe someone can explain me what's wrong with my code and how can i fix it
thank's

here is the code:
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
*
entity binbcd is
port (
Bin_in: in STD_LOGIC_VECTOR (7 downto 0);--Binary Input
bcd_in_1 :in std_logic_vector (3 downto 0);
bcd_in_2 :in std_logic_vector (3 downto 0);
hex0 :eek:ut std_logic_vector (6 downto 0);--output name for 7segment display in DE2
hex1 :eek:ut std_logic_vector(6 downto 0);
Bcd_out: out STD_LOGIC_VECTOR (9 downto 0)--Bcd Output
);
end binbcd;
architecture binbcd_arch of binbcd is
alias HEX_1 :std_logic_vector(3 downto 0) is Bin_in(3 downto 0);
alias HEX_2 :std_logic_vector(3 downto 0) is Bin_in(7 downto 4);
begin
bcd1: process(Bin_in)

variable z: STD_LOGIC_VECTOR (17 downto 0);

begin
for i in 0 to 17 loop
z(i) := '0';
end loop;
z(10 downto 3) := Bin_in;
*
for i in 0 to 4 loop
if z(11 downto 8) > 4 then
z(11 downto 8) := z(11 downto 8) + 3;
end if;
if z(15 downto 12) > 4 then
z(15 downto 12) := z(15 downto 12) + 3;
end if;
z(17 downto 1) := z(16 downto 0);
end loop;
Bcd_out <= z(17 downto 8);
end process bcd1;
end binbcd_arch;

architecture behave of seven_seg is
begin
process(HEX_1,HEX_2,hex0,hex1) --architecture behave of seven_seg is
begin
with HEX_1 select --(MSB) GFEDCBA (LSB)
hex0<= "1000000" when "0000", --show 0 at the display
"1111001" when "0001", --show 1 at the display
"0100100" when "0010", --show 2 at the display
"0110000" when "0011", --show 3 at the display
"0011001" when "0100", --show 4 at the display
"0010010" when "0101", --show 5 at the display
"0000011" when "0110", --show 6 at the display
"1111000" when "0111", --show 7 at the display
"0000000" when "1000", --show 8 at the display
"0011000" when "1001", --show 9 at the display
"1111111" when others;

with HEX_2 select --(MSB) GFEDCBA (LSB)
hex1<= "1000000" when "0000", --show 0 at the display
"1111001" when "0001", --show 1 at the display
"0100100" when "0010", --show 2 at the display
"0110000" when "0011", --show 3 at the display
"0011001" when "0100", --show 4 at the display
"0010010" when "0101", --show 5 at the display
"0000011" when "0110", --show 6 at the display
"1111000" when "0111", --show 7 at the display
"0000000" when "1000", --show 8 at the display
"0011000" when "1001", --show 9 at the display
"1111111" when others;


end behave;
 
Top