WTA VHDL shift left and shift right code different

Status
Not open for further replies.

alpha91

Full Member level 3
Joined
Sep 23, 2011
Messages
168
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,298
Activity points
2,625
Hi, i have learned the shift register code in VHDL as the following:


Code VHDL - [expand]
1
2
3
4
if (reset = '1') then
shift <= '0000" ;
else if (clock' event and (clock= '1')) then
shift <= shift (2 downto 0) & si;



can anyone tell me this is shift left or shift right? because now i need VHDL for both shift left and shift right.
 
Last edited by a moderator:

Hi
shift <= shift (2 downto 0) & si;
This is shift left. Algorithm = remove left most element and add new element on right.
 

    V

    Points: 2
    Helpful Answer Positive Rating
This is shift left. Algorithm = remove left most element and add new element on right.

thanks for reply. what i need to do if i want to shift right?
 

Remove right most element and add new element on left ?

shift <= si& shift (3 downto 1);
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…