mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Internals: Cleanup constructors etc. No functional change.
This commit is contained in:
+40
-40
@@ -66,10 +66,10 @@ private:
|
||||
// VISITORS
|
||||
virtual void visit(AstNetlist* nodep) override {
|
||||
m_vfilep
|
||||
= new AstVFile(nodep->fileline(), v3Global.opt.makeDir() + "/" + m_libName + ".sv");
|
||||
= new AstVFile{nodep->fileline(), v3Global.opt.makeDir() + "/" + m_libName + ".sv"};
|
||||
nodep->addFilesp(m_vfilep);
|
||||
m_cfilep
|
||||
= new AstCFile(nodep->fileline(), v3Global.opt.makeDir() + "/" + m_libName + ".cpp");
|
||||
= new AstCFile{nodep->fileline(), v3Global.opt.makeDir() + "/" + m_libName + ".cpp"};
|
||||
nodep->addFilesp(m_cfilep);
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
@@ -95,7 +95,7 @@ private:
|
||||
}
|
||||
|
||||
void addComment(AstTextBlock* txtp, FileLine* fl, const string& comment) {
|
||||
txtp->addNodep(new AstComment(fl, comment));
|
||||
txtp->addNodep(new AstComment{fl, comment});
|
||||
}
|
||||
|
||||
void hashComment(AstTextBlock* txtp, FileLine* fl) {
|
||||
@@ -132,7 +132,7 @@ private:
|
||||
|
||||
void createSvFile(FileLine* fl, AstNodeModule* modp) {
|
||||
// Comments
|
||||
AstTextBlock* const txtp = new AstTextBlock(fl);
|
||||
AstTextBlock* const txtp = new AstTextBlock{fl};
|
||||
addComment(txtp, fl, "Wrapper module for DPI protected library");
|
||||
addComment(txtp, fl,
|
||||
"This module requires lib" + m_libName + ".a or lib" + m_libName
|
||||
@@ -142,7 +142,7 @@ private:
|
||||
" to use DPI libraries\n");
|
||||
|
||||
// Module declaration
|
||||
m_modPortsp = new AstTextBlock(fl, "module " + m_libName + " (\n", false, true);
|
||||
m_modPortsp = new AstTextBlock{fl, "module " + m_libName + " (\n", false, true};
|
||||
txtp->addNodep(m_modPortsp);
|
||||
txtp->addText(fl, ");\n\n");
|
||||
|
||||
@@ -170,31 +170,31 @@ private:
|
||||
txtp->addText(fl, "import \"DPI-C\" function chandle " + m_libName
|
||||
+ "_protectlib_create(string scope__V);\n\n");
|
||||
comboComment(txtp, fl);
|
||||
m_comboPortsp = new AstTextBlock(fl,
|
||||
m_comboPortsp = new AstTextBlock{fl,
|
||||
"import \"DPI-C\" function longint " + m_libName
|
||||
+ "_protectlib_combo_update "
|
||||
"(\n",
|
||||
false, true);
|
||||
false, true};
|
||||
m_comboPortsp->addText(fl, "chandle handle__V\n");
|
||||
txtp->addNodep(m_comboPortsp);
|
||||
txtp->addText(fl, ");\n\n");
|
||||
seqComment(txtp, fl);
|
||||
if (m_hasClk) {
|
||||
m_seqPortsp = new AstTextBlock(fl,
|
||||
m_seqPortsp = new AstTextBlock{fl,
|
||||
"import \"DPI-C\" function longint " + m_libName
|
||||
+ "_protectlib_seq_update"
|
||||
"(\n",
|
||||
false, true);
|
||||
false, true};
|
||||
m_seqPortsp->addText(fl, "chandle handle__V\n");
|
||||
txtp->addNodep(m_seqPortsp);
|
||||
txtp->addText(fl, ");\n\n");
|
||||
}
|
||||
comboIgnoreComment(txtp, fl);
|
||||
m_comboIgnorePortsp = new AstTextBlock(fl,
|
||||
m_comboIgnorePortsp = new AstTextBlock{fl,
|
||||
"import \"DPI-C\" function void " + m_libName
|
||||
+ "_protectlib_combo_ignore"
|
||||
"(\n",
|
||||
false, true);
|
||||
false, true};
|
||||
m_comboIgnorePortsp->addText(fl, "chandle handle__V\n");
|
||||
txtp->addNodep(m_comboIgnorePortsp);
|
||||
txtp->addText(fl, ");\n\n");
|
||||
@@ -225,17 +225,17 @@ private:
|
||||
if (m_hasClk) txtp->addText(fl, "time last_seq_seqnum__V;\n");
|
||||
txtp->addText(fl, "\n");
|
||||
|
||||
m_comboDeclsp = new AstTextBlock(fl);
|
||||
m_comboDeclsp = new AstTextBlock{fl};
|
||||
txtp->addNodep(m_comboDeclsp);
|
||||
m_seqDeclsp = new AstTextBlock(fl);
|
||||
m_seqDeclsp = new AstTextBlock{fl};
|
||||
txtp->addNodep(m_seqDeclsp);
|
||||
m_tmpDeclsp = new AstTextBlock(fl);
|
||||
m_tmpDeclsp = new AstTextBlock{fl};
|
||||
txtp->addNodep(m_tmpDeclsp);
|
||||
|
||||
// CPP hash value
|
||||
addComment(txtp, fl, "Hash value to make sure this file and the corresponding");
|
||||
addComment(txtp, fl, "library agree");
|
||||
m_hashValuep = new AstTextBlock(fl, "localparam int protectlib_hash__V = 32'd");
|
||||
m_hashValuep = new AstTextBlock{fl, "localparam int protectlib_hash__V = 32'd"};
|
||||
txtp->addNodep(m_hashValuep);
|
||||
txtp->addText(fl, "\n");
|
||||
|
||||
@@ -249,11 +249,11 @@ private:
|
||||
|
||||
// Combinatorial process
|
||||
addComment(txtp, fl, "Combinatorialy evaluate changes to inputs");
|
||||
m_comboParamsp = new AstTextBlock(fl,
|
||||
m_comboParamsp = new AstTextBlock{fl,
|
||||
"always @(*) begin\n"
|
||||
"last_combo_seqnum__V = "
|
||||
+ m_libName + "_protectlib_combo_update(\n",
|
||||
false, true);
|
||||
false, true};
|
||||
m_comboParamsp->addText(fl, "handle__V\n");
|
||||
txtp->addNodep(m_comboParamsp);
|
||||
txtp->addText(fl, ");\n");
|
||||
@@ -262,21 +262,21 @@ private:
|
||||
// Sequential process
|
||||
if (m_hasClk) {
|
||||
addComment(txtp, fl, "Evaluate clock edges");
|
||||
m_clkSensp = new AstTextBlock(fl, "always @(", false, true);
|
||||
m_clkSensp = new AstTextBlock{fl, "always @(", false, true};
|
||||
txtp->addNodep(m_clkSensp);
|
||||
txtp->addText(fl, ") begin\n");
|
||||
m_comboIgnoreParamsp
|
||||
= new AstTextBlock(fl, m_libName + "_protectlib_combo_ignore(\n", false, true);
|
||||
= new AstTextBlock{fl, m_libName + "_protectlib_combo_ignore(\n", false, true};
|
||||
m_comboIgnoreParamsp->addText(fl, "handle__V\n");
|
||||
txtp->addNodep(m_comboIgnoreParamsp);
|
||||
txtp->addText(fl, ");\n");
|
||||
m_seqParamsp = new AstTextBlock(
|
||||
m_seqParamsp = new AstTextBlock{
|
||||
fl, "last_seq_seqnum__V <= " + m_libName + "_protectlib_seq_update(\n", false,
|
||||
true);
|
||||
true};
|
||||
m_seqParamsp->addText(fl, "handle__V\n");
|
||||
txtp->addNodep(m_seqParamsp);
|
||||
txtp->addText(fl, ");\n");
|
||||
m_nbAssignsp = new AstTextBlock(fl);
|
||||
m_nbAssignsp = new AstTextBlock{fl};
|
||||
txtp->addNodep(m_nbAssignsp);
|
||||
txtp->addText(fl, "end\n\n");
|
||||
}
|
||||
@@ -285,14 +285,14 @@ private:
|
||||
addComment(txtp, fl, "Select between combinatorial and sequential results");
|
||||
txtp->addText(fl, "always @(*) begin\n");
|
||||
if (m_hasClk) {
|
||||
m_seqAssignsp = new AstTextBlock(fl, "if (last_seq_seqnum__V > "
|
||||
"last_combo_seqnum__V) begin\n");
|
||||
m_seqAssignsp = new AstTextBlock{fl, "if (last_seq_seqnum__V > "
|
||||
"last_combo_seqnum__V) begin\n"};
|
||||
txtp->addNodep(m_seqAssignsp);
|
||||
m_comboAssignsp = new AstTextBlock(fl, "end\nelse begin\n");
|
||||
m_comboAssignsp = new AstTextBlock{fl, "end\nelse begin\n"};
|
||||
txtp->addNodep(m_comboAssignsp);
|
||||
txtp->addText(fl, "end\n");
|
||||
} else {
|
||||
m_comboAssignsp = new AstTextBlock(fl, "");
|
||||
m_comboAssignsp = new AstTextBlock{fl, ""};
|
||||
txtp->addNodep(m_comboAssignsp);
|
||||
}
|
||||
txtp->addText(fl, "end\n\n");
|
||||
@@ -313,7 +313,7 @@ private:
|
||||
|
||||
void createCppFile(FileLine* fl) {
|
||||
// Comments
|
||||
AstTextBlock* const txtp = new AstTextBlock(fl);
|
||||
AstTextBlock* const txtp = new AstTextBlock{fl};
|
||||
addComment(txtp, fl, "Wrapper functions for DPI protected library\n");
|
||||
|
||||
// Includes
|
||||
@@ -339,7 +339,7 @@ private:
|
||||
txtp->addText(fl, "void " + m_libName
|
||||
+ "_protectlib_check_hash"
|
||||
"(int protectlib_hash__V) {\n");
|
||||
m_cHashValuep = new AstTextBlock(fl, "const int expected_hash__V = ");
|
||||
m_cHashValuep = new AstTextBlock{fl, "const int expected_hash__V = "};
|
||||
txtp->addNodep(m_cHashValuep);
|
||||
txtp->addText(fl, /**/ "if (protectlib_hash__V != expected_hash__V) {\n");
|
||||
txtp->addText(fl, /****/ "fprintf(stderr, \"%%Error: cannot use " + m_libName
|
||||
@@ -360,38 +360,38 @@ private:
|
||||
|
||||
// Updates
|
||||
comboComment(txtp, fl);
|
||||
m_cComboParamsp = new AstTextBlock(
|
||||
fl, "long long " + m_libName + "_protectlib_combo_update(\n", false, true);
|
||||
m_cComboParamsp = new AstTextBlock{
|
||||
fl, "long long " + m_libName + "_protectlib_combo_update(\n", false, true};
|
||||
m_cComboParamsp->addText(fl, "void* vhandlep__V\n");
|
||||
txtp->addNodep(m_cComboParamsp);
|
||||
txtp->addText(fl, ")\n");
|
||||
m_cComboInsp = new AstTextBlock(fl, "{\n");
|
||||
m_cComboInsp = new AstTextBlock{fl, "{\n"};
|
||||
castPtr(fl, m_cComboInsp);
|
||||
txtp->addNodep(m_cComboInsp);
|
||||
m_cComboOutsp = new AstTextBlock(fl, "handlep__V->eval();\n");
|
||||
m_cComboOutsp = new AstTextBlock{fl, "handlep__V->eval();\n"};
|
||||
txtp->addNodep(m_cComboOutsp);
|
||||
txtp->addText(fl, "return handlep__V->m_seqnum++;\n");
|
||||
txtp->addText(fl, "}\n\n");
|
||||
|
||||
if (m_hasClk) {
|
||||
seqComment(txtp, fl);
|
||||
m_cSeqParamsp = new AstTextBlock(
|
||||
fl, "long long " + m_libName + "_protectlib_seq_update(\n", false, true);
|
||||
m_cSeqParamsp = new AstTextBlock{
|
||||
fl, "long long " + m_libName + "_protectlib_seq_update(\n", false, true};
|
||||
m_cSeqParamsp->addText(fl, "void* vhandlep__V\n");
|
||||
txtp->addNodep(m_cSeqParamsp);
|
||||
txtp->addText(fl, ")\n");
|
||||
m_cSeqClksp = new AstTextBlock(fl, "{\n");
|
||||
m_cSeqClksp = new AstTextBlock{fl, "{\n"};
|
||||
castPtr(fl, m_cSeqClksp);
|
||||
txtp->addNodep(m_cSeqClksp);
|
||||
m_cSeqOutsp = new AstTextBlock(fl, "handlep__V->eval();\n");
|
||||
m_cSeqOutsp = new AstTextBlock{fl, "handlep__V->eval();\n"};
|
||||
txtp->addNodep(m_cSeqOutsp);
|
||||
txtp->addText(fl, "return handlep__V->m_seqnum++;\n");
|
||||
txtp->addText(fl, "}\n\n");
|
||||
}
|
||||
|
||||
comboIgnoreComment(txtp, fl);
|
||||
m_cIgnoreParamsp = new AstTextBlock(
|
||||
fl, "void " + m_libName + "_protectlib_combo_ignore(\n", false, true);
|
||||
m_cIgnoreParamsp = new AstTextBlock{
|
||||
fl, "void " + m_libName + "_protectlib_combo_ignore(\n", false, true};
|
||||
m_cIgnoreParamsp->addText(fl, "void* vhandlep__V\n");
|
||||
txtp->addNodep(m_cIgnoreParamsp);
|
||||
txtp->addText(fl, ")\n");
|
||||
@@ -472,7 +472,7 @@ private:
|
||||
|
||||
static void addLocalVariable(AstTextBlock* textp, AstVar* varp, const char* suffix) {
|
||||
AstVar* const newVarp
|
||||
= new AstVar(varp->fileline(), VVarType::VAR, varp->name() + suffix, varp->dtypep());
|
||||
= new AstVar{varp->fileline(), VVarType::VAR, varp->name() + suffix, varp->dtypep()};
|
||||
textp->addNodep(newVarp);
|
||||
}
|
||||
|
||||
@@ -532,5 +532,5 @@ public:
|
||||
|
||||
void V3ProtectLib::protect() {
|
||||
UINFO(2, __FUNCTION__ << ": " << endl);
|
||||
ProtectVisitor(v3Global.rootp());
|
||||
ProtectVisitor{v3Global.rootp()};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user