From: stephane Domas Date: Thu, 4 May 2017 15:29:33 +0000 (+0200) Subject: begun integration of control ifaces X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/commitdiff_plain/561d4f45e60504cc9e041370dd908b002fe776a5?ds=sidebyside;hp=1f7784e996c1a8ebe3277aaeeff98490cd6d8a94 begun integration of control ifaces --- diff --git a/AbstractInterface.h b/AbstractInterface.h index 608d04c..5c0b83a 100644 --- a/AbstractInterface.h +++ b/AbstractInterface.h @@ -24,7 +24,7 @@ class AbstractInterface { public : enum IfaceWidthType { Expression = 1, Boolean, Natural}; - enum IfacePurpose { Data = 1, Clock = 2, Reset = 3, Wishbone = 4 }; + enum IfacePurpose { Data = 1, Control, Clock, Reset, Wishbone }; enum IfaceDirection { Input = 1, Output = 2, InOut = 3 }; enum IfaceVHDLContext { Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface enum IfaceVHDLFlags { NoComma = 1 }; diff --git a/BlockParameter.h b/BlockParameter.h index e0c4af2..adc8c5d 100644 --- a/BlockParameter.h +++ b/BlockParameter.h @@ -19,6 +19,15 @@ public : enum ParamType { Expression = 1, Character, String, Bit, BitVector, Boolean, Integer, Natural, Positive, Real, Time}; // a bit ugly to put that here but more practical for using them + /*! + * \brief The ParamWBAccess enum + * Read means that the block setup the value of this parameter and it is possible to + * to read that value from outside the FPGA (via the wrapper of the wishbone). Thus, + * from the block point of view, the parameter corresponds to an output port. + * Write means that it is possible to setup the value of this paramter from outside the FPGA (via + * the wrapper of the wishbone) so that the block can read that value. Thus, + * from the block point of view, the parameter corresponds to an input port. + */ enum ParamWBAccess { Read = 1, Write = 2}; enum ParamWBDuration { Permanent = 1, Trigger = 2 }; enum ParamVHDLContext { Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface diff --git a/ConnectedInterface.h b/ConnectedInterface.h index a8ce4de..3a1fb4f 100644 --- a/ConnectedInterface.h +++ b/ConnectedInterface.h @@ -14,7 +14,10 @@ class ReferenceInterface; using namespace std; using namespace Qt; - +/*! + * \brief The ConnectedInterface class represents an interface of block (functional or group) that may be connected from/to other interfaces + * A ConnectedInterface is used to establish connection between blocks. + */ class ConnectedInterface : public AbstractInterface { public : @@ -33,14 +36,13 @@ public : virtual bool canConnectTo(AbstractInterface* iface) = 0; virtual bool canConnectFrom(AbstractInterface* iface) = 0; - // others + // others bool connectTo(ConnectedInterface* iface); bool connectFrom(ConnectedInterface* iface); ConnectedInterface* getConnectionToParentGroup(); ConnectedInterface* getConnectionFromParentGroup(); - virtual AbstractInterface *clone() = 0; - + virtual AbstractInterface *clone() = 0; void removeConnectedTo(ConnectedInterface *inter); virtual void clearConnectedTo(); @@ -49,9 +51,29 @@ public : //virtual void connectionsValidation(QStack *interfacetoValidate, QList *validatedInterfaces) throw(Exception) = 0; protected: + /*! + * \brief connectedTo lists of connections to interfaces owned by other blocks (functional or group) + * Since the graph is oriented, and taking into account it modles a FPGA desing, + * this interface may be connected to several interfaces owned by other blocks (functional or group). + * connectedTo references such interfaces if they exist. + */ QList connectedTo; + /*! + * \brief connectedFrom connection from an interface owned by another blocks (functional or group) + * Since the graph is oriented, and taking into account it modles a FPGA desing, + * there may be a single interface owned by another block (functional or group) that is connected to + * this interface. connecteFrom references such an interface if it exists. + */ ConnectedInterface* connectedFrom; - + /*! + * \brief associatedIface the control (resp. data) interface that is bounded to this data (resp. control) interface + * If a reference block is designed to be fully integrated in Blast, nearly every data interface is bounded + * to a control interface that signals if the value presented on the interface is valid or not. associatedIface + * references this control interface if this is a data interface, and a data interface is this is a control interface. + * Note that the association is done by the call of setAssociatedIface() that must be done only for a control interface. + * (NB: a test is done in the method to prevent the other case). + */ + ConnectedInterface* associatedIface; }; diff --git a/ReferenceBlock.cpp b/ReferenceBlock.cpp index 93f7c41..a0a8220 100644 --- a/ReferenceBlock.cpp +++ b/ReferenceBlock.cpp @@ -68,6 +68,14 @@ void ReferenceBlock::load(QDomElement &elt) throw(Exception) { try { loadInterfaces(eltInter); } + catch(int err) { + throw(err); + } + + // create interfaces that correspond to a wishbone parameter, if any. + try { + createInterfaceForParameters(); + } catch(int err) { throw(err); } @@ -265,8 +273,27 @@ void ReferenceBlock::loadInterfaces(QDomElement &elt) throw(Exception) { } } -void ReferenceBlock::parametersValidation(QList *checkedBlocks, QList *blocksToConfigure) -{ +void ReferenceBlock::createInterfaceForParameters() throw(Exception){ + ReferenceInterface* iface = NULL; + foreach(BlockParameter* param, params) { + + if (param->isWishboneParameter()) { + BlockParameterWishbone* p = (BlockParameterWishbone*)param; + int orientation = -1; + if (p->getWBAccess() == BlockParameter::Read) { + iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), AbstractInterface::Output, AbstractInterface::Wishbone,1); + outputs.append(iface); + } + else if (p->getWBAccess() == BlockParameter::Write) { + iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), AbstractInterface::Input, AbstractInterface::Wishbone,1); + inputs.append(iface); + } + ReferenceInterface* iface = new ReferenceInterface(this,p->getName(),p->getType(),p->getWidth(), orientation, AbstractInterface::Wishbone,1); + } + } +} + +void ReferenceBlock::parametersValidation(QList *checkedBlocks, QList *blocksToConfigure) { return; } diff --git a/ReferenceBlock.h b/ReferenceBlock.h index 324e289..ebd46c9 100644 --- a/ReferenceBlock.h +++ b/ReferenceBlock.h @@ -56,6 +56,7 @@ private: void loadInformations(QDomElement &elt) throw(Exception); void loadParameters(QDomElement &elt) throw(Exception); void loadInterfaces(QDomElement &elt) throw(Exception); + void createInterfaceForParameters() throw(Exception); friend QDataStream &operator<<(QDataStream &out, const ReferenceBlock &b); friend QDataStream &operator>>(QDataStream &in, ReferenceBlock &b); diff --git a/blast.creator.user b/blast.creator.user index c87af56..5ea7a3a 100755 --- a/blast.creator.user +++ b/blast.creator.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -19,7 +19,7 @@ Cpp - CppGlobal + qt2 @@ -31,7 +31,7 @@ 2 UTF-8 false - 4 + 2 false 80 true @@ -42,12 +42,12 @@ 0 true 0 - 8 - true + 4 + false 1 true true - true + false false diff --git a/lib/README.txt b/lib/README.txt index 225b83e..85c9ae3 100644 --- a/lib/README.txt +++ b/lib/README.txt @@ -7,7 +7,7 @@ XML description of a block model : - type : required - value : required if context = constant/generic, optionnal if context = wb, optional but not used if context = user/port - context : required - - core : required if context = wb, not used for others. Possibles values : r or w. Specify if the parameter will be a register + - wishbone : required if context = wb, not used for others. Possibles values : r or w,keep_value,type_init. Specify if the parameter will be a register that is read by the core, i.e. an input port of the core, or written by the core. , attributes : diff --git a/lib/implementations/average-Nx3_impl.xml b/lib/implementations/average-Nx3_impl.xml index e74de0f..1ea7a7f 100644 --- a/lib/implementations/average-Nx3_impl.xml +++ b/lib/implementations/average-Nx3_impl.xml @@ -29,7 +29,7 @@ - + diff --git a/lib/references/average-Nx3.xml b/lib/references/average-Nx3.xml index 7689322..b103305 100644 --- a/lib/references/average-Nx3.xml +++ b/lib/references/average-Nx3.xml @@ -24,11 +24,12 @@ - + + diff --git a/lib/references/references.bmf b/lib/references/references.bmf index 8108f61..9bc3ec7 100644 Binary files a/lib/references/references.bmf and b/lib/references/references.bmf differ diff --git a/reference.xsd b/reference.xsd index a5c2c2d..3fa3faa 100644 --- a/reference.xsd +++ b/reference.xsd @@ -7,7 +7,6 @@ - @@ -28,7 +27,6 @@ - @@ -120,10 +118,17 @@ + + + + + + - + + @@ -137,7 +142,8 @@ - + +