In addition to the public instance variables which form part of the API, the main JTAG module maintains some private state.
TapStateMachine *stateMachine
This is an instance of the TAP state machine class (see Section 3.4.6), modeling the TAP state machine in the target to which this module is connected.
TapAction *currentTapAction
This is the JTAG action currently being processed through the TAP state machine. It has already been read from the FIFO.
The constructor initializes the current TAP action
(currentTapAction
) to NULL
and allocates new instances of the FIFO
(sc_fifo
) and the TAP state machine
(TapStateMachine
).
It also declares the protected method
processActions
to be a SystemC method
(SC_METHOD
), sensitive to the rising TCK
(tck.pos()
). It is this method that is
responsible for progressing the queued actions on each clock
cycle.
The destructor deletes the FIFO and TAP state machine to free the memory on completion.
This function is declared in the constructor as a SystemC
SC_METHOD
. It is invoked on every rising edge
of TCK
.
TRST
takes its value as the inverse of the System reset (since it
is active low, while the latter is active high). If the system is
in reset, there is nothing else to do and the method returns.
If there is no TAP action currently being processed
(i.e. currentTapAction
is
NULL
) then the method attempts a non-blocking
read from the FIFO.
If no new action is available from the FIFO, then TMS
is driven to
the appropriate state to move towards the Run-Test/Idle
state and the method returns.
Having obtained (or already in progress of) a TAP action, its
process
method is invoked. This takes the
current state machine and TDO
and returns (via parameters) new
values of TDI
and TMS
. It returns success if this completes the
action.
In the event of successful completion, the SystemC event
associated with the action is notified, and
currentTapAction
marked null, so a new action
will be obtained from the FIFO on the next cycle.
The state machine is then advanced to its next state (based on the
value of TMS
), and the values of TMS
and TDI
used to drive the
SystemC signals in tdi_o
and
tms_o
.
Note | |
---|---|
This function is only called on the positive edge of the clock,
although |