From 6e9bf2c5fb774d58eda16a24c827cc3d6d5f6a8d Mon Sep 17 00:00:00 2001 From: Prashanth Mundkur Date: Thu, 7 Mar 2019 15:10:13 -0800 Subject: Get rvfi building again. --- model/main_rvfi.sail | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'model/main_rvfi.sail') diff --git a/model/main_rvfi.sail b/model/main_rvfi.sail index 0ba4acf..837f2d4 100644 --- a/model/main_rvfi.sail +++ b/model/main_rvfi.sail @@ -4,19 +4,19 @@ val rvfi_fetch : unit -> FetchResult effect {escape, rmem, rreg, wmv, wreg} function rvfi_fetch() = /* check for legal PC */ - if (PC[0] != 0b0 | (PC[1] != 0b0 & (~ (haveRVC())))) + if (PC[0] != 0b0 | (PC[1] != 0b0 & (~ (haveRVC())))) then F_Error(E_Fetch_Addr_Align, PC) else { let i = rvfi_instruction.rvfi_insn(); rvfi_exec->rvfi_order() = minstret; rvfi_exec->rvfi_pc_rdata() = PC; - rvfi_exec->rvfi_insn() = zero_extend(i,64); + rvfi_exec->rvfi_insn() = sail_zero_extend(i,64); /* TODO: should we write these even if they're not really registers? */ rvfi_exec->rvfi_rs1_data() = X(i[19 .. 15]); rvfi_exec->rvfi_rs2_data() = X(i[24 .. 20]); - rvfi_exec->rvfi_rs1_addr() = zero_extend(i[19 .. 15],8); - rvfi_exec->rvfi_rs2_addr() = zero_extend(i[24 .. 20],8); - if (i[1 .. 0] == 0b11) + rvfi_exec->rvfi_rs1_addr() = sail_zero_extend(i[19 .. 15],8); + rvfi_exec->rvfi_rs2_addr() = sail_zero_extend(i[24 .. 20],8); + if (i[1 .. 0] == 0b11) then F_Base(i) else F_RVC(i[15 .. 0]) } @@ -29,7 +29,7 @@ val rvfi_step : int -> bool effect {barr, eamem, escape, exmem, rmem, rreg, wmv, function rvfi_step(step_no) = { minstret_written = false; /* see note for minstret */ let (retired, stepped) : (bool, bool) = - match curInterrupt(cur_privilege, mip, mie, mideleg) { + match dispatchInterrupt(cur_privilege) { Some(intr, priv) => { print_bits("Handling interrupt: ", intr); handle_interrupt(intr, priv); @@ -51,8 +51,13 @@ function rvfi_step(step_no) = { }, Some(ast) => { print("[" ^ string_of_int(step_no) ^ "] [" ^ cur_privilege ^ "]: " ^ BitStr(PC) ^ " (" ^ BitStr(h) ^ ") " ^ ast); - nextPC = PC + 2; - (execute(ast), true) + /* check for RVC once here instead of every RVC execute clause. */ + if haveRVC() then { + nextPC = PC + 2; + (execute(ast), true) + } else { + (false, true) + } } } }, @@ -95,7 +100,7 @@ function main () = { rvfi_zero_exec_packet(); rvfi_halt_exec_packet(); let _ = rvfi_get_exec_packet(); - PC = zero_extend(0x1000, 64); + PC = sail_zero_extend(0x1000, 64); print_bits("PC = ", PC); try { init_platform(); -- cgit v1.1 From 7f3f641a4ae2a12ac55904d30c6534360e5cae1d Mon Sep 17 00:00:00 2001 From: Prashanth Mundkur Date: Mon, 11 Mar 2019 15:18:25 -0700 Subject: Fix rvfi initialization. --- model/main_rvfi.sail | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'model/main_rvfi.sail') diff --git a/model/main_rvfi.sail b/model/main_rvfi.sail index 837f2d4..10b5428 100644 --- a/model/main_rvfi.sail +++ b/model/main_rvfi.sail @@ -103,8 +103,7 @@ function main () = { PC = sail_zero_extend(0x1000, 64); print_bits("PC = ", PC); try { - init_platform(); - init_sys(); + init_model(); loop() } catch { Error_not_implemented(s) => print_string("Error: Not implemented: ", s), -- cgit v1.1