diff --git a/netlist.cc b/netlist.cc index d59be9650..d5c8fc55c 100644 --- a/netlist.cc +++ b/netlist.cc @@ -1876,6 +1876,7 @@ NetConst::NetConst(NetScope*s, perm_string n, verinum::V v) pin(0).set_dir(Link::OUTPUT); value_ = new verinum::V[1]; value_[0] = v; + is_string_ = false; } NetConst::NetConst(NetScope*s, perm_string n, const verinum&val) @@ -1886,6 +1887,7 @@ NetConst::NetConst(NetScope*s, perm_string n, const verinum&val) for (unsigned idx = 0 ; idx < width_ ; idx += 1) { value_[idx] = val.get(idx); } + is_string_ = val.is_string(); } NetConst::~NetConst() @@ -1904,6 +1906,11 @@ unsigned NetConst::width() const return width_; } +bool NetConst::is_string() const +{ + return is_string_; +} + NetFuncDef::NetFuncDef(NetScope*s, NetNet*result, const svector&po) : scope_(s), statement_(0), result_sig_(result), ports_(po) { diff --git a/netlist.h b/netlist.h index 2a9a3e06f..50e376d99 100644 --- a/netlist.h +++ b/netlist.h @@ -1969,6 +1969,7 @@ class NetConst : public NetNode { verinum::V value(unsigned idx) const; unsigned width() const; + bool is_string() const; virtual bool emit_node(struct target_t*) const; virtual void functor_node(Design*, functor_t*); @@ -1977,6 +1978,7 @@ class NetConst : public NetNode { private: unsigned width_; verinum::V*value_; + bool is_string_; }; /* diff --git a/t-dll-api.cc b/t-dll-api.cc index 179a42a62..d86a67a6b 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -170,6 +170,7 @@ extern "C" const char*ivl_const_bits(ivl_net_const_t net) case IVL_VT_BOOL: case IVL_VT_LOGIC: + case IVL_VT_STRING: if (net->width_ <= sizeof(net->b.bit_)) return net->b.bit_; else diff --git a/t-dll.cc b/t-dll.cc index e45c70d20..e50c8fca9 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -2164,7 +2164,10 @@ bool dll_target::net_const(const NetConst*net) struct ivl_net_const_s *obj = new struct ivl_net_const_s; - obj->type = IVL_VT_BOOL; + if (net->is_string()) { + obj->type = IVL_VT_STRING; + assert((net->width() % 8) == 0); + } else obj->type = IVL_VT_BOOL; assert(net->scope()); obj->scope = find_scope(des_, net->scope()); FILE_NAME(obj, net); @@ -2197,11 +2200,13 @@ bool dll_target::net_const(const NetConst*net) if (obj->type == IVL_VT_BOOL) obj->type = IVL_VT_LOGIC; bits[idx] = 'x'; + assert(! net->is_string()); break; case verinum::Vz: if (obj->type == IVL_VT_BOOL) obj->type = IVL_VT_LOGIC; bits[idx] = 'z'; + assert(! net->is_string()); break; } diff --git a/tgt-vvp/draw_net_input.c b/tgt-vvp/draw_net_input.c index 44d6840ae..dc719972b 100644 --- a/tgt-vvp/draw_net_input.c +++ b/tgt-vvp/draw_net_input.c @@ -385,6 +385,7 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr) switch (ivl_const_type(cptr)) { case IVL_VT_LOGIC: case IVL_VT_BOOL: + case IVL_VT_STRING: if ((ivl_nexus_ptr_drive0(nptr) == IVL_DR_STRONG) && (ivl_nexus_ptr_drive1(nptr) == IVL_DR_STRONG)) {