0% found this document useful (0 votes)
9 views8 pages

VHDL 4-Bit Adder/Subtractor Lab Guide

This document outlines a lab tutorial for designing a 4-bit Adder/Subtractor Unit (ASU) and a Combinatorial Unit using VHDL in a digital systems course. It provides step-by-step instructions for creating the necessary files, compiling the code, and simulating the results to match a student's ID. The lab culminates in connecting the ASU and Combinatorial Unit in a block diagram and ensuring the final simulation aligns with the student's number.

Uploaded by

Mohammed Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views8 pages

VHDL 4-Bit Adder/Subtractor Lab Guide

This document outlines a lab tutorial for designing a 4-bit Adder/Subtractor Unit (ASU) and a Combinatorial Unit using VHDL in a digital systems course. It provides step-by-step instructions for creating the necessary files, compiling the code, and simulating the results to match a student's ID. The lab culminates in connecting the ASU and Combinatorial Unit in a block diagram and ensuring the final simulation aligns with the student's number.

Uploaded by

Mohammed Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

LAB 4 TUTORIAL
ADDER AND SUBTRACTOR UNIT

OVERVIEW

In this lab we will:


1. Use VHDL code to design a 4-bit Adder/Subtractor Unit (ASU) that multiplexes add
and subtract operations with a common Cin input.
2. Design a combinatorial circuit that takes the decoded output of the ASU as input,
and consequently outputs individual digits of your student number.

1
MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

PROCEDURE

1. 4-bit (Adder/Subtractor Unit) ASU

Please follow the following instructions to implement the 4-bit ASU:


1. Create a new folder “Lab4” in your “BME328” folder.
2. Open the Quartus II software, and using the new project wizard, create a new project
“Lab4” in your “Lab4” folder.
MAKE SURE THAT YOU CHOOSE THE “EP2C35F672C6” DEVICE IN THE
PROJECT WIZARD.
3. Create a new VHDL file in your “Lab4” project (File > New > VHDL File).
4. Type the following in the Text Editor and save file as “[Link]”:

2
MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

5. Set “[Link]” as the top-level entity. You can do this by right-clicking on “[Link]”
in the “Files” section of the project navigator (located at the right of your Quartus II
window) and selecting “Set at Top-Level Entity”.
6. Start the compiler. Fix any errors and re-compile. Once the compiler compiles
without any errors, move to the next step.
7. Create a symbol for your “[Link]” file. You can do this by right clicking on
“[Link]” in the “Files” section of the project navigator (located at the right of your
Quartus II window) and selecting “Create Symbol Files for Current File”.
8. Create a new University Program VWF (File > New > University Program VWF).
9. Simulate “[Link]” and make sure that your simulation results match the results
shown below.
10. Save the VWF file as “[Link]” in your “Lab4” folder and take a screenshot of your
results.

3
MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

2. Combinatorial Unit C

In this part of the lab we are required to create a Combinatorial Unit that takes as input the
output S from the ASU and consequently outputs individual digits of your student number.
I will use my student number as an example: 500414487
S = 0 corresponds to the first digit, in my case it is 5.
S= 1 corresponds to the second digit in my case it is 0.
And so on until we get to
S = 8 which corresponds to the 9th digit, in my case it is 7.
For all other values of S, we want to display 0.
Based on this please follow the following instructions to complete the lab:
1. fill out the truth table given the lab manual with your student ID. Below is an example
using my using.

ASU Sum Student ID Student ID


Output
(4-bit Binary) (4-bit Binary) (Decimal)
S3 S2 S1 S0 L3 L2 L1 L0
0 0 0 0 0 1 0 1 5
0 0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0 0
0 0 1 1 0 1 0 0 4
0 1 0 0 0 0 0 1 1
0 1 0 1 0 1 0 0 4
0 1 1 0 0 1 0 0 4
0 1 1 1 1 0 0 0 8
1 0 0 0 0 1 1 1 7
1 0 0 1 0 0 0 0 0
1 0 1 0 0 0 0 0 0
1 0 1 1 0 0 0 0 0
1 1 0 0 0 0 0 0 0
1 1 0 1 0 0 0 0 0
1 1 1 0 0 0 0 0 0
1 1 1 1 0 0 0 0 0

4
MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

2. Minimize the outputs L3, L2, L1, L0 in your truth table using K-maps. Below is an
example using my student ID.

5
MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

3. Use the VHDL code below to implement your Combinatorial Unit C. Remember to
replace the L(3), L(2), L(1), and L(0) output assignment functions in the code with
your minimized functions.
4. Save the VHDL file as “[Link]”.

6
MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

6. Set “[Link]” as the top-level entity. You can do this by right-clicking on “[Link]” in the
“Files” section of the project navigator (located at the right of your Quartus II window)
and selecting “Set at Top-Level Entity”.
7. Start the compiler. Fix any errors and re-compile. Once the compiler compiles
without any errors, move to the next step.
8. Create a symbol for your “[Link]” file. You can do this by right clicking on “[Link]” in
the “Files” section of the project navigator (located at the right of your Quartus II
window) and selecting “Create Symbol Files for Current File”.
9. Create a new University Program VWF (File > New > University Program VWF).
10. Simulate “[Link]” and make sure that your simulation results match your student
number.
11. Save the VWF file as “[Link]” in your “Lab4” folder and take a screenshot of your
results.

