Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HW] Optimize addrgen for OS-on operation #383

Merged
merged 4 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Pre-calculate timing-critical addresses before addrgen stage
- Update all GitHub Actions for CI
- Update READMEs with FPGA implementation instructions
- Optimize `addrgen` timing for OS-on operation
- Enable OS by default

## 3.0.0 - 2023-09-08

Expand Down
15 changes: 11 additions & 4 deletions hardware/src/ara.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module ara import ara_pkg::*; #(
// RVV Parameters
parameter int unsigned NrLanes = 0, // Number of parallel vector lanes.
parameter int unsigned VLEN = 0, // VLEN [bit]
parameter int unsigned OSSupport = 0,
parameter int unsigned OSSupport = 1,
// Support for floating-point data types
parameter fpu_support_e FPUSupport = FPUSupportHalfSingleDouble,
// External support for vfrec7, vfrsqrt7
Expand Down Expand Up @@ -52,6 +52,7 @@ module ara import ara_pkg::*; #(
input axi_resp_t axi_resp_i
);

`include "common_cells/registers.svh"
`include "ara/ara_typedef.svh"
import cf_math_pkg::idx_width;

Expand Down Expand Up @@ -433,22 +434,24 @@ module ara import ara_pkg::*; #(
logic vstu_mask_ready;

// Optional OS support
logic acc_mmu_misaligned_ex, acc_mmu_req, acc_mmu_is_store, acc_mmu_dtlb_hit, acc_mmu_valid, acc_mmu_en;
logic acc_mmu_misaligned_ex, acc_mmu_req, acc_mmu_is_store, acc_mmu_dtlb_hit, acc_mmu_valid;
logic acc_mmu_en, acc_mmu_en_q;
logic [riscv::VLEN-1:0] acc_mmu_vaddr;
logic [riscv::PLEN-1:0] acc_mmu_paddr;
logic [riscv::PPNW-1:0] acc_mmu_dtlb_ppn;
ariane_pkg::exception_t acc_mmu_exception;

if (OSSupport) begin
assign acc_resp_o.acc_mmu_req.acc_mmu_misaligned_ex = acc_mmu_misaligned_ex;
assign acc_resp_o.acc_mmu_req.acc_mmu_req = acc_mmu_req;
assign acc_resp_o.acc_mmu_req.acc_mmu_vaddr = acc_mmu_vaddr;
assign acc_resp_o.acc_mmu_req.acc_mmu_is_store = acc_mmu_is_store;
assign acc_mmu_en = acc_req_i.acc_mmu_en;
assign acc_mmu_dtlb_hit = acc_req_i.acc_mmu_resp.acc_mmu_dtlb_hit;
assign acc_mmu_dtlb_ppn = acc_req_i.acc_mmu_resp.acc_mmu_dtlb_ppn;
assign acc_mmu_valid = acc_req_i.acc_mmu_resp.acc_mmu_valid;
assign acc_mmu_paddr = acc_req_i.acc_mmu_resp.acc_mmu_paddr;
assign acc_mmu_exception = acc_req_i.acc_mmu_resp.acc_mmu_exception;
assign acc_mmu_en = acc_req_i.acc_mmu_en;
end else begin
assign acc_resp_o.acc_mmu_req.acc_mmu_misaligned_ex = '0;
assign acc_resp_o.acc_mmu_req.acc_mmu_req = '0;
Expand All @@ -462,6 +465,10 @@ module ara import ara_pkg::*; #(
assign acc_mmu_exception = '0;
end

// Break path for acc_mmu_en. This signal can afford some additional latency
// since vector mem ops take multiple cycles to reach the addrgen
`FF(acc_mmu_en_q, acc_mmu_en, '0, clk_i, rst_ni);

vlsu #(
.NrLanes (NrLanes ),
.VLEN (VLEN ),
Expand Down Expand Up @@ -515,7 +522,7 @@ module ara import ara_pkg::*; #(
.addrgen_operand_valid_i (sldu_addrgen_operand_valid ),
.addrgen_operand_ready_o (addrgen_operand_ready ),
// CSR input
.en_ld_st_translation_i (acc_req_i.acc_mmu_en ),
.en_ld_st_translation_i (acc_mmu_en_q ),
// Interface with CVA6's sv39 MMU
.mmu_misaligned_ex_o (acc_mmu_misaligned_ex ),
.mmu_req_o (acc_mmu_req ),
Expand Down
2 changes: 1 addition & 1 deletion hardware/src/ara_soc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module ara_soc import axi_pkg::*; import ara_pkg::*; #(
// RVV Parameters
parameter int unsigned NrLanes = 0, // Number of parallel vector lanes.
parameter int unsigned VLEN = 0, // VLEN [bit]
parameter int unsigned OSSupport = 0, // Support for OS
parameter int unsigned OSSupport = 1, // Support for OS
// Support for floating-point data types
parameter fpu_support_e FPUSupport = FPUSupportHalfSingleDouble,
// External support for vfrec7, vfrsqrt7
Expand Down
2 changes: 1 addition & 1 deletion hardware/src/ara_system.sv
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module ara_system import axi_pkg::*; import ara_pkg::*; #(
// RVV Parameters
parameter int unsigned NrLanes = 0, // Number of parallel vector lanes.
parameter int unsigned VLEN = 0, // VLEN [bit]
parameter int unsigned OSSupport = 0, // Support for floating-point data types
parameter int unsigned OSSupport = 1, // Support for floating-point data types
parameter fpu_support_e FPUSupport = FPUSupportHalfSingleDouble,
// External support for vfrec7, vfrsqrt7
parameter fpext_support_e FPExtSupport = FPExtSupportEnable,
Expand Down
Loading
Loading