Hide the "out" member of the vvp_net_t object.

The out pointer of a vvp_net_t object is going to be a bit more
sophisticated when we redo the handling of net signals. Take a step
towards this rework by making the pointer private and implementing
methods needed to access it.
This commit is contained in:
Stephen Williams 2009-04-03 20:40:26 -07:00
parent e987162cb9
commit 6d34b41dce
20 changed files with 235 additions and 204 deletions

View File

@ -82,14 +82,14 @@ void vvp_arith_abs::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
break;
}
vvp_send_vec4(ptr.ptr()->out, out, 0);
ptr.ptr()->send_vec4(out, 0);
}
void vvp_arith_abs::recv_real(vvp_net_ptr_t ptr, double bit,
vvp_context_t)
{
double out = fabs(bit);
vvp_send_real(ptr.ptr()->out, out, 0);
ptr.ptr()->send_real(out, 0);
}
vvp_arith_cast_int::vvp_arith_cast_int(unsigned wid)
@ -104,7 +104,7 @@ vvp_arith_cast_int::~vvp_arith_cast_int()
void vvp_arith_cast_int::recv_real(vvp_net_ptr_t ptr, double bit,
vvp_context_t)
{
vvp_send_vec4(ptr.ptr()->out, vvp_vector4_t(wid_, bit), 0);
ptr.ptr()->send_vec4(vvp_vector4_t(wid_, bit), 0);
}
vvp_arith_cast_real::vvp_arith_cast_real(bool signed_flag)
@ -121,7 +121,7 @@ void vvp_arith_cast_real::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
{
double val;
vector4_to_value(bit, val, signed_);
vvp_send_real(ptr.ptr()->out, val, 0);
ptr.ptr()->send_real(val, 0);
}
// Division
@ -139,13 +139,13 @@ void vvp_arith_div::wide4_(vvp_net_ptr_t ptr)
{
vvp_vector2_t a2 (op_a_);
if (a2.is_NaN()) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
vvp_vector2_t b2 (op_b_);
if (b2.is_NaN() || b2.is_zero()) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -162,7 +162,7 @@ void vvp_arith_div::wide4_(vvp_net_ptr_t ptr)
}
vvp_vector2_t res = a2 / b2;
if (negate) res = -res;
vvp_send_vec4(ptr.ptr()->out, vector2_to_vector4(res, wid_), 0);
ptr.ptr()->send_vec4(vector2_to_vector4(res, wid_), 0);
}
void vvp_arith_div::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
@ -177,13 +177,13 @@ void vvp_arith_div::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
unsigned long a;
if (! vector4_to_value(op_a_, a)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
unsigned long b;
if (! vector4_to_value(op_b_, b)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -216,7 +216,7 @@ void vvp_arith_div::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
for (unsigned idx = 0 ; idx < wid_ ; idx += 1)
xval.set_bit(idx, BIT4_X);
vvp_send_vec4(ptr.ptr()->out, xval, 0);
ptr.ptr()->send_vec4(xval, 0);
return;
}
@ -236,7 +236,7 @@ void vvp_arith_div::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
val >>= 1;
}
vvp_send_vec4(ptr.ptr()->out, vval, 0);
ptr.ptr()->send_vec4(vval, 0);
}
@ -253,13 +253,13 @@ void vvp_arith_mod::wide_(vvp_net_ptr_t ptr)
{
vvp_vector2_t a2 (op_a_);
if (a2.is_NaN()) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
vvp_vector2_t b2 (op_b_);
if (b2.is_NaN() || b2.is_zero()) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -275,7 +275,7 @@ void vvp_arith_mod::wide_(vvp_net_ptr_t ptr)
}
vvp_vector2_t res = a2 % b2;
if (negate) res = -res;
vvp_send_vec4(ptr.ptr()->out, vector2_to_vector4(res, res.size()), 0);
ptr.ptr()->send_vec4(vector2_to_vector4(res, res.size()), 0);
}
void vvp_arith_mod::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
@ -290,13 +290,13 @@ void vvp_arith_mod::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
unsigned long a;
if (! vector4_to_value(op_a_, a)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
unsigned long b;
if (! vector4_to_value(op_b_, b)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -328,7 +328,7 @@ void vvp_arith_mod::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
for (unsigned idx = 0 ; idx < wid_ ; idx += 1)
xval.set_bit(idx, BIT4_X);
vvp_send_vec4(ptr.ptr()->out, xval, 0);
ptr.ptr()->send_vec4(xval, 0);
return;
}
@ -348,7 +348,7 @@ void vvp_arith_mod::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
val >>= 1;
}
vvp_send_vec4(ptr.ptr()->out, vval, 0);
ptr.ptr()->send_vec4(vval, 0);
}
@ -369,14 +369,14 @@ void vvp_arith_mult::wide_(vvp_net_ptr_t ptr)
vvp_vector2_t b2 (op_b_);
if (a2.is_NaN() || b2.is_NaN()) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
vvp_vector2_t result = a2 * b2;
vvp_vector4_t res4 = vector2_to_vector4(result, wid_);
vvp_send_vec4(ptr.ptr()->out, res4, 0);
ptr.ptr()->send_vec4(res4, 0);
}
void vvp_arith_mult::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
@ -391,13 +391,13 @@ void vvp_arith_mult::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
long a;
if (! vector4_to_value(op_a_, a, false, true)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
long b;
if (! vector4_to_value(op_b_, b, false, true)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -414,7 +414,7 @@ void vvp_arith_mult::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
val >>= 1;
}
vvp_send_vec4(ptr.ptr()->out, vval, 0);
ptr.ptr()->send_vec4(vval, 0);
}
@ -437,7 +437,7 @@ void vvp_arith_pow::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_vector4_t res4;
if (signed_flag_) {
if (op_a_.has_xz() || op_b_.has_xz()) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -451,7 +451,7 @@ void vvp_arith_pow::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_vector2_t b2 (op_b_);
if (a2.is_NaN() || b2.is_NaN()) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -459,7 +459,7 @@ void vvp_arith_pow::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
res4 = vector2_to_vector4(result, wid_);
}
vvp_send_vec4(ptr.ptr()->out, res4, 0);
ptr.ptr()->send_vec4(res4, 0);
}
@ -494,14 +494,14 @@ void vvp_arith_sum::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_bit4_t cur = add_with_carry(a, b, carry);
if (cur == BIT4_X) {
vvp_send_vec4(net->out, x_val_, 0);
net->send_vec4(x_val_, 0);
return;
}
value.set_bit(idx, cur);
}
vvp_send_vec4(net->out, value, 0);
net->send_vec4(value, 0);
}
vvp_arith_sub::vvp_arith_sub(unsigned wid)
@ -539,14 +539,14 @@ void vvp_arith_sub::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_bit4_t cur = add_with_carry(a, b, carry);
if (cur == BIT4_X) {
vvp_send_vec4(net->out, x_val_, 0);
net->send_vec4(x_val_, 0);
return;
}
value.set_bit(idx, cur);
}
vvp_send_vec4(net->out, value, 0);
net->send_vec4(value, 0);
}
vvp_cmp_eeq::vvp_cmp_eeq(unsigned wid)
@ -571,7 +571,7 @@ void vvp_cmp_eeq::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_net_t*net = ptr.ptr();
vvp_send_vec4(net->out, eeq, 0);
net->send_vec4(eeq, 0);
}
vvp_cmp_nee::vvp_cmp_nee(unsigned wid)
@ -596,7 +596,7 @@ void vvp_cmp_nee::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
vvp_net_t*net = ptr.ptr();
vvp_send_vec4(net->out, eeq, 0);
net->send_vec4(eeq, 0);
}
vvp_cmp_eq::vvp_cmp_eq(unsigned wid)
@ -643,7 +643,7 @@ void vvp_cmp_eq::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
}
vvp_net_t*net = ptr.ptr();
vvp_send_vec4(net->out, res, 0);
net->send_vec4(res, 0);
}
@ -691,7 +691,7 @@ void vvp_cmp_ne::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
}
vvp_net_t*net = ptr.ptr();
vvp_send_vec4(net->out, res, 0);
net->send_vec4(res, 0);
}
@ -712,7 +712,7 @@ void vvp_cmp_gtge_base_::recv_vec4_base_(vvp_net_ptr_t ptr,
: compare_gtge(op_a_, op_b_, out_if_equal);
vvp_vector4_t val (1);
val.set_bit(0, out);
vvp_send_vec4(ptr.ptr()->out, val, 0);
ptr.ptr()->send_vec4(val, 0);
return;
}
@ -759,7 +759,7 @@ void vvp_shiftl::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
unsigned long shift;
if (! vector4_to_value(op_b_, shift)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -772,7 +772,7 @@ void vvp_shiftl::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
for (unsigned idx = shift ; idx < out.size() ; idx += 1)
out.set_bit(idx, op_a_.value(idx-shift));
vvp_send_vec4(ptr.ptr()->out, out, 0);
ptr.ptr()->send_vec4(out, 0);
}
vvp_shiftr::vvp_shiftr(unsigned wid, bool signed_flag)
@ -793,7 +793,7 @@ void vvp_shiftr::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
unsigned long shift;
if (! vector4_to_value(op_b_, shift)) {
vvp_send_vec4(ptr.ptr()->out, x_val_, 0);
ptr.ptr()->send_vec4(x_val_, 0);
return;
}
@ -810,7 +810,7 @@ void vvp_shiftr::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
for (unsigned idx = 0 ; idx < shift ; idx += 1)
out.set_bit(idx+out.size()-shift, pad);
vvp_send_vec4(ptr.ptr()->out, out, 0);
ptr.ptr()->send_vec4(out, 0);
}
@ -851,7 +851,7 @@ void vvp_arith_mult_real::recv_real(vvp_net_ptr_t ptr, double bit,
dispatch_operand_(ptr, bit);
double val = op_a_ * op_b_;
vvp_send_real(ptr.ptr()->out, val, 0);
ptr.ptr()->send_real(val, 0);
}
/* Real power. */
@ -869,7 +869,7 @@ void vvp_arith_pow_real::recv_real(vvp_net_ptr_t ptr, double bit,
dispatch_operand_(ptr, bit);
double val = pow(op_a_, op_b_);
vvp_send_real(ptr.ptr()->out, val, 0);
ptr.ptr()->send_real(val, 0);
}
/* Real division. */
@ -887,7 +887,7 @@ void vvp_arith_div_real::recv_real(vvp_net_ptr_t ptr, double bit,
dispatch_operand_(ptr, bit);
double val = op_a_ / op_b_;
vvp_send_real(ptr.ptr()->out, val, 0);
ptr.ptr()->send_real(val, 0);
}
/* Real modulus. */
@ -905,7 +905,7 @@ void vvp_arith_mod_real::recv_real(vvp_net_ptr_t ptr, double bit,
dispatch_operand_(ptr, bit);
double val = fmod(op_a_, op_b_);
vvp_send_real(ptr.ptr()->out, val, 0);
ptr.ptr()->send_real(val, 0);
}
/* Real summation. */
@ -923,7 +923,7 @@ void vvp_arith_sum_real::recv_real(vvp_net_ptr_t ptr, double bit,
dispatch_operand_(ptr, bit);
double val = op_a_ + op_b_;
vvp_send_real(ptr.ptr()->out, val, 0);
ptr.ptr()->send_real(val, 0);
}
/* Real subtraction. */
@ -941,7 +941,7 @@ void vvp_arith_sub_real::recv_real(vvp_net_ptr_t ptr, double bit,
dispatch_operand_(ptr, bit);
double val = op_a_ - op_b_;
vvp_send_real(ptr.ptr()->out, val, 0);
ptr.ptr()->send_real(val, 0);
}
/* Real compare equal. */
@ -958,7 +958,7 @@ void vvp_cmp_eq_real::recv_real(vvp_net_ptr_t ptr, const double bit,
if (op_a_ == op_b_) res.set_bit(0, BIT4_1);
else res.set_bit(0, BIT4_0);
vvp_send_vec4(ptr.ptr()->out, res, 0);
ptr.ptr()->send_vec4(res, 0);
}
/* Real compare not equal. */
@ -975,7 +975,7 @@ void vvp_cmp_ne_real::recv_real(vvp_net_ptr_t ptr, const double bit,
if (op_a_ != op_b_) res.set_bit(0, BIT4_1);
else res.set_bit(0, BIT4_0);
vvp_send_vec4(ptr.ptr()->out, res, 0);
ptr.ptr()->send_vec4(res, 0);
}
/* Real compare greater than or equal. */
@ -992,7 +992,7 @@ void vvp_cmp_ge_real::recv_real(vvp_net_ptr_t ptr, const double bit,
if (op_a_ >= op_b_) res.set_bit(0, BIT4_1);
else res.set_bit(0, BIT4_0);
vvp_send_vec4(ptr.ptr()->out, res, 0);
ptr.ptr()->send_vec4(res, 0);
}
/* Real compare greater than. */
@ -1009,5 +1009,5 @@ void vvp_cmp_gt_real::recv_real(vvp_net_ptr_t ptr, const double bit,
if (op_a_ > op_b_) res.set_bit(0, BIT4_1);
else res.set_bit(0, BIT4_0);
vvp_send_vec4(ptr.ptr()->out, res, 0);
ptr.ptr()->send_vec4(res, 0);
}

