Commit 3e1ad091 authored by Ludovic Apvrille's avatar Ludovic Apvrille

Merge branch 'master' into 'minh-help'

# Conflicts:
#   src/main/java/ui/window/JDialogCPUNode.java
parents e40eb6d1 3a7875af
......@@ -18,8 +18,8 @@ updateruntime:
cp mutekh/libmwmr/include/mwmr/mwmr.h mutekh/examples/avatar
cp mutekh/libsyscams/*.c mutekh/examples/avatar
cp mutekh/libsyscams/*.h mutekh/examples/avatar
cp src/*.c ~/TTool/MPSoC/mutekh/examples/avatar
cp src/*.h ~/TTool/MPSoC/mutekh/examples/avatar
cp src/*.c mutekh/examples/avatar
cp src/*.h mutekh/examples/avatar
updategeneratedcode:
......
13000
\ No newline at end of file
13005
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -46,7 +46,7 @@
MemPoolNoDel<TMLTransaction> TMLTransaction::memPool(BLOCK_SIZE_TRANS);
TMLTransaction::TMLTransaction():_runnableTime(0), _startTime(0), _length(0), _virtualLength(0), _command(0),
TMLTransaction::TMLTransaction():_runnableTime(0), _startTime(0), _length(0), _virtualLength(0), _command(0),_transactCoreNumber(0),_transVcdOutputState(END_IDLE_TRANS),
#ifdef PENALTIES_ENABLED
_idlePenalty(0), _taskSwitchingPenalty(0), //, _branchingPenalty(0),
#endif
......
......@@ -48,6 +48,13 @@
//class TMLCommand;
class TMLChannel;
enum vcdTransVisState
{
END_IDLE_TRANS,
END_PENALTY_TRANS,
END_TASK_TRANS
};
class TMLTransaction {
public:
///Constructor
......@@ -241,6 +248,10 @@ class TMLTransaction {
inline void setStateID(ID iID) {_stateID=iID;}
inline ID getStateID() {return _stateID;}
inline void setTaskID(ID iID) {_taskID=iID;}
inline unsigned int getTransactCoreNumber() {return _transactCoreNumber;}
inline void setTransactCoreNumber(unsigned int num) {_transactCoreNumber=num;}
inline void setTransVcdOutPutState(vcdTransVisState n) {_transVcdOutputState=n;}
inline vcdTransVisState getTransVcdOutPutState() { return _transVcdOutputState;}
void toXML(std::ostringstream& glob, int deviceID, std::string deviceName) const;
......@@ -255,6 +266,10 @@ class TMLTransaction {
TMLLength _virtualLength;
///Pointer to the command the transaction belongs to
TMLCommand* _command;
///Core number of the transaction
unsigned int _transactCoreNumber;
///State variable for the cpu VCD output
vcdTransVisState _transVcdOutputState;
#ifdef PENALTIES_ENABLED
///Idle penalty
TMLTime _idlePenalty;
......
......@@ -67,9 +67,10 @@ BusMaster* TMLChannel::getNextMaster(TMLTransaction* iTrans){
}
BusMaster* TMLChannel::getFirstMaster(TMLTransaction* iTrans){
std::cout<<"get First master"<<std::endl;
//if (iTrans->getCommand()->getTask()==_writeTask){
//std::cout << "fima 1\n";
if (_masters==0 || _slaves==0 || _numberOfHops==0) return 0;
if (_masters==0 || _slaves==0 || _numberOfHops==0 ) {return 0;}
//std::cout << "fima 2\n";
if (iTrans==_writeTrans){
//if (iTrans->getCommand()->getTask()==_writeTask){
......@@ -78,9 +79,10 @@ BusMaster* TMLChannel::getFirstMaster(TMLTransaction* iTrans){
return _masters[_writeTransCurrHop];
}else{
//std::cout << "fima 4\n";
if (_slaves[(_numberOfHops/2)]==0) return 0; //NEW!!!
if (_slaves[(_numberOfHops/2)]==0) {return 0;} //NEW!!!
//std::cout << "fima 5\n";
_readTransCurrHop=_numberOfHops-1;
return _masters[_readTransCurrHop];
}
}
......
......@@ -61,6 +61,7 @@ void TMLbrbwChannel::testRead(TMLTransaction* iTrans){
}
void TMLbrbwChannel::write(){
std::cout<<"write!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<<std::endl;
#ifdef LOSS_ENABLED
if (_maxNbOfLosses > _nbOfLosses){
TMLLength aLostBytes = _writeTrans->getVirtualLength() * _lossRate + _lossRemainder;
......
......@@ -91,7 +91,7 @@ void Bus::schedule(){
//Adds the transaction determined by the scheduling algorithm to the internal list of scheduled transactions
bool Bus::addTransaction(TMLTransaction* iTransToBeAdded){
//std::cout << "Bus add trans " << _nextTransaction << "\n";
std::cout << "Bus add trans ####" << _nextTransaction << "\n";
_endSchedule = _nextTransaction->getEndTime();
//std::cout << "set end time to " << _endSchedule << "\n";
//_transactList.push_back(_nextTransaction);
......@@ -257,12 +257,14 @@ void Bus::latencies2XML(std::ostringstream& glob, unsigned int id1, unsigned int
//Returns the next signal change (for vcd output)
void Bus::getNextSignalChange(bool iInit, SignalChangeData* oSigData){
std::cout<<"bus getnext"<<std::endl;
//std::ostringstream outp;
//std::cout << _transactList.size() << " elements in List of " << _name << std::endl;
if (iInit){
_posTrasactListVCD=_transactList.begin();
_previousTransEndTime=0;
_vcdOutputState=INIT_BUS;
std::cout<<"bus init"<<std::endl;
}
if (_posTrasactListVCD == _transactList.end()){
//outp << VCD_PREFIX << vcdValConvert(END_IDLE_BUS) << "bus" << _ID;
......@@ -270,11 +272,13 @@ void Bus::getNextSignalChange(bool iInit, SignalChangeData* oSigData){
//oNoMoreTrans=true;
//return _previousTransEndTime;
new (oSigData) SignalChangeData(END_IDLE_BUS, _previousTransEndTime, this);
std::cout<<"bus end "<<std::endl;
}else{
TMLTransaction* aCurrTrans=*_posTrasactListVCD;
//oNoMoreTrans=false;
switch (_vcdOutputState){
case END_READ_BUS:
std::cout<<"BUS END_READ_BUS"<<std::endl;
do{
_previousTransEndTime=(*_posTrasactListVCD)->getEndTime();
_posTrasactListVCD++;
......@@ -293,6 +297,7 @@ void Bus::getNextSignalChange(bool iInit, SignalChangeData* oSigData){
//return _previousTransEndTime;
break;
case END_WRITE_BUS:
std::cout<<"BUS END_WRTIE_BUS"<<std::endl;
do{
_previousTransEndTime=(*_posTrasactListVCD)->getEndTime();
_posTrasactListVCD++;
......@@ -311,6 +316,7 @@ void Bus::getNextSignalChange(bool iInit, SignalChangeData* oSigData){
//return _previousTransEndTime;
break;
case INIT_BUS:
std::cout<<"BUS INIT_BUS"<<std::endl;
if (aCurrTrans->getStartTimeOperation()!=0){
_vcdOutputState=END_IDLE_BUS;
//outp << VCD_PREFIX << vcdValConvert(END_IDLE_BUS) << "bus" << _ID;
......@@ -320,6 +326,7 @@ void Bus::getNextSignalChange(bool iInit, SignalChangeData* oSigData){
return;
}
case END_IDLE_BUS:
std::cout<<"BUS END_IDLE_BUS"<<std::endl;
if (aCurrTrans->getCommand()->getTask()==aCurrTrans->getChannel()->getBlockedReadTask()){
_vcdOutputState=END_READ_BUS;
new (oSigData) SignalChangeData(END_READ_BUS, aCurrTrans->getStartTimeOperation(), this);
......
......@@ -70,7 +70,7 @@ public:
\param iName Name of the device
\param iScheduler Pointer to the scheduler object
*/
CPU(ID iID, std::string iName, WorkloadSource* iScheduler): SchedulableDevice(iID, iName, iScheduler), _lastTransaction(0)/*,_schedulingNeeded(false)*/{
CPU(ID iID, std::string iName, WorkloadSource* iScheduler, unsigned int iAmountOfCore): SchedulableDevice(iID, iName, iScheduler), _lastTransaction(0), amountOfCore(iAmountOfCore)/*,_schedulingNeeded(false)*/{
}
///Destructor
virtual ~CPU(){
......@@ -111,6 +111,7 @@ public:
SchedulableDevice::writeObject(os);
return os;
}
inline unsigned int getAmoutOfCore(){ return amountOfCore;}
///Invalidate schedule of CPU
/*void setRescheduleFlag(){
_schedulingNeeded=true;
......@@ -158,6 +159,109 @@ public:
std::cout << "Current Trans " << _name << ": ";
if (_nextTransaction==0) std::cout << "0\n"; else std::cout << _nextTransaction->toString() << "\n";
}*/
void schedule2HTML(std::ofstream& myfile) const {
myfile << "<h2><span>Scheduling for device: "<< _name << "</span></h2>" << std::endl;
if ( _transactList.size() == 0 ) {
myfile << "<h4>Device never activated</h4>" << std::endl;
}
else {
myfile << "<table>" << std::endl << "<tr>";
std::map<TMLTask*, std::string> taskCellClasses;
unsigned int nextCellClassIndex = 0;
TMLTime aCurrTime = 0;
for( TransactionList::const_iterator i = _transactList.begin(); i != _transactList.end(); ++i ) {
std::cout<<"get transaction core number is: "<<(*i)->getTransactCoreNumber()<<std::endl;
std::cout<<"time : "<<_cycleTime<<std::endl;
//std::cout << "CPU:calcSTL: html of CPU " << _name << ": " << (*i)->toString() << std::endl;
if( (*i)->getTransactCoreNumber() == this->_cycleTime ){
TMLTransaction* aCurrTrans = *i;
unsigned int aBlanks = aCurrTrans->getStartTime() - aCurrTime;
if ( aBlanks > 0 ) {
writeHTMLColumn( myfile, aBlanks, "not", "idle time" );
}
unsigned int aLength = aCurrTrans->getPenalties();
if ( aLength != 0 ) {
std::ostringstream title;
title << "idle:" << aCurrTrans->getIdlePenalty() << " switch:" << aCurrTrans->getTaskSwitchingPenalty();
writeHTMLColumn( myfile, aLength, "not", title.str() );
}
aLength = aCurrTrans->getOperationLength();
// Issue #4
TMLTask* task = aCurrTrans->getCommand()->getTask();
const std::string cellClass = determineHTMLCellClass( taskCellClasses, task, nextCellClassIndex );
writeHTMLColumn( myfile, aLength, cellClass, aCurrTrans->toShortString() );
aCurrTime = aCurrTrans->getEndTime();
}
}
myfile << "</tr>" << std::endl << "<tr>";
for ( unsigned int aLength = 0; aLength < aCurrTime; aLength++ ) {
myfile << "<th></th>";
}
myfile << "</tr>" << std::endl << "<tr>";
for ( unsigned int aLength = 0; aLength <= aCurrTime; aLength += 5 ) {
std::ostringstream spanVal;
spanVal << aLength;
writeHTMLColumn( myfile, 5, "sc", "", spanVal.str(), false );
//myfile << "<td colspan=\"5\" class=\"sc\">" << aLength << "</td>";
}
myfile << "</tr>" << std::endl << "</table>" << std::endl << "<table>" << std::endl << "<tr>";
for( std::map<TMLTask*, std::string>::iterator taskColIt = taskCellClasses.begin(); taskColIt != taskCellClasses.end(); ++taskColIt ) {
TMLTask* task = (*taskColIt).first;
// Unset the default td max-width of 5px. For some reason setting the max-with on a specific t style does not work
myfile << "<td class=\"" << taskCellClasses[ task ] << "\"></td><td style=\"max-width: unset;\">" << task->toString() << "</td><td class=\"space\"></td>";
}
myfile << "</tr>" << std::endl;
#ifdef ADD_COMMENTS
bool aMoreComments = true, aInit = true;
Comment* aComment;
while ( aMoreComments ) {
aMoreComments = false;
myfile << "<tr>";
for( std::map<TMLTask*, std::string>::iterator taskColIt = taskCellClasses.begin(); taskColIt != taskCellClasses.end(); ++taskColIt ) {
//for(TaskList::const_iterator j=_taskList.begin(); j != _taskList.end(); ++j){
TMLTask* task = (*taskColIt).first;
std::string aCommentString = task->getNextComment( aInit, aComment );
if ( aComment == 0 ) {
myfile << "<td></td><td></td><td class=\"space\"></td>";
}
else {
replaceAll(aCommentString,"<","&lt;");
replaceAll(aCommentString,">","&gt;");
aMoreComments = true;
myfile << "<td style=\"max-width: unset;\">" << aComment->_time << "</td><td><pre>" << aCommentString << "</pre></td><td class=\"space\"></td>";
}
}
aInit = false;
myfile << "</tr>" << std::endl;
}
#endif
myfile << "</table>" << std::endl;
}
}
protected:
///List of all tasks running on the CPU
TaskList _taskList;
......@@ -165,6 +269,8 @@ protected:
TMLTransaction* _lastTransaction;
///List of bus masters
BusMasterList _busMasterList;
///Amount of cores
unsigned int amountOfCore;
///Dirty flag of the current scheduling decision
//bool _schedulingNeeded;
};
......
......@@ -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, WorkloadSource* iScheduler2,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);
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);
///Destructor
virtual ~MultiCoreCPU();
///Determines the next CPU transaction to be executed
......@@ -145,6 +145,20 @@ protected:
BusMaster* _masterNextTransaction;
///1/Processor frequency
TMLTime _timePerCycle;
///test////
unsigned int coreNumber;
//first parameter is the core number
///second parameter is the end schedule in the core
std::map <unsigned int, unsigned int> multiCore;
///initialization of all cores
void initCore();
///get the avaliable core
unsigned int getCoreNumber();
//inline void setCoreNumber(unsigned int n) { coreNumber=n;}
///return the minimum time of the end schedule in all cores
TMLTime getMinEndSchedule();
///end
#ifdef PENALTIES_ENABLED
///Pipeline size
unsigned int _pipelineSize;
......@@ -170,7 +184,7 @@ protected:
TMLTime _changeIdleModeTime;
#endif
///State variable for the VCD output
vcdCPUVisState _vcdOutputState;
//vcdCPUVisState _vcdOutputState;
};
#endif
......@@ -51,7 +51,8 @@ SchedulableDevice::SchedulableDevice( ID iID,
_deleteScheduler(true),
_busyCycles(0),
_static_consumPerCycle (15),
_dynamic_consumPerCycle (35) {
_dynamic_consumPerCycle (35),
_cycleTime(0) {
_transactList.reserve( BLOCK_SIZE_TRANS );
}
......@@ -183,7 +184,7 @@ std::string SchedulableDevice::determineHTMLCellClass( std::map<TMLTask*, std::
return taskColors[ task ];
}
void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const {
void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const {
myfile << "<h2><span>Scheduling for device: "<< _name << "</span></h2>" << std::endl;
if ( _transactList.size() == 0 ) {
......@@ -197,6 +198,10 @@ void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const {
TMLTime aCurrTime = 0;
for( TransactionList::const_iterator i = _transactList.begin(); i != _transactList.end(); ++i ) {
std::cout<<"get transaction core number is: "<<(*i)->getTransactCoreNumber()<<std::endl;
std::cout<<"time : "<<_cycleTime<<std::endl;
std::cout << "CPU:calcSTL: html of CPU " << _name << ": " << (*i)->toString() << std::endl;
//if( (*i)->getTransactCoreNumber() == this->_cycleTime ){
TMLTransaction* aCurrTrans = *i;
unsigned int aBlanks = aCurrTrans->getStartTime() - aCurrTime;
......@@ -221,7 +226,9 @@ void SchedulableDevice::schedule2HTML(std::ofstream& myfile) const {
writeHTMLColumn( myfile, aLength, cellClass, aCurrTrans->toShortString() );
aCurrTime = aCurrTrans->getEndTime();
// }
}
myfile << "</tr>" << std::endl << "<tr>";
......
......@@ -148,6 +148,8 @@ public:
static TMLTime getOverallTransNo() { return _overallTransNo; }
static TMLTime getOverallTransSize() { return _overallTransSize; }
inline void setCycleTime (unsigned int t) { _cycleTime =t; }
inline unsigned int getCycleTime() { return _cycleTime; }
protected:
///Unique ID of the device
......@@ -171,9 +173,10 @@ protected:
///Busy cycles since simulation start
TMLTime _busyCycles;
unsigned int _static_consumPerCycle;
unsigned int _dynamic_consumPerCycle;
unsigned int _dynamic_consumPerCycle;
static TMLTime _overallTransNo;
static TMLTime _overallTransSize;
unsigned int _cycleTime;
static void writeHTMLColumn( std::ofstream& myfile,
const unsigned int colSpan,
......
......@@ -59,7 +59,7 @@ SingleCoreCPU::SingleCoreCPU( ID iID,
unsigned int iBranchingMissrate,
unsigned int iChangeIdleModeCycles,
unsigned int iCyclesBeforeIdle,
unsigned int ibyteDataSize ) : CPU( iID, iName, iScheduler ), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle)
unsigned int ibyteDataSize ) : CPU( iID, iName, iScheduler, 1), /*_lastTransaction(0),*/ _masterNextTransaction(0), _timePerCycle(iTimePerCycle)
#ifdef PENALTIES_ENABLED
, _pipelineSize(iPipelineSize), _taskSwitchingCycles(iTaskSwitchingCycles),_brachingMissrate(iBranchingMissrate)
, _changeIdleModeCycles(iChangeIdleModeCycles), _cyclesBeforeIdle(iCyclesBeforeIdle)
......
......@@ -91,6 +91,7 @@ public class SysCAMSSpecification{
for (SysCAMSTComponent blockGPIO2VCI : components) {
if (blockGPIO2VCI instanceof SysCAMSTBlockGPIO2VCI) {
blocksGPIO2VCI.add((SysCAMSTBlockGPIO2VCI) blockGPIO2VCI);
//System.out.println("@@@@@GPIO block found in spec");
}
}
return blocksGPIO2VCI;
......@@ -238,6 +239,14 @@ public class SysCAMSSpecification{
}
return cons;
}
public LinkedList<SysCAMSTConnector> getAllConnectors(){
LinkedList<SysCAMSTConnector> cons = new LinkedList<SysCAMSTConnector>();
for (SysCAMSTConnector con : connectors) {
cons.add(con);
}
return cons;
}
public int getNbBlockTDF(){
return (getAllBlockTDF()).size();
......
......@@ -59,13 +59,14 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
private DefaultListModel<String> listStruct;
private String nameTemplate;
private String typeTemplate;
private String valueTemplate;
private DefaultListModel<String> listTypedef;
private SysCAMSTCluster cluster;
private LinkedList<SysCAMSTPortDE> portDE;
public SysCAMSTBlockDE(String _name, String _nameFn, String _code, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
public SysCAMSTBlockDE(String _name, String _nameFn, String _code, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, String _valueTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
name = _name;
// period = _period;
// time = _time;
......@@ -74,6 +75,7 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
listStruct = _listStruct;
nameTemplate = _nameTemplate;
typeTemplate = _typeTemplate;
valueTemplate = _valueTemplate;
listTypedef = _listTypedef;
cluster = _cluster;
portDE = new LinkedList<SysCAMSTPortDE>();
......@@ -110,6 +112,10 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
public String getTypeTemplate() {
return typeTemplate;
}
public String getValueTemplate() {
return valueTemplate;
}
public DefaultListModel<String> getListTypedef() {
return listTypedef;
......@@ -126,4 +132,4 @@ public class SysCAMSTBlockDE extends SysCAMSTComponent {
public void addPortDE(SysCAMSTPortDE de){
portDE.add(de);
}
}
\ No newline at end of file
}
......@@ -57,9 +57,11 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
private double period;
private String time;
private String processCode;
private String constructorCode;
private DefaultListModel<String> listStruct;
private String nameTemplate;
private String typeTemplate;
private String valueTemplate;
private DefaultListModel<String> listTypedef;
private SysCAMSTCluster cluster;
......@@ -67,21 +69,25 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
private LinkedList<SysCAMSTPortTDF> portTDF;
private LinkedList<SysCAMSTPortConverter> portConverter;
private SysCAMSTPortConverter localPortConverter;
private LinkedList<SysCAMSTPortConverter> localPortConverterList;
private int n;
private boolean isTimestepPropagated;
public SysCAMSTBlockTDF(String _name, double _period, String _time, String _processCode, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
public SysCAMSTBlockTDF(String _name, double _period, String _time, String _processCode, String _constructorCode, DefaultListModel<String> _listStruct, String _nameTemplate, String _typeTemplate, String _valueTemplate, DefaultListModel<String> _listTypedef, SysCAMSTCluster _cluster) {
name = _name;
period = _period;
time = _time;
processCode = _processCode;
constructorCode = _constructorCode;
listStruct = _listStruct;
nameTemplate = _nameTemplate;
typeTemplate = _typeTemplate;
valueTemplate = _valueTemplate;
listTypedef = _listTypedef;
cluster = _cluster;
portTDF = new LinkedList<SysCAMSTPortTDF>();
portConverter = new LinkedList<SysCAMSTPortConverter>();
localPortConverterList = new LinkedList<SysCAMSTPortConverter>();
n = 0;
isTimestepPropagated = false;
}
......@@ -105,6 +111,10 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
public String getProcessCode() {
return processCode;
}
public String getConstructorCode() {
return constructorCode;
}
public DefaultListModel<String> getListStruct() {
return listStruct;
......@@ -117,6 +127,10 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
public String getTypeTemplate() {
return typeTemplate;
}
public String getValueTemplate() {
return valueTemplate;
}
public DefaultListModel<String> getListTypedef() {
return listTypedef;
......@@ -153,8 +167,19 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
public void syncTDFBlockDEBlock(double[] time_prev) throws SysCAMSValidateException {
double tp;
try{
//Order list to have input converter ports first, in case of multirate-multiport single-modules
localPortConverterList.clear();
for(int i = 0; i < portConverter.size(); i++) {
localPortConverter = portConverter.get(i);
if(localPortConverter.getOrigin() == 0) { //Input
localPortConverterList.addFirst(localPortConverter);
} else if (localPortConverter.getOrigin() == 1) { //Output
localPortConverterList.addLast(localPortConverter);
}
}
for(int i = 0; i < localPortConverterList.size(); i++) {
localPortConverter = localPortConverterList.get(i);
if(localPortConverter.getOrigin() == 0) { //Input
check_causality_in(time_prev);
} else if (localPortConverter.getOrigin() == 1) { //Output
......@@ -169,8 +194,7 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
}
private void check_causality_in(double[] time_prev_max) throws SysCAMSValidateException {
double time_now_min_tdf, time_now_max_tdf, time_tmp_tdf, time_tmp_de,
time_now_min_de, time_now_max_de;
double time_now_max_de;
double tm = 0.0;
double tp = 0.0;
int r = 1;
......@@ -185,41 +209,22 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
if(localPortConverter.getDelay() > 0)
d = localPortConverter.getDelay();
time_now_min_tdf = (n*tm)+((k-1)*tp);
time_now_max_tdf = (n*tm)+((k-1)*tp);
time_now_min_de = (n*tm)+((k-1)*tp)-(d*tp);
time_now_max_de = (n*tm)+((k-1)*tp)-(d*tp);
for (k = 1; k <= r; k++) {
time_tmp_tdf = (n*tm)+((k-1)*tp);
time_tmp_de = (n*tm)+((k-1)*tp)-(d*tp);
System.out.println("tmstmp_in_tdf: " + time_tmp_tdf);
System.out.println("tmstmp_in_de: " + time_tmp_de);
time_now_min_tdf = Math.min(time_tmp_tdf, time_now_min_tdf);
time_now_max_tdf = Math.max(time_tmp_tdf, time_now_max_tdf);
time_now_min_de = Math.min(time_tmp_de, time_now_min_de);
time_now_max_de = Math.max(time_tmp_de, time_now_max_de);
System.out.println("time_now_min_de: " + time_now_min_de);
System.out.println("time_now_max_de: " + time_now_max_de);
System.out.println("time_now_min_tdf: " + time_now_min_tdf);
System.out.println("time_now_max_tdf: " + time_now_max_tdf);
}
time_now_max_de = (n*tm)+((r-1)*tp)-(d*tp);
System.out.println("time_prev_max_out: " + time_prev_max[1]);
if(time_now_min_tdf < time_prev_max[1]) {
localPortConverter.setDelay((int)Math.ceil((time_prev_max[1]-time_now_min_de)/tp) + d);
/*if(time_now_min_tdf2 < time_prev_max[1]) {
localPortConverter.setDelay((int)Math.ceil((time_prev_max[1]-time_now_min_tdf2)/tp) + d);
localPortConverter.setRecompute(true);
throw new SysCAMSValidateException("Timestamp of previous write port executed module is: " + time_prev_max[1]
+ " and current timestamp is: " + time_now_min_tdf + ".\n"
+ "Suggested delay in port \"" + localPortConverter.getName() + "\": " + (Math.ceil((time_prev_max[1]-time_now_min_tdf)/tp) + d));
}
+ "Suggested delay in port \"" + localPortConverter.getName() + "\" using time_now_min_tdf: " + (Math.ceil((time_prev_max[1]-time_now_min_tdf)/tp) + d)
+ " and using time_now_min_de: " + (Math.ceil((time_prev_max[1]-time_now_min_de)/tp) + d));
}*/
time_prev_max[0] = Double.valueOf(Math.max(time_prev_max[0],time_now_max_de));
System.out.println("New time_prev_max_in: " + time_prev_max[0]);
}
private void check_causality_out(double[] time_prev_max) throws SysCAMSValidateException {
double time_now_min_tdf, time_now_max_tdf, time_tmp_tdf, time_tmp_de,
time_now_min_de, time_now_max_de;
double time_now_min_tdf, time_now_max_de2;
double tm = 0.0;
double tp = 0.0;
int r = 1;
......@@ -234,36 +239,19 @@ public class SysCAMSTBlockTDF extends SysCAMSTComponent {
if(localPortConverter.getDelay() > 0)
d = localPortConverter.getDelay();
time_now_min_tdf = (n*tm)+((k-1)*tp);
time_now_max_tdf = (n*tm)+((k-1)*tp);
time_now_min_de = (n*tm)+((k-1)*tp)+(d*tp);
time_now_max_de = (n*tm)+((k-1)*tp)+(d*tp);
time_now_min_tdf = (n*tm)+((1-1)*tp)+(d*tp);
time_now_max_de2 = (n*tm)+((r-1)*tp)-(d*tp);
for (k = 1; k <= r; k++) {
time_tmp_tdf = (n*tm)+((k-1)*tp);
time_tmp_de = (n*tm)+((k-1)*tp)+(d*tp);;
System.out.println("tmstmp_out_tdf: " + time_tmp_tdf);
System.out.println("tmstmp_out_de: " + time_tmp_de);
time_now_min_tdf = Math.min(time_tmp_tdf, time_now_min_tdf);
time_now_max_tdf = Math.max(time_tmp_tdf, time_now_max_tdf);
time_now_min_de = Math.min(time_tmp_de, time_now_min_de);
time_now_max_de = Math.max(time_tmp_de, time_now_max_de);
System.out.println("time_now_min_de: " + time_now_min_de);
System.out.println("time_now_max_de: " + time_now_max_de);
System.out.println("time_now_min_tdf: " + time_now_min_tdf);
System.out.println("time_now_max_tdf: " + time_now_max_tdf);
}
System.out.println("time_prev_max_in: " + time_prev_max[0]);
if(time_now_min_de < time_prev_max[0]) {
localPortConverter.setDelay((int)Math.ceil((time_prev_max[0]-time_now_min_de)/tp) + d);
if(time_now_min_tdf < time_prev_max[0]) {
localPortConverter.setDelay((int)Math.ceil((time_prev_max[0]-time_now_min_tdf)/tp) + d);
localPortConverter.setRecompute(true);
throw new SysCAMSValidateException("Timestamp of previous read port executed module is: " + time_prev_max[0]
+ " and current timestamp is: " + time_now_min_de + ".\n"
+ "Suggested delay in port " + localPortConverter.getName() + ": " + (Math.ceil((time_prev_max[0]-time_now_min_de)/tp) + d));
+ " and current timestamp is: " + time_now_min_tdf + ".\n"
+ "Suggested delay in port " + localPortConverter.getName() + ": " + (Math.ceil((time_prev_max[0]-time_now_min_tdf)/tp) + d));
}
time_prev_max[1] = Double.valueOf(Math.max(time_prev_max[1],time_now_max_tdf));
System.out.println("New time_prev_max_out: " + time_prev_max[1]);
time_prev_max[1] = Double.valueOf(Math.max(time_prev_max[1],time_now_max_de2));
}
public void setN(int _n) {
......
......@@ -58,6 +58,7 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent {
private int delay;
private int origin;
private String TDFType;
private boolean recompute;
private SysCAMSTBlockTDF blockTDF;
private ELNTCluster cluster;
......@@ -71,6 +72,7 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent {
delay = _delay;
origin = _origin;
TDFType = _TDFType;
recompute = false;
blockTDF = _blockTDF;
}
......@@ -127,6 +129,14 @@ public class SysCAMSTPortTDF extends SysCAMSTComponent {
public void setDelay(int _delay) {
delay = _delay;
}
public boolean getRecompute() {