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 };
\r
enum ParamType { Expression = 1, Character, String, Bit, BitVector, Boolean, Integer, Natural, Positive, Real, Time};\r
// a bit ugly to put that here but more practical for using them\r
+ /*!\r
+ * \brief The ParamWBAccess enum\r
+ * Read means that the block setup the value of this parameter and it is possible to \r
+ * to read that value from outside the FPGA (via the wrapper of the wishbone). Thus,\r
+ * from the block point of view, the parameter corresponds to an output port.\r
+ * Write means that it is possible to setup the value of this paramter from outside the FPGA (via\r
+ * the wrapper of the wishbone) so that the block can read that value. Thus,\r
+ * from the block point of view, the parameter corresponds to an input port.\r
+ */\r
enum ParamWBAccess { Read = 1, Write = 2};\r
enum ParamWBDuration { Permanent = 1, Trigger = 2 };\r
enum ParamVHDLContext { Entity = 1, Component = 2, Architecture = 3 }; // NB : 3 is when creating an instance of the block that owns this iface\r
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 :
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();
//virtual void connectionsValidation(QStack<AbstractInterface*> *interfacetoValidate, QList<AbstractInterface*> *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<ConnectedInterface*> 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;
};
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);
}
}
}
-void ReferenceBlock::parametersValidation(QList<AbstractBlock *> *checkedBlocks, QList<AbstractBlock *> *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<AbstractBlock *> *checkedBlocks, QList<AbstractBlock *> *blocksToConfigure) {
return;
}
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);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 3.2.1, 2017-05-03T17:42:11. -->
+<!-- Written by QtCreator 3.2.1, 2017-05-04T17:29:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
- <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
+ <value type="QByteArray" key="CurrentPreferences">qt2</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
- <value type="int" key="EditorConfiguration.IndentSize">4</value>
+ <value type="int" key="EditorConfiguration.IndentSize">2</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
- <value type="int" key="EditorConfiguration.TabSize">8</value>
- <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+ <value type="int" key="EditorConfiguration.TabSize">4</value>
+ <value type="bool" key="EditorConfiguration.UseGlobal">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
- <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+ <value type="bool" key="EditorConfiguration.cleanWhitespace">false</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
- 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.
<inputs>, <outputs> attributes :
<input name="data_i" pattern="(1){$nb_data}" />
</consumption>
<production>
- <output name="data_o" pattern="00{$nb_data}" counter="{2,$nb_data+2}"/>
+ <output name="data_o" pattern="00{$nb_data}" counter="{2:$nb_data+2:1}"/>
</production>
</patterns>
</block_impl>
<inputs>\r
<input name="clk" type="boolean" width="1" purpose="clock" />\r
<input name="rst" type="boolean" width="1" purpose="reset" />\r
- \r
<input name="data_i" type="expression" width="$data_width" />\r
+ <control iface="data_i" />\r
</inputs>\r
<outputs>\r
<output name="data_o" type="expression" width="$data_width" multiplicity="1"/>\r
+ <control iface="data_o" />\r
</outputs> \r
</interfaces>\r
\r
<xs:attribute ref="name" use="required"/>
<xs:attribute ref="type" use="required"/>
<xs:attribute ref="wishbone" use="optional"/>
- <xs:attribute ref="core" use="optional"/>
<xs:attribute ref="value" use="optional"/>
<xs:attribute ref="iface" use="optional"/>
<xs:attribute ref="width" use="optional"/>
<xs:attribute name="ids" type="xs:string"/>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
- <xs:attribute name="core" type="xs:string"/>
<xs:attribute name="wishbone" type="xs:string"/>
<xs:attribute name="context" type="xs:string" />
<xs:attribute name="multiplicity" type="xs:string" />
</xs:complexType>
</xs:element>
+ <xs:element name="control">
+ <xs:complexType>
+ <xs:attribute ref="iface"/>
+ </xs:complexType>
+ </xs:element>
+
<xs:element name="inputs">
<xs:complexType>
<xs:sequence>
- <xs:element ref="input" maxOccurs="unbounded" />
+ <xs:element ref="input" maxOccurs="unbounded" />
+ <xs:element ref="control" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="outputs">
<xs:complexType>
<xs:sequence>
- <xs:element ref="output" maxOccurs="unbounded" />
+ <xs:element ref="output" maxOccurs="unbounded" />
+ <xs:element ref="control" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>