Add some pass by reference to vvp

This commit is contained in:
Cary R 2016-08-14 22:25:38 -07:00
parent ad5a7f7ca3
commit a2fbdeff78
7 changed files with 78 additions and 78 deletions

View File

@ -1474,8 +1474,8 @@ struct __vpiModPath* compile_modpath(char*label, unsigned width,
static struct __vpiModPathSrc*make_modpath_src(struct __vpiModPath*path,
char edge,
struct symb_s src,
struct numbv_s vals,
const struct symb_s&src,
struct numbv_s&vals,
bool ifnone)
{
vvp_fun_modpath*dst = path->modpath;
@ -1537,10 +1537,10 @@ static struct __vpiModPathSrc*make_modpath_src(struct __vpiModPath*path,
}
void compile_modpath_src(struct __vpiModPath*dst, char edge,
struct symb_s src,
struct numbv_s vals,
struct symb_s condit_src,
struct symb_s path_term_in)
const struct symb_s&src,
struct numbv_s&vals,
const struct symb_s&condit_src,
const struct symb_s&path_term_in)
{
struct __vpiModPathSrc*obj =
make_modpath_src(dst, edge, src, vals, false);
@ -1549,10 +1549,10 @@ void compile_modpath_src(struct __vpiModPath*dst, char edge,
}
void compile_modpath_src(struct __vpiModPath*dst, char edge,
struct symb_s src,
struct numbv_s vals,
const struct symb_s&src,
struct numbv_s&vals,
int condit_src,
struct symb_s path_term_in,
const struct symb_s&path_term_in,
bool ifnone)
{
assert(condit_src == 0);

View File

@ -241,24 +241,24 @@ extern __vpiModPath* compile_modpath(char*label,
struct symb_s dest);
extern void compile_modpath_src(__vpiModPath*dst,
char edge,
struct symb_s input,
struct numbv_s d,
int condit_input, /* match with '0' */
struct symb_s path_term_input,
bool ifnone);
const struct symb_s&src,
struct numbv_s&vals,
const struct symb_s&condit_src,
const struct symb_s&path_term_in);
extern void compile_modpath_src(__vpiModPath*dst,
char edge,
struct symb_s input,
struct numbv_s d,
struct symb_s condit_input,
struct symb_s path_term_input);
const struct symb_s&src,
struct numbv_s&vals,
int condit_src, /* match with '0' */
const struct symb_s&path_term_in,
bool ifnone);
extern void compile_reduce_and(char*label, struct symb_s arg);
extern void compile_reduce_or(char*label, struct symb_s arg);
extern void compile_reduce_xor(char*label, struct symb_s arg);
extern void compile_reduce_nand(char*label, struct symb_s arg);
extern void compile_reduce_nor(char*label, struct symb_s arg);
extern void compile_reduce_xnor(char*label, struct symb_s arg);
extern void compile_reduce_and(char*label, const struct symb_s&arg);
extern void compile_reduce_or(char*label, const struct symb_s&arg);
extern void compile_reduce_xor(char*label, const struct symb_s&arg);
extern void compile_reduce_nand(char*label, const struct symb_s&arg);
extern void compile_reduce_nor(char*label, const struct symb_s&arg);
extern void compile_reduce_xnor(char*label, const struct symb_s&arg);
extern void compile_extend_signed(char*label, long width, struct symb_s arg);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005-2010 Stephen Williams (steve@icarus.com)
* Copyright (c) 2005-2016 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -238,7 +238,7 @@ vvp_bit4_t vvp_reduce_xnor::calculate_result() const
return ~res;
}
static void make_reduce(char*label, vvp_net_fun_t*red, struct symb_s arg)
static void make_reduce(char*label, vvp_net_fun_t*red, const struct symb_s&arg)
{
vvp_net_t*ptr = new vvp_net_t;
ptr->fun = red;
@ -249,37 +249,37 @@ static void make_reduce(char*label, vvp_net_fun_t*red, struct symb_s arg)
input_connect(ptr, 0, arg.text);
}
void compile_reduce_and(char*label, struct symb_s arg)
void compile_reduce_and(char*label, const struct symb_s&arg)
{
vvp_reduce_and* reduce = new vvp_reduce_and;
make_reduce(label, reduce, arg);
}
void compile_reduce_or(char*label, struct symb_s arg)
void compile_reduce_or(char*label, const struct symb_s&arg)
{
vvp_reduce_or* reduce = new vvp_reduce_or;
make_reduce(label, reduce, arg);
}
void compile_reduce_xor(char*label, struct symb_s arg)
void compile_reduce_xor(char*label, const struct symb_s&arg)
{
vvp_reduce_xor* reduce = new vvp_reduce_xor;
make_reduce(label, reduce, arg);
}
void compile_reduce_nand(char*label, struct symb_s arg)
void compile_reduce_nand(char*label, const struct symb_s&arg)
{
vvp_reduce_nand* reduce = new vvp_reduce_nand;
make_reduce(label, reduce, arg);
}
void compile_reduce_nor(char*label, struct symb_s arg)
void compile_reduce_nor(char*label, const struct symb_s&arg)
{
vvp_reduce_nor* reduce = new vvp_reduce_nor;
make_reduce(label, reduce, arg);
}
void compile_reduce_xnor(char*label, struct symb_s arg)
void compile_reduce_xnor(char*label, const struct symb_s&arg)
{
vvp_reduce_xnor* reduce = new vvp_reduce_xnor;
make_reduce(label, reduce, arg);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2016 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -319,7 +319,7 @@ vvp_net_fil_t::prop_t vvp_net_fil_t::filter_object(vvp_object_t&)
return PROP;
}
void vvp_net_fil_t::force_mask(vvp_vector2_t mask)
void vvp_net_fil_t::force_mask(const vvp_vector2_t&mask)
{
if (force_mask_.size() == 0)
force_mask_ = vvp_vector2_t(vvp_vector2_t::FILL0, mask.size());
@ -334,7 +334,7 @@ void vvp_net_fil_t::force_mask(vvp_vector2_t mask)
}
}
void vvp_net_fil_t::release_mask(vvp_vector2_t mask)
void vvp_net_fil_t::release_mask(const vvp_vector2_t&mask)
{
if (force_mask_.size() == 0)
return;

View File

@ -1145,9 +1145,9 @@ class vvp_net_t {
// operate only on the vvp_net_t whose output is to be
// forced. These methods then communicate the force to the
// attached filter to set up the actual force.
void force_vec4(const vvp_vector4_t&val, vvp_vector2_t mask);
void force_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_real(double val, vvp_vector2_t mask);
void force_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask);
void force_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask);
void force_real(double val, const vvp_vector2_t&mask);
public: // Method to support $countdrivers
void count_drivers(unsigned idx, unsigned counts[4]);
@ -1306,9 +1306,9 @@ class vvp_net_fil_t : public vvp_vpi_callback {
// Support for force methods. These are called by the
// vvp_net_t::force_* methods to set the force value and mask
// for the filter.
virtual void force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask) =0;
virtual void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask) =0;
virtual void force_fil_real(double val, vvp_vector2_t mask) =0;
virtual void force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask) =0;
virtual void force_fil_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask) =0;
virtual void force_fil_real(double val, const vvp_vector2_t&mask) =0;
public: // These objects are only permallocated.
static void* operator new(std::size_t size) { return heap_.alloc(size); }
@ -1327,9 +1327,9 @@ class vvp_net_fil_t : public vvp_vpi_callback {
protected:
// Set bits of the filter force mask
void force_mask(vvp_vector2_t mask);
void force_mask(const vvp_vector2_t&mask);
// Release the force on the bits set in the mask.
void release_mask(vvp_vector2_t mask);
void release_mask(const vvp_vector2_t&mask);
// Test bits of the filter force mask;
bool test_force_mask(unsigned bit) const;
bool test_force_mask_is_zero() const;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2016 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -117,7 +117,7 @@ double vvp_signal_value::real_value() const
return 0;
}
void vvp_net_t::force_vec4(const vvp_vector4_t&val, vvp_vector2_t mask)
void vvp_net_t::force_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask)
{
assert(fil);
fil->force_fil_vec4(val, mask);
@ -125,7 +125,7 @@ void vvp_net_t::force_vec4(const vvp_vector4_t&val, vvp_vector2_t mask)
vvp_send_vec4(out_, val, 0);
}
void vvp_net_t::force_vec8(const vvp_vector8_t&val, vvp_vector2_t mask)
void vvp_net_t::force_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask)
{
assert(fil);
fil->force_fil_vec8(val, mask);
@ -133,7 +133,7 @@ void vvp_net_t::force_vec8(const vvp_vector8_t&val, vvp_vector2_t mask)
vvp_send_vec8(out_, val);
}
void vvp_net_t::force_real(double val, vvp_vector2_t mask)
void vvp_net_t::force_real(double val, const vvp_vector2_t&mask)
{
assert(fil);
fil->force_fil_real(val, mask);
@ -310,15 +310,15 @@ unsigned automatic_signal_base::filter_size() const
assert(0);
return(0);
}
void automatic_signal_base::force_fil_vec4(const vvp_vector4_t&, vvp_vector2_t)
void automatic_signal_base::force_fil_vec4(const vvp_vector4_t&, const vvp_vector2_t&)
{
assert(0);
}
void automatic_signal_base::force_fil_vec8(const vvp_vector8_t&, vvp_vector2_t)
void automatic_signal_base::force_fil_vec8(const vvp_vector8_t&, const vvp_vector2_t&)
{
assert(0);
}
void automatic_signal_base::force_fil_real(double, vvp_vector2_t)
void automatic_signal_base::force_fil_real(double, const vvp_vector2_t&)
{
assert(0);
}
@ -940,7 +940,7 @@ unsigned vvp_wire_vec4::filter_size() const
return bits4_.size();
}
void vvp_wire_vec4::force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask)
void vvp_wire_vec4::force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask)
{
force_mask(mask);
@ -957,12 +957,12 @@ void vvp_wire_vec4::force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask)
run_vpi_callbacks();
}
void vvp_wire_vec4::force_fil_vec8(const vvp_vector8_t&, vvp_vector2_t)
void vvp_wire_vec4::force_fil_vec8(const vvp_vector8_t&, const vvp_vector2_t&)
{
assert(0);
}
void vvp_wire_vec4::force_fil_real(double, vvp_vector2_t)
void vvp_wire_vec4::force_fil_real(double, const vvp_vector2_t&)
{
assert(0);
}
@ -1108,12 +1108,12 @@ unsigned vvp_wire_vec8::filter_size() const
return bits8_.size();
}
void vvp_wire_vec8::force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask)
void vvp_wire_vec8::force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask)
{
force_fil_vec8(vvp_vector8_t(val,6,6), mask);
}
void vvp_wire_vec8::force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask)
void vvp_wire_vec8::force_fil_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask)
{
force_mask(mask);
@ -1130,7 +1130,7 @@ void vvp_wire_vec8::force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask)
run_vpi_callbacks();
}
void vvp_wire_vec8::force_fil_real(double, vvp_vector2_t)
void vvp_wire_vec8::force_fil_real(double, const vvp_vector2_t&)
{
assert(0);
}
@ -1240,17 +1240,17 @@ unsigned vvp_wire_real::filter_size() const
return 0;
}
void vvp_wire_real::force_fil_vec4(const vvp_vector4_t&, vvp_vector2_t)
void vvp_wire_real::force_fil_vec4(const vvp_vector4_t&, const vvp_vector2_t&)
{
assert(0);
}
void vvp_wire_real::force_fil_vec8(const vvp_vector8_t&, vvp_vector2_t)
void vvp_wire_real::force_fil_vec8(const vvp_vector8_t&, const vvp_vector2_t&)
{
assert(0);
}
void vvp_wire_real::force_fil_real(double val, vvp_vector2_t mask)
void vvp_wire_real::force_fil_real(double val, const vvp_vector2_t&mask)
{
force_mask(mask);
if (mask.value(0))
@ -1339,15 +1339,15 @@ unsigned vvp_wire_string::filter_size() const
return 0;
}
void vvp_wire_string::force_fil_vec4(const vvp_vector4_t&, vvp_vector2_t)
void vvp_wire_string::force_fil_vec4(const vvp_vector4_t&, const vvp_vector2_t&)
{
assert(0);
}
void vvp_wire_string::force_fil_vec8(const vvp_vector8_t&, vvp_vector2_t)
void vvp_wire_string::force_fil_vec8(const vvp_vector8_t&, const vvp_vector2_t&)
{
assert(0);
}
void vvp_wire_string::force_fil_real(double, vvp_vector2_t)
void vvp_wire_string::force_fil_real(double, const vvp_vector2_t&)
{
assert(0);
}

