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

Subversion Repositories opencpu32

[/] [opencpu32/] [trunk/] [hdl/] [opencpu32/] [testRegisterFile.vhd] - Diff between revs 15 and 16

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

Rev 15 Rev 16
Line 36... Line 36...
   --Inputs
   --Inputs
   signal clk : std_logic := '0';                                                                                                                        --! Wire to connect Test signal to component
   signal clk : std_logic := '0';                                                                                                                        --! Wire to connect Test signal to component
   signal writeEn : std_logic := '0';                                                                                                            --! Wire to connect Test signal to component
   signal writeEn : std_logic := '0';                                                                                                            --! Wire to connect Test signal to component
   signal writeAddr : generalRegisters := r0;                                                                                   --! Wire to connect Test signal to component
   signal writeAddr : generalRegisters := r0;                                                                                   --! Wire to connect Test signal to component
   signal input : std_logic_vector((nBits - 1) downto 0) := (others => '0');      --! Wire to connect Test signal to component
   signal input : std_logic_vector((nBits - 1) downto 0) := (others => '0');      --! Wire to connect Test signal to component
   signal Read_A_En : std_logic := '0';                                                                                                  --! Wire to connect Test signal to component
   signal Read_A_En : std_logic := 'X';                                                                                                 --! Wire to connect Test signal to component
   signal Read_A_Addr : generalRegisters := r0;                                                                                 --! Wire to connect Test signal to component
   signal Read_A_Addr : generalRegisters := r0;                                                                                 --! Wire to connect Test signal to component
   signal Read_B_En : std_logic := '0';                                                                                                  --! Wire to connect Test signal to component
   signal Read_B_En : std_logic := 'X';                                                                                                 --! Wire to connect Test signal to component
   signal Read_B_Addr : generalRegisters := r0;                                                                                 --! Wire to connect Test signal to component
   signal Read_B_Addr : generalRegisters := r0;                                                                                 --! Wire to connect Test signal to component
 
 
        --Outputs
        --Outputs
   signal A_Out : std_logic_vector((nBits - 1) downto 0);                                                        --! Wire to connect Test signal to component
   signal A_Out : std_logic_vector((nBits - 1) downto 0);                                                        --! Wire to connect Test signal to component
   signal B_Out : std_logic_vector((nBits - 1) downto 0);                                                --! Wire to connect Test signal to component
   signal B_Out : std_logic_vector((nBits - 1) downto 0);                                                --! Wire to connect Test signal to component