View File

@ -836,8 +836,7 @@ void array_set_word(vvp_array_t arr,
struct __vpiSignal*vsig = vpip_signal_from_handle(word);
assert(vsig);
vvp_net_ptr_t ptr (vsig->node, 0);
vvp_send_vec4_pv(ptr, val, part_off, val.size(), vpip_size(vsig), 0);
vsig->node->send_vec4_pv(val, part_off, val.size(), vpip_size(vsig), 0);
array_word_change(arr, address);
}
@ -1143,7 +1142,7 @@ void vvp_fun_arrayport_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit
addr_valid_flag = vector4_to_value(bit, addr_);
if (! addr_valid_flag)
addr_ = arr_->array_count;
vvp_send_vec4(port.ptr()->out, array_get_word(arr_,addr_), 0);
port.ptr()->send_vec4(array_get_word(arr_,addr_), 0);
break;
default:
@ -1158,7 +1157,7 @@ void vvp_fun_arrayport_sa::check_word_change(unsigned long addr)
return;
vvp_vector4_t bit = array_get_word(arr_, addr_);
vvp_send_vec4(net_->out, bit, 0);
net_->send_vec4(bit, 0);
}
class vvp_fun_arrayport_aa : public vvp_fun_arrayport, public automatic_hooks_s {
@ -1242,8 +1241,7 @@ void vvp_fun_arrayport_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit
addr_valid_flag = vector4_to_value(bit, *addr);
if (! addr_valid_flag)
*addr = arr_->array_count;
vvp_send_vec4(port.ptr()->out, array_get_word(arr_,*addr),
context);
port.ptr()->send_vec4(array_get_word(arr_,*addr), context);
break;
default:
@ -1268,7 +1266,7 @@ void vvp_fun_arrayport_aa::check_word_change(unsigned long addr)
return;
vvp_vector4_t bit = array_get_word(arr_, addr);
vvp_send_vec4(net_->out, bit, vthread_get_wt_context());
net_->send_vec4(bit, vthread_get_wt_context());
}
static void array_attach_port(vvp_array_t array, vvp_fun_arrayport*fun)

