Skip to content

Commit

Permalink
Added the HPDC on the Bender. Added the tc_sram. Added no fpu config
Browse files Browse the repository at this point in the history
  • Loading branch information
OttG committed Feb 14, 2024
1 parent 405c244 commit 81754cd
Show file tree
Hide file tree
Showing 4 changed files with 266 additions and 47 deletions.
114 changes: 95 additions & 19 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,88 @@ sources:
- core/mmu_sv32/cva6_shared_tlb_sv32.sv
- core/cva6_accel_first_pass_decoder_stub.sv

- target: cv32a6_imafc_nfpu_sv32
files:
- core/include/cv32a6_imafc_nfpu_sv32_config_pkg.sv
- core/include/riscv_pkg.sv
- core/include/ariane_pkg.sv
- core/mmu_sv32/cva6_tlb_sv32.sv
- core/mmu_sv32/cva6_mmu_sv32.sv
- core/mmu_sv32/cva6_ptw_sv32.sv
- core/mmu_sv32/cva6_shared_tlb_sv32.sv
- core/cva6_accel_first_pass_decoder_stub.sv

# included via target core/include/${TARGET_CFG}_config_pkg.sv
# ariane_axi_pkg is dependent on this.
# - vendor/pulp-platform/axi/src/axi_pkg.sv

# Packages
- core/include/wt_cache_pkg.sv
- core/include/std_cache_pkg.sv
- core/include/acc_pkg.sv
- target: not(cv64a6_imafdc_sv39_hpdc)
files:
- core/include/wt_cache_pkg.sv
- core/include/std_cache_pkg.sv
- core/include/acc_pkg.sv

- target: cv64a6_imafdc_sv39_hpdc
include_dirs:
- core/cache_subsystem/hpdcache/rtl/include
files:
- core/include/cv64a6_imafdc_sv39_hpdcache_config_pkg.sv
- core/include/cva6_hpdcache_default_config_pkg.sv
- core/include/riscv_pkg.sv
- core/include/ariane_pkg.sv
- core/include/wt_cache_pkg.sv
- core/mmu_sv39/tlb.sv
- core/mmu_sv39/mmu.sv
- core/mmu_sv39/ptw.sv
# - core/cache_subsystem/hpdcache/rtl/src/target/cva6/cva6_hpdcache_params_pkg.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_pkg.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_demux.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_sync_buffer.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_fifo_reg.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_fxarb.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_rrarb.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_mux.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_prio_1hot_encoder.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_sram.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_sram_wbyteenable.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_sram_wmask.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_regbank_wbyteenable_1rw.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_regbank_wmask_1rw.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_data_downsize.sv
- core/cache_subsystem/hpdcache/rtl/src/common/hpdcache_data_upsize.sv
- core/cache_subsystem/hpdcache/rtl/src/hwpf_stride/hwpf_stride_pkg.sv
- core/cache_subsystem/hpdcache/rtl/src/hwpf_stride/hwpf_stride.sv
- core/cache_subsystem/hpdcache/rtl/src/hwpf_stride/hwpf_stride_arb.sv
- core/cache_subsystem/hpdcache/rtl/src/hwpf_stride/hwpf_stride_snooper.sv
- core/cache_subsystem/hpdcache/rtl/src/hwpf_stride/hwpf_stride_wrapper.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_amo.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_cmo.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_core_arbiter.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_ctrl.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_ctrl_pe.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_memarray.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_memctrl.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_miss_handler.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_mshr.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_mshr_to_cache_set.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_plru.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_rtab.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_uncached.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_wbuf.sv
- core/cache_subsystem/hpdcache/rtl/src/hpdcache_wbuf_wrapper.sv
- core/cache_subsystem/hpdcache/rtl/src/utils/hpdcache_mem_req_read_arbiter.sv
- core/cache_subsystem/hpdcache/rtl/src/utils/hpdcache_mem_req_write_arbiter.sv
- core/cache_subsystem/hpdcache/rtl/src/utils/hpdcache_mem_resp_demux.sv
- core/cache_subsystem/hpdcache/rtl/src/utils/hpdcache_mem_to_axi_read.sv
- core/cache_subsystem/hpdcache/rtl/src/utils/hpdcache_mem_to_axi_write.sv
- core/cache_subsystem/cva6_hpdcache_subsystem.sv
- core/cache_subsystem/cva6_hpdcache_subsystem_axi_arbiter.sv
- core/cache_subsystem/cva6_hpdcache_if_adapter.sv
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_1rw.sv
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_wbyteenable_1rw.sv
- core/cache_subsystem/hpdcache/rtl/src/common/macros/behav/hpdcache_sram_wmask_1rw.sv

