From a2fbdeff78ee9e1f82925510f5ac20213b920acf Mon Sep 17 00:00:00 2001 From: Cary R Date: Sun, 14 Aug 2016 22:25:38 -0700 Subject: [PATCH] Add some pass by reference to vvp --- vvp/compile.cc | 18 +++++++++--------- vvp/compile.h | 30 +++++++++++++++--------------- vvp/reduce.cc | 16 ++++++++-------- vvp/vvp_net.cc | 6 +++--- vvp/vvp_net.h | 16 ++++++++-------- vvp/vvp_net_sig.cc | 38 +++++++++++++++++++------------------- vvp/vvp_net_sig.h | 32 ++++++++++++++++---------------- 7 files changed, 78 insertions(+), 78 deletions(-) diff --git a/vvp/compile.cc b/vvp/compile.cc index 5de3f87b6..39392c64e 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -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); diff --git a/vvp/compile.h b/vvp/compile.h index eda571e5a..02b55174b 100644 --- a/vvp/compile.h +++ b/vvp/compile.h @@ -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); diff --git a/vvp/reduce.cc b/vvp/reduce.cc index 94b07fac0..2450a777e 100644 --- a/vvp/reduce.cc +++ b/vvp/reduce.cc @@ -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); diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index 864f72bbd..d1ecaf817 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -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; diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index a59045780..b5bf544c1 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -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; diff --git a/vvp/vvp_net_sig.cc b/vvp/vvp_net_sig.cc index fc1bd122e..c3dfc1576 100644 --- a/vvp/vvp_net_sig.cc +++ b/vvp/vvp_net_sig.cc @@ -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); } diff --git a/vvp/vvp_net_sig.h b/vvp/vvp_net_sig.h index 50d291a08..e64e21095 100644 --- a/vvp/vvp_net_sig.h +++ b/vvp/vvp_net_sig.h @@ -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);