Merge branch 'master' into vec4-stack

This commit is contained in:
Stephen Williams 2014-12-06 08:24:46 -08:00
commit 105521b547
5 changed files with 10 additions and 7 deletions

View File

@ -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:

View File

@ -538,7 +538,7 @@ __vpiDecConst::__vpiDecConst(int val)
}
__vpiDecConst::__vpiDecConst(const __vpiDecConst&that)
: value(that.value)
: __vpiHandle(), value(that.value)
{
}

View File

@ -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;

View File

@ -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;

View File

@ -1993,8 +1993,8 @@ ostream& operator<< (ostream&out, const vvp_vector4_t&that)
template <class INT>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 <class INT>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<INT>(0)) << vec.size();
}
val = res;