1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
masha68 [24]
3 years ago
6

Develop a testbench for the Half Adder that verifies the structural model. The testbench will have no ports. Your testbench shou

ld exhaustively stimulate the circuit and print output demonstrating that the model is correct. Text output can be generated using the $monitor and $display tasks.
Social Studies
1 answer:
Fynjy0 [20]3 years ago
8 0

Answer and Explanation:

--        Here we define the AND gate that we need for

-- the Half Adder

library ieee;

use ieee.std_logic_1164.all;

entity andGate is        

  port( A, B : in std_logic;

           F : out std_logic);

end andGate;

architecture func of andGate is

begin

  F <= A and B;

end func;

--        Here we define the XOR gate that we need for

-- the Half Adder

library ieee;

use ieee.std_logic_1164.all;

entity xorGate is

  port( A, B : in std_logic;

           F : out std_logic);

end xorGate;

architecture func of xorGate is

begin

  F <= A xor B;

end func;

-- At this point we construct the half adder using

-- the AND and XOR gates

library ieee;

use ieee.std_logic_1164.all;

entity halfAdder is

  port( A, B : in std_logic;

   sum, Cout : out std_logic);

end halfAdder;

architecture halfAdder of halfAdder is

component andGate is -- import AND Gate

     port( A, B : in std_logic;

              F : out std_logic);

  end component;

component xorGate is -- import XOR Gate

    port( A, B : in std_logic;

             F : out std_logic);

  end component;

begin

G1 : xorGate port map(A, B, sum);

G2 : andGate port map(A, B, Cout);

end halfAdder;

---------------------------------------------------------END

---------------------------------------------------------END

Test Bench:

--import std_logic from the IEEE library

library ieee;

use ieee.std_logic_1164.all;

entity halfAdder_tb is

end halfAdder_tb;

architecture tb of halfAdder_tb is

component halfAdder is

    port( A, B : in std_logic;

      sum, Cout : out std_logic);

  end component;

signal A, B, sum, Cout: std_logic;

begin

  mapping: halfAdder port map(A, B, sum, Cout);

  process

  variable errCnt : integer := 0;

  begin

--TEST 1

  A <= '0';

    B <= '1';

    wait for 10 ns;

    assert(sum = '1') report "sum error 1" severity error;

    assert(Cout = '0') report "Cout error 1" severity error;

    if(sum /= '1' or Cout /= '0') then

       errCnt := errCnt + 1;

    end if;

--TEST 2

  A <= '1';

    B <= '1';

    wait for 10 ns;

    assert(sum = '0') report "sum error 2" severity error;

    assert(Cout = '1') report "Cout error 2" severity error;

    if(sum /= '0' or Cout /= '1') then

       errCnt := errCnt + 1;

    end if;

--TEST 3

  A <= '1';

    B <= '0';

    wait for 10 ns;

    assert(sum = '1') report "sum error 3" severity error;

    assert(Cout = '0') report "Cout error 3" severity error;

    if(sum /= '1' or Cout /= '0') then

        errCnt := errCnt + 1;

    end if;

---- SUMMARY ----

    if(errCnt = 0) then

      assert false report "Success!" severity note;

    else

       assert false report "Faillure!" severity note;

    end if;

end process;

end tb;

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

configuration cfg_tb of halfAdder_tb is

  for tb

  end for;

end cfg_tb;

----------------------------------------------------------END

----------------------------------------------------------END

You might be interested in
¿Qué estado fue admitido como estado libre con el compromiso de<br> 1850?*
goldenfox [79]

Answer:

Como parte del Compromiso de 1850, California fue admitida como estado libre (1850), sin ser un estado esclavista. Para evitar la creación de una mayoría de estados libres en el Senado, California acordó enviar un delegado a favor de la esclavitud y un senador antiesclavista al Congreso.

Explanation:

8 0
3 years ago
Donald was arrested for murdering an acquaintance. At the trial, Donald takes the stand and testifies that he and the victim kne
lbvjy [14]

After analyzing this scenario, we can come to the conclusion that the option the best defines the situation is:

a. A rational choice theorist


That means Donald was aware of the consequences of pulling the trigger, even if that was due to his own attemp to self defense. That choice was rational.

4 0
4 years ago
Martin receives an e-mail about a money-making opportunity from a sender who asks for his bank account
weeeeeb [17]

Answer: Contact the police and file a phishing report.

Explanation:

3 0
2 years ago
What time is it recommended to have two minutes of silence in honor of veterans?.
Galina-37 [17]

A two-minute silence is also observed on Remembrance Sunday, also at 11:00 am.

As part of Remembrance Day, a two-minute silence is observed in the United Kingdom and other Commonwealth nations to honor those who have died in battle. The quiet, which is mainly observed at war memorials and in public spaces throughout the UK and Commonwealth, is held every year at 11:00 am on November 11. This coincides with the hour in 1918 when hostilities were officially put an end to the First World War. On Remembrance Sunday at 11:00 am, there is also a two-minute silence.

The tradition of the Remembrance Day silence began in Cape Town, South Africa, where a two-minute period of silence, referred to as the Two Minute Silent Pause of Remembrance, was observed following the daily firing of the noonday gun on Signal Hill from May 14, 1918, to May 14, 1919.

To know more about Remembrance Sunday :
brainly.com/question/14970943

#SPJ4

4 0
1 year ago
When the state of Georgia changed the design of its flag in 1956, many people objected. What can you conclude was the MAIN reaso
kow [346]

Answer:

The answer is D

Explanation:

People did not want to be reminded of the civil war, a racist war in which many people died, so they saw it as an insult, an offense.

8 0
3 years ago
Read 2 more answers
Other questions:
  • The most correct term for the religious traditions practiced by the majority of persons living in India would be what?
    7·1 answer
  • Alfonso ran the 1,000-meter race in 2.5 minutes. Alfonso's average speed was what m/min.
    15·1 answer
  • What criteria must be met to ensure that someone is an eligible voter?
    8·2 answers
  • Limiting contact with foreigners was the main goal of chinese. True or False
    9·1 answer
  • When Muslims conquered lands, they allowed non-Muslims to build new places of worship. TRUE OR FALSE
    13·2 answers
  • When a macrophage encounters a free-floating pathogen, it phagocytizes it, breaks it down into pieces, then displays the pieces
    13·1 answer
  • Emily is a psychologist who believes that many psychological difficulties are a result of a conflict between the id, ego, and su
    6·1 answer
  • The cost of something is what a person
    10·2 answers
  • Why are human resource important​
    15·2 answers
  • Julia wants to apply decorative border around a cake. What measurement does Julia need to know about the cake before she starts?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!