More cppcheck fixes - part 2

This commit is contained in:
Cary R 2025-10-20 22:45:05 -07:00
parent 08c8ee081a
commit 860761f9c6
58 changed files with 784 additions and 784 deletions

View File

@ -1,7 +1,7 @@
#ifndef IVL_PClass_H #ifndef IVL_PClass_H
#define IVL_PClass_H #define IVL_PClass_H
/* /*
* Copyright (c) 2012-2019 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -36,11 +36,11 @@ class PClass : public PScopeExtra, public PNamedItem {
public: public:
explicit PClass (perm_string name, LexicalScope*parent); explicit PClass (perm_string name, LexicalScope*parent);
~PClass(); ~PClass() override;
void dump(std::ostream&out, unsigned indent) const; void dump(std::ostream&out, unsigned indent) const;
SymbolType symbol_type() const; SymbolType symbol_type() const override;
public: public:
class_type_t*type; class_type_t*type;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -132,8 +132,8 @@ static NetExpr* make_delay_nets(Design*des, NetScope*scope, NetExpr*expr)
static NetExpr* calc_decay_time(NetExpr *rise, NetExpr *fall) static NetExpr* calc_decay_time(NetExpr *rise, NetExpr *fall)
{ {
NetEConst *c_rise = dynamic_cast<NetEConst*>(rise); const NetEConst *c_rise = dynamic_cast<NetEConst*>(rise);
NetEConst *c_fall = dynamic_cast<NetEConst*>(fall); const NetEConst *c_fall = dynamic_cast<NetEConst*>(fall);
if (c_rise && c_fall) { if (c_rise && c_fall) {
if (c_rise->value() < c_fall->value()) return rise; if (c_rise->value() < c_fall->value()) return rise;
else return fall; else return fall;

View File

@ -1,7 +1,7 @@
#ifndef IVL_PEvent_H #ifndef IVL_PEvent_H
#define IVL_PEvent_H #define IVL_PEvent_H
/* /*
* Copyright (c) 2000-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -37,7 +37,7 @@ class PEvent : public PNamedItem {
// The name is a perm-allocated string. It is the simple name // The name is a perm-allocated string. It is the simple name
// of the event, without any scope. // of the event, without any scope.
explicit PEvent(perm_string name, unsigned lexical_pos); explicit PEvent(perm_string name, unsigned lexical_pos);
~PEvent(); ~PEvent() override;
perm_string name() const; perm_string name() const;
@ -45,7 +45,7 @@ class PEvent : public PNamedItem {
void elaborate_scope(Design*des, NetScope*scope) const; void elaborate_scope(Design*des, NetScope*scope) const;
SymbolType symbol_type() const; SymbolType symbol_type() const override;
private: private:
perm_string name_; perm_string name_;

View File

@ -1,7 +1,7 @@
#ifndef IVL_PModport_H #ifndef IVL_PModport_H
#define IVL_PModport_H #define IVL_PModport_H
/* /*
* Copyright (c) 2015-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2015-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -34,14 +34,14 @@ class PModport : public PNamedItem {
// The name is a perm-allocated string. It is the simple name // The name is a perm-allocated string. It is the simple name
// of the modport, without any scope. // of the modport, without any scope.
explicit PModport(perm_string name); explicit PModport(perm_string name);
~PModport(); ~PModport() override;
perm_string name() const { return name_; } perm_string name() const { return name_; }
typedef std::pair <NetNet::PortType,PExpr*> simple_port_t; typedef std::pair <NetNet::PortType,PExpr*> simple_port_t;
std::map<perm_string,simple_port_t> simple_ports; std::map<perm_string,simple_port_t> simple_ports;
SymbolType symbol_type() const; SymbolType symbol_type() const override;
private: private:
perm_string name_; perm_string name_;

View File

@ -1,7 +1,7 @@
#ifndef IVL_PNamedItem_H #ifndef IVL_PNamedItem_H
#define IVL_PNamedItem_H #define IVL_PNamedItem_H
/* /*
* Copyright (c) 2019 Martin Whitaker (icarus@martin-whitaker.me.uk) * Copyright (c) 2019-2025 Martin Whitaker (icarus@martin-whitaker.me.uk)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -34,7 +34,7 @@ class PNamedItem : virtual public LineInfo {
INSTANCE }; INSTANCE };
explicit PNamedItem(); explicit PNamedItem();
virtual ~PNamedItem(); virtual ~PNamedItem() override;
virtual SymbolType symbol_type() const; virtual SymbolType symbol_type() const;
}; };
@ -49,9 +49,9 @@ class PGenvar : public PNamedItem {
public: public:
explicit PGenvar(); explicit PGenvar();
virtual ~PGenvar(); virtual ~PGenvar() override;
SymbolType symbol_type() const; SymbolType symbol_type() const override;
}; };
#endif /* IVL_PNamedItem_H */ #endif /* IVL_PNamedItem_H */

View File

@ -1,7 +1,7 @@
#ifndef IVL_PPackage_H #ifndef IVL_PPackage_H
#define IVL_PPackage_H #define IVL_PPackage_H
/* /*
* Copyright (c) 2012-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -36,7 +36,7 @@ class PPackage : public PScopeExtra, public LineInfo {
public: public:
explicit PPackage (perm_string name, LexicalScope*parent); explicit PPackage (perm_string name, LexicalScope*parent);
~PPackage(); ~PPackage() override;
bool elaborate_scope(Design*des, NetScope*scope); bool elaborate_scope(Design*des, NetScope*scope);
bool elaborate_sig(Design*des, NetScope*scope) const; bool elaborate_sig(Design*des, NetScope*scope) const;

View File

@ -1,7 +1,7 @@
#ifndef IVL_PScope_H #ifndef IVL_PScope_H
#define IVL_PScope_H #define IVL_PScope_H
/* /*
* Copyright (c) 2008-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 2008-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -198,7 +198,7 @@ class PScope : public LexicalScope {
// modules. Scopes for tasks and functions point to their // modules. Scopes for tasks and functions point to their
// containing module. // containing module.
explicit PScope(perm_string name, LexicalScope*parent =0); explicit PScope(perm_string name, LexicalScope*parent =0);
virtual ~PScope(); virtual ~PScope() override;
perm_string pscope_name() const { return name_; } perm_string pscope_name() const { return name_; }
@ -233,7 +233,7 @@ class PScopeExtra : public PScope {
public: public:
explicit PScopeExtra(perm_string, LexicalScope*parent =0); explicit PScopeExtra(perm_string, LexicalScope*parent =0);
~PScopeExtra(); ~PScopeExtra() override;
/* Task definitions within this module */ /* Task definitions within this module */
std::map<perm_string,PTask*> tasks; std::map<perm_string,PTask*> tasks;

View File

