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
Why does a delta often from where a river meets the ocean?
alexdok [17]

The answer to your question is,

because the water slows down, the sediment drops to the bottom

-Mabel <3

5 0
3 years ago
In a cross-sectional design, researchers study __________. the same group of participants repeatedly at different ages groups of
My name is Ann [436]

Answer:

groups of participants differing in age at the same point in time                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

Explanation:

Cross-sectional design: This is a type of observational study design. In this study, the investigator calculate the exposures and the outcome in study participants at the same time.

The research involves different groups of people who have different variables of interest but consists of other characteristics, for example, educational background, socioeconomic status, and ethnicity.

4 0
3 years ago
When actors have little or no emotional bond with a character, they replace the characters emotions with unrelated but personal
zzz [600]

The technique being used by actors of in a way of having to replace their emotions that are unrelated and with their own personal emotions is a term called substitution. This is a process or an action of having to replace something or having to exchange a particular thing in which their emotions are being replaced.

5 0
3 years ago
By the end of Greece’s Dark Ages, most city-states were ruled by which?
LekaFEV [45]
The Greek Dark Age<span>, also called </span>Greek Dark Ages, Homeric Age or Geometric period is the period ofGreek<span> history from the </span>end<span> of the Mycenaean palatial civilization around 1100 BC to the first signs of the</span>Greek<span> poleis, </span>city states<span>, in the 9th century BC.</span>
3 0
3 years ago
Read 2 more answers
Juliet is embarrassed that romeo has overheard how she feels about him, but she decides to ignore convention. although deeply, i
muminat
Juliet inquires as to whether he truly loves her, having come to acknowledge that Romeo may effortlessly deceive her with a specific end goal to exploit her. Juliet is worried that Romeo may figure she can easily be taken in light of the fact that she isn't distant.
4 0
3 years ago
Other questions:
  • Why did William Penn advertise his new colony of Pennsylvania in Europe?
    7·1 answer
  • Godden and Baddeley conducted a memory experiment using two groups of scuba divers. One group listened to a list of words while
    15·1 answer
  • How did the Industrial Revolution affect the North?​<br>How did it affect the South?
    14·1 answer
  • Stating the research hypothesis based on theory, identifying the design for conducting the research, selecting an appropriate da
    13·1 answer
  • Which organization in the United States studies and assesses the environment to protect it and the people affected by any negati
    13·2 answers
  • Shipley developed a NEW test to measure IQ. Using his test, someone with an IQ of 180 would be considered twice as intelligent a
    8·1 answer
  • Gabriella is worried about an upcoming exam and is unlikely to remember much of what the speaker says. She is experiencing a typ
    8·1 answer
  • Cooking with Aunt Ethel what is your thoughts
    10·1 answer
  • Please help with this it's science, please:? I will be giving out the crowns
    7·1 answer
  • Smoking, overeating, high blood pressure, and ________ strongly predict heart disease.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!