IDLE Time in Controller.h
This commit is contained in:
@@ -88,11 +88,14 @@ public:
|
||||
|
||||
~Controller()
|
||||
{
|
||||
delete controllerCore;
|
||||
delete controllerCore;
|
||||
delete scheduler;
|
||||
}
|
||||
|
||||
void terminateSimulation();
|
||||
|
||||
sc_time getIdleTime();
|
||||
|
||||
// ------- CONTROLLER CORE ---------
|
||||
virtual void send(const ScheduledCommand& command, tlm_generic_payload& payload) override;
|
||||
virtual void send(Trigger trigger, sc_time time, tlm_generic_payload& payload) override;
|
||||
@@ -138,6 +141,14 @@ private:
|
||||
|
||||
DebugManager& debugManager;
|
||||
TlmRecorder *tlmRecorder;
|
||||
|
||||
// Bandwith realted:
|
||||
sc_time idleStart;
|
||||
bool idleState = false;
|
||||
sc_time idleTime;
|
||||
void startBandwithIdleCollector();
|
||||
void endBandwithIdleCollector();
|
||||
|
||||
};
|
||||
|
||||
// --- IMPLEMENTATION -----
|
||||
@@ -353,6 +364,11 @@ tlm_sync_enum Controller<BUSWIDTH>::nb_transport_fw(tlm_generic_payload &payload
|
||||
|
||||
tlmRecorder->recordPhase(payload, phase, recTime);
|
||||
frontendPEQ.notify(payload, phase, notDelay);
|
||||
|
||||
//Bandwith IDLE
|
||||
if ((getTotalNumberOfPayloadsInSystem()== 0)&& idleState){
|
||||
endBandwithIdleCollector();
|
||||
}
|
||||
}
|
||||
else if (phase == END_RESP)
|
||||
{
|
||||
@@ -361,6 +377,11 @@ tlm_sync_enum Controller<BUSWIDTH>::nb_transport_fw(tlm_generic_payload &payload
|
||||
|
||||
printDebugMessage("[fw] Recording " + phaseNameToString(phase) + " at " + recTime.to_string() + " notification in " + notDelay.to_string());
|
||||
|
||||
// Badnwith IDLE
|
||||
if (getTotalNumberOfPayloadsInSystem()==1){
|
||||
startBandwithIdleCollector();
|
||||
}
|
||||
|
||||
tlmRecorder->recordPhase(payload, phase, recTime);
|
||||
frontendPEQ.notify(payload, phase, notDelay);
|
||||
}
|
||||
@@ -378,6 +399,7 @@ void Controller<BUSWIDTH>::frontendPEQCallback(tlm_generic_payload &payload, con
|
||||
{
|
||||
if (phase == BEGIN_REQ)
|
||||
{
|
||||
printDebugMessage(string("Payload in system: ") + to_string(getTotalNumberOfPayloadsInSystem()));
|
||||
payload.acquire();
|
||||
payloadEntersSystem(payload);
|
||||
if (getTotalNumberOfPayloadsInSystem() > controllerCore->config.MaxNrOfTransactions)
|
||||
@@ -454,7 +476,7 @@ void Controller<BUSWIDTH>::scheduleNextFromScheduler(Bank bank)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pair<Command, tlm::tlm_generic_payload*> nextRequest = scheduler->getNextRequest(bank);
|
||||
if(nextRequest.second != NULL)
|
||||
{
|
||||
@@ -598,5 +620,25 @@ void Controller<BUSWIDTH>::terminateSimulation()
|
||||
}
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
void Controller<BUSWIDTH>::startBandwithIdleCollector(){
|
||||
printDebugMessage("IDLE Start");
|
||||
printDebugMessage("IDLE Time: "+idleTime.to_string());
|
||||
idleStart = sc_time_stamp();
|
||||
idleState = true;
|
||||
}
|
||||
|
||||
template<unsigned int BUSWIDTH>
|
||||
void Controller<BUSWIDTH>::endBandwithIdleCollector(){
|
||||
printDebugMessage("IDLE End");
|
||||
idleTime += sc_time_stamp()-idleStart;
|
||||
idleState = false;
|
||||
}
|
||||
template<unsigned int BUSWIDTH>
|
||||
sc_time Controller<BUSWIDTH>::getIdleTime(){
|
||||
printDebugMessage("IDLE Time: "+idleTime.to_string());
|
||||
return idleTime;
|
||||
}
|
||||
|
||||
#endif /* CONTROLLERWRAPPER_H_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user