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
In order to calm herself during a very loud thunder storm, 2-year old tanya keeps repeating, "daddy says the angels are bowling.
slamgirl [31]
<span>This behavior best illustrates the concept of imprinting. This is a psychology concept that refers to learning that is sensitive to being acquired at a particular age or stage of life. This learning is fast and independent of the consequences that behavior can generate. <span>It is considered that the impression has a critical period to be acquired (that is, it can only be acquired between a particular stage).
</span></span>
I hope this information can help you.
<span><span /></span>
5 0
4 years ago
3. Identify the elements of Boccaccio's writing that demonstrate each feature of humanism: +
Nataly [62]

Answer:Growing Equality of Women

Scientific Interest in Nature

Use of the Vernacular:

3 0
3 years ago
In the context of Selye's general adaptation syndrome, if the body's all-out effort to combat stress fails and the stress persis
leonid [27]

Answer:

The answer is the exhaustion stage.

Explanation:

This is the final stage in the general adaptation syndrome. In this stage, the body has depleted all its energy. If the stressor has been removed, the body will proceed to heal itself as in the previous stage (resistance); however, if the stress continues for longer, the body will be unable to cope with it, and will show signs of exhaustion.  

3 0
3 years ago
the study of how people relate to one another and influence each others behavior is known as sociological imagination true or fa
mart [117]

Answer:

I think the answer is True.

Explanation:

The sociological imagination is the ability to see things socially and how they interact and influence each other. To have a sociological imagination, a person must be able to pull away from the situation and think from an alternative point of view.

3 0
4 years ago
What problems might there be with using Viking myths as historical sources?
ipn [44]
This is the same problem as using any myths as historical sources: they are not reliable. Myths are often created as a story, for the purpose of story-telling, or to make a point, and people would find it appropriate to change myths to be in accordance with the views of the time, making them a biased, and therefore not reliable, source.
4 0
3 years ago
Other questions:
  • Which event drew attention to the need to provide inmates with a better standard of care, including recreational activities?
    14·1 answer
  • Gloria is 40 years old and is employed as a(n) _____, where she provides hands-on care in a nursing home, helping elderly reside
    6·1 answer
  • Extra! Extra! Backyard Birding
    7·2 answers
  • The __________ perspective looks at the family as a whole; where change in one part sets in motion a process to restore equilibr
    6·1 answer
  • Race became a major factor in drawing congressional district lines as a result of
    11·1 answer
  • Why did Thomas Jefferson approve the Louisiana Purchase? A. He believed that the United States should settle lands from the Atla
    14·2 answers
  • Henry was in critical condition when he arrived at the er. his heart had stopped, but thanks to quick intervention he survived t
    10·1 answer
  • Plains,such as the Great Plains of NOrth America ,are large areas of flat level land.Plains have a Blank elevation and blank rel
    9·2 answers
  • PLEASE HELP! 40 points!
    10·1 answer
  • How many classification are made of biodiversity?​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!