From 8fb3c55ee009a11db5e1c08a4cfb286979412745 Mon Sep 17 00:00:00 2001 From: stephane Domas Date: Thu, 3 May 2018 15:16:02 +0200 Subject: [PATCH] changed sources to stimulis --- AbstractBlock.cpp | 42 +++- AbstractBlock.h | 22 ++- AbstractBoxItem.cpp | 2 +- AbstractBoxItem.h | 4 +- BlockLibraryWidget.cpp | 6 +- ConnectionItem.cpp | 4 +- Dispatcher.cpp | 46 ++--- Dispatcher.h | 8 +- Exception.cpp | 4 +- Exception.h | 8 +- ExternalResource.h | 2 +- FunctionalBlock.cpp | 204 +++++++++----------- FunctionalBlock.h | 6 +- FunctionalInterface.cpp | 2 +- Graph.cpp | 52 ++--- Graph.h | 12 +- GroupBlock.cpp | 14 +- GroupInterface.cpp | 2 +- GroupItem.cpp | 4 +- GroupScene.cpp | 26 +-- GroupScene.h | 14 +- InterfaceItem.cpp | 6 +- Parameters.cpp | 8 +- ReferenceBlock.cpp | 16 +- SpecialBlock.cpp | 59 +++++- SpecialBlock.h | 20 +- SourceItem.cpp => StimuliItem.cpp | 42 ++-- SourceItem.h => StimuliItem.h | 20 +- blast.creator.user | 6 +- blast.files | 4 +- lib/implementations/impls.bmf | Bin 0 -> 6865 bytes lib/references/clkdomain_convert_1024x8.xml | 2 +- lib/references/csvreader.xml | 2 +- lib/references/generator-cst.xml | 2 +- lib/references/generator-img.xml | 2 +- lib/references/read_csv.xml | 2 +- lib/references/references.bmf | Bin 20084 -> 21656 bytes object-files.txt | 2 +- reference.xsd | 10 +- 39 files changed, 402 insertions(+), 285 deletions(-) rename SourceItem.cpp => StimuliItem.cpp (95%) rename SourceItem.h => StimuliItem.h (72%) create mode 100644 lib/implementations/impls.bmf diff --git a/AbstractBlock.cpp b/AbstractBlock.cpp index 116494e..b8ce5e5 100644 --- a/AbstractBlock.cpp +++ b/AbstractBlock.cpp @@ -11,6 +11,7 @@ AbstractBlock::AbstractBlock() { name = ""; parent = NULL; + specialType = NotSpecial; } /* @@ -34,6 +35,15 @@ void AbstractBlock::setName(const QString& str) { name = Parameters::normalizeName(str); } +void AbstractBlock::setSpecialType(int type) { + if ((type >= NotSpecial) && (type <= ClkConvert)) { + specialType = type; + } + else { + specialType = NotSpecial; + } +} + void AbstractBlock::setParent(AbstractBlock* _parent) { parent = _parent; } @@ -46,6 +56,10 @@ bool AbstractBlock::isFunctionalBlock() { return false; } +bool AbstractBlock::isSpecialBlock() { + return false; +} + bool AbstractBlock::isGroupBlock() { return false; } @@ -54,20 +68,40 @@ bool AbstractBlock::isTopGroupBlock() { return false; } -bool AbstractBlock::isSourceBlock() { +bool AbstractBlock::isStimuliBlock() { return false; } -/* NB: a generator is a block that has no data inputs +/* NB: a source is a block that has no data inputs * and has at least one data output. * By the way, blocks that have no data input/output - * (like clkrstgen) are not generators ! + * (like clkrstgen) are not sources ! */ -bool AbstractBlock::isGeneratorBlock() { +bool AbstractBlock::isSourceBlock() { if (getDataInputs().size() > 0) return false; if (getDataOutputs().size() == 0) return false; return true; } +/* NB: a sink is a block without outputs of any type */ +bool AbstractBlock::isSinkBlock() { + if (getOutputs().size() == 0) return true; + return false; +} + +int AbstractBlock::getSpecialTypeFromString(QString str) { + if (str == "source") { + return Source; + } + else if (str == "sink") { + return Sink; + } + else if (str == "clkconvert") { + return ClkConvert; + } + return NotSpecial; +} + + void AbstractBlock::addParameter(BlockParameter *param) { params.append(param); } diff --git a/AbstractBlock.h b/AbstractBlock.h index fe3f90e..e1c33e4 100644 --- a/AbstractBlock.h +++ b/AbstractBlock.h @@ -12,6 +12,7 @@ class BlockParameter; #define AB_TO_REF(ptr) ((ReferenceBlock*)ptr) #define AB_TO_FUN(ptr) ((FunctionalBlock*)ptr) +#define AB_TO_SPE(ptr) ((SpecialBlock*)ptr) #define AB_TO_GRP(ptr) ((GroupBlock*)ptr) using namespace std; @@ -22,6 +23,8 @@ class AbstractBlock { public: enum BlockVHDLContext {AnyContext = 0, Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface + enum SpecialType { NotSpecial = 0, Source = 1, Sink = 2, ClkConvert = 3 }; + AbstractBlock(); //AbstractBlock(const QString& _name); @@ -29,6 +32,8 @@ public: // getters inline QString getName() { return name; } + inline int getSpecialType() { return specialType; } + inline QString getVersion() { return version; } inline int nbParameters() { return params.size(); } inline QList getParameters() { return params; } inline QList getInputs() { return inputs; } @@ -39,26 +44,31 @@ public: QList getPortParameters(); QList getWishboneParameters(); inline AbstractBlock* getParent() { return parent; } - inline bool getPatternComputed() { return patternComputed; } + inline bool getOutputPatternComputed() { return outputPatternComputed; } inline int getTraversalLevel() { return traversalLevel; } // setters void setName(const QString& str); + void setSpecialType(int type); + inline void setVersion(const QString& _version) { version = _version; } virtual void setParent(AbstractBlock* _parent); - inline void setPatternComputed(bool state) { patternComputed = state; } + inline void setOutputPatternComputed(bool state) { outputPatternComputed = state; } inline void resetTraversalLevel() { traversalLevel = -1; } inline void setTraversalLevel(int level) { traversalLevel = level; } // testers virtual bool isReferenceBlock(); virtual bool isFunctionalBlock(); + virtual bool isSpecialBlock(); virtual bool isGroupBlock(); - virtual bool isSourceBlock(); //! a source block is outside the top group and simulates a peripheral (NB: this is also a generator) + virtual bool isStimuliBlock(); //! a stimuli block is outside the top group and simulates a peripheral (NB: this is also a source) virtual bool isTopGroupBlock(); - bool isGeneratorBlock(); //! a generator block has no data inputs and thus executes infinitely + bool isSourceBlock(); //! a source block has no data inputs and thus executes infinitely + bool isSinkBlock(); //! a sink block has no data outputs and just collects what it receives (i.e. no compatibility check) bool isWBConfigurable(); // others + int getSpecialTypeFromString(QString str); /*! * \brief connectClkReset connects the clock and reset inputs to a clkrstgen block or the the group ifaces @@ -97,6 +107,8 @@ protected: QString name; + int specialType; + QString version; // parameters QList params; @@ -109,7 +121,7 @@ protected: // others // patterns - bool patternComputed; + bool outputPatternComputed; int traversalLevel; // the level (0, 1, ...) during the traversal of the graph // NB: only GroupBlock and FunctionalBlock have a real parent, except sources that have no parents diff --git a/AbstractBoxItem.cpp b/AbstractBoxItem.cpp index 911a790..7912813 100644 --- a/AbstractBoxItem.cpp +++ b/AbstractBoxItem.cpp @@ -94,7 +94,7 @@ bool AbstractBoxItem::isGroupItem() { return false; } -bool AbstractBoxItem::isSourceItem() { +bool AbstractBoxItem::isStimuliItem() { return false; } diff --git a/AbstractBoxItem.h b/AbstractBoxItem.h index e490088..d0965cf 100644 --- a/AbstractBoxItem.h +++ b/AbstractBoxItem.h @@ -17,7 +17,7 @@ class ConnectedInterface; #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 { @@ -76,7 +76,7 @@ public: // 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;} diff --git a/BlockLibraryWidget.cpp b/BlockLibraryWidget.cpp index 5dfd4b0..d80a78e 100644 --- a/BlockLibraryWidget.cpp +++ b/BlockLibraryWidget.cpp @@ -135,12 +135,13 @@ void BlockLibraryWidget::addClicked() { cout << "adding block to scene " << v.toInt() << endl; QHash clkRstToGen; - for(int i=0;irowCount();i++) { + for(int i=1;iitemAtPosition(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; } @@ -218,7 +219,7 @@ void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) { QWidget* widget = layClkRst->itemAt(0)->widget(); layClkRst->removeWidget(widget); delete widget; - } + } if (nbClock != 0) { delete [] comboClkGen; @@ -235,6 +236,7 @@ void BlockLibraryWidget::updateClkRst(int idCat, int idBlock) { nbClock = lstClocks.size(); QList 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;igetOwner()->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; } diff --git a/Dispatcher.cpp b/Dispatcher.cpp index 94cdfb6..c50270c 100644 --- a/Dispatcher.cpp +++ b/Dispatcher.cpp @@ -18,7 +18,7 @@ #include "GroupScene.h" #include "GroupItem.h" #include "BoxItem.h" -#include "SourceItem.h" +#include "StimuliItem.h" #include "InterfaceItem.h" #include "ConnectionItem.h" @@ -381,8 +381,8 @@ void Dispatcher::renameGroupBlock(Context context, GroupItem *item){ 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 @@ -392,7 +392,7 @@ void Dispatcher::renameSourceBlock(Context context, SourceItem *item){ 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; @@ -406,10 +406,10 @@ void Dispatcher::renameSourceBlock(Context context, SourceItem *item){ 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; } @@ -564,8 +564,8 @@ void Dispatcher::duplicateBoxItem(Context context, BoxItem *item){ } } -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 @@ -579,9 +579,9 @@ void Dispatcher::duplicateSourceItem(Context context, SourceItem *item) { // 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; } @@ -628,7 +628,7 @@ BoxItem* Dispatcher::addBlock(Context context, int idCategory, int idBlock, int #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 */ @@ -636,15 +636,15 @@ BoxItem* Dispatcher::addBlock(Context context, int idCategory, int idBlock, int 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 { @@ -1159,26 +1159,26 @@ void Dispatcher::removeAllBlockConnections(Context context, AbstractBoxItem *ite } } -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); } diff --git a/Dispatcher.h b/Dispatcher.h index 0fa74bd..cf14b6a 100644 --- a/Dispatcher.h +++ b/Dispatcher.h @@ -15,7 +15,7 @@ class GroupScene; class AbstractBoxItem; class GroupItem; class BoxItem; -class SourceItem; +class StimuliItem; class ConnectionItem; class InterfaceItem; class GroupBlock; @@ -101,9 +101,9 @@ public: 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 diff --git a/Exception.cpp b/Exception.cpp index 1329f0c..1003397 100644 --- a/Exception.cpp +++ b/Exception.cpp @@ -42,7 +42,9 @@ QString Exception::getDefaultMessage() { 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; diff --git a/Exception.h b/Exception.h index 00d146a..0c2cd5e 100644 --- a/Exception.h +++ b/Exception.h @@ -65,9 +65,11 @@ supp. infos : saved in UTF-8 [éè] #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 diff --git a/ExternalResource.h b/ExternalResource.h index e3adf1b..5cebdf9 100644 --- a/ExternalResource.h +++ b/ExternalResource.h @@ -14,7 +14,7 @@ class ExternalResource { public : - enum SourceType { Code = 1, Package, Netlist, InitFile}; + enum ResourceType { Code = 1, Package, Netlist, InitFile}; ExternalResource(const QString& _name, const QString& _file, int _type = Code); diff --git a/FunctionalBlock.cpp b/FunctionalBlock.cpp index ccaa7b2..0fb38c3 100644 --- a/FunctionalBlock.cpp +++ b/FunctionalBlock.cpp @@ -65,7 +65,7 @@ bool FunctionalBlock::isFunctionalBlock() { return true; } -bool FunctionalBlock::isSourceBlock() { +bool FunctionalBlock::isStimuliBlock() { if (parent == NULL) return true; return false; } @@ -146,7 +146,7 @@ void FunctionalBlock::createPatterns() throw(Exception) { cout << "create patterns for block " << qPrintable(name) << endl; if (evaluator == NULL) evaluator = new ArithmeticEvaluator(); - if (! isGeneratorBlock()) { + if (! isSourceBlock()) { try { createDelta(); createConsumptionPattern(); @@ -846,125 +846,113 @@ void FunctionalBlock::computeOutputPattern(int nbExec) throw(Exception) { clearOutputPattern(); - /* case 1: the block is a generator for which output pattern - must be computed for a nbExec following executions - */ + if (specialType != NotSpecial) { + cerr << "Abnormal case: the block is special and output pattern is computed normally" << endl; + throw(Exception(INVALID_FUNBLOCK_USE,this)); + } - if (nbExec > 0) { - cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl; - foreach(AbstractInterface* iface, getControlOutputs()) { - FunctionalInterface* connIface = AI_TO_FUN(iface); - // create output pattern - QList* pp = productionPattern.value(connIface); - QList* pattern = new QList(*pp); - for(int i=1;iappend(*pp); - // assign pattern to interface - connIface->setOutputPattern(pattern); - // store it in QMap - outputPattern.insert(connIface,pattern); + cout << "computing output pattern of " << qPrintable(name) << endl; + + // in case of inputPattern not created, do it + if (lengthIP <= 0) { + + cout << "Strange case: input pattern is not created while it is time to compute output pattern !" << endl; + // collect the input patterns for each input + try { + createInputPattern(); } + catch(Exception e) { + throw(e); + } + cout << "input pattern array initialized with min. len " << lengthIP << endl; } - else { - cout << "computing output pattern of " << qPrintable(name) << endl; - - // in case of inputPattern not created, do it - if (lengthIP <= 0) { - cout << "Strange case: input pattern is not created while it is time to compute output pattern !" << endl; - // collect the input patterns for each input - try { - createInputPattern(); - } - catch(Exception e) { - throw(e); + // initialize the output pattern + lengthOP = 0; + foreach(AbstractInterface* iface, getControlOutputs()) { + FunctionalInterface* connIface = AI_TO_FUN(iface); + lengthOP = lengthIP+productionPattern.value(connIface)->size(); + QList* pattern = new QList(); + for(int i=0;iappend(0); + connIface->setOutputPattern(pattern); + outputPattern.insert(connIface,pattern); + } + cout << "output pattern array initialized" << endl; + + int clock = 0; + nbExec = 0; + // search for the beginning of the first execution. + while ((clock < lengthIP) && (! isValidDataGroup(inputPattern,clock))) clock++; + cout << "found 1st exec clock: " << clock << endl; + + while (clock < lengthIP) { + // initialize counters for current execution. + int p = 0; // index in production pattern + int o = 0; // clock+o will give the clock cycle of each output group + int cip = 0; // clock+cip give the clock cycle of an input group + int ccp = 0; // ccp give a column in the consumptio pattern + int nip = 0; // number of input data groups already consumed during the current execution, used while exploring IP + int ncp = 0; // number of input data groups already consumed during the current execution, used while exploring CP + bool cannotCompleteExec = false; + for(int m=0;msize(); - QList* pattern = new QList(); - for(int i=0;iappend(0); - connIface->setOutputPattern(pattern); - outputPattern.insert(connIface,pattern); - } - cout << "output pattern array initialized" << endl; - - int clock = 0; - nbExec = 0; - // search for the beginning of the first execution. - while ((clock < lengthIP) && (! isValidDataGroup(inputPattern,clock))) clock++; - cout << "found 1st exec clock: " << clock << endl; - - while (clock < lengthIP) { - // initialize counters for current execution. - int p = 0; // index in production pattern - int o = 0; // clock+o will give the clock cycle of each output group - int cip = 0; // clock+cip give the clock cycle of an input group - int ccp = 0; // ccp give a column in the consumptio pattern - int nip = 0; // number of input data groups already consumed during the current execution, used while exploring IP - int ncp = 0; // number of input data groups already consumed during the current execution, used while exploring CP - bool cannotCompleteExec = false; - for(int m=0;mgetDirection() == Output) && (purpose == iface->getPurpose())) return true; if ((direction == InOut) && (iface->getDirection() == InOut) && (purpose == iface->getPurpose())) return true; } - else if ((getOwner()->isSourceBlock()) && (iface->getOwner()->isTopGroupBlock())) { + else if ((getOwner()->isStimuliBlock()) && (iface->getOwner()->isTopGroupBlock())) { if ((direction == Output) && (iface->getDirection() == Input) && (purpose == iface->getPurpose())) return true; } diff --git a/Graph.cpp b/Graph.cpp index a64d8aa..4b22691 100644 --- a/Graph.cpp +++ b/Graph.cpp @@ -2,6 +2,7 @@ #include "GroupBlock.h" #include "ReferenceBlock.h" #include "FunctionalBlock.h" +#include "SpecialBlock.h" Graph::Graph(bool createTopGroupIface) { topGroup = new GroupBlock(NULL, createTopGroupIface); @@ -40,7 +41,13 @@ GroupBlock* Graph::getGroupBlockByName(QString name) { 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; @@ -77,37 +84,38 @@ FunctionalBlock* Graph::getFunctionalBlockByName(QString name, GroupBlock* paren 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(); @@ -134,16 +142,16 @@ void Graph::createPatterns() throw(Exception) { } 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(); } } @@ -159,26 +167,26 @@ void Graph::computeOutputPatterns(int nbExec) throw(Exception) { } resetPatternComputed(); - // search for all block that are generators. - QList generators; - generators.append(sources); + // search for all block that are source. + QList 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); } diff --git a/Graph.h b/Graph.h index a9b90aa..58690c9 100644 --- a/Graph.h +++ b/Graph.h @@ -37,11 +37,11 @@ public: 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 getOutsideInterfaces(); @@ -62,7 +62,7 @@ public: private: GroupBlock* topGroup; QList groups; //! usefull to avoid recursive methods to find a particular group. - QList sources; //! source for the top group + QList stimulis; //! source for the top group }; diff --git a/GroupBlock.cpp b/GroupBlock.cpp index fda0546..d682a57 100644 --- a/GroupBlock.cpp +++ b/GroupBlock.cpp @@ -139,11 +139,11 @@ void GroupBlock::createInputPattern() { } 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)); } @@ -167,7 +167,7 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { 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 { @@ -200,7 +200,7 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { 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; @@ -221,7 +221,7 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { 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 @@ -240,7 +240,7 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { 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; } @@ -264,7 +264,7 @@ void GroupBlock::computeOutputPattern(int nbExec) throw(Exception) { QList* pattern = new QList(*(connIface->getConnectedFrom()->getOutputPattern())); connIface->setOutputPattern(pattern); } - setPatternComputed(true); + setOutputPatternComputed(true); } } diff --git a/GroupInterface.cpp b/GroupInterface.cpp index 5f292b6..b42e7a0 100644 --- a/GroupInterface.cpp +++ b/GroupInterface.cpp @@ -122,7 +122,7 @@ bool GroupInterface::canConnectFrom(AbstractInterface *iface) { 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; } diff --git a/GroupItem.cpp b/GroupItem.cpp index 385b352..f275f8e 100644 --- a/GroupItem.cpp +++ b/GroupItem.cpp @@ -5,7 +5,7 @@ #include "Dispatcher.h" #include "Parameters.h" #include "BoxItem.h" -#include "SourceItem.h" +#include "StimuliItem.h" #include "AbstractBlock.h" #include "AbstractInterface.h" #include "ConnectedInterface.h" @@ -430,7 +430,7 @@ void GroupItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { 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; } diff --git a/GroupScene.cpp b/GroupScene.cpp index 05d7c4c..70c88e2 100644 --- a/GroupScene.cpp +++ b/GroupScene.cpp @@ -5,7 +5,7 @@ #include "GroupWidget.h" #include "GroupItem.h" #include "BoxItem.h" -#include "SourceItem.h" +#include "StimuliItem.h" #include "ConnectionItem.h" #include "InterfaceItem.h" #include "AbstractBlock.h" @@ -73,7 +73,7 @@ int GroupScene::setItemsId(int countInit) { int counter = countInit; groupItem->setId(counter++); if (isTopScene()) { - foreach(SourceItem *item, sourceItems){ + foreach(StimuliItem *item, stimuliItems){ item->setId(counter++); } } @@ -89,7 +89,7 @@ int GroupScene::setInterfacesId(int countInit) { inter->setId(counter++); } if (isTopScene()) { - foreach(SourceItem *item, sourceItems){ + foreach(StimuliItem *item, stimuliItems){ foreach(InterfaceItem* inter, item->getInterfaces()){ inter->setId(counter++); } @@ -156,35 +156,35 @@ void GroupScene::removeBoxItem(BoxItem* item) { 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) { @@ -272,8 +272,8 @@ void GroupScene::save(QXmlStreamWriter &writer) { 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 diff --git a/GroupScene.h b/GroupScene.h index 211d9d7..d5a485e 100644 --- a/GroupScene.h +++ b/GroupScene.h @@ -12,7 +12,7 @@ class GroupWidget; class GroupItem; #include "BoxItem.h" class BoxItem; -class SourceItem; +class StimuliItem; class AbstractBoxItem; class ConnectionItem; class InterfaceItem; @@ -54,7 +54,7 @@ public: // attributes getters inline GroupItem* getGroupItem() {return groupItem;} inline QList getBoxItems() { return boxItems; } - inline QList getSourceItems() { return sourceItems; } + inline QList getSourceItems() { return stimuliItems; } inline QList getConnectionItems() { return connectionItems; } inline QList getChildrenScene() { return childrenScene; } inline GroupScene* getParentScene() { return parentScene; } @@ -89,10 +89,10 @@ public: // 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); } @@ -118,7 +118,7 @@ private: GroupItem *groupItem; //! for convenience, the group item is directly accessible via this attribute QList connectionItems; //! for convenience, connections are directly accessible via this attribute QList boxItems; //! for convenience, box items are directly accessible via this attribute - QList sourceItems; //! for convenience, box items are directly accessible via this attribute. Only usefull for top scene + QList stimuliItems; //! for convenience, box items are directly accessible via this attribute. Only usefull for top scene QList childrenScene;//! for convenience, children scenes are directly accessible via this attribute bool topScene; EditMode editMode; diff --git a/InterfaceItem.cpp b/InterfaceItem.cpp index 1ef3aae..02b04ac 100644 --- a/InterfaceItem.cpp +++ b/InterfaceItem.cpp @@ -98,7 +98,7 @@ void InterfaceItem::paint(QPainter *painter) { if(owner->isBoxItem()) { painter->setPen(QPen(Qt::black,1)); } - else if(owner->isSourceItem()) { + else if(owner->isStimuliItem()) { painter->setPen(QPen(Qt::darkCyan,1)); } } @@ -165,7 +165,7 @@ void InterfaceItem::paint(QPainter *painter) { 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()); } } @@ -174,7 +174,7 @@ void InterfaceItem::paint(QPainter *painter) { 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()); } } diff --git a/Parameters.cpp b/Parameters.cpp index 60d7971..98ea7eb 100644 --- a/Parameters.cpp +++ b/Parameters.cpp @@ -9,7 +9,7 @@ #include "GroupScene.h" #include "GroupItem.h" #include "BoxItem.h" -#include "SourceItem.h" +#include "StimuliItem.h" #include "InterfaceItem.h" #include "ConnectionItem.h" @@ -325,7 +325,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { cout << "top scene has " << sourceNodes.length() << " sources" << endl; for(int j=0; jload(currentSBNode); } @@ -334,7 +334,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) { } cout << "source item has been read, add it to the scene" << endl; // add the block to the GroupScene - currentScene->addSourceItem(sourceItem); + currentScene->addStimuliItem(sourceItem); } } /********************************************************** @@ -1303,7 +1303,7 @@ InterfaceItem* Parameters::searchInterfaceItemById(int id, GroupScene* scene) { } } if (scene->isTopScene()) { - foreach(SourceItem *block, scene->getSourceItems()){ + foreach(StimuliItem *block, scene->getSourceItems()){ foreach(InterfaceItem *item, block->getInterfaces()){ if(item->getId() == id){ return item; diff --git a/ReferenceBlock.cpp b/ReferenceBlock.cpp index b6dee80..9b3959c 100644 --- a/ReferenceBlock.cpp +++ b/ReferenceBlock.cpp @@ -9,7 +9,7 @@ #include "Parameters.h" ReferenceBlock::ReferenceBlock(const QString _xmlFile) : AbstractBlock() { - xmlFile = _xmlFile; + xmlFile = _xmlFile; } void ReferenceBlock::addCategory(int id) { @@ -40,6 +40,16 @@ void ReferenceBlock::setHashMd5() { 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"); @@ -419,6 +429,8 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << b.name; toWrite << b.xmlFile; + toWrite << b.specialType; + toWrite << b.version; toWrite << b.description; toWrite << b.categories; toWrite << b.hashMd5; @@ -547,6 +559,8 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) { in >> b.name; in >> b.xmlFile; + in >> b.specialType; + in >> b.version; in >> b.description; in >> b.categories; in >> b.hashMd5; diff --git a/SpecialBlock.cpp b/SpecialBlock.cpp index 2d225e2..8c7cc10 100644 --- a/SpecialBlock.cpp +++ b/SpecialBlock.cpp @@ -1,18 +1,31 @@ #include "SpecialBlock.h" +#include "FunctionalInterface.h" -SpecialBlock::SpecialBlock(SpecialType _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) { - type = _type; +SpecialBlock::SpecialBlock(int _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces) throw(Exception) : FunctionalBlock(_parent, _reference, createIfaces) { + specialType = _type; } SpecialBlock::~SpecialBlock() { } +bool SpecialBlock::isSpecialBlock() { + return true; +} + void SpecialBlock::checkInputPatternCompatibility() throw(Exception) { try { - switch(type) { - case ClockConvert : + switch(specialType) { + case Source : + checkInputPatternCompatibilitySource(); + break; + case Sink : + checkInputPatternCompatibilitySink(); + break; + case ClkConvert : checkInputPatternCompatibilityClockConvert(); - break; + break; + default: + break; } } catch(Exception e) { @@ -22,10 +35,18 @@ void SpecialBlock::checkInputPatternCompatibility() throw(Exception) { void SpecialBlock::computeOutputPattern(int nbExec) throw(Exception) { try { - switch(type) { - case ClockConvert : + switch(specialType) { + case Source : + computeOutputPatternSource(nbExec); + break; + case Sink : + computeOutputPatternSink(nbExec); + break; + case ClkConvert : computeOutputPatternClockConvert(nbExec); break; + default: + break; } } catch(Exception e) { @@ -33,6 +54,30 @@ void SpecialBlock::computeOutputPattern(int nbExec) throw(Exception) { } } +void SpecialBlock::checkInputPatternCompatibilitySource() throw(Exception) { +} +void SpecialBlock::computeOutputPatternSource(int nbExec) throw(Exception) { + + cout << "computing output pattern of " << qPrintable(name) << " for " << nbExec << " executions" << endl; + foreach(AbstractInterface* iface, getControlOutputs()) { + FunctionalInterface* connIface = AI_TO_FUN(iface); + // create output pattern + QList* pp = productionPattern.value(connIface); + QList* pattern = new QList(*pp); + for(int i=1;iappend(*pp); + // assign pattern to interface + connIface->setOutputPattern(pattern); + // store it in QMap + outputPattern.insert(connIface,pattern); + } + setOutputPatternComputed(true); +} + +void SpecialBlock::checkInputPatternCompatibilitySink() throw(Exception) { +} +void SpecialBlock::computeOutputPatternSink(int nbExec) throw(Exception) { +} + void SpecialBlock::checkInputPatternCompatibilityClockConvert() throw(Exception) { } void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) { diff --git a/SpecialBlock.h b/SpecialBlock.h index 574803d..aff0d6b 100644 --- a/SpecialBlock.h +++ b/SpecialBlock.h @@ -14,27 +14,29 @@ using namespace Qt; class SpecialBlock : public FunctionalBlock { -public: - - enum SpecialType { ClockConvert = 1 }; +public: - SpecialBlock(SpecialType _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces = true) throw(Exception); + SpecialBlock(int _type, GroupBlock* _parent, ReferenceBlock* _reference, bool createIfaces = true) throw(Exception); ~SpecialBlock(); - // getters + // getters // setters // testers + bool isSpecialBlock(); - // others + // others // patterns void checkInputPatternCompatibility() throw(Exception); void computeOutputPattern(int nbExec = -1) throw(Exception); -private: - SpecialType type; - +private: + + void checkInputPatternCompatibilitySource() throw(Exception); + void computeOutputPatternSource(int nbExec = -1) throw(Exception); + void checkInputPatternCompatibilitySink() throw(Exception); + void computeOutputPatternSink(int nbExec = -1) throw(Exception); void checkInputPatternCompatibilityClockConvert() throw(Exception); void computeOutputPatternClockConvert(int nbExec = -1) throw(Exception); diff --git a/SourceItem.cpp b/StimuliItem.cpp similarity index 95% rename from SourceItem.cpp rename to StimuliItem.cpp index 0229e7f..dff5247 100644 --- a/SourceItem.cpp +++ b/StimuliItem.cpp @@ -1,4 +1,4 @@ -#include "SourceItem.h" +#include "StimuliItem.h" #include "GroupScene.h" #include "ConnectionItem.h" #include "InterfaceItem.h" @@ -15,7 +15,7 @@ #include "Graph.h" -SourceItem::SourceItem(AbstractBlock *_refBlock, +StimuliItem::StimuliItem(AbstractBlock *_refBlock, Dispatcher *_dispatcher, Parameters *_params) throw(Exception) : AbstractBoxItem( _refBlock, _dispatcher, _params) { @@ -39,7 +39,7 @@ SourceItem::SourceItem(AbstractBlock *_refBlock, //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; @@ -52,10 +52,10 @@ SourceItem::SourceItem(Dispatcher *_dispatcher, Parameters *_params) throw(Excep 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); @@ -71,16 +71,16 @@ void SourceItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option } } -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); @@ -91,7 +91,7 @@ void SourceItem::nameChanged() { update(); } -void SourceItem::updateMinimumSize() { +void StimuliItem::updateMinimumSize() { int maxSouth = 0; int maxNorth = 0; @@ -149,7 +149,7 @@ void SourceItem::updateMinimumSize() { /* updateGeometry() : */ -bool SourceItem::updateGeometry(ChangeType type) { +bool StimuliItem::updateGeometry(ChangeType type) { currentPosition = pos(); //cout << "current pos of block: " << currentPosition.x() << "," << currentPosition.y() << endl; @@ -212,7 +212,7 @@ bool SourceItem::updateGeometry(ChangeType type) { return false; } -void SourceItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { +void StimuliItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { if(params->editState == Parameters::EditBlockMove) { QPointF absPos = currentPosition + originPoint; @@ -303,7 +303,7 @@ void SourceItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { } } -void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { +void StimuliItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { QPointF pos = event->pos(); qreal x = pos.x(); @@ -366,7 +366,7 @@ void SourceItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { } } -void SourceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { +void StimuliItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { //setZValue(zValue()-100); @@ -415,7 +415,7 @@ void SourceItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { QGraphicsItem::mouseReleaseEvent(event); } -void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { +void StimuliItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { QPointF pos = event->pos(); qreal x = pos.x(); @@ -485,7 +485,7 @@ void SourceItem::hoverMoveEvent(QGraphicsSceneHoverEvent * event) { } -void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { +void StimuliItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { event->accept(); @@ -539,17 +539,17 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { 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){ @@ -563,7 +563,7 @@ void SourceItem::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { } } -void SourceItem::load(QDomElement funcElement) throw(Exception) { +void StimuliItem::load(QDomElement funcElement) throw(Exception) { bool ok = false; @@ -614,7 +614,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) { 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. */ @@ -706,7 +706,7 @@ void SourceItem::load(QDomElement funcElement) throw(Exception) { updateGeometry(Resize); } -void SourceItem::save(QXmlStreamWriter &writer) { +void StimuliItem::save(QXmlStreamWriter &writer) { writer.writeStartElement("source_item"); diff --git a/SourceItem.h b/StimuliItem.h similarity index 72% rename from SourceItem.h rename to StimuliItem.h index 72ebede..c8d68a0 100644 --- a/SourceItem.h +++ b/StimuliItem.h @@ -1,5 +1,5 @@ -#ifndef __SOURCEITEM_H__ -#define __SOURCEITEM_H__ +#ifndef __STIMULIITEM_H__ +#define __STIMULIITEM_H__ #include @@ -21,24 +21,24 @@ using namespace std; 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(); @@ -59,4 +59,4 @@ protected: }; -#endif // __SOURCEITEM_H__ +#endif // __STIMULIITEM_H__ diff --git a/blast.creator.user b/blast.creator.user index ee6eead..eb750a8 100644 --- a/blast.creator.user +++ b/blast.creator.user @@ -1,10 +1,10 @@ - + EnvironmentId - {c8006d66-d34f-42be-ad10-d0207752286d} + {3701e197-5b6c-48ea-9e98-a6cf6de18672} ProjectExplorer.Project.ActiveTarget @@ -61,7 +61,7 @@ Desktop Desktop - {2c9bf876-3476-44eb-8065-1f0844704dda} + {ed04208c-8774-456b-99b9-4a02094ca7a4} 0 0 0 diff --git a/blast.files b/blast.files index 114b32d..8dcb9aa 100755 --- a/blast.files +++ b/blast.files @@ -42,13 +42,13 @@ GroupInterface.h 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 diff --git a/lib/implementations/impls.bmf b/lib/implementations/impls.bmf new file mode 100644 index 0000000000000000000000000000000000000000..31ec0a1a87da3f8be4fd98d9f4f0e3556672e735 GIT binary patch literal 6865 zcmd5=zi%T&6n<;a2_4eu1d$b4=!y_fLeAX9hjgdwK-YpIAqqsXihtl39NT9ncM0H< zmI4q31qD!3QPNOSQ1EB)U+{hNc6MfWXEq7avDjLBcjvt~^S<|UMx^tnh`fyJZ(Kjh z9XXP@9LorID;b*mL)_hw16ktf6O5eT=^dF0-}8Qe_d~y7BO`SN zjze4%@XU=OX7gaTvycjY}ObuXyoEzpE$OUhBLo3afo`w%k(6Y*80H}Yqqm|{XwiL_;3 zKCkes16*^D>lL|czA@e&WcK7?MQ#_fJ;b$^+m$hC{e)S6XuuGC_}>})ZUT=wF(yf2 zh?p_9fLn~dXb?JE#~Aq7*kgg;ec;xUw;=riMhy%MiZO5 z5k{;j7kG09jtPwDOxep!X*n;JXU*J32&u%moMIj)^8m}GdsJoaAxPK%YR2E964hm@ zbH(uJ%1&f$J=x72Exi7iOge3K1$)Mw??Piq?!yjWH{hlN_`nDW_S4Koxk@He=X7n1 z`ZR8YzGglxm`vTMUC0Q&BPmS_bRAD%3a>9Z$MbLwO55}##b}Jogbw#>BhXC&o2_6P zHmp>$EUnVz{m2Yeng_t*YEp{uGaGE@GU{dr;pNRlv6nW0`~~Xo8Z*GsGzqMBbhoPi z(%lHLPgevnSitFn%_y~k|16=-A$%*=p-`zZT}dgdAC1g5M9onJQeZ%Y#(6E!g07>a z)c~%u`X;2=P+XWsKnvRpyc&uh;jW3Uhd>RC?b)8pp))(5kT={ipjK%E;B7!%+x4jU zy*$swI-d?G{LaVm*|O+!`rS{*?qEnQxhG&CD3i zg}TxQOwmRN(|V5~%+G(&6(4$MEF8I^U?7LM*D!|me?ud+D4XGmPwPYc{9gdIz2{{C zRr&y+kD|@7D>U425bWKWEe8>z=ie~9NyDD!Ot zMcDSWY1Y4na{OlA{aUJ$LRdR8ux-v*$ypFqS-N3Q%A=75{uz*VoLsgn+j96MbK|Vk zCfAUBZ2B3S&iNE_QpnbB!6qPojLi{`D$mh#@(_xtNKX)AD(4ea#&UXa-I=xsIq=W)3%7VQrqTL#^A{CCQ7JvxyA7 z!m8Pf>TWm$a2uZM(-c7@R@n|u@wB@EigL%Mu4u)YR(p1)J;Dc&+QdeSht16MEBw!q w8dt$aDwL$Ksy+z=ZZqcBgM8kzZ{ud9jf#f9ZM2+*HKirOCGTQ0HAzrng9R* literal 0 HcmV?d00001 diff --git a/lib/references/clkdomain_convert_1024x8.xml b/lib/references/clkdomain_convert_1024x8.xml index 9247fb2..b980f69 100644 --- a/lib/references/clkdomain_convert_1024x8.xml +++ b/lib/references/clkdomain_convert_1024x8.xml @@ -1,5 +1,5 @@ - + clkdomain_convert_1024x8 diff --git a/lib/references/csvreader.xml b/lib/references/csvreader.xml index 7da5240..4d4d627 100644 --- a/lib/references/csvreader.xml +++ b/lib/references/csvreader.xml @@ -1,5 +1,5 @@ - + generator-csvreader diff --git a/lib/references/generator-cst.xml b/lib/references/generator-cst.xml index 76e4d39..2ddf876 100644 --- a/lib/references/generator-cst.xml +++ b/lib/references/generator-cst.xml @@ -1,5 +1,5 @@ - + generator-cst diff --git a/lib/references/generator-img.xml b/lib/references/generator-img.xml index a3905a0..dfc18eb 100644 --- a/lib/references/generator-img.xml +++ b/lib/references/generator-img.xml @@ -1,5 +1,5 @@ - + generator-img diff --git a/lib/references/read_csv.xml b/lib/references/read_csv.xml index 7cebc17..c8fd7f1 100644 --- a/lib/references/read_csv.xml +++ b/lib/references/read_csv.xml @@ -1,5 +1,5 @@ - + read_csv diff --git a/lib/references/references.bmf b/lib/references/references.bmf index 3c19438c097d2343fffb1e6485f708444c5a1fe1..b7a6ef6d9acaa1b455b30970d8800f9d287577d9 100644 GIT binary patch delta 4413 zcmb_fTW?fV6yEzxTd|6GgDMi7D8@o@=yYa!F>)(qDvASX2myVlbA^#IQ)Wt`1~a}$ zd_bcdf+P~{1Hl+$P*0+XM4pT>_@c%KBZ<*BAB-Bq5Agf;n$0<9+DRa>Cuh2^Yp=_< zzO~Qw^ZML}xx=}9YXsU zMrYJPwBmTVVp<)=$ol3;)%48Rr+?0A{jXbcUYiV`vilZJ83>(HH|KCHaE_{b>Bv2f zzUc1j{J)RNEI4YoYuvdhuhor?HTbOvA-)gkDc_3=ZTV%%D_Wm*_jP~K2)pe)wFizb zBQ!yA3<5_O6dpv;b+mIhzG6lWtE>rUQPnVCRi(h{f(dmQVXhe0=FKkd%d43f{uRvP zYG6wlSb0wEyCG_;+O5)RKn-~>-I40hv+n$|k6JW8-$wHSP9xN!(6C~DXVI^rcL4vX zD@PM}>ws0>xU!CRS#cfr9mNU)Qh-r4&Fa0p`xP&@xbQOOySw#N>#-cf>lZU)1?2W2kHH_a} zQ}?xKmlgJP8N=(|PxpP`=n414ig#KxItdw!Gn0|_mrXRqd%j5)6HMD9c5p5BPlvBW*M@>(MTR|$vEY2OBdy#v@_ zaHsH46{%1F#i#njp zQ6^^*l0+KAHek+6;(yM>X9T}PCR%YsErkH~Gg7P2%wf?W#EWuqv~o~VsZMu(OOF?M zB;)9eJF(`gmarAtge^#JQ3z$ynk0t}WfK+)z>IpLrJB;emdx1BG;KoJR$IK;$Cf+# zpnK}^R-V1kR+S=>bQ zFk$E{p|%PRI*guBq@-B5TA%J+>gY}G{JP7_U{8QLX5Ie2o=F;i=Eq-(c~j7He~hTFVTZK;TF5Ul7Z3Ogp566fi0`Ln%M4EZsgE zi<=;*WHcmM5;TKIzZKFM9DT~YlDd=+LuapnaTUvX zQ4q4Xd=XcZM&l@;oKa)2!_Ew}ok?)U`)2Tj<8)qd$3{L5XT5&8ZK~NTO+jshDeIto zA2f=or6?q~V`KwHm^}2QBp*|XAP6FZ9+sOm*Pt|$tgVndHp;Ef@;?PIZ0&D>6euM; zbjPFUrfST4kxIDMP_C(@RjXlBjr0*rsHT1f_qI~-qQiA$0YQx|tIQc5bju3g34!KT zO5MDjPacWrF89jDcLRv#?PIm^D@k06WFD#1t~Ml*IB~ob%R0^So&wZZuUQHNcEebc z#hMaU#W6bq*@SBfr`@KM*R}a?r}G>-E8SN|A99zEz7>E9Rr(qm$)|FY1 zHLydjnIW;ywmsltJV(``z~Y-5uNK!?x;`Ew<890>RoEv@L8m=|wQg>mjkc zAE~kp3h-BMbBkEpz(QJf*klPILYUW)YrY34PO|OheL!_An)e$gQx%R<8DC-_tEW#p zgk3wg#=NogY3=S_)9GFtKND~qFMsVyH}#%INhrfg|N3XsJjfD$VU}+*)+k{R`8cwB znz@@aMT}Tvl2Q;q_4CG2a*(7D%Nf53SiWN3)u;c`PRCC7%V#bJ3?RyX#TtHD9)dKg zY$?}%oz`%k6cJ0l;T2*id50{;vjv3yYEe99LrYlk*@X>q;g?TeImBAayLc8y^P_DN TDQG`ceHRA8 delta 2810 zcmcgu&ubG=5T1GYp;U^Etu(fXsY;EuhWu)>3nCH4VznjaCiY-9n+377Rf{52g@QMQ z>Ie#o1}Rz*ExL#hDfG~j|AHdoS$fLJgZRC*SC20&FY|VGmU;8d_s!<Q|Fww;9 z{qVi>Nt&h^N{~ZW=pxn0!`_9xO0~c|VO;d`FDx-D$+L)NyGD!csE-7RKEKJ0mJ6rb$CCFV7Gw%2b1JkbCi zj|u@GHmdeewToYiio>{d0EPu?0ks;SsUp-uup4*^@Yw)~C?bv2PM`Oe6&Iv3xM~!l zg#!bMyJYF0S^cS@PQ^Xab@;QIeq8qj*s zQYmbzLR$wd_ux$j4G&8rHty$gi_BkSJ>R~wI{_0RN*qVCFpC3K$xa4^xNtdOa2i2H zT)GmiV|{*2W_))2bm6+<1zEOM&Ka9Oe$$>;Dtt|>BX5n8XZq-6O`adep0tfTdRl7o zI6&45cA674O&hvM)Tb|{eYGFE<47}eo!YTHduw4a;9u{PPNW1slS!-C}aQt diff --git a/object-files.txt b/object-files.txt index 2adb35e..8184399 100644 --- a/object-files.txt +++ b/object-files.txt @@ -16,7 +16,7 @@ COMMON-OBJ = $(BUILDPATH)/AbstractBlock.o \ $(BUILDPATH)/AbstractBoxItem.o \ $(BUILDPATH)/BoxItem.o \ $(BUILDPATH)/GroupItem.o \ - $(BUILDPATH)/SourceItem.o \ + $(BUILDPATH)/StimuliItem.o \ $(BUILDPATH)/BlockCategory.o \ $(BUILDPATH)/BlockLibraryTree.o \ $(BUILDPATH)/BlockLibraryWidget.o \ diff --git a/reference.xsd b/reference.xsd index 9442528..259506f 100644 --- a/reference.xsd +++ b/reference.xsd @@ -30,6 +30,14 @@ + + + + + + + + @@ -219,7 +227,7 @@ - + -- 2.39.5