OpenCores
URL https://opencores.org/ocsvn/opencpu32/opencpu32/trunk

Subversion Repositories opencpu32

[/] [opencpu32/] [trunk/] [hdl/] [opencpu32/] [testMultiplexer4_1.vhd] - Diff between revs 18 and 19

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 18 Rev 19
Line 23... Line 23...
    generic (n : integer := nBits - 1);                                 --! Generic value (Used to easily change the size of the Alu on the package)
    generic (n : integer := nBits - 1);                                 --! Generic value (Used to easily change the size of the Alu on the package)
         Port ( A   : in  STD_LOGIC_VECTOR (n downto 0); --! First Input
         Port ( A   : in  STD_LOGIC_VECTOR (n downto 0); --! First Input
           B   : in  STD_LOGIC_VECTOR (n downto 0);      --! Second Input
           B   : in  STD_LOGIC_VECTOR (n downto 0);      --! Second Input
                          C   : in  STD_LOGIC_VECTOR (n downto 0);       --! Third Input
                          C   : in  STD_LOGIC_VECTOR (n downto 0);       --! Third Input
                          D   : in  STD_LOGIC_VECTOR (n downto 0);       --! Forth Input
                          D   : in  STD_LOGIC_VECTOR (n downto 0);       --! Forth Input
           sel : in  STD_LOGIC_VECTOR (1 downto 0);      --! Select inputs (1, 2, 3, 4)
                          E   : in  STD_LOGIC_VECTOR (n downto 0);       --! Fifth Input
 
           sel : in  STD_LOGIC_VECTOR (2 downto 0);      --! Select inputs (1, 2, 3, 4, 5)
           S   : out  STD_LOGIC_VECTOR (n downto 0));    --! Mux Output
           S   : out  STD_LOGIC_VECTOR (n downto 0));    --! Mux Output
    END COMPONENT;
    END COMPONENT;
 
 
 
 
   --Inputs
   --Inputs
   signal A : std_logic_vector((nBits - 1) downto 0) := (others => '0');  --! Wire to connect Test signal to component
   signal A : std_logic_vector((nBits - 1) downto 0) := (others => '0');  --! Wire to connect Test signal to component
   signal B : std_logic_vector((nBits - 1) downto 0) := (others => '0');  --! Wire to connect Test signal to component
   signal B : std_logic_vector((nBits - 1) downto 0) := (others => '0');  --! Wire to connect Test signal to component
        signal C : std_logic_vector((nBits - 1) downto 0) := (others => '0');     --! Wire to connect Test signal to component
        signal C : std_logic_vector((nBits - 1) downto 0) := (others => '0');     --! Wire to connect Test signal to component
        signal D : std_logic_vector((nBits - 1) downto 0) := (others => '0');     --! Wire to connect Test signal to component
        signal D : std_logic_vector((nBits - 1) downto 0) := (others => '0');     --! Wire to connect Test signal to component
   signal sel : STD_LOGIC_VECTOR (1 downto 0) := "00";                                                   --! Wire to connect Test signal to component
        signal E : std_logic_vector((nBits - 1) downto 0) := (others => '0');     --! Wire to connect Test signal to component
 
   signal sel : STD_LOGIC_VECTOR (2 downto 0) := "000";                                                  --! Wire to connect Test signal to component
 
 
        --Outputs
        --Outputs
   signal S : std_logic_vector((nBits - 1) downto 0);                                                    --! Wire to connect Test signal to component
   signal S : std_logic_vector((nBits - 1) downto 0);                                                    --! Wire to connect Test signal to component
 
 
