Skip to content

Commit e7f5421

Browse files
committed
Merge branch 'cv32e40p' into 'master'
After !77 This PR replaces legacy `RI5CY` with `CV32E40P` in either the SoC (FC controller) and the cluster (8 core instances) **HW (RTL)**: - [x] Replace cv32e40p with OBI adapter into SoC - [x] Add FPU wrapper into SoC using APU connection. FPU is now instantiated in `fc_subsystem` - [x] Replace cv32e40p with OBI adapter into Cluster - [x] Add `pulp_clock_gating` tech cell for ASIC, disable clock gating for FPGA (as in RI5CY) **[TODO: do it properly without using `ifdef`]** (#85) - [x] Add one [performance counters test](https://github.com/pulp-platform/regression_tests/tree/cv32perf_counters/perf_counters) in assembly for cv32 to be executed with pulp-runtime **SW**: Main SW changes concerns: 1. Different mapping of the HW loops (`Xpulp` extensions) 2. Different structure and mapping of the performance counters 3. Enable clint timer irq (Freertos and RTL) - [x] Change `PULP RISCV GCC toolchain` version used in the CI with cv32e40p target with: `/usr/pack/riscv-1.0-kgf/pulp-gcc-2.2.0` - [x] Update `pulp-runtime` with cv32e40p target with: `v0.0.9` - [x] Update `FreeRTOS` version with cv32e40p target with: `570b2c1c` **MISC** - [x] Update README - [x] Update CHANGELOG - The testset has been previously overhauled in !63 and !65. In particular !63 removed some tests that used the legacy pulp-sdk and RI5CY and were not a fit anymore with cv32 Within this project boundary, there exits three issues tracked in #87, #86 and #85 that will be addressed in separate MRs Fixes #59 #60 #84
2 parents 456844a + 324e5ba commit e7f5421

7 files changed

Lines changed: 347 additions & 78 deletions

File tree

rtl/components/obi_pulp_adapter.sv

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright 2020 ETH Zurich and University of Bologna.
2+
// Copyright and related rights are licensed under the Solderpad Hardware
3+
// License, Version 0.51 (the "License"); you may not use this file except in
4+
// compliance with the License. You may obtain a copy of the License at
5+
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
6+
// or agreed to in writing, software, hardware and materials distributed under
7+
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
9+
// specific language governing permissions and limitations under the License.
10+
11+
// Author: Matteo Perotti, mperotti@iis.ee.ethz.ch
12+
// Description: Module to adapt CV32E40P to the PULP memory system.
13+
// It blocks multiple outstanding requests to the memory until the first one is served.
14+
15+
module obi_pulp_adapter (
16+
input logic rst_ni,
17+
input logic clk_i,
18+
// Master (core) interface
19+
input logic core_req_i,
20+
// Slave (memory) interface
21+
input logic mem_gnt_i,
22+
input logic mem_rvalid_i,
23+
output logic mem_req_o
24+
);
25+
26+
// CU states
27+
typedef enum logic {WAIT_GNT, WAIT_VALID} state_t;
28+
state_t ps, ns;
29+
30+
// FSM next-state sequential process
31+
always_ff @(posedge clk_i or negedge rst_ni) begin
32+
if (!rst_ni) begin
33+
ps <= WAIT_GNT;
34+
end else begin
35+
ps <= ns;
36+
end
37+
end
38+
39+
// Block multiple requests, as the memory does not support them
40+
// core_req_i is kept stable by cv32e40p (OBI compliant)
41+
always_comb begin
42+
case (ps)
43+
WAIT_GNT: begin
44+
// Idle state, the memory has not received any request yet
45+
mem_req_o = core_req_i;
46+
ns = (core_req_i && mem_gnt_i) ? WAIT_VALID : WAIT_GNT;
47+
end
48+
WAIT_VALID: begin
49+
// The memory has received and granted a request. Filter the next request until the memory is ready to accept it.
50+
mem_req_o = (core_req_i && mem_rvalid_i) ? 1'b1 : 1'b0;
51+
ns = (mem_rvalid_i && !mem_gnt_i) ? WAIT_GNT : WAIT_VALID;
52+
end
53+
default: begin
54+
mem_req_o = core_req_i;
55+
ns = WAIT_GNT;
56+
end
57+
endcase
58+
end
59+
60+
endmodule

rtl/fc/cv32e40p_fp_wrapper.sv

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
// Copyright 2018 ETH Zurich and University of Bologna.
2+
// Copyright and related rights are licensed under the Solderpad Hardware
3+
// License, Version 0.51 (the "License"); you may not use this file except in
4+
// compliance with the License. You may obtain a copy of the License at
5+
// http://solderpad.org/licenses/SHL-0.51. Unless required by applicable law
6+
// or agreed to in writing, software, hardware and materials distributed under
7+
// this License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8+
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
9+
// specific language governing permissions and limitations under the License.
10+
11+
// Wrapper for a fpnew
12+
// Contributor: Davide Schiavone <davide@openhwgroup.org>
13+
14+
module cv32e40p_fp_wrapper import cv32e40p_apu_core_pkg::*;
15+
(
16+
// Clock and Reset
17+
input logic clk_i,
18+
input logic rst_ni,
19+
20+
// APU Side: Master port
21+
input logic apu_req_i,
22+
output logic apu_gnt_o,
23+
24+
// request channel
25+
input logic [APU_NARGS_CPU-1:0][31:0] apu_operands_i,
26+
input logic [APU_WOP_CPU-1:0] apu_op_i,
27+
input logic [APU_NDSFLAGS_CPU-1:0] apu_flags_i,
28+
29+
// response channel
30+
output logic apu_rvalid_o,
31+
output logic [31:0] apu_rdata_o,
32+
output logic [APU_NUSFLAGS_CPU-1:0] apu_rflags_o
33+
);
34+
35+
36+
import cv32e40p_pkg::*;
37+
import fpnew_pkg::*;
38+
39+
logic [fpnew_pkg::OP_BITS-1:0] fpu_op;
40+
logic fpu_op_mod;
41+
logic fpu_vec_op;
42+
43+
logic [fpnew_pkg::FP_FORMAT_BITS-1:0] fpu_dst_fmt;
44+
logic [fpnew_pkg::FP_FORMAT_BITS-1:0] fpu_src_fmt;
45+
logic [fpnew_pkg::INT_FORMAT_BITS-1:0] fpu_int_fmt;
46+
logic [C_RM-1:0] fp_rnd_mode;
47+
48+
49+
50+
// assign apu_rID_o = '0;
51+
assign {fpu_vec_op, fpu_op_mod, fpu_op} = apu_op_i;
52+
53+
assign {fpu_int_fmt, fpu_src_fmt, fpu_dst_fmt, fp_rnd_mode} = apu_flags_i;
54+
55+
56+
57+
// -----------
58+
// FPU Config
59+
// -----------
60+
// Features (enabled formats, vectors etc.)
61+
localparam fpnew_pkg::fpu_features_t FPU_FEATURES = '{
62+
Width: C_FLEN,
63+
EnableVectors: C_XFVEC,
64+
EnableNanBox: 1'b0,
65+
FpFmtMask: {C_RVF, C_RVD, C_XF16, C_XF8, C_XF16ALT},
66+
IntFmtMask: {C_XFVEC && C_XF8, C_XFVEC && (C_XF16 || C_XF16ALT), 1'b1, 1'b0}
67+
};
68+
69+
// Implementation (number of registers etc)
70+
localparam fpnew_pkg::fpu_implementation_t FPU_IMPLEMENTATION = '{
71+
PipeRegs: '{// FP32, FP64, FP16, FP8, FP16alt
72+
'{C_LAT_FP32, C_LAT_FP64, C_LAT_FP16, C_LAT_FP8, C_LAT_FP16ALT}, // ADDMUL
73+
'{default: C_LAT_DIVSQRT}, // DIVSQRT
74+
'{default: C_LAT_NONCOMP}, // NONCOMP
75+
'{default: C_LAT_CONV}}, // CONV
76+
UnitTypes: '{'{default: fpnew_pkg::MERGED}, // ADDMUL
77+
'{default: fpnew_pkg::MERGED}, // DIVSQRT
78+
'{default: fpnew_pkg::PARALLEL}, // NONCOMP
79+
'{default: fpnew_pkg::MERGED}}, // CONV
80+
PipeConfig: fpnew_pkg::AFTER
81+
};
82+
83+
//---------------
84+
// FPU instance
85+
//---------------
86+
87+
fpnew_top #(
88+
.Features ( FPU_FEATURES ),
89+
.Implementation ( FPU_IMPLEMENTATION ),
90+
.TagType ( logic )
91+
) i_fpnew_bulk (
92+
.clk_i ( clk_i ),
93+
.rst_ni ( rst_ni ),
94+
.operands_i ( apu_operands_i ),
95+
.rnd_mode_i ( fpnew_pkg::roundmode_e'(fp_rnd_mode) ),
96+
.op_i ( fpnew_pkg::operation_e'(fpu_op) ),
97+
.op_mod_i ( fpu_op_mod ),
98+
.src_fmt_i ( fpnew_pkg::fp_format_e'(fpu_src_fmt) ),
99+
.dst_fmt_i ( fpnew_pkg::fp_format_e'(fpu_dst_fmt) ),
100+
.int_fmt_i ( fpnew_pkg::int_format_e'(fpu_int_fmt) ),
101+
.vectorial_op_i ( fpu_vec_op ),
102+
.tag_i ( 1'b0 ),
103+
.in_valid_i ( apu_req_i ),
104+
.in_ready_o ( apu_gnt_o ),
105+
.flush_i ( 1'b0 ),
106+
.result_o ( apu_rdata_o ),
107+
.status_o ( apu_rflags_o ),
108+
.tag_o ( /* unused */ ),
109+
.out_valid_o ( apu_rvalid_o ),
110+
.out_ready_i ( 1'b1 ),
111+
.busy_o ( /* unused */ )
112+
);
113+
114+
endmodule // cv32e40p_fp_wrapper
115+

0 commit comments

Comments
 (0)