--- Quote Start ---
i have made a start to it but i dnt know if i am on the right track.
here is the code so far
entity universal_shift_register is
Port ( SIR, SIL, CLK, RST, : in STD_LOGIC;
D : in STD_LOGIC_VECTOR (3 downto 0);
Q : out STD_LOGIC_VECTOR (3 downto 0));
end universal_shift_register;
--- Quote End ---
You're missing S1 and S0 inputs...add them
--- Quote Start ---
architecture Behavioral of universal_shift_register is
begin
process (CLK)
Variable: REG: std_logic_vector (3 downto 0);
if clk'event and clk= '1' then
if
end Behavioral;
give me feedback please. i also have (s0 s1) as inputs but i am not sure if i am supposed to incule them and how
--- Quote End ---
- S1 and S0 are listed in the definition so why wouldn't you need them?
- The process will also need to have RST in the sensitivity list since the description says that RST is an
asynchronous reset input. If RST had been a synchronous reset, then RST would not be in the sensitivity list. Besides the sensitivity list, then you'll need to add code to support RST (as well as the other inputs) like this...
signal REG: std_logic_vector (3 downto 0);
...
process (CLK)
if rising_edge(clk) then
.. Here you add your code for computing REG as a
.. function of SIR, SIL, S1, S0
end if;
if (RST = '1') then
.. Here you define what REG should be set to when it is reset
end if ;
end process;
Q <= REG; -- Set the output of the entity
Note: With REG as a variable, you wouldn't be able to set the Q output outside of the process. If you tried to set 'Q <= REG' inside the process, then there would be an extra clock cycle delay that would probably not be desired.
Kevin Jennings