mirror of
https://github.com/openhwgroup/cva5.git
synced 2025-04-22 04:57:18 -04:00
added exception_unit_table
This commit is contained in:
parent
b5ba43ea6d
commit
500202f9b4
5 changed files with 35 additions and 9 deletions
|
@ -196,6 +196,17 @@ module decode_and_issue
|
|||
assign decode_rs_wb_group[RS1] = renamer.rs_wb_group[RS1];
|
||||
assign decode_rs_wb_group[RS2] = renamer.rs_wb_group[RS2];
|
||||
|
||||
|
||||
//TODO: Consider ways of parameterizing so that any exception generating unit
|
||||
//can be automatically added to this expression
|
||||
exception_sources_t decode_exception_unit;
|
||||
always_comb begin
|
||||
unique case (1'b1)
|
||||
unit_needed[UNIT_IDS.LS] : decode_exception_unit = LS_EXCEPTION;
|
||||
unit_needed[UNIT_IDS.BR] : decode_exception_unit = BR_EXCEPTION;
|
||||
default : decode_exception_unit = IEC_EXCEPTION;
|
||||
endcase
|
||||
end
|
||||
////////////////////////////////////////////////////
|
||||
//Issue
|
||||
logic [REGFILE_READ_PORTS-1:0][$clog2(CONFIG.NUM_WB_GROUPS)-1:0] issue_rs_wb_group;
|
||||
|
@ -216,6 +227,7 @@ module decode_and_issue
|
|||
issue.phys_rd_addr <= renamer.phys_rd_addr;
|
||||
issue.is_multicycle <= ~unit_needed[UNIT_IDS.ALU];
|
||||
issue.id <= decode.id;
|
||||
issue.exception_unit <= decode_exception_unit;
|
||||
issue.uses_rs1 <= uses_rs1;
|
||||
issue.uses_rs2 <= uses_rs2;
|
||||
issue.uses_rd <= uses_rd;
|
||||
|
|
|
@ -54,7 +54,7 @@ module gc_unit
|
|||
|
||||
//Retire
|
||||
input retire_packet_t retire,
|
||||
input logic [$clog2(NUM_EXCEPTION_SOURCES)-1:0] current_exception,
|
||||
input logic [$clog2(NUM_EXCEPTION_SOURCES)-1:0] current_exception_unit,
|
||||
|
||||
//External
|
||||
input logic interrupt,
|
||||
|
@ -240,8 +240,8 @@ module gc_unit
|
|||
always_comb begin
|
||||
gc_exception.valid = |ex_pending;
|
||||
gc_exception.pc = oldest_pc;
|
||||
gc_exception.code = ex_code[current_exception];
|
||||
gc_exception.tval = ex_tval[current_exception];
|
||||
gc_exception.code = ex_code[current_exception_unit];
|
||||
gc_exception.tval = ex_tval[current_exception_unit];
|
||||
end
|
||||
|
||||
//PC determination (trap, flush or return)
|
||||
|
|
|
@ -74,7 +74,8 @@ module instruction_metadata_and_id_management
|
|||
//CSR
|
||||
output logic [LOG2_MAX_IDS:0] post_issue_count,
|
||||
//Exception
|
||||
output logic [31:0] oldest_pc
|
||||
output logic [31:0] oldest_pc,
|
||||
output logic [$clog2(NUM_EXCEPTION_SOURCES)-1:0] current_exception_unit
|
||||
|
||||
);
|
||||
//////////////////////////////////////////
|
||||
|
@ -87,6 +88,8 @@ module instruction_metadata_and_id_management
|
|||
|
||||
(* ramstyle = "MLAB, no_rw_check" *) logic [$bits(fetch_metadata_t)-1:0] fetch_metadata_table [MAX_IDS];
|
||||
|
||||
(* ramstyle = "MLAB, no_rw_check" *) logic [$bits(exception_sources_t)-1:0] exception_unit_table [MAX_IDS];
|
||||
|
||||
id_t decode_id;
|
||||
id_t oldest_pre_issue_id;
|
||||
|
||||
|
@ -144,7 +147,15 @@ module instruction_metadata_and_id_management
|
|||
always_ff @ (posedge clk) begin
|
||||
if (decode_advance)
|
||||
uses_rd_table[decode_id] <= decode_uses_rd & |decode_rd_addr;
|
||||
end
|
||||
end
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//Exception unit table
|
||||
always_ff @ (posedge clk) begin
|
||||
if (instruction_issued)
|
||||
exception_unit_table[issue.id] <= issue.exception_unit;
|
||||
end
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//ID Management
|
||||
|
||||
|
@ -320,7 +331,8 @@ module instruction_metadata_and_id_management
|
|||
|
||||
//Exception Support
|
||||
generate if (CONFIG.INCLUDE_M_MODE) begin
|
||||
assign oldest_pc = pc_table[retire_ids[0]];
|
||||
assign oldest_pc = pc_table[retire_ids[0]];
|
||||
assign current_exception_unit = exception_unit_table[retire_ids[0]];
|
||||
end endgenerate
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
|
|
@ -166,7 +166,7 @@ module taiga
|
|||
|
||||
//Global Control
|
||||
exception_interface exception [NUM_EXCEPTION_SOURCES]();
|
||||
logic [$clog2(NUM_EXCEPTION_SOURCES)-1:0] current_exception;
|
||||
logic [$clog2(NUM_EXCEPTION_SOURCES)-1:0] current_exception_unit;
|
||||
|
||||
logic gc_init_clear;
|
||||
logic gc_fetch_hold;
|
||||
|
@ -282,7 +282,8 @@ module taiga
|
|||
.retire_ids (retire_ids),
|
||||
.retire_port_valid(retire_port_valid),
|
||||
.post_issue_count(post_issue_count),
|
||||
.oldest_pc (oldest_pc)
|
||||
.oldest_pc (oldest_pc),
|
||||
.current_exception_unit (current_exception_unit)
|
||||
);
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
|
@ -569,7 +570,7 @@ module taiga
|
|||
.gc_flush_required (gc_flush_required),
|
||||
.branch_flush (branch_flush),
|
||||
.exception (exception),
|
||||
.current_exception (current_exception),
|
||||
.current_exception_unit (current_exception_unit),
|
||||
.gc_exception (gc_exception),
|
||||
.oldest_pc (oldest_pc),
|
||||
.mret(mret),
|
||||
|
|
|
@ -91,6 +91,7 @@ package taiga_types;
|
|||
logic uses_rd;
|
||||
logic is_multicycle;
|
||||
id_t id;
|
||||
exception_sources_t exception_unit;
|
||||
logic stage_valid;
|
||||
fetch_metadata_t fetch_metadata;
|
||||
} issue_packet_t;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue