library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
use IEEE.std_logic_unsigned.all;
entity eightRC is
port(
CLK : in std_logic;
EN: in std_logic;
RST : in std_logic;
Q: out std_logic_vector(7 downto 0)
);
end eightRC;
architecture behavior of eightRC is
signal q_reg, q_next: std_logic_vector(7 downto 0);
signal e_in : std_logic;
begin
process(CLK, RST)
begin
if(RST = '1') then
QS <= "11111110"; --initial state for QS
elsif (CLK'EVENT AND CLK = '1') then
q_reg <= q_next;
--this is how I was originally doing it, thought I should include for you to see.
--QS(0) <= QS(7); --shift '0' to the left each clock edge, Q(0) gets Q(0) bit value
--QS(7 downto 1) <= QS(6 downto 0);
end if;
end process;
e_in <= '1' when q_reg(7 downto 1) = "11111111" else '0';
q_next <= e_in and q_reg(7 downto 1);
Q <= q_reg;
EN <= e_in;
end behavior;