diff --git a/cMIPS/docs/cMIPS.pdf b/cMIPS/docs/cMIPS.pdf index ca7ba41e753e0f3c2d12abb9f5f6af37727c5314..a0244361f1de709481efc30d594ee69abe098df8 100644 Binary files a/cMIPS/docs/cMIPS.pdf and b/cMIPS/docs/cMIPS.pdf differ diff --git a/cMIPS/tests/break.s b/cMIPS/tests/break.s index 00c7bad1d4ea68cce858b7edee92eaacdd09265e..e6645c7013825550381b504dc8e44a2581f5a5f4 100644 --- a/cMIPS/tests/break.s +++ b/cMIPS/tests/break.s @@ -29,6 +29,31 @@ _exit: nop # flush pipeline nop nop .end _start + + + + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + + .org x_EXCEPTION_0180,0 # exception vector_180 .global _excp_180, excp_180 @@ -67,7 +92,21 @@ _excp_200: eret .end _excp_200 - + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + + + ## + ##================================================================= + ## .org x_ENTRY_POINT # normal code start main: la $15,x_IO_BASE_ADDR li $7,4 diff --git a/cMIPS/tests/ll_sc.s b/cMIPS/tests/ll_sc.s index 02ef481951fde9632f79658522c89dc8560c5074..ea1dc5b8cf17aaad92f9f5fcedf0eb62f7e97cb9 100644 --- a/cMIPS/tests/ll_sc.s +++ b/cMIPS/tests/ll_sc.s @@ -27,6 +27,30 @@ _exit: nop # flush pipeline nop .end _start + + + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + + .org x_EXCEPTION_0180,0 .global excp_180 @@ -44,7 +68,32 @@ excp_180: nop .end excp_180 - + +_excp_0200: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x03 + nop + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + + + + ## + ##================================================================= + ## .org x_ENTRY_POINT,0 .ent main main: la $15,x_IO_BASE_ADDR # print $5=8 and count downwards diff --git a/cMIPS/tests/overflow.s b/cMIPS/tests/overflow.s index 7501f4503213f85ef411b494fa34739201af6edf..75d22a8187f4f4b8cba22ae77210f561a25cd234 100644 --- a/cMIPS/tests/overflow.s +++ b/cMIPS/tests/overflow.s @@ -31,6 +31,29 @@ _exit: nop # flush pipeline nop .end _start + + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + + .org x_EXCEPTION_0180,0 # exception vector_180 .global _excp_180 .ent _excp_180 @@ -73,7 +96,33 @@ return: mtc0 $k1, cop0_EPC .end _excp_180 - #----------------------------------------------------------------- + + +_excp_0200: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x03 + nop + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + + + + ## + ##---------------------------------------------------------------- + ## .org x_ENTRY_POINT,0 # user code starts here main: la $15, x_IO_BASE_ADDR la $16, x_IO_BASE_ADDR+x_IO_ADDR_RANGE diff --git a/cMIPS/tests/syscall.s b/cMIPS/tests/syscall.s index 37408a840e37c16cbd991b157e1f4dbdf5db85a7..341a92bf024a7603d7999fdac0ba05bd6723f6f2 100644 --- a/cMIPS/tests/syscall.s +++ b/cMIPS/tests/syscall.s @@ -30,6 +30,29 @@ _exit: nop # flush pipeline nop nop .end _start + + + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + .org x_EXCEPTION_0180,0 # exception vector_180 .ent _excp_180 @@ -46,6 +69,31 @@ _excp_180: .end _excp_180 +_excp_0200: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x03 + nop + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + + + + ## + ##=============================================================== + ## .org x_ENTRY_POINT,0 # normal code start main: la $15, x_IO_BASE_ADDR li $7, 4 diff --git a/cMIPS/tests/teq_jal.s b/cMIPS/tests/teq_jal.s index 1db06af64f45ef9a6ac44586eafe855d3e944214..b3ac06a929b1792a8964a4391453ce2ba47c90d4 100644 --- a/cMIPS/tests/teq_jal.s +++ b/cMIPS/tests/teq_jal.s @@ -32,6 +32,28 @@ _exit: nop # flush pipeline .end _start + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + + .org x_EXCEPTION_0180,0 # exception vector_180 .ent _excp_180 excp_180: @@ -88,7 +110,22 @@ _excp_200: nop .end _excp_200 - + + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + + + ## + ##================================================================ + ## .org x_ENTRY_POINT,0 main: la $15, x_IO_BASE_ADDR # print out address (simulator's stdout) ## diff --git a/cMIPS/tests/teq_tne.s b/cMIPS/tests/teq_tne.s index 9ba4c38845abf28f414aa720f524f05ec7ffc04a..78b52141d4f8af747dda2dad3f116823b8d92394 100644 --- a/cMIPS/tests/teq_tne.s +++ b/cMIPS/tests/teq_tne.s @@ -30,6 +30,30 @@ _exit: nop # flush pipeline nop .end _start + + + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + + .org x_EXCEPTION_0180,0 # exception vector_180 .ent _excp_180 @@ -90,6 +114,19 @@ _excp_200: nop .end _excp_200 + + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + + .org x_ENTRY_POINT,0 main: la $15, x_IO_BASE_ADDR # print out address (simulator's stdout) diff --git a/cMIPS/tests/tlt_tlti.s b/cMIPS/tests/tlt_tlti.s index 6a57f4f8c89ec2edcb76f4451967651dcb2c7fb4..ab1ae9b6d96a4bd3a622b7349fc9f13d58744330 100644 --- a/cMIPS/tests/tlt_tlti.s +++ b/cMIPS/tests/tlt_tlti.s @@ -34,7 +34,29 @@ _exit: nop # flush pipeline nop nop .end _start - + + + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + ## ## print CAUSE, decrement iteration control @@ -90,8 +112,21 @@ _excp_200: .end _excp_200 + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + ## + ##======================================================= + ## .org x_ENTRY_POINT,0 # normal code start main: la $15, x_IO_BASE_ADDR # simulator's stdout li $7, 4 # do loop 4 times diff --git a/cMIPS/tests/tltu_tgeu.s b/cMIPS/tests/tltu_tgeu.s index 88f6031eb9f31f86f74164daa60c0ea6887fa045..425ed67067e68f49fd918bb86ba9cf8b4c03aac1 100644 --- a/cMIPS/tests/tltu_tgeu.s +++ b/cMIPS/tests/tltu_tgeu.s @@ -36,6 +36,29 @@ _exit: nop # flush pipeline nop .end _start + + + .org x_EXCEPTION_0000,0 +_excp_0000: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x01 + nop + .org x_EXCEPTION_0100,0 +_excp_0100: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x02 + nop + .org x_EXCEPTION_0180,0 # exception vector_180 .ent _excp_180 ## @@ -87,7 +110,20 @@ _excp_200: .end _excp_200 - + .org x_EXCEPTION_BFC0,0 +_excp_BFC0: + la $k0, x_IO_BASE_ADDR + mfc0 $k1, cop0_CAUSE + sw $k1, 0($k0) # print CAUSE, flush pipe and stop simulation + nop + nop + nop + wait 0x04 + nop + + ## + ##======================================================= + ## .org x_ENTRY_POINT,0 # normal code main: la $15,x_IO_BASE_ADDR # simulator's stdout