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 national organization for women (now) is primarily a
Nata [24]

<u><em>The National Organization for Women (NOW)</em></u> was established by a group of feminists who were dedicated to actively challenging sex discrimination in society. Since its founding in 1966, NOW's goal has been "<em><u>to take action</u></em>" to bring about equality for all women. <u><em>NOW’s original mission statement read</em></u> “<u>The purpose of NOW is to take action to bring women into full participation in the mainstream of American society now, exercising all privileges and responsibilities thereof in truly equal partnership with men…</u>”

<u><em>The correct answer is C:</em></u> <u>Political advocacy group.</u>

8 0
3 years ago
Read 2 more answers
In general, countries with high real GDP per capita also received "very high human development" or "high development" rankings f
MrRissso [65]

The GDP is representing the total production in a year in a particular country of all final goods and services. The GDP per capita on the other side represents the amount of money that the citizens have on average, thus their financial strength. When compared, these two can show totally different pictures, or they may show very similar ones. Some nations do have high GDP and also high GDP per capita, while some have very high GDP , but the GP per capita is average or even low. We can take the UK and India as examples. They have relatively similar GDP's, but when the GDP'c per capita are compared then the UK is light years ahead. One of the biggest reasons for this is the population, as both countries have similar GDP, but the UK has around 20 times smaller population than India, so when the money are redistributed on the amount of population the differences are enormous.

6 0
3 years ago
Help if you want Brainliest
SSSSS [86.1K]

i think the answer is D

.

and tnx for points

7 0
3 years ago
Read 2 more answers
How does economics help us understand human behavior?
Illusion [34]
Money is the root for evil
4 0
3 years ago
Gandaki province has great prospect of tourism .Justify the statement.<br>​
Nitella [24]

Answer:

gandagi provience is one of the beautiful provience of Nepal. it is very famous for tourism. every year thousands of tourists visit many place of this provience. the major mountains such as Annapurna 1, Dhaulagiri,Mansalu, etc has attracted many toirists in this provience . likewise, the dry valley manang and mustang lies in this provience. so, there are sufficient attractions for mountaineering, trekking, rafting,paragliding etc centres. so, it has great prospect of tourism and tourism industry.

hope its helpfull...

3 0
3 years ago
Other questions:
  • How did Henry W. Grady use his position to promote a New South in Georgia?
    7·1 answer
  • How did the concept of mutually assured destruction influence the Cold War?
    11·1 answer
  • Why did the united states decide to build a canal through panama
    9·1 answer
  • It has been two weeks since Brianna’s husband left her for someone else. She knows that this divorce will be a life-changing eve
    15·2 answers
  • What is upward and downward social mobility of children to their parents called?
    5·1 answer
  • Slaves were used in the American colonies mainly because
    6·1 answer
  • Based on what you have read, explain how Dr. King used a rhetorical appeal
    8·1 answer
  • How did the internal divisions within the Indian subcontinent (in India) affect relations and future events?
    15·1 answer
  • Prisoners give up all constitutional rights when they are prosecuted and sentenced.
    14·1 answer
  • On a macintosh, in the __________ folder, you will find a subfolder named app profile. this contains lists of recently opened ap
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!