[J-core] Debug jump log?

Rob Landley rob at landley.net
Sat Feb 25 18:22:38 EST 2017

On 02/23/2017 06:18 PM, Rich Felker wrote:
> On Thu, Feb 23, 2017 at 01:35:53PM -0600, Rob Landley wrote:
>> What would it take to add a debug feature to j-core which recorded the
>> address each jump came from into a ring buffer when we set a status
>> flag? I.E "start debugging mode", then run until breakpoint, then dump
>> the buffer to have all the "come from" addresses so we can reconstruct
>> the path that got us here back into the runtime history?
>> Even if it was writing the data straight into DRAM (thus slowing
>> execution down a lot) it would be a really useful feature for things
>> like profiling the interrupt path. (Doing that would need a register to
>> set the size/location of the buffer...)

A better design would be "add an extra debug register: when it's not
zero each time you jump write the 'from' address to this location and
increment the register (by 4). When you cross a page boundary, raise an

That only needs one new register, you can tell exactly how much is used
if you breakpoint for other reasons, you can make the buffer as big as
you like by counting/returning from interrupts until you've got the size
you want, you can write out through the normal dcache mechanism
(bursting your writes into 32 byte lines)...

> Is there a reason you'd want this in the hardware rather than an
> emulator?

We have a VHDL processor. I'm coming up with little projects you can add
to it to show "here's cool things you can do with VHDL in an FPGA that
you can't do with a closed source asic", and which are also nice
examples people can work through as they're learning VHDL and learning
our processor design.

We haven't even managed to get proper "-cpu -j2" support into QEMU yet,
and it's generally bad about accurate traces because after a page is
translated you've lost the original instruction layout and have to
awkwardly map it back. It would be an intrusive and bloating change to
tcg because it's exactly the sort of thing tcg was _not_ designed to do.


More information about the J-core mailing list