dong
December 6, 2017, 7:29am
1
I would like to simulate the JTAG debugging interface of freedom-e300 with VCS.
In freedom/src/main/scala/everywhere/e300artydevkit/Config.scala I noticed that the WithJtagDTM has been added into the configuation (https://github.com/sifive/freedom/blob/master/src/main/scala/everywhere/e300artydevkit/Config.scala#L23 ), so the synthesized verilog has debugTransportModuleJTAG. Is there a script to simulate this interface already?
If not, how do I proceed it in general?
mwachs5
(Megan A. Wachs)
December 6, 2017, 5:52pm
2
The basic idea is that you launch your simulation with +jtag_vpi_enable
, then connect OpenOCD to it and debug to your heartās content.
Check out this thread, Forum user @kimokono did a great job writing up what they did:
Thanks Megan that was helpful to debug.
I have tried what you suggested and I figured the cause of the infinite loop. However I am not sure why it occurs. Apparently the program enters a loop when it reaches ret instruction on 80001058.
This is a snippet from dhrystone dump file
80001048 Proc_2:
80001048: 00003717 auipc a4,0x3
8000104c: 81974703 lbu a4,-2023(a4) # 80003861 <Ch_1_Glob>
80001050: 04100793 li a5,65
800ā¦
Or, you can check out this rocket-chip PR for reference:
chipsalliance:master
ā chipsalliance:new_remote_bitbang
opened 03:33PM - 03 Nov 17 UTC
This adds a single test from riscv-tools/riscv-tests/debug to our rocket chip re⦠gressions, for both a 32 and 64-bit core. So far it is working but not always passing. To run (`DEBUG=1` is optional)
```
cd regression
make vsim-jtag-dtm-regression SUITE=JtagDtmSuite DEBUG=1
```
To use Verilator:
```
cd regression
make emulator-jtag-dtm-regression SUITE=JtagDtmSuite DEBUG=1
```
I still need to stabilize it and make it deterministic (as the JTAG VPI version is) such that time does not advance in the simulation until each OpenOCD packet is received.
Both Verilator and VCS sims are supported. In order to run with verilator, this PR replaces the JTAG VPI with a SimJTAG which understands OpenOCD's "Remote Bitbang" protocol. This is similar to what is used in Spike. I have left the JTAG VPI in place, but this repo no longer uses it.
@timsifive FYI.
The same basic approach will work for simv
compiled in Freedom.
dong
December 6, 2017, 10:21pm
3
Sure, I will give it a try and let you know if I have any question. Thanks @mwachs5
BTW, will this work if a different simulator is used (e.g. NCSim, Modelsim)? How do we incorporate this flag jtag_vpi_enable with different simulators?
mwachs5
(Megan A. Wachs)
December 6, 2017, 10:57pm
4
My rocket-chip PR is to get it to work with Verilator (the open source simulator). I havenāt tried with the other simulators. The +jtag_vpi_enable
is read by the internal Verilog code, itās not intrinsic to the simulator.
1 Like
dong
December 6, 2017, 11:05pm
5
By default, the config in freedom-e300 should include JtagDTM, so I just make verilog, but I didnāt see JTAG VPI module in the synthesised verilog though?
mwachs5
(Megan A. Wachs)
December 8, 2017, 7:19pm
6
Right, that would have to be in your TestHarness code.
dong
December 14, 2017, 1:08am
7
Sure, I followed the thread you put above, but it seems like after I saw the meesage:
āconnection to 127.0.0.1:52484 suceedā, it stucks at the message:
āDebug: 177 7 core.c:327 jtag_call_event_callbacks(): jtag event: TAP resetā
Did I do anything wrong?