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
There were no pumpkins in Europe when Jack O Lanterns were first carved. What did they use instead?
lina2011 [118]
Mangelwurzel, Beets and most commonly Turnips were used.
6 0
3 years ago
Read 2 more answers
International Governmental Organizations are often called _________.
Katen [24]

Answer:

IGOs

Explanation:

6 0
3 years ago
Read 2 more answers
What advantage did India have won making the constitution
tensa zangetsu [6.8K]

Answer:

- Freedom from the influence of the Great Britain

They no longer had to put up with the pressure of having to elect officials that is wanted by the Great Britain. They can elect someone who can genuinely care for the country's development.

- Ability to forms their own laws that are suitable to their own culture

some of the laws that made during the colonization designed to conformed to western principles  / philosophy. Making own their constitution means that India no longer have to do this.

- Ability to form an alliance outside of Great Britain's social circle.

Such as Russia and China for example. They won't be able to form an alliance with them if they are still under the British influence.

- Create the economy that benefit Indian people

Under British's rule, the trades laws that passed will most likely benefit the Great Britain rather than the Indian people. They will decide which products gets the subsidy and how much the products they can export. But this commodities might not be popular In Indian market.

3 0
3 years ago
What happens when a petition gets enough signatures
gavmur [86]

Answer:

Explanation:

Typically, after there are enough signatories, the resulting letter may be delivered to the subject of the petition, usually via e-mail. The online petition may also deliver an email to the target of the petition each time the petition is signed.

5 0
3 years ago
HELP PLEASEE
Anettt [7]

Answer:

they were asked to do all of those things except fight in the war.

Explanation:

Many women dressed up as men to fight, but they were never ASKED to fight in the war.

Hope This Helps!!

6 0
2 years ago
Other questions:
  • In research on aging (both cellular aging and organismal aging), it has been found that aged cells do not progress through the c
    11·1 answer
  • According to this passage from the Declaration of Independence, where does political power come from? We hold these truths to be
    12·1 answer
  • Explain why Traditional economic systems are rarely found being used in our modern<br> society?
    10·1 answer
  • Which statement best describes a difference between authoritarian government and constitutional government?
    11·2 answers
  • Suppose that Mischa has found that when she sits in the first row of discussion classes she gets a better participation grade, r
    10·1 answer
  • In Central America on the same latitude as Africa Australia or south america
    8·1 answer
  • Aptitude tests are specifically designed to
    9·1 answer
  • Which statement best completes the diagram?
    8·2 answers
  • Wanda had been procrastinating on taking her continuing education courses. As the end of the year approached, she saw a course s
    12·1 answer
  • What type of acts can change the juvenile justice process?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!