From: stephane Domas Date: Thu, 11 May 2017 19:37:28 +0000 (+0200) Subject: started to include patterns in implementation X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/8d3e09e430e829b9d847847334cbfe37790baca3 started to include patterns in implementation --- diff --git a/BlockImplementation.cpp b/BlockImplementation.cpp index 571b72b..af06ef3 100644 --- a/BlockImplementation.cpp +++ b/BlockImplementation.cpp @@ -20,6 +20,30 @@ BlockImplementation::BlockImplementation(const QString& _xmlFile, const QString referenceMd5 = _referenceMd5; } +void BlockImplementation::assignPatterns(FunctionalBlock *_block) throw(Exception) { + + block = _block; + + QFile implFile(xmlFile); + + // reading in into QDomDocument + QDomDocument document("implFile"); + + if (!implFile.open(QIODevice::ReadOnly)) { + throw(Exception(IMPLFILE_NOACCESS)); + } + if (!document.setContent(&implFile)) { + implFile.close(); + throw(Exception(IMPLFILE_NOACCESS)); + } + implFile.close(); + QDomElement impl = document.documentElement(); + QDomNodeList patternNode = impl.elementsByTagName("patterns"); + if (patternNode.isEmpty()) return; + QDomElement patternElt = patternNode.at(0).toElement(); + +} + void BlockImplementation::generateVHDL(FunctionalBlock* _block, const QString &path) throw(Exception) { block = _block; diff --git a/BlockImplementation.h b/BlockImplementation.h index df0e499..852cc63 100644 --- a/BlockImplementation.h +++ b/BlockImplementation.h @@ -40,7 +40,9 @@ public: inline void setReference(ReferenceBlock* _reference) { reference = _reference; } + void assignPatterns(FunctionalBlock* _block) throw(Exception); // called during output pattern computation void generateVHDL(FunctionalBlock* _block, const QString& path) throw(Exception); // main entry to generate the VHDL code + private: QString xmlFile; diff --git a/Exception.cpp b/Exception.cpp index c45c367..9093e49 100644 --- a/Exception.cpp +++ b/Exception.cpp @@ -24,6 +24,7 @@ QString Exception::getDefaultMessage() { case BLOCKFILE_NOACCESS : ret = tr("Block file cannot be read"); break; case IMPLFILE_CORRUPTED : ret = tr("Implementation file is corrupted"); break; case IMPLFILE_NOACCESS : ret = tr("Implementation file cannot be read"); break; + case IMPLFILE_NOPATTERN : ret = tr("Implementation file does not contains pattern definitions"); break; case BLOCK_NULL : ret = tr("A parameter of type AbstractBlock* has been provided with NULL value."); break; case BLOCK_INVALID_TYPE : ret = tr("A parameter of type AbstractBlock* is used with an incorrect instance type."); break; case IFACE_NULL : ret = tr("A parameter of type AbstractInterface* has been provided with NULL value."); break; diff --git a/Exception.h b/Exception.h index 32b2e49..c65ed5a 100644 --- a/Exception.h +++ b/Exception.h @@ -20,41 +20,43 @@ supp. infos : saved in UTF-8 [éè] #include // exceptions for file accesses -#define CONFIGFILE_NOACCESS 1 -#define CONFIGFILE_CORRUPTED 2 +#define CONFIGFILE_NOACCESS 101 +#define CONFIGFILE_CORRUPTED 102 -#define PROJECTFILE_NOACCESS 3 -#define PROJECTFILE_CORRUPTED 4 +#define PROJECTFILE_NOACCESS 201 +#define PROJECTFILE_CORRUPTED 202 -#define BLOCKPATH_NOACCESS 5 -#define IMPLPATH_NOACCESS 6 +#define BLOCKFILE_NOACCESS 301 +#define BLOCKFILE_CORRUPTED 302 -#define BLOCKFILE_NOACCESS 7 -#define BLOCKFILE_CORRUPTED 8 +#define IMPLFILE_NOACCESS 401 +#define IMPLFILE_CORRUPTED 402 +#define IMPLFILE_NOPATTERN 403 -#define IMPLFILE_NOACCESS 9 -#define IMPLFILE_CORRUPTED 10 +#define VHDLFILE_NOACCESS 501 -#define VHDLFILE_NOACCESS 11 +#define BLOCKPATH_NOACCESS 601 + +#define IMPLPATH_NOACCESS 701 // exceptions for block manipulations -#define BLOCK_NULL 100 -#define BLOCK_INVALID_TYPE 101 +#define BLOCK_NULL 1001 +#define BLOCK_INVALID_TYPE 1002 // exceptions for interfaces manipulations -#define IFACE_NULL 200 -#define IFACE_INVALID_TYPE 201 -#define IFACE_MULTIPLICITY_REACHED 202 +#define IFACE_NULL 2001 +#define IFACE_INVALID_TYPE 2002 +#define IFACE_MULTIPLICITY_REACHED 2003 // exceptions for block items manipulations -#define BLOCKITEM_NULL 300 -#define BLOCKITEM_INVALID_TYPE 301 +#define BLOCKITEM_NULL 3001 +#define BLOCKITEM_INVALID_TYPE 3002 // exceptions for width interfaces validation -#define WIDTHS_NOT_EQUALS 400 +#define WIDTHS_NOT_EQUALS 4001 // exceptions for VHDL generation -#define INVALID_VALUE 500 +#define INVALID_VALUE 5001 using namespace std; using namespace Qt; diff --git a/blast.creator.user b/blast.creator.user index 6673fe4..b9d826a 100755 --- a/blast.creator.user +++ b/blast.creator.user @@ -1,10 +1,10 @@ - + EnvironmentId - {1d077e47-e3a1-47fd-8b12-4de650e39df5} + {c8006d66-d34f-42be-ad10-d0207752286d} ProjectExplorer.Project.ActiveTarget @@ -60,12 +60,12 @@ Desktop Desktop - {451ee8a3-56ff-4aba-8a8e-3da882cc142e} + {2c9bf876-3476-44eb-8065-1f0844704dda} 0 0 0 - /localhome/sdomas/Projet/Blast/code/blast + /home/sdomas/Projet/Blast/code/blast