Skip to content

Commit

Permalink
Add cv32e40x fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmallasen committed Apr 16, 2024
1 parent 4072a72 commit 412ce9d
Show file tree
Hide file tree
Showing 7 changed files with 331 additions and 2 deletions.
4 changes: 4 additions & 0 deletions hw/vendor/openhwgroup_cv32e40x/rtl/cv32e40x_controller.sv
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ module cv32e40x_controller import cv32e40x_pkg::*;

// eXtension interface
if_xif.cpu_commit xif_commit_if,
input logic xif_mem_valid_i,
input logic xif_mem_ready_i,
input xif_csr_error_i
);

Expand Down Expand Up @@ -239,6 +241,8 @@ module cv32e40x_controller import cv32e40x_pkg::*;

// eXtension interface
.xif_commit_if ( xif_commit_if ),
.xif_mem_valid_i ( xif_mem_valid_i ),
.xif_mem_ready_i ( xif_mem_ready_i ),
.xif_csr_error_i ( xif_csr_error_i )
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ module cv32e40x_controller_fsm import cv32e40x_pkg::*;

// eXtension interface
if_xif.cpu_commit xif_commit_if,
input logic xif_mem_valid_i,
input logic xif_mem_ready_i,
input xif_csr_error_i
);

Expand Down Expand Up @@ -1495,7 +1497,7 @@ module cv32e40x_controller_fsm import cv32e40x_pkg::*;
commit_valid_q <= 1'b0;
commit_kill_q <= 1'b0;
end else begin
if ((ex_valid_i && wb_ready_i) || ctrl_fsm_o.kill_ex) begin
if ((ex_valid_i && wb_ready_i) || ctrl_fsm_o.kill_ex || (xif_mem_valid_i && xif_mem_ready_i)) begin
commit_valid_q <= 1'b0;
commit_kill_q <= 1'b0;
end else begin
Expand Down
4 changes: 4 additions & 0 deletions hw/vendor/openhwgroup_cv32e40x/rtl/cv32e40x_core.sv
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ module cv32e40x_core import cv32e40x_pkg::*;

// eXtension interface
.xif_issue_if ( xif_issue_if ),
.xif_mem_valid_i ( xif_mem_if.mem_valid ),
.xif_mem_ready_i ( xif_mem_if.mem_ready ),
.xif_offloading_o ( xif_offloading_id )
);

Expand Down Expand Up @@ -1005,6 +1007,8 @@ module cv32e40x_core import cv32e40x_pkg::*;

// eXtension interface
.xif_commit_if ( xif_commit_if ),
.xif_mem_valid_i ( xif_mem_if.mem_valid ),
.xif_mem_ready_i ( xif_mem_if.mem_ready ),
.xif_csr_error_i ( xif_csr_error_ex )
);

Expand Down
4 changes: 4 additions & 0 deletions hw/vendor/openhwgroup_cv32e40x/rtl/cv32e40x_id_stage.sv
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ module cv32e40x_id_stage import cv32e40x_pkg::*;

// eXtension interface
if_xif.cpu_issue xif_issue_if,
input logic xif_mem_valid_i,
input logic xif_mem_ready_i,
output logic xif_offloading_o
);

Expand Down Expand Up @@ -681,6 +683,8 @@ module cv32e40x_id_stage import cv32e40x_pkg::*;

end else if (ex_ready_i) begin
id_ex_pipe_o.instr_valid <= 1'b0;
end else if (xif_mem_valid_i && xif_mem_ready_i) begin
id_ex_pipe_o.instr_valid <= 1'b0;
end
end
end
Expand Down
5 changes: 4 additions & 1 deletion hw/vendor/openhwgroup_cv32e40x/rtl/cv32e40x_if_stage.sv
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ module cv32e40x_if_stage import cv32e40x_pkg::*;

if_id_pipe_o.priv_lvl <= prefetch_priv_lvl;
if_id_pipe_o.trigger_match <= trigger_match_i;
if_id_pipe_o.xif_id <= xif_id;
if_id_pipe_o.last_op <= last_op_o;
if_id_pipe_o.first_op <= first_op_o;
if_id_pipe_o.abort_op <= abort_op_o;
Expand Down Expand Up @@ -478,6 +477,10 @@ module cv32e40x_if_stage import cv32e40x_pkg::*;
end else if (id_ready_i) begin
if_id_pipe_o.instr_valid <= 1'b0;
end
// Update the xif_id whenever the ID stage attempts to offload an instruction
if (id_ready_i && xif_offloading_id_i) begin
if_id_pipe_o.xif_id <= xif_id;
end
end
end

Expand Down
Loading

0 comments on commit 412ce9d

Please sign in to comment.