-
Notifications
You must be signed in to change notification settings - Fork 431
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
Parameter and pinout cleanup #277 #278
Conversation
Signed-off-by: Arjan Bink <[email protected]>
Needs to be done at the same time as openhwgroup/core-v-verif#85 |
Signed-off-by: Arjan Bink <[email protected]>
Added back in the APU interface. |
Thanks a lot @Silabs-ArjanB , few comments here:
|
The status of the tb/dm is unclear to me. They already seemed out of date to begin with. Can you let me know which ones are actually in use and I will update them (some of them seem to have been copied into the core-v-verif repos instead). Do you want me to work on #254? |
PR for #254 is already here: #285 tb/dm should just compile and work as before. The purpose is to provide an example to use GDB. |
@Silabs-ArjanB , as the PR #285 has been merged to master, the point 2. should be solved.
You should now merge the master to your branch and see if it solves the issue and address the point 1 here:
Thanks @Silabs-ArjanB |
Signed-off-by: Arjan Bink <[email protected]>
Cleaned up parameters and pinout in various testbenches.
Could we open another ticket to get rid of the high amount of testbenches and duplication in cv32e40p. For example riscv_core is currently being instantiated in all of the following: cv32e40p/tb/core/riscv_wrapper.sv and riscv_wrapper for example is then being instantiated in tb/core/tb_top.sv I updated all of the above but we should try to get rid of obsolete testbenches. |
Hi @Silabs-ArjanB , my answers inline
It works for me
👍
The problem is the RVA instructions emitted. As you tight to 0 the RVA parameter, you should also disable those instructions.
Yes please go ahead. We already have a ticket to change name to the folder and clean it up. @MikeOpenHWGroup is porting the interrupt test. Then, we should only have an example of application and the debug connected. |
Hi @davideschiavone , thank you for your feedback. I will fix the RVA instruction issue as you described. Can you be more specific about which parts I can remove please? For example, can I remove all of the following? Files: cv32e40p/tb/dm/tb_top_verilator.sv Directories: cv32e40p/tb/verilator-model |
Hi @Silabs-ArjanB , Can we have that discussion in another thread/issue ? |
output logic [31:0] instr_addr_o, | ||
input logic [31:0] instr_rdata_i, |
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:
output logic instr_req_o,
input logic instr_gnt_i,
input logic instr_rvalid_i,
output logic [INSTR_ADDR_WIDTH -1:0] instr_addr_o,
input logic [INSTR_RDATA_WIDTH-1:0] instr_rdata_i,
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.
@@ -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 comment
The 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 comment
The 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
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. All caps for parameters is a good coding style.
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Dito.
Sure |
…uration) Signed-off-by: Arjan Bink <[email protected]>
Fixed Makefile and firmware/start.S to no longer use non-supported instructions (i.e. atomics). Note that riscv_tests/rv32uc/rvc.S needed to be changed (as was done before) as it led to an internal compiler error. |
For me it's ok to MERGE, just hitting @bluewww to ask him about the last change you have done in the RVC (he is the expert :) ) |
TEST(amoswap_w) | ||
TEST(amoxor_w) | ||
TEST(lrsc) | ||
|
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 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 comment
The 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
@@ -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 comment
The 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 comment
The 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).
|
||
#include "../rv64uc/rvc.S" |
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.
Is this a copy paste of the ../rv64uc/rvc.S
file? Why would you do this for this file, but then you don't do it for the others?
There is a very good reason the structure of the test files is like this (i.e. with the #include
s from rv64uc
). They are a verbatim import from https://github.com/riscv/riscv-tests meaning that whenever there is an update to the upstream test repository, you can easily import the diff. Now that you change the structure you have to apply fixes everytime you do this. This is just an unnecessary increase in maintenance cost.
All in all its inconsistent and a bad idea. I would highly suggest to revert this change and apply the fix to ../rv64uc/rvc.S
which I guess is removing the .option norelax
, a fix I mistakenly did because I compiled with -march=rv32im
instead of imc
I suspect.
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.
I fully agree that it is important to be able to enable a verbatim import from https://github.com/riscv/riscv-tests. That being said, the tests (together with our Makefile/compiler) were not compiling correctly.
The ./rv64uc/rvc.S and ./rv32uc/rvc.S file are not the same. Even on the master branch this test case led to a gcc internal error, so the starting point was a repos in which test cases were not compiling correctly.
I looked at what this test looked like roughly half a year ago and I re-applied the same change to get it to work. (This might be related to this issue: riscv-collab/riscv-gnu-toolchain#445)
diff ./rv64uc/rvc.S ./rv32uc/rvc.S
10a11,12
#undef RVTEST_RV64U
#define RVTEST_RV64U RVTEST_RV32U
16,18d17
< // riscv-collab/riscv-gnu-toolchain#445
< // mixed modes should turn of relaxation (?)
< .option norelax
Originally I also thought it had to do with the missing imc switch so I fixed that first. However, if we keep the test as it was the entire test suite will not run because I would still get the following error:
/tool/pulp_riscv_gnu_toolchain/2019.12/rhel6-64/bin/riscv32-unknown-elf-gcc -c -march=rv32imc -g -o riscv_tests/rv32uc/rvc.o
-Iriscv_tests/ -Iriscv_tests/macros/scalar
-DTEST_FUNC_NAME=rvc
-DTEST_FUNC_TXT='"rvc"'
-DTEST_FUNC_RET=rvc_ret riscv_tests/rv32uc/rvc.S
riscv32-unknown-elf-gcc: internal compiler error: Floating point exception (program as)
Please submit a full bug report,
with preprocessed source if appropriate.
See https://gcc.gnu.org/bugs/ for instructions.
make: *** [riscv_tests/rv32uc/rvc.o] Error 4
I will file a separate issue on the compilation issue with the rvc.S test (and I acknowledge that I should already have done that). In the mean time I think it is important to have the repos in a state that actually runs with 0 errors and 0 warnings.
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.
This might also be a pulp-riscv-gnu-toolchain
bug. I believe that the test worked with riscv-gnu-toolchain
but I would have to check again.
tb/core/riscv_wrapper.sv
Outdated
@@ -42,7 +43,7 @@ module riscv_wrapper | |||
logic [3:0] data_be; | |||
logic [31:0] data_rdata; | |||
logic [31:0] data_wdata; | |||
logic [5:0] data_atop; | |||
logic [5:0] data_atop = 'b0; |
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.
indicate bitwidth. Should stay consistent in this repo.
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.
Okay, will do
@@ -371,7 +369,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 comment
The reason will be displayed to describe this comment to others. Learn more.
good
tb/core/Makefile
Outdated
@@ -83,15 +83,13 @@ RISCV_EXE_PREFIX = $(RISCV)/bin/riscv32-unknown-elf- | |||
|
|||
# firmware vars | |||
FIRMWARE = firmware/ | |||
RISCV_TEST_INCLUDES = -Iriscv_tests/ -Iriscv_tests/macros/scalar \ | |||
-Iriscv_tests/rv64ui -Iriscv_tests/rv64um -Iriscv_tests/rv64ua |
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.
Revert this too, see comment above
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.
Agreed this should be reverted (which has been done now). The rv64* includes are however not actually being used yet as I am still not using the originally intended rvc.S (see discussion above). Once we get the rvc.S issue solved, then at least RISCV_TEST_INCLUDES will be already have the correct value.
@@ -30,7 +30,7 @@ VLOG_FLAGS = -pedanticerrors -suppress 2577 -suppress 2583 | |||
VLOG_LOG = vloggy | |||
|
|||
VOPT = vopt-$(VVERSION) | |||
VOPT_FLAGS = -debugdb -fsmdebug -pedanticerrors #=mnprft | |||
VOPT_FLAGS = -debugdb -fsmdebug +acc -pedanticerrors #=mnprft |
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.
Ok this makes sense otherwise the defaults would be really useless.
tb/dm/tb_test_env.sv
Outdated
.apu_master_flags_i ( ), | ||
|
||
.apu_master_valid_i ( 1'b0 ), | ||
.apu_master_result_i ( 'b0 ), |
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.
indicate bitwidth. Should stay consistent in this repo.
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.
Fixed (and made similar fixes in other places)
tb/dm/tb_top_verilator.sv
Outdated
.apu_master_flags_i ( ), | ||
|
||
.apu_master_valid_i ( 1'b0 ), | ||
.apu_master_result_i ( 'b0 ), |
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.
indicate bitwidth
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.
Done
tb/verilator-model/top.sv
Outdated
.apu_master_flags_i ( ), | ||
|
||
.apu_master_valid_i ( 1'b0 ), | ||
.apu_master_result_i ( 'b0 ), |
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.
indicate bitwidth
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.
done
Signed-off-by: Arjan Bink <[email protected]>
Actually, these changes in the RISCV_TESTS suite should be done in the core-verif repository, the only purpose of this "testbench" should be make hello world pass. So it's not wasted work as can be ported to core-verif, but probably we can ignore the them here |
Signed-off-by: Arjan Bink [email protected]