diff --git a/tgt-vvp/eval_object.c b/tgt-vvp/eval_object.c index fef230bd1..64308e5f5 100644 --- a/tgt-vvp/eval_object.c +++ b/tgt-vvp/eval_object.c @@ -58,7 +58,8 @@ static int eval_darray_new(ivl_expr_t ex) int wid = msb>=lsb? msb - lsb : lsb - msb; wid += 1; - fprintf(vvp_out, " %%new/darray %u, \"sb%d\";\n", size_reg, wid); + fprintf(vvp_out, " %%new/darray %u, \"%sb%d\";\n", size_reg, + ivl_type_signed(element_type) ? "s" : "", wid); break; default: diff --git a/vvp/vpi_const.cc b/vvp/vpi_const.cc index da278d245..6cff523cc 100644 --- a/vvp/vpi_const.cc +++ b/vvp/vpi_const.cc @@ -538,7 +538,7 @@ __vpiDecConst::__vpiDecConst(int val) } __vpiDecConst::__vpiDecConst(const __vpiDecConst&that) -: value(that.value) +: __vpiHandle(), value(that.value) { } diff --git a/vvp/vpi_darray.cc b/vvp/vpi_darray.cc index 2f6104f71..5f00b31bd 100644 --- a/vvp/vpi_darray.cc +++ b/vvp/vpi_darray.cc @@ -162,7 +162,8 @@ void __vpiDarrayVar::put_word_value(struct __vpiArrayWord*word, p_vpi_value vp, case vpiIntVal: { vvp_vector4_t vec; - vec.setarray(0, 8 * sizeof(vp->value.integer), (unsigned long*)(&vp->value.integer)); + unsigned long val = vp->value.integer; + vec.setarray(0, 8 * sizeof(vp->value.integer), &val); aobj->set_word(index, vec); } break; diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index 56f5c88d9..df83b2322 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -537,6 +537,7 @@ extern vpiHandle vpip_make_string_var(const char*name, vvp_net_t*net); struct __vpiArrayBase { __vpiArrayBase() : vals_words(NULL) {} + virtual ~__vpiArrayBase() {} virtual unsigned get_size(void) const = 0; virtual vpiHandle get_left_range() = 0; diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 9ea45d8c6..380d4786b 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -1993,8 +1993,8 @@ ostream& operator<< (ostream&out, const vvp_vector4_t&that) template bool vector4_to_value(const vvp_vector4_t&vec, INT&val, bool is_signed, bool is_arithmetic) { - long res = 0; - INT msk = 1; + INT res = 0; + INT msk = 1; bool rc_flag = true; unsigned size = vec.size(); @@ -2013,12 +2013,12 @@ template bool vector4_to_value(const vvp_vector4_t&vec, INT&val, rc_flag = false; } - msk <<= 1L; + msk <<= 1; } if (is_signed && vec.value(vec.size()-1) == BIT4_1) { if (vec.size() < 8*sizeof(val)) - res |= (INT)(-1L) << vec.size(); + res |= (~static_cast(0)) << vec.size(); } val = res;