Introduce optional netlisting to console

-Replaced Component::getExpression(bool isXyce, bool isCdl) with
 Component::getExpression(spicecompat::SpiceDialect dialect)

Signed-off-by: ThomasZecha <zecha@ihp-microelectronics.com>
This commit is contained in:
ThomasZecha 2025-01-19 15:18:24 +01:00
parent b79d94ef2a
commit 63d6d07000
22 changed files with 36 additions and 36 deletions

View File

@ -828,7 +828,7 @@ QString Component::getVerilogACode() {
}
}
QString Component::getExpression(bool, bool) {
QString Component::getExpression(spicecompat::SpiceDialect) {
return QString();
}

View File

@ -44,7 +44,7 @@ public:
QString getNetlist();
QString getSpiceNetlist(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
QString getVerilogACode();
virtual QString getExpression(bool isXyce = false, bool isCdl = false);
virtual QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
virtual QString getEquations(QString sim, QStringList &dep_vars);
virtual QStringList getExtraVariables();
virtual QString getProbeVariable(bool isXyce = false);

View File

@ -119,14 +119,11 @@ QString Equation::getVAExpressions()
/*!
* \brief Equation::getExpression Extract equations that don't contain simulation variables
* (voltages/cureents) in .PARAM section of spice netlist
* \param isXyce True if Xyce is used.
* \param isCdl True if CDL is used.
* \param dialect Which spice-dialect is used.
* \return .PARAM section of spice netlist as a single string.
*/
QString Equation::getExpression(bool isXyce, bool isCdl /* = false */)
QString Equation::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
Q_UNUSED(isCdl);
if (isActive != COMP_IS_ACTIVE) return QString();
QStringList ng_vars,ngsims;
@ -145,9 +142,9 @@ QString Equation::getExpression(bool isXyce, bool isCdl /* = false */)
QStringList tokens;
QString eqn = Props.at(i)->Value;
spicecompat::splitEqn(eqn,tokens);
spicecompat::convert_functions(tokens,isXyce);
spicecompat::convert_functions(tokens, dialect == spicecompat::SPICEXyce);
eqn = tokens.join("");
if (isXyce) {
if (dialect == spicecompat::SPICEXyce) {
eqn.replace("^","**");
if (!(fp_pattern.match(eqn).hasMatch()||

View File

@ -28,7 +28,7 @@ public:
~Equation();
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
QString getEquations(QString sim, QStringList &dep_vars);
QString getVAvariables();
QString getVAExpressions();

View File

@ -27,7 +27,7 @@ public:
~iProbe();
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
QString getExpression(bool, bool) { return "";}
QString getExpression(spicecompat::SpiceDialect) { return "";}
QString getProbeVariable(bool isXyce = false);
protected:

View File

@ -149,7 +149,7 @@ void CdlNetlistWriter::startNetlist()
{
if (pc->isEquation)
{
s = pc->getExpression(false, true);
s = pc->getExpression(spicecompat::CDL);
a_netlistStream << s;
}
}

View File

@ -77,9 +77,9 @@ Element* InclScript::info(QString& Name, char* &BitmapFile, bool getNewOne)
return 0;
}
QString InclScript::getExpression(bool, bool isCdl /* = false */)
QString InclScript::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
if (isActive != COMP_IS_ACTIVE || isCdl)
if (isActive != COMP_IS_ACTIVE || dialect == spicecompat::CDL)
return QString();
return Props.at(0)->Value+"\n";
}

View File

@ -27,7 +27,7 @@ public:
~InclScript();
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString vhdlCode(int) { return QString(); }

View File

@ -69,8 +69,10 @@ Element* SpiceCSParam::info(QString& Name, char* &BitmapFile, bool getNewOne)
return 0;
}
QString SpiceCSParam::getExpression(bool)
QString SpiceCSParam::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
Q_UNUSED(dialect);
if (isActive != COMP_IS_ACTIVE) return QString();
QString s;

View File

@ -29,7 +29,7 @@ public:
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
static void splitEqn(QString &eqn, QStringList &tokens);
QString getExpression(bool isXyce = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString netlist() { return QString(); }

View File

@ -70,9 +70,9 @@ Element* SpiceFunc::info(QString& Name, char* &BitmapFile, bool getNewOne)
return 0;
}
QString SpiceFunc::getExpression(bool, bool isCdl /* = false */)
QString SpiceFunc::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
if (isActive != COMP_IS_ACTIVE || isCdl) return QString();
if (isActive != COMP_IS_ACTIVE || dialect == spicecompat::CDL) return QString();
QString s;
s.clear();

View File

@ -28,7 +28,7 @@ public:
~SpiceFunc();
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString vhdlCode(int) { return QString(); }

View File

@ -70,14 +70,15 @@ Element* SpiceGlobalParam::info(QString& Name, char* &BitmapFile, bool getNewOne
}
QString SpiceGlobalParam::getExpression(bool, bool isCdl /* = false */)
QString SpiceGlobalParam::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
if (isActive != COMP_IS_ACTIVE) return QString();
QString s;
s.clear();
for (Property *pp : Props) {
s += QStringLiteral(".%1PARAM %2 = %3\n").arg(isCdl ? "" : "GLOBAL_").arg(pp->Name).arg(pp->Value);
s += QStringLiteral(".%1PARAM %2 = %3\n")
.arg(dialect == spicecompat::CDL ? "" : "GLOBAL_").arg(pp->Name).arg(pp->Value);
}
return s;
}

View File

@ -29,7 +29,7 @@ public:
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
static void splitEqn(QString &eqn, QStringList &tokens);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString vhdlCode(int) { return QString(); }

View File

@ -69,9 +69,9 @@ Element* SpiceIC::info(QString& Name, char* &BitmapFile, bool getNewOne)
return 0;
}
QString SpiceIC::getExpression(bool, bool isCdl /* = false */)
QString SpiceIC::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
if (isActive != COMP_IS_ACTIVE || isCdl) return QString();
if (isActive != COMP_IS_ACTIVE || dialect == spicecompat::CDL) return QString();
QString s;
s.clear();

View File

@ -28,7 +28,7 @@ public:
~SpiceIC();
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString vhdlCode(int) { return QString(); }

View File

@ -69,9 +69,9 @@ Element* SpiceNodeset::info(QString& Name, char* &BitmapFile, bool getNewOne)
return 0;
}
QString SpiceNodeset::getExpression(bool, bool isCdl /* = false */)
QString SpiceNodeset::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
if (isActive != COMP_IS_ACTIVE || isCdl) return QString();
if (isActive != COMP_IS_ACTIVE || dialect == spicecompat::CDL) return QString();
QString s;
s.clear();

