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
Something explorers wanted to buy in the Indies
jekas [21]
Gold,spices,slaves hope i helped
3 0
2 years ago
If you are exposed to a bloodborne pathogen while at work, your employer must offer you post-exposure evaluation and follow-up.
aleksley [76]

<u>Answer:</u>

During the post-exposure follow up, the employer will verify whether the source patient is allowed by the law to be identified and documented and then do the needful.

<u>Explanation:</u>

  • Before offering the employee a post-exposure evaluation, the employer is expected to verify whether or not the exposure that has happened is covered by the law or not.
  • If the exposure is expected by the law to be identified and documented, the employer will immediately evaluate the symptoms and take the necessary steps to avoid any further complications.
6 0
3 years ago
Do you think that donald trump deserves to be on the throne once more
blagie [28]
Lol, we all know he’s gonna her elected again.
3 0
3 years ago
How does the popularity of the beatles compare with that of elvis? hHow did the marketing of these two rock icons compare? How d
Zepler [3.9K]

The popularity of the beatles compare with that of Elvis in the terms of ''fame'' Beatles was more famous than Elvis. The Beatles scored 4.423 vs. Elvis at 3.592. the marketing of these two rock icons cannot be compare, they both have same marketing value because they were both tailored to do a specific job.

The rock group had an impact on both popular culture and rock music. People have been motivated to explore their artistic creativity by their songs, albums, and cover art. They have an impact on society just by existing. By creating music that appealed to both age groups, The Beatles established a new trend and assisted in bridging the cultural divide between young people and adults.

to learn more Elvis and Beatles here

brainly.com/question/25773911

#SPJ4

7 0
1 year ago
What was prohibited by the 18th Amendment?
-BARSIC- [3]

Answer:

err

Explanation:

ff fd fd cjjjhss fsrt dsdygsx gdsryyf dsstg dssssss

7 0
3 years ago
Other questions:
  • Which of the following is a power that belongs ONLY to the House of Representatives?
    15·1 answer
  • 2 . desde los inicios de la humanidad del cambio ...
    7·1 answer
  • Marcus has Attention Deficit Disorder and is very easily distracted in the classroom. This is particularly problematic when he h
    5·2 answers
  • Jon recently stopped a conflict with his girlfriend, Ana, and said to her, "You don't know how to have a disagreement without lo
    6·1 answer
  • What were the two main causes of the War of 1812?
    7·2 answers
  • All power flows from the people
    5·1 answer
  • Using key words you found in the first task create your own definition of globalization
    13·1 answer
  • Which continent can be found at 40N and 0 longitude?
    6·2 answers
  • How does Carnival reflect Brazil’s African heritage?
    14·1 answer
  • What was the main focus of Chiang Kai-shek’s rule?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!