forked from github/verilator
Tighten signatures/implementaion of VerilatedModel abstract methods.
This commit is contained in:
parent
b61d819fcb
commit
79c901c220
@ -273,11 +273,11 @@ public:
|
||||
/// Used to get to e.g. simulation time via contextp()->time()
|
||||
inline VerilatedContext* contextp() const { return &m_context; }
|
||||
/// Returns the hierarchical name of this module instance.
|
||||
virtual const char* hierName() = 0;
|
||||
virtual const char* hierName() const = 0;
|
||||
/// Returns the name of this model (the name of the generated model class).
|
||||
virtual const char* modelName() = 0;
|
||||
virtual const char* modelName() const = 0;
|
||||
/// Returns the thread level parallelism, this model was Verilated with. Always 1 or higher.
|
||||
virtual unsigned threads() = 0;
|
||||
virtual unsigned threads() const = 0;
|
||||
};
|
||||
|
||||
//=========================================================================
|
||||
|
@ -220,9 +220,9 @@ class EmitCModel final : public EmitCFunc {
|
||||
}
|
||||
|
||||
puts("\n// Abstract methods from VerilatedModel\n");
|
||||
puts("const char* hierName() override;\n");
|
||||
puts("const char* modelName() override;\n");
|
||||
puts("unsigned threads() override;\n");
|
||||
puts("const char* hierName() const override final;\n");
|
||||
puts("const char* modelName() const override final;\n");
|
||||
puts("unsigned threads() const override final;\n");
|
||||
|
||||
puts("} VL_ATTR_ALIGNED(VL_CACHE_LINE_BYTES);\n");
|
||||
|
||||
@ -482,10 +482,10 @@ class EmitCModel final : public EmitCFunc {
|
||||
puts("}\n");
|
||||
|
||||
putSectionDelimiter("Implementations of abstract methods from VerilatedModel\n");
|
||||
puts("const char* " + topClassName() + "::hierName() { return vlSymsp->name(); }\n");
|
||||
puts("const char* " + topClassName() + "::modelName() { return \"" + topClassName()
|
||||
puts("const char* " + topClassName() + "::hierName() const { return vlSymsp->name(); }\n");
|
||||
puts("const char* " + topClassName() + "::modelName() const { return \"" + topClassName()
|
||||
+ "\"; }\n");
|
||||
puts("unsigned " + topClassName() + "::threads() { return "
|
||||
puts("unsigned " + topClassName() + "::threads() const { return "
|
||||
+ cvtToStr(std::max(1, v3Global.opt.threads())) + "; }\n");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user