# for all the below files use Flist.cva6 as baseline and also look at Makefile pd/synth
# CVXIF
Expand Down Expand Up @@ -178,21 +252,24 @@ sources:
- core/frontend/frontend.sv

# Cache subsystem
- core/cache_subsystem/wt_dcache_ctrl.sv
- core/cache_subsystem/wt_dcache_mem.sv
- core/cache_subsystem/wt_dcache_missunit.sv
- core/cache_subsystem/wt_dcache_wbuffer.sv
- core/cache_subsystem/wt_dcache.sv
- target: not(cv64a6_imafdc_sv39_hpdc)
files:
- core/cache_subsystem/wt_dcache_ctrl.sv
- core/cache_subsystem/wt_dcache_mem.sv
- core/cache_subsystem/wt_dcache_missunit.sv
- core/cache_subsystem/wt_dcache_wbuffer.sv
- core/cache_subsystem/wt_dcache.sv
- core/cache_subsystem/wt_cache_subsystem.sv
- core/cache_subsystem/wt_axi_adapter.sv
- core/cache_subsystem/tag_cmp.sv
- core/cache_subsystem/axi_adapter.sv
- core/cache_subsystem/miss_handler.sv
- core/cache_subsystem/cache_ctrl.sv
- core/cache_subsystem/std_nbdcache.sv
- core/cache_subsystem/std_cache_subsystem.sv

- core/cache_subsystem/cva6_icache.sv
- core/cache_subsystem/wt_cache_subsystem.sv
- core/cache_subsystem/wt_axi_adapter.sv
- core/cache_subsystem/tag_cmp.sv
- core/cache_subsystem/cva6_icache_axi_wrapper.sv
- core/cache_subsystem/axi_adapter.sv
- core/cache_subsystem/miss_handler.sv
- core/cache_subsystem/cache_ctrl.sv
- core/cache_subsystem/std_nbdcache.sv
- core/cache_subsystem/std_cache_subsystem.sv

# Physical Memory Protection
# NOTE: pmp.sv modified for DSIM (unchanged for other simulators)
Expand All @@ -208,9 +285,8 @@ sources:
include_dirs:
- common/local/util
files:
# The sram wrapper is needed fro the RTL test
# - common/local/util/tc_sram_wrapper.sv
# - vendor/pulp-platform/tech_cells_generic/src/rtl/tc_sram.sv
- common/local/util/tc_sram_wrapper.sv
- vendor/pulp-platform/tech_cells_generic/src/rtl/tc_sram.sv

- target: all(fpga, xilinx)
include_dirs:
Expand Down
2 changes: 0 additions & 2 deletions common/local/util/tc_sram_wrapper.sv
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ module tc_sram_wrapper #(
output data_t [NumPorts-1:0] rdata_o // read data
);

// synthesis translate_off

tc_sram #(
.NumWords(NumWords),
Expand All @@ -55,6 +54,5 @@ module tc_sram_wrapper #(
.rdata_o ( rdata_o )
);

// synthesis translate_on

endmodule
44 changes: 18 additions & 26 deletions core/cache_subsystem/wt_dcache_ctrl.sv
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,7 @@ module wt_dcache_ctrl
// speculatively request cache line
rd_req_o = 1'b1;

// kill -> go back to IDLE
if (req_port_i.kill_req) begin
state_d = IDLE;
req_port_o.data_rvalid = 1'b1;
end else if (req_port_i.tag_valid | state_q == REPLAY_READ) begin
if (req_port_i.tag_valid | state_q == REPLAY_READ) begin
save_tag = (state_q != REPLAY_READ);
if (wr_cl_vld_i || !rd_ack_q) begin
state_d = REPLAY_REQ;
Expand All @@ -168,7 +164,7 @@ module wt_dcache_ctrl
state_d = READ;
req_port_o.data_gnt = 1'b1;
end
// we've got a miss
// we've got a miss
end else begin
state_d = MISS_REQ;
end
Expand All @@ -179,14 +175,7 @@ module wt_dcache_ctrl
MISS_REQ: begin
miss_req_o = 1'b1;

if (req_port_i.kill_req) begin
req_port_o.data_rvalid = 1'b1;
if (miss_ack_i) begin
state_d = KILL_MISS;
end else begin
state_d = KILL_MISS_ACK;
end
end else if (miss_replay_i) begin
if (miss_replay_i) begin
state_d = REPLAY_REQ;
end else if (miss_ack_i) begin
state_d = MISS_WAIT;
Expand All @@ -196,14 +185,7 @@ module wt_dcache_ctrl
// wait until the memory transaction
// returns.
MISS_WAIT: begin
if (req_port_i.kill_req) begin
req_port_o.data_rvalid = 1'b1;
if (miss_rtrn_vld_i) begin
state_d = IDLE;
end else begin
state_d = KILL_MISS;
end
end else if (miss_rtrn_vld_i) begin
if (miss_rtrn_vld_i) begin
state_d = IDLE;
req_port_o.data_rvalid = 1'b1;
end
Expand All @@ -212,10 +194,8 @@ module wt_dcache_ctrl
// replay read request
REPLAY_REQ: begin
rd_req_o = 1'b1;
if (req_port_i.kill_req) begin
req_port_o.data_rvalid = 1'b1;
state_d = IDLE;
end else if (rd_ack_i) begin

if (rd_ack_i) begin
state_d = REPLAY_READ;
end
end
Expand Down Expand Up @@ -244,6 +224,18 @@ module wt_dcache_ctrl
state_d = IDLE;
end
endcase // state_q

if (req_port_i.kill_req) begin
state_d = IDLE;
req_port_o.data_rvalid = 1'b1;
if (state_q == MISS_WAIT && !miss_rtrn_vld_i) begin
state_d = KILL_MISS;
end else if (state_q == MISS_REQ && miss_ack_i) begin
state_d = KILL_MISS;
end else if (state_q == MISS_REQ) begin
state_d = KILL_MISS_ACK;
end
end
end

///////////////////////////////////////////////////////
Expand Down
153 changes: 153 additions & 0 deletions core/include/cv32a6_imafc_nfpu_sv32_config_pkg.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
// Copyright 2021 Thales DIS design services SAS
//
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.0
// You may obtain a copy of the License at https://solderpad.org/licenses/
//
// Original Author: Jean-Roch COULON - Thales


package cva6_config_pkg;

localparam CVA6ConfigXlen = 32;

localparam CVA6ConfigFpuEn = 0;
localparam CVA6ConfigF16En = 0;
localparam CVA6ConfigF16AltEn = 0;
localparam CVA6ConfigF8En = 0;
localparam CVA6ConfigFVecEn = 0;

localparam CVA6ConfigCvxifEn = 0;
localparam CVA6ConfigCExtEn = 1;
localparam CVA6ConfigZcbExtEn = 0;
localparam CVA6ConfigAExtEn = 1;
localparam CVA6ConfigBExtEn = 0;
localparam CVA6ConfigVExtEn = 0;
localparam CVA6ConfigZiCondExtEn = 0;

localparam CVA6ConfigAxiIdWidth = 4;
localparam CVA6ConfigAxiAddrWidth = 64;
localparam CVA6ConfigAxiDataWidth = 64;
localparam CVA6ConfigFetchUserEn = 0;
localparam CVA6ConfigFetchUserWidth = CVA6ConfigXlen;
localparam CVA6ConfigDataUserEn = 0;
localparam CVA6ConfigDataUserWidth = CVA6ConfigXlen;

localparam CVA6ConfigIcacheByteSize = 16384;
localparam CVA6ConfigIcacheSetAssoc = 4;
localparam CVA6ConfigIcacheLineWidth = 128;
localparam CVA6ConfigDcacheByteSize = 32768;
localparam CVA6ConfigDcacheSetAssoc = 8;
localparam CVA6ConfigDcacheLineWidth = 128;

localparam CVA6ConfigDcacheIdWidth = 1;
localparam CVA6ConfigMemTidWidth = 2;

localparam CVA6ConfigWtDcacheWbufDepth = 8;

localparam CVA6ConfigNrCommitPorts = 2;
localparam CVA6ConfigNrScoreboardEntries = 8;

localparam CVA6ConfigFPGAEn = 0;

localparam CVA6ConfigNrLoadPipeRegs = 1;
localparam CVA6ConfigNrStorePipeRegs = 0;
localparam CVA6ConfigNrLoadBufEntries = 2;

localparam CVA6ConfigInstrTlbEntries = 2;
localparam CVA6ConfigDataTlbEntries = 2;

localparam CVA6ConfigRASDepth = 2;
localparam CVA6ConfigBTBEntries = 32;
localparam CVA6ConfigBHTEntries = 128;

localparam CVA6ConfigTvalEn = 1;

localparam CVA6ConfigNrPMPEntries = 8;

localparam CVA6ConfigPerfCounterEn = 1;

localparam config_pkg::cache_type_t CVA6ConfigDcacheType = config_pkg::WT;

localparam CVA6ConfigMmuPresent = 1;

localparam CVA6ConfigRvfiTrace = 0;

localparam config_pkg::cva6_cfg_t cva6_cfg = '{
NrCommitPorts: unsigned'(CVA6ConfigNrCommitPorts),
AxiAddrWidth: unsigned'(CVA6ConfigAxiAddrWidth),
AxiDataWidth: unsigned'(CVA6ConfigAxiDataWidth),
AxiIdWidth: unsigned'(CVA6ConfigAxiIdWidth),
AxiUserWidth: unsigned'(CVA6ConfigDataUserWidth),
NrLoadBufEntries: unsigned'(CVA6ConfigNrLoadBufEntries),
FpuEn: bit'(CVA6ConfigFpuEn),
XF16: bit'(CVA6ConfigF16En),
XF16ALT: bit'(CVA6ConfigF16AltEn),
XF8: bit'(CVA6ConfigF8En),
RVA: bit'(CVA6ConfigAExtEn),
RVB: bit'(CVA6ConfigBExtEn),
RVV: bit'(CVA6ConfigVExtEn),
RVC: bit'(CVA6ConfigCExtEn),
RVZCB: bit'(CVA6ConfigZcbExtEn),
XFVec: bit'(CVA6ConfigFVecEn),
CvxifEn: bit'(CVA6ConfigCvxifEn),
ZiCondExtEn: bit'(CVA6ConfigZiCondExtEn),
// Extended
RVF:
bit'(
0
),
RVD: bit'(0),
FpPresent: bit'(0),
NSX: bit'(0),
FLen: unsigned'(0),
RVFVec: bit'(0),
XF16Vec: bit'(0),
XF16ALTVec: bit'(0),
XF8Vec: bit'(0),
NrRgprPorts: unsigned'(0),
NrWbPorts: unsigned'(0),
EnableAccelerator: bit'(0),
RVS: bit'(1),
RVU: bit'(1),
HaltAddress: 64'h800,
ExceptionAddress: 64'h808,
RASDepth: unsigned'(CVA6ConfigRASDepth),
BTBEntries: unsigned'(CVA6ConfigBTBEntries),
BHTEntries: unsigned'(CVA6ConfigBHTEntries),
DmBaseAddress: 64'h0,
TvalEn: bit'(CVA6ConfigTvalEn),
NrPMPEntries: unsigned'(CVA6ConfigNrPMPEntries),
PMPCfgRstVal: {16{64'h0}},
PMPAddrRstVal: {16{64'h0}},
PMPEntryReadOnly: 16'd0,
NOCType: config_pkg::NOC_TYPE_AXI4_ATOP,
// idempotent region
NrNonIdempotentRules:
unsigned'(
2
),
NonIdempotentAddrBase: 1024'({64'b0, 64'b0}),
NonIdempotentLength: 1024'({64'b0, 64'b0}),
NrExecuteRegionRules: unsigned'(3),
// DRAM, Boot ROM, Debug Module
ExecuteRegionAddrBase:
1024'(
{64'h8000_0000, 64'h1_0000, 64'h0}
),
ExecuteRegionLength: 1024'({64'h40000000, 64'h10000, 64'h1000}),
// cached region
NrCachedRegionRules:
unsigned'(
1
),
CachedRegionAddrBase: 1024'({64'h8000_0000}),
CachedRegionLength: 1024'({64'h40000000}),
MaxOutstandingStores: unsigned'(7),
DebugEn: bit'(1),
NonIdemPotenceEn: bit'(0),
AxiBurstWriteEn: bit'(0)
};

endpackage

0 comments on commit 81754cd

Please sign in to comment.