@ -1,7 +1,7 @@
#ifndef IVL_PSpec_H #ifndef IVL_PSpec_H
#define IVL_PSpec_H #define IVL_PSpec_H
/* /*
* Copyright (c) 2006-2014 Stephen Williams <steve@icarus.com> * Copyright (c) 2006-2025 Stephen Williams <steve@icarus.com>
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -60,7 +60,7 @@ class PSpecPath : public LineInfo {
PSpecPath(const std::list<perm_string> &src_list, PSpecPath(const std::list<perm_string> &src_list,
const std::list<perm_string> &dst_list, const std::list<perm_string> &dst_list,
char polarity, bool full_flag); char polarity, bool full_flag);
~PSpecPath(); ~PSpecPath() override;
void elaborate(class Design*des, class NetScope*scope) const; void elaborate(class Design*des, class NetScope*scope) const;

View File

@ -1,10 +1,10 @@
// These are correct and are used to find the base (zero) pin. // These are correct and are used to find the base (zero) pin.
thisSubtraction:netlist.h:5244 thisSubtraction:netlist.h:5311
thisSubtraction:netlist.h:5253 thisSubtraction:netlist.h:5320
// This is used when running a debugger // This is used when running a debugger
// debugger_release // debugger_release
knownConditionTrueFalse:main.cc:921 knownConditionTrueFalse:main.cc:931
// This are just stubs // This are just stubs
// vpi_control() // vpi_control()

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -41,14 +41,14 @@ struct cprop_functor : public functor_t {
unsigned count; unsigned count;
virtual void signal(Design*des, NetNet*obj); virtual void signal(Design*des, NetNet*obj) override;
virtual void lpm_add_sub(Design*des, NetAddSub*obj); virtual void lpm_add_sub(Design*des, NetAddSub*obj) override;
virtual void lpm_compare(Design*des, const NetCompare*obj); virtual void lpm_compare(Design*des, const NetCompare*obj) override;
virtual void lpm_concat(Design*des, NetConcat*obj); virtual void lpm_concat(Design*des, NetConcat*obj) override;
virtual void lpm_ff(Design*des, NetFF*obj); virtual void lpm_ff(Design*des, NetFF*obj) override;
virtual void lpm_logic(Design*des, NetLogic*obj); virtual void lpm_logic(Design*des, NetLogic*obj) override;
virtual void lpm_mux(Design*des, NetMux*obj); virtual void lpm_mux(Design*des, NetMux*obj) override;
virtual void lpm_part_select(Design*des, NetPartSelect*obj); virtual void lpm_part_select(Design*des, NetPartSelect*obj) override;
void lpm_compare_eq_(Design*des, const NetCompare*obj); void lpm_compare_eq_(Design*des, const NetCompare*obj);
}; };
@ -90,7 +90,7 @@ void cprop_functor::lpm_concat(Design*des, NetConcat*obj)
unsigned off = 0; unsigned off = 0;
for (unsigned idx = 1 ; idx < obj->pin_count() ; idx += 1) { for (unsigned idx = 1 ; idx < obj->pin_count() ; idx += 1) {
Nexus*nex = obj->pin(idx).nexus(); const Nexus*nex = obj->pin(idx).nexus();
// If there are non-constant drivers, then give up. // If there are non-constant drivers, then give up.
if (! nex->drivers_constant()) if (! nex->drivers_constant())
return; return;
@ -156,7 +156,7 @@ void cprop_functor::lpm_mux(Design*des, NetMux*obj)
if (obj->sel_width() != 1) if (obj->sel_width() != 1)
return; return;
Nexus*sel_nex = obj->pin_Sel().nexus(); const Nexus*sel_nex = obj->pin_Sel().nexus();
/* If the select input is constant, then replace with a BUFZ */ /* If the select input is constant, then replace with a BUFZ */
@ -226,7 +226,7 @@ void cprop_functor::lpm_part_select(Design*des, NetPartSelect*obj)
NetPins*tmp_obj = cur->get_obj(); NetPins*tmp_obj = cur->get_obj();
// Record if we are driving a 2-state net. // Record if we are driving a 2-state net.
NetNet*net_obj = dynamic_cast<NetNet*> (tmp_obj); const NetNet*net_obj = dynamic_cast<NetNet*> (tmp_obj);
if (net_obj && (net_obj->data_type() == IVL_VT_BOOL)) if (net_obj && (net_obj->data_type() == IVL_VT_BOOL))
output_2_state = true; output_2_state = true;
@ -355,7 +355,7 @@ void cprop_functor::lpm_part_select(Design*des, NetPartSelect*obj)
*/ */
struct cprop_dc_functor : public functor_t { struct cprop_dc_functor : public functor_t {
virtual void lpm_const(Design*des, NetConst*obj); virtual void lpm_const(Design*des, NetConst*obj) override;
}; };
struct nexus_info_s { struct nexus_info_s {

View File

@ -341,7 +341,7 @@ NetExpr* PEAssignPattern::elaborate_expr_uarray_(Design *des, NetScope *scope,
// have a good way of passing the inner dimensions through the // have a good way of passing the inner dimensions through the
// generic elaborate_expr() API and assigment patterns is the only // generic elaborate_expr() API and assigment patterns is the only
// place where we need it. // place where we need it.
if (auto ap = dynamic_cast<PEAssignPattern*>(parms_[idx])) { if (const auto ap = dynamic_cast<PEAssignPattern*>(parms_[idx])) {
expr = ap->elaborate_expr_uarray_(des, scope, uarray_type, expr = ap->elaborate_expr_uarray_(des, scope, uarray_type,
dims, cur_dim, need_const); dims, cur_dim, need_const);
} else if (dynamic_cast<PEConcat*>(parms_[idx])) { } else if (dynamic_cast<PEConcat*>(parms_[idx])) {
@ -410,7 +410,7 @@ NetExpr* PEAssignPattern::elaborate_expr_packed_(Design *des, NetScope *scope,
// have a good way of passing the inner dimensions through the // have a good way of passing the inner dimensions through the
// generic elaborate_expr() API and assigment patterns is the only // generic elaborate_expr() API and assigment patterns is the only
// place where we need it. // place where we need it.
auto ap = dynamic_cast<PEAssignPattern*>(parms_[idx]); const auto ap = dynamic_cast<PEAssignPattern*>(parms_[idx]);
if (ap) if (ap)
expr = ap->elaborate_expr_packed_(des, scope, base_type, expr = ap->elaborate_expr_packed_(des, scope, base_type,
width, dims, cur_dim, need_const); width, dims, cur_dim, need_const);
@ -755,7 +755,7 @@ NetExpr* PEBinary::elaborate_expr_base_mult_(Design*,
} }
// Handle a few special case multiplies against constants. // Handle a few special case multiplies against constants.
if (NetEConst*rp_const = dynamic_cast<NetEConst*> (rp)) { if (const NetEConst*rp_const = dynamic_cast<NetEConst*> (rp)) {
verinum rp_val = rp_const->value(); verinum rp_val = rp_const->value();
if (!rp_val.is_defined() && (lp->expr_type() == IVL_VT_LOGIC)) { if (!rp_val.is_defined() && (lp->expr_type() == IVL_VT_LOGIC)) {
@ -1062,7 +1062,7 @@ unsigned PEBLeftWidth::test_width(Design*des, NetScope*scope, width_mode_t&mode)
delete right_; delete right_;
right_ = tmp; right_ = tmp;
} }
NetEConst*rc = dynamic_cast<NetEConst*> (rp); const NetEConst*rc = dynamic_cast<NetEConst*> (rp);
// Adjust the expression width that can be converter depending // Adjust the expression width that can be converter depending
// on if the R-value is signed or not. // on if the R-value is signed or not.
unsigned c_width = sizeof(long)*8; unsigned c_width = sizeof(long)*8;
@ -1086,7 +1086,7 @@ unsigned PEBLeftWidth::test_width(Design*des, NetScope*scope, width_mode_t&mode)
// If the left operand is a simple unsized number, we // If the left operand is a simple unsized number, we
// can calculate the actual width required for the power // can calculate the actual width required for the power
// operator. // operator.
PENumber*lc = dynamic_cast<PENumber*> (left_); const PENumber*lc = dynamic_cast<PENumber*> (left_);
// Now calculate the lossless width. // Now calculate the lossless width.
unsigned use_width = expr_width_; unsigned use_width = expr_width_;
@ -1259,7 +1259,7 @@ NetExpr*PEBShift::elaborate_expr_leaf(Design*des, NetExpr*lp, NetExpr*rp,
// there are some other interesting cases. But if neither are // there are some other interesting cases. But if neither are
// constant, then there is the general case. // constant, then there is the general case.
if (NetEConst*lpc = dynamic_cast<NetEConst*> (lp)) { if (const NetEConst*lpc = dynamic_cast<NetEConst*> (lp)) {
// Special case: The left expression is zero. If the // Special case: The left expression is zero. If the
// shift value contains no 'x' or 'z' bits, the result // shift value contains no 'x' or 'z' bits, the result
@ -1279,7 +1279,7 @@ NetExpr*PEBShift::elaborate_expr_leaf(Design*des, NetExpr*lp, NetExpr*rp,
return tmp; return tmp;
} }
} else if (NetEConst*rpc = dynamic_cast<NetEConst*> (rp)) { } else if (const NetEConst*rpc = dynamic_cast<NetEConst*> (rp)) {
// Special case: The shift value contains 'x' or 'z' bits. // Special case: The shift value contains 'x' or 'z' bits.
// Elaborate as a constant-x. // Elaborate as a constant-x.
@ -1382,7 +1382,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope,
return 0; return 0;
} }
NetExpr*nexpr = elab_and_eval(des, scope, pexpr, -1, true); const NetExpr*nexpr = elab_and_eval(des, scope, pexpr, -1, true);
if (nexpr == 0) { if (nexpr == 0) {
cerr << get_fileline() << ": error: " cerr << get_fileline() << ": error: "
<< "Unable to evaluate " << name << "Unable to evaluate " << name
@ -1560,7 +1560,7 @@ unsigned PECallFunction::test_width_method_(Design*, NetScope*,
if (search_results.net && search_results.net->data_type()==IVL_VT_DARRAY if (search_results.net && search_results.net->data_type()==IVL_VT_DARRAY
&& search_results.path_head.back().index.empty()) { && search_results.path_head.back().index.empty()) {
NetNet*net = search_results.net; const NetNet*net = search_results.net;
const netdarray_t*darray = net->darray_type(); const netdarray_t*darray = net->darray_type();
ivl_assert(*this, darray); ivl_assert(*this, darray);
@ -1583,7 +1583,7 @@ unsigned PECallFunction::test_width_method_(Design*, NetScope*,
if (search_results.net && search_results.net->data_type()==IVL_VT_QUEUE if (search_results.net && search_results.net->data_type()==IVL_VT_QUEUE
&& search_results.path_head.back().index.empty()) { && search_results.path_head.back().index.empty()) {
NetNet*net = search_results.net; const NetNet*net = search_results.net;
const netdarray_t*darray = net->darray_type(); const netdarray_t*darray = net->darray_type();
ivl_assert(*this, darray); ivl_assert(*this, darray);
@ -1616,7 +1616,7 @@ unsigned PECallFunction::test_width_method_(Design*, NetScope*,
&& (search_results.net->data_type()==IVL_VT_QUEUE || search_results.net->data_type()==IVL_VT_DARRAY) && (search_results.net->data_type()==IVL_VT_QUEUE || search_results.net->data_type()==IVL_VT_DARRAY)
&& search_results.path_head.back().index.size()) { && search_results.path_head.back().index.size()) {
NetNet*net = search_results.net; const NetNet*net = search_results.net;
const netdarray_t*darray = net->darray_type(); const netdarray_t*darray = net->darray_type();
ivl_assert(*this, darray); ivl_assert(*this, darray);
@ -1646,7 +1646,7 @@ unsigned PECallFunction::test_width_method_(Design*, NetScope*,
// Enumeration variable. Check for the various enumeration methods. // Enumeration variable. Check for the various enumeration methods.
if (search_results.net && search_results.net->enumeration()) { if (search_results.net && search_results.net->enumeration()) {
NetNet*net = search_results.net; const NetNet*net = search_results.net;
const netenum_t*enum_type = net->enumeration(); const netenum_t*enum_type = net->enumeration();
if (method_name=="first" || method_name=="last" if (method_name=="first" || method_name=="last"
@ -1692,7 +1692,7 @@ unsigned PECallFunction::test_width_method_(Design*, NetScope*,
} }
// Get the return value of the method function. // Get the return value of the method function.
if (NetNet*res = method->find_signal(method->basename())) { if (const NetNet*res = method->find_signal(method->basename())) {
expr_type_ = res->data_type(); expr_type_ = res->data_type();
expr_width_ = res->vector_width(); expr_width_ = res->vector_width();
min_width_ = expr_width_; min_width_ = expr_width_;
@ -1786,7 +1786,7 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope,
<< "." << endl; << "." << endl;
} }
NetNet*res = search_results.net; const NetNet*res = search_results.net;
expr_type_ = res->data_type(); expr_type_ = res->data_type();
expr_width_ = res->vector_width(); expr_width_ = res->vector_width();
min_width_ = expr_width_; min_width_ = expr_width_;
@ -1845,7 +1845,7 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope,
NetScope*dscope = def->scope(); NetScope*dscope = def->scope();
ivl_assert(*this, dscope); ivl_assert(*this, dscope);
if (NetNet*res = dscope->find_signal(dscope->basename())) { if (const NetNet*res = dscope->find_signal(dscope->basename())) {
expr_type_ = res->data_type(); expr_type_ = res->data_type();
expr_width_ = res->vector_width(); expr_width_ = res->vector_width();
min_width_ = expr_width_; min_width_ = expr_width_;
@ -1906,7 +1906,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope,
if (name=="$ivlh_to_unsigned") { if (name=="$ivlh_to_unsigned") {
ivl_assert(*this, parms_.size()==2); ivl_assert(*this, parms_.size()==2);
PExpr *expr = parms_[0].parm; const PExpr *expr = parms_[0].parm;
ivl_assert(*this, expr); ivl_assert(*this, expr);
NetExpr*sub = expr->elaborate_expr(des, scope, expr->expr_width(), flags); NetExpr*sub = expr->elaborate_expr(des, scope, expr->expr_width(), flags);
return cast_to_width_(sub, expr_wid); return cast_to_width_(sub, expr_wid);
@ -1934,7 +1934,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope,
cerr << get_fileline() << ": PECallFunction::elaborate_sfunc_: " cerr << get_fileline() << ": PECallFunction::elaborate_sfunc_: "
<< name << " expression is the argument cast to expr_wid=" << expr_wid << endl; << name << " expression is the argument cast to expr_wid=" << expr_wid << endl;
} }
PExpr *expr = parms_[0].parm; const PExpr *expr = parms_[0].parm;
NetExpr*sub = expr->elaborate_expr(des, scope, expr_width_, flags); NetExpr*sub = expr->elaborate_expr(des, scope, expr_width_, flags);
return cast_to_width_(sub, expr_wid); return cast_to_width_(sub, expr_wid);
@ -1959,7 +1959,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope,
PExpr *expr = parms_[0].parm; PExpr *expr = parms_[0].parm;
uint64_t use_width = 0; uint64_t use_width = 0;
if (PETypename*type_expr = dynamic_cast<PETypename*>(expr)) { if (const PETypename*type_expr = dynamic_cast<PETypename*>(expr)) {
ivl_type_t data_type = type_expr->get_type()->elaborate_type(des, scope); ivl_type_t data_type = type_expr->get_type()->elaborate_type(des, scope);
ivl_assert(*this, data_type); ivl_assert(*this, data_type);
use_width = 1; use_width = 1;
@ -2009,7 +2009,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope,
return 0; return 0;
} }
PExpr *expr = parms_[0].parm; const PExpr *expr = parms_[0].parm;
verinum val (expr->has_sign() ? verinum::V1 : verinum::V0, 1); verinum val (expr->has_sign() ? verinum::V1 : verinum::V0, 1);
NetEConst*sub = new NetEConst(val); NetEConst*sub = new NetEConst(val);
@ -2104,7 +2104,7 @@ NetExpr* PECallFunction::elaborate_access_func_(Design*des, NetScope*scope,
if (parms_.size() == 1) { if (parms_.size() == 1) {
PExpr *arg1 = parms_[0].parm; PExpr *arg1 = parms_[0].parm;
PEIdent*arg_ident = dynamic_cast<PEIdent*> (arg1); const PEIdent*arg_ident = dynamic_cast<PEIdent*> (arg1);
ivl_assert(*this, arg_ident); ivl_assert(*this, arg_ident);
const pform_name_t&path = arg_ident->path().name; const pform_name_t&path = arg_ident->path().name;
@ -2264,7 +2264,7 @@ static NetExpr* check_for_enum_methods(const LineInfo*li,
"enumeration method argument " << use_path << "." "enumeration method argument " << use_path << "."
<< method_name << "(" << args[0] << ")." << endl; << method_name << "(" << args[0] << ")." << endl;
des->errors++; des->errors++;
} else if (NetEEvent *evt = dynamic_cast<NetEEvent*> (count)) { } else if (const NetEEvent *evt = dynamic_cast<NetEEvent*> (count)) {
cerr << evt->get_fileline() << ": error: An event '" cerr << evt->get_fileline() << ": error: An event '"
<< evt->event()->name() << "' cannot be an enumeration " << evt->event()->name() << "' cannot be an enumeration "
"method argument." << endl; "method argument." << endl;
@ -3160,7 +3160,7 @@ unsigned PECallFunction::elaborate_arguments_(Design*des, NetScope*scope,
continue; continue;
} }
if (NetEEvent*evt = dynamic_cast<NetEEvent*> (parms[pidx])) { if (const NetEEvent*evt = dynamic_cast<NetEEvent*> (parms[pidx])) {
cerr << evt->get_fileline() << ": error: An event '" cerr << evt->get_fileline() << ": error: An event '"
<< evt->event()->name() << "' can not be a user " << evt->event()->name() << "' can not be a user "
"function argument." << endl; "function argument." << endl;
@ -3272,7 +3272,7 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope,
if (search_results.net && search_results.net->data_type()==IVL_VT_QUEUE if (search_results.net && search_results.net->data_type()==IVL_VT_QUEUE
&& search_results.path_head.back().index.size()==1) { && search_results.path_head.back().index.size()==1) {
NetNet*net = search_results.net; const NetNet*net = search_results.net;
const netdarray_t*darray = net->darray_type(); const netdarray_t*darray = net->darray_type();
const index_component_t&use_index = search_results.path_head.back().index.back(); const index_component_t&use_index = search_results.path_head.back().index.back();
ivl_assert(*this, use_index.msb != 0); ivl_assert(*this, use_index.msb != 0);
@ -3378,7 +3378,7 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope,
// Enumeration methods. // Enumeration methods.
if (search_results.net && search_results.net->enumeration()) { if (search_results.net && search_results.net->enumeration()) {
NetNet*net = search_results.net; const NetNet*net = search_results.net;
const netenum_t*netenum = net->enumeration(); const netenum_t*netenum = net->enumeration();
// Get the method name that we are looking for. // Get the method name that we are looking for.
@ -3581,7 +3581,7 @@ unsigned PECastSize::test_width(Design*des, NetScope*scope, width_mode_t&)
expr_width_ = 0; expr_width_ = 0;
NetExpr*size_ex = elab_and_eval(des, scope, size_, -1, true); NetExpr*size_ex = elab_and_eval(des, scope, size_, -1, true);
NetEConst*size_ce = dynamic_cast<NetEConst*>(size_ex); const NetEConst*size_ce = dynamic_cast<NetEConst*>(size_ex);
if (size_ce && !size_ce->value().is_negative()) if (size_ce && !size_ce->value().is_negative())
expr_width_ = size_ce->value().as_ulong(); expr_width_ = size_ce->value().as_ulong();
delete size_ex; delete size_ex;
@ -3837,7 +3837,7 @@ unsigned PEConcat::test_width(Design*des, NetScope*scope, width_mode_t&)
return 0; return 0;
} }
NetEConst*rep = dynamic_cast<NetEConst*>(tmp); const NetEConst*rep = dynamic_cast<NetEConst*>(tmp);
if (rep == 0) { if (rep == 0) {
cerr << get_fileline() << ": error: " cerr << get_fileline() << ": error: "
@ -4094,7 +4094,7 @@ bool PEIdent::calculate_bits_(Design*des, NetScope*scope,
bit select expressions which must be constant. */ bit select expressions which must be constant. */
NetExpr*msb_ex = elab_and_eval(des, scope, index_tail.msb, -1, true); NetExpr*msb_ex = elab_and_eval(des, scope, index_tail.msb, -1, true);
NetEConst*msb_c = dynamic_cast<NetEConst*>(msb_ex); const NetEConst*msb_c = dynamic_cast<NetEConst*>(msb_ex);
if (msb_c == 0) { if (msb_c == 0) {
cerr << index_tail.msb->get_fileline() << ": error: " cerr << index_tail.msb->get_fileline() << ": error: "
"Bit select expressions must be a constant integral value." "Bit select expressions must be a constant integral value."
@ -4136,7 +4136,7 @@ bool PEIdent::calculate_parts_(Design*des, NetScope*scope,
constant. Evaluate them and pass the results back to constant. Evaluate them and pass the results back to
the caller. */ the caller. */
NetExpr*lsb_ex = elab_and_eval(des, scope, index_tail.lsb, -1, true); NetExpr*lsb_ex = elab_and_eval(des, scope, index_tail.lsb, -1, true);
NetEConst*lsb_c = dynamic_cast<NetEConst*>(lsb_ex); const NetEConst*lsb_c = dynamic_cast<NetEConst*>(lsb_ex);
if (lsb_c == 0) { if (lsb_c == 0) {
cerr << index_tail.lsb->get_fileline() << ": error: " cerr << index_tail.lsb->get_fileline() << ": error: "
"Part select expressions must be constant integral values." "Part select expressions must be constant integral values."
@ -4154,7 +4154,7 @@ bool PEIdent::calculate_parts_(Design*des, NetScope*scope,
} }
NetExpr*msb_ex = elab_and_eval(des, scope, index_tail.msb, -1, true); NetExpr*msb_ex = elab_and_eval(des, scope, index_tail.msb, -1, true);
NetEConst*msb_c = dynamic_cast<NetEConst*>(msb_ex); const NetEConst*msb_c = dynamic_cast<NetEConst*>(msb_ex);
if (msb_c == 0) { if (msb_c == 0) {
cerr << index_tail.msb->get_fileline() << ": error: " cerr << index_tail.msb->get_fileline() << ": error: "
"Part select expressions must be constant integral values." "Part select expressions must be constant integral values."
@ -4191,7 +4191,7 @@ bool PEIdent::calculate_up_do_width_(Design*des, NetScope*scope,
first. If the expression is not constant, error but guess 1 first. If the expression is not constant, error but guess 1
so we can keep going and find more errors. */ so we can keep going and find more errors. */
NetExpr*wid_ex = elab_and_eval(des, scope, index_tail.lsb, -1, true); NetExpr*wid_ex = elab_and_eval(des, scope, index_tail.lsb, -1, true);
NetEConst*wid_c = dynamic_cast<NetEConst*>(wid_ex); const NetEConst*wid_c = dynamic_cast<NetEConst*>(wid_ex);
wid = wid_c ? wid_c->value().as_ulong() : 0; wid = wid_c ? wid_c->value().as_ulong() : 0;
if (wid == 0) { if (wid == 0) {
@ -5204,7 +5204,7 @@ NetExpr* PEIdent::elaborate_expr_param_bit_(Design*des, NetScope*scope,
// Handle the special case that the selection is constant. In this // Handle the special case that the selection is constant. In this
// case, just precalculate the entire constant result. // case, just precalculate the entire constant result.
if (NetEConst*sel_c = dynamic_cast<NetEConst*> (sel)) { if (const NetEConst*sel_c = dynamic_cast<NetEConst*> (sel)) {
// Special case: If the bit select is constant and not fully // Special case: If the bit select is constant and not fully
// defined, then we know that the result must be 1'bx. // defined, then we know that the result must be 1'bx.
if (! sel_c->value().is_defined()) { if (! sel_c->value().is_defined()) {
@ -5428,7 +5428,7 @@ NetExpr* PEIdent::elaborate_expr_param_idx_up_(Design*des, NetScope*scope,
// Handle the special case that the base is constant. In this // Handle the special case that the base is constant. In this
// case, just precalculate the entire constant result. // case, just precalculate the entire constant result.
if (NetEConst*base_c = dynamic_cast<NetEConst*> (base)) { if (const NetEConst*base_c = dynamic_cast<NetEConst*> (base)) {
if (! base_c->value().is_defined()) { if (! base_c->value().is_defined()) {
NetEConst *ex; NetEConst *ex;
ex = new NetEConst(verinum(verinum::Vx, wid, true)); ex = new NetEConst(verinum(verinum::Vx, wid, true));
@ -5516,7 +5516,7 @@ NetExpr* PEIdent::elaborate_expr_param_idx_do_(Design*des, NetScope*scope,
// Handle the special case that the base is constant. In this // Handle the special case that the base is constant. In this
// case, just precalculate the entire constant result. // case, just precalculate the entire constant result.
if (NetEConst*base_c = dynamic_cast<NetEConst*> (base)) { if (const NetEConst*base_c = dynamic_cast<NetEConst*> (base)) {
if (! base_c->value().is_defined()) { if (! base_c->value().is_defined()) {
NetEConst *ex; NetEConst *ex;
ex = new NetEConst(verinum(verinum::Vx, wid, true)); ex = new NetEConst(verinum(verinum::Vx, wid, true));
@ -6011,7 +6011,7 @@ NetExpr* PEIdent::elaborate_expr_net_idx_up_(Design*des, NetScope*scope,
// Handle the special case that the base is constant as // Handle the special case that the base is constant as
// well. In this case it can be converted to a conventional // well. In this case it can be converted to a conventional
// part select. // part select.
if (NetEConst*base_c = dynamic_cast<NetEConst*> (base)) { if (const NetEConst*base_c = dynamic_cast<NetEConst*> (base)) {
NetExpr*ex; NetExpr*ex;
if (base_c->value().is_defined()) { if (base_c->value().is_defined()) {
long lsv = base_c->value().as_long(); long lsv = base_c->value().as_long();
@ -6178,7 +6178,7 @@ NetExpr* PEIdent::elaborate_expr_net_idx_do_(Design*des, NetScope*scope,
// Handle the special case that the base is constant as // Handle the special case that the base is constant as
// well. In this case it can be converted to a conventional // well. In this case it can be converted to a conventional
// part select. // part select.
if (NetEConst*base_c = dynamic_cast<NetEConst*> (base)) { if (const NetEConst*base_c = dynamic_cast<NetEConst*> (base)) {
NetExpr*ex; NetExpr*ex;
if (base_c->value().is_defined()) { if (base_c->value().is_defined()) {
long lsv = base_c->value().as_long(); long lsv = base_c->value().as_long();
@ -6352,7 +6352,7 @@ NetExpr* PEIdent::elaborate_expr_net_bit_(Design*des, NetScope*scope,
// If the bit select is constant, then treat it similar // If the bit select is constant, then treat it similar
// to the part select, so that I save the effort of // to the part select, so that I save the effort of
// making a mux part in the netlist. // making a mux part in the netlist.
if (NetEConst*msc = dynamic_cast<NetEConst*> (mux)) { if (const NetEConst*msc = dynamic_cast<NetEConst*> (mux)) {
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": PEIdent::elaborate_expr_net_bit_: " cerr << get_fileline() << ": PEIdent::elaborate_expr_net_bit_: "
@ -6763,7 +6763,7 @@ NetExpr* PENewClass::elaborate_expr_constructor_(Design*des, NetScope*scope,
// Ran out of explicit arguments. Is there a default // Ran out of explicit arguments. Is there a default
// argument we can use? // argument we can use?
if (NetExpr*tmp = def->port_defe(idx)) { if (const NetExpr*tmp = def->port_defe(idx)) {
parms[idx] = tmp->dup_expr(); parms[idx] = tmp->dup_expr();
continue; continue;
} }
@ -7120,7 +7120,7 @@ NetExpr*PETernary::elaborate_expr(Design*des, NetScope*scope,
// Verilog doesn't say that we must do short circuit evaluation // Verilog doesn't say that we must do short circuit evaluation
// of ternary expressions, but it doesn't disallow it. // of ternary expressions, but it doesn't disallow it.
if (NetEConst*tmp = dynamic_cast<NetEConst*> (con)) { if (const NetEConst*tmp = dynamic_cast<NetEConst*> (con)) {
verinum cval = tmp->value(); verinum cval = tmp->value();
ivl_assert(*this, cval.len()==1); ivl_assert(*this, cval.len()==1);
@ -7386,7 +7386,7 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
break; break;
case '-': case '-':
if (NetEConst*ipc = dynamic_cast<NetEConst*>(ip)) { if (const NetEConst*ipc = dynamic_cast<NetEConst*>(ip)) {
verinum val = - ipc->value(); verinum val = - ipc->value();
tmp = new NetEConst(val); tmp = new NetEConst(val);
@ -7394,7 +7394,7 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
tmp->set_line(*this); tmp->set_line(*this);
delete ip; delete ip;
} else if (NetECReal*ipr = dynamic_cast<NetECReal*>(ip)) { } else if (const NetECReal*ipr = dynamic_cast<NetECReal*>(ip)) {
/* When taking the - of a real, fold this into the /* When taking the - of a real, fold this into the
constant value. */ constant value. */
@ -7417,7 +7417,7 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
/* If the operand to unary ! is a constant, then I can /* If the operand to unary ! is a constant, then I can
evaluate this expression here and return a logical evaluate this expression here and return a logical
constant in its place. */ constant in its place. */
if (NetEConst*ipc = dynamic_cast<NetEConst*>(ip)) { if (const NetEConst*ipc = dynamic_cast<NetEConst*>(ip)) {
verinum val = ipc->value(); verinum val = ipc->value();
unsigned v1 = 0; unsigned v1 = 0;
unsigned vx = 0; unsigned vx = 0;
@ -7445,7 +7445,7 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope,
tmp = new NetEConst(vres); tmp = new NetEConst(vres);
tmp->set_line(*this); tmp->set_line(*this);
delete ip; delete ip;
} else if (NetECReal*ipr = dynamic_cast<NetECReal*>(ip)) { } else if (const NetECReal*ipr = dynamic_cast<NetECReal*>(ip)) {
verinum::V res; verinum::V res;
if (ipr->value().as_double() == 0.0) res = verinum::V1; if (ipr->value().as_double() == 0.0) res = verinum::V1;
else res = verinum::V0; else res = verinum::V0;
@ -7527,7 +7527,7 @@ NetNet* Design::find_discipline_reference(ivl_discipline_t dis, NetScope*scope)
if (gnd) return gnd; if (gnd) return gnd;
string name = string(dis->name()) + "$gnd"; string name = string(dis->name()) + "$gnd";
netvector_t*gnd_vec = new netvector_t(IVL_VT_REAL,0,0); const netvector_t*gnd_vec = new netvector_t(IVL_VT_REAL,0,0);
gnd = new NetNet(scope, lex_strings.make(name), NetNet::WIRE, gnd_vec); gnd = new NetNet(scope, lex_strings.make(name), NetNet::WIRE, gnd_vec);
gnd->set_discipline(dis); gnd->set_discipline(dis);
discipline_references_[dis->name()] = gnd; discipline_references_[dis->name()] = gnd;

View File

@ -177,7 +177,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des,
symbol_search(this, des, scope, path_, lexical_pos_, &sr); symbol_search(this, des, scope, path_, lexical_pos_, &sr);
NetNet *reg = sr.net; NetNet *reg = sr.net;
pform_name_t &member_path = sr.path_tail; const pform_name_t &member_path = sr.path_tail;
/* The l-value must be a variable. If not, then give up and /* The l-value must be a variable. If not, then give up and
print a useful error message. */ print a useful error message. */
@ -475,7 +475,7 @@ NetAssign_* PEIdent::elaborate_lval_net_word_(Design*des,
if ((reg->type()==NetNet::UNRESOLVED_WIRE) && !is_force) { if ((reg->type()==NetNet::UNRESOLVED_WIRE) && !is_force) {
ivl_assert(*this, reg->coerced_to_uwire()); ivl_assert(*this, reg->coerced_to_uwire());
NetEConst*canon_const = dynamic_cast<NetEConst*>(canon_index); const NetEConst*canon_const = dynamic_cast<NetEConst*>(canon_index);
if (!canon_const || reg->test_part_driven(reg->vector_width() - 1, 0, if (!canon_const || reg->test_part_driven(reg->vector_width() - 1, 0,
canon_const->value().as_long())) { canon_const->value().as_long())) {
report_mixed_assignment_conflict_("array word"); report_mixed_assignment_conflict_("array word");
@ -556,7 +556,7 @@ bool PEIdent::elaborate_lval_net_bit_(Design*des,
return false; return false;
} }
if (NetEConst*index_con = dynamic_cast<NetEConst*> (mux)) { if (const NetEConst*index_con = dynamic_cast<NetEConst*> (mux)) {
// The index has a constant defined value. // The index has a constant defined value.
if (index_con->value().is_defined()) { if (index_con->value().is_defined()) {
lsb = index_con->value().as_long(); lsb = index_con->value().as_long();
@ -901,7 +901,7 @@ bool PEIdent::elaborate_lval_net_idx_(Design*des,
// Handle the special case that the base is constant. For this // Handle the special case that the base is constant. For this
// case we can reduce the expression. // case we can reduce the expression.
if (NetEConst*base_c = dynamic_cast<NetEConst*> (base)) { if (const NetEConst*base_c = dynamic_cast<NetEConst*> (base)) {
// For the undefined case just let the constant pass and // For the undefined case just let the constant pass and
// we will handle it in the code generator. // we will handle it in the code generator.
if (base_c->value().is_defined()) { if (base_c->value().is_defined()) {

View File

@ -105,7 +105,7 @@ NetNet* PEConcat::elaborate_lnet_common_(Design*des, NetScope*scope,
concat operator from most significant to least significant, concat operator from most significant to least significant,
which is the order they are given in the concat list. */ which is the order they are given in the concat list. */
netvector_t*tmp2_vec = new netvector_t(nets[0]->data_type(),width-1,0); const netvector_t*tmp2_vec = new netvector_t(nets[0]->data_type(),width-1,0);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, tmp2_vec); NetNet::IMPLICIT, tmp2_vec);
@ -237,7 +237,7 @@ bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig,
case index_component_t::SEL_IDX_DO: case index_component_t::SEL_IDX_DO:
case index_component_t::SEL_IDX_UP: { case index_component_t::SEL_IDX_UP: {
NetExpr*tmp_ex = elab_and_eval(des, scope, index_tail.msb, -1, true); NetExpr*tmp_ex = elab_and_eval(des, scope, index_tail.msb, -1, true);
NetEConst*tmp = dynamic_cast<NetEConst*>(tmp_ex); const NetEConst*tmp = dynamic_cast<NetEConst*>(tmp_ex);
if (!tmp) { if (!tmp) {
cerr << get_fileline() << ": error: Indexed part select " cerr << get_fileline() << ": error: Indexed part select "
"base expression must be a constant integral value " "base expression must be a constant integral value "
@ -743,7 +743,7 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope,
member_select.sel = index_component_t::SEL_BIT; member_select.sel = index_component_t::SEL_BIT;
member_select.msb = new PENumber(new verinum(member_off)); member_select.msb = new PENumber(new verinum(member_off));
tmp_index.push_back(member_select); tmp_index.push_back(member_select);
NetExpr*packed_base = collapse_array_indices(des, scope, sig, tmp_index); const NetExpr*packed_base = collapse_array_indices(des, scope, sig, tmp_index);
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": PEIdent::elaborate_lnet_common_: " cerr << get_fileline() << ": PEIdent::elaborate_lnet_common_: "
@ -825,7 +825,7 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope,
widx_flag = true; widx_flag = true;
} else { } else {
NetEConst*canon_const = dynamic_cast<NetEConst*>(canon_index); const NetEConst*canon_const = dynamic_cast<NetEConst*>(canon_index);
ivl_assert(*this, canon_const); ivl_assert(*this, canon_const);
widx = canon_const->value().as_long(); widx = canon_const->value().as_long();
@ -967,7 +967,7 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope,
<< " wid=" << subnet_wid <<"]" << " wid=" << subnet_wid <<"]"
<< endl; << endl;
netvector_t*tmp2_vec = new netvector_t(sig->data_type(), const netvector_t*tmp2_vec = new netvector_t(sig->data_type(),
subnet_wid-1,0); subnet_wid-1,0);
NetNet*subsig = new NetNet(sig->scope(), NetNet*subsig = new NetNet(sig->scope(),
sig->scope()->local_symbol(), sig->scope()->local_symbol(),
@ -1114,7 +1114,7 @@ NetNet* PEIdent::elaborate_subport(Design*des, NetScope*scope) const
unsigned swid = abs(midx - lidx) + 1; unsigned swid = abs(midx - lidx) + 1;
ivl_assert(*this, swid > 0 && swid < sig->vector_width()); ivl_assert(*this, swid > 0 && swid < sig->vector_width());
netvector_t*tmp2_vec = new netvector_t(sig->data_type(),swid-1,0); const netvector_t*tmp2_vec = new netvector_t(sig->data_type(),swid-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp2_vec); NetNet::WIRE, tmp2_vec);
tmp->port_type(sig->port_type()); tmp->port_type(sig->port_type());

View File

@ -218,7 +218,7 @@ static void elaborate_scope_enumeration(Design*des, NetScope*scope,
// There is an explicit value. elaborate/evaluate // There is an explicit value. elaborate/evaluate
// the value and assign it to the enumeration name. // the value and assign it to the enumeration name.
NetExpr*val = elab_and_eval(des, scope, cur->parm, -1); NetExpr*val = elab_and_eval(des, scope, cur->parm, -1);
NetEConst*val_const = dynamic_cast<NetEConst*> (val); const NetEConst*val_const = dynamic_cast<NetEConst*> (val);
if (val_const == 0) { if (val_const == 0) {
cerr << use_enum->get_fileline() cerr << use_enum->get_fileline()
<< ": error: Enumeration expression for " << ": error: Enumeration expression for "
@ -241,7 +241,7 @@ static void elaborate_scope_enumeration(Design*des, NetScope*scope,
} }
// If this is a literal constant and it has a defined // If this is a literal constant and it has a defined
// width then the width must match the enumeration width. // width then the width must match the enumeration width.
if (PENumber *tmp = dynamic_cast<PENumber*>(cur->parm)) { if (const PENumber *tmp = dynamic_cast<PENumber*>(cur->parm)) {
if (tmp->value().has_len() && if (tmp->value().has_len() &&
(tmp->value().len() != enum_width)) { (tmp->value().len() != enum_width)) {
cerr << use_enum->get_fileline() cerr << use_enum->get_fileline()
@ -706,7 +706,7 @@ class generate_schemes_work_item_t : public elaborator_work_item_t {
: elaborator_work_item_t(des__), scope_(scope), mod_(mod) : elaborator_work_item_t(des__), scope_(scope), mod_(mod)
{ } { }
void elaborate_runrun() void elaborate_runrun() override
{ {
if (debug_scopes) if (debug_scopes)
cerr << mod_->get_fileline() << ": debug: " cerr << mod_->get_fileline() << ": debug: "
@ -965,7 +965,7 @@ bool PGenerate::generate_scope_loop_(Design*des, NetScope*container)
// use) the genvar itself, so we can evaluate this expression // use) the genvar itself, so we can evaluate this expression
// the same way any other parameter value is evaluated. // the same way any other parameter value is evaluated.
NetExpr*init_ex = elab_and_eval(des, container, loop_init, -1, true); NetExpr*init_ex = elab_and_eval(des, container, loop_init, -1, true);
NetEConst*init = dynamic_cast<NetEConst*> (init_ex); const NetEConst*init = dynamic_cast<NetEConst*> (init_ex);
if (init == 0) { if (init == 0) {
cerr << get_fileline() << ": error: " cerr << get_fileline() << ": error: "
"Cannot evaluate generate \"loop\" initialization " "Cannot evaluate generate \"loop\" initialization "
@ -991,7 +991,7 @@ bool PGenerate::generate_scope_loop_(Design*des, NetScope*container)
container->genvar_tmp = loop_index; container->genvar_tmp = loop_index;
container->genvar_tmp_val = genvar; container->genvar_tmp_val = genvar;
NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1, true); NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1, true);
NetEConst*test = dynamic_cast<NetEConst*>(test_ex); const NetEConst*test = dynamic_cast<NetEConst*>(test_ex);
if (test == 0) { if (test == 0) {
cerr << get_fileline() << ": error: Cannot evaluate generate \"loop\" " cerr << get_fileline() << ": error: Cannot evaluate generate \"loop\" "
"conditional expression: " << *loop_test << endl; "conditional expression: " << *loop_test << endl;
@ -1123,7 +1123,7 @@ bool PGenerate::generate_scope_loop_(Design*des, NetScope*container)
bool PGenerate::generate_scope_condit_(Design*des, NetScope*container, bool else_flag) bool PGenerate::generate_scope_condit_(Design*des, NetScope*container, bool else_flag)
{ {
NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1, true); NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1, true);
NetEConst*test = dynamic_cast<NetEConst*> (test_ex); const NetEConst*test = dynamic_cast<NetEConst*> (test_ex);
if (test == 0) { if (test == 0) {
cerr << get_fileline() << ": error: Cannot evaluate genvar" cerr << get_fileline() << ": error: Cannot evaluate genvar"
<< " conditional expression: " << *loop_test << endl; << " conditional expression: " << *loop_test << endl;
@ -1380,9 +1380,9 @@ class delayed_elaborate_scope_mod_instances : public elaborator_work_item_t {
NetScope*sc) NetScope*sc)
: elaborator_work_item_t(des__), obj_(obj), mod_(mod), sc_(sc) : elaborator_work_item_t(des__), obj_(obj), mod_(mod), sc_(sc)
{ } { }
~delayed_elaborate_scope_mod_instances() { } ~delayed_elaborate_scope_mod_instances() override { }
virtual void elaborate_runrun(); virtual void elaborate_runrun() override;
private: private:
const PGModule*obj_; const PGModule*obj_;
@ -1751,7 +1751,7 @@ void PCase::elaborate_scope(Design*des, NetScope*scope) const
for (unsigned idx = 0 ; idx < (*items_).size() ; idx += 1) { for (unsigned idx = 0 ; idx < (*items_).size() ; idx += 1) {
ivl_assert(*this, (*items_)[idx]); ivl_assert(*this, (*items_)[idx]);
if (Statement*sp = (*items_)[idx]->stat) if (const Statement*sp = (*items_)[idx]->stat)
sp -> elaborate_scope(des, scope); sp -> elaborate_scope(des, scope);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012 / Stephen Williams (steve@icarus.com) * Copyright CERN 2012 / Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -538,7 +538,7 @@ bool PGenerate::elaborate_sig(Design*des, NetScope*container) const
cerr << get_fileline() << ": debug: Elaborate nets in " cerr << get_fileline() << ": debug: Elaborate nets in "
<< "scope " << scope_path(*cur) << "scope " << scope_path(*cur)
<< " in generate " << id_number << endl; << " in generate " << id_number << endl;
flag = elaborate_sig_(des, *cur) & flag; flag = elaborate_sig_(des, *cur) && flag;
} }
return flag; return flag;
@ -671,7 +671,7 @@ void PFunction::elaborate_sig(Design*des, NetScope*scope) const
ivl_assert(*this, ret_type); ivl_assert(*this, ret_type);
} }
} else { } else {
netvector_t*tmp = new netvector_t(IVL_VT_LOGIC); const netvector_t*tmp = new netvector_t(IVL_VT_LOGIC);
ret_type = tmp; ret_type = tmp;
} }
@ -970,7 +970,7 @@ bool test_ranges_eeq(const netranges_t&lef, const netranges_t&rig)
ivl_type_t PWire::elaborate_type(Design*des, NetScope*scope, ivl_type_t PWire::elaborate_type(Design*des, NetScope*scope,
const netranges_t &packed_dimensions) const const netranges_t &packed_dimensions) const
{ {
vector_type_t *vec_type = dynamic_cast<vector_type_t*>(set_data_type_.get()); const vector_type_t *vec_type = dynamic_cast<vector_type_t*>(set_data_type_.get());
if (set_data_type_ && !vec_type) { if (set_data_type_ && !vec_type) {
ivl_assert(*this, packed_dimensions.empty()); ivl_assert(*this, packed_dimensions.empty());
return set_data_type_->elaborate_type(des, scope); return set_data_type_->elaborate_type(des, scope);
@ -1156,7 +1156,7 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope)
} }
unsigned nattrib = 0; unsigned nattrib = 0;
attrib_list_t*attrib_list = evaluate_attributes(attributes, nattrib, const attrib_list_t*attrib_list = evaluate_attributes(attributes, nattrib,
des, scope); des, scope);
/* If the net type is supply0 or supply1, replace it /* If the net type is supply0 or supply1, replace it

View File

@ -199,7 +199,7 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
NetPartSelect::VP); NetPartSelect::VP);
des->add_node(tmp); des->add_node(tmp);
tmp->set_line(*this); tmp->set_line(*this);
netvector_t*osig_vec = new netvector_t(rval->data_type(), const netvector_t*osig_vec = new netvector_t(rval->data_type(),
lval->vector_width()-1,0); lval->vector_width()-1,0);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::TRI, osig_vec); NetNet::TRI, osig_vec);
@ -227,7 +227,7 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const
connect(rval->pin(0), driver->pin(1)); connect(rval->pin(0), driver->pin(1));
netvector_t*tmp_vec = new netvector_t(rval->data_type(), const netvector_t*tmp_vec = new netvector_t(rval->data_type(),
rval->vector_width()-1,0); rval->vector_width()-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
@ -258,7 +258,7 @@ NetNet *elaborate_unpacked_array(Design *des, NetScope *scope, const LineInfo &l
const NetNet *lval, PExpr *expr) const NetNet *lval, PExpr *expr)
{ {
NetNet *expr_net; NetNet *expr_net;
PEIdent* ident = dynamic_cast<PEIdent*> (expr); const PEIdent* ident = dynamic_cast<PEIdent*> (expr);
if (!ident) { if (!ident) {
if (dynamic_cast<PEConcat*> (expr)) { if (dynamic_cast<PEConcat*> (expr)) {
cout << loc.get_fileline() << ": sorry: Continuous assignment" cout << loc.get_fileline() << ": sorry: Continuous assignment"
@ -923,7 +923,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
des->add_node(rep); des->add_node(rep);
connect(rep->pin(1), sig->pin(0)); connect(rep->pin(1), sig->pin(0));
netvector_t*osig_vec = new netvector_t(IVL_VT_LOGIC, const netvector_t*osig_vec = new netvector_t(IVL_VT_LOGIC,
instance_width-1,0); instance_width-1,0);
sig = new NetNet(scope, scope->local_symbol(), sig = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, osig_vec); NetNet::WIRE, osig_vec);
@ -1004,7 +1004,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
unsigned dev = gdx*gate_count; unsigned dev = gdx*gate_count;
connect(cur[dev+idx]->pin(0), cc->pin(gdx+1)); connect(cur[dev+idx]->pin(0), cc->pin(gdx+1));
netvector_t*tmp2_vec = new netvector_t(IVL_VT_LOGIC); const netvector_t*tmp2_vec = new netvector_t(IVL_VT_LOGIC);
NetNet*tmp2 = new NetNet(scope, NetNet*tmp2 = new NetNet(scope,
scope->local_symbol(), scope->local_symbol(),
NetNet::WIRE, tmp2_vec); NetNet::WIRE, tmp2_vec);
@ -1021,7 +1021,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const
tmp1->set_line(*this); tmp1->set_line(*this);
des->add_node(tmp1); des->add_node(tmp1);
connect(tmp1->pin(1), sig->pin(0)); connect(tmp1->pin(1), sig->pin(0));
netvector_t*tmp2_vec = new netvector_t(sig->data_type()); const netvector_t*tmp2_vec = new netvector_t(sig->data_type());
NetNet*tmp2 = new NetNet(scope, scope->local_symbol(), NetNet*tmp2 = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp2_vec); NetNet::WIRE, tmp2_vec);
tmp2->set_line(*this); tmp2->set_line(*this);
@ -1052,7 +1052,7 @@ NetNet*PGModule::resize_net_to_port_(Design*des, NetScope*scope,
ivl_assert(*this, dir != NetNet::NOT_A_PORT); ivl_assert(*this, dir != NetNet::NOT_A_PORT);
ivl_assert(*this, dir != NetNet::PIMPLICIT); ivl_assert(*this, dir != NetNet::PIMPLICIT);
netvector_t*tmp_type = new netvector_t(IVL_VT_LOGIC, port_wid-1, 0); const netvector_t*tmp_type = new netvector_t(IVL_VT_LOGIC, port_wid-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_type); NetNet::WIRE, tmp_type);
tmp->local_flag(true); tmp->local_flag(true);
@ -1508,7 +1508,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
// commonly used feature.) // commonly used feature.)
for (unsigned ldx = 0 ; ldx < mport.size() ; ldx += 1) { for (unsigned ldx = 0 ; ldx < mport.size() ; ldx += 1) {
unsigned lbase = inst * mport.size(); unsigned lbase = inst * mport.size();
PEIdent*pport = mport[ldx]; const PEIdent*pport = mport[ldx];
ivl_assert(*this, pport); ivl_assert(*this, pport);
NetNet *netnet = pport->elaborate_subport(des, inst_scope); NetNet *netnet = pport->elaborate_subport(des, inst_scope);
prts[lbase + ldx] = netnet; prts[lbase + ldx] = netnet;
@ -1592,7 +1592,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
in that case that the port is input. */ in that case that the port is input. */
int context_width = -1; int context_width = -1;
if (PENumber*literal = dynamic_cast<PENumber*>(pins[idx])) { if (const PENumber*literal = dynamic_cast<PENumber*>(pins[idx])) {
if (literal->value().is_single()) if (literal->value().is_single())
context_width = prts_vector_width; context_width = prts_vector_width;
} }
@ -1664,7 +1664,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const
des->add_node(tmp); des->add_node(tmp);
connect(tmp->pin(1), sig->pin(0)); connect(tmp->pin(1), sig->pin(0));
netvector_t*tmp2_vec = new netvector_t(sig->data_type(), const netvector_t*tmp2_vec = new netvector_t(sig->data_type(),
sig->vector_width()-1,0); sig->vector_width()-1,0);
NetNet*tmp2 = new NetNet(inner_scope, inner_scope->local_symbol(), NetNet*tmp2 = new NetNet(inner_scope, inner_scope->local_symbol(),
NetNet::WIRE, tmp2_vec); NetNet::WIRE, tmp2_vec);
@ -2420,12 +2420,12 @@ NetAssign_* PAssign_::elaborate_lval(Design*des, NetScope*scope) const
rval_->test_width(des, scope, mode); rval_->test_width(des, scope, mode);
// Create a L-value that matches the function return type. // Create a L-value that matches the function return type.
NetNet*tmp; NetNet*tmp;
netvector_t*tmp_vec = new netvector_t(rval_->expr_type(), const netvector_t*tmp_vec = new netvector_t(rval_->expr_type(),
rval_->expr_width()-1, 0, rval_->expr_width()-1, 0,
rval_->has_sign()); rval_->has_sign());
if(rval_->expr_type() == IVL_VT_DARRAY) { if(rval_->expr_type() == IVL_VT_DARRAY) {
netdarray_t*darray = new netdarray_t(tmp_vec); const netdarray_t*darray = new netdarray_t(tmp_vec);
tmp = new NetNet(scope, scope->local_symbol(), NetNet::REG, darray); tmp = new NetNet(scope, scope->local_symbol(), NetNet::REG, darray);
} else { } else {
tmp = new NetNet(scope, scope->local_symbol(), NetNet::REG, tmp_vec); tmp = new NetNet(scope, scope->local_symbol(), NetNet::REG, tmp_vec);
@ -2636,7 +2636,7 @@ NetProc* PAssign::elaborate_compressed_(Design*des, NetScope*scope) const
static bool lval_not_program_variable(const NetAssign_*lv) static bool lval_not_program_variable(const NetAssign_*lv)
{ {
while (lv) { while (lv) {
NetScope*sig_scope = lv->scope(); const NetScope*sig_scope = lv->scope();
if (! sig_scope->program_block()) return true; if (! sig_scope->program_block()) return true;
lv = lv->more; lv = lv->more;
} }
@ -2752,7 +2752,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
if (delay || event_) { if (delay || event_) {
unsigned wid = count_lval_width(lv); unsigned wid = count_lval_width(lv);
netvector_t*tmp2_vec = new netvector_t(rv->expr_type(),wid-1,0); const netvector_t*tmp2_vec = new netvector_t(rv->expr_type(),wid-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::REG, tmp2_vec); NetNet::REG, tmp2_vec);
tmp->local_flag(true); tmp->local_flag(true);
@ -2797,7 +2797,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const
// If the expression is a constant, handle // If the expression is a constant, handle
// certain special iteration counts. // certain special iteration counts.
if (NetEConst*ce = dynamic_cast<NetEConst*>(count)) { if (const NetEConst*ce = dynamic_cast<NetEConst*>(count)) {
long val = ce->value().as_long(); long val = ce->value().as_long();
// We only need the real statement. // We only need the real statement.
if (val <= 0) { if (val <= 0) {
@ -2946,7 +2946,7 @@ NetProc* PAssignNB::elaborate(Design*des, NetScope*scope) const
ivl_assert(*this, event); ivl_assert(*this, event);
// Some constant values are special. // Some constant values are special.
if (NetEConst*ce = dynamic_cast<NetEConst*>(count)) { if (const NetEConst*ce = dynamic_cast<NetEConst*>(count)) {
long val = ce->value().as_long(); long val = ce->value().as_long();
// We only need the assignment statement. // We only need the assignment statement.
if (val <= 0) { if (val <= 0) {
@ -3056,7 +3056,7 @@ NetProc* PBlock::elaborate(Design*des, NetScope*scope) const
// Detect the error that a super.new() statement is in the // Detect the error that a super.new() statement is in the
// midst of a block. Report the error. Continue on with the // midst of a block. Report the error. Continue on with the
// elaboration so that other errors might be found. // elaboration so that other errors might be found.
if (PChainConstructor*supernew = dynamic_cast<PChainConstructor*> (list_[idx])) { if (const PChainConstructor*supernew = dynamic_cast<PChainConstructor*> (list_[idx])) {
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": PBlock::elaborate: " cerr << get_fileline() << ": PBlock::elaborate: "
<< "Found super.new statement, idx=" << idx << ", " << "Found super.new statement, idx=" << idx << ", "
@ -3335,7 +3335,7 @@ NetProc* PChainConstructor::elaborate(Design*des, NetScope*scope) const
// The scope is the <class>.new function, so scope->parent() // The scope is the <class>.new function, so scope->parent()
// is the class. Use that to get the class type that we are // is the class. Use that to get the class type that we are
// constructing. // constructing.
NetScope*scope_class = scope->parent(); const NetScope*scope_class = scope->parent();
const netclass_t*class_this = scope_class->class_def(); const netclass_t*class_this = scope_class->class_def();
ivl_assert(*this, class_this); ivl_assert(*this, class_this);
@ -3376,7 +3376,7 @@ NetProc* PChainConstructor::elaborate(Design*des, NetScope*scope) const
continue; continue;
} }
if (NetExpr*tmp = def->port_defe(idx)) { if (const NetExpr*tmp = def->port_defe(idx)) {
parms[idx] = tmp->dup_expr(); parms[idx] = tmp->dup_expr();
continue; continue;
} }
@ -3429,7 +3429,7 @@ NetProc* PCondit::elaborate(Design*des, NetScope*scope) const
// then look at the value and elaborate either the if statement // then look at the value and elaborate either the if statement
// or the else statement. I don't need both. If there is no // or the else statement. I don't need both. If there is no
// else_ statement, then use an empty block as a noop. // else_ statement, then use an empty block as a noop.
if (NetEConst*ce = dynamic_cast<NetEConst*>(expr)) { if (const NetEConst*ce = dynamic_cast<NetEConst*>(expr)) {
verinum val = ce->value(); verinum val = ce->value();
if (debug_elaborate) { if (debug_elaborate) {
cerr << get_fileline() << ": debug: Condition expression " cerr << get_fileline() << ": debug: Condition expression "
@ -3476,14 +3476,14 @@ NetProc* PCondit::elaborate(Design*des, NetScope*scope) const
// Detect the special cases that the if or else statements are // Detect the special cases that the if or else statements are
// empty blocks. If this is the case, remove the blocks as // empty blocks. If this is the case, remove the blocks as
// null statements. // null statements.
if (NetBlock*tmp = dynamic_cast<NetBlock*>(i)) { if (const NetBlock*tmp = dynamic_cast<NetBlock*>(i)) {
if (tmp->proc_first() == 0) { if (tmp->proc_first() == 0) {
delete i; delete i;
i = 0; i = 0;
} }
} }
if (NetBlock*tmp = dynamic_cast<NetBlock*>(e)) { if (const NetBlock*tmp = dynamic_cast<NetBlock*>(e)) {
if (tmp->proc_first() == 0) { if (tmp->proc_first() == 0) {
delete e; delete e;
e = 0; e = 0;
@ -3642,7 +3642,7 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const
ivl_assert(*this, task); ivl_assert(*this, task);
ivl_assert(*this, task->type() == NetScope::TASK); ivl_assert(*this, task->type() == NetScope::TASK);
NetTaskDef*def = task->task_def(); const NetTaskDef*def = task->task_def();
if (def == 0) { if (def == 0) {
cerr << get_fileline() << ": internal error: task " << path_ cerr << get_fileline() << ": internal error: task " << path_
<< " doesn't have a definition in " << scope_path(scope) << " doesn't have a definition in " << scope_path(scope)
@ -4241,7 +4241,7 @@ NetProc* PCallTask::elaborate_build_call_(Design*des, NetScope*scope,
if (args[parms_idx]) { if (args[parms_idx]) {
rv = elaborate_rval_expr(des, scope, port->net_type(), rv = elaborate_rval_expr(des, scope, port->net_type(),
args[parms_idx]); args[parms_idx]);
if (NetEEvent*evt = dynamic_cast<NetEEvent*> (rv)) { if (const NetEEvent*evt = dynamic_cast<NetEEvent*> (rv)) {
cerr << evt->get_fileline() << ": error: An event '" cerr << evt->get_fileline() << ": error: An event '"
<< evt->event()->name() << "' can not be a user " << evt->event()->name() << "' can not be a user "
"task argument." << endl; "task argument." << endl;
@ -4651,7 +4651,7 @@ NetProc* PDelayStatement::elaborate(Design*des, NetScope*scope) const
NetExpr*dex = elaborate_delay_expr(delay_, des, scope); NetExpr*dex = elaborate_delay_expr(delay_, des, scope);
NetPDelay *obj; NetPDelay *obj;
if (NetEConst*tmp = dynamic_cast<NetEConst*>(dex)) { if (const NetEConst*tmp = dynamic_cast<NetEConst*>(dex)) {
if (statement_) if (statement_)
obj = new NetPDelay(tmp->value().as_ulong64(), obj = new NetPDelay(tmp->value().as_ulong64(),
statement_->elaborate(des, scope)); statement_->elaborate(des, scope));
@ -4951,7 +4951,7 @@ cerr << endl;
named event, then handle this case all at once and named event, then handle this case all at once and
skip the rest of the expression handling. */ skip the rest of the expression handling. */
if (PEIdent*id = dynamic_cast<PEIdent*>(expr_[idx]->expr())) { if (const PEIdent*id = dynamic_cast<PEIdent*>(expr_[idx]->expr())) {
symbol_search_results sr; symbol_search_results sr;
symbol_search(this, des, scope, id->path(), id->lexical_pos(), &sr); symbol_search(this, des, scope, id->path(), id->lexical_pos(), &sr);
@ -5168,7 +5168,7 @@ NetProc* PEventStatement::elaborate_wait(Design*des, NetScope*scope,
constant. Constant true is OK (it becomes transparent) but constant. Constant true is OK (it becomes transparent) but
constant false is almost certainly not what is intended. */ constant false is almost certainly not what is intended. */
ivl_assert(*this, expr->expr_width() == 1); ivl_assert(*this, expr->expr_width() == 1);
if (NetEConst*ce = dynamic_cast<NetEConst*>(expr)) { if (const NetEConst*ce = dynamic_cast<NetEConst*>(expr)) {
verinum val = ce->value(); verinum val = ce->value();
ivl_assert(*this, val.len() == 1); ivl_assert(*this, val.len() == 1);
@ -5896,7 +5896,7 @@ NetProc* PRepeat::elaborate(Design*des, NetScope*scope) const
// If the expression is a constant, handle certain special // If the expression is a constant, handle certain special
// iteration counts. // iteration counts.
if (NetEConst*ce = dynamic_cast<NetEConst*>(expr)) { if (const NetEConst*ce = dynamic_cast<NetEConst*>(expr)) {
long val = ce->value().as_long(); long val = ce->value().as_long();
if (val <= 0) { if (val <= 0) {
delete expr; delete expr;
@ -6254,7 +6254,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
PExpr*exp = delays[idx]; PExpr*exp = delays[idx];
NetExpr*cur = elab_and_eval(des, scope, exp, -1); NetExpr*cur = elab_and_eval(des, scope, exp, -1);
if (NetEConst*con = dynamic_cast<NetEConst*> (cur)) { if (const NetEConst*con = dynamic_cast<NetEConst*> (cur)) {
verinum fn = con->value(); verinum fn = con->value();
delay_value[idx] = des->scale_to_precision(fn.as_ulong64(), delay_value[idx] = des->scale_to_precision(fn.as_ulong64(),
scope); scope);
@ -6310,7 +6310,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
typedef std::vector<perm_string>::const_iterator str_vec_iter; typedef std::vector<perm_string>::const_iterator str_vec_iter;
for (str_vec_iter cur = src.begin(); for (str_vec_iter cur = src.begin();
( cur != src.end() && all_single); ++ cur) { ( cur != src.end() && all_single); ++ cur) {
NetNet *psig = scope->find_signal(*cur); const NetNet *psig = scope->find_signal(*cur);
/* We will report a missing signal as invalid later. For /* We will report a missing signal as invalid later. For
* now assume it's a single bit. */ * now assume it's a single bit. */
if (psig == 0) continue; if (psig == 0) continue;
@ -6318,7 +6318,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const
} }
for (str_vec_iter cur = dst.begin(); for (str_vec_iter cur = dst.begin();
( cur != dst.end() && all_single); ++ cur) { ( cur != dst.end() && all_single); ++ cur) {
NetNet *psig = scope->find_signal(*cur); const NetNet *psig = scope->find_signal(*cur);
/* The same as above for source paths. */ /* The same as above for source paths. */
if (psig == 0) continue; if (psig == 0) continue;
if (psig->vector_width() != 1) all_single = false; if (psig->vector_width() != 1) all_single = false;
@ -6723,7 +6723,7 @@ bool Module::elaborate(Design*des, NetScope*scope) const
void netclass_t::elaborate(Design*des, PClass*pclass) void netclass_t::elaborate(Design*des, PClass*pclass)
{ {
if (! pclass->type->initialize_static.empty()) { if (! pclass->type->initialize_static.empty()) {
std::vector<Statement*>&stmt_list = pclass->type->initialize_static; const std::vector<Statement*>&stmt_list = pclass->type->initialize_static;
NetBlock*stmt = new NetBlock(NetBlock::SEQU, 0); NetBlock*stmt = new NetBlock(NetBlock::SEQU, 0);
for (size_t idx = 0 ; idx < stmt_list.size() ; idx += 1) { for (size_t idx = 0 ; idx < stmt_list.size() ; idx += 1) {
NetProc*tmp = stmt_list[idx]->elaborate(des, class_scope_); NetProc*tmp = stmt_list[idx]->elaborate(des, class_scope_);
@ -6822,7 +6822,7 @@ bool PGenerate::elaborate(Design*des, NetScope*container) const
cerr << get_fileline() << ": debug: Elaborate in " cerr << get_fileline() << ": debug: Elaborate in "
<< "scope " << scope_path(scope) << endl; << "scope " << scope_path(scope) << endl;
flag = elaborate_(des, scope) & flag; flag = elaborate_(des, scope) && flag;
} }
return flag; return flag;
@ -6972,9 +6972,9 @@ class elaborate_package_t : public elaborator_work_item_t {
: elaborator_work_item_t(d), scope_(scope), package_(p) : elaborator_work_item_t(d), scope_(scope), package_(p)
{ } { }
~elaborate_package_t() { } ~elaborate_package_t() override { }
virtual void elaborate_runrun() virtual void elaborate_runrun() override
{ {
if (! package_->elaborate_scope(des, scope_)) if (! package_->elaborate_scope(des, scope_))
des->errors += 1; des->errors += 1;
@ -6991,9 +6991,9 @@ class elaborate_root_scope_t : public elaborator_work_item_t {
: elaborator_work_item_t(des__), scope_(scope), rmod_(rmod) : elaborator_work_item_t(des__), scope_(scope), rmod_(rmod)
{ } { }
~elaborate_root_scope_t() { } ~elaborate_root_scope_t() override { }
virtual void elaborate_runrun() virtual void elaborate_runrun() override
{ {
Module::replace_t root_repl; Module::replace_t root_repl;
for (list<Module::named_expr_t>::iterator cur = Module::user_defparms.begin() for (list<Module::named_expr_t>::iterator cur = Module::user_defparms.begin()
@ -7025,9 +7025,9 @@ class top_defparams : public elaborator_work_item_t {
: elaborator_work_item_t(des__) : elaborator_work_item_t(des__)
{ } { }
~top_defparams() { } ~top_defparams() override { }
virtual void elaborate_runrun() virtual void elaborate_runrun() override
{ {
if (debug_scopes) { if (debug_scopes) {
cerr << "debug: top_defparams::elaborate_runrun()" << endl; cerr << "debug: top_defparams::elaborate_runrun()" << endl;
@ -7056,9 +7056,9 @@ class later_defparams : public elaborator_work_item_t {
: elaborator_work_item_t(des__) : elaborator_work_item_t(des__)
{ } { }
~later_defparams() { } ~later_defparams() override { }
virtual void elaborate_runrun() virtual void elaborate_runrun() override
{ {
if (debug_scopes) { if (debug_scopes) {
cerr << "debug: later_defparams::elaborate_runrun()" << endl; cerr << "debug: later_defparams::elaborate_runrun()" << endl;
@ -7434,7 +7434,7 @@ static void check_timescales()
} }
for (mod = pform_modules.begin(); mod != pform_modules.end(); ++mod) { for (mod = pform_modules.begin(); mod != pform_modules.end(); ++mod) {
Module*mp = (*mod).second; const Module*mp = (*mod).second;
if (mp->has_explicit_timescale()) if (mp->has_explicit_timescale())
continue; continue;
cerr << " : -- module " << (*mod).first cerr << " : -- module " << (*mod).first
@ -7445,7 +7445,7 @@ static void check_timescales()
return; return;
for (pkg = pform_packages.begin(); pkg != pform_packages.end(); ++pkg) { for (pkg = pform_packages.begin(); pkg != pform_packages.end(); ++pkg) {
PPackage*pp = *pkg; const PPackage*pp = *pkg;
if (pp->has_explicit_timescale()) if (pp->has_explicit_timescale())
continue; continue;
cerr << " : -- package " << pp->pscope_name() cerr << " : -- package " << pp->pscope_name()
@ -7656,7 +7656,7 @@ Design* elaborate(list<perm_string>roots)
// creates all the NetNet and NetMemory objects for declared // creates all the NetNet and NetMemory objects for declared
// objects. // objects.
for (i = 0; i < pack_elems.size(); i += 1) { for (i = 0; i < pack_elems.size(); i += 1) {
PPackage*pack = pack_elems[i].pack; const PPackage*pack = pack_elems[i].pack;
NetScope*scope= pack_elems[i].scope; NetScope*scope= pack_elems[i].scope;
if (! pack->elaborate_sig(des, scope)) { if (! pack->elaborate_sig(des, scope)) {
@ -7680,7 +7680,7 @@ Design* elaborate(list<perm_string>roots)
} }
for (i = 0; i < root_elems.size(); i++) { for (i = 0; i < root_elems.size(); i++) {
Module *rmod = root_elems[i].mod; const Module *rmod = root_elems[i].mod;
NetScope *scope = root_elems[i].scope; NetScope *scope = root_elems[i].scope;
scope->set_num_ports( rmod->port_count() ); scope->set_num_ports( rmod->port_count() );
@ -7708,7 +7708,7 @@ Design* elaborate(list<perm_string>roots)
for (unsigned pin = 0; pin < mport.size(); pin += 1) { for (unsigned pin = 0; pin < mport.size(); pin += 1) {
// This really does more than we need and adds extra // This really does more than we need and adds extra
// stuff to the design that should be cleaned later. // stuff to the design that should be cleaned later.
NetNet *netnet = mport[pin]->elaborate_subport(des, scope); const NetNet *netnet = mport[pin]->elaborate_subport(des, scope);
if (netnet != 0) { if (netnet != 0) {
// Elaboration may actually fail with // Elaboration may actually fail with
// erroneous input source // erroneous input source
@ -7729,13 +7729,13 @@ Design* elaborate(list<perm_string>roots)
// run through the pform again and generate the full netlist. // run through the pform again and generate the full netlist.
for (i = 0; i < pack_elems.size(); i += 1) { for (i = 0; i < pack_elems.size(); i += 1) {
PPackage*pkg = pack_elems[i].pack; const PPackage*pkg = pack_elems[i].pack;
NetScope*scope = pack_elems[i].scope; NetScope*scope = pack_elems[i].scope;
rc &= pkg->elaborate(des, scope); rc &= pkg->elaborate(des, scope);
} }
for (i = 0; i < root_elems.size(); i++) { for (i = 0; i < root_elems.size(); i++) {
Module *rmod = root_elems[i].mod; const Module *rmod = root_elems[i].mod;
NetScope *scope = root_elems[i].scope; NetScope *scope = root_elems[i].scope;
rc &= rmod->elaborate(des, scope); rc &= rmod->elaborate(des, scope);
} }

10
emit.cc
View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -391,7 +391,7 @@ void NetBlock::emit_recurse(struct target_t*tgt) const
if (last_ == 0) if (last_ == 0)
return; return;
NetProc*cur = last_; const NetProc*cur = last_;
do { do {
cur = cur->next_; cur = cur->next_;
cur->emit_proc(tgt); cur->emit_proc(tgt);
@ -467,7 +467,7 @@ void NetScope::emit_scope(struct target_t*tgt) const
tgt->scope(this); tgt->scope(this);
for (NetEvent*cur = events_ ; cur ; cur = cur->snext_) for (const NetEvent*cur = events_ ; cur ; cur = cur->snext_)
tgt->event(cur); tgt->event(cur);
for (map<perm_string,netclass_t*>::const_iterator cur = classes_.begin() for (map<perm_string,netclass_t*>::const_iterator cur = classes_.begin()
@ -566,7 +566,7 @@ int Design::emit(struct target_t*tgt) const
// emit nodes // emit nodes
bool nodes_rc = true; bool nodes_rc = true;
if (nodes_) { if (nodes_) {
NetNode*cur = nodes_->node_next_; const NetNode*cur = nodes_->node_next_;
do { do {
nodes_rc = nodes_rc && cur->emit_node(tgt); nodes_rc = nodes_rc && cur->emit_node(tgt);
cur = cur->node_next_; cur = cur->node_next_;
@ -575,7 +575,7 @@ int Design::emit(struct target_t*tgt) const
bool branches_rc = true; bool branches_rc = true;
for (NetBranch*cur = branches_ ; cur ; cur = cur->next_) { for (const NetBranch*cur = branches_ ; cur ; cur = cur->next_) {
branches_rc = tgt->branch(cur) && branches_rc; branches_rc = tgt->branch(cur) && branches_rc;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -58,9 +58,9 @@ attrib_list_t* evaluate_attributes(const map<perm_string,PExpr*>&att,
if (!tmp) if (!tmp)
continue; continue;
if (NetEConst *ce = dynamic_cast<NetEConst*>(tmp)) { if (const NetEConst *ce = dynamic_cast<NetEConst*>(tmp)) {
table[idx].val = ce->value(); table[idx].val = ce->value();
} else if (NetECReal *cer = dynamic_cast<NetECReal*>(tmp)) { } else if (const NetECReal *cer = dynamic_cast<NetECReal*>(tmp)) {
table[idx].val = verinum(cer->value().as_long()); table[idx].val = verinum(cer->value().as_long());
} else { } else {
cerr << exp->get_fileline() << ": error: ``" cerr << exp->get_fileline() << ": error: ``"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2022 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -153,8 +153,8 @@ NetExpr* NetEBAdd::eval_tree()
// example, the expression (a + 2) - 1 can be rewritten as a + 1. // example, the expression (a + 2) - 1 can be rewritten as a + 1.
NetEBAdd*se = dynamic_cast<NetEBAdd*>(left_); NetEBAdd*se = dynamic_cast<NetEBAdd*>(left_);
NetEConst*lc = se? dynamic_cast<NetEConst*>(se->right_) : NULL; const NetEConst*lc = se? dynamic_cast<NetEConst*>(se->right_) : NULL;
NetEConst*rc = dynamic_cast<NetEConst*>(right_); const NetEConst*rc = dynamic_cast<NetEConst*>(right_);
if (lc != 0 && rc != 0) { if (lc != 0 && rc != 0) {
ivl_assert(*this, se != 0); ivl_assert(*this, se != 0);
@ -1194,12 +1194,12 @@ NetEConst* NetEConcat::eval_arguments_(const vector<NetExpr*>&vals,
NetEConst* NetESelect::eval_tree() NetEConst* NetESelect::eval_tree()
{ {
eval_expr(expr_); eval_expr(expr_);
NetEConst*expr = dynamic_cast<NetEConst*>(expr_); const NetEConst*expr = dynamic_cast<NetEConst*>(expr_);
long bval = 0; long bval = 0;
if (base_) { if (base_) {
eval_expr(base_); eval_expr(base_);
NetEConst*base = dynamic_cast<NetEConst*>(base_); const NetEConst*base = dynamic_cast<NetEConst*>(base_);
if (base == 0) return 0; if (base == 0) return 0;
@ -1242,11 +1242,11 @@ NetEConst* NetESelect::eval_tree()
static void print_ternary_cond(NetExpr*expr) static void print_ternary_cond(NetExpr*expr)
{ {
if (NetEConst*c = dynamic_cast<NetEConst*>(expr)) { if (const NetEConst*c = dynamic_cast<NetEConst*>(expr)) {
cerr << c->value() << endl; cerr << c->value() << endl;
return; return;
} }
if (NetECReal*c = dynamic_cast<NetECReal*>(expr)) { if (const NetECReal*c = dynamic_cast<NetECReal*>(expr)) {
cerr << c->value() << endl; cerr << c->value() << endl;
return; return;
} }
@ -2499,7 +2499,7 @@ NetExpr* NetEUFunc::eval_tree()
return 0; return 0;
} }
NetFuncDef*def = func_->func_def(); const NetFuncDef*def = func_->func_def();
ivl_assert(*this, def); ivl_assert(*this, def);
vector<NetExpr*>args(parms_.size()); vector<NetExpr*>args(parms_.size());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016-2021 Martin Whitaker (icarus@martin-whitaker.me.uk) * Copyright (c) 2016-2025 Martin Whitaker (icarus@martin-whitaker.me.uk)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -47,9 +47,9 @@ struct exposenodes_functor : public functor_t {
unsigned count; unsigned count;
virtual void lpm_mux(Design*des, NetMux*obj); virtual void lpm_mux(Design*des, NetMux*obj) override;
virtual void lpm_part_select(Design*des, NetPartSelect*obj); virtual void lpm_part_select(Design*des, NetPartSelect*obj) override;
virtual void lpm_substitute(Design*des, NetSubstitute*obj); virtual void lpm_substitute(Design*des, NetSubstitute*obj) override;
}; };
static bool expose_nexus(Nexus*nex) static bool expose_nexus(Nexus*nex)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -177,7 +177,7 @@ NetNet* NetEBBits::synthesize(Design*des, NetScope*scope, NetExpr*root)
rsig = pad_to_width(des, rsig, width, *this); rsig = pad_to_width(des, rsig, width, *this);
ivl_assert(*this, lsig->vector_width() == rsig->vector_width()); ivl_assert(*this, lsig->vector_width() == rsig->vector_width());
netvector_t*osig_vec = new netvector_t(expr_type(), width-1, 0); const netvector_t*osig_vec = new netvector_t(expr_type(), width-1, 0);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, osig_vec); NetNet::IMPLICIT, osig_vec);
osig->set_line(*this); osig->set_line(*this);
@ -247,7 +247,7 @@ NetNet* NetEBComp::synthesize(Design*des, NetScope*scope, NetExpr*root)
rsig = pad_to_width(des, rsig, width, *this); rsig = pad_to_width(des, rsig, width, *this);
} }
netvector_t*osig_vec = new netvector_t(IVL_VT_LOGIC); const netvector_t*osig_vec = new netvector_t(IVL_VT_LOGIC);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, osig_vec); NetNet::IMPLICIT, osig_vec);
osig->set_line(*this); osig->set_line(*this);
@ -576,7 +576,7 @@ NetNet* NetEBLogic::synthesize(Design*des, NetScope*scope, NetExpr*root)
olog->set_line(*this); olog->set_line(*this);
des->add_node(olog); des->add_node(olog);
netvector_t*osig_tmp = new netvector_t(expr_type()); const netvector_t*osig_tmp = new netvector_t(expr_type());
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, osig_tmp); NetNet::IMPLICIT, osig_tmp);
osig->set_line(*this); osig->set_line(*this);
@ -618,7 +618,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root)
/* Detect the special case where the shift amount is /* Detect the special case where the shift amount is
constant. Evaluate the shift amount, and simply reconnect constant. Evaluate the shift amount, and simply reconnect
the left operand to the output, but shifted. */ the left operand to the output, but shifted. */
if (NetEConst*rcon = dynamic_cast<NetEConst*>(right_)) { if (const NetEConst*rcon = dynamic_cast<NetEConst*>(right_)) {
verinum shift_v = rcon->value(); verinum shift_v = rcon->value();
long shift = shift_v.as_long(); long shift = shift_v.as_long();
@ -628,7 +628,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root)
if (shift == 0) if (shift == 0)
return lsig; return lsig;
netvector_t*osig_vec = new netvector_t(expr_type(), expr_width()-1,0); const netvector_t*osig_vec = new netvector_t(expr_type(), expr_width()-1,0);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, osig_vec); NetNet::IMPLICIT, osig_vec);
osig->set_line(*this); osig->set_line(*this);
@ -650,7 +650,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root)
psel->set_line(*this); psel->set_line(*this);
des->add_node(psel); des->add_node(psel);
netvector_t*psig_vec = new netvector_t(expr_type(), part_width-1, 0); const netvector_t*psig_vec = new netvector_t(expr_type(), part_width-1, 0);
NetNet*psig = new NetNet(scope, scope->local_symbol(), NetNet*psig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, psig_vec); NetNet::IMPLICIT, psig_vec);
psig->set_line(*this); psig->set_line(*this);
@ -678,7 +678,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root)
znum); znum);
des->add_node(zcon); des->add_node(zcon);
netvector_t*zsig_vec = new netvector_t(osig->data_type(), const netvector_t*zsig_vec = new netvector_t(osig->data_type(),
znum.len()-1, 0); znum.len()-1, 0);
NetNet*zsig = new NetNet(scope, scope->local_symbol(), NetNet*zsig = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, zsig_vec); NetNet::WIRE, zsig_vec);
@ -709,7 +709,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root)
if (rsig == 0) return 0; if (rsig == 0) return 0;
netvector_t*osig_vec = new netvector_t(expr_type(), expr_width()-1, 0); const netvector_t*osig_vec = new netvector_t(expr_type(), expr_width()-1, 0);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, osig_vec); NetNet::IMPLICIT, osig_vec);
osig->set_line(*this); osig->set_line(*this);
@ -966,7 +966,7 @@ NetNet* NetEUBits::synthesize(Design*des, NetScope*scope, NetExpr*root)
} }
unsigned width = isig->vector_width(); unsigned width = isig->vector_width();
netvector_t*osig_vec = new netvector_t(expr_type(), width-1, 0); const netvector_t*osig_vec = new netvector_t(expr_type(), width-1, 0);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, osig_vec); NetNet::IMPLICIT, osig_vec);
osig->set_line(*this); osig->set_line(*this);
@ -1009,7 +1009,7 @@ NetNet* NetEUnary::synthesize(Design*des, NetScope*scope, NetExpr*root)
if (expr_->has_sign() == false) if (expr_->has_sign() == false)
return sub; return sub;
netvector_t*sig_vec = new netvector_t(sub->data_type(), const netvector_t*sig_vec = new netvector_t(sub->data_type(),
sub->vector_width()-1, 0); sub->vector_width()-1, 0);
NetNet*sig = new NetNet(scope, scope->local_symbol(), NetNet*sig = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, sig_vec); NetNet::WIRE, sig_vec);
@ -1084,7 +1084,7 @@ NetNet* NetEUReduce::synthesize(Design*des, NetScope*scope, NetExpr*root)
gate->set_line(*this); gate->set_line(*this);
des->add_node(gate); des->add_node(gate);
netvector_t*osig_vec = new netvector_t(expr_type()); const netvector_t*osig_vec = new netvector_t(expr_type());
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, osig_vec); NetNet::IMPLICIT, osig_vec);
osig->set_line(*this); osig->set_line(*this);
@ -1139,7 +1139,7 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root)
// Detect the special case that there is a base expression and // Detect the special case that there is a base expression and
// it is constant. In this case we can generate fixed part selects. // it is constant. In this case we can generate fixed part selects.
if (NetEConst*base_const = dynamic_cast<NetEConst*>(base_)) { if (const NetEConst*base_const = dynamic_cast<NetEConst*>(base_)) {
verinum base_tmp = base_const->value(); verinum base_tmp = base_const->value();
unsigned select_width = expr_width(); unsigned select_width = expr_width();
@ -1194,7 +1194,7 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root)
des->add_node(sel); des->add_node(sel);
ivl_assert(*this, select_width > 0); ivl_assert(*this, select_width > 0);
netvector_t*tmp_vec = new netvector_t(sub->data_type(), const netvector_t*tmp_vec = new netvector_t(sub->data_type(),
select_width-1, 0); select_width-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
@ -1243,7 +1243,7 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root)
sel->set_line(*this); sel->set_line(*this);
des->add_node(sel); des->add_node(sel);
netvector_t*tmp_vec = new netvector_t(sub->data_type(), const netvector_t*tmp_vec = new netvector_t(sub->data_type(),
expr_width()-1, 0); expr_width()-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, tmp_vec); NetNet::IMPLICIT, tmp_vec);
@ -1321,7 +1321,7 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root)
con->set_line(*this); con->set_line(*this);
des->add_node(con); des->add_node(con);
netvector_t*tmp_vec = new netvector_t(expr_type(), pad_width-1, 0); const netvector_t*tmp_vec = new netvector_t(expr_type(), pad_width-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, tmp_vec); NetNet::IMPLICIT, tmp_vec);
tmp->set_line(*this); tmp->set_line(*this);
@ -1376,7 +1376,7 @@ NetNet* NetETernary::synthesize(Design *des, NetScope*scope, NetExpr*root)
ivl_assert(*this, csig->vector_width() == 1); ivl_assert(*this, csig->vector_width() == 1);
unsigned width=expr_width(); unsigned width=expr_width();
netvector_t*osig_vec = new netvector_t(expr_type(), width-1, 0); const netvector_t*osig_vec = new netvector_t(expr_type(), width-1, 0);
NetNet*osig = new NetNet(csig->scope(), path, NetNet::IMPLICIT, osig_vec); NetNet*osig = new NetNet(csig->scope(), path, NetNet::IMPLICIT, osig_vec);
osig->set_line(*this); osig->set_line(*this);
osig->local_flag(true); osig->local_flag(true);
@ -1421,7 +1421,7 @@ NetNet* NetESignal::synthesize(Design*des, NetScope*scope, NetExpr*root)
// If this is a synthesis with a specific value for the // If this is a synthesis with a specific value for the
// signal, then replace it (here) with a constant value. // signal, then replace it (here) with a constant value.
if (net_->scope()==scope && net_->name()==scope->genvar_tmp) { if (net_->scope()==scope && net_->name()==scope->genvar_tmp) {
netvector_t*tmp_vec = new netvector_t(net_->data_type(), const netvector_t*tmp_vec = new netvector_t(net_->data_type(),
net_->vector_width()-1, 0); net_->vector_width()-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, tmp_vec); NetNet::IMPLICIT, tmp_vec);
@ -1452,7 +1452,7 @@ NetNet* NetESignal::synthesize(Design*des, NetScope*scope, NetExpr*root)
return tmp; return tmp;
} }
netvector_t*tmp_vec = new netvector_t(net_->data_type(), const netvector_t*tmp_vec = new netvector_t(net_->data_type(),
net_->vector_width()-1, 0); net_->vector_width()-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::IMPLICIT, tmp_vec); NetNet::IMPLICIT, tmp_vec);
@ -1462,7 +1462,7 @@ NetNet* NetESignal::synthesize(Design*des, NetScope*scope, NetExpr*root)
// For NetExpr objects, the word index is already converted to // For NetExpr objects, the word index is already converted to
// a canonical (lsb==0) address. Just use the index directly. // a canonical (lsb==0) address. Just use the index directly.
if (NetEConst*index_co = dynamic_cast<NetEConst*> (word_)) { if (const NetEConst*index_co = dynamic_cast<NetEConst*> (word_)) {
long index = index_co->value().as_long(); long index = index_co->value().as_long();
connect(tmp->pin(0), net_->pin(index)); connect(tmp->pin(0), net_->pin(index));
@ -1611,7 +1611,7 @@ NetNet* NetEUFunc::synthesize(Design*des, NetScope*scope, NetExpr*root)
des->add_node(net); des->add_node(net);
/* Create an output signal and connect it to the function. */ /* Create an output signal and connect it to the function. */
netvector_t*osig_vec = new netvector_t(result_sig_->expr_type(), const netvector_t*osig_vec = new netvector_t(result_sig_->expr_type(),
result_sig_->vector_width()-1, 0); result_sig_->vector_width()-1, 0);
NetNet*osig = new NetNet(scope_, scope_->local_symbol(), NetNet::WIRE, NetNet*osig = new NetNet(scope_, scope_->local_symbol(), NetNet::WIRE,
osig_vec); osig_vec);
@ -1626,7 +1626,7 @@ NetNet* NetEUFunc::synthesize(Design*des, NetScope*scope, NetExpr*root)
} }
/* Connect the pins to the arguments. */ /* Connect the pins to the arguments. */
NetFuncDef*def = func_->func_def(); const NetFuncDef*def = func_->func_def();
for (unsigned idx = 0; idx < eparms.size(); idx += 1) { for (unsigned idx = 0; idx < eparms.size(); idx += 1) {
unsigned width = def->port(idx)->vector_width(); unsigned width = def->port(idx)->vector_width();
NetNet*tmp; NetNet*tmp;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -56,8 +56,8 @@ const char* StringHeap::add(const char*text)
char*buf = strdup(text); char*buf = strdup(text);
#ifdef CHECK_WITH_VALGRIND #ifdef CHECK_WITH_VALGRIND
string_pool_count += 1; string_pool_count += 1;
string_pool = (char**)realloc(string_pool, string_pool = static_cast<char**>(realloc(string_pool,
string_pool_count*sizeof(char**)); string_pool_count*sizeof(char**)));
string_pool[string_pool_count-1] = buf; string_pool[string_pool_count-1] = buf;
#endif #endif
return buf; return buf;
@ -72,19 +72,19 @@ const char* StringHeap::add(const char*text)
// same pointer. // same pointer.
if (rem > 0) { if (rem > 0) {
char*old = cell_base_; char*old = cell_base_;
cell_base_ = (char*)realloc(cell_base_, cell_ptr_); cell_base_ = static_cast<char*>(realloc(cell_base_, cell_ptr_));
assert(cell_base_ != 0); assert(cell_base_ != 0);
assert(cell_base_ == old); assert(cell_base_ == old);
} }
// start new cell // start new cell
cell_base_ = (char*)malloc(DEFAULT_CELL_SIZE); cell_base_ = static_cast<char*>(malloc(DEFAULT_CELL_SIZE));
cell_ptr_ = 0; cell_ptr_ = 0;
rem = DEFAULT_CELL_SIZE; rem = DEFAULT_CELL_SIZE;
assert(cell_base_ != 0); assert(cell_base_ != 0);
#ifdef CHECK_WITH_VALGRIND #ifdef CHECK_WITH_VALGRIND
string_pool_count += 1; string_pool_count += 1;
string_pool = (char **) realloc(string_pool, string_pool = static_cast<char **>(realloc(string_pool,
string_pool_count*sizeof(char **)); string_pool_count*sizeof(char **)));
string_pool[string_pool_count-1] = cell_base_; string_pool[string_pool_count-1] = cell_base_;
#endif #endif
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -122,7 +122,7 @@ int build_library_index(const char*path, bool key_case_sensitive)
/* Scan the director for files. check each file name to see if /* Scan the director for files. check each file name to see if
it has one of the configured suffixes. If it does, then use it has one of the configured suffixes. If it does, then use
the root of the name as the key and index the file name. */ the root of the name as the key and index the file name. */
while (struct dirent*de = readdir(dir)) { while (const struct dirent*de = readdir(dir)) {
unsigned namsiz = strlen(de->d_name); unsigned namsiz = strlen(de->d_name);
char*key = 0; char*key = 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -290,7 +290,7 @@ unsigned NetAssignBase::l_val_count() const
unsigned NetAssignBase::lwidth() const unsigned NetAssignBase::lwidth() const
{ {
unsigned sum = 0; unsigned sum = 0;
for (NetAssign_*cur = lval_ ; cur ; cur = cur->more) for (const NetAssign_*cur = lval_ ; cur ; cur = cur->more)
sum += cur->lwidth(); sum += cur->lwidth();
return sum; return sum;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -643,7 +643,7 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur)
if ((*cur).second.range == 0) if ((*cur).second.range == 0)
return; return;
NetEConst*val = dynamic_cast<NetEConst*>((*cur).second.val); const NetEConst*val = dynamic_cast<NetEConst*>((*cur).second.val);
ivl_assert(*expr, val); ivl_assert(*expr, val);
verinum value = val->value(); verinum value = val->value();
@ -659,7 +659,7 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur)
continue; continue;
if (value_range->low_expr) { if (value_range->low_expr) {
NetEConst*tmp = dynamic_cast<NetEConst*>(value_range->low_expr); const NetEConst*tmp = dynamic_cast<NetEConst*>(value_range->low_expr);
ivl_assert(*value_range->low_expr, tmp); ivl_assert(*value_range->low_expr, tmp);
if (value_range->low_open_flag && value <= tmp->value()) if (value_range->low_open_flag && value <= tmp->value())
continue; continue;
@ -668,7 +668,7 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur)
} }
if (value_range->high_expr) { if (value_range->high_expr) {
NetEConst*tmp = dynamic_cast<NetEConst*>(value_range->high_expr); const NetEConst*tmp = dynamic_cast<NetEConst*>(value_range->high_expr);
ivl_assert(*value_range->high_expr, tmp); ivl_assert(*value_range->high_expr, tmp);
if (value_range->high_open_flag && value >= tmp->value()) if (value_range->high_open_flag && value >= tmp->value())
continue; continue;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com) * Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -73,7 +73,7 @@ const NetScope* NetEvent::scope() const
unsigned NetEvent::nprobe() const unsigned NetEvent::nprobe() const
{ {
unsigned cnt = 0; unsigned cnt = 0;
NetEvProbe*cur = probes_; const NetEvProbe*cur = probes_;
while (cur) { while (cur) {
cnt += 1; cnt += 1;
cur = cur->enext_; cur = cur->enext_;
@ -105,7 +105,7 @@ const NetEvProbe* NetEvent::probe(unsigned idx) const
unsigned NetEvent::ntrig() const unsigned NetEvent::ntrig() const
{ {
unsigned cnt = 0; unsigned cnt = 0;
NetEvTrig*cur = trig_; const NetEvTrig*cur = trig_;
while (cur) { while (cur) {
cnt += 1; cnt += 1;
cur = cur->enext_; cur = cur->enext_;
@ -198,7 +198,7 @@ void NetEvent::find_similar_event(list<NetEvent*>&event_list)
continue; continue;
unsigned tcnt = 0; unsigned tcnt = 0;
for (NetEvProbe*cur = tmp->probes_ ; cur ; cur = cur->enext_) for (const NetEvProbe*cur = tmp->probes_ ; cur ; cur = cur->enext_)
tcnt += 1; tcnt += 1;
if (tcnt == probe_count) if (tcnt == probe_count)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -52,7 +52,7 @@ NetUserFunc::~NetUserFunc()
unsigned NetUserFunc::port_width(unsigned port) const unsigned NetUserFunc::port_width(unsigned port) const
{ {
NetFuncDef*fdef = def_->func_def(); const NetFuncDef*fdef = def_->func_def();
/* Port 0 is the return port. */ /* Port 0 is the return port. */
if (port == 0) { if (port == 0) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -329,7 +329,7 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc,
return false; return false;
} }
NetEConst*word_const = dynamic_cast<NetEConst*>(word_result); const NetEConst*word_const = dynamic_cast<NetEConst*>(word_result);
ivl_assert(loc, word_const); ivl_assert(loc, word_const);
if (!word_const->value().is_defined()) if (!word_const->value().is_defined())
@ -353,7 +353,7 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc,
return false; return false;
} }
NetEConst*base_const = dynamic_cast<NetEConst*>(base_result); const NetEConst*base_const = dynamic_cast<NetEConst*>(base_result);
ivl_assert(loc, base_const); ivl_assert(loc, base_const);
long base = base_const->value().as_long(); long base = base_const->value().as_long();
@ -361,10 +361,10 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc,
if (old_lval == 0) if (old_lval == 0)
old_lval = make_const_x(lval->sig()->vector_width()); old_lval = make_const_x(lval->sig()->vector_width());
NetEConst*lval_const = dynamic_cast<NetEConst*>(old_lval); const NetEConst*lval_const = dynamic_cast<NetEConst*>(old_lval);
ivl_assert(loc, lval_const); ivl_assert(loc, lval_const);
verinum lval_v = lval_const->value(); verinum lval_v = lval_const->value();
NetEConst*rval_const = dynamic_cast<NetEConst*>(rval_result); const NetEConst*rval_const = dynamic_cast<NetEConst*>(rval_result);
ivl_assert(loc, rval_const); ivl_assert(loc, rval_const);
verinum rval_v = rval_const->value(); verinum rval_v = rval_const->value();
@ -392,10 +392,10 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc,
if (op_ == 0) { if (op_ == 0) {
rval_result = fix_assign_value(lval->sig(), rval_result); rval_result = fix_assign_value(lval->sig(), rval_result);
} else if (dynamic_cast<NetECReal*>(rval_result)) { } else if (dynamic_cast<NetECReal*>(rval_result)) {
NetECReal*lval_const = dynamic_cast<NetECReal*>(old_lval); const NetECReal*lval_const = dynamic_cast<NetECReal*>(old_lval);
ivl_assert(loc, lval_const); ivl_assert(loc, lval_const);
verireal lval_r = lval_const->value(); verireal lval_r = lval_const->value();
NetECReal*rval_const = dynamic_cast<NetECReal*>(rval_result); const NetECReal*rval_const = dynamic_cast<NetECReal*>(rval_result);
ivl_assert(loc, rval_const); ivl_assert(loc, rval_const);
verireal rval_r = rval_const->value(); verireal rval_r = rval_const->value();
@ -404,10 +404,10 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc,
delete rval_result; delete rval_result;
rval_result = new NetECReal(lval_r); rval_result = new NetECReal(lval_r);
} else { } else {
NetEConst*lval_const = dynamic_cast<NetEConst*>(old_lval); const NetEConst*lval_const = dynamic_cast<NetEConst*>(old_lval);
ivl_assert(loc, lval_const); ivl_assert(loc, lval_const);
verinum lval_v = lval_const->value(); verinum lval_v = lval_const->value();
NetEConst*rval_const = dynamic_cast<NetEConst*>(rval_result); const NetEConst*rval_const = dynamic_cast<NetEConst*>(rval_result);
ivl_assert(loc, rval_const); ivl_assert(loc, rval_const);
verinum rval_v = rval_const->value(); verinum rval_v = rval_const->value();
@ -453,7 +453,7 @@ bool NetAssign::evaluate_function(const LineInfo&loc,
// If we get here, the LHS must be a concatenation, so we // If we get here, the LHS must be a concatenation, so we
// expect the RHS to be a vector value. // expect the RHS to be a vector value.
NetEConst*rval_const = dynamic_cast<NetEConst*>(rval_result); const NetEConst*rval_const = dynamic_cast<NetEConst*>(rval_result);
ivl_assert(*this, rval_const); ivl_assert(*this, rval_const);
if (op_) { if (op_) {
@ -557,13 +557,13 @@ bool NetCase::evaluate_function_vect_(const LineInfo&loc,
if (case_expr == 0) if (case_expr == 0)
return false; return false;
NetEConst*case_const = dynamic_cast<NetEConst*> (case_expr); const NetEConst*case_const = dynamic_cast<NetEConst*> (case_expr);
ivl_assert(loc, case_const); ivl_assert(loc, case_const);
verinum case_val = case_const->value(); verinum case_val = case_const->value();
delete case_expr; delete case_expr;
NetProc*default_statement = 0; const NetProc*default_statement = 0;
for (unsigned cnt = 0 ; cnt < items_.size() ; cnt += 1) { for (unsigned cnt = 0 ; cnt < items_.size() ; cnt += 1) {
const Item*item = &items_[cnt]; const Item*item = &items_[cnt];
@ -577,7 +577,7 @@ bool NetCase::evaluate_function_vect_(const LineInfo&loc,
if (item_expr == 0) if (item_expr == 0)
return false; return false;
NetEConst*item_const = dynamic_cast<NetEConst*> (item_expr); const NetEConst*item_const = dynamic_cast<NetEConst*> (item_expr);
ivl_assert(loc, item_const); ivl_assert(loc, item_const);
verinum item_val = item_const->value(); verinum item_val = item_const->value();
@ -619,13 +619,13 @@ bool NetCase::evaluate_function_real_(const LineInfo&loc,
if (case_expr == 0) if (case_expr == 0)
return false; return false;
NetECReal*case_const = dynamic_cast<NetECReal*> (case_expr); const NetECReal*case_const = dynamic_cast<NetECReal*> (case_expr);
ivl_assert(loc, case_const); ivl_assert(loc, case_const);
double case_val = case_const->value().as_double(); double case_val = case_const->value().as_double();
delete case_expr; delete case_expr;
NetProc*default_statement = 0; const NetProc*default_statement = 0;
for (unsigned cnt = 0 ; cnt < items_.size() ; cnt += 1) { for (unsigned cnt = 0 ; cnt < items_.size() ; cnt += 1) {
const Item*item = &items_[cnt]; const Item*item = &items_[cnt];
@ -639,7 +639,7 @@ bool NetCase::evaluate_function_real_(const LineInfo&loc,
if (item_expr == 0) if (item_expr == 0)
return false; return false;
NetECReal*item_const = dynamic_cast<NetECReal*> (item_expr); const NetECReal*item_const = dynamic_cast<NetECReal*> (item_expr);
ivl_assert(loc, item_const); ivl_assert(loc, item_const);
double item_val = item_const->value().as_double(); double item_val = item_const->value().as_double();
@ -677,7 +677,7 @@ bool NetCondit::evaluate_function(const LineInfo&loc,
return false; return false;
} }
NetEConst*cond_const = dynamic_cast<NetEConst*> (cond); const NetEConst*cond_const = dynamic_cast<NetEConst*> (cond);
ivl_assert(loc, cond_const); ivl_assert(loc, cond_const);
long val = cond_const->value().as_long(); long val = cond_const->value().as_long();
@ -767,7 +767,7 @@ bool NetDoWhile::evaluate_function(const LineInfo&loc,
break; break;
} }
NetEConst*cond_const = dynamic_cast<NetEConst*> (cond); const NetEConst*cond_const = dynamic_cast<NetEConst*> (cond);
ivl_assert(loc, cond_const); ivl_assert(loc, cond_const);
long val = cond_const->value().as_long(); long val = cond_const->value().as_long();
@ -843,7 +843,7 @@ bool NetForLoop::evaluate_function(const LineInfo&loc,
break; break;
} }
NetEConst*cond_const = dynamic_cast<NetEConst*> (cond); const NetEConst*cond_const = dynamic_cast<NetEConst*> (cond);
ivl_assert(loc, cond_const); ivl_assert(loc, cond_const);
long val = cond_const->value().as_long(); long val = cond_const->value().as_long();
@ -891,7 +891,7 @@ bool NetRepeat::evaluate_function(const LineInfo&loc,
NetExpr*count_expr = expr_->evaluate_function(loc, context_map); NetExpr*count_expr = expr_->evaluate_function(loc, context_map);
if (count_expr == 0) return false; if (count_expr == 0) return false;
NetEConst*count_const = dynamic_cast<NetEConst*> (count_expr); const NetEConst*count_const = dynamic_cast<NetEConst*> (count_expr);
ivl_assert(loc, count_const); ivl_assert(loc, count_const);
long count = count_const->value().as_long(); long count = count_const->value().as_long();
@ -948,7 +948,7 @@ bool NetWhile::evaluate_function(const LineInfo&loc,
break; break;
} }
NetEConst*cond_const = dynamic_cast<NetEConst*> (cond); const NetEConst*cond_const = dynamic_cast<NetEConst*> (cond);
ivl_assert(loc, cond_const); ivl_assert(loc, cond_const);
long val = cond_const->value().as_long(); long val = cond_const->value().as_long();
@ -1047,7 +1047,7 @@ NetExpr* NetESelect::evaluate_function(const LineInfo&loc,
NetExpr*sub_exp = expr_->evaluate_function(loc, context_map); NetExpr*sub_exp = expr_->evaluate_function(loc, context_map);
ivl_assert(loc, sub_exp); ivl_assert(loc, sub_exp);
NetEConst*sub_const = dynamic_cast<NetEConst*> (sub_exp); const NetEConst*sub_const = dynamic_cast<NetEConst*> (sub_exp);
ivl_assert(loc, sub_exp); ivl_assert(loc, sub_exp);
verinum sub = sub_const->value(); verinum sub = sub_const->value();
@ -1058,7 +1058,7 @@ NetExpr* NetESelect::evaluate_function(const LineInfo&loc,
NetExpr*base_val = base_->evaluate_function(loc, context_map); NetExpr*base_val = base_->evaluate_function(loc, context_map);
ivl_assert(loc, base_val); ivl_assert(loc, base_val);
NetEConst*base_const = dynamic_cast<NetEConst*>(base_val); const NetEConst*base_const = dynamic_cast<NetEConst*>(base_val);
ivl_assert(loc, base_const); ivl_assert(loc, base_const);
base = base_const->value().as_long(); base = base_const->value().as_long();
@ -1096,14 +1096,14 @@ NetExpr* NetESignal::evaluate_function(const LineInfo&loc,
var = var->ref; var = var->ref;
} }
NetExpr*value = 0; const NetExpr*value = 0;
if (var->nwords > 0) { if (var->nwords > 0) {
ivl_assert(loc, word_); ivl_assert(loc, word_);
NetExpr*word_result = word_->evaluate_function(loc, context_map); NetExpr*word_result = word_->evaluate_function(loc, context_map);
if (word_result == 0) if (word_result == 0)
return 0; return 0;
NetEConst*word_const = dynamic_cast<NetEConst*>(word_result); const NetEConst*word_const = dynamic_cast<NetEConst*>(word_result);
ivl_assert(loc, word_const); ivl_assert(loc, word_const);
int word = word_const->value().as_long(); int word = word_const->value().as_long();
@ -1202,7 +1202,7 @@ NetExpr* NetESFunc::evaluate_function(const LineInfo&loc,
NetExpr* NetEUFunc::evaluate_function(const LineInfo&loc, NetExpr* NetEUFunc::evaluate_function(const LineInfo&loc,
map<perm_string,LocalVar>&context_map) const map<perm_string,LocalVar>&context_map) const
{ {
NetFuncDef*def = func_->func_def(); const NetFuncDef*def = func_->func_def();
ivl_assert(*this, def); ivl_assert(*this, def);
vector<NetExpr*>args(parms_.size()); vector<NetExpr*>args(parms_.size());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -144,9 +144,9 @@ NexusSet* NetESelect::nex_input(bool rem_out, bool always_sens, bool nested_func
NexusSet*tmp = expr_->nex_input(rem_out, always_sens, nested_func); NexusSet*tmp = expr_->nex_input(rem_out, always_sens, nested_func);
bool const_select = result->size() == 0; bool const_select = result->size() == 0;
if (always_sens && const_select) { if (always_sens && const_select) {
if (NetEConst *val = dynamic_cast <NetEConst*> (base_)) { if (const NetEConst *val = dynamic_cast <NetEConst*> (base_)) {
assert(select_type() == IVL_SEL_OTHER); assert(select_type() == IVL_SEL_OTHER);
if (NetESignal *sig = dynamic_cast<NetESignal*> (expr_)) { if (const NetESignal *sig = dynamic_cast<NetESignal*> (expr_)) {
delete tmp; delete tmp;
tmp = sig->nex_input_base(rem_out, always_sens, nested_func, tmp = sig->nex_input_base(rem_out, always_sens, nested_func,
val->value().as_unsigned(), expr_width()); val->value().as_unsigned(), expr_width());
@ -221,7 +221,7 @@ NexusSet* NetESignal::nex_input_base(bool rem_out, bool always_sens, bool nested
<< net_->unpacked_count() << " words in array '" << net_->unpacked_count() << " words in array '"
<< name() << "'." << endl; << name() << "'." << endl;
} }
if (always_sens) if (NetEConst *val = dynamic_cast <NetEConst*> (word_)) { if (always_sens) if (const NetEConst *val = dynamic_cast <NetEConst*> (word_)) {
const_select = true; const_select = true;
const_word = val->value().as_unsigned(); const_word = val->value().as_unsigned();
} }
@ -337,7 +337,7 @@ NexusSet* NetAssignBase::nex_input(bool rem_out, bool always_sens, bool nested_f
/* It is possible that the lval_ can have nex_input values. In /* It is possible that the lval_ can have nex_input values. In
particular, index expressions are statement inputs as well, particular, index expressions are statement inputs as well,
so should be addressed here. */ so should be addressed here. */
for (NetAssign_*cur = lval_ ; cur ; cur = cur->more) { for (const NetAssign_*cur = lval_ ; cur ; cur = cur->more) {
NexusSet*tmp = cur->nex_input(rem_out, always_sens, nested_func); NexusSet*tmp = cur->nex_input(rem_out, always_sens, nested_func);
result->add(*tmp); result->add(*tmp);
delete tmp; delete tmp;

View File

@ -133,7 +133,7 @@ void NetCase::prune()
// If the guard expression is not constant, assume // If the guard expression is not constant, assume
// all bits are needed, so no pruning can be done. // all bits are needed, so no pruning can be done.
NetEConst*gc = dynamic_cast<NetEConst*>(items_[idx].guard); const NetEConst*gc = dynamic_cast<NetEConst*>(items_[idx].guard);
if (gc == 0) if (gc == 0)
return; return;

View File

@ -1,7 +1,7 @@
#ifndef IVL_netclass_H #ifndef IVL_netclass_H
#define IVL_netclass_H #define IVL_netclass_H
/* /*
* Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -36,7 +36,7 @@ class PExpr;
class netclass_t : public ivl_type_s { class netclass_t : public ivl_type_s {
public: public:
netclass_t(perm_string class_name, const netclass_t*super); netclass_t(perm_string class_name, const netclass_t*super);
~netclass_t(); ~netclass_t() override;
// Set the property of the class during elaboration. Set the // Set the property of the class during elaboration. Set the
// name and type, and return true. If the name is already // name and type, and return true. If the name is already
@ -61,7 +61,7 @@ class netclass_t : public ivl_type_s {
// As an ivl_type_s object, the netclass is always an // As an ivl_type_s object, the netclass is always an
// ivl_VT_CLASS object. // ivl_VT_CLASS object.
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
// This is the name of the class type // This is the name of the class type
inline perm_string get_name() const { return name_; } inline perm_string get_name() const { return name_; }
@ -114,7 +114,7 @@ class netclass_t : public ivl_type_s {
void emit_scope(struct target_t*tgt) const; void emit_scope(struct target_t*tgt) const;
bool emit_defs(struct target_t*tgt) const; bool emit_defs(struct target_t*tgt) const;
std::ostream& debug_dump(std::ostream&fd) const; std::ostream& debug_dump(std::ostream&fd) const override;
void dump_scope(std::ostream&fd) const; void dump_scope(std::ostream&fd) const;
const NetExpr* get_parameter(Design *des, perm_string name, const NetExpr* get_parameter(Design *des, perm_string name,
@ -124,7 +124,7 @@ class netclass_t : public ivl_type_s {
bool is_virtual() const { return virtual_class_; } bool is_virtual() const { return virtual_class_; }
protected: protected:
bool test_compatibility(ivl_type_t that) const; bool test_compatibility(ivl_type_t that) const override;
private: private:
perm_string name_; perm_string name_;

View File

@ -1,7 +1,7 @@
#ifndef IVL_netdarray_H #ifndef IVL_netdarray_H
#define IVL_netdarray_H #define IVL_netdarray_H
/* /*
* Copyright (c) 2012-2015 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -26,15 +26,15 @@ class netdarray_t : public netarray_t {
public: public:
explicit netdarray_t(ivl_type_t vec); explicit netdarray_t(ivl_type_t vec);
~netdarray_t(); ~netdarray_t() override;
// This is the "base_type()" virtual method of the // This is the "base_type()" virtual method of the
// nettype_base_t. The ivl_target api expects this to return // nettype_base_t. The ivl_target api expects this to return
// IVL_VT_DARRAY for dynamic arrays? // IVL_VT_DARRAY for dynamic arrays?
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
// A dynamic array may have a type that is signed. // A dynamic array may have a type that is signed.
inline bool get_signed() const { return element_type()->get_signed(); } inline bool get_signed() const override { return element_type()->get_signed(); }
// This is the base_type() of the element of the array. We // This is the base_type() of the element of the array. We
// need this in some cases in order to get the base type of // need this in some cases in order to get the base type of
@ -45,11 +45,11 @@ class netdarray_t : public netarray_t {
// element. Strictly speaking it's not necessary. // element. Strictly speaking it's not necessary.
inline unsigned long element_width(void) const { return element_type()->packed_width(); } inline unsigned long element_width(void) const { return element_type()->packed_width(); }
std::ostream& debug_dump(std::ostream&) const; std::ostream& debug_dump(std::ostream&) const override;
private: private:
bool test_compatibility(ivl_type_t that) const; bool test_compatibility(ivl_type_t that) const override;
bool test_equivalence(ivl_type_t that) const; bool test_equivalence(ivl_type_t that) const override;
}; };
#endif /* IVL_netdarray_H */ #endif /* IVL_netdarray_H */

View File

@ -1,7 +1,7 @@
#ifndef IVL_netenum_H #ifndef IVL_netenum_H
#define IVL_netenum_H #define IVL_netenum_H
/* /*
* Copyright (c) 2010-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2010-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -34,13 +34,13 @@ class netenum_t : public LineInfo, public ivl_type_s {
public: public:
explicit netenum_t(ivl_type_t base_type, size_t name_count, explicit netenum_t(ivl_type_t base_type, size_t name_count,
bool integer_flag); bool integer_flag);
~netenum_t(); ~netenum_t() override;
virtual ivl_variable_type_t base_type() const; virtual ivl_variable_type_t base_type() const override;
virtual bool packed() const; virtual bool packed() const override;
virtual long packed_width() const; virtual long packed_width() const override;
netranges_t slice_dimensions() const; netranges_t slice_dimensions() const override;
bool get_signed() const; bool get_signed() const override;
bool get_isint() const; bool get_isint() const;
// The size() is the number of enumeration literals. // The size() is the number of enumeration literals.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -1013,7 +1013,7 @@ NetProcTop::~NetProcTop()
bool flag = false; bool flag = false;
for (unsigned idx = 0 ; idx < nex_set.size() ; idx += 1) { for (unsigned idx = 0 ; idx < nex_set.size() ; idx += 1) {
NetNet*net = nex_set[idx].lnk.nexus()->pick_any_net(); const NetNet*net = nex_set[idx].lnk.nexus()->pick_any_net();
if (net->peek_lref() > 0) { if (net->peek_lref() > 0) {
cerr << get_fileline() << ": warning: '" << net->name() cerr << get_fileline() << ": warning: '" << net->name()
<< "' is driven by more than one process." << endl; << "' is driven by more than one process." << endl;
@ -3070,7 +3070,7 @@ static void check_if_logic_l_value(const NetAssignBase *base,
const NetAssign_*lval = base->l_val(0); const NetAssign_*lval = base->l_val(0);
if (! lval) return; if (! lval) return;
NetNet*sig = lval->sig(); const NetNet*sig = lval->sig();
if (! sig) return; if (! sig) return;
if ((sig->data_type() != IVL_VT_BOOL) && if ((sig->data_type() != IVL_VT_BOOL) &&
@ -3451,7 +3451,7 @@ bool NetScope::check_synth(ivl_process_type_t pr_type,
{ {
bool result = false; bool result = false;
// Skip local events/signals // Skip local events/signals
for (NetEvent*cur = events_ ; cur ; cur = cur->snext_) { for (const NetEvent*cur = events_ ; cur ; cur = cur->snext_) {
if (cur->local_flag()) continue; if (cur->local_flag()) continue;
cerr << cur->get_fileline() << ": warning: An event (" cerr << cur->get_fileline() << ": warning: An event ("
<< cur->name() << ") cannot be synthesized " << cur->name() << ") cannot be synthesized "

666
netlist.h

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -34,7 +34,7 @@ using namespace std;
NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig) NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig)
{ {
netvector_t*zero_vec = new netvector_t(sig->data_type(), const netvector_t*zero_vec = new netvector_t(sig->data_type(),
sig->vector_width()-1, 0); sig->vector_width()-1, 0);
NetNet*zero_net = new NetNet(scope, scope->local_symbol(), NetNet*zero_net = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, zero_vec); NetNet::WIRE, zero_vec);
@ -68,7 +68,7 @@ NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig)
connect(zero_net->pin(0), adder->pin_DataA()); connect(zero_net->pin(0), adder->pin_DataA());
connect(adder->pin_DataB(), sig->pin(0)); connect(adder->pin_DataB(), sig->pin(0));
netvector_t*tmp_vec = new netvector_t(sig->data_type(), const netvector_t*tmp_vec = new netvector_t(sig->data_type(),
sig->vector_width()-1, 0); sig->vector_width()-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
@ -85,7 +85,7 @@ NetNet* cast_to_int2(Design*des, NetScope*scope, NetNet*src, unsigned wid)
if (src->data_type() == IVL_VT_BOOL) if (src->data_type() == IVL_VT_BOOL)
return src; return src;
netvector_t*tmp_vec = new netvector_t(IVL_VT_BOOL, wid-1, 0, const netvector_t*tmp_vec = new netvector_t(IVL_VT_BOOL, wid-1, 0,
src->get_signed()); src->get_signed());
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec);
tmp->set_line(*src); tmp->set_line(*src);
@ -106,7 +106,7 @@ NetNet* cast_to_int4(Design*des, NetScope*scope, NetNet*src, unsigned wid)
if (src->data_type() != IVL_VT_REAL) if (src->data_type() != IVL_VT_REAL)
return src; return src;
netvector_t*tmp_vec = new netvector_t(IVL_VT_LOGIC, wid-1, 0); const netvector_t*tmp_vec = new netvector_t(IVL_VT_LOGIC, wid-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec);
tmp->set_line(*src); tmp->set_line(*src);
tmp->local_flag(true); tmp->local_flag(true);
@ -126,7 +126,7 @@ NetNet* cast_to_real(Design*des, NetScope*scope, NetNet*src)
if (src->data_type() == IVL_VT_REAL) if (src->data_type() == IVL_VT_REAL)
return src; return src;
netvector_t*tmp_vec = new netvector_t(IVL_VT_REAL); const netvector_t*tmp_vec = new netvector_t(IVL_VT_REAL);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec);
tmp->set_line(*src); tmp->set_line(*src);
tmp->local_flag(true); tmp->local_flag(true);
@ -514,7 +514,7 @@ void indices_to_expressions(Design*des, NetScope*scope,
// Track if we detect any non-constant expressions // Track if we detect any non-constant expressions
// here. This may allow for a special case. // here. This may allow for a special case.
NetEConst*word_const = dynamic_cast<NetEConst*> (word_index); const NetEConst*word_const = dynamic_cast<NetEConst*> (word_index);
if (word_const == 0) if (word_const == 0)
flags.variable = true; flags.variable = true;
else if (!word_const->value().is_defined()) else if (!word_const->value().is_defined())
@ -631,7 +631,7 @@ NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netranges_t&dims,
// Now generate the math to calculate the canonical address. // Now generate the math to calculate the canonical address.
NetExpr*tmp_scaled = 0; NetExpr*tmp_scaled = 0;
if (NetEConst*tmp_const = dynamic_cast<NetEConst*> (tmp)) { if (const NetEConst*tmp_const = dynamic_cast<NetEConst*> (tmp)) {
// Special case: the index is constant, so this // Special case: the index is constant, so this
// iteration can be replaced with a constant // iteration can be replaced with a constant
// expression. // expression.
@ -748,7 +748,7 @@ static NetNet* make_const_net(Design*des, NetScope*scope, verinum val)
NetConst*res = new NetConst(scope, scope->local_symbol(), val); NetConst*res = new NetConst(scope, scope->local_symbol(), val);
des->add_node(res); des->add_node(res);
netvector_t*sig_vec = new netvector_t(IVL_VT_LOGIC, val.len() - 1, 0); const netvector_t*sig_vec = new netvector_t(IVL_VT_LOGIC, val.len() - 1, 0);
NetNet*sig = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, sig_vec); NetNet*sig = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, sig_vec);
sig->local_flag(true); sig->local_flag(true);
@ -774,7 +774,7 @@ NetNet* make_const_z(Design*des, NetScope*scope, unsigned long wid)
NetExpr* condition_reduce(NetExpr*expr) NetExpr* condition_reduce(NetExpr*expr)
{ {
if (expr->expr_type() == IVL_VT_REAL) { if (expr->expr_type() == IVL_VT_REAL) {
if (NetECReal *tmp = dynamic_cast<NetECReal*>(expr)) { if (const NetECReal *tmp = dynamic_cast<NetECReal*>(expr)) {
verinum::V res; verinum::V res;
if (tmp->value().as_double() == 0.0) res = verinum::V0; if (tmp->value().as_double() == 0.0) res = verinum::V0;
else res = verinum::V1; else res = verinum::V1;
@ -1181,12 +1181,12 @@ bool eval_as_long(long&value, const NetExpr*expr)
bool eval_as_double(double&value, NetExpr*expr) bool eval_as_double(double&value, NetExpr*expr)
{ {
if (NetEConst*tmp = dynamic_cast<NetEConst*>(expr) ) { if (const NetEConst*tmp = dynamic_cast<NetEConst*>(expr) ) {
value = tmp->value().as_double(); value = tmp->value().as_double();
return true; return true;
} }
if (NetECReal*rtmp = dynamic_cast<NetECReal*>(expr)) { if (const NetECReal*rtmp = dynamic_cast<NetECReal*>(expr)) {
value = rtmp->value().as_double(); value = rtmp->value().as_double();
return true; return true;
} }
@ -1431,7 +1431,7 @@ void collapse_partselect_pv_to_concat(Design*des, NetNet*sig)
unsigned idx = 0; unsigned idx = 0;
unsigned device_count = 0; unsigned device_count = 0;
while (idx < ps_map.size()) { while (idx < ps_map.size()) {
NetPartSelect*ps_obj = ps_map[idx]; const NetPartSelect*ps_obj = ps_map[idx];
if (ps_obj == 0) if (ps_obj == 0)
return; return;

View File

@ -1,7 +1,7 @@
#ifndef IVL_netarray_H #ifndef IVL_netarray_H
#define IVL_netarray_H #define IVL_netarray_H
/* /*
* Copyright (c) 2012-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* Copyright CERN 2012 / Stephen Williams (steve@icarus.com) * Copyright CERN 2012 / Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -31,7 +31,7 @@ class netsarray_t : public netarray_t {
public: public:
explicit netsarray_t(const netranges_t&packed, ivl_type_t etype); explicit netsarray_t(const netranges_t&packed, ivl_type_t etype);
~netsarray_t(); ~netsarray_t() override;
public: public:
// Virtual methods from the ivl_type_s type... // Virtual methods from the ivl_type_s type...
@ -57,17 +57,17 @@ class netparray_t : public netsarray_t {
public: public:
explicit netparray_t(const netranges_t&packed, ivl_type_t etype); explicit netparray_t(const netranges_t&packed, ivl_type_t etype);
~netparray_t(); ~netparray_t() override;
public: public:
// Virtual methods from the ivl_type_s type... // Virtual methods from the ivl_type_s type...
bool packed(void) const; bool packed(void) const override;
long packed_width(void) const; long packed_width(void) const override;
netranges_t slice_dimensions() const; netranges_t slice_dimensions() const override;
private: private:
bool test_compatibility(ivl_type_t that) const; bool test_compatibility(ivl_type_t that) const override;
bool test_equivalence(ivl_type_t that) const; bool test_equivalence(ivl_type_t that) const override;
}; };
inline netparray_t::netparray_t(const netranges_t&pd, ivl_type_t etype) inline netparray_t::netparray_t(const netranges_t&pd, ivl_type_t etype)
@ -82,14 +82,14 @@ class netuarray_t : public netsarray_t {
public: public:
explicit netuarray_t(const netranges_t&packed, ivl_type_t etype); explicit netuarray_t(const netranges_t&packed, ivl_type_t etype);
~netuarray_t(); ~netuarray_t() override;
public: public:
// Virtual methods from the ivl_type_s type... // Virtual methods from the ivl_type_s type...
netranges_t slice_dimensions() const; netranges_t slice_dimensions() const override;
private: private:
bool test_equivalence(ivl_type_t that) const; bool test_equivalence(ivl_type_t that) const override;
}; };
inline netuarray_t::netuarray_t(const netranges_t&pd, ivl_type_t etype) inline netuarray_t::netuarray_t(const netranges_t&pd, ivl_type_t etype)

View File

@ -1,7 +1,7 @@
#ifndef IVL__netqueue_H #ifndef IVL__netqueue_H
#define IVL__netqueue_H #define IVL__netqueue_H
/* /*
* Copyright (c) 2014-2020 Stephen Williams (steve@icarus.com) * Copyright (c) 2014-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -31,16 +31,16 @@ class netqueue_t : public netdarray_t {
public: public:
explicit netqueue_t(ivl_type_t vec, long max_idx); explicit netqueue_t(ivl_type_t vec, long max_idx);
~netqueue_t(); ~netqueue_t() override;
// This is the "base_type()" virtual method of the // This is the "base_type()" virtual method of the
// nettype_base_t. The ivl_target api expects this to return // nettype_base_t. The ivl_target api expects this to return
// IVL_VT_QUEUE for queues. // IVL_VT_QUEUE for queues.
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
long max_idx(void) const { return max_idx_; } long max_idx(void) const { return max_idx_; }
std::ostream& debug_dump(std::ostream&) const; std::ostream& debug_dump(std::ostream&) const override;
private: private:
long max_idx_; long max_idx_;

View File

@ -1,7 +1,7 @@
#ifndef IVL_netscalar_H #ifndef IVL_netscalar_H
#define IVL_netscalar_H #define IVL_netscalar_H
/* /*
* Copyright (c) 2013-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2013-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -25,13 +25,13 @@ class netreal_t : public ivl_type_s {
public: public:
inline explicit netreal_t() { } inline explicit netreal_t() { }
~netreal_t(); ~netreal_t() override;
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
bool get_signed() const { return true; } bool get_signed() const override { return true; }
bool get_scalar() const { return true; } bool get_scalar() const override { return true; }
std::ostream& debug_dump(std::ostream&) const; std::ostream& debug_dump(std::ostream&) const override;
public: public:
static netreal_t type_real; static netreal_t type_real;
@ -42,11 +42,11 @@ class netstring_t : public ivl_type_s {
public: public:
inline explicit netstring_t() { } inline explicit netstring_t() { }
~netstring_t(); ~netstring_t() override;
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
std::ostream& debug_dump(std::ostream&) const; std::ostream& debug_dump(std::ostream&) const override;
public: public:
static netstring_t type_string; static netstring_t type_string;

View File

@ -1,7 +1,7 @@
#ifndef IVL_netstruct_H #ifndef IVL_netstruct_H
#define IVL_netstruct_H #define IVL_netstruct_H
/* /*
* Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2011-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -40,7 +40,7 @@ class netstruct_t : public LineInfo, public ivl_type_s {
public: public:
netstruct_t(); netstruct_t();
~netstruct_t(); ~netstruct_t() override;
// If this is a union (instead of struct) then this flag is // If this is a union (instead of struct) then this flag is
// set. We handle union and struct together because they are // set. We handle union and struct together because they are
@ -49,11 +49,11 @@ class netstruct_t : public LineInfo, public ivl_type_s {
bool union_flag(void) const; bool union_flag(void) const;
void packed(bool flag); void packed(bool flag);
bool packed(void) const; bool packed(void) const override;
// When the struct is accessed as a primary it can be signed or unsigned // When the struct is accessed as a primary it can be signed or unsigned
void set_signed(bool flag) { signed_ = flag; } void set_signed(bool flag) { signed_ = flag; }
bool get_signed(void) const { return signed_; } bool get_signed(void) const override { return signed_; }
// Append a new member to the struct/union. This must be done // Append a new member to the struct/union. This must be done
// after the union_flag and packed settings are set. This // after the union_flag and packed settings are set. This
@ -69,16 +69,16 @@ class netstruct_t : public LineInfo, public ivl_type_s {
// Return the width (in bits) of the packed record, or -1 if // Return the width (in bits) of the packed record, or -1 if
// the record is not packed. // the record is not packed.
long packed_width() const; long packed_width() const override;
netranges_t slice_dimensions() const; netranges_t slice_dimensions() const override;
// Return the base type of the packed record, or // Return the base type of the packed record, or
// IVL_VT_NO_TYPE if the record is not packed. // IVL_VT_NO_TYPE if the record is not packed.
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
private: private:
bool test_compatibility(ivl_type_t that) const; bool test_compatibility(ivl_type_t that) const override;
bool test_equivalence(ivl_type_t that) const; bool test_equivalence(ivl_type_t that) const override;
private: private:
bool union_; bool union_;

View File

@ -1,7 +1,7 @@
#ifndef IVL_nettypes_H #ifndef IVL_nettypes_H
#define IVL_nettypes_H #define IVL_nettypes_H
/* /*
* Copyright (c) 2012-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -80,13 +80,13 @@ class netarray_t : public ivl_type_s {
public: public:
inline explicit netarray_t(ivl_type_t etype) : element_type_(etype) { } inline explicit netarray_t(ivl_type_t etype) : element_type_(etype) { }
~netarray_t(); ~netarray_t() override;
public: public:
// Some virtual methods have a common implementation for arrays. // Some virtual methods have a common implementation for arrays.
// The base_type() for arrays is the base_Typeof the element. // The base_type() for arrays is the base_Typeof the element.
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
public: public:
inline ivl_type_t element_type() const { return element_type_; } inline ivl_type_t element_type() const { return element_type_; }

View File

@ -1,7 +1,7 @@
#ifndef IVL_netvector_H #ifndef IVL_netvector_H
#define IVL_netvector_H #define IVL_netvector_H
/* /*
* Copyright (c) 2012-2014 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -37,29 +37,29 @@ class netvector_t : public ivl_type_s {
// Special case: scalar object--no packed dimensions at all. // Special case: scalar object--no packed dimensions at all.
explicit netvector_t(ivl_variable_type_t type); explicit netvector_t(ivl_variable_type_t type);
~netvector_t(); ~netvector_t() override;
// Vectors can be interpreted as signed or unsigned when // Vectors can be interpreted as signed or unsigned when
// handled as vectors. // handled as vectors.
inline void set_signed(bool flag) { signed_ = flag; } inline void set_signed(bool flag) { signed_ = flag; }
inline bool get_signed(void) const { return signed_; } inline bool get_signed(void) const override { return signed_; }
inline void set_isint(bool flag) { isint_ = flag; } inline void set_isint(bool flag) { isint_ = flag; }
inline bool get_isint(void) const { return isint_; } inline bool get_isint(void) const { return isint_; }
inline bool get_scalar(void) const { return packed_dims_.empty(); } inline bool get_scalar(void) const override { return packed_dims_.empty(); }
void set_implicit(bool implicit) { implicit_ = implicit; } void set_implicit(bool implicit) { implicit_ = implicit; }
bool get_implicit() const { return implicit_; } bool get_implicit() const { return implicit_; }
ivl_variable_type_t base_type() const; ivl_variable_type_t base_type() const override;
const netranges_t&packed_dims() const; const netranges_t&packed_dims() const;
bool packed(void) const; bool packed(void) const override;
long packed_width() const; long packed_width() const override;
netranges_t slice_dimensions() const; netranges_t slice_dimensions() const override;
std::ostream& debug_dump(std::ostream&) const; std::ostream& debug_dump(std::ostream&) const override;
public: public:
// Some commonly used predefined types // Some commonly used predefined types
@ -78,8 +78,8 @@ class netvector_t : public ivl_type_s {
static const netvector_t*integer_type(bool is_signed = true); static const netvector_t*integer_type(bool is_signed = true);
private: private:
bool test_compatibility(ivl_type_t that) const; bool test_compatibility(ivl_type_t that) const override;
bool test_equivalence(ivl_type_t that) const; bool test_equivalence(ivl_type_t that) const override;
private: private:
netranges_t packed_dims_; netranges_t packed_dims_;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -33,8 +33,8 @@ using namespace std;
class nodangle_f : public functor_t { class nodangle_f : public functor_t {
public: public:
void event(Design*des, NetEvent*ev); void event(Design*des, NetEvent*ev) override;
void signal(Design*des, NetNet*sig); void signal(Design*des, NetNet*sig) override;
unsigned iteration; unsigned iteration;
unsigned stotal, etotal; unsigned stotal, etotal;
@ -230,7 +230,7 @@ void nodangle_f::signal(Design*, NetNet*sig)
if (cur == &sig->pin(idx)) if (cur == &sig->pin(idx))
continue; continue;
NetNet*cursig = dynamic_cast<NetNet*>(cur->get_obj()); const NetNet*cursig = dynamic_cast<NetNet*>(cur->get_obj());
if (cursig == 0) if (cursig == 0)
continue; continue;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2016 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -106,7 +106,7 @@ NetNet*pad_to_width(Design*des, NetNet*net, unsigned wid, const LineInfo&info)
connect(cc->pin(2), con->pin(0)); connect(cc->pin(2), con->pin(0));
// Make a NetNet for the NetConst to NetConcat link. // Make a NetNet for the NetConst to NetConcat link.
netvector_t*tmp_vec = new netvector_t(net->data_type(), const netvector_t*tmp_vec = new netvector_t(net->data_type(),
wid - net->vector_width() - 1, 0); wid - net->vector_width() - 1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
@ -162,7 +162,7 @@ NetNet*crop_to_width(Design*des, NetNet*net, unsigned wid)
ps->set_line(*net); ps->set_line(*net);
des->add_node(ps); des->add_node(ps);
netvector_t*tmp_vec = new netvector_t(net->data_type(), wid-1, 0); const netvector_t*tmp_vec = new netvector_t(net->data_type(), wid-1, 0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
tmp->set_line(*net); tmp->set_line(*net);

View File

@ -439,7 +439,7 @@ Module::port_t *module_declare_port(const YYLTYPE&loc, char *id,
// are variables. Unlike the other port types, which are nets in // are variables. Unlike the other port types, which are nets in
// that case. // that case.
if (net_type == NetNet::IMPLICIT) { if (net_type == NetNet::IMPLICIT) {
if (vector_type_t*dtype = dynamic_cast<vector_type_t*> (data_type)) { if (const vector_type_t*dtype = dynamic_cast<vector_type_t*> (data_type)) {
if (!dtype->implicit_flag) if (!dtype->implicit_flag)
net_type = NetNet::IMPLICIT_REG; net_type = NetNet::IMPLICIT_REG;
} else if (data_type) { } else if (data_type) {
@ -4998,7 +4998,7 @@ module_item
*/ */
| attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' | attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';'
{ NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE; { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) { if (const vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
if (dtype->implicit_flag) if (dtype->implicit_flag)
use_type = NetNet::NONE; use_type = NetNet::NONE;
} }
@ -5010,7 +5010,7 @@ module_item
| attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' | attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';'
{ NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE; { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) { if (const vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
if (dtype->implicit_flag) if (dtype->implicit_flag)
use_type = NetNet::NONE; use_type = NetNet::NONE;
} }
@ -5022,7 +5022,7 @@ module_item
| attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' | attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';'
{ NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE; { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE;
if (vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) { if (const vector_type_t*dtype = dynamic_cast<vector_type_t*> ($3)) {
if (dtype->implicit_flag) if (dtype->implicit_flag)
use_type = NetNet::NONE; use_type = NetNet::NONE;
else else

View File

@ -138,7 +138,7 @@ void parm_to_defparam_list(const string&param)
unsigned off = param.find('='); unsigned off = param.find('=');
if (off > param.size()) { if (off > param.size()) {
key = strdup(param.c_str()); key = strdup(param.c_str());
value = (char*)malloc(1); value = static_cast<char*>(malloc(1));
*value = '\0'; *value = '\0';
} else { } else {
@ -2007,7 +2007,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
// XXXX // XXXX
ivl_assert(loc, pins[0]->get_wire_type() == NetNet::REG); ivl_assert(loc, pins[0]->get_wire_type() == NetNet::REG);
PAssign*pa = dynamic_cast<PAssign*>(init_expr); const PAssign*pa = dynamic_cast<PAssign*>(init_expr);
ivl_assert(*init_expr, pa); ivl_assert(*init_expr, pa);
const PEIdent*id = dynamic_cast<const PEIdent*>(pa->lval()); const PEIdent*id = dynamic_cast<const PEIdent*>(pa->lval());
@ -2088,7 +2088,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name,
// XXXX // XXXX
ivl_assert(*init_expr, pins[0]->get_wire_type() == NetNet::REG); ivl_assert(*init_expr, pins[0]->get_wire_type() == NetNet::REG);
PAssign*pa = dynamic_cast<PAssign*>(init_expr); const PAssign*pa = dynamic_cast<PAssign*>(init_expr);
ivl_assert(*init_expr, pa); ivl_assert(*init_expr, pa);
const PEIdent*id = dynamic_cast<const PEIdent*>(pa->lval()); const PEIdent*id = dynamic_cast<const PEIdent*>(pa->lval());
@ -2157,7 +2157,7 @@ static void pform_set_net_range(PWire *wire,
if (!vec_type) if (!vec_type)
return; return;
list<pform_range_t> *range = vec_type->pdims.get(); const list<pform_range_t> *range = vec_type->pdims.get();
if (range) if (range)
wire->set_range(*range, rt); wire->set_range(*range, rt);
wire->set_signed(vec_type->signed_flag); wire->set_signed(vec_type->signed_flag);
@ -2745,7 +2745,7 @@ vector<pform_tf_port_t>*pform_make_task_ports(const struct vlltype&loc,
// If this is a non-ansi port declaration and the type is an implicit type // If this is a non-ansi port declaration and the type is an implicit type
// this is only a port declaration. // this is only a port declaration.
vector_type_t*vec_type = dynamic_cast<vector_type_t*>(vtype); const vector_type_t*vec_type = dynamic_cast<vector_type_t*>(vtype);
if (allow_implicit && (!vtype || (vec_type && vec_type->implicit_flag))) if (allow_implicit && (!vtype || (vec_type && vec_type->implicit_flag)))
rt = SR_PORT; rt = SR_PORT;
@ -3193,7 +3193,7 @@ void pform_set_port_type(const struct vlltype&li,
{ {
ivl_assert(li, pt != NetNet::PIMPLICIT && pt != NetNet::NOT_A_PORT); ivl_assert(li, pt != NetNet::PIMPLICIT && pt != NetNet::NOT_A_PORT);
vector_type_t *vt = dynamic_cast<vector_type_t*> (dt); const vector_type_t *vt = dynamic_cast<vector_type_t*> (dt);
bool have_init_expr = false; bool have_init_expr = false;
for (list<pform_port_t>::iterator cur = ports->begin() for (list<pform_port_t>::iterator cur = ports->begin()
@ -3242,7 +3242,7 @@ void pform_set_data_type(const struct vlltype&li, data_type_t*data_type,
ivl_assert(li, 0); ivl_assert(li, 0);
} }
vector_type_t*vec_type = dynamic_cast<vector_type_t*> (data_type); const vector_type_t*vec_type = dynamic_cast<vector_type_t*> (data_type);
for (std::vector<PWire*>::iterator it= wires->begin(); for (std::vector<PWire*>::iterator it= wires->begin();
it != wires->end() ; ++it) { it != wires->end() ; ++it) {
@ -3428,8 +3428,8 @@ int pform_parse(const char*path)
if (strcmp(path, "-") == 0) { if (strcmp(path, "-") == 0) {
vl_input = stdin; vl_input = stdin;
} else if (ivlpp_string) { } else if (ivlpp_string) {
char*cmdline = (char*)malloc(strlen(ivlpp_string) + char*cmdline = static_cast<char*>(malloc(strlen(ivlpp_string) +
strlen(path) + 4); strlen(path) + 4));
strcpy(cmdline, ivlpp_string); strcpy(cmdline, ivlpp_string);
strcat(cmdline, " \""); strcat(cmdline, " \"");
strcat(cmdline, path); strcat(cmdline, path);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012-2024 Stephen Williams (steve@icarus.com) * Copyright (c) 2012-2025 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 Stephen Williams (steve@icarus.com) * Copyright CERN 2013 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -118,7 +118,7 @@ PPackage *pform_package_importable(PPackage *pkg, perm_string name)
if (import_pkg == pkg->explicit_imports.end()) if (import_pkg == pkg->explicit_imports.end())
return nullptr; return nullptr;
for (auto &exp : pkg->exports) { for (const auto &exp : pkg->exports) {
// *::* will match all imports, P::* will match all imports // *::* will match all imports, P::* will match all imports
// from a package and P::ID will match a specific identifier // from a package and P::ID will match a specific identifier
// from a package. // from a package.

View File

@ -1,7 +1,7 @@
#ifndef IVL_pform_types_H #ifndef IVL_pform_types_H
#define IVL_pform_types_H #define IVL_pform_types_H
/* /*
* Copyright (c) 2007-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 2007-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -157,7 +157,7 @@ struct pform_tf_port_t {
class data_type_t : public PNamedItem { class data_type_t : public PNamedItem {
public: public:
inline explicit data_type_t() { } inline explicit data_type_t() { }
virtual ~data_type_t() = 0; virtual ~data_type_t() override = 0;
// This method is used by the pform dumper to diagnostic dump. The // This method is used by the pform dumper to diagnostic dump. The
// pform_dump dumps type type in pform format, and the debug_dump // pform_dump dumps type type in pform format, and the debug_dump
// prints the output in a linear form. // prints the output in a linear form.
@ -166,7 +166,7 @@ class data_type_t : public PNamedItem {
ivl_type_t elaborate_type(Design*des, NetScope*scope); ivl_type_t elaborate_type(Design*des, NetScope*scope);
virtual SymbolType symbol_type() const; virtual SymbolType symbol_type() const override;
private: private:
// Elaborate the type to an ivl_type_s type. // Elaborate the type to an ivl_type_s type.
@ -208,10 +208,10 @@ public:
struct typeref_t : public data_type_t { struct typeref_t : public data_type_t {
explicit typeref_t(typedef_t *t, PScope *s = 0) : scope(s), type(t) {} explicit typeref_t(typedef_t *t, PScope *s = 0) : scope(s), type(t) {}
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
NetScope *find_scope(Design* des, NetScope *scope) const; NetScope *find_scope(Design* des, NetScope *scope) const override;
std::ostream& debug_dump(std::ostream&out) const; std::ostream& debug_dump(std::ostream&out) const override;
private: private:
PScope *scope; PScope *scope;
@ -220,13 +220,13 @@ private:
struct type_parameter_t : data_type_t { struct type_parameter_t : data_type_t {
explicit type_parameter_t(perm_string n) : name(n) { } explicit type_parameter_t(perm_string n) : name(n) { }
ivl_type_t elaborate_type_raw(Design *des, NetScope *scope) const; ivl_type_t elaborate_type_raw(Design *des, NetScope *scope) const override;
perm_string name; perm_string name;
}; };
struct void_type_t : public data_type_t { struct void_type_t : public data_type_t {
virtual void pform_dump(std::ostream&out, unsigned indent) const; virtual void pform_dump(std::ostream&out, unsigned indent) const override;
}; };
/* /*
@ -239,9 +239,9 @@ struct enum_type_t : public data_type_t {
explicit enum_type_t(data_type_t *btype) : base_type(btype) { } explicit enum_type_t(data_type_t *btype) : base_type(btype) { }
// Return the elaborated version of the type. // Return the elaborated version of the type.
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
SymbolType symbol_type() const; SymbolType symbol_type() const override;
std::unique_ptr<data_type_t> base_type; std::unique_ptr<data_type_t> base_type;
std::unique_ptr< std::list<named_pexpr_t> > names; std::unique_ptr< std::list<named_pexpr_t> > names;
@ -254,8 +254,8 @@ struct struct_member_t : public LineInfo {
}; };
struct struct_type_t : public data_type_t { struct struct_type_t : public data_type_t {
virtual void pform_dump(std::ostream&out, unsigned indent) const; virtual void pform_dump(std::ostream&out, unsigned indent) const override;
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
bool packed_flag; bool packed_flag;
bool union_flag; bool union_flag;
@ -279,9 +279,9 @@ struct atom_type_t : public data_type_t {
enum type_code type_code; enum type_code type_code;
bool signed_flag; bool signed_flag;
virtual std::ostream& debug_dump(std::ostream&out) const; virtual std::ostream& debug_dump(std::ostream&out) const override;
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
}; };
extern atom_type_t size_type; extern atom_type_t size_type;
@ -304,9 +304,9 @@ struct vector_type_t : public data_type_t {
inline explicit vector_type_t(ivl_variable_type_t bt, bool sf, inline explicit vector_type_t(ivl_variable_type_t bt, bool sf,
std::list<pform_range_t>*pd) std::list<pform_range_t>*pd)
: base_type(bt), signed_flag(sf), integer_flag(false), implicit_flag(false), pdims(pd) { } : base_type(bt), signed_flag(sf), integer_flag(false), implicit_flag(false), pdims(pd) { }
virtual void pform_dump(std::ostream&out, unsigned indent) const; virtual void pform_dump(std::ostream&out, unsigned indent) const override;
virtual std::ostream& debug_dump(std::ostream&out) const; virtual std::ostream& debug_dump(std::ostream&out) const override;
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
ivl_variable_type_t base_type; ivl_variable_type_t base_type;
bool signed_flag; bool signed_flag;
@ -334,8 +334,8 @@ struct parray_type_t : public array_base_t {
inline explicit parray_type_t(data_type_t*btype, std::list<pform_range_t>*pd) inline explicit parray_type_t(data_type_t*btype, std::list<pform_range_t>*pd)
: array_base_t(btype, pd) { } : array_base_t(btype, pd) { }
virtual void pform_dump(std::ostream&out, unsigned indent) const; virtual void pform_dump(std::ostream&out, unsigned indent) const override;
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
}; };
/* /*
@ -346,17 +346,17 @@ struct uarray_type_t : public array_base_t {
: array_base_t(btype, pd) { } : array_base_t(btype, pd) { }
public: public:
virtual void pform_dump(std::ostream&out, unsigned indent) const; virtual void pform_dump(std::ostream&out, unsigned indent) const override;
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
}; };
struct real_type_t : public data_type_t { struct real_type_t : public data_type_t {
public: public:
enum type_t { REAL, SHORTREAL }; enum type_t { REAL, SHORTREAL };
inline explicit real_type_t(type_t tc) : type_code_(tc) { } inline explicit real_type_t(type_t tc) : type_code_(tc) { }
virtual std::ostream& debug_dump(std::ostream&out) const; virtual std::ostream& debug_dump(std::ostream&out) const override;
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
inline type_t type_code() const { return type_code_; } inline type_t type_code() const { return type_code_; }
@ -366,16 +366,16 @@ struct real_type_t : public data_type_t {
struct string_type_t : public data_type_t { struct string_type_t : public data_type_t {
inline explicit string_type_t() { } inline explicit string_type_t() { }
~string_type_t(); ~string_type_t() override;
ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override;
}; };
struct class_type_t : public data_type_t { struct class_type_t : public data_type_t {
inline explicit class_type_t(perm_string n) : name(n) { } inline explicit class_type_t(perm_string n) : name(n) { }
void pform_dump(std::ostream&out, unsigned indent) const; void pform_dump(std::ostream&out, unsigned indent) const override;
void pform_dump_init(std::ostream&out, unsigned indent) const; void pform_dump_init(std::ostream&out, unsigned indent) const;
// This is the named type that is supposed to be the base // This is the named type that is supposed to be the base
@ -408,11 +408,11 @@ struct class_type_t : public data_type_t {
// without waiting for any constructor. // without waiting for any constructor.
std::vector<Statement*> initialize_static; std::vector<Statement*> initialize_static;
ivl_type_t elaborate_type_raw(Design*, NetScope*) const; ivl_type_t elaborate_type_raw(Design*, NetScope*) const override;
perm_string name; perm_string name;
virtual SymbolType symbol_type() const; virtual SymbolType symbol_type() const override;
}; };
ivl_type_t elaborate_array_type(Design *des, NetScope *scope, ivl_type_t elaborate_array_type(Design *des, NetScope *scope,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2010 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -40,7 +40,7 @@ bool NetEvWait::is_synchronous()
return false; return false;
for (unsigned pdx = 0 ; pdx < ev->nprobe() ; pdx += 1) { for (unsigned pdx = 0 ; pdx < ev->nprobe() ; pdx += 1) {
NetEvProbe*pr = ev->probe(pdx); const NetEvProbe*pr = ev->probe(pdx);
/* No level sensitive clocks. */ /* No level sensitive clocks. */
if (pr->edge() == NetEvProbe::ANYEDGE) if (pr->edge() == NetEvProbe::ANYEDGE)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999-2017 Stephen Williams (steve@icarus.com) * Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -41,10 +41,10 @@ class do_expr : public proc_match_t {
Design*des_; Design*des_;
NetScope*scope_; NetScope*scope_;
virtual int assign(NetAssign*); virtual int assign(NetAssign*) override;
virtual int assign_nb(NetAssignNB*); virtual int assign_nb(NetAssignNB*) override;
virtual int event_wait(NetEvWait*); virtual int event_wait(NetEvWait*) override;
virtual int condit(NetCondit*); virtual int condit(NetCondit*) override;
}; };
@ -114,7 +114,7 @@ class synth_f : public functor_t {
public: public:
synth_f() { top_ = NULL; } synth_f() { top_ = NULL; }
void process(Design*, NetProcTop*); void process(Design*, NetProcTop*) override;
private: private:
void proc_always_(Design*); void proc_always_(Design*);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2022 Stephen Williams (steve@icarus.com) * Copyright (c) 2002-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -261,7 +261,7 @@ bool NetProcTop::tie_off_floating_inputs_(Design*des,
continue; continue;
ivl_variable_type_t data_type = IVL_VT_LOGIC; ivl_variable_type_t data_type = IVL_VT_LOGIC;
netvector_t*tmp_vec = new netvector_t(data_type, width-1,0); const netvector_t*tmp_vec = new netvector_t(data_type, width-1,0);
NetNet*sig = new NetNet(scope(), scope()->local_symbol(), NetNet*sig = new NetNet(scope(), scope()->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
sig->local_flag(true); sig->local_flag(true);
@ -421,14 +421,14 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope,
// Evaluate the index expression to a constant. // Evaluate the index expression to a constant.
const NetExpr*base_expr_raw = lval_->get_base(); const NetExpr*base_expr_raw = lval_->get_base();
ivl_assert(*this, base_expr_raw); ivl_assert(*this, base_expr_raw);
NetExpr*base_expr = base_expr_raw->evaluate_function(*this, scope->loop_index_tmp); const NetExpr*base_expr = base_expr_raw->evaluate_function(*this, scope->loop_index_tmp);
if (! eval_as_long(base_off, base_expr)) { if (! eval_as_long(base_off, base_expr)) {
ivl_assert(*this, 0); ivl_assert(*this, 0);
} }
ivl_assert(*this, base_off >= 0); ivl_assert(*this, base_off >= 0);
ivl_variable_type_t tmp_data_type = rsig->data_type(); ivl_variable_type_t tmp_data_type = rsig->data_type();
netvector_t*tmp_type = new netvector_t(tmp_data_type, lsig_width-1,0); const netvector_t*tmp_type = new netvector_t(tmp_data_type, lsig_width-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_type); NetNet::WIRE, tmp_type);
@ -451,7 +451,7 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope,
const NetExpr*base_expr_raw = lval_->get_base(); const NetExpr*base_expr_raw = lval_->get_base();
ivl_assert(*this, base_expr_raw); ivl_assert(*this, base_expr_raw);
NetExpr*base_expr = base_expr_raw->evaluate_function(*this, scope->loop_index_tmp); const NetExpr*base_expr = base_expr_raw->evaluate_function(*this, scope->loop_index_tmp);
if (! eval_as_long(base_off, base_expr)) { if (! eval_as_long(base_off, base_expr)) {
cerr << get_fileline() << ": sorry: assignment to variable " cerr << get_fileline() << ": sorry: assignment to variable "
"bit location is not currently supported in " "bit location is not currently supported in "
@ -462,7 +462,7 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope,
ivl_assert(*this, base_off >= 0); ivl_assert(*this, base_off >= 0);
ivl_variable_type_t tmp_data_type = rsig->data_type(); ivl_variable_type_t tmp_data_type = rsig->data_type();
netvector_t*tmp_type = new netvector_t(tmp_data_type, lsig_width-1,0); const netvector_t*tmp_type = new netvector_t(tmp_data_type, lsig_width-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_type); NetNet::WIRE, tmp_type);
@ -679,7 +679,7 @@ static NetNet* mux_selector_reduce_width(Design*des, NetScope*scope,
// This is the output signal, osig. // This is the output signal, osig.
ivl_variable_type_t osig_data_type = IVL_VT_LOGIC; ivl_variable_type_t osig_data_type = IVL_VT_LOGIC;
netvector_t*osig_vec = new netvector_t(osig_data_type, sel_need-1, 0); const netvector_t*osig_vec = new netvector_t(osig_data_type, sel_need-1, 0);
NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet*osig = new NetNet(scope, scope->local_symbol(),
NetNet::TRI, osig_vec); NetNet::TRI, osig_vec);
osig->local_flag(true); osig->local_flag(true);
@ -699,7 +699,7 @@ static NetNet* mux_selector_reduce_width(Design*des, NetScope*scope,
des->add_node(ps0); des->add_node(ps0);
connect(ps0->pin(1), esig->pin(0)); connect(ps0->pin(1), esig->pin(0));
netvector_t*ps0_vec = new netvector_t(osig_data_type, sel_need-2, 0); const netvector_t*ps0_vec = new netvector_t(osig_data_type, sel_need-2, 0);
NetNet*ps0_sig = new NetNet(scope, scope->local_symbol(), NetNet*ps0_sig = new NetNet(scope, scope->local_symbol(),
NetNet::TRI, ps0_vec); NetNet::TRI, ps0_vec);
ps0_sig->local_flag(true); ps0_sig->local_flag(true);
@ -717,7 +717,7 @@ static NetNet* mux_selector_reduce_width(Design*des, NetScope*scope,
des->add_node(ps1); des->add_node(ps1);
connect(ps1->pin(1), esig->pin(0)); connect(ps1->pin(1), esig->pin(0));
netvector_t*ps1_vec = new netvector_t(osig_data_type, sel_got-sel_need, 0); const netvector_t*ps1_vec = new netvector_t(osig_data_type, sel_got-sel_need, 0);
NetNet*ps1_sig = new NetNet(scope, scope->local_symbol(), NetNet*ps1_sig = new NetNet(scope, scope->local_symbol(),
NetNet::TRI, ps1_vec); NetNet::TRI, ps1_vec);
ps1_sig->local_flag(true); ps1_sig->local_flag(true);
@ -819,7 +819,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope,
continue; continue;
} }
NetEConst*ge = dynamic_cast<NetEConst*>(items_[item].guard); const NetEConst*ge = dynamic_cast<NetEConst*>(items_[item].guard);
if (ge == 0) { if (ge == 0) {
cerr << items_[item].guard->get_fileline() << ": sorry: " cerr << items_[item].guard->get_fileline() << ": sorry: "
<< "variable case item expressions with a variable " << "variable case item expressions with a variable "
@ -939,7 +939,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope,
// the pin. // the pin.
if (out_mux[mdx]->pin_Result().nexus()->pick_any_net() == 0) { if (out_mux[mdx]->pin_Result().nexus()->pick_any_net() == 0) {
ivl_variable_type_t mux_data_type = IVL_VT_LOGIC; ivl_variable_type_t mux_data_type = IVL_VT_LOGIC;
netvector_t*tmp_vec = new netvector_t(mux_data_type, mux_width[mdx]-1,0); const netvector_t*tmp_vec = new netvector_t(mux_data_type, mux_width[mdx]-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
tmp->local_flag(true); tmp->local_flag(true);
@ -1105,7 +1105,7 @@ bool NetCase::synth_async_casez_(Design*des, NetScope*scope,
} }
} }
netvector_t*condit_type = new netvector_t(IVL_VT_LOGIC, 0, 0); const netvector_t*condit_type = new netvector_t(IVL_VT_LOGIC, 0, 0);
NetCaseCmp::kind_t case_kind = NetCaseCmp::EEQ; NetCaseCmp::kind_t case_kind = NetCaseCmp::EEQ;
switch (type()) { switch (type()) {
@ -1185,7 +1185,7 @@ bool NetCase::synth_async_casez_(Design*des, NetScope*scope,
// Make a NetNet for the result. // Make a NetNet for the result.
ivl_variable_type_t mux_data_type = IVL_VT_LOGIC; ivl_variable_type_t mux_data_type = IVL_VT_LOGIC;
netvector_t*tmp_vec = new netvector_t(mux_data_type, mux_width[mdx]-1,0); const netvector_t*tmp_vec = new netvector_t(mux_data_type, mux_width[mdx]-1,0);
NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet*tmp = new NetNet(scope, scope->local_symbol(),
NetNet::WIRE, tmp_vec); NetNet::WIRE, tmp_vec);
tmp->local_flag(true); tmp->local_flag(true);
@ -1335,7 +1335,7 @@ bool NetCondit::synth_async(Design*des, NetScope*scope,
// Guess the mux type from the type of the output. // Guess the mux type from the type of the output.
ivl_variable_type_t mux_data_type = IVL_VT_LOGIC; ivl_variable_type_t mux_data_type = IVL_VT_LOGIC;
if (NetNet*tmp = nex_out.pin(idx).nexus()->pick_any_net()) { if (const NetNet*tmp = nex_out.pin(idx).nexus()->pick_any_net()) {
mux_data_type = tmp->data_type(); mux_data_type = tmp->data_type();
} }
@ -1389,7 +1389,7 @@ bool NetCondit::synth_async(Design*des, NetScope*scope,
mux->set_line(*this); mux->set_line(*this);
des->add_node(mux); des->add_node(mux);
netvector_t*tmp_type = 0; const netvector_t*tmp_type = 0;
if (mux_width==1) if (mux_width==1)
tmp_type = new netvector_t(mux_data_type); tmp_type = new netvector_t(mux_data_type);
else else
@ -1477,7 +1477,7 @@ bool NetForLoop::synth_async(Design*des, NetScope*scope,
NetAssign*step_assign = dynamic_cast<NetAssign*> (step_statement_); NetAssign*step_assign = dynamic_cast<NetAssign*> (step_statement_);
char assign_operator = step_assign->assign_operator(); char assign_operator = step_assign->assign_operator();
ivl_assert(*this, step_assign); ivl_assert(*this, step_assign);
NetExpr*step_expr = step_assign->rval(); const NetExpr*step_expr = step_assign->rval();
// Tell the scope that this index value is like a genvar. // Tell the scope that this index value is like a genvar.
LocalVar index_var; LocalVar index_var;
@ -1814,11 +1814,11 @@ bool NetCondit::synth_sync(Design*des, NetScope*scope,
case NetEvProbe::NEGEDGE: { case NetEvProbe::NEGEDGE: {
bool is_inverter = false; bool is_inverter = false;
NetNode*node = rst->pin(0).nexus()->pick_any_node(); NetNode*node = rst->pin(0).nexus()->pick_any_node();
if (NetLogic*gate = dynamic_cast<NetLogic*>(node)) { if (const NetLogic*gate = dynamic_cast<NetLogic*>(node)) {
if (gate->type() == NetLogic::NOT) if (gate->type() == NetLogic::NOT)
is_inverter = true; is_inverter = true;
} }
if (NetUReduce*gate = dynamic_cast<NetUReduce*>(node)) { if (const NetUReduce*gate = dynamic_cast<NetUReduce*>(node)) {
if (gate->type() == NetUReduce::NOR) if (gate->type() == NetUReduce::NOR)
is_inverter = true; is_inverter = true;
} }
@ -1854,7 +1854,7 @@ bool NetCondit::synth_sync(Design*des, NetScope*scope,
ivl_assert(*this, tmp_out.pin_count() == ff_aset.pin_count()); ivl_assert(*this, tmp_out.pin_count() == ff_aset.pin_count());
for (unsigned pin = 0 ; pin < tmp_out.pin_count() ; pin += 1) { for (unsigned pin = 0 ; pin < tmp_out.pin_count() ; pin += 1) {
Nexus*rst_nex = tmp_out.pin(pin).nexus(); const Nexus*rst_nex = tmp_out.pin(pin).nexus();
if (!all_bits_driven(tmp_masks[pin])) { if (!all_bits_driven(tmp_masks[pin])) {
cerr << get_fileline() << ": sorry: Not all bits of '" cerr << get_fileline() << ": sorry: Not all bits of '"
@ -2034,7 +2034,7 @@ bool NetEvWait::synth_sync(Design*des, NetScope*scope,
/* Get the input set from the substatement. This will be used /* Get the input set from the substatement. This will be used
to figure out which of the probes is the clock. */ to figure out which of the probes is the clock. */
NexusSet*statement_input = statement_ -> nex_input(); const NexusSet*statement_input = statement_ -> nex_input();
/* Search for a clock input. The clock input is the edge event /* Search for a clock input. The clock input is the edge event
that is not also an input to the substatement. */ that is not also an input to the substatement. */
@ -2209,7 +2209,7 @@ bool NetProcTop::synth_sync(Design*des)
class synth2_f : public functor_t { class synth2_f : public functor_t {
public: public:
void process(Design*, NetProcTop*); void process(Design*, NetProcTop*) override;
private: private:
}; };

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) * Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -563,7 +563,7 @@ string verinum::as_string() const
string res; string res;
for (unsigned idx = nbits_ ; idx > 0 ; idx -= 8) { for (unsigned idx = nbits_ ; idx > 0 ; idx -= 8) {
char char_val = 0; char char_val = 0;
V*bp = bits_+idx; const V*bp = bits_+idx;
if (*(--bp) == V1) char_val |= 0x80; if (*(--bp) == V1) char_val |= 0x80;
if (*(--bp) == V1) char_val |= 0x40; if (*(--bp) == V1) char_val |= 0x40;

View File

@ -253,7 +253,7 @@ bool load_vpi_module(const char*path)
ivl_dlclose(dll); ivl_dlclose(dll);
return true; return true;
} }
vpip_set_callback_t set_callback = (vpip_set_callback_t)function; vpip_set_callback_t set_callback = static_cast<vpip_set_callback_t>(function);
if (!set_callback(&vpi_routines, vpip_routines_version)) { if (!set_callback(&vpi_routines, vpip_routines_version)) {
cerr << "error: Failed to link '" << path << "'. " cerr << "error: Failed to link '" << path << "'. "
"Try rebuilding it with iverilog-vpi." << endl; "Try rebuilding it with iverilog-vpi." << endl;

View File

@ -1082,7 +1082,7 @@ struct __vpiModPath* vpip_make_modpath(vvp_net_t *net)
#ifdef CHECK_WITH_VALGRIND #ifdef CHECK_WITH_VALGRIND
mp_count += 1; mp_count += 1;
mp_list = static_cast<struct __vpiModPath **> mp_list = static_cast<struct __vpiModPath **>
(realloc(static_cast<void*>(mp_list), (realloc(mp_list,
mp_count*sizeof(struct __vpiModPath **))); mp_count*sizeof(struct __vpiModPath **)));
mp_list[mp_count-1] = obj; mp_list[mp_count-1] = obj;
#endif #endif
@ -1451,7 +1451,7 @@ struct __vpiInterModPath* vpip_make_intermodpath(vvp_net_t *net, vpiPortInfo* po
#ifdef CHECK_WITH_VALGRIND #ifdef CHECK_WITH_VALGRIND
imp_count += 1; imp_count += 1;
imp_list = static_cast<struct __vpiInterModPath **> imp_list = static_cast<struct __vpiInterModPath **>
(realloc(static_cast<void>(imp_list), (realloc(imp_list,
imp_count*sizeof(struct __vpiInterModPath **))); imp_count*sizeof(struct __vpiInterModPath **)));
imp_list[imp_count-1] = obj; imp_list[imp_count-1] = obj;
#endif #endif

View File

@ -251,7 +251,7 @@ void vpip_load_module(const char*name)
/* Add the dll to the list so it can be closed when we are done. */ /* Add the dll to the list so it can be closed when we are done. */
dll_list_cnt += 1; dll_list_cnt += 1;
dll_list = static_cast<ivl_dll_t*> dll_list = static_cast<ivl_dll_t*>
(realloc(static_cast<void *>(dll_list), dll_list_cnt*sizeof(ivl_dll_t))); (realloc(dll_list, dll_list_cnt*sizeof(ivl_dll_t)));
dll_list[dll_list_cnt-1] = dll; dll_list[dll_list_cnt-1] = dll;
vpi_mode_flag = VPI_MODE_REGISTER; vpi_mode_flag = VPI_MODE_REGISTER;

View File

@ -150,7 +150,7 @@ static void delete_sub_scopes(__vpiScope *scope)
citer != scope->classes.end(); ++ citer ) { citer != scope->classes.end(); ++ citer ) {
class_list_count += 1; class_list_count += 1;
class_list = static_cast<class_type **> class_list = static_cast<class_type **>
(realloc(static_cast<void>(class_list), (realloc(class_list,
class_list_count*sizeof(class_type **))); class_list_count*sizeof(class_type **)));
class_list[class_list_count-1] = citer->second; class_list[class_list_count-1] = citer->second;
} }
@ -663,7 +663,7 @@ unsigned vpip_add_item_to_context(automatic_hooks_s*item,
(malloc(sizeof(automatic_hooks_s*))); (malloc(sizeof(automatic_hooks_s*)));
else else
scope->item = static_cast<automatic_hooks_s**> scope->item = static_cast<automatic_hooks_s**>
(realloc(static_cast<void *>(scope->item), (realloc(scope->item,
sizeof(automatic_hooks_s*)*scope->nitem)); sizeof(automatic_hooks_s*)*scope->nitem));
scope->item[idx] = item; scope->item[idx] = item;

View File

@ -1204,7 +1204,7 @@ void* __vpiSignal::operator new(size_t siz)
VALGRIND_CREATE_MEMPOOL(alloc_array, 0, 1); VALGRIND_CREATE_MEMPOOL(alloc_array, 0, 1);
signal_pool_count += 1; signal_pool_count += 1;
signal_pool = static_cast<vpiSignal_plug **> signal_pool = static_cast<vpiSignal_plug **>
(realloc(static_cast<void *>(signal_pool), (realloc(signal_pool,
signal_pool_count*sizeof(vpiSignal_plug **))); signal_pool_count*sizeof(vpiSignal_plug **)));
signal_pool[signal_pool_count-1] = alloc_array; signal_pool[signal_pool_count-1] = alloc_array;
#endif #endif

View File

@ -581,7 +581,7 @@ static struct __vpiUserSystf* allocate_def(void)
} }
def_table = static_cast<struct __vpiUserSystf**> def_table = static_cast<struct __vpiUserSystf**>
(realloc(static_cast<void *>(def_table), (realloc(def_table,
(def_count+1)*sizeof(struct __vpiUserSystf*))); (def_count+1)*sizeof(struct __vpiUserSystf*)));
def_table[def_count] = new __vpiUserSystf; def_table[def_count] = new __vpiUserSystf;
@ -708,7 +708,7 @@ static void add_vpi_call_error(vpi_call_error_type type, const char *name,
long file_idx, long lineno) long file_idx, long lineno)
{ {
vpi_call_error_lst = static_cast<vpi_call_error_p> vpi_call_error_lst = static_cast<vpi_call_error_p>
(realloc(static_cast<void *>(vpi_call_error_lst), (realloc(vpi_call_error_lst,
(vpi_call_error_num + 1) * (vpi_call_error_num + 1) *
sizeof(vpi_call_error_s))); sizeof(vpi_call_error_s)));
vpi_call_error_lst[vpi_call_error_num].type = type; vpi_call_error_lst[vpi_call_error_num].type = type;