We use the term processes in the SystemC
sense to cover both SC_THREAD
and
SC_METHOD
.
The busThread
is a
SC_THREAD
. It sits in a perpetual loop. It first
marks the transmit buffer as empty (on reset the flags are cleared,
so the buffer will appear full).
Note | |
---|---|
The 16450 UART describes two flags for transmit buffer status, one to indicate that the transmit holding register is empty and a second to indicate that the internal transmit buffer register is empty. For simplicity, this model does not model a separate internal register (effectively a one byte FIFO), so both flags are set and cleared together. |
If the transmit buffer empty interrupt is enabled, the thread generates an interrupt to indicate that the buffer is empty.
The thread then waits until it is notified via the SystemC event
txReceived
that a byte is in the buffer to be
sent. This event will be triggered by the
busWrite
callback when a value is written into
the transmit holding register.
Note | |
---|---|
It might be thought that a SystemC
That would certainly be suitable in this implementation. However
this is a virtual function, and when we reimplement later to add
timing, we will wish to call |
The second process, rxMethod
is a SystemC
SC_METHOD
, sensitive to characters appearing in
the Rx buffer. The character is read into the read buffer register
and the line status data ready flag is set to indicate availability.
If the receive data interrupt is enabled, an interrupt is asserted to indicate data availability.