Professional Documents
Culture Documents
Sem II AY 2023-24
Experiment No. : 04
Objective
Simulate and implement a BCD Adder/Subtractor circuit.
Theory
The BCD Adder/Subtractor circuit consists of 4 full adder and 2 four digit binary inputs and a input for
controlling the addition or subtraction in the circuit. When the control input is 1, the module performs
subtraction and when the control input’s value is 0 the module performs between the two number.
Logic Design
The selection of addition/subtraction operation is done by another input. The sign (in case of
subtraction) and carry (in case of addition) is shown on an LED, while the BCD difference or sum is
shown on a 7-segment display.
The Module checks if the inputs are valid, valid in the sense A and B are less than or equal to 9, else it
none of the led glows.
Source Description
The different sources in this experiment are firstly the source file, two constraint files one for PYNQ
board and one for the RPI addon module and one testbench file. The inputs for this experiment are just
two 4 digit binary numbers A[3:0] and B[3:0] and a control input M for controlling subtraction or
addition.
- Design source
The source file is a add_sub.v module that generates two output seg_out and c_out_sign from inputs
A[3:0] and B[3:0] and M.
- Constraint file
The PYNQ XDC file was updated with the following changes:
The RPI XDC file was updated with the following changes:
- Simulation source
The simulation file includes a testbench.v file which generates the waveform for each of the variables
with different inputs.
Simulation Results
Elaborated Design
List of Attachments
https://drive.google.com/file/d/1LZAU2WppH3YO7bor_hbbnhcs8NeHuxmj/view?usp=classroom_web
&authuser=0