diff --git a/netlist.cc b/netlist.cc index a4b05c413..a96728765 100644 --- a/netlist.cc +++ b/netlist.cc @@ -715,10 +715,8 @@ bool NetNet::get_signed() const bool NetNet::get_scalar() const { - if (const netvector_t*vec = dynamic_cast (net_type_)) - return vec->get_scalar(); - else - return false; + ivl_assert(*this, net_type_); + return net_type_->get_scalar(); } const netenum_t*NetNet::enumeration(void) const diff --git a/nettypes.cc b/nettypes.cc index 23360fcee..d669bd9fe 100644 --- a/nettypes.cc +++ b/nettypes.cc @@ -56,6 +56,11 @@ bool ivl_type_s::get_signed() const return false; } +bool ivl_type_s::get_scalar() const +{ + return false; +} + bool ivl_type_s::type_compatible(ivl_type_t that) const { if (this == that) diff --git a/nettypes.h b/nettypes.h index 48ce48fd2..0c26678dc 100644 --- a/nettypes.h +++ b/nettypes.h @@ -45,6 +45,7 @@ class ivl_type_s { // those specific types. virtual ivl_variable_type_t base_type() const; virtual bool get_signed() const; + virtual bool get_scalar() const; // Return true if "that" type is compatible with this // type. Compatible means the types are essentially the same.