In: Electrical Engineering
1) For x ¼ "110010", of type BIT_VECTOR(5 DOWNTO 0), determine
the values of the
shift operations listed in the column on the left below.
2) In the column on the right, write an equivalent expression using
the concatenation
operator (the first one was already done).
a) x SLL 3
b) x SLA -2
c) x SRA 2
d) x ROL 1
e) x ROR -3
a) x(2 DOWNTO 0) & "000"
b)
c)
d)
e)
The question is about shift operations in VHDL. In VHDL the shift registers are defined only for one-dimensional arrays of bit or boolean. There are a total of 6 shift operators in VHDL. Among them, in this question, we have to deal with 5 of the VHDL shift operators.
SLL= Shift Left Logical
SLA= Shift Left Arithmetic
SRA= Shift Right Arithmetic
ROL= Rotate Left Logical
ROR= Rotate Right Logical
(a) x SLL 3 = 3 LSB bits (010) + 000 = x(2 DOWNTO 0) & '000'
(b) x SLA -2 = x SRA 2 = vector x is shifted to the rigth by 2 bits and the MSB bit is replicated twice
= 11 & 1100 = "11" & x( 5 DOWNTO 2)
(c) x SRA 2 = vector x is shifted to the rigth by 2 bits and the MSB bit is replicated twice
= 11 & 1100 = "11" & x( 5 DOWNTO 2)
(d) x ROL 1 = vector x is rotated to the left by 1 bit = 011001 = x(0) & x(5 DOWNTO 1)
(e) x ROR -3 = x ROL 3 = vector x is rotated to the left by 3 bits
= 010110 = x(0 TO 2) & x(5 DOWNTO 3)