7
MOUSA AL-QAWASMI

BME 328 – DIGITAL SYSTEMS (FALL 2020)

Finally, we need to connect the ASU and Combinatorial Unit C:


1. Create a new Block Diagram/Schematic File in your “Lab4” project (File > New >
Block Diagram/Schematic File.
2. Build the circuit shown below.
3. Save your file as “[Link]”

4. Set “[Link]” as the top-level entity. You can do this by right-clicking on


“[Link]” in the “Files” section of the project navigator (located at the
right of your Quartus II window) and selecting “Set at Top-Level Entity”.
5. Start the compiler. Fix any errors and re-compile. Once the compiler compiles
without any errors, move to the next step.
6. Create a new University Program VWF (File > New > University Program VWF).
7. Simulate “[Link]” and make sure that your simulation results match
your student number.
8. Save the VWF file as “[Link]” in your “Lab4” folder and take a
screenshot of your results.

Common questions

Powered by AI

Integrating an Adder/Subtractor Unit with a Combinatorial Unit contributes significantly to the design and functionality of a digital system by allowing the development of multifunctional processing units. This integration enables arithmetic operations and logical decision making within the same system, allowing for operations like encoding results to a specific output format such as student numbers. This modular approach enhances system capabilities, robustness, and application versatility by combining simple operations to solve complex problems within a unified architecture .

Simulation match verification against actual student numbers ensures the functionality of the designed circuit by validating that the output logic is accurate and consistent with expected results. This process demonstrates that the circuit correctly interprets the binary encoded data to produce designated outputs, such as displaying components of a student number. It also provides a controlled method to detect and correct discrepancies between designed behavior and expected outcomes pre-deployment, mitigating costly errors in real-world applications .

Fixing compiler errors before progressing to the simulation phase is crucial because it ensures that the design is syntactically and semantically correct, which is foundational for reliable simulation results. Errors often signify issues that, if unresolved, could lead to incorrect simulations, misleading results, and extended debugging times. Moreover, correcting these errors beforehand prevents subsequent cascading faults, optimizes simulation efficiency, and aids in resource allocation during synthesis, reducing chances of hardware-level functional inaccuracies .

Setting the top-level entity in Quartus II projects specifies which file is the primary file for the project compilation process. This determines the entry point of the design that drives the synthesis and fitting tools to generate the necessary outputs for the intended FPGA device. It is crucial because it directs the compiler to focus its optimization and error-checking on the desired part of the design, ensuring that the correct configuration is simulated and that desired results are achieved .

Setting a VHDL file as the top-level entity is critical in projects with multiple design files as it designates which file serves as the primary module to be synthesized and implemented. This organizational hierarchy is necessary to manage complexity and dependencies between different VHDL modules. By delineating the top-level entity, designers ensure that the intended hierarchy is adhered to during compilation, and that the top-level signals and connections are properly mapped to the FPGA pins, thereby ensuring correct overall project behavior .

The University Program VWF (Vector Waveform File) plays a crucial role in the simulation of VHDL designs by providing a graphical interface to define input stimuli and observe output responses of digital circuits over time. It allows students and designers to create test benches that simulate different scenarios the design could encounter, verifying functionality against expected outputs. This step is vital for debugging and confirming the correctness of the design before actual hardware implementation .

Creating a symbol for a VHDL file is important in digital system design because it allows the designer to use the VHDL description in a graphical format within a block diagram or schematic file. This facilitates visual design processes, making it easier to integrate with other components, view signal flow, and modify connections. It helps in confirming the logic visually, supports simulation and debugging, and eases the interpretation of complex designs .

Creating a Block Diagram/Schematic File in a digital design environment like Quartus II presents challenges such as ensuring accurate representation of VHDL logic in graphical form, managing complex connections between components, and verifying that all signals are properly routed and connected. Designers must also ensure that the schematic reflects logical efficiency and optimize readability, which can become difficult with large designs. Furthermore, integrating various components seamlessly while preserving signal integrity and mitigating any potential for erroneous cross-connections are common obstacles .

The purpose of multiplexing add and subtract operations in a 4-bit Adder/Subtractor Unit (ASU) with a common Cin input is to efficiently use a single circuit to perform both arithmetic operations, thus saving space and resources in digital design. By using a common carry-in (Cin) input, the designer can switch between addition and subtraction functions without the need for separate circuits for each operation, simplifying the design process and improving overall circuit efficiency .

Minimizing outputs with Karnaugh maps (K-maps) is significant in digital circuit design due to its ability to simplify Boolean expressions efficiently. K-maps provide a method to reduce the complexity of logic circuits by grouping expressions that can be combined further, resulting in fewer gates and reduced power consumption. This leads to optimized performance and lower material costs in integrated circuit manufacturing. Furthermore, it enhances the reliability and speed of the circuit by reducing propagation delays and potential points of failure caused by unnecessary circuit components .

You might also like