mirror of
https://github.com/openhwgroup/cva6.git
synced 2025-04-23 21:57:11 -04:00
Code_coverage: Add conditions for the MMU (#1507)
This commit is contained in:
parent
bb80b3f245
commit
ed5d42f1db
4 changed files with 40 additions and 31 deletions
|
@ -1084,7 +1084,7 @@ module csr_regfile import ariane_pkg::*; #(
|
|||
// ------------------------------
|
||||
// Set the address translation at which the load and stores should occur
|
||||
// we can use the previous values since changing the address translation will always involve a pipeline flush
|
||||
if (mprv && riscv::vm_mode_t'(satp_q.mode) == riscv::MODE_SV && (mstatus_q.mpp != riscv::PRIV_LVL_M))
|
||||
if (ariane_pkg::MMU_PRESENT && mprv && riscv::vm_mode_t'(satp_q.mode) == riscv::MODE_SV && (mstatus_q.mpp != riscv::PRIV_LVL_M))
|
||||
en_ld_st_translation_d = 1'b1;
|
||||
else // otherwise we go with the regular settings
|
||||
en_ld_st_translation_d = en_translation_o;
|
||||
|
|
|
@ -447,7 +447,7 @@ module load_store_unit import ariane_pkg::*; #(
|
|||
end
|
||||
end
|
||||
|
||||
if (en_ld_st_translation_i && lsu_ctrl.overflow) begin
|
||||
if (ariane_pkg::MMU_PRESENT && en_ld_st_translation_i && lsu_ctrl.overflow) begin
|
||||
|
||||
if (lsu_ctrl.fu == LOAD) begin
|
||||
misaligned_exception = {
|
||||
|
|
|
@ -216,15 +216,17 @@ module load_unit import ariane_pkg::*; #(
|
|||
if (!req_port_i.data_gnt) begin
|
||||
state_d = WAIT_GNT;
|
||||
end else begin
|
||||
if (dtlb_hit_i && !stall_ni) begin
|
||||
// we got a grant and a hit on the DTLB so we can send the tag in the next cycle
|
||||
state_d = SEND_TAG;
|
||||
pop_ld_o = 1'b1;
|
||||
// translation valid but this is to NC and the WB is not yet empty.
|
||||
end else if (dtlb_hit_i && stall_ni) begin
|
||||
state_d = ABORT_TRANSACTION_NI;
|
||||
end else begin // TLB miss
|
||||
if (ariane_pkg::MMU_PRESENT && !dtlb_hit_i) begin
|
||||
state_d = ABORT_TRANSACTION;
|
||||
end else begin
|
||||
if (!stall_ni) begin
|
||||
// we got a grant and a hit on the DTLB so we can send the tag in the next cycle
|
||||
state_d = SEND_TAG;
|
||||
pop_ld_o = 1'b1;
|
||||
// translation valid but this is to NC and the WB is not yet empty.
|
||||
end else begin
|
||||
state_d = ABORT_TRANSACTION_NI;
|
||||
end
|
||||
end
|
||||
end
|
||||
end else begin
|
||||
|
@ -281,16 +283,19 @@ module load_unit import ariane_pkg::*; #(
|
|||
// we finally got a data grant
|
||||
if (req_port_i.data_gnt) begin
|
||||
// so we send the tag in the next cycle
|
||||
if (dtlb_hit_i && !stall_ni) begin
|
||||
state_d = SEND_TAG;
|
||||
pop_ld_o = 1'b1;
|
||||
// translation valid but this is to NC and the WB is not yet empty.
|
||||
end else if (dtlb_hit_i && stall_ni) begin
|
||||
state_d = ABORT_TRANSACTION_NI;
|
||||
end else begin
|
||||
// should we not have hit on the TLB abort this transaction an retry later
|
||||
if (ariane_pkg::MMU_PRESENT && !dtlb_hit_i) begin
|
||||
state_d = ABORT_TRANSACTION;
|
||||
end else begin
|
||||
if (!stall_ni) begin
|
||||
// we got a grant and a hit on the DTLB so we can send the tag in the next cycle
|
||||
state_d = SEND_TAG;
|
||||
pop_ld_o = 1'b1;
|
||||
// translation valid but this is to NC and the WB is not yet empty.
|
||||
end else begin
|
||||
state_d = ABORT_TRANSACTION_NI;
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
// otherwise we keep waiting on our grant
|
||||
end
|
||||
|
@ -312,15 +317,17 @@ module load_unit import ariane_pkg::*; #(
|
|||
state_d = WAIT_GNT;
|
||||
end else begin
|
||||
// we got a grant so we can send the tag in the next cycle
|
||||
if (dtlb_hit_i && !stall_ni) begin
|
||||
// we got a grant and a hit on the DTLB so we can send the tag in the next cycle
|
||||
state_d = SEND_TAG;
|
||||
pop_ld_o = 1'b1;
|
||||
// translation valid but this is to NC and the WB is not yet empty.
|
||||
end else if (dtlb_hit_i && stall_ni) begin
|
||||
state_d = ABORT_TRANSACTION_NI;
|
||||
if (ariane_pkg::MMU_PRESENT && !dtlb_hit_i) begin
|
||||
state_d = ABORT_TRANSACTION;
|
||||
end else begin
|
||||
state_d = ABORT_TRANSACTION;// we missed on the TLB -> wait for the translation
|
||||
if (!stall_ni) begin
|
||||
// we got a grant and a hit on the DTLB so we can send the tag in the next cycle
|
||||
state_d = SEND_TAG;
|
||||
pop_ld_o = 1'b1;
|
||||
// translation valid but this is to NC and the WB is not yet empty.
|
||||
end else begin
|
||||
state_d = ABORT_TRANSACTION_NI;
|
||||
end
|
||||
end
|
||||
end
|
||||
end else begin
|
||||
|
|
|
@ -97,7 +97,7 @@ module store_unit import ariane_pkg::*; #(
|
|||
pop_st_o = 1'b1;
|
||||
// check if translation was valid and we have space in the store buffer
|
||||
// otherwise simply stall
|
||||
if (!dtlb_hit_i) begin
|
||||
if (ariane_pkg::MMU_PRESENT && !dtlb_hit_i) begin
|
||||
state_d = WAIT_TRANSLATION;
|
||||
pop_st_o = 1'b0;
|
||||
end
|
||||
|
@ -124,7 +124,7 @@ module store_unit import ariane_pkg::*; #(
|
|||
state_d = VALID_STORE;
|
||||
pop_st_o = 1'b1;
|
||||
|
||||
if (!dtlb_hit_i) begin
|
||||
if (ariane_pkg::MMU_PRESENT && !dtlb_hit_i) begin
|
||||
state_d = WAIT_TRANSLATION;
|
||||
pop_st_o = 1'b0;
|
||||
end
|
||||
|
@ -153,10 +153,12 @@ module store_unit import ariane_pkg::*; #(
|
|||
// but we know that the store queue is not full as we could only have landed here if
|
||||
// it wasn't full
|
||||
WAIT_TRANSLATION: begin
|
||||
translation_req_o = 1'b1;
|
||||
if(ariane_pkg::MMU_PRESENT) begin
|
||||
translation_req_o = 1'b1;
|
||||
|
||||
if (dtlb_hit_i) begin
|
||||
state_d = IDLE;
|
||||
if (dtlb_hit_i) begin
|
||||
state_d = IDLE;
|
||||
end
|
||||
end
|
||||
end
|
||||
endcase
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue