AbstractBlock::AbstractBlock() {\r
name = "";\r
parent = NULL;\r
+ specialType = NotSpecial;\r
}\r
\r
/*\r
name = Parameters::normalizeName(str);\r
}\r
\r
+void AbstractBlock::setSpecialType(int type) {\r
+ if ((type >= NotSpecial) && (type <= ClkConvert)) {\r
+ specialType = type;\r
+ }\r
+ else {\r
+ specialType = NotSpecial;\r
+ }\r
+}\r
+\r
void AbstractBlock::setParent(AbstractBlock* _parent) {\r
parent = _parent;\r
}\r
return false;\r
}\r
\r
+bool AbstractBlock::isSpecialBlock() {\r
+ return false;\r
+}\r
+\r
bool AbstractBlock::isGroupBlock() {\r
return false;\r
}\r
return false;\r
}\r
\r
-bool AbstractBlock::isSourceBlock() {\r
+bool AbstractBlock::isStimuliBlock() {\r
return false;\r
}\r
-/* NB: a generator is a block that has no data inputs\r
+/* NB: a source is a block that has no data inputs\r
* and has at least one data output.\r
* By the way, blocks that have no data input/output\r
- * (like clkrstgen) are not generators !\r
+ * (like clkrstgen) are not sources !\r
*/\r
-bool AbstractBlock::isGeneratorBlock() {\r
+bool AbstractBlock::isSourceBlock() {\r
if (getDataInputs().size() > 0) return false;\r
if (getDataOutputs().size() == 0) return false;\r
return true;\r
}\r
\r
+/* NB: a sink is a block without outputs of any type */\r
+bool AbstractBlock::isSinkBlock() {\r
+ if (getOutputs().size() == 0) return true;\r
+ return false;\r
+}\r
+\r
+int AbstractBlock::getSpecialTypeFromString(QString str) {\r
+ if (str == "source") {\r
+ return Source;\r
+ }\r
+ else if (str == "sink") {\r
+ return Sink;\r
+ }\r
+ else if (str == "clkconvert") {\r
+ return ClkConvert;\r
+ }\r
+ return NotSpecial;\r
+}\r
+\r
+\r
void AbstractBlock::addParameter(BlockParameter *param) {\r
params.append(param);\r
}\r
\r
#define AB_TO_REF(ptr) ((ReferenceBlock*)ptr)\r
#define AB_TO_FUN(ptr) ((FunctionalBlock*)ptr)\r
+#define AB_TO_SPE(ptr) ((SpecialBlock*)ptr)\r
#define AB_TO_GRP(ptr) ((GroupBlock*)ptr)\r
\r
using namespace std;\r
public: \r
\r
enum BlockVHDLContext {AnyContext = 0, Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface\r
+ enum SpecialType { NotSpecial = 0, Source = 1, Sink = 2, ClkConvert = 3 };\r
+\r
\r
AbstractBlock();\r
//AbstractBlock(const QString& _name);\r
\r
// getters\r
inline QString getName() { return name; }\r
+ inline int getSpecialType() { return specialType; }\r
+ inline QString getVersion() { return version; }\r
inline int nbParameters() { return params.size(); }\r
inline QList<BlockParameter *> getParameters() { return params; }\r
inline QList<AbstractInterface*> getInputs() { return inputs; }\r
QList<BlockParameter *> getPortParameters();\r
QList<BlockParameter *> getWishboneParameters();\r
inline AbstractBlock* getParent() { return parent; }\r
- inline bool getPatternComputed() { return patternComputed; }\r
+ inline bool getOutputPatternComputed() { return outputPatternComputed; }\r
inline int getTraversalLevel() { return traversalLevel; }\r
\r
// setters\r
void setName(const QString& str);\r
+ void setSpecialType(int type);\r
+ inline void setVersion(const QString& _version) { version = _version; }\r
virtual void setParent(AbstractBlock* _parent);\r
- inline void setPatternComputed(bool state) { patternComputed = state; }\r
+ inline void setOutputPatternComputed(bool state) { outputPatternComputed = state; }\r
inline void resetTraversalLevel() { traversalLevel = -1; }\r
inline void setTraversalLevel(int level) { traversalLevel = level; }\r
\r
// testers\r
virtual bool isReferenceBlock();\r
virtual bool isFunctionalBlock();\r
+ virtual bool isSpecialBlock();\r
virtual bool isGroupBlock();\r
- virtual bool isSourceBlock(); //! a source block is outside the top group and simulates a peripheral (NB: this is also a generator)\r
+ virtual bool isStimuliBlock(); //! a stimuli block is outside the top group and simulates a peripheral (NB: this is also a source)\r
virtual bool isTopGroupBlock();\r
- bool isGeneratorBlock(); //! a generator block has no data inputs and thus executes infinitely\r
+ bool isSourceBlock(); //! a source block has no data inputs and thus executes infinitely\r
+ bool isSinkBlock(); //! a sink block has no data outputs and just collects what it receives (i.e. no compatibility check)\r
bool isWBConfigurable();\r
\r
// others\r
+ int getSpecialTypeFromString(QString str);\r
\r
/*!\r
* \brief connectClkReset connects the clock and reset inputs to a clkrstgen block or the the group ifaces\r
\r
\r
QString name;\r
+ int specialType;\r
+ QString version;\r
\r
// parameters\r
QList<BlockParameter *> params;\r
// others\r
\r
// patterns \r
- bool patternComputed;\r
+ bool outputPatternComputed;\r
int traversalLevel; // the level (0, 1, ...) during the traversal of the graph\r
\r
// NB: only GroupBlock and FunctionalBlock have a real parent, except sources that have no parents\r
return false;
}
-bool AbstractBoxItem::isSourceItem() {
+bool AbstractBoxItem::isStimuliItem() {
return false;
}
#define ABI_TO_BI(ptr) ((BoxItem*)ptr)
#define ABI_TO_GI(ptr) ((GroupItem*)ptr)
-#define ABI_TO_SI(ptr) ((SourceItem*)ptr)
+#define ABI_TO_SI(ptr) ((StimuliItem*)ptr)
class AbstractBoxItem : public QGraphicsItem {
// testers
virtual bool isBoxItem();
virtual bool isGroupItem();
- virtual bool isSourceItem();
+ virtual bool isStimuliItem();
inline bool isSelected() { return selected; }
inline bool isRstClkVisible(){ return rstClkVisible;}
inline bool isWishboneVisible(){ return wishboneVisible;}
cout << "adding block to scene " << v.toInt() << endl;
QHash<QString, int> clkRstToGen;
- for(int i=0;i<layClkRst->rowCount();i++) {
+ for(int i=1;i<nbClock+nbRst;i++) {
QLayoutItem* item = layClkRst->itemAtPosition(i,0);
QLabel* lab = (QLabel *)(item->widget());
item = layClkRst->itemAtPosition(i,1);
QComboBox* combo = (QComboBox *)(item->widget());
clkRstToGen.insert(lab->text(),combo->currentIndex());
+ cout << "addblock: have to connect " << qPrintable(lab->text()) << " to clk/rst n° " << combo->currentIndex() << endl;
}
QWidget* widget = layClkRst->itemAt(0)->widget();
layClkRst->removeWidget(widget);
delete widget;
- }
+ }
if (nbClock != 0) {
delete [] comboClkGen;
nbClock = lstClocks.size();
QList<AbstractInterface*> lstRst = currentRefBlock->getInterfaces(AbstractInterface::Input, AbstractInterface::Reset);
nbRst = lstRst.size();
+ cout << "For chosen block there are " << nbClock << " clocks and " << nbRst << " resets" << endl;
comboClkGen = new QComboBox*[lstClocks.size()];
for(int i=0;i<lstClocks.size();i++) {
fromInterfaceItem = _iface1;
}
}
- else if ((ref1->getOwner()->isSourceBlock()) && (ref2->getOwner()->isTopGroupBlock())) {
+ else if ((ref1->getOwner()->isStimuliBlock()) && (ref2->getOwner()->isTopGroupBlock())) {
fromInterfaceItem = _iface1;
toInterfaceItem = _iface2;
}
- else if ((ref2->getOwner()->isSourceBlock()) && (ref1->getOwner()->isTopGroupBlock())) {
+ else if ((ref2->getOwner()->isStimuliBlock()) && (ref1->getOwner()->isTopGroupBlock())) {
fromInterfaceItem = _iface2;
toInterfaceItem = _iface1;
}
#include "GroupScene.h"
#include "GroupItem.h"
#include "BoxItem.h"
-#include "SourceItem.h"
+#include "StimuliItem.h"
#include "InterfaceItem.h"
#include "ConnectionItem.h"
mainWindow->getLibrary()->updateComboScene();
}
-void Dispatcher::renameSourceBlock(Context context, SourceItem *item){
- static QString fctName = "Dispatcher::renameSourceBlock()";
+void Dispatcher::renameStimuliItem(Context context, StimuliItem *item){
+ static QString fctName = "Dispatcher::renameStimuliItem()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
bool ok = false;
QString text = "";
while (!ok) {
- text = QInputDialog::getText(win, "Rename a source",
+ text = QInputDialog::getText(win, "Rename a stimuli",
"New name:", QLineEdit::Normal,
item->getRefBlock()->getName(), &ok);
if (!ok) return;
ok = false;
}
else {
- FunctionalBlock* block = params->getGraph()->getSourceBlockByName(text);
+ FunctionalBlock* block = params->getGraph()->getStimuliBlockByName(text);
if (block != NULL) {
QMessageBox::warning(win,"Error in given name",
- "the name provided is similar to that of another source block within the top group",
+ "the name provided is similar to that of another stimuli block within the top group",
QMessageBox::Ok);
ok = false;
}
}
}
-void Dispatcher::duplicateSourceItem(Context context, SourceItem *item) {
- static QString fctName = "Dispatcher::duplicateSourceItem()";
+void Dispatcher::duplicateStimuliItem(Context context, StimuliItem *item) {
+ static QString fctName = "Dispatcher::duplicateStimuliItem()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
// adding to the model
FunctionalBlock* funBlock = (FunctionalBlock*)block;
- newBlock = params->getGraph()->duplicateSourceBlock(funBlock);
+ newBlock = params->getGraph()->duplicateStimuliBlock(funBlock);
// adding to the view
- scene->createSourceItem(newBlock);
+ scene->createStimuliItem(newBlock);
params->unsaveModif = true;
}
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
- bool newSource = false;
+ bool newStimuli = false;
BoxItem* item = NULL;
/* For now, this method is only used while designing and not loading */
GroupScene *scene = getSceneById(idScene);
ReferenceBlock* ref = params->getReferenceBlock(idCategory,idBlock);
// if block has no inputs, propose to add it as a source to top scene
- if ((scene->isTopScene()) && (ref->isGeneratorBlock())) {
- int ret = QMessageBox::question(NULL,"Adding a block to top scene","Selected block may be used as a source for the top scene. Do you want to add it as a source ?");
+ if ((scene->isTopScene()) && (ref->isSourceBlock())) {
+ int ret = QMessageBox::question(NULL,"Adding a block to top scene","Selected block may be used as a stimuli for the top scene. Do you want to add it as a stimuli ?");
if (ret == QMessageBox::Yes) {
- newSource = true;
+ newStimuli = true;
}
}
- if (newSource) {
- FunctionalBlock* newOne = params->getGraph()->createSourceBlock(ref, true);
- scene->createSourceItem(newOne);
+ if (newStimuli) {
+ FunctionalBlock* newOne = params->getGraph()->createStimuliBlock(ref, true);
+ scene->createStimuliItem(newOne);
}
else {
}
}
-void Dispatcher::removeSourceItem(Context context, SourceItem *item) {
- static QString fctName = "Dispatcher::removeSourceItem()";
+void Dispatcher::removeStimuliItem(Context context, StimuliItem *item) {
+ static QString fctName = "Dispatcher::removeStimuliItem()";
#ifdef DEBUG_FCTNAME
cout << "call to " << qPrintable(fctName) << endl;
#endif
- QString msg = "Removing source ";
+ QString msg = "Removing stimmuli ";
msg += item->getRefBlock()->getName();
msg += " and all its connections.\n\nAre you sure ?";
- int ret = QMessageBox::question(NULL,"Removing source block",msg, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
+ int ret = QMessageBox::question(NULL,"Removing stimuli block",msg, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
if (ret == QMessageBox::Cancel) {
return;
}
removeAllBlockConnections(context, item);
FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());
- item->getScene()->removeSourceItem(item);
- params->getGraph()->removeSourceBlock(block);
+ item->getScene()->removeStimuliItem(item);
+ params->getGraph()->removeStimuliBlock(block);
}
class AbstractBoxItem;
class GroupItem;
class BoxItem;
-class SourceItem;
+class StimuliItem;
class ConnectionItem;
class InterfaceItem;
class GroupBlock;
void renameFunctionalBlock(Context context, BoxItem* item);
void generateBlockVHDL(Context context, BoxItem* item);
void renameGroupBlock(Context context, GroupItem* item);
- void renameSourceBlock(Context context, SourceItem* item);
- void removeSourceItem(Context context, SourceItem* item);
- void duplicateSourceItem(Context context, SourceItem* item);
+ void renameStimuliItem(Context context, StimuliItem* item);
+ void removeStimuliItem(Context context, StimuliItem* item);
+ void duplicateStimuliItem(Context context, StimuliItem* item);
// interface ops
case BLOCKITEM_INVALID_TYPE : ret = tr("A parameter of type AbstractBlockItem* is used with an incorrect instance type."); break;
case WIDTHS_NOT_EQUALS : ret = tr("Two interfaces are connected but don't have the same widths."); break;
case INVALID_VALUE : ret = tr("parameter value is not correct (e.g. not numeric, invalid other parameter name, ...)."); break;
- case INVALID_REFBLOCK_USE : ret = tr("a reference block is used during pattern computations"); break;
+ case INVALID_FUNBLOCK_USE : ret = tr("a functional block is used for an unauthorized operation while analyzing the design"); break;
+ case INVALID_REFBLOCK_USE : ret = tr("a reference block is used for an unauthorized operation while analyzing the design"); break;
+ case INVALID_GROUPBLOCK_USE : ret = tr("a group block is used for an unauthorized operation while analyzing the design"); break;
case INVALID_DELTA_CP : ret = tr("delta and CP are not consistent"); break;
case EVAL_PARAM_UNKNOWN : ret = tr("a variable used in an expression is not defined as a block parameter"); break;
case EVAL_PARAM_NOVALUE : ret = tr("can't get the double value of a block parameter"); break;
#define INVALID_VALUE 5001
// exception for patterns
-#define INVALID_REFBLOCK_USE 10001
-#define INVALID_GROUPBLOCK_USE 10002
-#define INVALID_DELTA_CP 10003 // delta and CP are not consistent (NB: used during admittance computation)
+#define INVALID_FUNBLOCK_USE 10001
+#define INVALID_REFBLOCK_USE 10002
+#define INVALID_GROUPBLOCK_USE 10003
+
+#define INVALID_DELTA_CP 10004 // delta and CP are not consistent (NB: used during admittance computation)
#define EVAL_PARAM_UNKNOWN 10101 // a variable used in an expression is not defined as a block parameter
#define EVAL_PARAM_NOVALUE 10102 // can't get the double value of a block parameter
\r
public :\r
\r
- enum SourceType { Code = 1, Package, Netlist, InitFile};\r
+ enum ResourceType { Code = 1, Package, Netlist, InitFile};\r
\r
ExternalResource(const QString& _name, const QString& _file, int _type = Code);\r
\r
return true;\r
}\r
\r
-bool FunctionalBlock::isSourceBlock() {\r
+bool FunctionalBlock::isStimuliBlock() {\r
if (parent == NULL) return true;\r
return false;\r
}\r
\r
cout << "create patterns for block " << qPrintable(name) << endl;\r
if (evaluator == NULL) evaluator = new ArithmeticEvaluator();\r
- if (! isGeneratorBlock()) {\r
+ if (! isSourceBlock()) {\r
try {\r
createDelta();\r
createConsumptionPattern(); \r
\r
clearOutputPattern();\r
\r
- /* case 1: the block is a generator for which output pattern\r
- must be computed for a nbExec following executions\r
- */\r
+ if (specialType != NotSpecial) {\r
+ cerr << "Abnormal case: the block is special and output pattern is computed normally" << endl;\r
+ throw(Exception(INVALID_FUNBLOCK_USE,this));\r
+ }\r
\r
- if (nbExec > 0) {\r
- cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl;\r
- foreach(AbstractInterface* iface, getControlOutputs()) {\r
- FunctionalInterface* connIface = AI_TO_FUN(iface);\r
- // create output pattern\r
- QList<char>* pp = productionPattern.value(connIface);\r
- QList<char>* pattern = new QList<char>(*pp);\r
- for(int i=1;i<nbExec;i++) pattern->append(*pp);\r
- // assign pattern to interface\r
- connIface->setOutputPattern(pattern);\r
- // store it in QMap\r
- outputPattern.insert(connIface,pattern); \r
+ cout << "computing output pattern of " << qPrintable(name) << endl;\r
+\r
+ // in case of inputPattern not created, do it\r
+ if (lengthIP <= 0) {\r
+\r
+ cout << "Strange case: input pattern is not created while it is time to compute output pattern !" << endl;\r
+ // collect the input patterns for each input\r
+ try {\r
+ createInputPattern();\r
}\r
+ catch(Exception e) {\r
+ throw(e);\r
+ }\r
+ cout << "input pattern array initialized with min. len " << lengthIP << endl;\r
}\r
- else {\r
- cout << "computing output pattern of " << qPrintable(name) << endl;\r
- \r
- // in case of inputPattern not created, do it\r
- if (lengthIP <= 0) {\r
\r
- cout << "Strange case: input pattern is not created while it is time to compute output pattern !" << endl;\r
- // collect the input patterns for each input \r
- try {\r
- createInputPattern();\r
- }\r
- catch(Exception e) {\r
- throw(e);\r
+ // initialize the output pattern\r
+ lengthOP = 0;\r
+ foreach(AbstractInterface* iface, getControlOutputs()) {\r
+ FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+ lengthOP = lengthIP+productionPattern.value(connIface)->size();\r
+ QList<char>* pattern = new QList<char>();\r
+ for(int i=0;i<lengthOP;i++) pattern->append(0);\r
+ connIface->setOutputPattern(pattern);\r
+ outputPattern.insert(connIface,pattern);\r
+ }\r
+ cout << "output pattern array initialized" << endl;\r
+\r
+ int clock = 0;\r
+ nbExec = 0;\r
+ // search for the beginning of the first execution.\r
+ while ((clock < lengthIP) && (! isValidDataGroup(inputPattern,clock))) clock++;\r
+ cout << "found 1st exec clock: " << clock << endl;\r
+\r
+ while (clock < lengthIP) {\r
+ // initialize counters for current execution.\r
+ int p = 0; // index in production pattern\r
+ int o = 0; // clock+o will give the clock cycle of each output group\r
+ int cip = 0; // clock+cip give the clock cycle of an input group\r
+ int ccp = 0; // ccp give a column in the consumptio pattern\r
+ int nip = 0; // number of input data groups already consumed during the current execution, used while exploring IP\r
+ int ncp = 0; // number of input data groups already consumed during the current execution, used while exploring CP\r
+ bool cannotCompleteExec = false;\r
+ for(int m=0;m<productionCounter.size();m++) {\r
+ // search for the first production in PP\r
+ while (!isValidDataGroup(productionPattern,p)) {\r
+ p += 1;\r
+ o += 1;\r
}\r
- cout << "input pattern array initialized with min. len " << lengthIP << endl;\r
- }\r
- \r
- // initialize the output pattern \r
- lengthOP = 0;\r
- foreach(AbstractInterface* iface, getControlOutputs()) {\r
- FunctionalInterface* connIface = AI_TO_FUN(iface); \r
- lengthOP = lengthIP+productionPattern.value(connIface)->size();\r
- QList<char>* pattern = new QList<char>();\r
- for(int i=0;i<lengthOP;i++) pattern->append(0);\r
- connIface->setOutputPattern(pattern);\r
- outputPattern.insert(connIface,pattern);\r
- }\r
- cout << "output pattern array initialized" << endl;\r
- \r
- int clock = 0;\r
- nbExec = 0;\r
- // search for the beginning of the first execution.\r
- while ((clock < lengthIP) && (! isValidDataGroup(inputPattern,clock))) clock++;\r
- cout << "found 1st exec clock: " << clock << endl;\r
- \r
- while (clock < lengthIP) {\r
- // initialize counters for current execution.\r
- int p = 0; // index in production pattern\r
- int o = 0; // clock+o will give the clock cycle of each output group\r
- int cip = 0; // clock+cip give the clock cycle of an input group\r
- int ccp = 0; // ccp give a column in the consumptio pattern\r
- int nip = 0; // number of input data groups already consumed during the current execution, used while exploring IP\r
- int ncp = 0; // number of input data groups already consumed during the current execution, used while exploring CP\r
- bool cannotCompleteExec = false;\r
- for(int m=0;m<productionCounter.size();m++) {\r
- // search for the first production in PP\r
- while (!isValidDataGroup(productionPattern,p)) {\r
- p += 1;\r
- o += 1;\r
+ int gap = 0; // count the number of extra null columns\r
+ // search for PC(m) valid input group in IP\r
+ while (nip < productionCounter.at(m)) {\r
+ if (clock+cip < lengthIP) {\r
+ if (isValidDataGroup(inputPattern,clock+cip)) nip += 1;\r
+ cip += 1;\r
+ gap += 1;\r
}\r
- int gap = 0; // count the number of extra null columns\r
- // search for PC(m) valid input group in IP\r
- while (nip < productionCounter.at(m)) {\r
- if (clock+cip < lengthIP) {\r
- if (isValidDataGroup(inputPattern,clock+cip)) nip += 1;\r
- cip += 1;\r
- gap += 1;\r
- }\r
- else {\r
- cannotCompleteExec = true;\r
- break;\r
- } \r
- } \r
- \r
- if (cannotCompleteExec) break; // no need to go further since the next search of input data group will lead to go outside inputPattern\r
- \r
- // search for PC(m) valid input group in IP\r
- while (ncp < productionCounter.at(m)) {\r
- if (isValidDataGroup(consumptionPattern,ccp)) ncp += 1;\r
- ccp += 1;\r
- gap -= 1;\r
+ else {\r
+ cannotCompleteExec = true;\r
+ break;\r
}\r
- o += gap; // to take into acocunt of extra null columns\r
- combinePatterns(productionPattern,p,outputPattern,clock+o);\r
- p += 1;\r
- o += 1;\r
}\r
- \r
+\r
if (cannotCompleteExec) break; // no need to go further since the next search of input data group will lead to go outside inputPattern\r
- \r
- // current exec. taken into accunt\r
- nbExec += 1;\r
- \r
- // search for the next exec.\r
- clock += 1; \r
- nip = 0;\r
- while ((clock < lengthIP) && (nip < delta)) {\r
- if (isValidDataGroup(inputPattern,clock)) nip += 1;\r
- if (nip < delta) clock += 1;\r
+\r
+ // search for PC(m) valid input group in IP\r
+ while (ncp < productionCounter.at(m)) {\r
+ if (isValidDataGroup(consumptionPattern,ccp)) ncp += 1;\r
+ ccp += 1;\r
+ gap -= 1;\r
}\r
- cout << "found exec " << nbExec << " at clock: " << clock << endl;\r
+ o += gap; // to take into acocunt of extra null columns\r
+ combinePatterns(productionPattern,p,outputPattern,clock+o);\r
+ p += 1;\r
+ o += 1;\r
}\r
- // find the last valid output data group\r
- while(! isValidDataGroup(outputPattern,lengthOP-1)) {\r
- removeDataGroup(outputPattern,lengthOP-1);\r
- lengthOP -= 1;\r
+\r
+ if (cannotCompleteExec) break; // no need to go further since the next search of input data group will lead to go outside inputPattern\r
+\r
+ // current exec. taken into accunt\r
+ nbExec += 1;\r
+\r
+ // search for the next exec.\r
+ clock += 1;\r
+ nip = 0;\r
+ while ((clock < lengthIP) && (nip < delta)) {\r
+ if (isValidDataGroup(inputPattern,clock)) nip += 1;\r
+ if (nip < delta) clock += 1;\r
}\r
+ cout << "found exec " << nbExec << " at clock: " << clock << endl;\r
+ }\r
+ // find the last valid output data group\r
+ while(! isValidDataGroup(outputPattern,lengthOP-1)) {\r
+ removeDataGroup(outputPattern,lengthOP-1);\r
+ lengthOP -= 1;\r
+ }\r
+\r
+ // clear input pattern\r
+ clearInputPattern();\r
+\r
+ setOutputPatternComputed(true);\r
\r
- // clear input pattern\r
- clearInputPattern();\r
- } \r
}\r
\r
/*\r
\r
// testers\r
bool isFunctionalBlock();\r
- bool isSourceBlock(); //! a source block has no parent and has no data inputs\r
+ bool isStimuliBlock(); //! a stimuli block has no parent and has no data inputs\r
\r
// others\r
\r
\r
// patterns\r
void createPatterns() throw(Exception); // called in Graph, before checking compatibility and computing output pattern\r
- void checkInputPatternCompatibility() throw(Exception);\r
- void computeOutputPattern(int nbExec = -1) throw(Exception);\r
+ virtual void checkInputPatternCompatibility() throw(Exception);\r
+ virtual void computeOutputPattern(int nbExec = -1) throw(Exception);\r
void computeAdmittanceDelays() throw(Exception); // compute differences between IP and admittance\r
\r
protected:\r
if ((direction == Output) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true;\r
if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true;\r
}\r
- else if ((getOwner()->isSourceBlock()) && (iface->getOwner()->isTopGroupBlock())) {\r
+ else if ((getOwner()->isStimuliBlock()) && (iface->getOwner()->isTopGroupBlock())) {\r
if ((direction == Output) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true;\r
}\r
\r
#include "GroupBlock.h"
#include "ReferenceBlock.h"
#include "FunctionalBlock.h"
+#include "SpecialBlock.h"
Graph::Graph(bool createTopGroupIface) {
topGroup = new GroupBlock(NULL, createTopGroupIface);
FunctionalBlock* Graph::createFunctionalBlock(GroupBlock* group, ReferenceBlock* ref, bool createIfaces) {
- FunctionalBlock* newBlock = new FunctionalBlock(group,ref, createIfaces);
+ FunctionalBlock* newBlock = NULL;
+ if (ref->getSpecialType() != -1) {
+ newBlock = new SpecialBlock(ref->getSpecialType(), group,ref, createIfaces);
+ }
+ else {
+ newBlock = new FunctionalBlock(group,ref, createIfaces);
+ }
group->addBlock(newBlock);
return newBlock;
return block;
}
-FunctionalBlock* Graph::createSourceBlock(ReferenceBlock* ref, bool createIfaces) {
+FunctionalBlock* Graph::createStimuliBlock(ReferenceBlock* ref, bool createIfaces) {
+ /* A stimuli block is always a special block with idSpecial = 1 */
- FunctionalBlock* newBlock = new FunctionalBlock(NULL,ref, createIfaces);
- sources.append(newBlock);
+ FunctionalBlock* newBlock = new SpecialBlock(AbstractBlock::Source, NULL,ref, createIfaces);
+ stimulis.append(newBlock);
return newBlock;
}
-FunctionalBlock* Graph::duplicateSourceBlock(FunctionalBlock *block) {
+FunctionalBlock* Graph::duplicateStimuliBlock(FunctionalBlock *block) {
ReferenceBlock* ref = block->getReference();
// adding to the graph
- FunctionalBlock* newBlock = createSourceBlock(ref, true);
+ FunctionalBlock* newBlock = createStimuliBlock(ref, true);
return newBlock;
}
-FunctionalBlock* Graph::getSourceBlockByName(QString name) {
- foreach(FunctionalBlock* block, sources) {
+FunctionalBlock* Graph::getStimuliBlockByName(QString name) {
+ foreach(FunctionalBlock* block, stimulis) {
if (block->getName() == name) return block;
}
return NULL;
}
-bool Graph::removeSourceBlock(FunctionalBlock *block) {
- sources.removeAll(block);
+bool Graph::removeStimuliBlock(FunctionalBlock *block) {
+ stimulis.removeAll(block);
return true;
}
void Graph::createPatterns() throw(Exception) {
- foreach(AbstractBlock* block, sources) {
+ foreach(AbstractBlock* block, stimulis) {
FunctionalBlock* funBlock = AB_TO_FUN(block);
try {
funBlock->createPatterns();
}
void Graph::resetPatternComputed() {
- foreach(AbstractBlock* block, sources) {
- block->setPatternComputed(false);
+ foreach(AbstractBlock* block, stimulis) {
+ block->setOutputPatternComputed(false);
block->resetTraversalLevel();
}
foreach(AbstractBlock* block, groups) {
GroupBlock* group = AB_TO_GRP(block);
- group->setPatternComputed(false);
+ group->setOutputPatternComputed(false);
block->resetTraversalLevel();
foreach(AbstractBlock* inBlock, group->getBlocks()) {
- inBlock->setPatternComputed(false);
+ inBlock->setOutputPatternComputed(false);
block->resetTraversalLevel();
}
}
}
resetPatternComputed();
- // search for all block that are generators.
- QList<FunctionalBlock*> generators;
- generators.append(sources);
+ // search for all block that are source.
+ QList<FunctionalBlock*> sources;
+ sources.append(stimulis);
foreach(AbstractBlock* block, groups) {
GroupBlock* group = AB_TO_GRP(block);
foreach(AbstractBlock* inBlock, group->getBlocks()) {
FunctionalBlock* funBlock = AB_TO_FUN(inBlock);
- if ((inBlock->isFunctionalBlock()) && (inBlock->isGeneratorBlock())) {
- generators.append(funBlock);
+ if (inBlock->isSourceBlock()) {
+ sources.append(funBlock);
}
}
}
// search for maximum PP length
int maxPP = 0;
- foreach(FunctionalBlock* block, generators) {
+ foreach(FunctionalBlock* block, sources) {
if (block->getProductionPatternLength() > maxPP) maxPP = block->getProductionPatternLength();
}
// compute output for generators
int maxExecLen = maxPP*nbExec;
- foreach(FunctionalBlock* block, generators) {
+ foreach(FunctionalBlock* block, sources) {
int d = block->getProductionPatternLength();
block->computeOutputPattern((maxExecLen+d-1)/d);
}
bool removeFunctionalBlock(FunctionalBlock* block);
FunctionalBlock* getFunctionalBlockByName(QString name, GroupBlock* parent = NULL); //! if parent = NULL, search in the whole graph
- // methods for source blocks
- FunctionalBlock* createSourceBlock(ReferenceBlock *ref, bool createIfaces = true);
- FunctionalBlock* duplicateSourceBlock(FunctionalBlock *block);
- FunctionalBlock* getSourceBlockByName(QString name);
- bool removeSourceBlock(FunctionalBlock* block);
+ // methods for stimulis blocks
+ FunctionalBlock* createStimuliBlock(ReferenceBlock *ref, bool createIfaces = true);
+ FunctionalBlock* duplicateStimuliBlock(FunctionalBlock *block);
+ FunctionalBlock* getStimuliBlockByName(QString name);
+ bool removeStimuliBlock(FunctionalBlock* block);
// others
QList<AbstractInterface *> getOutsideInterfaces();
private:
GroupBlock* topGroup;
QList<GroupBlock *> groups; //! usefull to avoid recursive methods to find a particular group.
- QList<FunctionalBlock*> sources; //! source for the top group
+ QList<FunctionalBlock*> stimulis; //! source for the top group
};
}
void GroupBlock::computeAdmittanceDelays() throw(Exception) {
- throw(Exception(INVALID_GROUPBLOCK_USE));
+ throw(Exception(INVALID_GROUPBLOCK_USE,this));
}
void GroupBlock::checkInputPatternCompatibility() throw(Exception){
- throw(Exception(INVALID_GROUPBLOCK_USE));
+ throw(Exception(INVALID_GROUPBLOCK_USE,this));
}
bool addIt = false;
// if a block is a generator and has control outputs, add it
- if (block->isGeneratorBlock()) {
+ if (block->isSourceBlock()) {
if (block->getControlOutputs().size() > 0) addIt = true;
}
else {
while (!fifo.isEmpty()) {
AbstractBlock* block = fifo.takeFirst();
- if (block->getPatternComputed()) continue; // block has already been processed
+ if (block->getOutputPatternComputed()) continue; // block has already been processed
cout << "computing compat and output for " << qPrintable(block->getName()) << endl;
throw(e);
}
canCompute = true;
- block->setPatternComputed(true);
+
/* add other blocks connected from block to the fifo but only if
all their connected inputs are connected to blocks that have
a traversalLevel >=0
ConnectedInterface* connFrom = ((ConnectedInterface*)iface)->getConnectedFrom();
//cout << qPrintable(connFrom->getName()) << " of " << qPrintable(connFrom->getOwner()->getName()) << endl;
- if ((connFrom != NULL) && (connFrom->getOwner()->getPatternComputed() == false)) {
+ if ((connFrom != NULL) && (connFrom->getOwner()->getOutputPatternComputed() == false)) {
addIt = false;
break;
}
QList<char>* pattern = new QList<char>(*(connIface->getConnectedFrom()->getOutputPattern()));
connIface->setOutputPattern(pattern);
}
- setPatternComputed(true);
+ setOutputPatternComputed(true);
}
}
if ((direction == Input) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true;
if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true;
}
- else if ((getOwner()->isTopGroupBlock()) && (iface->getOwner()->isSourceBlock())) {
+ else if ((getOwner()->isTopGroupBlock()) && (iface->getOwner()->isStimuliBlock())) {
if ((direction == Input) && (iface->getDirection() == Output) && (purpose == iface->getPurpose())) return true;
}
#include "Dispatcher.h"
#include "Parameters.h"
#include "BoxItem.h"
-#include "SourceItem.h"
+#include "StimuliItem.h"
#include "AbstractBlock.h"
#include "AbstractInterface.h"
#include "ConnectedInterface.h"
if (refBlock->isTopGroupBlock()) {
QRectF rectGroup = boundingRectInScene();
rectGroup.moveTo(rectGroup.x()+gapX,rectGroup.y()+gapY);
- foreach(SourceItem* source, getScene()->getSourceItems()) {
+ foreach(StimuliItem* source, getScene()->getSourceItems()) {
QRectF rectSource = source->boundingRectInScene();
if (rectGroup.intersects(rectSource)) canMove = false;
}
#include "GroupWidget.h"
#include "GroupItem.h"
#include "BoxItem.h"
-#include "SourceItem.h"
+#include "StimuliItem.h"
#include "ConnectionItem.h"
#include "InterfaceItem.h"
#include "AbstractBlock.h"
int counter = countInit;
groupItem->setId(counter++);
if (isTopScene()) {
- foreach(SourceItem *item, sourceItems){
+ foreach(StimuliItem *item, stimuliItems){
item->setId(counter++);
}
}
inter->setId(counter++);
}
if (isTopScene()) {
- foreach(SourceItem *item, sourceItems){
+ foreach(StimuliItem *item, stimuliItems){
foreach(InterfaceItem* inter, item->getInterfaces()){
inter->setId(counter++);
}
groupItem->updateShape();
}
-SourceItem *GroupScene::createSourceItem(AbstractBlock *block) {
+StimuliItem *GroupScene::createStimuliItem(AbstractBlock *block) {
- SourceItem* item = new SourceItem(block,dispatcher,params);
+ StimuliItem* item = new StimuliItem(block,dispatcher,params);
// adding item to the scene
addItem(item);
item->setZValue(1);
// add item from the QList
- sourceItems.append(item);
+ stimuliItems.append(item);
// center the new block
QPointF groupPos = groupItem->pos();
- QPointF newPos(groupPos.x()-item->getTotalWidth()-50, groupPos.y());
+ QPointF newPos(groupPos.x()-item->getTotalWidth()-100, groupPos.y());
newPos = newPos-item->getOriginPoint();
item->moveTo(newPos);
return item;
}
-void GroupScene::addSourceItem(SourceItem* item) {
+void GroupScene::addStimuliItem(StimuliItem* item) {
// adding item to the scene
addItem(item);
item->setZValue(1);
// add item from the QList
- sourceItems.append(item);
+ stimuliItems.append(item);
}
-void GroupScene::removeSourceItem(SourceItem* item) {
+void GroupScene::removeStimuliItem(StimuliItem* item) {
// remove item from the viewport
removeItem(item);
// remove item from the QList
- sourceItems.removeAll(item);
+ stimuliItems.removeAll(item);
}
void GroupScene::createConnectionItem(InterfaceItem *iface1, InterfaceItem *iface2, bool visible) {
if (isTopScene()) {
writer.writeStartElement("source_items");
- writer.writeAttribute("count",QString::number(sourceItems.length()));
- foreach(SourceItem* item, sourceItems) {
+ writer.writeAttribute("count",QString::number(stimuliItems.length()));
+ foreach(StimuliItem* item, stimuliItems) {
item->save(writer);
}
writer.writeEndElement(); // source_items
class GroupItem;
#include "BoxItem.h"
class BoxItem;
-class SourceItem;
+class StimuliItem;
class AbstractBoxItem;
class ConnectionItem;
class InterfaceItem;
// attributes getters
inline GroupItem* getGroupItem() {return groupItem;}
inline QList<BoxItem*> getBoxItems() { return boxItems; }
- inline QList<SourceItem*> getSourceItems() { return sourceItems; }
+ inline QList<StimuliItem*> getSourceItems() { return stimuliItems; }
inline QList<ConnectionItem*> getConnectionItems() { return connectionItems; }
inline QList<GroupScene*> getChildrenScene() { return childrenScene; }
inline GroupScene* getParentScene() { return parentScene; }
// GroupItem related
void removeGroupItem();
- // SourceItem related
- SourceItem* createSourceItem(AbstractBlock* block); //! create a new SourceItem and place it around the group item
- void addSourceItem(SourceItem* item); //! add an already configured SourceItem in the scene.
- void removeSourceItem(SourceItem* item);
+ // StimuliItem related
+ StimuliItem* createStimuliItem(AbstractBlock* block); //! create a new SourceItem and place it around the group item
+ void addStimuliItem(StimuliItem* item); //! add an already configured SourceItem in the scene.
+ void removeStimuliItem(StimuliItem* item);
// child scenes related
inline void addChildScene(GroupScene* child) { childrenScene.append(child); }
GroupItem *groupItem; //! for convenience, the group item is directly accessible via this attribute
QList<ConnectionItem*> connectionItems; //! for convenience, connections are directly accessible via this attribute
QList<BoxItem*> boxItems; //! for convenience, box items are directly accessible via this attribute
- QList<SourceItem*> sourceItems; //! for convenience, box items are directly accessible via this attribute. Only usefull for top scene
+ QList<StimuliItem*> stimuliItems; //! for convenience, box items are directly accessible via this attribute. Only usefull for top scene
QList<GroupScene*> childrenScene;//! for convenience, children scenes are directly accessible via this attribute
bool topScene;
EditMode editMode;
if(owner->isBoxItem()) {
painter->setPen(QPen(Qt::black,1));
}
- else if(owner->isSourceItem()) {
+ else if(owner->isStimuliItem()) {
painter->setPen(QPen(Qt::darkCyan,1));
}
}
if(owner->isGroupItem()){
painter->drawText(-(w+params->arrowWidth+params->arrowLineLength),-h/2,w,h,Qt::AlignLeft | Qt::TextWordWrap, refInter->getName());
}
- else if((owner->isBoxItem()) || (owner->isSourceItem())){
+ else if((owner->isBoxItem()) || (owner->isStimuliItem())){
painter->drawText(0,-h/2,w,h,Qt::AlignRight | Qt::TextWordWrap, refInter->getName());
}
}
if(owner->isGroupItem()) {
painter->drawText(params->arrowWidth+params->arrowLineLength,-h/2,w,h,Qt::AlignRight | Qt::TextWordWrap, refInter->getName());
}
- else if((owner->isBoxItem()) || (owner->isSourceItem())){
+ else if((owner->isBoxItem()) || (owner->isStimuliItem())){
painter->drawText(-w,-h/2,w,h,Qt::AlignLeft | Qt::TextWordWrap, refInter->getName());
}
}
#include "GroupScene.h"\r
#include "GroupItem.h"\r
#include "BoxItem.h"\r
-#include "SourceItem.h"\r
+#include "StimuliItem.h"\r
#include "InterfaceItem.h"\r
#include "ConnectionItem.h"\r
\r
cout << "top scene has " << sourceNodes.length() << " sources" << endl;\r
for(int j=0; j<sourceNodes.length(); j++) {\r
QDomElement currentSBNode = sourceNodes.at(j).toElement(); \r
- SourceItem* sourceItem = new SourceItem(dispatcher,this);\r
+ StimuliItem* sourceItem = new StimuliItem(dispatcher,this);\r
try {\r
sourceItem->load(currentSBNode);\r
}\r
}\r
cout << "source item has been read, add it to the scene" << endl;\r
// add the block to the GroupScene\r
- currentScene->addSourceItem(sourceItem);\r
+ currentScene->addStimuliItem(sourceItem);\r
} \r
}\r
/**********************************************************\r
}\r
}\r
if (scene->isTopScene()) {\r
- foreach(SourceItem *block, scene->getSourceItems()){\r
+ foreach(StimuliItem *block, scene->getSourceItems()){\r
foreach(InterfaceItem *item, block->getInterfaces()){\r
if(item->getId() == id){\r
return item;\r
#include "Parameters.h"
ReferenceBlock::ReferenceBlock(const QString _xmlFile) : AbstractBlock() {
- xmlFile = _xmlFile;
+ xmlFile = _xmlFile;
}
void ReferenceBlock::addCategory(int id) {
void ReferenceBlock::load(QDomElement &elt) throw(Exception) {
+ cout << "Block : get version" << endl;
+ QString verStr = elt.attribute("version","none");
+ QString specialStr = elt.attribute("special","none");
+ if (verStr != "none") {
+ setVersion(verStr);
+ }
+ else {
+ setVersion("0.0");
+ }
+ setSpecialType(getSpecialTypeFromString(specialStr));
cout << "Block : get informations" << endl;
QDomElement eltInfo = elt.firstChildElement("informations");
toWrite << b.name;
toWrite << b.xmlFile;
+ toWrite << b.specialType;
+ toWrite << b.version;
toWrite << b.description;
toWrite << b.categories;
toWrite << b.hashMd5;
in >> b.name;
in >> b.xmlFile;
+ in >> b.specialType;
+ in >> b.version;
in >> b.description;
in >> b.categories;
in >> b.hashMd5;
#include "SpecialBlock.h"\r
+#include "FunctionalInterface.h"\r
\r
-SpecialBlock::SpecialBlock(SpecialType _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) {\r
- type = _type; \r
+SpecialBlock::SpecialBlock(int _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) {\r
+ specialType = _type;\r
}\r
\r
SpecialBlock::~SpecialBlock() {\r
}\r
\r
+bool SpecialBlock::isSpecialBlock() {\r
+ return true;\r
+}\r
+\r
void SpecialBlock::checkInputPatternCompatibility() throw(Exception) {\r
try {\r
- switch(type) {\r
- case ClockConvert :\r
+ switch(specialType) {\r
+ case Source :\r
+ checkInputPatternCompatibilitySource();\r
+ break;\r
+ case Sink :\r
+ checkInputPatternCompatibilitySink();\r
+ break;\r
+ case ClkConvert :\r
checkInputPatternCompatibilityClockConvert();\r
- break; \r
+ break;\r
+ default:\r
+ break;\r
}\r
}\r
catch(Exception e) {\r
\r
void SpecialBlock::computeOutputPattern(int nbExec) throw(Exception) {\r
try {\r
- switch(type) {\r
- case ClockConvert :\r
+ switch(specialType) {\r
+ case Source :\r
+ computeOutputPatternSource(nbExec);\r
+ break;\r
+ case Sink :\r
+ computeOutputPatternSink(nbExec);\r
+ break;\r
+ case ClkConvert :\r
computeOutputPatternClockConvert(nbExec);\r
break; \r
+ default:\r
+ break;\r
}\r
}\r
catch(Exception e) {\r
}\r
}\r
\r
+void SpecialBlock::checkInputPatternCompatibilitySource() throw(Exception) {\r
+}\r
+void SpecialBlock::computeOutputPatternSource(int nbExec) throw(Exception) {\r
+\r
+ cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl;\r
+ foreach(AbstractInterface* iface, getControlOutputs()) {\r
+ FunctionalInterface* connIface = AI_TO_FUN(iface);\r
+ // create output pattern\r
+ QList<char>* pp = productionPattern.value(connIface);\r
+ QList<char>* pattern = new QList<char>(*pp);\r
+ for(int i=1;i<nbExec;i++) pattern->append(*pp);\r
+ // assign pattern to interface\r
+ connIface->setOutputPattern(pattern);\r
+ // store it in QMap\r
+ outputPattern.insert(connIface,pattern);\r
+ }\r
+ setOutputPatternComputed(true);\r
+}\r
+\r
+void SpecialBlock::checkInputPatternCompatibilitySink() throw(Exception) {\r
+}\r
+void SpecialBlock::computeOutputPatternSink(int nbExec) throw(Exception) {\r
+}\r
+\r
void SpecialBlock::checkInputPatternCompatibilityClockConvert() throw(Exception) {\r
}\r
void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) {\r
\r
\r
class SpecialBlock : public FunctionalBlock {\r
-public:\r
-\r
- enum SpecialType { ClockConvert = 1 };\r
+public: \r
\r
- SpecialBlock(SpecialType _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces = true) throw(Exception);\r
+ SpecialBlock(int _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces = true) throw(Exception);\r
~SpecialBlock();\r
- // getters\r
+ // getters \r
\r
// setters\r
\r
// testers\r
+ bool isSpecialBlock();\r
\r
- // others\r
+ // others \r
\r
// patterns\r
void checkInputPatternCompatibility() throw(Exception);\r
void computeOutputPattern(int nbExec = -1) throw(Exception);\r
\r
-private:\r
- SpecialType type;\r
- \r
+private: \r
+\r
+ void checkInputPatternCompatibilitySource() throw(Exception);\r
+ void computeOutputPatternSource(int nbExec = -1) throw(Exception);\r
+ void checkInputPatternCompatibilitySink() throw(Exception);\r
+ void computeOutputPatternSink(int nbExec = -1) throw(Exception);\r
void checkInputPatternCompatibilityClockConvert() throw(Exception);\r
void computeOutputPatternClockConvert(int nbExec = -1) throw(Exception);\r
\r
-#include "SourceItem.h"
+#include "StimuliItem.h"
#include "GroupScene.h"
#include "ConnectionItem.h"
#include "InterfaceItem.h"
#include "Graph.h"
-SourceItem::SourceItem(AbstractBlock *_refBlock,
+StimuliItem::StimuliItem(AbstractBlock *_refBlock,
Dispatcher *_dispatcher,
Parameters *_params) throw(Exception) : AbstractBoxItem( _refBlock, _dispatcher, _params) {
//cout << "pos in group: " << x() << "," << y() << endl;
}
-SourceItem::SourceItem(Dispatcher *_dispatcher, Parameters *_params) throw(Exception) : AbstractBoxItem(_dispatcher, _params) {
+StimuliItem::StimuliItem(Dispatcher *_dispatcher, Parameters *_params) throw(Exception) : AbstractBoxItem(_dispatcher, _params) {
refBlock = NULL;
currentBorder = NoBorder;
boxHeight = params->defaultBlockHeight;
}
-SourceItem::~SourceItem() {
+StimuliItem::~StimuliItem() {
}
-void SourceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
+void StimuliItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
QPen pen(Qt::black, 3);
if(selected)
pen.setColor(Qt::red);
}
}
-void SourceItem::moveTo(QPointF dest) {
+void StimuliItem::moveTo(QPointF dest) {
setPos(dest);
currentPosition = dest;
}
-bool SourceItem::isSourceItem() {
+bool StimuliItem::isStimuliItem() {
return true;
}
-void SourceItem::nameChanged() {
+void StimuliItem::nameChanged() {
QFontMetrics fmId(params->defaultBlockFont);
update();
}
-void SourceItem::updateMinimumSize() {
+void StimuliItem::updateMinimumSize() {
int maxSouth = 0;
int maxNorth = 0;
/* updateGeometry() :
*/
-bool SourceItem::updateGeometry(ChangeType type) {
+bool StimuliItem::updateGeometry(ChangeType type) {
currentPosition = pos();
//cout << "current pos of block: " << currentPosition.x() << "," << currentPosition.y() << endl;
return false;
}
-void SourceItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
+void StimuliItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) {
if(params->editState == Parameters::EditBlockMove) {
QPointF absPos = currentPosition + originPoint;
}
}
-void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
+void StimuliItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
QPointF pos = event->pos();
qreal x = pos.x();
}
}
-void SourceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
+void StimuliItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
//setZValue(zValue()-100);
QGraphicsItem::mouseReleaseEvent(event);
}
-void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) {
+void StimuliItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) {
QPointF pos = event->pos();
qreal x = pos.x();
}
-void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
+void StimuliItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) {
event->accept();
if(selectedAction == NULL) return ;
if (selectedAction == removeAction) {
- dispatcher->removeSourceItem(Dispatcher::Design, this);
+ dispatcher->removeStimuliItem(Dispatcher::Design, this);
}
else if (selectedAction == duplicateAction) {
- dispatcher->duplicateSourceItem(Dispatcher::Design, this);
+ dispatcher->duplicateStimuliItem(Dispatcher::Design, this);
}
else if(selectedAction == renameAction){
if(ifaceItem != NULL) {
dispatcher->renameInterface(Dispatcher::Design, ifaceItem);
}
else {
- dispatcher->renameSourceBlock(Dispatcher::Design, this);
+ dispatcher->renameStimuliItem(Dispatcher::Design, this);
}
}
else if(selectedAction == showProperties){
}
}
-void SourceItem::load(QDomElement funcElement) throw(Exception) {
+void StimuliItem::load(QDomElement funcElement) throw(Exception) {
bool ok = false;
reference = referenceMd5;
}
- FunctionalBlock* functionalBlock = params->getGraph()->createSourceBlock(reference);
+ FunctionalBlock* functionalBlock = params->getGraph()->createStimuliBlock(reference);
/* NB: createSourceBlock creates all interfaces from the reference, which is annoying when
reading bif_iface tags. Thus interface are all removed.
*/
updateGeometry(Resize);
}
-void SourceItem::save(QXmlStreamWriter &writer) {
+void StimuliItem::save(QXmlStreamWriter &writer) {
writer.writeStartElement("source_item");
-#ifndef __SOURCEITEM_H__
-#define __SOURCEITEM_H__
+#ifndef __STIMULIITEM_H__
+#define __STIMULIITEM_H__
#include <iostream>
using namespace Qt;
/*!
- * \brief The SourceItem class
- * A SourceItem represents a special type of block that is added only
+ * \brief The StimuliItem class
+ * A StimuliItem represents a special type of block that is added only
* to the top scene, in order to simulate inputs on the FPGA input
* pins. This, the reference block used as a source must be chosen
* among blocks that have no inputs and only outputs (with multiplicity
* = 1)
*/
-class SourceItem : public AbstractBoxItem {
+class StimuliItem : public AbstractBoxItem {
public:
- SourceItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params) throw(Exception);
- SourceItem(Dispatcher *_dispatcher, Parameters *_params) throw(Exception);
- ~SourceItem();
+ StimuliItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params) throw(Exception);
+ StimuliItem(Dispatcher *_dispatcher, Parameters *_params) throw(Exception);
+ ~StimuliItem();
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
// testers
- bool isSourceItem();
+ bool isStimuliItem();
// others
void nameChanged();
};
-#endif // __SOURCEITEM_H__
+#endif // __STIMULIITEM_H__
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.2.0, 2018-05-02T22:20:14. -->
+<!-- Written by QtCreator 4.2.0, 2018-05-03T15:15:26. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
- <value type="QByteArray">{c8006d66-d34f-42be-ad10-d0207752286d}</value>
+ <value type="QByteArray">{3701e197-5b6c-48ea-9e98-a6cf6de18672}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
- <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{2c9bf876-3476-44eb-8065-1f0844704dda}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ed04208c-8774-456b-99b9-4a02094ca7a4}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
GroupInterface.cpp
BlockLibraryWidget.cpp
BlockLibraryWidget.h
+StimuliItem.cpp
+StimuliItem.h
VHDLConverter.cpp
VHDLConverter.h
blast.cpp
BlockCategory.cpp
BlockCategory.h
-SourceItem.cpp
-SourceItem.h
BoxItem.cpp
BoxItem.h
BlockLibraryTree.cpp
<!DOCTYPE clkdomain_convert_1024x8>
-<block version="0.1" special="1">
+<block version="0.1" special="clkconvert">
<informations>
<name>clkdomain_convert_1024x8</name>
<category ids="10"/>
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<block>
+<block special="source">
<informations>
<name>
generator-csvreader
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<block>
+<block special="source">
<informations>
<name>
generator-cst
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<block>
+<block special="source">
<informations>
<name>
generator-img
<!DOCTYPE read_csv>
-<block version="0.1">
+<block version="0.1" special="source">
<informations>
<name>read_csv</name>
<category ids="6"/>
$(BUILDPATH)/AbstractBoxItem.o \
$(BUILDPATH)/BoxItem.o \
$(BUILDPATH)/GroupItem.o \
- $(BUILDPATH)/SourceItem.o \
+ $(BUILDPATH)/StimuliItem.o \
$(BUILDPATH)/BlockCategory.o \
$(BUILDPATH)/BlockLibraryTree.o \
$(BUILDPATH)/BlockLibraryWidget.o \
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="clock" type="xs:string"/>
+ <xs:simpleType name="typespecial">
+ <xs:restriction base="xs:string">
+ <xs:enumeration value="source"/>
+ <xs:enumeration value="sink"/>
+ <xs:enumeration value="clkconvert"/>
+ </xs:restriction>
+ </xs:simpleType>
+
<xs:simpleType name="typeparam">
<xs:restriction base="xs:string">
<xs:enumeration value="string"/>
<xs:complexType>
<xs:group ref="blockElmtGroup"/>
<xs:attribute name="version" type="xs:string" use="optional" />
- <xs:attribute name="special" type="xs:nonNegativeInteger" use="optional" />
+ <xs:attribute name="special" type="typespecial" use="optional" />
</xs:complexType>
</xs:element>