Commit b49cd333 authored by Siyuan Niu's avatar Siyuan Niu

html model name and vcd change

parent 98e8b653
......@@ -70,7 +70,8 @@ public:
\param iName Name of the device
\param iScheduler Pointer to the scheduler object
*/
CPU(ID iID, std::string iName, WorkloadSource* iScheduler, unsigned int iAmountOfCore): SchedulableDevice(iID, iName, iScheduler), _lastTransaction(0), amountOfCore(iAmountOfCore)/*,_schedulingNeeded(false)*/{
CPU(ID iID, std::string iName, WorkloadSource* iScheduler, unsigned int iAmountOfCore, std::string iModelName): SchedulableDevice(iID, iName, iScheduler), _lastTransaction(0),
amountOfCore(iAmountOfCore), _modelName(iModelName)/*,_schedulingNeeded(false)*/{
}
///Destructor
virtual ~CPU(){
......@@ -112,6 +113,9 @@ public:
return os;
}
inline unsigned int getAmoutOfCore(){ return amountOfCore;}
inline std::string getModelName() {return _modelName;}
//inline void setModelName(std::string s) {_modelName=s;}
//inline std::string getModelName() {return _modelName;}
///Invalidate schedule of CPU
/*void setRescheduleFlag(){
_schedulingNeeded=true;
......@@ -270,7 +274,9 @@ protected:
///List of bus masters
BusMasterList _busMasterList;
///Amount of cores
unsigned int amountOfCore;
unsigned int amountOfCore;
///model name
std::string _modelName;
///Dirty flag of the current scheduling decision
//bool _schedulingNeeded;
};
......
......@@ -51,6 +51,7 @@
MultiCoreCPU::MultiCoreCPU(ID iID,
std::string iName,
WorkloadSource* iScheduler,
std::string iModelName,
TMLTime iTimePerCycle,
unsigned int iCyclesPerExeci,
unsigned int iCyclesPerExecc,
......@@ -60,7 +61,8 @@ MultiCoreCPU::MultiCoreCPU(ID iID,
unsigned int iChangeIdleModeCycles,
unsigned int iCyclesBeforeIdle,
unsigned int ibyteDataSize,
unsigned int iAmountOfCore): CPU(iID, iName, iScheduler, iAmountOfCore), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle), coreNumber(0)
unsigned int iAmountOfCore): CPU(iID, iName, iScheduler, iAmountOfCore, iModelName), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle),
coreNumber(0)
#ifdef PENALTIES_ENABLED
, _pipelineSize(iPipelineSize), _taskSwitchingCycles(iTaskSwitchingCycles),_brachingMissrate(iBranchingMissrate)
, _changeIdleModeCycles(iChangeIdleModeCycles), _cyclesBeforeIdle(iCyclesBeforeIdle)
......@@ -581,17 +583,14 @@ void MultiCoreCPU::getNextSignalChange(bool iInit, SignalChangeData* oSigData){
std::cout<<"END_TASK_CPU"<<std::endl;
do{
std::cout<<"1111"<<std::endl;
_previousTransEndTime=(*_posTrasactListVCD)->getEndTime();
_posTrasactListVCD++;
std::cout<<"2222"<<std::endl;
_posTrasactListVCD++;
while(_posTrasactListVCD != _transactList.end()){
if((*_posTrasactListVCD)->getTransactCoreNumber() == oSigData->_coreNumberVcd)
break;
else
_posTrasactListVCD++;
}
std::cout<<"3333"<<std::endl;
}while (_posTrasactListVCD != _transactList.end() && (*_posTrasactListVCD)->getStartTimeOperation()==_previousTransEndTime);
// std::cout<<"4444"<<std::endl;
if (_posTrasactListVCD != _transactList.end() && (*_posTrasactListVCD)->getStartTime()==_previousTransEndTime){
......
......@@ -77,7 +77,7 @@ public:
\param iCyclesBeforeIdle Idle cycles which elapse before entering idle mode
\param ibyteDataSize Machine word length
*/
MultiCoreCPU(ID iID, std::string iName, WorkloadSource* iScheduler,TMLTime iTimePerCycle, unsigned int iCyclesPerExeci, unsigned int iCyclesPerExecc, unsigned int iPipelineSize, unsigned int iTaskSwitchingCycles, unsigned int iBranchingMissrate, unsigned int iChangeIdleModeCycles, unsigned int iCyclesBeforeIdle, unsigned int ibyteDataSize, unsigned int iAmountOfCore);
MultiCoreCPU(ID iID, std::string iName, WorkloadSource* iScheduler,std::string iModelName,TMLTime iTimePerCycle, unsigned int iCyclesPerExeci, unsigned int iCyclesPerExecc, unsigned int iPipelineSize, unsigned int iTaskSwitchingCycles, unsigned int iBranchingMissrate, unsigned int iChangeIdleModeCycles, unsigned int iCyclesBeforeIdle, unsigned int ibyteDataSize, unsigned int iAmountOfCore);
///Destructor
virtual ~MultiCoreCPU();
///Determines the next CPU transaction to be executed
......
......@@ -51,6 +51,7 @@
SingleCoreCPU::SingleCoreCPU( ID iID,
std::string iName,
WorkloadSource* iScheduler,
std::string iModelName,
TMLTime iTimePerCycle,
unsigned int iCyclesPerExeci,
unsigned int iCyclesPerExecc,
......@@ -59,7 +60,7 @@ SingleCoreCPU::SingleCoreCPU( ID iID,
unsigned int iBranchingMissrate,
unsigned int iChangeIdleModeCycles,
unsigned int iCyclesBeforeIdle,
unsigned int ibyteDataSize ) : CPU( iID, iName, iScheduler, 1), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle)
unsigned int ibyteDataSize ) : CPU( iID, iName, iScheduler, 1, iModelName), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle)
#ifdef PENALTIES_ENABLED
, _pipelineSize(iPipelineSize), _taskSwitchingCycles(iTaskSwitchingCycles),_brachingMissrate(iBranchingMissrate)
, _changeIdleModeCycles(iChangeIdleModeCycles), _cyclesBeforeIdle(iCyclesBeforeIdle)
......
......@@ -77,7 +77,7 @@ public:
\param iCyclesBeforeIdle Idle cycles which elapse before entering idle mode
\param ibyteDataSize Machine word length
*/
SingleCoreCPU(ID iID, std::string iName, WorkloadSource* iScheduler, TMLTime iTimePerCycle, unsigned int iCyclesPerExeci, unsigned int iCyclesPerExecc, unsigned int iPipelineSize, unsigned int iTaskSwitchingCycles, unsigned int iBranchingMissrate, unsigned int iChangeIdleModeCycles, unsigned int iCyclesBeforeIdle, unsigned int ibyteDataSize);
SingleCoreCPU(ID iID, std::string iName, WorkloadSource* iScheduler, std::string iModelName, TMLTime iTimePerCycle, unsigned int iCyclesPerExeci, unsigned int iCyclesPerExecc, unsigned int iPipelineSize, unsigned int iTaskSwitchingCycles, unsigned int iBranchingMissrate, unsigned int iChangeIdleModeCycles, unsigned int iCyclesBeforeIdle, unsigned int ibyteDataSize);
///Destructor
virtual ~SingleCoreCPU();
///Determines the next CPU transaction to be executed
......
......@@ -763,6 +763,7 @@ void replaceAll(std::string& ioHTML, std::string iSearch, std::string iReplace);
bool ends_with(std::string const& str, std::string const& suffix);
inline std::string vcdValConvert(unsigned int iVal) {if(iVal==1 || iVal==2) return "1"; else return "0";}
inline std::string vcdTaskValConvert(unsigned int iVal) {if(iVal==2) return "10"; else if(iVal==1) return "01"; else return "00";}
std::string vcdTimeConvert(TMLTime iVal);
int getexename(char* buf, size_t size);
unsigned int getEnabledBranchNo(int iNo, int iMask);
......
......@@ -303,7 +303,7 @@ std::cout<<"schedule2HTML--------------------------------------*****************
std::ofstream myfile(iTraceFileName.c_str());
myfile<<"file name: "<<iTraceFileName.c_str()<<std::endl;
myfile<<"model name: "<<(*_simComp->getCPUList().begin())->getModelName();
if (myfile.is_open()) {
myfile << " date: " << asctime(aTimeinfo)<<std::endl;
......@@ -429,7 +429,10 @@ void Simulator::schedule2VCD(std::string& iTraceFileName) const{
}
}
else{
myfile << "$var wire 1 " << (*i)->toShortString() << " " << (*i)->toString() << " $end\n";
if(((*i)->toShortString().substr(0,2) == "ta"))
myfile << "$var wire 2 " << (*i)->toShortString() << " " << (*i)->toString() << " $end\n";
else
myfile << "$var wire 1 " << (*i)->toShortString() << " " << (*i)->toString() << " $end\n";
aTopElement = new SignalChangeData();
(*i)->getNextSignalChange(true, aTopElement);
aQueue.push(aTopElement);
......@@ -440,17 +443,6 @@ void Simulator::schedule2VCD(std::string& iTraceFileName) const{
// (dynamic_cast<CPU*>(*i))->setCycleTime( (dynamic_cast<CPU*>(*i))->getCycleTime()+1);
//if sucess, make it as a fonction !!!! change
for (TraceableDeviceList::const_iterator i=_simComp->getVCDList().begin(); i!= _simComp->getVCDList().end(); ++i){
if ((*i)->toShortString().substr(0,3) == "cpu"){
for(unsigned int j = 0; j < (dynamic_cast<CPU*>(*i))->getAmoutOfCore(); j++) {
(dynamic_cast<CPU*>(*i))->setCycleTime(0);
}
}
}
myfile << "$var integer 32 clk Clock $end\n";
myfile << "$upscope $end\n$enddefinitions $end\n\n";
......@@ -480,7 +472,9 @@ void Simulator::schedule2VCD(std::string& iTraceFileName) const{
}
//myfile << aTopElement->_sigChange << "\n";
if( aTopElement->_device->toShortString().substr(0,3) == "cpu")
myfile << vcdValConvert(aTopElement->_sigChange) << aTopElement->_device->toShortString() << "_core" << aTopElement->_coreNumberVcd << "\n";
myfile << vcdValConvert(aTopElement->_sigChange) << aTopElement->_device->toShortString() << "_core" << aTopElement->_coreNumberVcd << "\n";
else if(aTopElement->_device->toShortString().substr(0,2) == "ta")
myfile <<"b"<< vcdTaskValConvert(aTopElement->_sigChange) <<" "<< aTopElement->_device->toShortString() << "\n";
else myfile << vcdValConvert(aTopElement->_sigChange) << aTopElement->_device->toShortString() << "\n";
aQueue.pop();
TMLTime aTime = aTopElement->_time;
......
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