diff --git a/include/ariane_pkg.svh b/include/ariane_pkg.svh index 1834225b6..0335d9aa6 100644 --- a/include/ariane_pkg.svh +++ b/include/ariane_pkg.svh @@ -31,17 +31,18 @@ package ariane_pkg; // Only use struct when signals have same direction // exception typedef struct packed { - logic [63:0] epc; - logic [63:0] cause; + logic [63:0] cause; // cause of exception + logic [63:0] tval; // additional information of causing exception (e.g.: instruction causing it), + // address of ld/st fault logic valid; } exception; // miss-predict typedef struct packed { - logic [63:0] pc; - logic [63:0] target_address; - logic is_taken; - logic valid; // is miss-predict + logic [63:0] pc; + logic [63:0] target_address; + logic is_taken; + logic valid; // is miss-predict } misspredict; typedef enum logic[3:0] { @@ -49,10 +50,10 @@ package ariane_pkg; } fu_t; localparam EXC_OFF_RST = 8'h80; + // --------------- // EX Stage // --------------- - typedef enum logic [7:0] { // basic ALU op ADD, SUB, ADDW, SUBW, // logic operations @@ -73,6 +74,7 @@ package ariane_pkg; // ID/EX/WB Stage // --------------- typedef struct packed { + logic [63:0] pc; // PC of instruction logic [TRANS_ID_BITS-1:0] trans_id; // this can potentially be simplified, we could index the scoreboard entry // with the transaction id in any case make the width more generic fu_t fu; // functional unit to use diff --git a/src/decoder.sv b/src/decoder.sv index 84ac52df0..51e6dfd3c 100644 --- a/src/decoder.sv +++ b/src/decoder.sv @@ -46,6 +46,7 @@ module decoder ( imm_select = NOIMM; illegal_instr_o = 1'b0; + instruction_o.pc = pc_i; instruction_o.fu = NONE; instruction_o.op = ADD; instruction_o.rs1 = 5'b0; diff --git a/src/if_stage.sv b/src/if_stage.sv index 168e69f6b..523437e2a 100644 --- a/src/if_stage.sv +++ b/src/if_stage.sv @@ -197,8 +197,8 @@ module if_stage ( illegal_c_insn_id_o <= illegal_c_insn; is_compressed_id_o <= instr_compressed_int; pc_id_o <= pc_if_o; - ex_o.epc <= pc_if_o; ex_o.cause <= 64'b0; // TODO: Output exception + ex_o.tval <= 64'b0; // TODO: Output exception ex_o.valid <= 1'b0; // TODO: Output exception end else if (clear_instr_valid_i) begin instr_valid_id_o <= 1'b0; diff --git a/src/issue_read_operands.sv b/src/issue_read_operands.sv index a887a5a15..dbf5e4117 100644 --- a/src/issue_read_operands.sv +++ b/src/issue_read_operands.sv @@ -178,7 +178,7 @@ module issue_read_operands ( // use the PC as operand a if (issue_instr_i.use_pc) begin - operand_a_n = issue_instr_i.ex.epc; + operand_a_n = issue_instr_i.pc; end // or is it an immediate (including PC), this is not the case for a store diff --git a/tb/models/scoreboard.sv b/tb/models/scoreboard.sv index a5feb1559..ded3570cd 100755 --- a/tb/models/scoreboard.sv +++ b/tb/models/scoreboard.sv @@ -8,7 +8,7 @@ class Scoreboard; static function scoreboard_entry randomize_scoreboard(); exception exception = { 63'h0, 63'h0, 1'b0}; scoreboard_entry entry = { - i, ALU, ADD, 5'h5, 5'h5, 5'h5, 64'h0, 1'b0, 1'b0, exception, 1'b0 + 63'b0, i, ALU, ADD, 5'h5, 5'h5, 5'h5, 64'h0, 1'b0, 1'b0, exception, 1'b0 }; return entry; endfunction : randomize_scoreboard