Commit 8af526b6 authored by Siyuan Niu's avatar Siyuan Niu

daemon change

parent cc63797d
......@@ -327,7 +327,6 @@ void TMLTask::finished(){
}
unsigned int TMLTask::getState() const{
std::cout<<"getState"<<std::endl;
/*if (!_transactList.empty() && _transactList.back()->getEndTime()==SchedulableDevice::getSimulatedTime()){
return RUNNING;
}else{
......
......@@ -82,12 +82,12 @@ using std::min;
using std::max;
#undef DEBUG_KERNEL
#undef DEBUG_CPU
#define DEBUG_CPU
#undef DEBUG_BUS
#undef DEBUG_SERIALIZE
#undef DEBUG_FPGA
#undef DEBUG_SIMULATE
#define DEBUG_SIMULATE
//enables mapping of DIPLODOCUS channels onto buses
#define BUS_ENABLED
//cost of a send/wait command
......
......@@ -812,6 +812,10 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
SchedulableDevice* deviceLET;
CPU* depCPU;
FPGA* depFPGA;
bool isFinish=true;
#ifdef DEBUG_KERNEL
std::cout << "kernel:simulate: first schedule" << std::endl;
#endif
......@@ -837,6 +841,11 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
if (_wasReset) NOTIFY_SIM_STARTED();
_wasReset=false;
#endif
if( transLET !=0 && _simComp->getStopFlag())
isFinish=false;
while ( transLET!=0 && !_simComp->getStopFlag()){
#ifdef DEBUG_SIMULATE
std::cout<<"come in cpu"<<std::endl;
......@@ -846,14 +855,14 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
#endif
commandLET=transLET->getCommand();
if(transLET!=0 && transLET->getCommand()->getTask()->getIsDaemon()==true){
if(transLET->getStartTime() >= deviceLET->getSimulatedTime()){
// std::cout<<"bigger time"<<std::endl;
bool isFinish=true;
if(_simComp->getNonDaemonTaskList().empty())
break;
for(TaskList::const_iterator i=_simComp->getNonDaemonTaskList().begin(); i != _simComp->getNonDaemonTaskList().end(); ++i){
// std::cout<<"non dameon task"<<(*i)->toString()<<" state is "<<(*i)->getState()<<std::endl;
if((*i)->getState()!=3 && (*i)->getState()!=0){
// std::cout<<"non dameon task"<<(*i)->toString()<<" state is "<<(*i)->getState()<<(*i)->getCurrCommand()->toString()<<std::endl;
if((*i)->getState()!=3){
// std::cout<<"not stop"<<std::endl;
isFinish=false;
break;
......@@ -863,6 +872,8 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
break;
}
}
else
isFinish=false;
#ifdef DEBUG_SIMULATE
......@@ -1000,6 +1011,9 @@ bool Simulator::simulate(TMLTransaction*& oLastTrans){
}
bool aSimCompleted = ( transLET==0 && !_simComp->getStoppedOnAction());
if(isFinish==true)
aSimCompleted = true;
if (aSimCompleted){
#ifdef LISTENERS_ENABLED
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment