i need to design a car park indicator system for a space with 8 lots. it needs to have the following specifications:
- a seven-segment display to indicate the number of free lots.
- presettable up/down counter
- each lor has a light which will turn on to indicate that is free
- the light should turn off when the lost is occupied
- when the lot is filled to the maximun of 8 cars, the seven-segment should display 'F' the indicate it is full
i have to write a VHDL code for this but i aint sure how to, can any one help me with it? i aint sure if what i did is right or wrong
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY carpark IS
PORT(
d0,d1,d2,d3,clock, reset, led : in std_logic;
in_sensor : in std_logic;
out_sensor : in std_logic;
l : out std_logic_vector (7 downto 0);
a,b,c,d,e,f,g : out std_logic);
q: out std_logic_vector(2 downto 0 ));
end carpark;
architecture arc of carpark is
signal input: bit_vector (3 downto 0);
signal output_lights: bit_vector (7 downto 0);
signal output_7segment: bit_vector (6 downto 0);
type state type is (l0,l1,l2,l3,l4,l5,l6);
begin
process (in_sensor, out_sensor)
begin
output_lights <= "1";
elsif falling_edge (out_sensor) then
output_lights <= output_lights -1;
end if;
input (3)<= d3;
input (2)<=d2;
input (1)<=d1;
input (0)<=d0;
begin
input<= d3 & d2 & d1 & d0;
with input select
output<= "0000000" when "0000",
"0001111" when "0001",
"0100000" when "0010",
"0100100" when "0011",
"1001100" when "0100",
"0000110" when "0101",
"0010010" when "0110",
"1001111" when "0111",
"0111000" when "1000",
"1111111" when others;
a <= output(6);
b <= output(5);
c <= output(4);
d <= output(3);
e <= output(2);
f <= output(1);
g <= output(0);
end if;
end process;
end carpark;