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
During the cold war, nations that adopted to the policy of a nonalignment believed they should?
miv72 [106K]
- - 
4. follow a course independent of the superpower
<span>
- - This is because During the cold war, nations that adopted to the policy of a nonalignment believed they should 
</span><span> follow a course independent of the superpower.</span>
3 0
3 years ago
What is social environment ​
luda_lava [24]

Answer:

The social environment, social context, social cultural context or milieu refers to the immediate physical and social setting in which people live or in which something happens or develops. It includes the culture that the individual was educated or lives in, and the people and institutions with whom they interact.The interaction may be in person or through communication media, even anonymous or one-way, and may not imply equality of social status

Explanation:

4 0
3 years ago
Which department protects America’s natural resources?
blondinia [14]
The u.s Department of the Interior
5 0
3 years ago
Read 2 more answers
Shifts in eye contact, slight head movements, posture changes, and nodding to tell another person when to finish what he or she
Yanka [14]

Answer:

TRUE

Explanation:

Shifts in eye contact, slight head movements, posture changes, and nodding to tell another person when to finish what he or she is saying are all examples of nonverbal behaviors. Non verbal behaviors are means of communication/transmission of information  such as eye contact, facial expressions, gestures, posture, and the distance between two individuals and they are mostly effective when speaking is not very much neccessary or if the place is not conducive enough for a proper verbal discussion.

5 0
4 years ago
A constant danger to people living in hunting and gathering societies is
elena55 [62]

A constant danger to people living in hunting and gathering societies is <u>"the forces of nature, including storms and droughts."</u>


Hunting and gathering societies refers to the societies that depend essentially or only on chasing wild creatures, angling, and assembling wild natural products, berries, nuts, and vegetables to help their eating regimen. Until the point when people started to train plants and creatures around ten thousand years back, every single human culture were seeker gatherers. Today, just a small division of the world's populaces bolster themselves in this way, and they survive just in detached, cold regions, for example, deserts, the solidified tundra, and thick rain woodlands.

7 0
3 years ago
Other questions:
  • Can someone check this please?
    14·1 answer
  • PL1
    14·1 answer
  • A meritocracy is when social stratification is based on personal merit
    10·1 answer
  • What term defines the income paid to the owner of land, labor, or capital in return for productive service?
    8·1 answer
  • Which is not capital?
    13·1 answer
  • ​ Hilda, a 75-year-old woman, has problems thinking and has become increasingly forgetful over the past 6 months. Her doctor tel
    6·1 answer
  • A nurse is caring for a client who has been admitted with an ear infection. While discussing the partner with the nurse, the cli
    12·1 answer
  • 8 According to the census of the year 2068, there is the highest population in the Central Development Region and the least popu
    7·1 answer
  • Plz help me do you know anything about this
    13·1 answer
  • Write about the relationship between geographical diversity and lifestyle of people.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!