From 7d23994613a721e8ed2be54c8eaff3c318a8d825 Mon Sep 17 00:00:00 2001
From: Roberto Hexsel <roberto@inf.ufpr.br>
Date: Mon, 10 Aug 2015 15:12:25 -0300
Subject: [PATCH] fixed test script

---
 cMIPS/include/start.s | 14 +++++---------
 cMIPS/vhdl/core.vhd   |  7 ++++---
 2 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/cMIPS/include/start.s b/cMIPS/include/start.s
index b69f4a2..042e402 100644
--- a/cMIPS/include/start.s
+++ b/cMIPS/include/start.s
@@ -209,18 +209,16 @@ excp_tbl: # see Table 8-25, pg 95,96
 	j h_Ov    # 12 overflow
 	nop
 
-	j h_trap  # 13 trap
+	wait 0x0d # 13 trap                             -- abort simulation
 	nop
 	
-	wait 0x14 # reserved, should never get here     -- abort simulation
+	wait 0x0e # reserved, should never get here     -- abort simulation
 	nop
 	
-	wait 0x15 # PF exception, should never get here -- abort simulation
+	wait 0x0f # FP exception, should never get here -- abort simulation
 	nop
 
-
-h_trap: wait 13
-
+	
 h_Mod:
 h_TLBL:
 h_TLBS:	
@@ -229,8 +227,6 @@ h_breakpoint:
 h_RI:
 h_CpU:
 h_Ov:
-
-
 	
 excp_0180ret:
 	lui  $k1, %hi(_excp_saves) # Read previous contents of STATUS
@@ -332,7 +328,7 @@ _excp_BFC0:
 	nop
 	nop
 	nop
-	wait 0x38
+	wait 0xff		# signal exception and abort simulation
 	nop
 	.end _excp_BFC0
 	##---------------------------------------------------------------
diff --git a/cMIPS/vhdl/core.vhd b/cMIPS/vhdl/core.vhd
index 6e9275f..7aafb4d 100644
--- a/cMIPS/vhdl/core.vhd
+++ b/cMIPS/vhdl/core.vhd
@@ -857,9 +857,10 @@ begin
 
       -- simulation aborted by instruction "wait N"
       assert not(exception = exWAIT and syscall_n /= x"80000")
-        report LF & "INVALID REFERENCE at EPC="& SLV32HEX(EPC) &
-        " opc="& SLV2STR(opcode) & " fun=" & SLV2STR(func) &
-        " instr=" & SLV32HEX(RF_instruction) & 
+        report LF & "ABORTED at EPC="& SLV32HEX(EPC) &
+        " bad="& SLV32HEX(BadVAddr) &
+        " opc="& SLV2STR(opcode) & " wait=" & SLV2STR(syscall_n(7 downto 0)) &
+        " instr=" & SLV32HEX(RF_instruction) &
         LF & "SIMULATION ABORTED AT EXCEPTION HANDLER;"
         severity failure;
 
-- 
GitLab