In normal use, a debugger, such as GDB would be connected to the JTAG port. For demonstrating the interface, we use a stripped down JTAG logger class. This uses the debug interface to read the processor's next program counter SPR once per (modeled) second.
With the Or1ksim debug unit (see [2]), this requires the following steps.
Reset the JTAG interface
Shift DEBUG
(0x8) into the JTAG instruction
register.
Construct a JTAG data register to select module
CPU0
so we can access its SPRs and shift that
into the JTAG data register.
Construct a JTAG data register for the
WRITE_COMMAND
debug unit command, specifying
that we wish to read the next program counter SPR and shift that
into the JTAG data register.
Construct a JTAG data register for the
GO_COMMAND
debug unit command, to collect the
value read from the next program counter SPR and shift that into
the JTAG data register.
These last two steps are repeated with a wait of one second between, to give a regular report on the value of the next program counter.