mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Emit timescale in hierarchical block only when timescale is specified (#2735)
* Add a test for hierarchical verilation without timescale * Emit timeunit in hierarchical wrapper only when it is specified in the input design or command line option. * Update src/V3AstNodes.h Co-authored-by: Wilson Snyder <[email protected]> Co-authored-by: Wilson Snyder <[email protected]>
This commit is contained in:
co-authored by
Wilson Snyder
parent
bd602d0e2d
commit
7a18adc716
@@ -135,20 +135,18 @@ private:
|
||||
"See instructions in your simulator for how"
|
||||
" to use DPI libraries\n");
|
||||
|
||||
bool timescaleShown = false;
|
||||
if (v3Global.opt.hierChild() && !modp->timeunit().isNone()) {
|
||||
// Emit timescale for hierarhical verilation
|
||||
timescaleShown = true;
|
||||
txtp->addText(fl, string("`timescale ") + modp->timeunit().ascii() + "/"
|
||||
+ v3Global.rootp()->timeprecision().ascii() + "\n\n");
|
||||
}
|
||||
// Module declaration
|
||||
m_modPortsp = new AstTextBlock(fl, "module " + m_libName + " (\n", false, true);
|
||||
txtp->addNodep(m_modPortsp);
|
||||
txtp->addText(fl, ");\n\n");
|
||||
|
||||
// Timescale
|
||||
if (!timescaleShown) {
|
||||
if (v3Global.opt.hierChild() && v3Global.rootp()->timescaleSpecified()) {
|
||||
// Emit timescale for hierarhical verilation if input HDL specifies timespec
|
||||
txtp->addText(fl, string("timeunit ") + modp->timeunit().ascii() + ";\n");
|
||||
txtp->addText(fl, string("timeprecision ") + +v3Global.rootp()->timeprecision().ascii()
|
||||
+ ";\n");
|
||||
} else {
|
||||
addComment(txtp, fl,
|
||||
"Precision of submodule"
|
||||
" (commented out to avoid requiring timescale on all modules)");
|
||||
|
||||
Reference in New Issue
Block a user