Line 68... Line 68...
   --! Process that will stimulate all register assignments, and reads...
   --! Process that will stimulate all register assignments, and reads...
   stim_proc: process
   stim_proc: process
        variable allZ : std_logic_vector((nBits - 1) downto 0) := (others => 'Z');
        variable allZ : std_logic_vector((nBits - 1) downto 0) := (others => 'Z');
   begin
   begin
                -- r0=1 ... r15=16---------------------------------------------------------------------------
                -- r0=1 ... r15=16---------------------------------------------------------------------------
 
                for i in 0 to (numGenRegs-1) loop
                clk <= '0';
                clk <= '0';
                REPORT "Write r0 := 1" SEVERITY NOTE;
                REPORT "Write r0 := 1" SEVERITY NOTE;
                writeEn <= '1';
                writeEn <= '1';
                writeAddr <= r0;
                        writeAddr <= Num2reg(i);
                input <= conv_std_logic_vector(1, nBits);
                        input <= conv_std_logic_vector(i+1, nBits);
                wait for 1 ns;
 
                clk <= '1';
 
                wait for 1 ns;  -- Wait to stabilize the response
 
 
 
                clk <= '0';
 
                REPORT "Write r1 := 2" SEVERITY NOTE;
 
                writeEn <= '1';
 
                writeAddr <= r1;
 
                input <= conv_std_logic_vector(2, nBits);
 
                wait for 1 ns;
 
                clk <= '1';
 
                wait for 1 ns;  -- Wait to stabilize the response
 
 
 
                clk <= '0';
 
                REPORT "Write r2 := 3" SEVERITY NOTE;
 
                writeEn <= '1';
 
                writeAddr <= r2;
 
                input <= conv_std_logic_vector(3, nBits);
 
                wait for 1 ns;
 
                clk <= '1';
 
                wait for 1 ns;  -- Wait to stabilize the response
 
 
 
                clk <= '0';
 
                REPORT "Write r3 := 4" SEVERITY NOTE;
 
                writeEn <= '1';
 
                writeAddr <= r3;
 
                input <= conv_std_logic_vector(4, nBits);
 
                wait for 1 ns;
 
                clk <= '1';
 
                wait for 1 ns;  -- Wait to stabilize the response
 
 
 
                clk <= '0';
 
                REPORT "Write r4 := 5" SEVERITY NOTE;
 
                writeEn <= '1';
 
                writeAddr <= r4;
 
                input <= conv_std_logic_vector(5, nBits);
 
                wait for 1 ns;
                wait for 1 ns;
                clk <= '1';
                clk <= '1';
                wait for 1 ns;  -- Wait to stabilize the response
                wait for 1 ns;  -- Wait to stabilize the response
 
                end loop;
 
 
 
                -- Mark write end....
                clk <= '0';
                clk <= '0';
                writeEn <= '0';
                writeEn <= '0';
                wait for 1 ns;  -- Wait to stabilize the response               
                wait for 1 ns;  -- Wait to stabilize the response               
 
 
                -- Read r0..r15 PortA-------------------------------------------------------------------------
                -- Read r0..r15 PortA-------------------------------------------------------------------------
 
                for i in 0 to (numGenRegs-1) loop
                REPORT "Check r0 = 1" SEVERITY NOTE;
                REPORT "Check r0 = 1" SEVERITY NOTE;
                Read_A_En <= '1';
                Read_A_En <= '1';
                Read_A_Addr <= r0;
                        Read_A_Addr <= Num2reg(i);
                wait for 1 ns;  -- Wait to stabilize the response
                wait for 1 ns;  -- Wait to stabilize the response
                assert A_Out = conv_std_logic_vector(1, nBits) report "Invalid value r0" severity FAILURE;
                        assert A_Out = conv_std_logic_vector(i+1, nBits) report "Invalid value r0" severity FAILURE;
                assert B_Out = allZ report "PortB should be high impedance" severity FAILURE;
                assert B_Out = allZ report "PortB should be high impedance" severity FAILURE;
 
                end loop;
 
 
                REPORT "Check r1 = 2" SEVERITY NOTE;
                -- Mark read A end
                Read_A_En <= '1';
                Read_A_En <= 'X';
                Read_A_Addr <= r1;
 
                wait for 1 ns;  -- Wait to stabilize the response
 
                assert A_Out = conv_std_logic_vector(2, nBits) report "Invalid value r1" severity FAILURE;
 
                assert B_Out = allZ report "PortB should be high impedance" severity FAILURE;
 
 
 
                REPORT "Check r2 = 3" SEVERITY NOTE;
                -- Read r0..r15 PortB-------------------------------------------------------------------------
                Read_A_En <= '1';
                for i in 0 to (numGenRegs-1) loop
                Read_A_Addr <= r2;
                        REPORT "Check r0 = 1" SEVERITY NOTE;
                wait for 1 ns;  -- Wait to stabilize the response
                        Read_B_En <= '1';
                assert A_Out = conv_std_logic_vector(3, nBits) report "Invalid value r2" severity FAILURE;
                        Read_B_Addr <= Num2reg(i);
                assert B_Out = allZ report "PortB should be high impedance" severity FAILURE;
 
 
 
                REPORT "Check r3 = 4" SEVERITY NOTE;
 
                Read_A_En <= '1';
 
                Read_A_Addr <= r3;
 
                wait for 1 ns;  -- Wait to stabilize the response
 
                assert A_Out = conv_std_logic_vector(4, nBits) report "Invalid value r3" severity FAILURE;
 
                assert B_Out = allZ report "PortB should be high impedance" severity FAILURE;
 
 
 
                REPORT "Check r4 = 5" SEVERITY NOTE;
 
                Read_A_En <= '1';
 
                Read_A_Addr <= r4;
 
                wait for 1 ns;  -- Wait to stabilize the response
                wait for 1 ns;  -- Wait to stabilize the response
                assert A_Out = conv_std_logic_vector(5, nBits) report "Invalid value r4" severity FAILURE;
                        assert B_Out = conv_std_logic_vector(i+1, nBits) report "Invalid value r0" severity FAILURE;
                assert B_Out = allZ report "PortB should be high impedance" severity FAILURE;
                        assert A_Out = allZ report "PortB should be high impedance" severity FAILURE;
 
                end loop;
 
 
 
                -- Mark read B end
 
                Read_B_En <= 'X';
      wait;
      wait;
   end process;
   end process;
 
 
END;
END;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

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