The Or1ksim ISS library is extended to provide API calls to handle
JTAG registers being shifted in and out. The API
call, or1ksim_jtag_reset
, causes the JTAG unit
to process through a reset sequence. The API
calls, or1ksim_jtag_shift_ir
and
or1ksim_jtag_shift_dr
, take a byte vector and bit
length as arguments and shift specified number of bits through the
instruction register and data register respectively.
All three API calls return the time taken by the function in seconds
(as a C++ double). A key aspect of this API is that the
calls may not be used during the execution of
or1ksim_run
. This could occur during processing
of an upcall, but at such a time the processor is mid-instruction and
the state for debug unit processing is inconsistent. This requirement
is enforced in the wrapper by use of a SystemC
sc_mutex
.
The Or1ksim wrapper, Or1ksimIntrSC
is further
extended by a new derived class, Or1ksimJtagSC
,
which provides a TLM 2.0 target port to for JTAG transactions and a
handler method, jtagHandler
, for those
requests.
The JTAG target port makes use of TLM 2.0 generic payload with an
ignorable extension, used to specify precisely the JTAG operation
required and the size in bits of the JTAG register. The class
JtagExtensionSC
(see Section 11.2) is defined for this purpose.