View File

@ -79,5 +79,5 @@ void vvp_fun_bufif::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
}
}
vvp_send_vec8(ptr.ptr()->out, out);
ptr.ptr()->send_vec8(out);
}

View File

@ -367,9 +367,7 @@ bool vvp_net_resolv_list_s::resolve(bool mes)
if (tmp) {
// Link the input port to the located output.
vvp_net_t*net = port.ptr();
net->port[port.port()] = tmp->out;
tmp->out = port;
tmp->link(port);
return true;
}

View File

@ -64,7 +64,7 @@ void vvp_fun_concat::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
val_.set_bit(off+idx, bit.value(idx));
}
vvp_send_vec4(port.ptr()->out, val_, 0);
port.ptr()->send_vec4(val_, 0);
}
void compile_concat(char*label, unsigned w0, unsigned w1,
@ -107,7 +107,7 @@ void vvp_fun_repeat::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
}
vvp_send_vec4(port.ptr()->out, val, 0);
port.ptr()->send_vec4(val, 0);
}
void compile_repeat(char*label, long width, long repeat, struct symb_s arg)

View File

@ -253,7 +253,7 @@ void vvp_fun_delay::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
if (use_delay == 0) {
cur_vec4_ = bit;
initial_ = false;
vvp_send_vec4(net_->out, cur_vec4_, 0);
net_->send_vec4(cur_vec4_, 0);
} else {
struct event_*cur = new struct event_(use_simtime);
cur->run_run_ptr = &vvp_fun_delay::run_run_vec4_;
@ -278,7 +278,7 @@ void vvp_fun_delay::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit)
if (use_delay == 0) {
cur_vec8_ = bit;
initial_ = false;
vvp_send_vec8(net_->out, cur_vec8_);
net_->send_vec8(cur_vec8_);
} else {
struct event_*cur = new struct event_(use_simtime);
cur->ptr_vec8 = bit;
@ -334,7 +334,7 @@ void vvp_fun_delay::recv_real(vvp_net_ptr_t port, double bit,
if (use_delay == 0) {
cur_real_ = bit;
initial_ = false;
vvp_send_real(net_->out, cur_real_, 0);
net_->send_real(cur_real_, 0);
} else {
struct event_*cur = new struct event_(use_simtime);
cur->run_run_ptr = &vvp_fun_delay::run_run_real_;
@ -363,19 +363,19 @@ void vvp_fun_delay::run_run()
void vvp_fun_delay::run_run_vec4_(struct event_*cur)
{
cur_vec4_ = cur->ptr_vec4;
vvp_send_vec4(net_->out, cur_vec4_, 0);
net_->send_vec4(cur_vec4_, 0);
}
void vvp_fun_delay::run_run_vec8_(struct vvp_fun_delay::event_*cur)
{
cur_vec8_ = cur->ptr_vec8;
vvp_send_vec8(net_->out, cur_vec8_);
net_->send_vec8(cur_vec8_);
}
void vvp_fun_delay::run_run_real_(struct vvp_fun_delay::event_*cur)
{
cur_real_ = cur->ptr_real;
vvp_send_real(net_->out, cur_real_, 0);
net_->send_real(cur_real_, 0);
}
vvp_fun_modpath::vvp_fun_modpath(vvp_net_t*net)
@ -539,7 +539,7 @@ void vvp_fun_modpath::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
void vvp_fun_modpath::run_run()
{
vvp_send_vec4(net_->out, cur_vec4_, 0);
net_->send_vec4(cur_vec4_, 0);
}
vvp_fun_modpath_src::vvp_fun_modpath_src(vvp_time64_t del[12])

View File

@ -58,7 +58,7 @@ void vvp_dff::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
tmp = clk_cur_;
clk_cur_ = bit.value(0);
if (clk_cur_ == BIT4_1 && tmp != BIT4_1)
vvp_send_vec4(port.ptr()->out, d_, 0);
port.ptr()->send_vec4(d_, 0);
break;
case 2: // CE
@ -68,7 +68,7 @@ void vvp_dff::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
case 3: // Asynch-D
d_ = bit;
vvp_send_vec4(port.ptr()->out, d_, 0);
port.ptr()->send_vec4(d_, 0);
break;
}
}

View File

@ -241,7 +241,7 @@ void vvp_fun_edge_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
{
if (recv_vec4_(port, bit, bits_[port.port()], threads_)) {
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, 0);
net->send_vec4(bit, 0);
}
}
@ -300,7 +300,7 @@ void vvp_fun_edge_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
if (recv_vec4_(port, bit, state->bits[port.port()], state->threads)) {
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, context);
net->send_vec4(bit, context);
}
} else {
context = context_scope_->live_contexts;
@ -390,7 +390,7 @@ void vvp_fun_anyedge_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
{
if (recv_vec4_(port, bit, bits_[port.port()], threads_)) {
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, 0);
net->send_vec4(bit, 0);
}
}
@ -399,7 +399,7 @@ void vvp_fun_anyedge_sa::recv_real(vvp_net_ptr_t port, double bit,
{
if (recv_real_(port, bit, bitsr_[port.port()], threads_)) {
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, vvp_vector4_t(), 0);
net->send_vec4(vvp_vector4_t(), 0);
}
}
@ -459,7 +459,7 @@ void vvp_fun_anyedge_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
if (recv_vec4_(port, bit, state->bits[port.port()], state->threads)) {
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, context);
net->send_vec4(bit, context);
}
} else {
context = context_scope_->live_contexts;
@ -479,7 +479,7 @@ void vvp_fun_anyedge_aa::recv_real(vvp_net_ptr_t port, double bit,
if (recv_real_(port, bit, state->bitsr[port.port()], state->threads)) {
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, vvp_vector4_t(), context);
net->send_vec4(vvp_vector4_t(), context);
}
} else {
context = context_scope_->live_contexts;
@ -520,7 +520,7 @@ void vvp_fun_event_or_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
{
run_waiting_threads_(threads_);
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, 0);
net->send_vec4(bit, 0);
}
vvp_fun_event_or_aa::vvp_fun_event_or_aa()
@ -575,7 +575,7 @@ void vvp_fun_event_or_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
run_waiting_threads_(state->threads);
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, context);
net->send_vec4(bit, context);
} else {
context = context_scope_->live_contexts;
while (context) {
@ -616,7 +616,7 @@ void vvp_named_event_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
{
run_waiting_threads_(threads_);
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, 0);
net->send_vec4(bit, 0);
vpip_run_named_event_callbacks(handle_);
}
@ -674,7 +674,7 @@ void vvp_named_event_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
run_waiting_threads_(state->threads);
vvp_net_t*net = port.ptr();
vvp_send_vec4(net->out, bit, context);
net->send_vec4(bit, context);
}
/*

View File

@ -36,7 +36,7 @@ void vvp_fun_extend_signed::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bi
vvp_context_t)
{
if (bit.size() >= width_) {
vvp_send_vec4(port.ptr()->out, bit, 0);
port.ptr()->send_vec4(bit, 0);
return;
}
@ -49,5 +49,5 @@ void vvp_fun_extend_signed::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bi
for (unsigned idx = bit.size() ; idx < res.size() ; idx += 1)
res.set_bit(idx, pad);
vvp_send_vec4(port.ptr()->out, res, 0);
port.ptr()->send_vec4(res, 0);
}

View File

@ -108,7 +108,7 @@ void vvp_fun_and::run_run()
result.set_bit(idx, bitbit);
}
vvp_send_vec4(ptr->out, result, 0);
ptr->send_vec4(result, 0);
}
vvp_fun_buf::vvp_fun_buf()
@ -149,7 +149,7 @@ void vvp_fun_buf::run_run()
vvp_vector4_t tmp (input_);
tmp.change_z2x();
vvp_send_vec4(ptr->out, tmp, 0);
ptr->send_vec4(tmp, 0);
}
vvp_fun_bufz::vvp_fun_bufz()
@ -171,7 +171,7 @@ void vvp_fun_bufz::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
if (ptr.port() != 0)
return;
vvp_send_vec4(ptr.ptr()->out, bit, 0);
ptr.ptr()->send_vec4(bit, 0);
}
void vvp_fun_bufz::recv_vec8(vvp_net_ptr_t ptr, const vvp_vector8_t&bit)
@ -179,7 +179,7 @@ void vvp_fun_bufz::recv_vec8(vvp_net_ptr_t ptr, const vvp_vector8_t&bit)
if (ptr.port() != 0)
return;
vvp_send_vec8(ptr.ptr()->out, bit);
ptr.ptr()->send_vec8(bit);
}
void vvp_fun_bufz::recv_real(vvp_net_ptr_t ptr, double bit,
@ -188,7 +188,7 @@ void vvp_fun_bufz::recv_real(vvp_net_ptr_t ptr, double bit,
if (ptr.port() != 0)
return;
vvp_send_real(ptr.ptr()->out, bit, 0);
ptr.ptr()->send_real(bit, 0);
}
vvp_fun_muxr::vvp_fun_muxr()
@ -267,16 +267,16 @@ void vvp_fun_muxr::run_run()
switch (select_) {
case SEL_PORT0:
vvp_send_real(ptr->out, a_, 0);
ptr->send_real(a_, 0);
break;
case SEL_PORT1:
vvp_send_real(ptr->out, b_, 0);
ptr->send_real(b_, 0);
break;
default:
if (a_ == b_) {
vvp_send_real(ptr->out, a_, 0);
ptr->send_real(a_, 0);
} else {
vvp_send_real(ptr->out, 0.0, 0); // Should this be NaN?
ptr->send_real(0.0, 0); // Should this be NaN?
}
break;
}
@ -347,10 +347,10 @@ void vvp_fun_muxz::run_run()
switch (select_) {
case SEL_PORT0:
vvp_send_vec4(ptr->out, a_, 0);
ptr->send_vec4(a_, 0);
break;
case SEL_PORT1:
vvp_send_vec4(ptr->out, b_, 0);
ptr->send_vec4(b_, 0);
break;
default:
{
@ -373,7 +373,7 @@ void vvp_fun_muxz::run_run()
for (unsigned idx = min_size ; idx < max_size ; idx += 1)
res.set_bit(idx, BIT4_X);
vvp_send_vec4(ptr->out, res, 0);
ptr->send_vec4(res, 0);
}
break;
}
@ -421,7 +421,7 @@ void vvp_fun_not::run_run()
result.set_bit(idx, bitbit);
}
vvp_send_vec4(ptr->out, result, 0);
ptr->send_vec4(result, 0);
}
vvp_fun_or::vvp_fun_or(unsigned wid, bool invert)
@ -457,7 +457,7 @@ void vvp_fun_or::run_run()
result.set_bit(idx, bitbit);
}
vvp_send_vec4(ptr->out, result, 0);
ptr->send_vec4(result, 0);
}
vvp_fun_xor::vvp_fun_xor(unsigned wid, bool invert)
@ -493,7 +493,7 @@ void vvp_fun_xor::run_run()
result.set_bit(idx, bitbit);
}
vvp_send_vec4(ptr->out, result, 0);
ptr->send_vec4(result, 0);
}
/*
@ -607,7 +607,7 @@ void compile_functor(char*label, char*type, unsigned width,
net_drv->fun = obj_drv;
/* Point the gate to the drive node. */
net->out = vvp_net_ptr_t(net_drv, 0);
net->link(vvp_net_ptr_t(net_drv, 0));
define_functor_symbol(label, net_drv);
free(label);

View File

@ -75,7 +75,7 @@ void vvp_fun_pmos_::generate_output_(vvp_net_ptr_t ptr)
}
if (out.size() > 0)
vvp_send_vec8(ptr.ptr()->out, out);
ptr.ptr()->send_vec8(out);
}
@ -178,7 +178,7 @@ void vvp_fun_cmos_::generate_output_(vvp_net_ptr_t ptr)
}
if (out.size() > 0)
vvp_send_vec8(ptr.ptr()->out, out);
ptr.ptr()->send_vec8(out);
}
vvp_fun_cmos::vvp_fun_cmos()

View File

@ -100,7 +100,7 @@ void vvp_fun_part_sa::run_run()
if (idx + base_ < val_.size())
res.set_bit(idx, val_.value(base_+idx));
}
vvp_send_vec4(ptr->out, res, 0);
ptr->send_vec4(res, 0);
}
vvp_fun_part_aa::vvp_fun_part_aa(unsigned base, unsigned wid)
@ -152,7 +152,7 @@ void vvp_fun_part_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
}
if (!val->eeq( tmp )) {
*val = tmp;
vvp_send_vec4(port.ptr()->out, tmp, context);
port.ptr()->send_vec4(tmp, context);
}
} else {
context = context_scope_->live_contexts;
@ -217,7 +217,7 @@ void vvp_fun_part_pv::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
}
assert(bit.size() == wid_);
vvp_send_vec4_pv(port.ptr()->out, bit, base_, wid_, vwid_, context);
port.ptr()->send_vec4_pv(bit, base_, wid_, vwid_, context);
}
void vvp_fun_part_pv::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit)
@ -232,7 +232,7 @@ void vvp_fun_part_pv::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit)
}
assert(bit.size() == wid_);
vvp_send_vec8_pv(port.ptr()->out, bit, base_, wid_, vwid_);
port.ptr()->send_vec8_pv(bit, base_, wid_, vwid_);
}
vvp_fun_part_var::vvp_fun_part_var(unsigned w)
@ -295,7 +295,7 @@ void vvp_fun_part_var_sa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
vvp_context_t)
{
if (recv_vec4_(port, bit, base_, source_, ref_)) {
vvp_send_vec4(port.ptr()->out, ref_, 0);
port.ptr()->send_vec4(ref_, 0);
}
}
@ -365,7 +365,7 @@ void vvp_fun_part_var_aa::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
(vvp_get_context_item(context, context_idx_));
if (recv_vec4_(port, bit, state->base, state->source, state->ref)) {
vvp_send_vec4(port.ptr()->out, state->ref, context);
port.ptr()->send_vec4(state->ref, context);
}
} else {
context = context_scope_->live_contexts;

View File

@ -66,7 +66,7 @@ void vvp_reduce_base::recv_vec4(vvp_net_ptr_t prt, const vvp_vector4_t&bit,
bits_ = bit;
vvp_bit4_t res = calculate_result();
vvp_vector4_t rv (1, res);
vvp_send_vec4(prt.ptr()->out, rv, context);
prt.ptr()->send_vec4(rv, context);
}
void vvp_reduce_base::recv_vec4_pv(vvp_net_ptr_t prt, const vvp_vector4_t&bit,
@ -82,7 +82,7 @@ void vvp_reduce_base::recv_vec4_pv(vvp_net_ptr_t prt, const vvp_vector4_t&bit,
bits_.set_vec(base, bit);
vvp_bit4_t res = calculate_result();
vvp_vector4_t rv (1, res);
vvp_send_vec4(prt.ptr()->out, rv, context);
prt.ptr()->send_vec4(rv, context);
}
class vvp_reduce_and : public vvp_reduce_base {

View File

@ -96,7 +96,7 @@ void resolv_functor::recv_vec8(vvp_net_ptr_t port, const vvp_vector8_t&bit)
<< " in=" << val_[0] << ", " << val_[1]
<< ", " << val_[2] << ", " << val_[3] << endl;
vvp_send_vec8(ptr->out, out);
ptr->send_vec8(out);
}
void resolv_functor::recv_vec8_pv(vvp_net_ptr_t port, const vvp_vector8_t&bit,
@ -146,7 +146,7 @@ void resolv_wired_logic::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
out = wired_logic_math_(out, val_[idx]);
}
vvp_send_vec4(ptr->out, out, 0);
ptr->send_vec4(out, 0);
}
vvp_vector4_t resolv_triand::wired_logic_math_(vvp_vector4_t&a, vvp_vector4_t&b)

View File

@ -989,7 +989,7 @@ void compile_udp_functor(char*label, char*type,
delete delay;
net_drv->fun = obj_drv;
ptr->out = vvp_net_ptr_t(net_drv,0);
ptr->link(vvp_net_ptr_t(net_drv,0));
define_functor_symbol(label, net_drv);
} else {

View File

@ -426,7 +426,7 @@ static vpiHandle sysfunc_put_4net_value(vpiHandle ref, p_vpi_value vp, int)
assert(0);
}
vvp_send_vec4(rfp->fnet->out, val, vthread_get_wt_context());
rfp->fnet->send_vec4(val, vthread_get_wt_context());
return 0;
}
@ -450,7 +450,7 @@ static vpiHandle sysfunc_put_rnet_value(vpiHandle ref, p_vpi_value vp, int)
assert(0);
}
vvp_send_real(rfp->fnet->out, val, vthread_get_wt_context());
rfp->fnet->send_real(val, vthread_get_wt_context());
return 0;
}

View File

@ -550,41 +550,6 @@ void vthread_run(vthread_t thr)
running_thread = 0;
}
/*
* Unlink a ptr object from the driver. The input is the driver in the
* form of a vvp_net_t pointer. The .out member of that object is the
* driver. The dst_ptr argument is the receiver pin to be located and
* removed from the fan-out list.
*/
static void unlink_from_driver(vvp_net_t*src, vvp_net_ptr_t dst_ptr)
{
vvp_net_t*net = dst_ptr.ptr();
unsigned net_port = dst_ptr.port();
if (src->out == dst_ptr) {
/* If the drive fan-out list starts with this pointer,
then the unlink is easy. Pull the list forward. */
src->out = net->port[net_port];
} else {
/* Scan the linked list, looking for the net_ptr_t
pointer *before* the one we wish to remove. */
vvp_net_ptr_t cur = src->out;
assert(!cur.nil());
vvp_net_t*cur_net = cur.ptr();
unsigned cur_port = cur.port();
while (cur_net->port[cur_port] != dst_ptr) {
cur = cur_net->port[cur_port];
assert(!cur.nil());
cur_net = cur.ptr();
cur_port = cur.port();
}
/* Unlink. */
cur_net->port[cur_port] = net->port[net_port];
}
net->port[net_port] = vvp_net_ptr_t(0,0);
}
/*
* The CHUNK_LINK instruction is a special next pointer for linking
* chunks of code space. It's like a simplified %jmp.
@ -1265,7 +1230,7 @@ bool of_CASSIGN_LINK(vthread_t thr, vvp_code_t cp)
unlink it. We can have only 1 cassign at a time. */
if (sig->cassign_link != 0) {
vvp_net_ptr_t tmp (dst, 1);
unlink_from_driver(sig->cassign_link, tmp);
sig->cassign_link->unlink(tmp);
}
sig->cassign_link = src;
@ -1273,8 +1238,7 @@ bool of_CASSIGN_LINK(vthread_t thr, vvp_code_t cp)
/* Link the output of the src to the port[1] (the cassign
port) of the destination. */
vvp_net_ptr_t dst_ptr (dst, 1);
dst->port[1] = src->out;
src->out = dst_ptr;
src->link(dst_ptr);
return true;
}
@ -1777,7 +1741,7 @@ bool of_DEASSIGN(vthread_t thr, vvp_code_t cp)
}
// And this is the pointer to be removed.
vvp_net_ptr_t dst_ptr (net, 1);
unlink_from_driver(src, dst_ptr);
src->unlink(dst_ptr);
sig->cassign_link = 0;
}
@ -1803,7 +1767,7 @@ bool of_DEASSIGN_WR(vthread_t thr, vvp_code_t cp)
if (vvp_net_t*src = sig->cassign_link) {
// And this is the pointer to be removed.
vvp_net_ptr_t dst_ptr (net, 1);
unlink_from_driver(src, dst_ptr);
src->unlink(dst_ptr);
sig->cassign_link = 0;
}
@ -2337,26 +2301,7 @@ static void unlink_force(vvp_net_t*net)
/* We are looking for this pointer. */
vvp_net_ptr_t net_ptr (net, 2);
/* If net is first in the fan-out list, then simply pull it
from the front. */
if (src->out == net_ptr) {
src->out = net->port[2];
net->port[2] = vvp_net_ptr_t();
return;
}
/* Look for the pointer in the fan-out chain */
vvp_net_ptr_t cur_ptr = src->out;
assert(!cur_ptr.nil());
while (cur_ptr.ptr()->port[cur_ptr.port()] != net_ptr) {
cur_ptr = cur_ptr.ptr()->port[cur_ptr.port()];
assert( !cur_ptr.nil() );
}
/* Remove as if from a singly-linked list. */
cur_ptr.ptr()->port[cur_ptr.port()] = net->port[2];
net->port[2] = vvp_net_ptr_t();
src->unlink(net_ptr);
}
/*
@ -2389,8 +2334,7 @@ bool of_FORCE_LINK(vthread_t thr, vvp_code_t cp)
/* Link the output of the src to the port[2] (the force
port) of the destination. */
vvp_net_ptr_t dst_ptr (dst, 2);
dst->port[2] = src->out;
src->out = dst_ptr;
src->link(dst_ptr);
return true;
}
@ -4029,7 +3973,7 @@ bool of_RELEASE_REG(vthread_t thr, vvp_code_t cp)
}
// And this is the pointer to be removed.
vvp_net_ptr_t dst_ptr (net, 2);
unlink_from_driver(src, dst_ptr);
src->unlink(dst_ptr);
sig->force_link = 0;
}
@ -4058,7 +4002,7 @@ bool of_RELEASE_WR(vthread_t thr, vvp_code_t cp)
if (vvp_net_t*src = sig->force_link) {
// And this is the pointer to be removed.
vvp_net_ptr_t dst_ptr (net, 2);
unlink_from_driver(src, dst_ptr);
src->unlink(dst_ptr);
sig->force_link = 0;
}

View File

@ -40,7 +40,7 @@ void island_send_value(vvp_net_t*net, const vvp_vector8_t&val)
return;
fun->outvalue = val;
vvp_send_vec8(net->out, fun->outvalue);
net->send_vec8(fun->outvalue);
}
/*

View File

@ -108,6 +108,52 @@ void vvp_net_t::operator delete(void*)
assert(0);
}
vvp_net_t::vvp_net_t()
{
out_ = vvp_net_ptr_t(0,0);
}
void vvp_net_t::link(vvp_net_ptr_t port)
{
vvp_net_t*net = port.ptr();
net->port[port.port()] = out_;
out_ = port;
}
/*
* Unlink a ptr object from the driver. The input is the driver in the
* form of a vvp_net_t pointer. The .out member of that object is the
* driver. The dst_ptr argument is the receiver pin to be located and
* removed from the fan-out list.
*/
void vvp_net_t::unlink(vvp_net_ptr_t dst_ptr)
{
vvp_net_t*net = dst_ptr.ptr();
unsigned net_port = dst_ptr.port();
if (out_ == dst_ptr) {
/* If the drive fan-out list starts with this pointer,
then the unlink is easy. Pull the list forward. */
out_ = net->port[net_port];
} else if (! out_.nil()) {
/* Scan the linked list, looking for the net_ptr_t
pointer *before* the one we wish to remove. */
vvp_net_ptr_t cur = out_;
assert(!cur.nil());
vvp_net_t*cur_net = cur.ptr();
unsigned cur_port = cur.port();
while (cur_net && cur_net->port[cur_port] != dst_ptr) {
cur = cur_net->port[cur_port];
cur_net = cur.ptr();
cur_port = cur.port();
}
/* Unlink. */
if (cur_net) cur_net->port[cur_port] = net->port[net_port];
}
net->port[net_port] = vvp_net_ptr_t(0,0);
}
void* vvp_net_fun_t::operator new(size_t size)
{
// Link in an initial chunk of space for net_fun_t
@ -2462,7 +2508,7 @@ void vvp_fun_drive::recv_vec4(vvp_net_ptr_t port, const vvp_vector4_t&bit,
vvp_context_t)
{
assert(port.port() == 0);
vvp_send_vec8(port.ptr()->out, vvp_vector8_t(bit, drive0_, drive1_));
port.ptr()->send_vec8(vvp_vector8_t(bit, drive0_, drive1_));
}
@ -2715,9 +2761,9 @@ void vvp_fun_signal4_sa::calculate_output_(vvp_net_ptr_t ptr)
if (force_mask_.value(idx))
bits.set_bit(idx, force_.value(idx));
}
vvp_send_vec4(ptr.ptr()->out, bits, 0);
ptr.ptr()->send_vec4(bits, 0);
} else {
vvp_send_vec4(ptr.ptr()->out, bits4_, 0);
ptr.ptr()->send_vec4(bits4_, 0);
}
run_vpi_callbacks();
@ -2727,7 +2773,7 @@ void vvp_fun_signal4_sa::release(vvp_net_ptr_t ptr, bool net)
{
force_mask_ = vvp_vector2_t();
if (net) {
vvp_send_vec4(ptr.ptr()->out, bits4_, 0);
ptr.ptr()->send_vec4(bits4_, 0);
run_vpi_callbacks();
} else {
bits4_ = force_;
@ -2833,7 +2879,7 @@ void vvp_fun_signal4_aa::recv_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&bit,
if (!bits4->eeq(bit)) {
*bits4 = bit;
vvp_send_vec4(ptr.ptr()->out, *bits4, context);
ptr.ptr()->send_vec4(*bits4, context);
}
}
@ -2853,7 +2899,7 @@ void vvp_fun_signal4_aa::recv_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&bit
if (base+idx >= bits4->size()) break;
bits4->set_bit(base+idx, bit.value(idx));
}
vvp_send_vec4(ptr.ptr()->out, *bits4, context);
ptr.ptr()->send_vec4(*bits4, context);
}
void vvp_fun_signal4_aa::release(vvp_net_ptr_t ptr, bool net)
@ -3009,10 +3055,10 @@ void vvp_fun_signal8::calculate_output_(vvp_net_ptr_t ptr)
if (force_mask_.value(idx))
bits.set_bit(idx, force_.value(idx));
}
vvp_send_vec8(ptr.ptr()->out, bits);
ptr.ptr()->send_vec8(bits);
} else {
vvp_send_vec8(ptr.ptr()->out, bits8_);
ptr.ptr()->send_vec8(bits8_);
}
run_vpi_callbacks();
@ -3022,7 +3068,7 @@ void vvp_fun_signal8::release(vvp_net_ptr_t ptr, bool net)
{
force_mask_ = vvp_vector2_t();
if (net) {
vvp_send_vec8(ptr.ptr()->out, bits8_);
ptr.ptr()->send_vec8(bits8_);
run_vpi_callbacks();
} else {
bits8_ = force_;
@ -3112,7 +3158,7 @@ void vvp_fun_signal_real_sa::recv_real(vvp_net_ptr_t ptr, double bit,
if (needs_init_ || !bits_equal(bits_, bit)) {
bits_ = bit;
needs_init_ = false;
vvp_send_real(ptr.ptr()->out, bit, 0);
ptr.ptr()->send_real(bit, 0);
run_vpi_callbacks();
}
}
@ -3121,14 +3167,14 @@ void vvp_fun_signal_real_sa::recv_real(vvp_net_ptr_t ptr, double bit,
case 1: // Continuous assign value
continuous_assign_active_ = true;
bits_ = bit;
vvp_send_real(ptr.ptr()->out, bit, 0);
ptr.ptr()->send_real(bit, 0);
run_vpi_callbacks();
break;
case 2: // Force value
force_mask_ = vvp_vector2_t(1, 1);
force_ = bit;
vvp_send_real(ptr.ptr()->out, bit, 0);
ptr.ptr()->send_real(bit, 0);
run_vpi_callbacks();
break;
@ -3143,7 +3189,7 @@ void vvp_fun_signal_real_sa::release(vvp_net_ptr_t ptr, bool net)
{
force_mask_ = vvp_vector2_t();
if (net) {
vvp_send_real(ptr.ptr()->out, bits_, 0);
ptr.ptr()->send_real(bits_, 0);
run_vpi_callbacks();
} else {
bits_ = force_;
@ -3206,7 +3252,7 @@ void vvp_fun_signal_real_aa::recv_real(vvp_net_ptr_t ptr, double bit,
if (!bits_equal(*bits,bit)) {
*bits = bit;
vvp_send_real(ptr.ptr()->out, bit, context);
ptr.ptr()->send_real(bit, context);
}
}
@ -3243,9 +3289,9 @@ void vvp_wide_fun_core::propagate_vec4(const vvp_vector4_t&bit,
vvp_time64_t delay)
{
if (delay)
schedule_assign_plucked_vector(ptr_->out, delay, bit, 0, bit.size());
schedule_assign_plucked_vector(ptr_->peek_out(), delay, bit, 0, bit.size());
else
vvp_send_vec4(ptr_->out, bit, 0);
ptr_->send_vec4(bit, 0);
}
void vvp_wide_fun_core::propagate_real(double bit,
@ -3255,7 +3301,7 @@ void vvp_wide_fun_core::propagate_real(double bit,
// schedule_assign_vector(ptr_->out, bit, delay);
assert(0); // Need a real-value version of assign_vector.
} else {
vvp_send_real(ptr_->out, bit, 0);
ptr_->send_real(bit, 0);
}
}

View File

@ -963,14 +963,37 @@ template <class T> ostream& operator << (ostream&out, vvp_sub_pointer_t<T> val)
* The vvp_send_*() functions take as input a vvp_net_ptr_t and follow
* all the fan-out chain, delivering the specified value.
*/
struct vvp_net_t {
class vvp_net_t {
public:
vvp_net_t();
#ifdef CHECK_WITH_VALGRIND
vvp_net_t *pool;
#endif
vvp_net_ptr_t port[4];
vvp_net_ptr_t out;
vvp_net_fun_t*fun;
vvp_net_ptr_t peek_out() const { return out_; }
public:
// Connect the port to the output from this net.
void link(vvp_net_ptr_t port);
// Disconnect the port from the output of this net.
void unlink(vvp_net_ptr_t port);
public: // Methods to propagate output from this node.
void send_vec4(const vvp_vector4_t&val, vvp_context_t context);
void send_vec8(const vvp_vector8_t&val);
void send_real(double val, vvp_context_t context);
void send_long(long val);
void send_vec4_pv(const vvp_vector4_t&val,
unsigned base, unsigned wid, unsigned vwid,
vvp_context_t context);
void send_vec8_pv(const vvp_vector8_t&val,
unsigned base, unsigned wid, unsigned vwid);
private:
vvp_net_ptr_t out_;
public: // Need a better new for these objects.
static void* operator new(std::size_t size);
static void operator delete(void*); // not implemented
@ -1536,8 +1559,7 @@ class vvp_wide_fun_t : public vvp_net_fun_t {
};
inline void vvp_send_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&val,
vvp_context_t context)
inline void vvp_send_vec4(vvp_net_ptr_t ptr, const vvp_vector4_t&val, vvp_context_t context)
{
while (struct vvp_net_t*cur = ptr.ptr()) {
vvp_net_ptr_t next = cur->port[ptr.port()];
@ -1576,8 +1598,8 @@ extern void vvp_send_long_pv(vvp_net_ptr_t ptr, long val,
* mirror of the destination vector.
*/
inline void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val,
unsigned base, unsigned wid, unsigned vwid,
vvp_context_t context)
unsigned base, unsigned wid, unsigned vwid,
vvp_context_t context)
{
while (struct vvp_net_t*cur = ptr.ptr()) {
vvp_net_ptr_t next = cur->port[ptr.port()];
@ -1589,9 +1611,10 @@ inline void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val,
}
}
inline void vvp_send_vec8_pv(vvp_net_ptr_t ptr, const vvp_vector8_t&val,
unsigned base, unsigned wid, unsigned vwid)
inline void vvp_net_t::send_vec8_pv(const vvp_vector8_t&val,
unsigned base, unsigned wid, unsigned vwid)
{
vvp_net_ptr_t ptr = out_;
while (struct vvp_net_t*cur = ptr.ptr()) {
vvp_net_ptr_t next = cur->port[ptr.port()];
@ -1602,4 +1625,26 @@ inline void vvp_send_vec8_pv(vvp_net_ptr_t ptr, const vvp_vector8_t&val,
}
}
inline void vvp_net_t::send_vec4(const vvp_vector4_t&val, vvp_context_t context)
{
vvp_send_vec4(out_, val, context);
}
inline void vvp_net_t::send_vec4_pv(const vvp_vector4_t&val,
unsigned base, unsigned wid, unsigned vwid,
vvp_context_t context)
{
vvp_send_vec4_pv(out_, val, base, wid, vwid, context);
}
inline void vvp_net_t::send_vec8(const vvp_vector8_t&val)
{
vvp_send_vec8(out_, val);
}
inline void vvp_net_t::send_real(double val, vvp_context_t context)
{
vvp_send_real(out_, val, context);
}
#endif