-
Notifications
You must be signed in to change notification settings - Fork 432
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
Parameter and pinout cleanup #277 #278
Changes from all commits
c81bb7f
9e8fb61
df1ce89
2fc2477
615a032
117d01f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,27 +37,10 @@ import riscv_defines::*; | |
|
||
module riscv_core | ||
#( | ||
parameter N_EXT_PERF_COUNTERS = 0, | ||
parameter INSTR_RDATA_WIDTH = 32, | ||
parameter PULP_SECURE = 0, | ||
parameter N_PMP_ENTRIES = 16, | ||
parameter USE_PMP = 1, //if PULP_SECURE is 1, you can still not use the PMP | ||
parameter PULP_CLUSTER = 1, | ||
parameter A_EXTENSION = 0, | ||
parameter PULP_CLUSTER = 0, | ||
parameter FPU = 0, | ||
parameter Zfinx = 0, | ||
parameter FP_DIVSQRT = 1, | ||
parameter SHARED_FP = 0, | ||
parameter SHARED_DSP_MULT = 0, | ||
parameter SHARED_INT_MULT = 0, | ||
parameter SHARED_INT_DIV = 0, | ||
parameter SHARED_FP_DIVSQRT = 0, | ||
parameter WAPUTYPE = 0, | ||
parameter APU_NARGS_CPU = 3, | ||
parameter APU_WOP_CPU = 6, | ||
parameter APU_NDSFLAGS_CPU = 15, | ||
parameter APU_NUSFLAGS_CPU = 5, | ||
parameter DM_HaltAddress = 32'h1A110800 | ||
parameter PULP_ZFINX = 0, | ||
parameter DM_HALTADDRESS = 32'h1A110800 | ||
) | ||
( | ||
// Clock and Reset | ||
|
@@ -75,11 +58,11 @@ module riscv_core | |
input logic [ 5:0] cluster_id_i, | ||
|
||
// Instruction memory interface | ||
output logic instr_req_o, | ||
input logic instr_gnt_i, | ||
input logic instr_rvalid_i, | ||
output logic [31:0] instr_addr_o, | ||
input logic [INSTR_RDATA_WIDTH-1:0] instr_rdata_i, | ||
output logic instr_req_o, | ||
input logic instr_gnt_i, | ||
input logic instr_rvalid_i, | ||
output logic [31:0] instr_addr_o, | ||
input logic [31:0] instr_rdata_i, | ||
|
||
// Data memory interface | ||
output logic data_req_o, | ||
|
@@ -91,8 +74,6 @@ module riscv_core | |
output logic [31:0] data_wdata_o, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More magic numbers. Consider replacing with parameter, even if these are intended to be fixed values for cv32e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is a 32-bit core. Let's not go adding even more parameters |
||
input logic [31:0] data_rdata_i, | ||
|
||
output logic [5:0] data_atop_o, // atomic operation, only active if parameter `A_EXTENSION != 0` | ||
|
||
// apu-interconnect | ||
// handshake signals | ||
output logic apu_master_req_o, | ||
|
@@ -111,7 +92,6 @@ module riscv_core | |
// Interrupt inputs | ||
output logic irq_ack_o, | ||
output logic [4:0] irq_id_o, | ||
input logic irq_sec_i, | ||
|
||
input logic irq_software_i, | ||
input logic irq_timer_i, | ||
|
@@ -120,23 +100,43 @@ module riscv_core | |
input logic irq_nmi_i, | ||
input logic [31:0] irq_fastx_i, | ||
|
||
output logic sec_lvl_o, | ||
|
||
// Debug Interface | ||
input logic debug_req_i, | ||
|
||
|
||
// CPU Control Signals | ||
input logic fetch_enable_i, | ||
output logic core_busy_o, | ||
|
||
input logic [N_EXT_PERF_COUNTERS-1:0] ext_perf_counters_i | ||
output logic core_busy_o | ||
); | ||
|
||
// Unused parameters and signals (left in code for future design extensions) | ||
localparam N_EXT_PERF_COUNTERS = 0; | ||
localparam INSTR_RDATA_WIDTH = 32; | ||
localparam PULP_SECURE = 0; | ||
localparam N_PMP_ENTRIES = 16; | ||
localparam USE_PMP = 0; // if PULP_SECURE is 1, you can still not use the PMP | ||
localparam A_EXTENSION = 0; | ||
localparam FP_DIVSQRT = FPU; | ||
localparam SHARED_FP = 0; | ||
localparam SHARED_DSP_MULT = 0; | ||
localparam SHARED_INT_MULT = 0; | ||
localparam SHARED_INT_DIV = 0; | ||
localparam SHARED_FP_DIVSQRT = 0; | ||
|
||
// Unused signals related to above unused parameters | ||
// Left in code (with their original _i, _o postfixes) for future design extensions; | ||
// these used to be former inputs/outputs of RI5CY | ||
|
||
logic [5:0] data_atop_o; // atomic operation, only active if parameter `A_EXTENSION != 0` | ||
logic [N_EXT_PERF_COUNTERS-1:0] ext_perf_counters_i = 'b0; | ||
logic irq_sec_i = 1'b0; | ||
logic sec_lvl_o; | ||
|
||
localparam N_HWLP = 2; | ||
localparam N_HWLP_BITS = $clog2(N_HWLP); | ||
localparam APU = ((SHARED_DSP_MULT==1) | (SHARED_INT_DIV==1) | (FPU==1)) ? 1 : 0; | ||
|
||
|
||
// IF/ID signals | ||
logic is_hwlp_id; | ||
logic [N_HWLP-1:0] hwlp_dec_cnt_id; | ||
|
@@ -476,7 +476,7 @@ module riscv_core | |
.N_HWLP ( N_HWLP ), | ||
.RDATA_WIDTH ( INSTR_RDATA_WIDTH ), | ||
.FPU ( FPU ), | ||
.DM_HaltAddress ( DM_HaltAddress ) | ||
.DM_HALTADDRESS ( DM_HALTADDRESS ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice. All caps for parameters is a good coding style. |
||
) | ||
if_stage_i | ||
( | ||
|
@@ -561,7 +561,7 @@ module riscv_core | |
.A_EXTENSION ( A_EXTENSION ), | ||
.APU ( APU ), | ||
.FPU ( FPU ), | ||
.Zfinx ( Zfinx ), | ||
.PULP_ZFINX ( PULP_ZFINX ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dito. |
||
.FP_DIVSQRT ( FP_DIVSQRT ), | ||
.SHARED_FP ( SHARED_FP ), | ||
.SHARED_DSP_MULT ( SHARED_DSP_MULT ), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -90,8 +90,7 @@ FIRMWARE_OBJS = $(addprefix firmware/, start.o \ | |
FIRMWARE_TEST_OBJS = $(addsuffix .o, \ | ||
$(basename $(wildcard riscv_tests/rv32ui/*.S)) \ | ||
$(basename $(wildcard riscv_tests/rv32um/*.S)) \ | ||
$(basename $(wildcard riscv_tests/rv32uc/*.S)) \ | ||
$(basename $(wildcard riscv_tests/rv32ua/*.S))) | ||
$(basename $(wildcard riscv_tests/rv32uc/*.S))) | ||
|
||
COMPLIANCE_TEST_OBJS = $(addsuffix .o, \ | ||
$(basename $(wildcard riscv_compliance_tests/*.S))) | ||
|
@@ -371,7 +370,7 @@ riscv_tests/rv32um/%.o: riscv_tests/rv32um/%.S riscv_tests/riscv_test.h \ | |
|
||
riscv_tests/rv32uc/%.o: riscv_tests/rv32uc/%.S riscv_tests/riscv_test.h \ | ||
riscv_tests/macros/scalar/test_macros.h | ||
$(RISCV_EXE_PREFIX)gcc -c -march=rv32im -g -o $@ \ | ||
$(RISCV_EXE_PREFIX)gcc -c -march=rv32imc -g -o $@ \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good |
||
$(RISCV_TEST_INCLUDES) \ | ||
-DTEST_FUNC_NAME=$(notdir $(basename $<)) \ | ||
-DTEST_FUNC_TXT='"$(notdir $(basename $<))"' \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -317,17 +317,6 @@ start: | |
|
||
TEST(fence_i) | ||
|
||
TEST(amoadd_w) | ||
TEST(amoand_w) | ||
TEST(amomaxu_w) | ||
TEST(amomax_w) | ||
TEST(amominu_w) | ||
TEST(amomin_w) | ||
TEST(amoor_w) | ||
TEST(amoswap_w) | ||
TEST(amoxor_w) | ||
TEST(lrsc) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this removed? These test should work. Also I don't think a PR that is called cleanup should regress on features. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The RVA parameter has been set to 0 by default, so they generate illegal instructions now |
||
/* running riscv-compliance-tests */ | ||
la a0, riscv_compliance_tests_msg | ||
call print_str | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -698,7 +698,8 @@ module mm_ram | |
|
||
`ifndef VERILATOR | ||
riscv_random_stall | ||
#(.DATA_WIDTH(INSTR_RDATA_WIDTH)) | ||
#(.ADDR_WIDTH(RAM_ADDR_WIDTH), | ||
.DATA_WIDTH(INSTR_RDATA_WIDTH)) | ||
instr_random_stalls | ||
( | ||
.clk_i ( clk_i ), | ||
|
@@ -715,7 +716,7 @@ module mm_ram | |
.req_core_i ( instr_req_i ), | ||
.req_mem_o ( rnd_stall_instr_req ), | ||
|
||
.addr_core_i ( 32'(instr_addr_i) ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing this will generate a port mismatch warning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The connections to riscv_random_stall were actually generating port mismatch warnings and they have been fixed by above change. The key is that I also added an ADDR_WIDTH parameter to riscv_random_stall so that it can be used in different context with potentially different address with requirements (so that we can make this warning free in every context). |
||
.addr_core_i ( instr_addr_i ), | ||
.addr_mem_o ( rnd_stall_instr_addr ), | ||
|
||
.wdata_core_i ( ), | ||
|
@@ -734,7 +735,8 @@ module mm_ram | |
); | ||
|
||
riscv_random_stall | ||
#(.DATA_WIDTH(32)) | ||
#(.ADDR_WIDTH(RAM_ADDR_WIDTH), | ||
.DATA_WIDTH(32)) | ||
data_random_stalls | ||
( | ||
.clk_i ( clk_i ), | ||
|
@@ -751,7 +753,7 @@ module mm_ram | |
.req_core_i ( data_req_dec ), | ||
.req_mem_o ( rnd_stall_data_req ), | ||
|
||
.addr_core_i ( 32'(data_addr_dec) ), | ||
.addr_core_i ( data_addr_dec ), | ||
.addr_mem_o ( rnd_stall_data_addr ), | ||
|
||
.wdata_core_i ( data_wdata_dec ), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing parameters here? Even if these widths must be fixed, there are a lot of magic numbers in the code and it would be a good idea to slowly replace them all. How about:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only instr_rdata_i had a parameter. There is no need to use a parameter for instr_addr_o. This will always be 32 bits wide. The use of INSTR_ADDR_WIDTH is debatable; I would not be against it but at the same time both cv32e40p and cv32e40 will have it set to 32.