Write a program that will control a pair of LEDs labeled LEF

Write a program that will control a pair of LEDs labeled LEFT and RIGHT connected to two output pins in PORTA. Using the keyboard you should be able to independently control the LEDs. For example, you may have to implement the following

Solution

LIBRARY ieee; USE ieee.std_logic_1164.ALL; -- Uncomment the following library declaration if using -- arithmetic functions with Signed or Unsigned values --USE ieee.numeric_std.ALL; ENTITY ifstmt_tb IS END ifstmt_tb; ARCHITECTURE behavior OF ifstmt_tb IS -- Component Declaration for the Unit Under Test (UUT) COMPONENT ram_ctrl_test PORT( clk : IN std_logic; reset : IN std_logic; sw : IN std_logic_vector(7 downto 0); btn : IN std_logic_vector(2 downto 0); led : OUT std_logic_vector(7 downto 0) ); END COMPONENT; --Inputs signal clk : std_logic := \'0\'; signal reset : std_logic := \'0\'; signal sw : std_logic_vector(7 downto 0) := (others => \'0\'); signal btn : std_logic_vector(2 downto 0) := (others => \'0\'); --Outputs signal led : std_logic_vector(7 downto 0); -- Clock period definitions constant clk_period : time := 10 ns; BEGIN -- Instantiate the Unit Under Test (UUT) uut: ram_ctrl_test PORT MAP ( clk => clk, reset => reset, sw => sw, btn => btn, led => led ); -- Clock process definitions clk_process :process begin clk <= \'0\'; wait for clk_period/2; clk <= \'1\'; wait for clk_period/2; end process; -- Stimulus process stim_proc: process begin -- hold reset state for 100 ns. reset <= \'1\'; sw <= \"11001100\"; btn<= (others => \'0\'); wait for 100 ns; reset <= \'0\'; wait for clk_period*10; -- load register btn<= (0=>\'1\', others => \'0\'); wait for clk_period*2; btn<= (others => \'0\'); wait for clk_period*10; -- display with btn 1 btn<= (1=>\'1\', others => \'0\'); wait for clk_period*5; btn<= (others => \'0\'); wait for clk_period*10; -- display with btn 2 btn<= (2=>\'1\', others => \'0\'); wait for clk_period*5; btn<= (others => \'0\'); wait for clk_period*10; -- change pattern sw <= \"11100111\"; wait for clk_period; -- load register btn<= (0=>\'1\', others => \'0\'); wait for clk_period*2; btn<= (others => \'0\'); wait for clk_period*10; -- display with btn 2 btn<= (2=>\'1\', others => \'0\'); wait for clk_period*5; btn<= (others => \'0\'); wait for clk_period*10; -- display with btn 1 btn<= (1=>\'1\', others => \'0\'); wait for clk_period*5; btn<= (others => \'0\'); -- insert stimulus here wait; end process; END;
 Write a program that will control a pair of LEDs labeled LEFT and RIGHT connected to two output pins in PORTA. Using the keyboard you should be able to indepen

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site