Apr 1, 2014 #1 A 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: Apr 1, 2014
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.
Apr 1, 2014 #2 S SynthWorks Member level 2 Joined Jun 4, 2013 Messages 42 Helped 18 Reputation 36 Reaction score 21 Trophy points 1,288 Activity points 1,712 alpha91 said: Hi shift <= shift (2 downto 0) & si; Click to expand... This is shift left. Algorithm = remove left most element and add new element on right.
alpha91 said: Hi shift <= shift (2 downto 0) & si; Click to expand... This is shift left. Algorithm = remove left most element and add new element on right.
Apr 1, 2014 #3 A 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 SynthWorks said: This is shift left. Algorithm = remove left most element and add new element on right. Click to expand... thanks for reply. what i need to do if i want to shift right?
SynthWorks said: This is shift left. Algorithm = remove left most element and add new element on right. Click to expand... thanks for reply. what i need to do if i want to shift right?
Apr 1, 2014 #4 A axcdd Full Member level 3 Joined Jan 29, 2012 Messages 154 Helped 58 Reputation 116 Reaction score 57 Trophy points 1,308 Activity points 2,133 Remove right most element and add new element on left ? shift <= si& shift (3 downto 1);
Apr 1, 2014 #5 A 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 axcdd said: Remove right most element and add new element on left ? shift <= si& shift (3 downto 1); Click to expand... i think you are right...
axcdd said: Remove right most element and add new element on left ? shift <= si& shift (3 downto 1); Click to expand... i think you are right...