Add additional exception information to sbe

Moved PC from exception to scoreboard entry as we have the entry
available in the commit stage where we take the exception. Also add the
additional exception information which we need to set the s/mval field.
This commit is contained in:
Florian Zaruba 2017-05-04 19:51:53 +02:00
parent e683824b2a
commit 2fe5cbad49
5 changed files with 13 additions and 10 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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

View file

@ -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