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
Which resources do many ctsos provide to their members check all that apply​
Delvig [45]

Answer:

B. publications

D. networks of career professionals

F. career preparation activities

Explanation:

5 0
4 years ago
Some observers believe it is realistic to think of the u.s. justice system as representative of:
Rom4ik [11]
Crime control through due process, I believe.
3 0
4 years ago
Living in a way that allows people to meet present needs, without compromising the ability of future generations to do the same,
Ivenika [448]

Living in a way that allows people to meet present needs, without compromising the ability of future generations to do the same, is known as sustainability.

<h3>What is sustainability ?</h3>

Sustainability is a social ideal that, in general, seeks for long-term human coexistence on Earth in safety. Since there is no universally accepted definition of sustainability, there are many different ones in the literature and over time. Meeting our needs today without sacrificing the potential of future generations to do the same is what is meant by sustainability. Along with natural resources, we also require economic and social resources. Sustainability goes beyond environmental concerns.

<h3>What makes a lifestyle sustainable?</h3>

Living sustainably is a practical attitude that attempts to lessen societal and individual environmental impact by implementing actions to combat climate change and other serious environmental issues. Living sustainably is, to put it another way, a way of lessening one's "carbon footprint".

To know more about carbon footprint visit :

brainly.com/question/1270740

#SPJ4

6 0
2 years ago
Zulu’s Bar and Grill wants to include live music to its list of events. To do so its owner has to go before the Zoning Board to
Zanzabum

Answer:

noise

i just took the test

7 0
3 years ago
Judy feels that she needs her can of diet coke every morning to wake her up and satisfy her cravings. She doubts that she could
oee [108]

She doubts that she could ever give up drinking Diet Coke. Judy is demonstrating  <u>"psychological dependence. "</u>


The term psychology is for the most part intended to allude to behavioral procedures that identify with the feelings or the psyche. The term psychological dependence is for the most part intended to depict the enthusiastic and mental procedures that are related with the improvement of, and recuperation from, a substance utilize turmoil or process compulsion. Be that as it may, there can be no aggregate partition of feeling and discernment from physiology.  

Most people or references that allude to psychological dependence are referring to the subjective and passionate parts of addictive practices or the withdrawal procedure from medications or liquor rather than endeavoring to order certain substances or exercises as being mentally addictive or physically addictive.

4 0
3 years ago
Other questions:
  • Complementary opposition is typical of which kind of group? age-sets clans secret societies segmentary lineages
    8·1 answer
  • The area on the southern border of the U.S.- Mexico boundary has faced hardships in recent years due largely to
    14·2 answers
  • What was the purpose of cold war
    8·1 answer
  • In the commerce compromise, how did congress ease the concerns of an agricultural south and industrial north? Select all that ap
    5·2 answers
  • What are the circumstances you feel the US should send troops?
    8·1 answer
  • ( WORLD HISTORY )
    12·1 answer
  • You will write a short letter reaching out to a person with whom you have had a conflict that has NOT been resolved
    15·1 answer
  • What is the role of an entrepreneur?
    8·1 answer
  • (i rly need help!) Explain and analyze the impact the environment has had on the culture of at least one of about the first Amer
    8·2 answers
  • An arching firework effect is named after which type of tree?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!