Closed davidmallasen closed 7 months ago
Same error there. Nothing suspicious in the trace file, strange :neutral_face:
Strange that the rvfi_tracer
finishes. @JeanRochCoulon do you have a suspicion why?
Temporary solution:
ecall
loop: https://github.com/openhwgroup/cva6/blob/master/corev_apu/tb/rvfi_tracer.sv#L54make clean && make verilator
)./work-ver/Variane_testharness /opt/riscv/riscv64-unknown-elf/bin/pk hello.elf
This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1.
Listening on port 37879
bbl loader
Hello CVA6!
/opt/riscv/riscv64-unknown-elf/bin/pk completed after 1529936 cycles
CPU time used: 196366.65 ms
Wall clock time passed: 98656.32 ms
I confirm that commenting lines 54-57 and line 61 of rvfi_tracer.sv
temporarily solves the issue. Thanks @pcotret!
user@user-VirtualBox:~/cva6$ work-ver/Variane_testharness $RISCV/riscv64-unknown-elf/bin/pk hello.elf
This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1.
Listening on port 39227
bbl loader
Hello CVA6!\n/home/user/riscv/riscv64-unknown-elf/bin/pk completed after 2258993 cycles
CPU time used: 351096.20 ms
Wall clock time passed: 175684.81 ms
user@user-VirtualBox:~/cva6$
The steps to reproduce this issue in a fresh Ubuntu 20.04 installation:
sudo apt install -y git curl gcc g++ make autoconf
git clone https://github.com/openhwgroup/cva6.git
cd cva6
git submodule update --init --recursive
~/.bashrc
:
export RISCV=/home/user/riscv
export PATH=$PATH:$RISCV/bin
source ~/.bashrc
./ci/setup.sh
./ci/install-riscvpk.sh
Run user-space application using verilator:
echo '
#include <stdio.h>
int main(int argc, char const *argv[]) {
printf("Hello CVA6!\n");
return 0;
}' > hello.c
riscv64-unknown-elf-gcc hello.c -o hello.elf
make verilate
work-ver/Variane_testharness $RISCV/riscv64-unknown-elf/bin/pk hello.elf
The output should be similar to:
user@user-VirtualBox:~/cva6$ work-ver/Variane_testharness $RISCV/riscv64-unknown-elf/bin/pk hello.elf
This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1.
Listening on port 45645
bbl loader
- /home/user/cva6/corev_apu/tb/rvfi_tracer.sv:61: Verilog $finish
- /home/user/cva6/corev_apu/tb/rvfi_tracer.sv:61: Verilog $finish
- /home/user/cva6/corev_apu/tb/rvfi_tracer.sv:61: Second verilog $finish, exiting
user@user-VirtualBox:~/cva6$
Hello David, thank for reporting the point.
When simulation finishes on ecall, also if the cpu has finished to execute the program, the com interface has not finished to transmit the string "Hello CVA6!" to the port. That's why the string is not written out. In testharness, the simulation is ended by ecall. If you remove ecall, the simulation finishes with the debug module help. And the string has time to be written out.
ecall was inserted to finish the simulation on other testbench than testharness, testbenches supported in core-v-verif projects (core only and uvm) for instance. This solution has also been implemented in riscv-compliance and riscv-tests regression suites.
To write out the string, an timing loop can be inserted before progam end.
Keep us in touch, Jean-Roch
So from what I understand this is the intended behaviour, as it was not ment to run user applications but to execute the verification tests. For now the solution proposed by Pascal is enough in my case but I'll take this into account if I need it in the future.
Thanks for your time and your insight!
Temporary solution:
* Commented the `ecall` loop: https://github.com/openhwgroup/cva6/blob/master/corev_apu/tb/rvfi_tracer.sv#L54 * Recompile the Verilator model (`make clean && make verilator`)
./work-ver/Variane_testharness /opt/riscv/riscv64-unknown-elf/bin/pk hello.elf This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1. Listening on port 37879 bbl loader Hello CVA6! /opt/riscv/riscv64-unknown-elf/bin/pk completed after 1529936 cycles CPU time used: 196366.65 ms Wall clock time passed: 98656.32 ms
Temporary solution:
* Commented the `ecall` loop: https://github.com/openhwgroup/cva6/blob/master/corev_apu/tb/rvfi_tracer.sv#L54 * Recompile the Verilator model (`make clean && make verilator`)
./work-ver/Variane_testharness /opt/riscv/riscv64-unknown-elf/bin/pk hello.elf This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1. Listening on port 37879 bbl loader Hello CVA6! /opt/riscv/riscv64-unknown-elf/bin/pk completed after 1529936 cycles CPU time used: 196366.65 ms Wall clock time passed: 98656.32 ms
how would the file look once you have the comments, because it gives me syntax errors thank you
@FranDuqueAyachi just comment these lines: https://github.com/openhwgroup/cva6/blob/5c5c704d1d14190ec349fae12fe39fbe025456ae/corev_apu/tb/rvfi_tracer.sv#L59-L62
And this line: https://github.com/openhwgroup/cva6/blob/5c5c704d1d14190ec349fae12fe39fbe025456ae/corev_apu/tb/rvfi_tracer.sv#L66
@FranDuqueAyachi just comment these lines:
And this line:
@FranDuqueAyachi just comment these lines:
And this line:
OKey, I commented these lines, but when I execute make verilate: %Error: /home/users/PFC/divsicad/fduque/tfg/cva6/corev_apu/tb/rvfi_tracer.sv:63:11: syntax error, unexpected else 63 | end else if (rvfi_i[i].trap)
@FranDuqueAyachi Also comment line 62, I have updated my previous reply.
@FranDuqueAyachi Also comment line 62, I have updated my previous reply.
Didnt see it, thank you!
Seeing the same issue with current CVA6 setup. There is also no ecall in rvfi_tracer.sv in recent code.
As told previously, the simulation stops before printing out. Today the simulation do not stop anymore on ecall instruction execution but on a write to a special address (TOHOST_ADDR). I reopened this github issue, just to know if a delay could be added to wait for printf completion.
Any news on this?
@JeanRochCoulon I tried running the simulation for ~5mins but did not get any output. However when running the hello world with the pk (now unsupported) as done by the first post in this issue I have no issue getting an output with the most recent version of the repo. @zchamski maybe you know if the pk was indeed the only way to get an output with this hello world test ?
@valentinThomazic yes, the Proxy Kernel (pk) is the layer in charge of generic host I/O. If I remember correctly, it uses the HTIF protocol (https://chipyard.readthedocs.io/en/stable/Advanced-Concepts/Chip-Communication.html) to communicate with the host via commands written to variable tohost
.
Okay, that is what I thought ! I had some doubts there was some way to get an output even without the pk since thet test has been kept and getting an output is what you would expect from an hello world. I think the issue can be closed again @JeanRochCoulon
So how would one go about running a simulation with an stdout output with the current setup?
Today there is no way to printout. CVA6 is an open source development. If you would like to contribute, we can support the effort.
Hi, If there is no way to print out, how can I check simulation of hello.c is successful?
Today the printout is not supported by CVA6 project. The use of pk-kernel could be a solution to support it.
I've been trying to set up the verilator workflow with the comments from the recent pull request #740 in a blank VM with Ubuntu 20.04 (until now I was using QuestaSim and the Genesys II). When executing
work-ver/Variane_testharness $RISCV/riscv64-unknown-elf/bin/pk hello.elf
after compiling withriscv64-unknown-elf-gcc hello.c -o hello.elf
, it seems to run normally but in the end there is no "Hello CVA6!" output to stdout. I have tested the generated .elf on the Genesys II from my previous working flow and it seems to work fine. Any suggestions on what I could be missing? Thanks!P.S: I've tried with Verilator 4.100, 4.014 and 4.002 with the same result.