This set of Logic Design Multiple Choice Questions & Answers (MCQs) focuses on “VHDL Operators – Set 2”.
1. VHDL has 3 shift operators.
a) True
b) False
View Answer
Explanation: VHDL has 6 Shift operators:
sll – shift left logical, filled with ‘0’
srl – shift right logical, filled with ‘0’
sla – shift left arithmetic, filled with rightmost bit
sra – shift right arithmetic, filled with leftmost bit
rol – rotate left
ror – rotate right
Hence the answer is false.
2. VHDL Shift operators can be used only on bit_vector data types.
a) True
b) False
View Answer
Explanation: The shift operators are used to shift or rotate a bit_vector.
Hence the answer is True. The VHDL shift operators won’t work on other data types.
3. A is an 8-bit vector equal to “10010101”. Perform A sll 1.
a) 00101010
b) 10010100
c) 10010000
d) 00010000
View Answer
Explanation: The operator sll performs shift left logical operation, remaining bits are filled with ‘0’. A is shifted logically to the left by one bit, remaining bits are filled with zeros. Thus, on shifting A to the left by 1 bit, we get the result as 00101010.
4. A is an 8-bit vector equal to “10010101”. Perform A srl 1.
a) 01001010
b) 00100101
c) 10010000
d) 00010000
View Answer
Explanation: The operator srl performs shift right logical operation, remaining bits are filled with ‘0’. A is shifted logically to the right by one bit, remaining bits are filled with zeros. Thus, on shifting A to the right by 1 bit, we get the result as 01001010.
5. A is a 7-bit vector equal to “1001101”. Perform A sla 3.
a) 1101111
b) 1101000
c) 1100000
d) 1111111
View Answer
Explanation: The operator sla performs shift left arithmetic, remaining bits are filled with the rightmost bit. A is shifted arithmetically to the left by 3 bits, remaining bits are filled with the rightmost bit.
6. A is an 8 bit vector equal to “10010101”. Perform A sra 1.
a) 11001010
b) 00100101
c) 10010000
d) 00010000
View Answer
Explanation: The operator sra performs shift right arithmetic, remaining bits are filled with the leftmost bit. A is shifted arithmetically to the right by 1 bit, remaining bits are filled with the leftmost bit.
7. A is an 8 bit vector equal to “10010101”. Perform A rol 1.
a) 00101011
b) 00100101
c) 10010000
d) 00010000
View Answer
Explanation: The operator rol performs rotate left operation. A is rotated to the left by 1 bit. Thus, on rotating A to the left by 1 bit, we get the result as 00101011.
8. A is an 8 bit vector equal to “10010101”. Perform A ror 1.
a) 11001010
b) 00100101
c) 10010000
d) 00010000
View Answer
Explanation: The operator ror performs rotate right operation. A is rotated to the right by 1 bit. Thus, on rotating A to the right by 1 bit, we get the result as 11001010.
Sanfoundry Global Education & Learning Series – Logic Design.
To practice all areas of Logic Design, here is complete set of 1000+ Multiple Choice Questions and Answers.