View File

@ -1,7 +1,7 @@
#ifndef IVL_vvp_net_sig_H
#define IVL_vvp_net_sig_H
/*
* Copyright (c) 2004-2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2004-2016 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -125,9 +125,9 @@ class automatic_signal_base : public vvp_signal_value, public vvp_net_fil_t {
virtual void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);
virtual unsigned filter_size() const;
virtual void force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask);
virtual void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
virtual void force_fil_real(double val, vvp_vector2_t mask);
virtual void force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask);
virtual void force_fil_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask);
virtual void force_fil_real(double val, const vvp_vector2_t&mask);
virtual void get_value(struct t_vpi_value*value);
};
@ -435,9 +435,9 @@ class vvp_wire_vec4 : public vvp_wire_base {
void get_value(struct t_vpi_value*value);
// Abstract methods from vvp_net_fit_t
unsigned filter_size() const;
void force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask);
void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_fil_real(double val, vvp_vector2_t mask);
void force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask);
void force_fil_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask);
void force_fil_real(double val, const vvp_vector2_t&mask);
void release(vvp_net_ptr_t ptr, bool net_flag);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);
@ -480,9 +480,9 @@ class vvp_wire_vec8 : public vvp_wire_base {
void get_value(struct t_vpi_value*value);
// Abstract methods from vvp_net_fit_t
unsigned filter_size() const;
void force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask);
void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_fil_real(double val, vvp_vector2_t mask);
void force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask);
void force_fil_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask);
void force_fil_real(double val, const vvp_vector2_t&mask);
void release(vvp_net_ptr_t ptr, bool net_flag);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);
@ -519,9 +519,9 @@ class vvp_wire_real : public vvp_wire_base {
void get_value(struct t_vpi_value*value);
// Abstract methods from vvp_net_fit_t
unsigned filter_size() const;
void force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask);
void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_fil_real(double val, vvp_vector2_t mask);
void force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask);
void force_fil_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask);
void force_fil_real(double val, const vvp_vector2_t&mask);
void release(vvp_net_ptr_t ptr, bool net_flag);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);
@ -549,9 +549,9 @@ class vvp_wire_string : public vvp_wire_base {
void get_value(struct t_vpi_value*value);
// Abstract methods from vvp_net_fil_t
unsigned filter_size() const;
void force_fil_vec4(const vvp_vector4_t&val, vvp_vector2_t mask);
void force_fil_vec8(const vvp_vector8_t&val, vvp_vector2_t mask);
void force_fil_real(double val, vvp_vector2_t mask);
void force_fil_vec4(const vvp_vector4_t&val, const vvp_vector2_t&mask);
void force_fil_vec8(const vvp_vector8_t&val, const vvp_vector2_t&mask);
void force_fil_real(double val, const vvp_vector2_t&mask);
void release(vvp_net_ptr_t ptr, bool net_flag);
void release_pv(vvp_net_ptr_t ptr, unsigned base, unsigned wid, bool net_flag);