BEGIN
BEGIN
Line 46... Line 48...
   uut: Multiplexer4_1 PORT MAP (
   uut: Multiplexer4_1 PORT MAP (
          A => A,
          A => A,
          B => B,
          B => B,
                         C => C,
                         C => C,
                         D => D,
                         D => D,
 
                         E => E,
          sel => sel,
          sel => sel,
          S => S
          S => S
        );
        );
 
 
   --! Process that will change sel signal and verify the Mux outputs
   --! Process that will change sel signal and verify the Mux outputs
   stim_proc: process
   stim_proc: process
   begin
   begin
      -- Sel 0 ---------------------------------------------------------------------------
      -- Sel 0 ---------------------------------------------------------------------------
                wait for 1 ps;
                wait for 1 ps;
                REPORT "Select first channel" SEVERITY NOTE;
                REPORT "Select first channel" SEVERITY NOTE;
                sel <= "00";
                sel <= "000";
                A <= conv_std_logic_vector(0, nBits);
                A <= conv_std_logic_vector(0, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
 
                E <= conv_std_logic_vector(4000, nBits);
                wait for 1 ns;  -- Wait to stabilize the response
                wait for 1 ns;  -- Wait to stabilize the response
                assert S = (A) report "Could not select first channel" severity FAILURE;
                assert S = (A) report "Could not select first channel" severity FAILURE;
 
 
                -- Sel 1 ---------------------------------------------------------------------------
                -- Sel 1 ---------------------------------------------------------------------------
                wait for 1 ns;
                wait for 1 ns;
                REPORT "Select second channel" SEVERITY NOTE;
                REPORT "Select second channel" SEVERITY NOTE;
                sel <= "01";
                sel <= "001";
                A <= conv_std_logic_vector(0, nBits);
                A <= conv_std_logic_vector(0, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
 
                E <= conv_std_logic_vector(4000, nBits);
                wait for 1 ns;  -- Wait to stabilize the response
                wait for 1 ns;  -- Wait to stabilize the response
                assert S = (B) report "Could not select second channel" severity FAILURE;
                assert S = (B) report "Could not select second channel" severity FAILURE;
 
 
                -- Sel 2 ---------------------------------------------------------------------------
                -- Sel 2 ---------------------------------------------------------------------------
                wait for 1 ns;
                wait for 1 ns;
                REPORT "Select second channel" SEVERITY NOTE;
                REPORT "Select third channel" SEVERITY NOTE;
                sel <= "10";
                sel <= "010";
                A <= conv_std_logic_vector(0, nBits);
                A <= conv_std_logic_vector(0, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
 
                E <= conv_std_logic_vector(4000, nBits);
                wait for 1 ns;  -- Wait to stabilize the response
                wait for 1 ns;  -- Wait to stabilize the response
                assert S = (C) report "Could not select second channel" severity FAILURE;
                assert S = (C) report "Could not select third channel" severity FAILURE;
 
 
                -- Sel 3 ---------------------------------------------------------------------------
                -- Sel 3 ---------------------------------------------------------------------------
                wait for 1 ns;
                wait for 1 ns;
                REPORT "Select second channel" SEVERITY NOTE;
                REPORT "Select forth channel" SEVERITY NOTE;
                sel <= "11";
                sel <= "011";
 
                A <= conv_std_logic_vector(0, nBits);
 
                B <= conv_std_logic_vector(1000, nBits);
 
                C <= conv_std_logic_vector(2000, nBits);
 
                D <= conv_std_logic_vector(3000, nBits);
 
                E <= conv_std_logic_vector(4000, nBits);
 
                wait for 1 ns;  -- Wait to stabilize the response
 
                assert S = (D) report "Could not select forth channel" severity FAILURE;
 
 
 
                -- Sel 4 ---------------------------------------------------------------------------
 
                wait for 1 ns;
 
                REPORT "Select fifth channel" SEVERITY NOTE;
 
                sel <= "100";
                A <= conv_std_logic_vector(0, nBits);
                A <= conv_std_logic_vector(0, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                B <= conv_std_logic_vector(1000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                C <= conv_std_logic_vector(2000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
                D <= conv_std_logic_vector(3000, nBits);
 
                E <= conv_std_logic_vector(4000, nBits);
                wait for 1 ns;  -- Wait to stabilize the response
                wait for 1 ns;  -- Wait to stabilize the response
                assert S = (D) report "Could not select second channel" severity FAILURE;
                assert S = (E) report "Could not select fifth channel" severity FAILURE;
 
 
                -- Finish simulation
                -- Finish simulation
                assert false report "NONE. End of simulation." severity failure;
                assert false report "NONE. End of simulation." severity failure;
   end process;
   end process;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.