Fix -G dropping public indication (#2561).

This commit is contained in:
Wilson Snyder 2020-09-21 08:29:39 -04:00
parent 157948c552
commit 7a9e79ea79
5 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,8 @@ The contributors that suggested a given feature are shown in []. Thanks!
**** Support # as a comment in -f files (#2497). [phantom-killua]
**** Fix -G dropping public indication (#2561). [Andrew Goessling]
* Verilator 4.100 2020-09-07

View File

@ -1128,6 +1128,7 @@ class LinkDotFindVisitor : public AstNVisitor {
AstVar* newp
= new AstVar(nodep->fileline(), AstVarType(AstVarType::GPARAM),
nodep->name(), nodep);
newp->combineType(nodep);
string svalue = v3Global.opt.parameter(nodep->name());
if (AstNode* valuep
= AstConst::parseParamLiteral(nodep->fileline(), svalue)) {

View File

@ -10,6 +10,7 @@
#include "Vt_param_public.h"
#include "Vt_param_public_p.h"
#include "Vt_param_public_t.h"
int main(int argc, char* argv[]) {
Vt_param_public* topp = new Vt_param_public;
@ -17,6 +18,9 @@ int main(int argc, char* argv[]) {
Verilated::debug(0);
// Make sure public tag worked
if (static_cast<int>(Vt_param_public_t::TOP_PARAM) != 30) {
vl_fatal(__FILE__, __LINE__, "dut", "bad value");
}
if (static_cast<int>(Vt_param_public_p::INPACK) != 0) {}
for (int i = 0; i < 10; i++) {

View File

@ -12,7 +12,7 @@ scenarios(simulator => 1);
if ($Self->{vlt_all}) {
compile(
verilator_flags2 => ["--exe $Self->{t_dir}/$Self->{name}.cpp"],
verilator_flags2 => ["-GTOP_PARAM=30 --exe $Self->{t_dir}/$Self->{name}.cpp"],
make_top_shell => 0,
make_main => 0,
);

View File

@ -12,6 +12,8 @@ module t (/*AUTOARG*/
);
input clk;
parameter TOP_PARAM /*verilator public*/ = 20;
a #(1) a1 ();
b #(2) b2 ();