Cleanup some cppcheck warnings

This commit is contained in:
Cary R 2022-12-27 23:59:39 -08:00
parent 5cd8bb3a88
commit dc8b7d0184
45 changed files with 273 additions and 266 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2022 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
@ -148,7 +148,7 @@ bool Module::can_be_toplevel() const
// Don't choose modules with parameters without default value
for (std::map<perm_string,param_expr_t*>::const_iterator cur =
parameters.begin(); cur != parameters.end(); cur++) {
parameters.begin(); cur != parameters.end(); ++cur) {
if (cur->second->expr == 0)
return false;
}

View File

@ -1,20 +1,20 @@
// These are correct and are used to find the base (zero) pin.
thisSubtraction:netlist.h:5213
thisSubtraction:netlist.h:5222
thisSubtraction:netlist.h:5244
thisSubtraction:netlist.h:5253
// This is used when running a debugger
// debugger_release
knownConditionTrueFalse:main.cc:919
knownConditionTrueFalse:main.cc:921
// This are just stubs
// vpi_control()
unusedFunction:vpi_modules.cc:107
unusedFunction:vpi_modules.cc:109
// vpi_mcd_printf()
unusedFunction:vpi_modules.cc:84
unusedFunction:vpi_modules.cc:86
// vpi_printf()
unusedFunction:vpi_modules.cc:88
unusedFunction:vpi_modules.cc:90
// vpi_sim_control()
unusedFunction:vpi_modules.cc:108
unusedFunction:vpi_modules.cc:110
// These are the functions that the compiler exports to the targets.
//ivl_branch_island()

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2022 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -2943,7 +2943,7 @@ unsigned PECallFunction::elaborate_arguments_(Design*des, NetScope*scope,
for (unsigned idx = 0 ; idx < parm_count ; idx += 1) {
unsigned pidx = idx + parm_off;
PExpr*tmp = (idx < actual_count) ? parms_[idx] : 0;
PExpr*tmp = (idx < actual_count) ? parms_[idx] : NULL;
if (tmp) {
parms[pidx] = elaborate_rval_expr(des, scope,
def->port(pidx)->net_type(),
@ -3177,7 +3177,7 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope,
// Get the method name that we are looking for.
perm_string method_name = search_results.path_tail.back().name;
PExpr*tmp = parms_.size() ? parms_[0] : 0;
PExpr*tmp = parms_.size() ? parms_[0] : NULL;
return check_for_enum_methods(this, des, scope,
netenum, path_,
method_name, sub_expr,
@ -4171,7 +4171,7 @@ unsigned PEIdent::test_width(Design*des, NetScope*scope, width_mode_t&mode)
ivl_assert(*this, 0);
}
if (const netdarray_t*darray = sr.net ? sr.net->darray_type() : 0) {
if (const netdarray_t*darray = sr.net ? sr.net->darray_type() : NULL) {
switch (use_sel) {
case index_component_t::SEL_BIT:
case index_component_t::SEL_BIT_LAST:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012-2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -183,7 +183,6 @@ NetAssign_* PEIdent::elaborate_lval(Design*des,
symbol_search(this, des, use_scope, path_, &sr);
NetNet *reg = sr.net;
pform_name_t &base_path = sr.path_head;
pform_name_t &member_path = sr.path_tail;
/* The l-value must be a variable. If not, then give up and
@ -221,6 +220,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des,
else
cerr << get_fileline() << ": " << __func__ << ": "
<< "reg->net_type()=<nil>" << endl;
const pform_name_t &base_path = sr.path_head;
cerr << get_fileline() << ": " << __func__ << ": "
<< " base_path=" << base_path
<< ", member_path=" << member_path

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2022 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -1115,7 +1115,7 @@ NetNet*PEIdent::elaborate_unpacked_net(Design*des, NetScope*scope) const
}
const name_component_t&name_tail = path_.back();
if (name_tail.index.size() != 0) {
if (!name_tail.index.empty()) {
cerr << get_fileline() << ": sorry: Array slices are not yet "
<< "supported for continuous assignment." << endl;
des->errors += 1;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -415,7 +415,7 @@ static void blend_class_constructors(PClass*pclass)
// While we're here, look for a super.new() call. If we find
// it, strip it out of the constructor and set it aside for
// when we actually call the chained constructor.
PChainConstructor*chain_new = use_new? use_new->extract_chain_constructor() : 0;
PChainConstructor*chain_new = use_new? use_new->extract_chain_constructor() : NULL;
// If we do not have an explicit constructor chain, but there
// is a parent class, then create an implicit chain.
@ -457,7 +457,6 @@ static void blend_class_constructors(PClass*pclass)
} else {
use_new->push_statement_front(chain_new);
}
chain_new = 0;
}
}
@ -1153,7 +1152,6 @@ bool PGenerate::generate_scope_case_(Design*des, NetScope*container)
}
delete case_value_co;
case_value_co = 0;
PGenerate*item = (cur == generate_schemes.end())? default_item : *cur;
if (item == 0) {

View File

@ -3422,8 +3422,8 @@ NetProc* PCondit::elaborate(Design*des, NetScope*scope) const
// Well, I actually need to generate code to handle the
// conditional, so elaborate.
NetProc*i = if_? if_->elaborate(des, scope) : 0;
NetProc*e = else_? else_->elaborate(des, scope) : 0;
NetProc*i = if_? if_->elaborate(des, scope) : NULL;
NetProc*e = else_? else_->elaborate(des, scope) : NULL;
// Detect the special cases that the if or else statements are
// empty blocks. If this is the case, remove the blocks as

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2022 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
@ -153,7 +153,7 @@ NetExpr* NetEBAdd::eval_tree()
// example, the expression (a + 2) - 1 can be rewritten as a + 1.
NetEBAdd*se = dynamic_cast<NetEBAdd*>(left_);
NetEConst*lc = se? dynamic_cast<NetEConst*>(se->right_) : 0;
NetEConst*lc = se? dynamic_cast<NetEConst*>(se->right_) : NULL;
NetEConst*rc = dynamic_cast<NetEConst*>(right_);
if (lc != 0 && rc != 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2022 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
@ -176,7 +176,7 @@ void Design::functor(functor_t*fun)
break;
nodes_functor_cur_ = nodes_functor_nxt_;
} while (nodes_ && (nodes_functor_cur_ != nodes_));
} while (nodes_functor_cur_ != nodes_);
nodes_functor_cur_ = 0;
nodes_functor_nxt_ = 0;

View File

@ -80,7 +80,7 @@ char* yytext_string_filter(const char*str, size_t str_len)
char* strdupnew(char const *str)
{
return str ? strcpy(new char [strlen(str)+1], str) : 0;
return str ? strcpy(new char [strlen(str)+1], str) : NULL;
}
static const char* set_file_name(char*text)

View File

@ -1,5 +1,5 @@
const char COPYRIGHT[] =
"Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)";
"Copyright (c) 1998-2022 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
@ -1327,8 +1327,7 @@ int main(int argc, char*argv[])
delete des;
EOC_cleanup();
return 1;
}
if (emit_rc < 0) {
} else {
cerr << "error: Code generator failure: " << emit_rc << endl;
delete des;
EOC_cleanup();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2022 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
@ -829,9 +829,9 @@ void NetScope::evaluate_type_parameter_(Design *des, param_ref_t cur)
return;
}
data_type_t *type = type_expr->get_type();
data_type_t *ptype = type_expr->get_type();
NetScope *type_scope = cur->second.val_scope;
cur->second.ivl_type = type->elaborate_type(des, type_scope);
cur->second.ivl_type = ptype->elaborate_type(des, type_scope);
}
void NetScope::evaluate_parameter_(Design*des, param_ref_t cur)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2022 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
@ -38,6 +38,7 @@ NetEvent::NetEvent(perm_string n)
waitref_ = 0;
exprref_ = 0;
wlist_ = 0;
nb_trig_ = 0;
}
NetEvent::~NetEvent()

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2022 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
@ -33,7 +33,7 @@ using namespace std;
void Nexus::connect(Link&r)
{
Nexus*r_nexus = r.next_? r.find_nexus_() : 0;
Nexus*r_nexus = r.next_? r.find_nexus_() : NULL;
if (this == r_nexus)
return;

View File

@ -24,7 +24,7 @@
using namespace std;
netclass_t::netclass_t(perm_string name, const netclass_t*super)
: name_(name), super_(super), class_scope_(0), definition_scope_(0)
: name_(name), super_(super), class_scope_(0), definition_scope_(0), virtual_class_(false)
{
}

View File

@ -1,7 +1,7 @@
#ifndef IVL_netlist_H
#define IVL_netlist_H
/*
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -4061,7 +4061,7 @@ class NetProcTop : public LineInfo, public Attrib {
private:
bool tie_off_floating_inputs_(Design*des,
NexusSet&nex_map, NetBus&nex_in,
std::vector<NetProc::mask_t>&bitmasks,
const std::vector<NetProc::mask_t>&bitmasks,
bool is_ff_input);
const ivl_process_type_t type_;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011 Stephen Williams (steve@icarus.com)
* Copyright (c) 2011-2022 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
@ -27,7 +27,7 @@
using namespace std;
netstruct_t::netstruct_t()
: union_(false), packed_(false)
: union_(false), packed_(false), signed_(false)
{
}

View File

@ -98,7 +98,7 @@ class netvector_t : public ivl_type_s {
inline netvector_t::netvector_t(const std::vector<netrange_t>&pd,
ivl_variable_type_t type)
: packed_dims_(pd), type_(type), signed_(false), isint_(false)
: packed_dims_(pd), type_(type), signed_(false), isint_(false), implicit_(false)
{
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -1900,14 +1900,13 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
perm_string port_name = (*decl)[idx]->basename();
if (PWire*cur = defs[port_name]) {
bool rc = true;
assert((*decl)[idx]);
if ((*decl)[idx]->get_port_type() != NetNet::PIMPLICIT) {
rc = cur->set_port_type((*decl)[idx]->get_port_type());
bool rc = cur->set_port_type((*decl)[idx]->get_port_type());
assert(rc);
}
if ((*decl)[idx]->get_wire_type() != NetNet::IMPLICIT) {
rc = cur->set_wire_type((*decl)[idx]->get_wire_type());
bool rc = cur->set_wire_type((*decl)[idx]->get_wire_type());
assert(rc);
}
@ -2770,7 +2769,7 @@ vector<pform_tf_port_t>*pform_make_task_ports(const struct vlltype&loc,
for (list<pform_port_t>::iterator cur = ports->begin();
cur != ports->end(); ++cur) {
perm_string &name = cur->name;
const perm_string &name = cur->name;
PWire*curw = pform_get_or_make_wire(loc, name, NetNet::IMPLICIT_REG,
pt, rt);
@ -2919,7 +2918,7 @@ LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag,
}
static void pform_set_type_parameter(const struct vlltype&loc, perm_string name,
LexicalScope::range_t*value_range)
const LexicalScope::range_t*value_range)
{
pform_requires_sv(loc, "Type parameter");

View File

@ -192,7 +192,7 @@ static void merge_sequential_enables(Design*des, NetScope*scope,
}
}
static void merge_sequential_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub_mask)
static void merge_sequential_masks(NetProc::mask_t&top_mask, const NetProc::mask_t&sub_mask)
{
if (sub_mask.size() == 0)
return;
@ -209,7 +209,7 @@ static void merge_sequential_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub
}
}
static void merge_parallel_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub_mask)
static void merge_parallel_masks(NetProc::mask_t&top_mask, const NetProc::mask_t&sub_mask)
{
if (sub_mask.size() == 0)
return;
@ -226,7 +226,7 @@ static void merge_parallel_masks(NetProc::mask_t&top_mask, NetProc::mask_t&sub_m
}
}
static bool all_bits_driven(NetProc::mask_t&mask)
static bool all_bits_driven(const NetProc::mask_t&mask)
{
if (mask.size() == 0)
return false;
@ -240,7 +240,7 @@ static bool all_bits_driven(NetProc::mask_t&mask)
bool NetProcTop::tie_off_floating_inputs_(Design*des,
NexusSet&nex_map, NetBus&nex_in,
vector<NetProc::mask_t>&bitmasks,
const vector<NetProc::mask_t>&bitmasks,
bool is_ff_input)
{
bool flag = true;
@ -1380,8 +1380,8 @@ bool NetCondit::synth_async(Design*des, NetScope*scope,
delete bpv;
} else {
// The part selects are of no use. Forget them.
apv = 0;
bpv = 0;
if (apv) delete apv;
if (bpv) delete bpv;
}
NetMux*mux = new NetMux(scope, scope->local_symbol(),

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -261,16 +261,16 @@ ivl_scope_t dll_target::find_scope(ivl_design_s &des, const NetScope*cur)
for (unsigned idx = 0; idx < des.roots.size(); idx += 1) {
assert(des.roots[idx]);
ivl_scope_t scope = find_scope_from_root(des.roots[idx], cur);
if (scope)
return scope;
ivl_scope_t scop = find_scope_from_root(des.roots[idx], cur);
if (scop)
return scop;
}
for (size_t idx = 0; idx < des.packages.size(); idx += 1) {
assert(des.packages[idx]);
ivl_scope_t scope = find_scope_from_root(des.packages[idx], cur);
if (scope)
return scope;
ivl_scope_t scop = find_scope_from_root(des.packages[idx], cur);
if (scop)
return scop;
}
return 0;
@ -287,14 +287,14 @@ ivl_scope_t dll_target::lookup_scope_(const NetScope*cur)
*/
ivl_signal_t dll_target::find_signal(ivl_design_s &des, const NetNet*net)
{
ivl_scope_t scope = find_scope(des, net->scope());
assert(scope);
ivl_scope_t scop = find_scope(des, net->scope());
assert(scop);
perm_string nname = net->name();
for (unsigned idx = 0 ; idx < scope->sigs_.size() ; idx += 1) {
if (strcmp(scope->sigs_[idx]->name_, nname) == 0)
return scope->sigs_[idx];
for (unsigned idx = 0 ; idx < scop->sigs_.size() ; idx += 1) {
if (strcmp(scop->sigs_[idx]->name_, nname) == 0)
return scop->sigs_[idx];
}
assert(0);
@ -2744,7 +2744,7 @@ void dll_target::signal(const NetNet*net)
for (unsigned idx = 0 ; idx < obj->array_words ; idx += 1) {
const Nexus*nex = net->pins_are_virtual() ? 0 : net->pin(idx).nexus();
const Nexus*nex = net->pins_are_virtual() ? NULL : net->pin(idx).nexus();
if (nex == 0) {
// Special case: This pin is connected to
// nothing. This can happen, for example, if the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013-2020 Stephen Williams (steve@icarus.com)
* Copyright (c) 2013-2022 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
@ -222,7 +222,7 @@ static void emit_blif(const char*blif_path, ivl_design_t des, ivl_scope_t model)
fclose(fd);
}
bool scope_is_in_model(ivl_scope_t model, ivl_scope_t scope)
bool scope_is_in_model(const ivl_scope_t model, ivl_scope_t scope)
{
while (scope) {
if (scope==model)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2022 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -345,7 +345,7 @@ static void emit_driver_delay(ivl_scope_t scope, ivl_nexus_t nex)
emit_delay(scope, rise, fall, decay, 3);
}
static unsigned is_local_nexus(ivl_scope_t scope, ivl_nexus_t nex)
static unsigned is_local_nexus(const ivl_scope_t scope, ivl_nexus_t nex)
{
unsigned idx, count = ivl_nexus_ptrs(nex);
unsigned is_local = 1;
@ -469,7 +469,7 @@ static void emit_nexus_port_signal(ivl_scope_t scope, ivl_nexus_t nex)
else fprintf(vlog_out, "/* Empty */");
}
static ivl_signal_t find_local_signal(ivl_scope_t scope, ivl_nexus_t nex,
static ivl_signal_t find_local_signal(const ivl_scope_t scope, ivl_nexus_t nex,
unsigned *word)
{
unsigned idx, count = ivl_nexus_ptrs(nex);
@ -817,7 +817,7 @@ static void emit_lpm_concat(ivl_scope_t scope, ivl_lpm_t lpm)
/*
* Look for an output signal in the nexus that is driving into this scope.
*/
static ivl_signal_t find_output_signal(ivl_scope_t scope, ivl_nexus_t nex,
static ivl_signal_t find_output_signal(const ivl_scope_t scope, ivl_nexus_t nex,
unsigned*array_word)
{
unsigned idx, count = ivl_nexus_ptrs(nex);
@ -961,9 +961,8 @@ static void emit_lpm_part_select(ivl_scope_t scope, ivl_lpm_t lpm,
return;
}
if (sign_extend) fprintf(vlog_out, "(");
if (sign_extend) {
fprintf(vlog_out, "(");
assert(base != lsb);
// HERE: This looks wrong.
if (msb >= lsb) base += lsb;
@ -1771,7 +1770,7 @@ static void emit_lpm_latch(ivl_scope_t scope, ivl_lpm_t lpm)
need_latch_prim = 1;
}
static ivl_signal_t get_output_from_nexus(ivl_scope_t scope, ivl_nexus_t nex,
static ivl_signal_t get_output_from_nexus(const ivl_scope_t scope, ivl_nexus_t nex,
int64_t*array_idx)
{
ivl_signal_t use_sig = 0;
@ -1858,7 +1857,7 @@ static void emit_lpm_part_pv(ivl_scope_t scope, ivl_lpm_t lpm)
fprintf(vlog_out, "]");
}
static unsigned output_is_module_instantiation_input(ivl_scope_t scope,
static unsigned output_is_module_instantiation_input(const ivl_scope_t scope,
ivl_nexus_t nex)
{
unsigned idx, count = ivl_nexus_ptrs(nex);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2020 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2022 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -420,7 +420,7 @@ void emit_scaled_expr(ivl_scope_t scope, ivl_expr_t expr, int msb, int lsb)
}
}
static unsigned find_signal_in_nexus(ivl_scope_t scope, ivl_nexus_t nex)
static unsigned find_signal_in_nexus(const ivl_scope_t scope, ivl_nexus_t nex)
{
ivl_signal_t use_sig = 0;
unsigned is_driver = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010-2021 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2010-2022 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -171,7 +171,7 @@ static unsigned emit_and_free_net_const_list(ivl_scope_t scope)
return idx;
}
static void save_net_constants(ivl_scope_t scope, ivl_signal_t sig)
static void save_net_constants(const ivl_scope_t scope, ivl_signal_t sig)
{
ivl_nexus_t nex = ivl_signal_nex(sig, 0);
unsigned idx, count = ivl_nexus_ptrs(nex);
@ -397,7 +397,7 @@ static void emit_module_ports(ivl_scope_t scope)
fprintf(vlog_out, ")");
}
static ivl_signal_t get_port_from_nexus(ivl_scope_t scope, ivl_nexus_t nex,
static ivl_signal_t get_port_from_nexus(const ivl_scope_t scope, ivl_nexus_t nex,
unsigned *word)
{
assert(nex);
@ -1015,7 +1015,7 @@ static ivl_scope_t *scopes_to_emit = 0;
static unsigned num_scopes_to_emit = 0;
static unsigned emitting_scopes = 0;
int emit_scope(ivl_scope_t scope, ivl_scope_t parent)
int emit_scope(ivl_scope_t scope, const ivl_scope_t parent)
{
char *package_name = 0;
ivl_scope_type_t sc_type = ivl_scope_type(scope);

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2021 Cary R. (cygcary@yahoo.com)
* Copyright (C) 2011-2022 Cary R. (cygcary@yahoo.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1085,7 +1085,7 @@ static void emit_stmt_delayx(ivl_scope_t scope, ivl_statement_t stmt)
emit_stmt(scope, ivl_stmt_sub_stmt(stmt));
}
static unsigned is_func_disable(ivl_scope_t scope, ivl_scope_t disable_scope)
static unsigned is_func_disable(ivl_scope_t scope, const ivl_scope_t disable_scope)
{
assert(func_rtn_name);
/* Find the enclosing function scope. */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2022 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
@ -280,7 +280,7 @@ static char* draw_net_pull(ivl_net_logic_t lptr, ivl_drive_t drive, const char*l
* to this nexus.
*/
static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
static char* draw_net_input_drive(const ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
{
unsigned nptr_pin = ivl_nexus_ptr_pin(nptr);
ivl_net_const_t cptr;
@ -817,7 +817,7 @@ const char*draw_net_input(ivl_nexus_t nex)
return nex_data->net_input;
}
const char*draw_island_net_input(ivl_island_t island, ivl_nexus_t nex)
const char*draw_island_net_input(const ivl_island_t island, ivl_nexus_t nex)
{
struct vvp_nexus_data*nex_data = (struct vvp_nexus_data*)
ivl_nexus_get_private(nex);

View File

@ -262,7 +262,7 @@ const char*drive_string(ivl_drive_t drive)
* to netlist signals. This routine performs this check on the
* given nexus.
*/
static unsigned is_netlist_signal(ivl_net_logic_t net, ivl_nexus_t nex)
static unsigned is_netlist_signal(const ivl_net_logic_t net, ivl_nexus_t nex)
{
unsigned idx, rtn;

View File

@ -3,177 +3,184 @@
// problems will not be fixed.
// fstapi.c from GTKWave
asctimeCalled:fstapi.c:955
allocaCalled:fstapi.c:2386
unreadVariable:fstapi.c:204
unreadVariable:fstapi.c:205
unreadVariable:fstapi.c:1645
unreadVariable:fstapi.c:1653
unreadVariable:fstapi.c:1657
unreadVariable:fstapi.c:1662
unreadVariable:fstapi.c:1685
unreadVariable:fstapi.c:1691
unreadVariable:fstapi.c:1692
unreadVariable:fstapi.c:1696
unreadVariable:fstapi.c:2818
unreadVariable:fstapi.c:6521
variableScope:fstapi.c:684
variableScope:fstapi.c:1078
variableScope:fstapi.c:1385
variableScope:fstapi.c:1386
variableScope:fstapi.c:1387
variableScope:fstapi.c:1444
variableScope:fstapi.c:2056
variableScope:fstapi.c:2189
variableScope:fstapi.c:2622
variableScope:fstapi.c:2623
variableScope:fstapi.c:2812
variableScope:fstapi.c:2813
variableScope:fstapi.c:2814
variableScope:fstapi.c:2815
variableScope:fstapi.c:2816
variableScope:fstapi.c:2817
variableScope:fstapi.c:2818
variableScope:fstapi.c:2919
variableScope:fstapi.c:2920
variableScope:fstapi.c:2924
variableScope:fstapi.c:3161
variableScope:fstapi.c:3200
variableScope:fstapi.c:3201
variableScope:fstapi.c:3920
variableScope:fstapi.c:4098
variableScope:fstapi.c:4100
variableScope:fstapi.c:4542
variableScope:fstapi.c:4543
variableScope:fstapi.c:4552
variableScope:fstapi.c:4815
variableScope:fstapi.c:5086
variableScope:fstapi.c:5089
variableScope:fstapi.c:5585
variableScope:fstapi.c:5589
variableScope:fstapi.c:5590
variableScope:fstapi.c:5748
variableScope:fstapi.c:5806
variableScope:fstapi.c:6119
variableScope:fstapi.c:6122
variableScope:fstapi.c:6416
variableScope:fstapi.c:6521
variableScope:fstapi.c:6522
variableScope:fstapi.c:6553
variableScope:fstapi.c:6781
variableScope:fstapi.c:6957
variableScope:fstapi.c:6958
variableScope:fstapi.c:6959
asctimeCalled:fstapi.c:965
allocaCalled:fstapi.c:2396
unreadVariable:fstapi.c:214
unreadVariable:fstapi.c:215
unreadVariable:fstapi.c:1655
unreadVariable:fstapi.c:1663
unreadVariable:fstapi.c:1667
unreadVariable:fstapi.c:1672
unreadVariable:fstapi.c:1695
unreadVariable:fstapi.c:1701
unreadVariable:fstapi.c:1702
unreadVariable:fstapi.c:1706
unreadVariable:fstapi.c:2828
unreadVariable:fstapi.c:6555
variableScope:fstapi.c:694
variableScope:fstapi.c:1088
variableScope:fstapi.c:1395
variableScope:fstapi.c:1396
variableScope:fstapi.c:1397
variableScope:fstapi.c:1454
variableScope:fstapi.c:1944
variableScope:fstapi.c:2064
variableScope:fstapi.c:2066
variableScope:fstapi.c:2187
variableScope:fstapi.c:2199
variableScope:fstapi.c:2632
variableScope:fstapi.c:2633
variableScope:fstapi.c:2822
variableScope:fstapi.c:2823
variableScope:fstapi.c:2824
variableScope:fstapi.c:2825
variableScope:fstapi.c:2826
variableScope:fstapi.c:2827
variableScope:fstapi.c:2828
variableScope:fstapi.c:2929
variableScope:fstapi.c:2930
variableScope:fstapi.c:2934
variableScope:fstapi.c:3171
variableScope:fstapi.c:3210
variableScope:fstapi.c:3211
variableScope:fstapi.c:3927
variableScope:fstapi.c:3930
variableScope:fstapi.c:4108
variableScope:fstapi.c:4110
variableScope:fstapi.c:4578
variableScope:fstapi.c:4579
variableScope:fstapi.c:4582
variableScope:fstapi.c:4583
variableScope:fstapi.c:4591
variableScope:fstapi.c:4592
variableScope:fstapi.c:4854
variableScope:fstapi.c:5120
variableScope:fstapi.c:5123
variableScope:fstapi.c:5619
variableScope:fstapi.c:5623
variableScope:fstapi.c:5624
variableScope:fstapi.c:5782
variableScope:fstapi.c:5840
variableScope:fstapi.c:6153
variableScope:fstapi.c:6156
variableScope:fstapi.c:6450
variableScope:fstapi.c:6555
variableScope:fstapi.c:6556
variableScope:fstapi.c:6587
variableScope:fstapi.c:6815
variableScope:fstapi.c:6991
variableScope:fstapi.c:6992
variableScope:fstapi.c:6993
// These functions are not used by Icarus
// fstReaderClrFacProcessMask()
unusedFunction:fstapi.c:3652
unusedFunction:fstapi.c:3662
// fstReaderClrFacProcessMaskAll()
unusedFunction:fstapi.c:3681
unusedFunction:fstapi.c:3691
// fstReaderGetAliasCount()
unusedFunction:fstapi.c:3744
unusedFunction:fstapi.c:3754
// fstReaderGetCurrentFlatScope()
unusedFunction:fstapi.c:3490
unusedFunction:fstapi.c:3500
// fstReaderGetCurrentScopeLen()
unusedFunction:fstapi.c:3587
unusedFunction:fstapi.c:3597
// fstReaderGetCurrentScopeUserInfo()
unusedFunction:fstapi.c:3504
unusedFunction:fstapi.c:3514
// fstReaderGetDateString()
unusedFunction:fstapi.c:3772
unusedFunction:fstapi.c:3782
// fstReaderGetDoubleEndianMatchState()
unusedFunction:fstapi.c:3758
unusedFunction:fstapi.c:3768
// fstReaderGetDumpActivityChangeTime()
unusedFunction:fstapi.c:3800
unusedFunction:fstapi.c:3810
// fstReaderGetDumpActivityChangeValue()
unusedFunction:fstapi.c:3815
unusedFunction:fstapi.c:3825
// fstReaderGetEndTime()
unusedFunction:fstapi.c:3709
unusedFunction:fstapi.c:3719
// fstReaderGetFacProcessMask()
unusedFunction:fstapi.c:3615
unusedFunction:fstapi.c:3625
// fstReaderGetFileType()
unusedFunction:fstapi.c:3779
unusedFunction:fstapi.c:3789
// fstReaderGetFseekFailed()
unusedFunction:fstapi.c:3600
unusedFunction:fstapi.c:3610
// fstReaderGetMaxHandle()
unusedFunction:fstapi.c:3737
unusedFunction:fstapi.c:3747
// fstReaderGetMemoryUsedByWriter()
unusedFunction:fstapi.c:3716
unusedFunction:fstapi.c:3726
// fstReaderGetNumberDumpActivityChanges()
unusedFunction:fstapi.c:3793
unusedFunction:fstapi.c:3803
// fstReaderGetScopeCount()
unusedFunction:fstapi.c:3723
unusedFunction:fstapi.c:3733
// fstReaderGetStartTime()
unusedFunction:fstapi.c:3702
unusedFunction:fstapi.c:3712
// fstReaderGetTimescale()
unusedFunction:fstapi.c:3695
unusedFunction:fstapi.c:3705
// fstReaderGetTimezero()
unusedFunction:fstapi.c:3786
unusedFunction:fstapi.c:3796
// fstReaderGetValueChangeSectionCount()
unusedFunction:fstapi.c:3751
unusedFunction:fstapi.c:3761
// fstReaderGetValueFromHandleAtTime()
unusedFunction:fstapi.c:6001
unusedFunction:fstapi.c:6035
// fstReaderGetVarCount()
unusedFunction:fstapi.c:3730
unusedFunction:fstapi.c:3740
// fstReaderGetVersionString()
unusedFunction:fstapi.c:3765
unusedFunction:fstapi.c:3775
// fstReaderIterBlocks()
unusedFunction:fstapi.c:4964
unusedFunction:fstapi.c:5003
// fstReaderIterBlocksSetNativeDoublesOnCallback()
unusedFunction:fstapi.c:3865
unusedFunction:fstapi.c:3875
// fstReaderIterateHier()
unusedFunction:fstapi.c:4094
unusedFunction:fstapi.c:4104
// fstReaderIterateHierRewind()
unusedFunction:fstapi.c:4074
unusedFunction:fstapi.c:4084
// fstReaderOpen()
unusedFunction:fstapi.c:4862
unusedFunction:fstapi.c:4901
// fstReaderOpenForUtilitiesOnly()
unusedFunction:fstapi.c:4854
unusedFunction:fstapi.c:4893
// fstReaderPushScope()
unusedFunction:fstapi.c:3552
unusedFunction:fstapi.c:3562
// fstReaderResetScope()
unusedFunction:fstapi.c:3541
unusedFunction:fstapi.c:3551
// fstReaderSetFacProcessMask()
unusedFunction:fstapi.c:3634
unusedFunction:fstapi.c:3644
// fstReaderSetFacProcessMaskAll()
unusedFunction:fstapi.c:3670
unusedFunction:fstapi.c:3680
// fstReaderSetLimitTimeRange()
unusedFunction:fstapi.c:3830
unusedFunction:fstapi.c:3840
// fstReaderSetUnlimitedTimeRange()
unusedFunction:fstapi.c:3843
unusedFunction:fstapi.c:3853
// fstReaderSetVcdExtensions()
unusedFunction:fstapi.c:3854
unusedFunction:fstapi.c:3864
// fstUtilityExtractEnumTableFromString()
unusedFunction:fstapi.c:6954
unusedFunction:fstapi.c:6988
// fstUtilityFreeEnumTable()
unusedFunction:fstapi.c:7015
unusedFunction:fstapi.c:7049
// fstWriterCreateEnumTable()
unusedFunction:fstapi.c:2807
unusedFunction:fstapi.c:2817
// fstWriterCreateVar2()
unusedFunction:fstapi.c:2609
unusedFunction:fstapi.c:2619
// fstWriterEmitEnumTableRef()
unusedFunction:fstapi.c:2902
unusedFunction:fstapi.c:2912
// fstWriterEmitValueChangeVec32()
unusedFunction:fstapi.c:3054
unusedFunction:fstapi.c:3064
// fstWriterEmitValueChangeVec64()
unusedFunction:fstapi.c:3103
unusedFunction:fstapi.c:3113
// fstWriterEmitVariableLengthValueChange()
unusedFunction:fstapi.c:3154
unusedFunction:fstapi.c:3164
// fstWriterGetFseekFailed()
unusedFunction:fstapi.c:2592
unusedFunction:fstapi.c:2602
// fstWriterSetAttrEnd()
unusedFunction:fstapi.c:2795
unusedFunction:fstapi.c:2805
// fstWriterSetComment()
unusedFunction:fstapi.c:2441
unusedFunction:fstapi.c:2451
// fstWriterSetEnvVar()
unusedFunction:fstapi.c:2453
unusedFunction:fstapi.c:2463
// fstWriterSetFileType()
unusedFunction:fstapi.c:2316
unusedFunction:fstapi.c:2326
// fstWriterSetParallelMode()
unusedFunction:fstapi.c:2552
unusedFunction:fstapi.c:2562
// fstWriterSetTimezero()
unusedFunction:fstapi.c:2517
unusedFunction:fstapi.c:2527
// fstWriterSetValueList()
unusedFunction:fstapi.c:2447
unusedFunction:fstapi.c:2457
// lxt2_write.c from GTKWave
allocaCalled:lxt2_write.c:1813
@ -335,7 +342,7 @@ unusedFunction:lz4.c:376
// The routines in sys_random.c are exact copies from IEEE1364-2005 and
// they have scope warnings that we need to ignore.
variableScope:sys_random.c:46
variableScope:sys_random.c:69
variableScope:sys_random.c:92
variableScope:sys_random.c:147
variableScope:sys_random.c:47
variableScope:sys_random.c:70
variableScope:sys_random.c:93
variableScope:sys_random.c:148

View File

@ -1,5 +1,5 @@
/*
* NOTE: This code as been slightly modified to interface with the
* NOTE: This code has been slightly modified to interface with the
* PLI implementations of $random. The copyright and license
* information are given in the comment block below.
*
@ -89,7 +89,7 @@ genrand(struct context_s *context)
if (mti >= N) { /* generate N words at one time */
/* mag01[x] = x * MATRIX_A for x=0,1 */
static unsigned long mag01[2]={0x0, MATRIX_A};
static const unsigned long mag01[2]={0x0, MATRIX_A};
int kk;
if (mti == N+1) /* if sgenrand() has not been called, */

View File

@ -334,7 +334,7 @@ int __vpiArrayWord::as_word_t::vpi_get(int code)
{
struct __vpiArrayWord*obj = array_var_word_from_handle(this);
assert(obj);
struct __vpiArrayBase*parent = obj->get_parent();
struct __vpiArrayBase*my_parent = obj->get_parent();
t_vpi_value val;
switch (code) {
@ -342,24 +342,24 @@ int __vpiArrayWord::as_word_t::vpi_get(int code)
return 0; // Not implemented for now!
case vpiSize:
return parent->get_word_size();
return my_parent->get_word_size();
case vpiLeftRange:
val.format = vpiIntVal;
parent->get_left_range()->vpi_get_value(&val);
my_parent->get_left_range()->vpi_get_value(&val);
assert(val.format == vpiIntVal);
return val.value.integer;
case vpiRightRange:
val.format = vpiIntVal;
parent->get_right_range()->vpi_get_value(&val);
my_parent->get_right_range()->vpi_get_value(&val);
assert(val.format == vpiIntVal);
return val.value.integer;
case vpiIndex:
{
int base_offset = 0;
struct __vpiArray*base = dynamic_cast<__vpiArray*> (parent);
struct __vpiArray*base = dynamic_cast<__vpiArray*> (my_parent);
if (base) {
val.format = vpiIntVal;
base->first_addr.vpi_get_value(&val);
@ -372,7 +372,7 @@ int __vpiArrayWord::as_word_t::vpi_get(int code)
}
case vpiAutomatic:
return parent->get_scope()->is_automatic()? 1 : 0;
return my_parent->get_scope()->is_automatic()? 1 : 0;
#if defined(CHECK_WITH_VALGRIND) || defined(BR916_STOPGAP_FIX)
case _vpiFromThr:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Stephen Williams (steve@icarus.com)
* Copyright (c) 2014-2022 Stephen Williams (steve@icarus.com)
* Copyright (c) 2014 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -116,24 +116,24 @@ char* __vpiArrayWord::as_word_t::vpi_get_str(int code)
{
struct __vpiArrayWord*obj = array_var_word_from_handle(this);
assert(obj);
struct __vpiArrayBase*parent = obj->get_parent();
return parent->get_word_str(obj, code);
struct __vpiArrayBase*my_parent = obj->get_parent();
return my_parent->get_word_str(obj, code);
}
void __vpiArrayWord::as_word_t::vpi_get_value(p_vpi_value vp)
{
struct __vpiArrayWord*obj = array_var_word_from_handle(this);
assert(obj);
struct __vpiArrayBase*parent = obj->get_parent();
return parent->get_word_value(obj, vp);
struct __vpiArrayBase*my_parent = obj->get_parent();
return my_parent->get_word_value(obj, vp);
}
vpiHandle __vpiArrayWord::as_word_t::vpi_put_value(p_vpi_value vp, int flags)
{
struct __vpiArrayWord*obj = array_var_word_from_handle(this);
assert(obj);
struct __vpiArrayBase*parent = obj->get_parent();
parent->put_word_value(obj, vp, flags);
struct __vpiArrayBase*my_parent = obj->get_parent();
my_parent->put_word_value(obj, vp, flags);
return this;
}
@ -141,7 +141,7 @@ vpiHandle __vpiArrayWord::as_word_t::vpi_handle(int code)
{
struct __vpiArrayWord*obj = array_var_word_from_handle(this);
assert(obj);
struct __vpiArrayBase*parent = obj->get_parent();
struct __vpiArrayBase*my_parent = obj->get_parent();
switch (code) {
@ -149,19 +149,19 @@ vpiHandle __vpiArrayWord::as_word_t::vpi_handle(int code)
return &(obj->as_index);
case vpiLeftRange:
return parent->get_left_range();
return my_parent->get_left_range();
case vpiRightRange:
return parent->get_right_range();
return my_parent->get_right_range();
case vpiParent:
return dynamic_cast<vpiHandle>(parent);
return dynamic_cast<vpiHandle>(my_parent);
case vpiScope:
return parent->get_scope();
return my_parent->get_scope();
case vpiModule:
return vpip_module(parent->get_scope());
return vpip_module(my_parent->get_scope());
}
return 0;

View File

@ -1,6 +1,6 @@
// The new() operator is always used to allocate space for this class and
// pool is defined there.
uninitMemberVar:vvp_net.cc:190
uninitMemberVar:vvp_net.cc:192
// These functions are not used by Icarus
// vpi_chk_error()

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2022 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
@ -185,7 +185,7 @@ void vvp_island_tran::count_drivers(vvp_island_port*port, unsigned bit_idx,
void vvp_island_branch_tran::run_test_enabled()
{
vvp_island_port*ep = en? dynamic_cast<vvp_island_port*> (en->fun) : 0;
vvp_island_port*ep = en? dynamic_cast<vvp_island_port*> (en->fun) : NULL;
// If there is no ep port (no "enabled" input) then this is a
// tran branch. Assume it is always enabled.

View File

@ -1,7 +1,7 @@
%{
/*
* Copyright (c) 2001-202` Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2022 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2022 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
@ -461,7 +461,7 @@ static struct __vpiCallback* make_at_end_of_sim_time(p_cb_data data)
class simulator_callback : public __vpiCallback {
public:
inline explicit simulator_callback(struct t_cb_data*data)
inline explicit simulator_callback(const struct t_cb_data*data)
{ cb_data = *data; }
public:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2021 Picture Elements, Inc.
* Copyright (c) 2012-2022 Picture Elements, Inc.
* Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -117,7 +117,7 @@ void __vpiCobjectVar::vpi_get_value(p_vpi_value val)
vpiHandle vpip_make_cobject_var(const char*name, vvp_net_t*net)
{
__vpiScope*scope = vpip_peek_current_scope();
const char*use_name = name ? vpip_name_string(name) : 0;
const char*use_name = name ? vpip_name_string(name) : NULL;
__vpiCobjectVar*obj = new __vpiCobjectVar(scope, use_name, net);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2012-2022 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
@ -286,7 +286,7 @@ vvp_darray*__vpiDarrayVar::get_vvp_darray() const
vpiHandle vpip_make_darray_var(const char*name, vvp_net_t*net)
{
__vpiScope*scope = vpip_peek_current_scope();
const char*use_name = name ? vpip_name_string(name) : 0;
const char*use_name = name ? vpip_name_string(name) : NULL;
__vpiDarrayVar*obj = new __vpiDarrayVar(scope, use_name, net);
@ -332,7 +332,7 @@ void __vpiQueueVar::vpi_get_value(p_vpi_value val)
vpiHandle vpip_make_queue_var(const char*name, vvp_net_t*net)
{
__vpiScope*scope = vpip_peek_current_scope();
const char*use_name = name ? vpip_name_string(name) : 0;
const char*use_name = name ? vpip_name_string(name) : NULL;
__vpiQueueVar*obj = new __vpiQueueVar(scope, use_name, net);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2022 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
@ -1057,7 +1057,7 @@ void vpip_put_value_event::run_run()
}
/* Make a copy of a pointer to a time structure. */
static t_vpi_time *timedup(t_vpi_time *val)
static t_vpi_time *timedup(const t_vpi_time *val)
{
t_vpi_time *rtn;
rtn = static_cast<t_vpi_time *> (malloc(sizeof(t_vpi_time)));
@ -1078,7 +1078,7 @@ static t_vpi_vecval *vectordup(t_vpi_vecval *val, PLI_INT32 size)
}
/* Make a copy of a pointer to a strength structure. */
static t_vpi_strengthval *strengthdup(t_vpi_strengthval *val)
static t_vpi_strengthval *strengthdup(const t_vpi_strengthval *val)
{
t_vpi_strengthval *rtn;
rtn = static_cast<t_vpi_strengthval *>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2022 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
@ -86,10 +86,10 @@ static vpiHandle real_var_get_handle(int code, vpiHandle ref)
switch (code) {
case vpiParent:
return rfp->is_netarray ? rfp->within.parent : 0;
return rfp->is_netarray ? rfp->within.parent : NULL;
case vpiIndex:
return rfp->is_netarray ? rfp->id.index : 0;
return rfp->is_netarray ? rfp->id.index : NULL;
case vpiScope:
return vpip_scope(rfp);
@ -107,7 +107,7 @@ static vpiHandle real_var_iterate(int code, vpiHandle ref)
assert(rfp);
if (code == vpiIndex) {
return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : 0;
return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : NULL;
}
return 0;
@ -183,7 +183,7 @@ static vpiHandle vpip_make_real_(__vpiScope*scope, const char*name,
{
struct __vpiRealVar*obj = new __vpiRealVar;
obj->id.name = name ? vpip_name_string(name) : 0;
obj->id.name = name ? vpip_name_string(name) : NULL;
obj->is_netarray = 0;
obj->is_wire = is_wire;
obj->net = net;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2022 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
@ -639,10 +639,10 @@ static vpiHandle signal_get_handle(int code, vpiHandle ref)
switch (code) {
case vpiParent:
return rfp->is_netarray? rfp->within.parent : 0;
return rfp->is_netarray? rfp->within.parent : NULL;
case vpiIndex:
return rfp->is_netarray? rfp->id.index : 0;
return rfp->is_netarray? rfp->id.index : NULL;
case vpiLeftRange:
return &rfp->msb;
@ -665,7 +665,7 @@ static vpiHandle signal_iterate(int code, vpiHandle ref)
assert(rfp);
if (code == vpiIndex) {
return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : 0;
return rfp->is_netarray ? rfp->id.index->vpi_iterate(code) : NULL;
}
return 0;
@ -1266,7 +1266,7 @@ static vpiHandle fill_in_net4(struct __vpiSignal*obj, __vpiScope*scope,
const char*name, int msb, int lsb,
bool signed_flag, vvp_net_t*node)
{
obj->id.name = name? vpip_name_string(name) : 0;
obj->id.name = name? vpip_name_string(name) : NULL;
obj->msb = __vpiDecConst(msb);
obj->lsb = __vpiDecConst(lsb);
obj->signed_flag = signed_flag? 1 : 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2015 Stephen Williams (steve@icarus.com)
* Copyright (c) 2012-2022 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
@ -92,7 +92,7 @@ vpiHandle __vpiStringVar::vpi_put_value(p_vpi_value val, int)
vpiHandle vpip_make_string_var(const char*name, vvp_net_t*net)
{
__vpiScope*scope = vpip_peek_current_scope();
const char*use_name = name ? vpip_name_string(name) : 0;
const char*use_name = name ? vpip_name_string(name) : NULL;
__vpiStringVar*obj = new __vpiStringVar(scope, use_name, net);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2001-2022 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
@ -3204,7 +3204,7 @@ bool of_FLAG_SET_IMM(vthread_t thr, vvp_code_t cp)
assert(flag < vthread_s::FLAGS_COUNT);
assert(vali >= 0 && vali < 4);
static vvp_bit4_t map_bit[4] = {BIT4_0, BIT4_1, BIT4_Z, BIT4_X};
static const vvp_bit4_t map_bit[4] = {BIT4_0, BIT4_1, BIT4_Z, BIT4_X};
thr->flags[flag] = map_bit[vali];
return true;
}
@ -5162,12 +5162,12 @@ inline void push_value(vthread_t thr, double value, unsigned)
thr->push_real(value);
}
inline void push_value(vthread_t thr, string value, unsigned)
inline void push_value(vthread_t thr, const string&value, unsigned)
{
thr->push_str(value);
}
inline void push_value(vthread_t thr, vvp_vector4_t value, unsigned wid)
inline void push_value(vthread_t thr, const vvp_vector4_t&value, unsigned wid)
{
assert(wid == value.size());
thr->push_vec4(value);
@ -5357,7 +5357,7 @@ static void poke_val(vthread_t fun_thr, unsigned depth, double val)
fun_thr->parent->poke_real(depth, val);
}
static void poke_val(vthread_t fun_thr, unsigned depth, string val)
static void poke_val(vthread_t fun_thr, unsigned depth, const string&val)
{
fun_thr->parent->poke_str(depth, val);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2008-2022 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
@ -34,7 +34,9 @@
using namespace std;
#ifdef CHECK_WITH_VALGRIND
static bool at_EOS = false;
#endif
void island_send_value(vvp_net_t*net, const vvp_vector8_t&val)
{
@ -61,7 +63,9 @@ vvp_island::vvp_island()
vvp_island::~vvp_island()
{
// We can only delete islands at the end of simulation.
#ifdef CHECK_WITH_VALGRIND
if (!at_EOS) assert(0);
#endif
while (branches_) {
vvp_island_branch *next_br = branches_->next_branch;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2003-2022 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
@ -373,7 +373,7 @@ static void __compile_net(char*label,
int vpi_type_code, bool signed_flag, bool local_flag,
unsigned argc, struct symb_s*argv)
{
vvp_array_t array = array_label? array_find(array_label) : 0;
vvp_array_t array = array_label? array_find(array_label) : NULL;
assert(array_label ? array!=0 : true);
free(array_label);
@ -503,7 +503,7 @@ static void __compile_real(char*label, char*name,
unsigned argc, struct symb_s*argv)
{
assert(msb == 0 && lsb == 0);
vvp_array_t array = array_label ? array_find(array_label) : 0;
vvp_array_t array = array_label ? array_find(array_label) : NULL;
assert(array_label ? array!=0 : true);
free(array_label);