Advertisement
Tyler_Elric

testripplecarry

Sep 20th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 1.86 KB | None | 0 0
  1. LIBRARY ieee;
  2. USE ieee.std_logic_1164.ALL;
  3. use ieee.numeric_std.all;
  4.  
  5. ENTITY testripple IS
  6. END testripple;
  7.  
  8. ARCHITECTURE behavior OF testripple IS
  9.  
  10.     -- Component Declaration for the Unit Under Test (UUT)
  11.  
  12.     COMPONENT ripplecarry
  13.     PORT(
  14.          a : IN  std_logic_vector(3 downto 0);
  15.          b : IN  std_logic_vector(3 downto 0);
  16.          cin : IN  std_logic;
  17.          c : OUT  std_logic_vector(3 downto 0);
  18.          cout : OUT  std_logic
  19.         );
  20.     END COMPONENT;
  21.    
  22.  
  23.    --Inputs
  24.    signal a : std_logic_vector(3 downto 0) := (others => '0');
  25.    signal b : std_logic_vector(3 downto 0) := (others => '0');
  26.    signal cin : std_logic := '0';
  27.  
  28.     --Outputs
  29.    signal c : std_logic_vector(3 downto 0);
  30.    signal cout : std_logic;
  31.    -- No clocks detected in port list. Replace <clock> below with
  32.    -- appropriate port name
  33.  
  34. BEGIN
  35.  
  36.     -- Instantiate the Unit Under Test (UUT)
  37.    uut: ripplecarry PORT MAP (
  38.           a => a,
  39.           b => b,
  40.           cin => cin,
  41.           c => c,
  42.           cout => cout
  43.         );
  44.  
  45.    -- Stimulus process
  46.    stim_proc: process
  47.    begin       
  48.       -- hold reset state for 100 ns.
  49.       wait for 100 ns;
  50.  
  51.       -- insert stimulus here
  52.         cin <= '0';
  53.         a   <= "0001";
  54.         b   <= "0010";
  55.       wait for 100 ns;
  56.        
  57.         cin <= '0';
  58.         a   <= "0011";
  59.         b   <= "0100";
  60.       wait for 100 ns;
  61.        
  62.         cin <= '0';
  63.         a   <= "0101";
  64.         b   <= "0110";
  65.       wait for 100 ns;
  66.        
  67.         cin <= '0';
  68.         a   <= "0111";
  69.         b   <= "1000";
  70.       wait for 100 ns;
  71.        
  72.         cin <= '1';
  73.         a   <= "0001";
  74.         b   <= "0010";
  75.       wait for 100 ns;
  76.        
  77.         cin <= '1';
  78.         a   <= "0011";
  79.         b   <= "0100";
  80.       wait for 100 ns;
  81.        
  82.         cin <= '1';
  83.         a   <= "0101";
  84.         b   <= "0110";
  85.       wait for 100 ns;
  86.        
  87.         cin <= '1';
  88.         a   <= "0111";
  89.         b   <= "1000";
  90.       wait for 100 ns;
  91.  
  92.       wait;
  93.    end process;
  94.  
  95. END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement