The scHThread class.
The scHThread is the working hose of the system. I rougly corresponds to what a conventioal processor (core) is.
Public Member Functions | |
bool | AllocatedBit_Get (bool B) |
< Get 'Allocated' status of HThread | |
void | AllocatedBit_Set (bool B) |
< Set 'Allocated' status of HThread | |
scHThread * | AllocateFor (scHThread *Parent) |
< Allocate this scHThread for another one More... | |
ClusterAddress_t | ClusterAddress_Get (void) |
< Return the cluster address of the gridpoint, stored in the matrix | |
SC_WORD_TYPE * | DataPositionInBuffer (SC_ADDRESS_TYPE A) |
Return pointer to word containing next data. | |
virtual void | FinishPrefetching (void) |
Make sure we have a fetched instruction. If ready, just make nothing. If fetch started, but not finished, just wait until arrives. If not started, initiate fetching. | |
SC_WORD_TYPE * | InstPositionInBuffer (SC_ADDRESS_TYPE A=CORE_DEFAULT_ADDRESS) |
Return pointer to word containing next instruction. | |
bool | IsTimedOut (void) const |
< The HThread can be time, true if the actin timed out | |
void | ObservedBit_Set (bool B) |
< Put graph data to a vector storage | |
void | PC_Affected_Set (bool B) |
bool | PreAllocatedBit_Get (void) |
< Get 'PreAllocated' status of HThreadl | |
void | PreAllocatedBit_Set (bool V=true) |
< Set 'PreAllocated' status of HThread | |
scHThread * | PreAllocateFor (scHThread *Parent) |
< PreAllocate this scHThread for another one More... | |
void | Reset (void) |
< Reset the thread for operation | |
scHThread (sc_core::sc_module_name nm, scGridPoint *GP, SC_HTHREAD_ID_TYPE ID) | |
An scGridPoint owns run several HW threads (scHThread), can run them, with auto-scheduling them. More... | |
string | StringOfClusterAddress_Get (void) |
string | StringOfName_Get (void) |
Return alias name of default name. More... | |
void | Timeout_Set (sc_time &T) |
< Set timout facility for a thread | |
Public Attributes | |
struct { | |
sc_core::sc_event EXEC | |
< New execution requested | |
sc_core::sc_event EXECUTED | |
< New execution finished | |
sc_core::sc_event FETCH | |
< New fetch requested | |
sc_core::sc_event NEXT | |
< Next intruction is requested | |
} | EVENT_HTHREAD |
These events are handled at thread level. | |
Protected Member Functions | |
void | EXEC_method (void) |
EXEC_method Runs when a thread receives an EVENT_HTHREAD.EXEC. More... | |
void | FETCH_method (void) |
Runs when a next instruction is due to process It handles prefetching, suspending operation, handles execution of meta instructions and conventional instructions. More... | |
void | NEXT_method (void) |
Runs when a next instruction should be taken from memory. More... | |
Protected Attributes | |
CoreExecute_t | exec |
All information relating to the execution. | |
CoreFetch_t | fetch |
All info relating instruction fetch. | |
SC_ADDRESS_TYPE | mInstrMemoryAddressEnd |
The first/last contents in the cache. | |
SC_WORD_TYPE | mInstrMemoryBuffer [MAX_IGPCBUFFER_SIZE] |
Store received data&instr memory content here. | |
bool | mTimedOut |
Is set when EVENT_GRID.TIMEOUT.notify() times out. | |
scHThread::scHThread | ( | sc_core::sc_module_name | nm, |
scGridPoint * | GP, | ||
SC_HTHREAD_ID_TYPE | ID | ||
) |
An scGridPoint owns run several HW threads (scHThread), can run them, with auto-scheduling them.
An scHThread "rents" its corresponding owner scGridPoint for the time of processing, i.e., only one of the HThreads can run at the same time, the others are waiting. This can increase utilization of the scGridPoint. Basically, the scHThread can use the HW unit for fetching and executing of one machine instructions. The HTreads have their independent context, such as Program Counter and (two) Program Counters, (one for fetching and one for executing) register set and status word, if any. When executing, the scGridPoint can be in one of two stages: either executing a conventional machine instruction, or morphing, with the assistance of its owner processor.
The scGridPoint owns the scHThread (the scHThread can run only on that scGridPoint), but an scHThread can be a parent of another scHThread; in this way they will be in parent-child relationship
[in] | nm | Module name |
[in] | GP | the owner scGridPoint |
[in] | ID | The unique (whithin the scGridPoint) ID of the thread |
< Allocate this scHThread for another one
|
protected |
EXEC_method Runs when a thread receives an EVENT_HTHREAD.EXEC.
The thread attemps to 'own' the cores EXEC facilities. If it suceeds, writes its own thread number to the corresponding structure. If not, waits for the corresponding EVENT_HTHREAD.EXECUTED signal and retries. The owner scGridPoint will send that signal to all of its HThreads.
|
protected |
Runs when a next instruction is due to process It handles prefetching, suspending operation, handles execution of meta instructions and conventional instructions.
FETCH_method Runs when a thread receives an EVENT_HTHREAD.FETCH
The thread attemps to 'own' the cores FETCH facilities. If it suceeds, writes its own thread number to the corresponding structure. If not, waits for the corresponding EVENT_HTHREAD.FETCHED signal and retries. The owner scGridPoint will send that signal to all of its HThreads.
|
protected |
Runs when a next instruction should be taken from memory.
Works in cooperation with the events/thread of its scGridPoint: it arbitrates scGridPoint utilization (with no priority): the requesting unit makes scGridPoint (NEXT_thread) busy and releases it when the instruction finshes; it must set also the "current thread"
Called when the next instruction in a HThread shall be executed.
The method work in cooperation with FETCH_method and EXEC_method
|
inline |
B | Set if PC is affected after using the instruction |
< PreAllocate this scHThread for another one
scHThread::StringOfClusterAddress_Get | ( | void | ) |
string scHThread::StringOfName_Get | ( | void | ) |
Return alias name of default name.