When using a basys 3 FPGA board and using VHDL how would you
When using a basys 3 FPGA board, and using VHDL, how would you get LED 1 then LED 2 then LED 3 then LED 2 then LED 1 to light up after turning on Switch 1?
Solution
USE a shiftregister.
 LET you have 3 LEDs TO GLOW THEM ONE BY ONE then make a shiftregister of 3 bit.
 
 signal LEDreg : std_logic_vector(2 downto 0) := (others => \'0\');
 
 p_shiftreg : process (clk)
 begin
 if rising_edge(clk)then
    Ledreg(0) <= input;
    Ledreg(2 downto 1) <= Ledreg(1 downto 0);
 end if;
 end process p_shiftreg;
 
 the input is a std_logic, it can be practically anything depending on how and what ou want to implement.
 for example you could make a continuous binary counter and decode that input becomes one at one value. Then input will become 1 every X times and will shift trough the register.
 for example:
 signal count : std_logic_vector(2 downto 0) := (others => \'0\');
 
 process(clk)
 if rising_edge(clk)then
 count <= count + \'1\';
 end if;
 end process;
 
 input <= \'1\' when count = \"00000000\" else \'0\';
 
 The LEDs you connect to every flip flop in the register.

