Activate wildcard imports for implicit named port connections
The LRM section 23.3.2.4 says that an implicit `.name` port connection is a reference that can make a name from a preceding wildcard package import visible. Currently `.name` creates its `PEIdent` directly and skips the package import reference bookkeeping, so the imported name can not be resolved. Allow `pform_new_ident()` to suppress implicit net creation and use it for `.name`. This keeps import activation, `PEIdent` construction, and source location handling in one place while preserving the existing behavior that prevents `.name` from creating an implicit net. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
c5dbdddf7b
commit
19772cfe07
5
PExpr.cc
5
PExpr.cc
|
|
@ -406,8 +406,9 @@ const verireal& PEFNumber::value() const
|
||||||
return *value_;
|
return *value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
PEIdent::PEIdent(const pform_name_t&that, unsigned lexical_pos)
|
PEIdent::PEIdent(const pform_name_t&that, unsigned lexical_pos,
|
||||||
: path_(that), no_implicit_sig_(false)
|
bool no_implicit_sig)
|
||||||
|
: path_(that), no_implicit_sig_(no_implicit_sig)
|
||||||
{
|
{
|
||||||
LineInfo::lexical_pos(lexical_pos);
|
LineInfo::lexical_pos(lexical_pos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
3
PExpr.h
3
PExpr.h
|
|
@ -346,7 +346,8 @@ class PEIdent : public PExpr {
|
||||||
public:
|
public:
|
||||||
explicit PEIdent(perm_string, unsigned lexical_pos, bool no_implicit_sig=false);
|
explicit PEIdent(perm_string, unsigned lexical_pos, bool no_implicit_sig=false);
|
||||||
explicit PEIdent(PPackage*pkg, const pform_name_t&name);
|
explicit PEIdent(PPackage*pkg, const pform_name_t&name);
|
||||||
explicit PEIdent(const pform_name_t&, unsigned lexical_pos);
|
explicit PEIdent(const pform_name_t&, unsigned lexical_pos,
|
||||||
|
bool no_implicit_sig = false);
|
||||||
~PEIdent() override;
|
~PEIdent() override;
|
||||||
|
|
||||||
// Add another name to the string of hierarchy that is the
|
// Add another name to the string of hierarchy that is the
|
||||||
|
|
|
||||||
7
parse.y
7
parse.y
|
|
@ -6460,9 +6460,10 @@ port_name
|
||||||
{ pform_requires_sv(@3, "Implicit named port connections");
|
{ pform_requires_sv(@3, "Implicit named port connections");
|
||||||
named_pexpr_t*tmp = new named_pexpr_t;
|
named_pexpr_t*tmp = new named_pexpr_t;
|
||||||
FILE_NAME(tmp, @$);
|
FILE_NAME(tmp, @$);
|
||||||
tmp->name = lex_strings.make($3);
|
auto name = lex_strings.make($3);
|
||||||
tmp->parm = new PEIdent(lex_strings.make($3), @3.lexical_pos, true);
|
pform_name_t path = { name_component_t(name) };
|
||||||
FILE_NAME(tmp->parm, @3);
|
tmp->name = name;
|
||||||
|
tmp->parm = pform_new_ident(@3, path, true);
|
||||||
delete[]$3;
|
delete[]$3;
|
||||||
delete $1;
|
delete $1;
|
||||||
$$ = tmp;
|
$$ = tmp;
|
||||||
|
|
|
||||||
5
pform.cc
5
pform.cc
|
|
@ -737,12 +737,13 @@ PBlock* pform_push_block_scope(const struct vlltype&loc, const char*name,
|
||||||
/*
|
/*
|
||||||
* Create a new identifier.
|
* Create a new identifier.
|
||||||
*/
|
*/
|
||||||
PEIdent* pform_new_ident(const struct vlltype&loc, const pform_name_t&name)
|
PEIdent *pform_new_ident(const struct vlltype&loc, const pform_name_t&name,
|
||||||
|
bool no_implicit_sig)
|
||||||
{
|
{
|
||||||
if (gn_system_verilog())
|
if (gn_system_verilog())
|
||||||
check_potential_imports(loc, name.front().name, false);
|
check_potential_imports(loc, name.front().name, false);
|
||||||
|
|
||||||
auto tmp = new PEIdent(name, loc.lexical_pos);
|
auto tmp = new PEIdent(name, loc.lexical_pos, no_implicit_sig);
|
||||||
FILE_NAME(tmp, loc);
|
FILE_NAME(tmp, loc);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
pform.h
4
pform.h
|
|
@ -236,7 +236,9 @@ extern void pform_add_modport_port(const struct vlltype&loc,
|
||||||
* This creates an identifier aware of names that may have been
|
* This creates an identifier aware of names that may have been
|
||||||
* imported from other packages.
|
* imported from other packages.
|
||||||
*/
|
*/
|
||||||
extern PEIdent* pform_new_ident(const struct vlltype&loc, const pform_name_t&name);
|
extern PEIdent *pform_new_ident(const struct vlltype&loc,
|
||||||
|
const pform_name_t&name,
|
||||||
|
bool no_implicit_sig = false);
|
||||||
|
|
||||||
extern PTrigger* pform_new_trigger(const struct vlltype&loc, PPackage*pkg,
|
extern PTrigger* pform_new_trigger(const struct vlltype&loc, PPackage*pkg,
|
||||||
const pform_name_t&name);
|
const pform_name_t&name);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue