Clean up invokations of the vector4_to_value template.
This commit is contained in:
parent
559d965681
commit
222b683849
|
|
@ -403,24 +403,24 @@ void vvp_arith_mult::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
|
|||
{
|
||||
dispatch_operand_(ptr, bit);
|
||||
|
||||
if (wid_ > 8 * sizeof(long)) {
|
||||
if (wid_ > 8 * sizeof(int64_t)) {
|
||||
wide_(ptr);
|
||||
return ;
|
||||
}
|
||||
|
||||
long a;
|
||||
int64_t a;
|
||||
if (! vector4_to_value(op_a_, a, false, true)) {
|
||||
ptr.ptr()->send_vec4(x_val_, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
long b;
|
||||
int64_t b;
|
||||
if (! vector4_to_value(op_b_, b, false, true)) {
|
||||
ptr.ptr()->send_vec4(x_val_, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
long val = a * b;
|
||||
int64_t val = a * b;
|
||||
assert(wid_ <= 8*sizeof(val));
|
||||
|
||||
vvp_vector4_t vval (wid_);
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
# define __STDC_LIMIT_MACROS
|
||||
# include "compile.h"
|
||||
# include "part.h"
|
||||
# include <cstdlib>
|
||||
# include <climits>
|
||||
# include <stdint.h>
|
||||
# include <iostream>
|
||||
# include <cassert>
|
||||
|
||||
|
|
@ -238,7 +240,7 @@ bool vvp_fun_part_var::recv_vec4_(vvp_net_ptr_t port, const vvp_vector4_t&bit,
|
|||
int&base, vvp_vector4_t&source,
|
||||
vvp_vector4_t&ref)
|
||||
{
|
||||
long tmp;
|
||||
int32_t tmp;
|
||||
switch (port.port()) {
|
||||
case 0:
|
||||
source = bit;
|
||||
|
|
@ -246,9 +248,9 @@ bool vvp_fun_part_var::recv_vec4_(vvp_net_ptr_t port, const vvp_vector4_t&bit,
|
|||
case 1:
|
||||
// INT_MIN is before the vector and is used to
|
||||
// represent a 'bx value on the select input.
|
||||
tmp = INT_MIN;
|
||||
tmp = INT32_MIN;
|
||||
vector4_to_value(bit, tmp, is_signed_);
|
||||
if ((int)tmp == base) return false;
|
||||
if (static_cast<int>(tmp) == base) return false;
|
||||
base = tmp;
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -327,9 +327,21 @@ static void format_vpiIntVal(vvp_signal_value*sig, int base, unsigned wid,
|
|||
vvp_vector4_t tmp;
|
||||
sig->vec4_value(tmp);
|
||||
vvp_vector4_t sub = tmp.subvalue(base, wid);
|
||||
long val = 0;
|
||||
vector4_to_value(sub, val, signed_flag, false);
|
||||
vp->value.integer = val;
|
||||
|
||||
// Normally, we'd be OK with just using long in the call to
|
||||
// vector4_to_value, but some compilers seem to take long as
|
||||
// distinct from int32_t AND int64_t. Since the condition is
|
||||
// constant, the compiler should eliminate the dead code.
|
||||
if (sizeof(vp->value.integer) == sizeof(int32_t)) {
|
||||
int32_t val = 0;
|
||||
vector4_to_value(sub, val, signed_flag, false);
|
||||
vp->value.integer = val;
|
||||
} else {
|
||||
assert(sizeof(vp->value.integer) == sizeof(int64_t));
|
||||
int64_t val = 0;
|
||||
vector4_to_value(sub, val, signed_flag, false);
|
||||
vp->value.integer = val;
|
||||
}
|
||||
}
|
||||
|
||||
static void format_vpiRealVal(vvp_signal_value*sig, int base, unsigned wid,
|
||||
|
|
|
|||
Loading…
Reference in New Issue