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
+\r
inline QList<AbstractInterface*> getInputs() { return inputs; }\r
inline QList<AbstractInterface*> getOutputs() { return outputs; }\r
inline QList<AbstractInterface*> getBidirs() { return bidirs; } \r
+ QList<AbstractInterface *> getInterfaces(int direction = AbstractInterface::AnyDirection, int purpose = AbstractInterface::AnyPurpose);\r
+ QList<AbstractInterface *> getDataInputs(); //! return all inputs of type data\r
+ QList<AbstractInterface *> getDataOutputs(); //! return all inputs of type data\r
+ QList<AbstractInterface *> getControlInputs(); //! return all inputs of type control\r
+ QList<AbstractInterface *> getControlOutputs(); //! return all outputs of type control\r
+ AbstractInterface* getIfaceFromName(QString name);\r
+\r
+ inline QList<BlockParameter *> getParameters() { return params; }\r
+ BlockParameter* getParameterFromName(QString name);\r
QList<BlockParameter *> getUserParameters();\r
QList<BlockParameter *> getGenericParameters();\r
QList<BlockParameter *> getPortParameters();\r
QList<BlockParameter *> getWishboneParameters();\r
+\r
inline AbstractBlock* getParent() { return parent; }\r
inline bool getOutputPatternComputed() { return outputPatternComputed; }\r
inline int getTraversalLevel() { return traversalLevel; }\r
void removeAllInterfaces();\r
void defineBlockParam(BlockParameter *param);\r
\r
- QList<AbstractInterface *> getInterfaces(int direction = AbstractInterface::AnyDirection, int purpose = AbstractInterface::AnyPurpose);\r
- QList<AbstractInterface *> getDataInputs(); //! return all inputs of type data\r
- QList<AbstractInterface *> getDataOutputs(); //! return all inputs of type data\r
- QList<AbstractInterface *> getControlInputs(); //! return all inputs of type control\r
- QList<AbstractInterface *> getControlOutputs(); //! return all outputs of type control\r
- AbstractInterface* getIfaceFromName(QString name);\r
- BlockParameter* getParameterFromName(QString name);\r
\r
// patterns\r
virtual void checkInputPatternCompatibility() throw(Exception) = 0;\r
inline AbstractInterface* getAssociatedIface() { return associatedIface; }
inline QString getClockIfaceString() { return clkIface; }
inline int getClockIfaceType() { return clkIfaceType; }
- AbstractInterface* getClockIface();
-
+ AbstractInterface* getClockIface();
double getDoubleWidth() throw(QException);
return ref;\r
}\r
\r
+double Parameters::getFeedingClockFrequency(AbstractInterface *iface) {\r
+\r
+ int idClock = 0;\r
+\r
+ if (iface->isReferenceInterface()) return 0.0;\r
+\r
+ if (iface->getClockIfaceType() == AbstractInterface::ParameterName) {\r
+ BlockParameter* param = iface->getOwner()->getParameterFromName(iface->getClockIfaceString());\r
+ if (!param->isUserParameter()) return 0.0;\r
+ bool ok;\r
+ double freq = param->getDoubleValue(&ok);\r
+ if (!ok) {\r
+ cerr << "Abnormal case: cannot retrieve clock id from parameter " << qPrintable(param->getName()) << endl;\r
+ }\r
+ return freq;\r
+ }\r
+ else if ( (iface->getClockIfaceType() == AbstractInterface::ClockName) || ((iface->getDirection() == AbstractInterface::Input) && (iface->getPurpose() == AbstractInterface::Clock))) {\r
+\r
+ // if iface is not clock, retrieve the clock related to it\r
+ if (iface->getClockIfaceType() == AbstractInterface::ClockName) {\r
+ iface = iface->getClockIface();\r
+ }\r
+ // if iface is a group interface, then iface name is ext_clk_X, thus extract the X\r
+ if (iface->isGroupInterface()) {\r
+ QString name = iface->getName();\r
+ name.remove(0,8);\r
+ bool ok;\r
+ idClock = name.toInt(&ok);\r
+ if (!ok) {\r
+ cerr << "Abnormal case: cannot retrieve clock id from iface name " << qPrintable(iface->getName()) << endl;\r
+ return 0.0;\r
+ }\r
+ }\r
+ // if iface is a functional interface, it is connected to clkrstgen_X (in top group) or to ext_clk_X (in subgroup)\r
+ else if (iface->isFunctionalInterface()) {\r
+ FunctionalInterface* funIface = AI_TO_FUN(iface);\r
+ ConnectedInterface* connFrom = funIface->getConnectedFrom();\r
+ if (connFrom == NULL) {\r
+ cerr << "Abnormal case: input clock " << qPrintable(iface->getName()) << " is not connected" << endl;\r
+ return 0.0;\r
+ }\r
+ if (iface->getOwner()->isTopGroupBlock()) {\r
+ QString name = connFrom->getOwner()->getName();\r
+ name.remove(0,10);\r
+ bool ok;\r
+ idClock = name.toInt(&ok);\r
+ if (!ok) {\r
+ cerr << "Abnormal case: cannot retrieve clock id for " << qPrintable(iface->getName()) << endl;\r
+ return 0.0;\r
+ }\r
+ }\r
+ else {\r
+ QString name = connFrom->getName();\r
+ name.remove(0,8);\r
+ bool ok;\r
+ idClock = name.toInt(&ok);\r
+ if (!ok) {\r
+ cerr << "Abnormal case: cannot retrieve clock id for " << qPrintable(iface->getName()) << endl;\r
+ return 0.0;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ return clocks.at(idClock);\r
+}\r
+\r
void Parameters::createDelayBlock() {\r
delayRef = new ReferenceBlock("no.xml");\r
delayRef->addCategory(100);\r
void destroyGraph();\r
inline Graph* getGraph() { return graph; } \r
ReferenceBlock* getReferenceBlock(int idCategory, int idBlock); // get the reference block from its category and index\r
- ReferenceBlock* getHiddenReferenceBlock(QString blockName); // get a hidden block by name, i.e. in category 100\r
- FunctionalBlock* duplicateFunctionalBlock(FunctionalBlock* block); // adding a copy of a functional block to current group\r
-\r
+ ReferenceBlock* getHiddenReferenceBlock(QString blockName); // get a hidden block by name, i.e. in category 100 \r
+ double getFeedingClockFrequency(AbstractInterface* iface); // determine at which freq. is synchronized iface\r
\r
void clear();\r
\r
}\r
\r
void SpecialBlock::checkInputPatternCompatibilityClockConvert() throw(Exception) {\r
+ static QString fctName = "SpecialBlock::checkInputPatternCompatibilityClockConvert()";\r
+#ifdef DEBUG_FCTNAME\r
+ cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+ // just create input pattern\r
+ try {\r
+ createInputPattern();\r
+ }\r
+ catch(Exception e) {\r
+ throw(e);\r
+ }\r
}\r
+\r
void SpecialBlock::computeOutputPatternClockConvert(int nbExec) throw(Exception) {\r
+ static QString fctName = "SpecialBlock::computeOutputPatternClockConvert()";\r
+#ifdef DEBUG_FCTNAME\r
+ cout << "call to " << qPrintable(fctName) << endl;\r
+#endif\r
+ cout << "computing output pattern of " << qPrintable(name) << endl;\r
+\r
+ /* CAUTION: it is assumed that all clock domain converters are using\r
+ * a clk_in and clk_out signals for input and output clocks.\r
+ */\r
+ AbstractInterface* clkIn = getIfaceFromName("clk_in");\r
+ AbstractInterface* clkOut = getIfaceFromName("clk_out");\r
+ cout << "freq clk_in = " << clkIn-\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
+\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
+\r
}\r
\r
\r
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 4.2.0, 2018-05-03T15:15:26. -->
+<!-- Written by QtCreator 4.2.0, 2018-05-03T17:24:00. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
clkdconvert_1024x8_1 : clkdconvert_1024x8
port map (
rst => @{reset},
-wr_clk => @{clk_wr},
-rd_clk => @{clk_rd},
+wr_clk => @{clk_in},
+rd_clk => @{clk_out},
din => @{data_in},
wr_en => @{data_in_enb},
rd_en => rd_en,
rd_en <= not empty;
-read_fifo : process(@{clk_rd}, @{reset})
+read_fifo : process(@{clk_out}, @{reset})
begin
if @{reset} = '1' then
@{data_out_enb} <= '0';
-elsif rising_edge(@{clk_rd}) then
+elsif rising_edge(@{clk_out}) then
@{data_out_enb} <= '0';
if empty = '0' then
@{data_out_enb} <= '1';
</informations>
<parameters>
- <parameter name="imx_clk" type="positive" value="133" context="user"/>
+ <parameter name="imx_clk" type="real" value="133" context="user"/>
</parameters>
<interfaces>
</parameters>
<interfaces>
<inputs>
- <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_rd" purpose="clock"/>
- <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_wr" purpose="clock"/>
+ <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_in" purpose="clock"/>
+ <input width="1" multiplicity="1" endian="little" type="boolean" name="clk_out" purpose="clock"/>
<input width="1" multiplicity="1" endian="little" type="boolean" name="reset" purpose="reset"/>
- <input width="8" multiplicity="1" endian="little" type="natural" name="data_in" purpose="data" clock="clk_rd"/>
+ <input width="8" multiplicity="1" endian="little" type="natural" name="data_in" purpose="data" clock="clk_in"/>
<control iface="data_in"/>
</inputs>
<outputs>
- <output width="8" multiplicity="1" endian="little" type="natural" name="data_out" purpose="data" clock="clk_wr"/>
+ <output width="8" multiplicity="1" endian="little" type="natural" name="data_out" purpose="data" clock="clk_out"/>
<control iface="data_out"/>
</outputs>
</interfaces>