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
The ice age provided access to americas through the
vova2212 [387]
The Bering Strait. It would be the small section of water that separates modern Alaska and Siberia
4 0
3 years ago
Read 2 more answers
“all men are created equal," suggesting that this was “self-
Temka [501]

Answer:

Explanation:

He meant that all men are the same created by god. It's pretty clear that god created all men to be created equal, so it's like common sense. Thomas Jefferson wrote this "self-evident" in hopes of abolishing slavery.

4 0
3 years ago
Who was William Jefferson Clinton​
Finger [1]

William "Bill" Jefferson Clinton is an American politician who served as the 42nd president of the United States.

smh some gay mod removed my answer

5 0
3 years ago
which of the following describes a major religious contribution of the muslim conquest of parts of india and Pakistan
Montano1993 [528]
The answer is letter D. <span>The development of Sikhism, which was influenced by both Hinduism and Islam.
</span>Options are:

A.      The end of religious tolerance which prevented non-Muslims from holding government office.

B.      The creation of the Indian caliphate which served as the foundation for the modern country of India.

C.      The establishment of Sharia Law, which banned all Indians from practicing Hinduism and Islam

<span>D. The development of Sikhism, which was influenced by both Hinduism and Islam 
</span>
5 0
3 years ago
The ________ is a personality assessment model that describes five basic dimensions encompassing most of the significant variati
Shkiper50 [21]

Answer:

The Big Five Model.

Explanation:

This model provides a structure for personality and it states that it can be divided into 5 independent states:

  • Extraversion: how an individual tends to act and relate during <em>interpersonal relations</em>, such as communicating with other individuals.
  • Agreeableness: a <em>friendly</em> and <em>optimistic</em> individual who tends to help others gets along well with everyone.
  • Conscientiousness: relating to the individual's <em>discipline. </em>
  • Emotional Stability: also known as <em>neuroticism</em>, it measures one's emotional adjustment against emotional instability, in order to understand the individual and know how he/she could react.
  • Openness to experience: it centers on measuring one's <em>tolerance </em>and <em>search of new experiences</em>, as well as trying to get out of a basic routine to try new things.
7 0
3 years ago
Other questions:
  • Describe the several roles that followers of islam will play in the emerging post-classical era.
    11·1 answer
  • This is the name of the non-profit special interest group who attempts to uphold the second amendment to the u.s. constitution.
    11·2 answers
  • In his speech on depression, dhavan said: "according to materials i located through a google search, almost 20 million american
    6·1 answer
  • Describe an unlimited government
    5·2 answers
  • Why do people often treat the idea of a nation and the idea of a culture as​ synonymous?
    5·1 answer
  • what global religion was created in response to aspects of hinduism? a. sikhism b. hinduism c. jainism d. buddhism
    6·1 answer
  • Which of the following was the biggest factor that led to the demise of the Spanish Armada?
    13·1 answer
  • Is it ethical to have the audience think the speech is about one thing when it is<br> about another?
    11·1 answer
  • Why did President Jackson attack the bank of the United States?
    5·2 answers
  • Many researchers have proven that _____________ (also referred to as ""faith-based approaches"". can be seen as a ""hook""—somet
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!