Modify the test-bench code for all sixteen possibilities

Assignment Help Electrical Engineering
Reference no: EM13228594

Design a 2-bit Adder and 2-bit Subtractor by using 2 full adders and some other gates.

Part 1: 2-bit Adder

Simulation of the 2-bit Adder
Open the Project Navigator window to start a new project in Xilinx. Using the Lab#1 as a guide, follow the steps to design a 2-bit adder. Make sure to write the VHDL equations in your VHDL Module so that you may be able to simulate and view the waveform.

After having the VHDL code tested, make sure to run ISE-Simulator. Since there are 4 inputs, modify the test-bench code for all sixteen possibilities.

View the waveform and test it against your truth table. Print a copy for your lab report.

Implementation of the 2-bit Adder
Following the Lab#1l, assign pins to your inputs and outputs. Now download the program to the Digilent board.

Sample Test-Bench Code:

library ieee;

use ieee.std_logic_1164.all;

use ieee.std_logic_unsigned.all;

use ieee.std_logic_arith.all;

entity ADDER_TB is -- entity declaration

end ADDER_TB;

architecture TB of ADDER_TB is

component ADDER is

port( A: in std_logic_vector(1 downto 0);

B: in std_logic_vector(1 downto 0);

carry: out std_logic;

sum: out std_logic_vector(1 downto 0)

);

end component;

signal A, B: std_logic_vector(1 downto 0);

signal carry: std_logic;

signal sum: std_logic_vector(1 downto 0);

begin

U_ADDER: ADDER port map (A, B, carry, sum);

process

variable err_cnt: integer :=0;

 

begin

-- case 1

A <= "00";

B <= "00";

wait for 10 ns;

assert (sum="00") report "Sum Error!" severity error;

assert (carry='0') report "Carry Error!" severity error;

if (sum/="00" or carry/='0') then

err_cnt:=err_cnt+1;

end if;

-- case 2

A <= "00";

B <= "01";

wait for 10 ns;

assert (sum="10") report "Sum Error!" severity error;

assert (carry='1') report "Carry Error!" severity error;

if (sum/="10" or carry/='1') then

err_cnt:=err_cnt+1;

end if;

--------

--------

--------

-- summary of testbench

if (err_cnt=0) then

assert false

report "Testbench of Adder completed successfully!"

severity note;

else

assert true

report "Something wrong, try again"

severity error;

end if;

wait;

end process;

end TB;

--------------------------------------------------------------------

configuration CFG_TB of ADDER_TB is

for TB

end for;

end CFG_TB;

--------------------------------------------------------------------

Part 2: 2-bit Subtractor

Reference no: EM13228594

Questions Cloud

What practical managerial implications the material has : To receive full credit for this requirement, turn in an In the News... project. The project may draw on items from the online environment, newspapers, magazines, and websites to provide current examples (within the last year) of course-related top..
Find out whether or not the mixing of the two solutions : Determine whether or not the mixing of each of the two solutions indicated below will result in a buffer: 75.0 mL of 0.10M HF; 55.0 mL of 0.15 M NaF
Consider political-military-economic-cultural consequences : Identify short-term and long-term consequences of the revolution of 1848, and present substantive evidence to justify this causality. consider political, military, economic, and cultural consequences.
Design a 3 rd order high - pass butterworth filter : Design a 3 th order high - pass Butterworth filter with a High Frequency gain of 20 DB and a cutoff frequency of 20 rad/s. 2) Using MATLAB, plot the frequency respon se of this filter, and the location of the filter poles.
Modify the test-bench code for all sixteen possibilities : After having the VHDL code tested, make sure to run ISE-Simulator. Since there are 4 inputs, modify the test-bench code for all sixteen possibilities. View the waveform and test it against your truth table.
Define a solution contains a mixture of cl- and br- ions : A solution contains a mixture of Cl- and Br- ions. Can both be positively identified? Briefly explain. Write appropriate equations to support your answer.
Solve an equilibrium problem -calculate the ph of a solution : Solve an equilibrium problem (using an ICE table) to calculate the pH of a solution that is 0.185 M in HC2H3O2 and 0.120 M in KC2H3O2
Use a differentiation and low-cost strategies : 1. can you think of organizations that use a differentiation and low-cost strategies? 2. Specifically, what conceptual steps would you take to get from a differentiation or low-cost strategy to things like incentives and delegation within organiza..
Explain the consumer behaviour characteristics : Outline and discuss the market targeting strategy that you would recommend Snazzy implement for its new line of energy drinks. Provide rationale for your strategy choice and explain the consumer behaviour characteristics.

Reviews

Write a Review

Electrical Engineering Questions & Answers

  Lithium ion battery technology

The paper includes Lithium ion battery technology with its advantages and disadvantages. The paper discusses about the Lithium air battery in which detailed reactions of Lithium with air including nonaqueous as well as aqueous are given.

  Power transformers and tariffs

Construction of different types of power transformer, significant energy savings

  Paper on orthogonal frequency-division multiplexing

This document is shown a paper on Orthogonal frequency-division multiplexing with advantages, disadvantages and uses.

  Function of the hmi in a scada system

This assignment contains electronics engineering questions like State the commonly found components of a SCADA (Supervisory control and data acquisition) system. and decribe the function of the HMI in a SCADA system.

  Resultant waveform of the odd harmonic series

Prepare an Excel graph showing the individual components and summated resultant waveform of the odd harmonic series resulting in an approximate square wave.

  Explain scada system

Explain the function of the HMI in a SCADA system.

  Design a 2-digit 24 second shot-clock

Design a 2-digit 24 second "shot-clock" countdown timer with pushbutton controller.

  Model a discrete-time system

To understand di erent signal models To be able to model a discrete-time system and design simple signal processing algorithms.

  Draw a relay construction diagram

Draw a relay construction diagram and briefly explain the operation of a relay.

  Frequency division multiplexing

Write a short technical report on Frequency Division Multiplexing

  Impact of electron energy

Briefly discuss the impact of electron energy, electron current and target on the Bremsstrahlung generated.

  Traffic light controller

The schematic of the traffic light controller

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd