Internals: Minor cleanups preparing for initialization fixes.
This commit is contained in:
parent
14a94b6de9
commit
c21498293e
|
|
@ -404,6 +404,7 @@ class TaskVisitor final : public VNVisitor {
|
|||
bool m_inSensesp = false; // Are we under a senitem?
|
||||
bool m_inNew = false; // Are we under a constructor?
|
||||
int m_modNCalls = 0; // Incrementing func # for making symbols
|
||||
int m_unconVarNum = 0; // Unique bad connection variable
|
||||
|
||||
// STATE - across all visitors
|
||||
DpiCFuncs m_dpiNames; // Map of all created DPI functions
|
||||
|
|
@ -520,7 +521,7 @@ class TaskVisitor final : public VNVisitor {
|
|||
|
||||
void connectPort(AstVar* portp, AstArg* argp, const string& namePrefix, AstNode* beginp,
|
||||
bool inlineTask) {
|
||||
AstNodeExpr* const pinp = argp->exprp();
|
||||
AstNodeExpr* pinp = argp->exprp();
|
||||
if (inlineTask) {
|
||||
portp->unlinkFrBack();
|
||||
pushDeletep(portp); // Remove it from the clone (not original)
|
||||
|
|
@ -530,15 +531,28 @@ class TaskVisitor final : public VNVisitor {
|
|||
} else {
|
||||
UINFO(9, " Port " << portp);
|
||||
UINFO(9, " pin " << pinp);
|
||||
if (inlineTask) {
|
||||
pushDeletep(pinp->unlinkFrBack()); // Cloned in assignment below
|
||||
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp); // Args no longer needed
|
||||
}
|
||||
if (portp->isWritable() && VN_IS(pinp, Const)) {
|
||||
pinp->v3error("Function/task " + portp->direction().prettyName() // e.g. "output"
|
||||
+ " connected to constant instead of variable: "
|
||||
+ portp->prettyNameQ());
|
||||
} else if (portp->isRef() || portp->isConstRef()) {
|
||||
// Make temp pin to tie it off
|
||||
AstVar* const varp = new AstVar{pinp->fileline(), VVarType::STMTTEMP,
|
||||
"__VfuncUnconn_" + portp->name() + "__"
|
||||
+ std::to_string(m_unconVarNum++),
|
||||
portp->dtypep()};
|
||||
m_modp->addStmtsp(varp);
|
||||
AstVarScope* const newvscp = new AstVarScope{pinp->fileline(), m_scopep, varp};
|
||||
m_scopep->addVarsp(newvscp);
|
||||
AstVarRef* const repp = new AstVarRef{pinp->fileline(), newvscp, VAccess::WRITE};
|
||||
pinp->replaceWith(repp);
|
||||
pushDeletep(pinp);
|
||||
pinp = repp;
|
||||
}
|
||||
if (inlineTask) {
|
||||
pushDeletep(pinp->unlinkFrBack()); // Cloned in assignment below
|
||||
VL_DO_DANGLING(argp->unlinkFrBack()->deleteTree(), argp); // Args no longer needed
|
||||
}
|
||||
if (portp->isRef() || portp->isConstRef()) {
|
||||
bool refArgOk = false;
|
||||
if (VN_IS(pinp, VarRef) || VN_IS(pinp, MemberSel) || VN_IS(pinp, StructSel)
|
||||
|| VN_IS(pinp, ArraySel)) {
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ module top;
|
|||
|
||||
// Conclude when all counters reach 10
|
||||
begin
|
||||
static bit done = 1'b1;
|
||||
automatic bit done = 1'b1;
|
||||
for (int i = 0; i < N; ++i) begin
|
||||
if (cnt[i] != 10) done = 1'b0;
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,11 +9,8 @@
|
|||
|
||||
import vltest_bootstrap
|
||||
|
||||
test.scenarios('simulator')
|
||||
test.scenarios('vlt')
|
||||
|
||||
test.compile(fails=test.vlt_all, expect_filename=test.golden_filename)
|
||||
|
||||
if not test.vlt_all:
|
||||
test.execute()
|
||||
test.compile(fails=True, expect_filename=test.golden_filename)
|
||||
|
||||
test.passes()
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ module t (
|
|||
endfunction
|
||||
|
||||
initial begin
|
||||
int i_no_has_init = 1; // <--- Warning: want explicit lifetime
|
||||
int i_no_has_init = 1; // <--- Warning: IMPLICIT STATIC
|
||||
automatic int i_automatic_has_init = 1; // Ok
|
||||
static int i_static_has_init = 1; // Ok
|
||||
$finish;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module t;
|
|||
m #(.p(2)) m_i ();
|
||||
|
||||
initial begin
|
||||
static virtual b_if #(2) vif = m_i.b;
|
||||
automatic virtual b_if #(2) vif = m_i.b;
|
||||
automatic int y = m_i.b.x;
|
||||
|
||||
if (vif.x != 2) $stop;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ module t;
|
|||
|
||||
typedef virtual b_if vif_t;
|
||||
initial begin
|
||||
static vif_t vif = t.m_i.if_bind;
|
||||
static int y = t.m_i.if_bind.x;
|
||||
automatic vif_t vif = t.m_i.if_bind;
|
||||
automatic int y = t.m_i.if_bind.x;
|
||||
|
||||
if (vif.x != 1) $stop;
|
||||
if (y != 1) $stop;
|
||||
|
|
|
|||
Loading…
Reference in New Issue