Professional Documents
Culture Documents
begin
entity nightlamp is
state_rem:
port ( malam : IN std_logic;
state <= srem when brake = '1' else srem_idle;
LED1, LED2, LED3, LED4,
lampu : LED5, LED6, LED7, LED8 : OUT std_logic);
LED4 <= '1'; state <= smalam when malam = '1' else smalam_idle;
end process;
a. Satu kondisi aktif
end cond;
LIBRARY ieee;
lampu : state_kiri_rem:
end case;
Halaman
case state is
LED3 <= '1';
Halaman
LIBRARY ieee;
component darurat is
USE ieee.std_logic_1164.all;
port ( darurat, clock : IN std_logic;
entity rearlights is
LED1, LED2, LED3, LED4,
LED5, LED6, LED7, LED8 : OUT std_logic);
PORT( switch_darurat, switch_rem, switch_malam,
switch_kanan, switch_kiri, Clocks : IN STD_LOGIC;
end component;
CLK: IN std_logic;
end rearlights;
end component;
component brake is
end component;
Output1r, Output2r, Output3r, Output4r,
Output5r, Output6r, Output7r, Output8r,
6
component nightlamp is
Output1rr, Output2rr, Output3rr, Output4rr,
Halaman
state3: right port map (switch_kanan, clockin, Output1r, Output2r, out_5 <= Output5r;
Output3r, Output4r, Output5r, Output6r, Output7r, Output8r);
out_6 <= Output6r;
state5: left PORT map (switch_kiri, clockin, Output1l, Output2l, elsif (switch_kanan = '0' and switch_darurat = '0' and switch_rem =
Output3l, Output4l, Output5l, Output6l, Output7l, Output8l); '0' and (switch_malam = '1' or switch_kiri = '1')) then
state6: left_rem PORT map (switch_kiri, clockin, Output1lr, out_1 <= Output1l;
Output2lr, Output3lr, Output4lr, Output5lr, Output6lr, Output7lr,
Output8lr); out_2 <= Output2l;
state7: darurat PORT map (switch_darurat, clockin, Output1d, out_3 <= Output3l;
Output2d, Output3d, Output4d, Output5d, Output6d, Output7d,
Output8d); out_4 <= Output4l;
elsif ((switch_rem = '1' or switch_malam = '1') and switch_kanan = out_7 <= Output7rr;
'0' and switch_darurat = '0' and switch_kiri = '0') then
out_8 <= Output8rr;
out_1 <= Output1b or Output1n;
elsif (switch_kanan = '0' and switch_darurat = '0' and switch_rem =
out_2 <= Output2b or Output2n; '1' and switch_malam = '0' and switch_kiri = '1') then
7
Halaman
elsif ((switch_kanan = '1' or switch_malam = '1') and switch_darurat out_7 <= Output7lr;
= '0' and switch_rem = '0' and switch_kiri = '0') then
out_8 <= Output8lr; out_6 <= '0';
elsif (switch_kanan = '1' and switch_darurat = '0' and switch_rem = out_7 <= '0';
'1' and switch_malam = '1' and switch_kiri = '0') then
out_8 <= '0';
out_1 <= Output1rr;
end if;
out_2 <= Output2rr;
end process;
out_3 <= Output3rr;
end structural;
out_4 <= Output4rr;
else