diff --git a/cMIPS/docs/cMIPS.pdf b/cMIPS/docs/cMIPS.pdf index 5e7101260c5cd192542d2764dc2a7f28efff9d1d..6b3199a5aae47d03a1cf3b06d37d22d6843d105e 100644 Binary files a/cMIPS/docs/cMIPS.pdf and b/cMIPS/docs/cMIPS.pdf differ diff --git a/cMIPS/vhdl/core.vhd b/cMIPS/vhdl/core.vhd index 4fa49dd091ee7d7b9106d375833c4917cfb928b2..d5991dac45a6a7116940a2d4ae773b2dd4a8e63c 100644 --- a/cMIPS/vhdl/core.vhd +++ b/cMIPS/vhdl/core.vhd @@ -694,11 +694,12 @@ begin (others => 'X') when others; with excp_PCsel select - PCinp <= PCinp_noExcp when b"000", -- no exception - EPC when b"001", -- ERET - x_EXCEPTION_0180 when b"010", -- single exception handler - x_EXCEPTION_0200 when b"011", -- separate interrupt handler - x_EXCEPTION_0000 when b"100", -- NMI or soft-reset handler + PCinp <= PCinp_noExcp when PCsel_EXC_none, -- no exception + EPC when PCsel_EXC_EPC, -- ERET + x_EXCEPTION_0100 when PCsel_EXC_0100, -- TLBmiss entry point + x_EXCEPTION_0180 when PCsel_EXC_0180, -- single exception handler + x_EXCEPTION_0200 when PCsel_EXC_0200, -- separate interrupt handler + x_EXCEPTION_0000 when PCsel_EXC_0000, -- NMI or soft-reset handler (others => 'X') when others; IF_excp_type <= IFaddressError when PC(1 downto 0) /= b"00" else @@ -1568,7 +1569,7 @@ begin newSTATUS := STATUS; i_epc_update := '1'; i_epc_source := b"000"; - i_excp_PCsel := b"000"; -- PC <= normal processing PC + i_excp_PCsel := PCsel_EXC_none; -- PC <= normal processing PC i_update := '0'; i_update_r := b"00000"; i_a_c := b"00000"; @@ -1645,7 +1646,7 @@ begin i_update := '1'; i_update_r := cop0reg_STATUS; i_stall := '0'; - i_excp_PCsel := b"001"; -- PC <= EPC + i_excp_PCsel := PCsel_EXC_EPC; -- PC <= EPC i_nullify := '1'; -- nullify instructions in IF,RF when exTRAP | exSYSCALL | exBREAK => -- trap instruction @@ -1684,7 +1685,7 @@ begin else i_epc_source := b"001"; -- RF_PC end if; - i_excp_PCsel := b"010"; -- PC <= exception_180 + i_excp_PCsel := PCsel_EXC_0180; -- PC <= exception_180 else trap_taken <= '0'; end if; @@ -1708,7 +1709,7 @@ begin i_update := '1'; i_update_r := cop0reg_STATUS; i_epc_update := '0'; - i_excp_PCsel := b"010"; -- PC <= exception_0180 + i_excp_PCsel := PCsel_EXC_0180; -- PC <= exception_0180 ExcCode <= cop0code_Ov; i_nullify := '1'; -- nullify instructions in IF,RF nullify_EX <= '1'; -- and instruction in EX @@ -1722,7 +1723,7 @@ begin i_update := '1'; i_update_r := cop0reg_STATUS; i_epc_update := '0'; - i_excp_PCsel := b"010"; -- PC <= exception_0180 + i_excp_PCsel := PCsel_EXC_0180; -- PC <= exception_0180 BadVAddr_update <= '0'; if is_exception = MMaddressErrorST then ExcCode <= cop0code_AdES; @@ -1760,7 +1761,7 @@ begin else i_epc_source := b"001"; -- RF_PC end if; - i_excp_PCsel := b"100"; -- PC <= exception_0000 + i_excp_PCsel := PCsel_EXC_0000; -- PC <= exception_0000 elsif ( (STATUS(STATUS_EXL) = '0') and (STATUS(STATUS_ERL) = '0') and (STATUS(STATUS_IE) = '1') and (EX_interrupt = '1') and @@ -1783,9 +1784,9 @@ begin i_epc_source := b"001"; -- RF_PC end if; if CAUSE(CAUSE_IV) = '1' then - i_excp_PCsel := b"011"; -- PC <= exception_0200 + i_excp_PCsel := PCsel_EXC_0200; -- PC <= exception_0200 else - i_excp_PCsel := b"010"; -- PC <= exception_0180 + i_excp_PCsel := PCsel_EXC_0180; -- PC <= exception_0180 end if; end if; -- NMI or else interrupt diff --git a/cMIPS/vhdl/packageExcp.vhd b/cMIPS/vhdl/packageExcp.vhd index 2c56bff3fe644b8891d89d04eaa7e95e3cb82098..cca34ff70c9fbf9db12284ce90d8384431221b52 100644 --- a/cMIPS/vhdl/packageExcp.vhd +++ b/cMIPS/vhdl/packageExcp.vhd @@ -121,7 +121,15 @@ package p_EXCEPTION is constant CAUSE_ExcCodehi: integer := 6; -- exception code constant CAUSE_ExcCodelo: integer := 2; -- exception code + -- Sources of Exception Hnadler's addresses; signal excp_PCsel + constant PCsel_EXC_none : reg3 := b"000"; -- no exception + constant PCsel_EXC_EPC : reg3 := b"001"; -- ERET + constant PCsel_EXC_0180 : reg3 := b"010"; -- general exception handler + constant PCsel_EXC_0200 : reg3 := b"011"; -- separate interrupt handler + constant PCsel_EXC_0100 : reg3 := b"100"; -- TLBmiss entry point + constant PCsel_EXC_0000 : reg3 := b"110"; -- NMI or soft-reset handler + end p_EXCEPTION; -- package body p_EXCEPTION is diff --git a/cMIPS/vhdl/packageMemory.vhd b/cMIPS/vhdl/packageMemory.vhd index 8a788b4cb837fa4bb60c896a17297f246d4c89e7..b1ad89a0d896fac82077f11dac4f384b3701192c 100644 --- a/cMIPS/vhdl/packageMemory.vhd +++ b/cMIPS/vhdl/packageMemory.vhd @@ -44,7 +44,8 @@ package p_MEMORY is constant x_IO_MEM_SZ : reg32 := x"00002000"; constant x_IO_ADDR_RANGE : reg32 := x"00000020"; constant x_EXCEPTION_0000 : reg32 := x"00000080"; - constant x_EXCEPTION_0180 : reg32 := x"000000c0"; + constant x_EXCEPTION_0100 : reg32 := x"000000A0"; + constant x_EXCEPTION_0180 : reg32 := x"000000C0"; constant x_EXCEPTION_0200 : reg32 := x"00000140"; constant x_ENTRY_POINT : reg32 := x"00000300"; -- end DO NOT change these names --