Advertisement
coletucker12

fulladder4bittest

Sep 23rd, 2019
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.97 KB | None | 0 0
  1. --------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:   16:08:47 09/23/2019
  6. -- Design Name:  
  7. -- Module Name:   C:/Users/cgtucker/CompOrg/Lab2Attempt2/full_adder_4bit_test.vhd
  8. -- Project Name:  Lab2Attempt2
  9. -- Target Device:  
  10. -- Tool versions:  
  11. -- Description:  
  12. --
  13. -- VHDL Test Bench Created by ISE for module: full_adder_4bits
  14. --
  15. -- Dependencies:
  16. --
  17. -- Revision:
  18. -- Revision 0.01 - File Created
  19. -- Additional Comments:
  20. --
  21. -- Notes:
  22. -- This testbench has been automatically generated using types std_logic and
  23. -- std_logic_vector for the ports of the unit under test.  Xilinx recommends
  24. -- that these types always be used for the top-level I/O of a design in order
  25. -- to guarantee that the testbench will bind correctly to the post-implementation
  26. -- simulation model.
  27. --------------------------------------------------------------------------------
  28. LIBRARY ieee;
  29. USE ieee.std_logic_1164.ALL;
  30.  
  31. -- Uncomment the following library declaration if using
  32. -- arithmetic functions with Signed or Unsigned values
  33. --USE ieee.numeric_std.ALL;
  34.  
  35. ENTITY full_adder_4bit_test IS
  36. END full_adder_4bit_test;
  37.  
  38. ARCHITECTURE behavior OF full_adder_4bit_test IS
  39.  
  40.     -- Component Declaration for the Unit Under Test (UUT)
  41.  
  42.     COMPONENT full_adder_4bits
  43.     PORT(
  44.          Cin : IN  std_logic;
  45.          A : IN  std_logic_vector(3 downto 0);
  46.          B : IN  std_logic_vector(3 downto 0);
  47.          Sout : OUT  std_logic_vector(3 downto 0);
  48.          Cout : OUT  std_logic
  49.         );
  50.     END COMPONENT;
  51.    
  52.  
  53.    --Inputs
  54.    signal Cin : std_logic := '0';
  55.    signal A : std_logic_vector(3 downto 0) := (others => '0');
  56.    signal B : std_logic_vector(3 downto 0) := (others => '0');
  57.  
  58.     --Outputs
  59.    signal Sout : std_logic_vector(3 downto 0);
  60.    signal Cout : std_logic;
  61.    -- No clocks detected in port list. Replace <clock> below with
  62.    -- appropriate port name
  63.  
  64. BEGIN
  65.  
  66.     -- Instantiate the Unit Under Test (UUT)
  67.    uut: full_adder_4bits PORT MAP (
  68.           Cin => Cin,
  69.           A => A,
  70.           B => B,
  71.           Sout => Sout,
  72.           Cout => Cout
  73.         );
  74.  
  75.  
  76.    -- Stimulus process
  77.    stim_proc: process
  78.    begin       
  79.       -- hold reset state for 100 ns.
  80.       wait for 50 ns;  
  81.      
  82.         -- insert stimulus here
  83.         Cin <= '0';
  84.       A <= "0001";
  85.         B <= "0010";
  86.       wait for 100 ns;
  87.        
  88.         Cin <= '0';
  89.       A <= "0011";
  90.         B <= "0100";
  91.       wait for 100 ns;
  92.        
  93.         Cin <= '0';
  94.       A <= "0101";
  95.         B <= "0110";
  96.       wait for 100 ns;
  97.        
  98.         Cin <= '0';
  99.       A <= "0111";
  100.         B <= "1000";
  101.       wait for 100 ns;
  102.        
  103.         Cin <= '1';
  104.       A <= "0001";
  105.         B <= "0010";
  106.       wait for 100 ns;
  107.        
  108.         Cin <= '1';
  109.       A <= "0011";
  110.         B <= "0100";
  111.       wait for 100 ns;
  112.        
  113.         Cin <= '1';
  114.       A <= "0101";
  115.         B <= "0110";
  116.       wait for 100 ns;
  117.        
  118.         Cin <= '1';
  119.       A <= "0111";
  120.         B <= "1000";
  121.       wait for 100 ns;
  122.        
  123.       wait;
  124.    end process;
  125.  
  126. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement