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

update cve2 #284

Merged
merged 23 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
3 changes: 2 additions & 1 deletion core-v-mini-mcu.core
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ filesets:
- x-heep::packages
- openhwgroup.org:ip:cv32e40p
- openhwgroup.org:ip:cv32e40x
- openhwgroup.org:ip:cve2
- openhwgroup:cve2:cve2_top
- esl_epfl:ip:cv32e40px
- pulp-platform.org:ip:gpio
- pulp-platform.org::common_cells
Expand Down Expand Up @@ -351,6 +351,7 @@ targets:
- -override_timescale 1ns/1ps
- -suppress vlog-2583
- -suppress vlog-2577
- -suppress vlog-2720
- -pedanticerrors
- -define MODELSIM
vsim_options:
Expand Down
82 changes: 9 additions & 73 deletions hw/core-v-mini-mcu/cpu_subsystem.sv
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,16 @@ module cpu_subsystem

if (CPU_TYPE == cv32e20) begin : gen_cv32e20

logic [4:0] rf_raddr_a, rf_raddr_b, rf_waddr_wb;
logic [31:0] rf_rdata_a, rf_rdata_b, rf_wdata_wb;
logic rf_we_wb;

import ibex_pkg::*;

ibex_core #(
cve2_top #(
.DmHaltAddr(DM_HALTADDRESS),
.DmExceptionAddr(32'h0),
.DbgTriggerEn(1'b1),
.ResetAll(1'b1)
.DmExceptionAddr('0)
) cv32e20_i (
.clk_i (clk_i),
.rst_ni(rst_ni),

.test_en_i(1'b0),
.ram_cfg_i('0),

.hart_id_i (32'h0),
.boot_addr_i(BOOT_ADDR),

Expand All @@ -94,79 +89,20 @@ module cpu_subsystem
.data_rvalid_i(core_data_resp_i.rvalid),
.data_err_i (1'b0),

.dummy_instr_id_o (),
.rf_raddr_a_o (rf_raddr_a),
.rf_raddr_b_o (rf_raddr_b),
.rf_waddr_wb_o (rf_waddr_wb),
.rf_we_wb_o (rf_we_wb),
.rf_wdata_wb_ecc_o(rf_wdata_wb),
.rf_rdata_a_ecc_i (rf_rdata_a),
.rf_rdata_b_ecc_i (rf_rdata_b),

.ic_tag_req_o (),
.ic_tag_write_o (),
.ic_tag_addr_o (),
.ic_tag_wdata_o (),
.ic_tag_rdata_i (),
.ic_data_req_o (),
.ic_data_write_o (),
.ic_data_addr_o (),
.ic_data_wdata_o (),
.ic_data_rdata_i (),
.ic_scr_key_valid_i(),

.irq_software_i(irq_i[3]),
.irq_timer_i (irq_i[7]),
.irq_external_i(irq_i[11]),
.irq_fast_i (irq_i[30:16]),
.irq_nm_i (irq_i[31]),
.irq_pending_o (),
.irq_fast_i (irq_i[31:16]),
.irq_nm_i (1'b0),

.debug_req_i(debug_req_i),
.debug_req_i (debug_req_i),
.crash_dump_o(),
.double_fault_seen_o(),

.fetch_enable_i(fetch_enable),
.alert_minor_o (),
.alert_major_o (),
.icache_inval_o(),
.core_sleep_o
);

cv32e40p_register_file #(
.ADDR_WIDTH(6)
) cv32e20_register_file_i (
// Clock and Reset
.clk (clk_i),
.rst_n(rst_ni),

.scan_cg_en_i(1'b0),

//Read port R1
.raddr_a_i({1'b0, rf_raddr_a}),
.rdata_a_o(rf_rdata_a),

//Read port R2
.raddr_b_i({1'b0, rf_raddr_b}),
.rdata_b_o(rf_rdata_b),

//Read port R3
.raddr_c_i('0),
.rdata_c_o(),

// Write port W1
.waddr_a_i({1'b0, rf_waddr_wb}),
.wdata_a_i(rf_wdata_wb),
.we_a_i(rf_we_wb),

// Write port W2
.waddr_b_i('0),
.wdata_b_i('0),
.we_b_i('0)
.core_sleep_o
);



assign irq_ack_o = '0;
assign irq_id_o = '0;

Expand Down
23 changes: 23 additions & 0 deletions hw/vendor/openhwgroup_cv32e20/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2023 OpenHW Group
# Solderpad Hardware License, Version 2.1, see LICENSE.md for details.
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1

# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

build:
os: "ubuntu-20.04"
tools:
python: "3.9"

# Build from the docs directory with Sphinx
sphinx:
configuration: doc/conf.py

# Explicitly set the Python requirements
python:
install:
- requirements: doc/requirements.txt
2 changes: 1 addition & 1 deletion hw/vendor/openhwgroup_cv32e20/bhv/cve2_sim_clock_gate.sv
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ module cve2_clock_gate (

assign clk_o = clk_i & clk_en;

endmodule // cv32e40p_clock_gate
endmodule // cve2_clock_gate
63 changes: 63 additions & 0 deletions hw/vendor/openhwgroup_cv32e20/cv32e20_manifest.flist
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2022 OpenHW Group
//
// Licensed under the Solderpad Hardware Licence, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://solderpad.org/licenses/
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
///////////////////////////////////////////////////////////////////////////////
//
// Manifest for the CV32E20 RTL model.
// - Format based on manifest used by other CORE-V cores.
// - Intended to be used by both synthesis and simulation.
// - Relevent synthesis and simulation scripts/Makefiles must set the shell
// ENV variable DESIGN_RTL_DIR as required.
//
// TODO: Replace once-and-for-all with unified manifest (FuseSoc?)
//
///////////////////////////////////////////////////////////////////////////////

+incdir+${DESIGN_RTL_DIR}/../shared/rtl/
+incdir+${DESIGN_RTL_DIR}/../rtl
+incdir+${DESIGN_RTL_DIR}/../shared/rtl/sim
+incdir+${DESIGN_RTL_DIR}/../vendor/lowrisc_ip/ip/prim/rtl
+incdir+${DESIGN_RTL_DIR}/../vendor/lowrisc_ip/dv/sv/dv_utils

${DESIGN_RTL_DIR}/cve2_pkg.sv
${DESIGN_RTL_DIR}/cve2_tracer_pkg.sv
${DESIGN_RTL_DIR}/../vendor/lowrisc_ip/ip/prim/rtl/prim_secded_pkg.sv
${DESIGN_RTL_DIR}/../vendor/lowrisc_ip/ip/prim/rtl/prim_ram_1p_pkg.sv
${DESIGN_RTL_DIR}/cve2_alu.sv
${DESIGN_RTL_DIR}/cve2_compressed_decoder.sv
${DESIGN_RTL_DIR}/cve2_controller.sv
${DESIGN_RTL_DIR}/cve2_cs_registers.sv
${DESIGN_RTL_DIR}/cve2_csr.sv
${DESIGN_RTL_DIR}/cve2_counter.sv
${DESIGN_RTL_DIR}/cve2_decoder.sv
${DESIGN_RTL_DIR}/cve2_ex_block.sv
${DESIGN_RTL_DIR}/cve2_fetch_fifo.sv
${DESIGN_RTL_DIR}/cve2_id_stage.sv
${DESIGN_RTL_DIR}/cve2_if_stage.sv
${DESIGN_RTL_DIR}/cve2_load_store_unit.sv
${DESIGN_RTL_DIR}/cve2_multdiv_fast.sv
${DESIGN_RTL_DIR}/cve2_multdiv_slow.sv
${DESIGN_RTL_DIR}/cve2_prefetch_buffer.sv
${DESIGN_RTL_DIR}/cve2_pmp.sv
${DESIGN_RTL_DIR}/cve2_register_file_ff.sv
${DESIGN_RTL_DIR}/cve2_wb.sv
${DESIGN_RTL_DIR}/cve2_core.sv
${DESIGN_RTL_DIR}/cve2_top.sv
${DESIGN_RTL_DIR}/cve2_top_tracing.sv
${DESIGN_RTL_DIR}/cve2_tracer.sv

${DESIGN_RTL_DIR}/../bhv/cve2_sim_clock_gate.sv
94 changes: 94 additions & 0 deletions hw/vendor/openhwgroup_cv32e20/cve2_configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Ibex configurations files, holds the parameter sets that are tested under CI.
# Each configuration must specify the same set of parameters

# Two-stage pipeline without additional branch target ALU and 3 cycle multiplier
# (4 cycles for mulh), resulting in 2 stall cycles for mul (3 for mulh)
small:
RV32E : 0
RV32M : "cve2_pkg::RV32MFast"
RV32B : "cve2_pkg::RV32BNone"
RegFile : "cve2_pkg::RegFileFF"
WritebackStage : 0
PMPEnable : 0
PMPGranularity : 0
PMPNumRegions : 4

# Configuration to match that used in the OpenTitan project
opentitan:
RV32E : 0
RV32M : "cve2_pkg::RV32MSingleCycle"
RV32B : "cve2_pkg::RV32BOTEarlGrey"
RegFile : "cve2_pkg::RegFileFF"
WritebackStage : 1
PMPEnable : 1
PMPGranularity : 0
PMPNumRegions : 16

# ===============================
# * EXPERIMENTAL CONFIGURATIONS *
# ===============================

# Three-stage pipeline with additional branch traget ALU and 1 cycle multiplier
# (2 cycles for mulh) so mul does not stall (mulh stall 1 cycles). This is the
# maximum performance configuration.
experimental-maxperf:
RV32E : 0
RV32M : "cve2_pkg::RV32MSingleCycle"
RV32B : "cve2_pkg::RV32BNone"
RegFile : "cve2_pkg::RegFileFF"
WritebackStage : 1
PMPEnable : 0
PMPGranularity : 0
PMPNumRegions : 4

# experimental-maxperf config above plus PMP enabled with 16 regions.
experimental-maxperf-pmp:
RV32E : 0
RV32M : "cve2_pkg::RV32MSingleCycle"
RV32B : "cve2_pkg::RV32BNone"
RegFile : "cve2_pkg::RegFileFF"
WritebackStage : 1
PMPEnable : 1
PMPGranularity : 0
PMPNumRegions : 16

# experimental-maxperf-pmp config above with balanced bitmanip extension
experimental-maxperf-pmp-bmbalanced:
RV32E : 0
RV32M : "cve2_pkg::RV32MSingleCycle"
RV32B : "cve2_pkg::RV32BBalanced"
RegFile : "cve2_pkg::RegFileFF"
WritebackStage : 1
PMPEnable : 1
PMPGranularity : 0
PMPNumRegions : 16

# experimental-maxperf-pmp config above with full bitmanip extension
experimental-maxperf-pmp-bmfull:
RV32E : 0
RV32M : "cve2_pkg::RV32MSingleCycle"
RV32B : "cve2_pkg::RV32BFull"
RegFile : "cve2_pkg::RegFileFF"
WritebackStage : 1
PMPEnable : 1
PMPGranularity : 0
PMPNumRegions : 16

# experimental-maxperf with branch predictor switched on. This exists to allow
# easy use of Ibex with the branch predictor in particular for CI runs. The
# branch predictor will be enabled in all the 'maxperf' configs after further
# development.
experimental-branch-predictor:
RV32E : 0
RV32M : "cve2_pkg::RV32MSingleCycle"
RV32B : "cve2_pkg::RV32BNone"
RegFile : "cve2_pkg::RegFileFF"
WritebackStage : 1
PMPEnable : 0
PMPGranularity : 0
PMPNumRegions : 4

Loading
Loading