View File

@ -28,7 +28,7 @@ public:
~SpiceNodeset();
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString vhdlCode(int) { return QString(); }

View File

@ -71,13 +71,13 @@ Element* SpiceOptions::info(QString& Name, char* &BitmapFile, bool getNewOne)
return 0;
}
QString SpiceOptions::getExpression(bool isXyce, bool isCdl /* = false */)
QString SpiceOptions::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
if (isActive != COMP_IS_ACTIVE || isCdl) return QString();
if (isActive != COMP_IS_ACTIVE || dialect == spicecompat::CDL) return QString();
QString s;
s.clear();
if (isXyce) {
if (dialect == spicecompat::SPICEXyce) {
s += QStringLiteral(".OPTIONS %1 ").arg(Props.at(0)->Value);
for (int i=1;i<Props.count();i++) {
s += QStringLiteral(" %1 = %2 ").arg(Props.at(i)->Name).arg(Props.at(i)->Value);

View File

@ -29,7 +29,7 @@ public:
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
static void splitEqn(QString &eqn, QStringList &tokens);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString vhdlCode(int) { return QString(); }

View File

@ -69,14 +69,14 @@ Element* SpiceParam::info(QString& Name, char* &BitmapFile, bool getNewOne)
return 0;
}
QString SpiceParam::getExpression(bool, bool isCdl /* = false */)
QString SpiceParam::getExpression(spicecompat::SpiceDialect dialect /* = spicecompat::SPICEDefault */)
{
if (isActive != COMP_IS_ACTIVE) return QString();
QString s;
s.clear();
for (Property *pp : Props) {
if (isCdl)
if (dialect == spicecompat::CDL)
{
s += QStringLiteral(".PARAM %1=%2\n").arg(pp->Name).arg(pp->Value);
}

View File

@ -29,7 +29,7 @@ public:
Component* newOne();
static Element* info(QString&, char* &, bool getNewOne=false);
static void splitEqn(QString &eqn, QStringList &tokens);
QString getExpression(bool isXyce, bool isCdl = false);
QString getExpression(spicecompat::SpiceDialect dialect = spicecompat::SPICEDefault);
protected:
QString vhdlCode(int) { return QString(); }