Jorge Jesse Cantu
Junior Member level 1
- Joined
- Mar 3, 2014
- Messages
- 16
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 167
I am trying to design an 8-bit self correcting ring counter whose states are 11111110, 11111101,.......,01111111. This includes reset and enable inputs, where the counter goes to the initial state when reset is asserted and counts only if enable input is asserted.
Now I think my code is correct except I am not sure if it's self correcting or not? To make it self correcting what could I implement?
Here is my VHDL code:
Now I think my code is correct except I am not sure if it's self correcting or not? To make it self correcting what could I implement?
Here is my VHDL code:
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 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 qs: std_logic_vector(7 downto 0); begin process(CLK, RST, EN) begin if(RST = '1') then QS <= "11111110"; --initial state for QS elsif (CLK'EVENT AND CLK = '1' and EN = '1') then --enable starts the shifting 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; Q <= QS; end process; end behavior;