Docsity

Assignment 1 - 180108002, Thesis of Archeology

Toggle sidebar
bg1
Assignment 1
Digital Circuits EE 210
Last date for submission is 3-09-2019.
Upload a zipped folder on Moodle consisting your code and a document consisting of screenshot of the
output waveform and answer to the questions asked.
The code should have comments for each line. Uncommented codes will not be evaluated
Q1) Write a Verilog code for a 4 ˟ 1 Mux
a) Using structural description
b) Using conditional statements
Q2) Write a behavioural Verilog code for parity generation.
Q3) Implement an arithmetic logic unit (ALU) using Verilog. Consider signed number arithmetic
operation. The outputs of the ALU should be
1) Addition of two 8-bit numbers
2) A Zero Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is zero.
3) A Negative Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is less than 0.
4) An Overflow Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is more than
the bit length of the output.
5) A carry flag. It is set (it is 1 if the condition is met and 0 otherwise) when the carry is generated.
If the number is unsigned, will there be a need of both carry and overflow flag?
To get a clear idea of when carry and an overflow is generated solve the following cases for an 8 bit
signed number. Determine if there is a carry output or/and will it overflow.
100+49.
-2-1
51+28
126-64

Partial preview of the text

Download Assignment 1 - 180108002 and more Thesis Archeology in PDF only on Docsity!

Assignment 1 Digital Circuits EE 210 Last date for submission is 3- 09 - 2019. Upload a zipped folder on Moodle consisting your code and a document consisting of screenshot of the output waveform and answer to the questions asked. The code should have comments for each line. Uncommented codes will not be evaluated Q1) Write a Verilog code for a 4 ˟ 1 Mux a) Using structural description b) Using conditional statements Q2) Write a behavioural Verilog code for parity generation. Q3) Implement an arithmetic logic unit (ALU) using Verilog. Consider signed number arithmetic operation. The outputs of the ALU should be

  1. Addition of two 8 - bit numbers 2 ) A Zero Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is zero. 3 ) A Negative Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is less than 0. 4 ) An Overflow Flag. It is set (it is 1 if the condition is met and 0 otherwise) if the result is more than the bit length of the output. 5 ) A carry flag. It is set (it is 1 if the condition is met and 0 otherwise) when the carry is generated. If the number is unsigned , will there be a need of both carry and overflow flag? To get a clear idea of when carry and an overflow is generated solve the following cases for an 8 bit signed number. Determine if there is a carry output or/and will it overflow.  100+49.  - 2 - 1  51+  126 - 64