Allow connecting module instance using implicit named port connections.
This is part of the 1800-2009 standard (Section 23.3.2.3) and allows ports of module instances to be declared like: modname instance(.foo, .bar); instead of modname instead(.foo(foo), .bar(bar)); The only tricky part about this is the implicit port connection shall not create an implicit net declaration. To make this happen, the path of least resistance was to add a bool to PEIdent indicating that it should not implicitely create a net. This does not rely on the generation flag to be 2009, following the trend that new port naming convention (like ANSI style ports) work regardless of the generation.
This commit is contained in:
parent
12ddc34277
commit
be67199177
15
PExpr.cc
15
PExpr.cc
|
|
@ -258,11 +258,12 @@ const verireal& PEFNumber::value() const
|
|||
}
|
||||
|
||||
PEIdent::PEIdent(const pform_name_t&that)
|
||||
: path_(that)
|
||||
: path_(that), no_implicit_sig_(false)
|
||||
{
|
||||
}
|
||||
|
||||
PEIdent::PEIdent(perm_string s)
|
||||
PEIdent::PEIdent(perm_string s, bool no_implicit_sig)
|
||||
: no_implicit_sig_(no_implicit_sig)
|
||||
{
|
||||
path_.push_back(name_component_t(s));
|
||||
}
|
||||
|
|
@ -273,9 +274,13 @@ PEIdent::~PEIdent()
|
|||
|
||||
void PEIdent::declare_implicit_nets(LexicalScope*scope, NetNet::Type type)
|
||||
{
|
||||
/* We create an implicit wire if this is a simple identifier and
|
||||
if an identifier of that name has not already been declared in
|
||||
any enclosing scope. */
|
||||
/* We create an implicit wire if:
|
||||
- this is a simple identifier
|
||||
- an identifier of that name has not already been declared in
|
||||
any enclosing scope.
|
||||
- this is not an implicit named port connection */
|
||||
if (no_implicit_sig_)
|
||||
return;
|
||||
if ((path_.size() == 1) && (path_.front().index.size() == 0)) {
|
||||
perm_string name = path_.front().name;
|
||||
LexicalScope*ss = scope;
|
||||
|
|
|
|||
3
PExpr.h
3
PExpr.h
|
|
@ -255,7 +255,7 @@ class PEFNumber : public PExpr {
|
|||
class PEIdent : public PExpr {
|
||||
|
||||
public:
|
||||
explicit PEIdent(perm_string);
|
||||
explicit PEIdent(perm_string, bool no_implicit_sig=false);
|
||||
explicit PEIdent(const pform_name_t&);
|
||||
~PEIdent();
|
||||
|
||||
|
|
@ -298,6 +298,7 @@ class PEIdent : public PExpr {
|
|||
|
||||
private:
|
||||
pform_name_t path_;
|
||||
bool no_implicit_sig_;
|
||||
|
||||
private:
|
||||
// Common functions to calculate parts of part/bit
|
||||
|
|
|
|||
Loading…
Reference in New Issue