From 860761f9c68945c1d4de4dc61f9423d1b1241213 Mon Sep 17 00:00:00 2001 From: Cary R Date: Mon, 20 Oct 2025 22:45:05 -0700 Subject: [PATCH] More cppcheck fixes - part 2 --- PClass.h | 6 +- PDelays.cc | 6 +- PEvent.h | 6 +- PModport.h | 6 +- PNamedItem.h | 8 +- PPackage.h | 4 +- PScope.h | 6 +- PSpec.h | 4 +- cppcheck.sup | 6 +- cprop.cc | 26 +- elab_expr.cc | 86 +++--- elab_lval.cc | 8 +- elab_net.cc | 14 +- elab_scope.cc | 18 +- elab_sig.cc | 12 +- elaborate.cc | 108 +++---- emit.cc | 10 +- eval_attrib.cc | 6 +- eval_tree.cc | 16 +- exposenodes.cc | 8 +- expr_synth.cc | 58 ++-- libmisc/StringHeap.cc | 14 +- load_module.cc | 4 +- net_assign.cc | 4 +- net_design.cc | 8 +- net_event.cc | 8 +- net_func.cc | 4 +- net_func_eval.cc | 52 ++-- net_nex_input.cc | 10 +- net_proc.cc | 2 +- netclass.h | 10 +- netdarray.h | 14 +- netenum.h | 14 +- netlist.cc | 8 +- netlist.h | 686 +++++++++++++++++++++--------------------- netmisc.cc | 32 +- netparray.h | 22 +- netqueue.h | 8 +- netscalar.h | 18 +- netstruct.h | 18 +- nettypes.h | 6 +- netvector.h | 22 +- nodangle.cc | 8 +- pad_to_width.cc | 8 +- parse.y | 8 +- pform.cc | 18 +- pform_package.cc | 4 +- pform_types.h | 56 ++-- sync.cc | 4 +- synth.cc | 12 +- synth2.cc | 42 +-- verinum.cc | 4 +- vpi_modules.cc | 2 +- vvp/delay.cc | 4 +- vvp/vpi_modules.cc | 2 +- vvp/vpi_scope.cc | 4 +- vvp/vpi_signal.cc | 2 +- vvp/vpi_tasks.cc | 4 +- 58 files changed, 784 insertions(+), 784 deletions(-) diff --git a/PClass.h b/PClass.h index 55a3b7048..5856b023d 100644 --- a/PClass.h +++ b/PClass.h @@ -1,7 +1,7 @@ #ifndef 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 * 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: explicit PClass (perm_string name, LexicalScope*parent); - ~PClass(); + ~PClass() override; void dump(std::ostream&out, unsigned indent) const; - SymbolType symbol_type() const; + SymbolType symbol_type() const override; public: class_type_t*type; diff --git a/PDelays.cc b/PDelays.cc index c513a9f56..20645434a 100644 --- a/PDelays.cc +++ b/PDelays.cc @@ -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 * 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) { - NetEConst *c_rise = dynamic_cast(rise); - NetEConst *c_fall = dynamic_cast(fall); + const NetEConst *c_rise = dynamic_cast(rise); + const NetEConst *c_fall = dynamic_cast(fall); if (c_rise && c_fall) { if (c_rise->value() < c_fall->value()) return rise; else return fall; diff --git a/PEvent.h b/PEvent.h index 3b648f757..c906604c7 100644 --- a/PEvent.h +++ b/PEvent.h @@ -1,7 +1,7 @@ #ifndef 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 * 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 // of the event, without any scope. explicit PEvent(perm_string name, unsigned lexical_pos); - ~PEvent(); + ~PEvent() override; perm_string name() const; @@ -45,7 +45,7 @@ class PEvent : public PNamedItem { void elaborate_scope(Design*des, NetScope*scope) const; - SymbolType symbol_type() const; + SymbolType symbol_type() const override; private: perm_string name_; diff --git a/PModport.h b/PModport.h index add4ab8ac..048590c55 100644 --- a/PModport.h +++ b/PModport.h @@ -1,7 +1,7 @@ #ifndef 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 * 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 // of the modport, without any scope. explicit PModport(perm_string name); - ~PModport(); + ~PModport() override; perm_string name() const { return name_; } typedef std::pair simple_port_t; std::map simple_ports; - SymbolType symbol_type() const; + SymbolType symbol_type() const override; private: perm_string name_; diff --git a/PNamedItem.h b/PNamedItem.h index 0b6e791ea..ba8f86e8f 100644 --- a/PNamedItem.h +++ b/PNamedItem.h @@ -1,7 +1,7 @@ #ifndef 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 * and/or modify it in source code form under the terms of the GNU @@ -34,7 +34,7 @@ class PNamedItem : virtual public LineInfo { INSTANCE }; explicit PNamedItem(); - virtual ~PNamedItem(); + virtual ~PNamedItem() override; virtual SymbolType symbol_type() const; }; @@ -49,9 +49,9 @@ class PGenvar : public PNamedItem { public: explicit PGenvar(); - virtual ~PGenvar(); + virtual ~PGenvar() override; - SymbolType symbol_type() const; + SymbolType symbol_type() const override; }; #endif /* IVL_PNamedItem_H */ diff --git a/PPackage.h b/PPackage.h index 075e214b4..7f79b8ab4 100644 --- a/PPackage.h +++ b/PPackage.h @@ -1,7 +1,7 @@ #ifndef 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) * * This source code is free software; you can redistribute it @@ -36,7 +36,7 @@ class PPackage : public PScopeExtra, public LineInfo { public: explicit PPackage (perm_string name, LexicalScope*parent); - ~PPackage(); + ~PPackage() override; bool elaborate_scope(Design*des, NetScope*scope); bool elaborate_sig(Design*des, NetScope*scope) const; diff --git a/PScope.h b/PScope.h index 03bc4f2e3..5f8a6caf4 100644 --- a/PScope.h +++ b/PScope.h @@ -1,7 +1,7 @@ #ifndef 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 * 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 // containing module. explicit PScope(perm_string name, LexicalScope*parent =0); - virtual ~PScope(); + virtual ~PScope() override; perm_string pscope_name() const { return name_; } @@ -233,7 +233,7 @@ class PScopeExtra : public PScope { public: explicit PScopeExtra(perm_string, LexicalScope*parent =0); - ~PScopeExtra(); + ~PScopeExtra() override; /* Task definitions within this module */ std::map tasks; diff --git a/PSpec.h b/PSpec.h index 450fbd393..b6cb91f6f 100644 --- a/PSpec.h +++ b/PSpec.h @@ -1,7 +1,7 @@ #ifndef IVL_PSpec_H #define IVL_PSpec_H /* - * Copyright (c) 2006-2014 Stephen Williams + * Copyright (c) 2006-2025 Stephen Williams * * This source code is free software; you can redistribute it * 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 &src_list, const std::list &dst_list, char polarity, bool full_flag); - ~PSpecPath(); + ~PSpecPath() override; void elaborate(class Design*des, class NetScope*scope) const; diff --git a/cppcheck.sup b/cppcheck.sup index b7b2ede5d..bed3e1f16 100644 --- a/cppcheck.sup +++ b/cppcheck.sup @@ -1,10 +1,10 @@ // These are correct and are used to find the base (zero) pin. -thisSubtraction:netlist.h:5244 -thisSubtraction:netlist.h:5253 +thisSubtraction:netlist.h:5311 +thisSubtraction:netlist.h:5320 // This is used when running a debugger // debugger_release -knownConditionTrueFalse:main.cc:921 +knownConditionTrueFalse:main.cc:931 // This are just stubs // vpi_control() diff --git a/cprop.cc b/cprop.cc index c8514f9fc..8ddfb65eb 100644 --- a/cprop.cc +++ b/cprop.cc @@ -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 * 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; - virtual void signal(Design*des, NetNet*obj); - virtual void lpm_add_sub(Design*des, NetAddSub*obj); - virtual void lpm_compare(Design*des, const NetCompare*obj); - virtual void lpm_concat(Design*des, NetConcat*obj); - virtual void lpm_ff(Design*des, NetFF*obj); - virtual void lpm_logic(Design*des, NetLogic*obj); - virtual void lpm_mux(Design*des, NetMux*obj); - virtual void lpm_part_select(Design*des, NetPartSelect*obj); + virtual void signal(Design*des, NetNet*obj) override; + virtual void lpm_add_sub(Design*des, NetAddSub*obj) override; + virtual void lpm_compare(Design*des, const NetCompare*obj) override; + virtual void lpm_concat(Design*des, NetConcat*obj) override; + virtual void lpm_ff(Design*des, NetFF*obj) override; + virtual void lpm_logic(Design*des, NetLogic*obj) override; + virtual void lpm_mux(Design*des, NetMux*obj) override; + virtual void lpm_part_select(Design*des, NetPartSelect*obj) override; 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; 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 (! nex->drivers_constant()) return; @@ -156,7 +156,7 @@ void cprop_functor::lpm_mux(Design*des, NetMux*obj) if (obj->sel_width() != 1) 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 */ @@ -226,7 +226,7 @@ void cprop_functor::lpm_part_select(Design*des, NetPartSelect*obj) NetPins*tmp_obj = cur->get_obj(); // Record if we are driving a 2-state net. - NetNet*net_obj = dynamic_cast (tmp_obj); + const NetNet*net_obj = dynamic_cast (tmp_obj); if (net_obj && (net_obj->data_type() == IVL_VT_BOOL)) 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 { - virtual void lpm_const(Design*des, NetConst*obj); + virtual void lpm_const(Design*des, NetConst*obj) override; }; struct nexus_info_s { diff --git a/elab_expr.cc b/elab_expr.cc index bbd8d0c08..fe5dc8f20 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -341,7 +341,7 @@ NetExpr* PEAssignPattern::elaborate_expr_uarray_(Design *des, NetScope *scope, // have a good way of passing the inner dimensions through the // generic elaborate_expr() API and assigment patterns is the only // place where we need it. - if (auto ap = dynamic_cast(parms_[idx])) { + if (const auto ap = dynamic_cast(parms_[idx])) { expr = ap->elaborate_expr_uarray_(des, scope, uarray_type, dims, cur_dim, need_const); } else if (dynamic_cast(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 // generic elaborate_expr() API and assigment patterns is the only // place where we need it. - auto ap = dynamic_cast(parms_[idx]); + const auto ap = dynamic_cast(parms_[idx]); if (ap) expr = ap->elaborate_expr_packed_(des, scope, base_type, 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. - if (NetEConst*rp_const = dynamic_cast (rp)) { + if (const NetEConst*rp_const = dynamic_cast (rp)) { verinum rp_val = rp_const->value(); 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_; right_ = tmp; } - NetEConst*rc = dynamic_cast (rp); + const NetEConst*rc = dynamic_cast (rp); // Adjust the expression width that can be converter depending // on if the R-value is signed or not. 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 // can calculate the actual width required for the power // operator. - PENumber*lc = dynamic_cast (left_); + const PENumber*lc = dynamic_cast (left_); // Now calculate the lossless 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 // constant, then there is the general case. - if (NetEConst*lpc = dynamic_cast (lp)) { + if (const NetEConst*lpc = dynamic_cast (lp)) { // Special case: The left expression is zero. If the // 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; } - } else if (NetEConst*rpc = dynamic_cast (rp)) { + } else if (const NetEConst*rpc = dynamic_cast (rp)) { // Special case: The shift value contains 'x' or 'z' bits. // Elaborate as a constant-x. @@ -1382,7 +1382,7 @@ unsigned PECallFunction::test_width_sfunc_(Design*des, NetScope*scope, 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) { cerr << get_fileline() << ": error: " << "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 && 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(); 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 && 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(); 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.path_head.back().index.size()) { - NetNet*net = search_results.net; + const NetNet*net = search_results.net; const netdarray_t*darray = net->darray_type(); ivl_assert(*this, darray); @@ -1646,7 +1646,7 @@ unsigned PECallFunction::test_width_method_(Design*, NetScope*, // Enumeration variable. Check for the various enumeration methods. 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(); 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. - if (NetNet*res = method->find_signal(method->basename())) { + if (const NetNet*res = method->find_signal(method->basename())) { expr_type_ = res->data_type(); expr_width_ = res->vector_width(); min_width_ = expr_width_; @@ -1786,7 +1786,7 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope, << "." << endl; } - NetNet*res = search_results.net; + const NetNet*res = search_results.net; expr_type_ = res->data_type(); expr_width_ = res->vector_width(); min_width_ = expr_width_; @@ -1845,7 +1845,7 @@ unsigned PECallFunction::test_width(Design*des, NetScope*scope, NetScope*dscope = def->scope(); 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_width_ = res->vector_width(); min_width_ = expr_width_; @@ -1906,7 +1906,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope, if (name=="$ivlh_to_unsigned") { ivl_assert(*this, parms_.size()==2); - PExpr *expr = parms_[0].parm; + const PExpr *expr = parms_[0].parm; ivl_assert(*this, expr); NetExpr*sub = expr->elaborate_expr(des, scope, expr->expr_width(), flags); 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_: " << 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); return cast_to_width_(sub, expr_wid); @@ -1959,7 +1959,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope, PExpr *expr = parms_[0].parm; uint64_t use_width = 0; - if (PETypename*type_expr = dynamic_cast(expr)) { + if (const PETypename*type_expr = dynamic_cast(expr)) { ivl_type_t data_type = type_expr->get_type()->elaborate_type(des, scope); ivl_assert(*this, data_type); use_width = 1; @@ -2009,7 +2009,7 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope, return 0; } - PExpr *expr = parms_[0].parm; + const PExpr *expr = parms_[0].parm; verinum val (expr->has_sign() ? verinum::V1 : verinum::V0, 1); NetEConst*sub = new NetEConst(val); @@ -2104,7 +2104,7 @@ NetExpr* PECallFunction::elaborate_access_func_(Design*des, NetScope*scope, if (parms_.size() == 1) { PExpr *arg1 = parms_[0].parm; - PEIdent*arg_ident = dynamic_cast (arg1); + const PEIdent*arg_ident = dynamic_cast (arg1); ivl_assert(*this, arg_ident); 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 << "." << method_name << "(" << args[0] << ")." << endl; des->errors++; - } else if (NetEEvent *evt = dynamic_cast (count)) { + } else if (const NetEEvent *evt = dynamic_cast (count)) { cerr << evt->get_fileline() << ": error: An event '" << evt->event()->name() << "' cannot be an enumeration " "method argument." << endl; @@ -3160,7 +3160,7 @@ unsigned PECallFunction::elaborate_arguments_(Design*des, NetScope*scope, continue; } - if (NetEEvent*evt = dynamic_cast (parms[pidx])) { + if (const NetEEvent*evt = dynamic_cast (parms[pidx])) { cerr << evt->get_fileline() << ": error: An event '" << evt->event()->name() << "' can not be a user " "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 && 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 index_component_t&use_index = search_results.path_head.back().index.back(); ivl_assert(*this, use_index.msb != 0); @@ -3378,7 +3378,7 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope, // Enumeration methods. 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(); // 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; NetExpr*size_ex = elab_and_eval(des, scope, size_, -1, true); - NetEConst*size_ce = dynamic_cast(size_ex); + const NetEConst*size_ce = dynamic_cast(size_ex); if (size_ce && !size_ce->value().is_negative()) expr_width_ = size_ce->value().as_ulong(); delete size_ex; @@ -3837,7 +3837,7 @@ unsigned PEConcat::test_width(Design*des, NetScope*scope, width_mode_t&) return 0; } - NetEConst*rep = dynamic_cast(tmp); + const NetEConst*rep = dynamic_cast(tmp); if (rep == 0) { cerr << get_fileline() << ": error: " @@ -4094,7 +4094,7 @@ bool PEIdent::calculate_bits_(Design*des, NetScope*scope, bit select expressions which must be constant. */ NetExpr*msb_ex = elab_and_eval(des, scope, index_tail.msb, -1, true); - NetEConst*msb_c = dynamic_cast(msb_ex); + const NetEConst*msb_c = dynamic_cast(msb_ex); if (msb_c == 0) { cerr << index_tail.msb->get_fileline() << ": error: " "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 the caller. */ NetExpr*lsb_ex = elab_and_eval(des, scope, index_tail.lsb, -1, true); - NetEConst*lsb_c = dynamic_cast(lsb_ex); + const NetEConst*lsb_c = dynamic_cast(lsb_ex); if (lsb_c == 0) { cerr << index_tail.lsb->get_fileline() << ": error: " "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); - NetEConst*msb_c = dynamic_cast(msb_ex); + const NetEConst*msb_c = dynamic_cast(msb_ex); if (msb_c == 0) { cerr << index_tail.msb->get_fileline() << ": error: " "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 so we can keep going and find more errors. */ NetExpr*wid_ex = elab_and_eval(des, scope, index_tail.lsb, -1, true); - NetEConst*wid_c = dynamic_cast(wid_ex); + const NetEConst*wid_c = dynamic_cast(wid_ex); wid = wid_c ? wid_c->value().as_ulong() : 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 // case, just precalculate the entire constant result. - if (NetEConst*sel_c = dynamic_cast (sel)) { + if (const NetEConst*sel_c = dynamic_cast (sel)) { // Special case: If the bit select is constant and not fully // defined, then we know that the result must be 1'bx. 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 // case, just precalculate the entire constant result. - if (NetEConst*base_c = dynamic_cast (base)) { + if (const NetEConst*base_c = dynamic_cast (base)) { if (! base_c->value().is_defined()) { NetEConst *ex; 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 // case, just precalculate the entire constant result. - if (NetEConst*base_c = dynamic_cast (base)) { + if (const NetEConst*base_c = dynamic_cast (base)) { if (! base_c->value().is_defined()) { NetEConst *ex; 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 // well. In this case it can be converted to a conventional // part select. - if (NetEConst*base_c = dynamic_cast (base)) { + if (const NetEConst*base_c = dynamic_cast (base)) { NetExpr*ex; if (base_c->value().is_defined()) { 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 // well. In this case it can be converted to a conventional // part select. - if (NetEConst*base_c = dynamic_cast (base)) { + if (const NetEConst*base_c = dynamic_cast (base)) { NetExpr*ex; if (base_c->value().is_defined()) { 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 // to the part select, so that I save the effort of // making a mux part in the netlist. - if (NetEConst*msc = dynamic_cast (mux)) { + if (const NetEConst*msc = dynamic_cast (mux)) { if (debug_elaborate) { 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 // argument we can use? - if (NetExpr*tmp = def->port_defe(idx)) { + if (const NetExpr*tmp = def->port_defe(idx)) { parms[idx] = tmp->dup_expr(); continue; } @@ -7120,7 +7120,7 @@ NetExpr*PETernary::elaborate_expr(Design*des, NetScope*scope, // Verilog doesn't say that we must do short circuit evaluation // of ternary expressions, but it doesn't disallow it. - if (NetEConst*tmp = dynamic_cast (con)) { + if (const NetEConst*tmp = dynamic_cast (con)) { verinum cval = tmp->value(); ivl_assert(*this, cval.len()==1); @@ -7386,7 +7386,7 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, break; case '-': - if (NetEConst*ipc = dynamic_cast(ip)) { + if (const NetEConst*ipc = dynamic_cast(ip)) { verinum val = - ipc->value(); tmp = new NetEConst(val); @@ -7394,7 +7394,7 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, tmp->set_line(*this); delete ip; - } else if (NetECReal*ipr = dynamic_cast(ip)) { + } else if (const NetECReal*ipr = dynamic_cast(ip)) { /* When taking the - of a real, fold this into the 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 evaluate this expression here and return a logical constant in its place. */ - if (NetEConst*ipc = dynamic_cast(ip)) { + if (const NetEConst*ipc = dynamic_cast(ip)) { verinum val = ipc->value(); unsigned v1 = 0; unsigned vx = 0; @@ -7445,7 +7445,7 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, tmp = new NetEConst(vres); tmp->set_line(*this); delete ip; - } else if (NetECReal*ipr = dynamic_cast(ip)) { + } else if (const NetECReal*ipr = dynamic_cast(ip)) { verinum::V res; if (ipr->value().as_double() == 0.0) res = verinum::V1; else res = verinum::V0; @@ -7527,7 +7527,7 @@ NetNet* Design::find_discipline_reference(ivl_discipline_t dis, NetScope*scope) if (gnd) return 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->set_discipline(dis); discipline_references_[dis->name()] = gnd; diff --git a/elab_lval.cc b/elab_lval.cc index e1c88dab8..bde944622 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -177,7 +177,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, symbol_search(this, des, scope, path_, lexical_pos_, &sr); 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 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) { ivl_assert(*this, reg->coerced_to_uwire()); - NetEConst*canon_const = dynamic_cast(canon_index); + const NetEConst*canon_const = dynamic_cast(canon_index); if (!canon_const || reg->test_part_driven(reg->vector_width() - 1, 0, canon_const->value().as_long())) { report_mixed_assignment_conflict_("array word"); @@ -556,7 +556,7 @@ bool PEIdent::elaborate_lval_net_bit_(Design*des, return false; } - if (NetEConst*index_con = dynamic_cast (mux)) { + if (const NetEConst*index_con = dynamic_cast (mux)) { // The index has a constant defined value. if (index_con->value().is_defined()) { 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 // case we can reduce the expression. - if (NetEConst*base_c = dynamic_cast (base)) { + if (const NetEConst*base_c = dynamic_cast (base)) { // For the undefined case just let the constant pass and // we will handle it in the code generator. if (base_c->value().is_defined()) { diff --git a/elab_net.cc b/elab_net.cc index 2fd881b3a..c5bfb6165 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -105,7 +105,7 @@ NetNet* PEConcat::elaborate_lnet_common_(Design*des, NetScope*scope, concat operator from most significant to least significant, 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::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_UP: { NetExpr*tmp_ex = elab_and_eval(des, scope, index_tail.msb, -1, true); - NetEConst*tmp = dynamic_cast(tmp_ex); + const NetEConst*tmp = dynamic_cast(tmp_ex); if (!tmp) { cerr << get_fileline() << ": error: Indexed part select " "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.msb = new PENumber(new verinum(member_off)); 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) { cerr << get_fileline() << ": PEIdent::elaborate_lnet_common_: " @@ -825,7 +825,7 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope, widx_flag = true; } else { - NetEConst*canon_const = dynamic_cast(canon_index); + const NetEConst*canon_const = dynamic_cast(canon_index); ivl_assert(*this, canon_const); widx = canon_const->value().as_long(); @@ -967,8 +967,8 @@ NetNet* PEIdent::elaborate_lnet_common_(Design*des, NetScope*scope, << " wid=" << subnet_wid <<"]" << endl; - netvector_t*tmp2_vec = new netvector_t(sig->data_type(), - subnet_wid-1,0); + const netvector_t*tmp2_vec = new netvector_t(sig->data_type(), + subnet_wid-1,0); NetNet*subsig = new NetNet(sig->scope(), sig->scope()->local_symbol(), NetNet::WIRE, tmp2_vec); @@ -1114,7 +1114,7 @@ NetNet* PEIdent::elaborate_subport(Design*des, NetScope*scope) const unsigned swid = abs(midx - lidx) + 1; 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::WIRE, tmp2_vec); tmp->port_type(sig->port_type()); diff --git a/elab_scope.cc b/elab_scope.cc index d05138170..b51410088 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -218,7 +218,7 @@ static void elaborate_scope_enumeration(Design*des, NetScope*scope, // There is an explicit value. elaborate/evaluate // the value and assign it to the enumeration name. NetExpr*val = elab_and_eval(des, scope, cur->parm, -1); - NetEConst*val_const = dynamic_cast (val); + const NetEConst*val_const = dynamic_cast (val); if (val_const == 0) { cerr << use_enum->get_fileline() << ": 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 // width then the width must match the enumeration width. - if (PENumber *tmp = dynamic_cast(cur->parm)) { + if (const PENumber *tmp = dynamic_cast(cur->parm)) { if (tmp->value().has_len() && (tmp->value().len() != enum_width)) { 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) { } - void elaborate_runrun() + void elaborate_runrun() override { if (debug_scopes) 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 // the same way any other parameter value is evaluated. NetExpr*init_ex = elab_and_eval(des, container, loop_init, -1, true); - NetEConst*init = dynamic_cast (init_ex); + const NetEConst*init = dynamic_cast (init_ex); if (init == 0) { cerr << get_fileline() << ": error: " "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_val = genvar; NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1, true); - NetEConst*test = dynamic_cast(test_ex); + const NetEConst*test = dynamic_cast(test_ex); if (test == 0) { cerr << get_fileline() << ": error: Cannot evaluate generate \"loop\" " "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) { NetExpr*test_ex = elab_and_eval(des, container, loop_test, -1, true); - NetEConst*test = dynamic_cast (test_ex); + const NetEConst*test = dynamic_cast (test_ex); if (test == 0) { cerr << get_fileline() << ": error: Cannot evaluate genvar" << " conditional expression: " << *loop_test << endl; @@ -1380,9 +1380,9 @@ class delayed_elaborate_scope_mod_instances : public elaborator_work_item_t { NetScope*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: 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) { ivl_assert(*this, (*items_)[idx]); - if (Statement*sp = (*items_)[idx]->stat) + if (const Statement*sp = (*items_)[idx]->stat) sp -> elaborate_scope(des, scope); } } diff --git a/elab_sig.cc b/elab_sig.cc index 2cfcfef7c..0bb89f21f 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -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) * * 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 " << "scope " << scope_path(*cur) << " in generate " << id_number << endl; - flag = elaborate_sig_(des, *cur) & flag; + flag = elaborate_sig_(des, *cur) && flag; } return flag; @@ -671,7 +671,7 @@ void PFunction::elaborate_sig(Design*des, NetScope*scope) const ivl_assert(*this, ret_type); } } else { - netvector_t*tmp = new netvector_t(IVL_VT_LOGIC); + const netvector_t*tmp = new netvector_t(IVL_VT_LOGIC); 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, const netranges_t &packed_dimensions) const { - vector_type_t *vec_type = dynamic_cast(set_data_type_.get()); + const vector_type_t *vec_type = dynamic_cast(set_data_type_.get()); if (set_data_type_ && !vec_type) { ivl_assert(*this, packed_dimensions.empty()); return set_data_type_->elaborate_type(des, scope); @@ -1156,8 +1156,8 @@ NetNet* PWire::elaborate_sig(Design*des, NetScope*scope) } unsigned nattrib = 0; - attrib_list_t*attrib_list = evaluate_attributes(attributes, nattrib, - des, scope); + const attrib_list_t*attrib_list = evaluate_attributes(attributes, nattrib, + des, scope); /* If the net type is supply0 or supply1, replace it with a simple wire with a pulldown/pullup with supply diff --git a/elaborate.cc b/elaborate.cc index 60aab22a6..23406a7d1 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -199,8 +199,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const NetPartSelect::VP); des->add_node(tmp); tmp->set_line(*this); - netvector_t*osig_vec = new netvector_t(rval->data_type(), - lval->vector_width()-1,0); + const netvector_t*osig_vec = new netvector_t(rval->data_type(), + lval->vector_width()-1,0); NetNet*osig = new NetNet(scope, scope->local_symbol(), NetNet::TRI, osig_vec); osig->set_line(*this); @@ -227,8 +227,8 @@ void PGAssign::elaborate(Design*des, NetScope*scope) const connect(rval->pin(0), driver->pin(1)); - netvector_t*tmp_vec = new netvector_t(rval->data_type(), - rval->vector_width()-1,0); + const netvector_t*tmp_vec = new netvector_t(rval->data_type(), + rval->vector_width()-1,0); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); tmp->set_line(*this); @@ -258,7 +258,7 @@ NetNet *elaborate_unpacked_array(Design *des, NetScope *scope, const LineInfo &l const NetNet *lval, PExpr *expr) { NetNet *expr_net; - PEIdent* ident = dynamic_cast (expr); + const PEIdent* ident = dynamic_cast (expr); if (!ident) { if (dynamic_cast (expr)) { cout << loc.get_fileline() << ": sorry: Continuous assignment" @@ -923,8 +923,8 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const des->add_node(rep); connect(rep->pin(1), sig->pin(0)); - netvector_t*osig_vec = new netvector_t(IVL_VT_LOGIC, - instance_width-1,0); + const netvector_t*osig_vec = new netvector_t(IVL_VT_LOGIC, + instance_width-1,0); sig = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, osig_vec); sig->set_line(*this); @@ -1004,7 +1004,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const unsigned dev = gdx*gate_count; 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, scope->local_symbol(), NetNet::WIRE, tmp2_vec); @@ -1021,7 +1021,7 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const tmp1->set_line(*this); des->add_node(tmp1); 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::WIRE, tmp2_vec); 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::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::WIRE, tmp_type); tmp->local_flag(true); @@ -1508,7 +1508,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const // commonly used feature.) for (unsigned ldx = 0 ; ldx < mport.size() ; ldx += 1) { unsigned lbase = inst * mport.size(); - PEIdent*pport = mport[ldx]; + const PEIdent*pport = mport[ldx]; ivl_assert(*this, pport); NetNet *netnet = pport->elaborate_subport(des, inst_scope); 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. */ int context_width = -1; - if (PENumber*literal = dynamic_cast(pins[idx])) { + if (const PENumber*literal = dynamic_cast(pins[idx])) { if (literal->value().is_single()) context_width = prts_vector_width; } @@ -1664,8 +1664,8 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const des->add_node(tmp); connect(tmp->pin(1), sig->pin(0)); - netvector_t*tmp2_vec = new netvector_t(sig->data_type(), - sig->vector_width()-1,0); + const netvector_t*tmp2_vec = new netvector_t(sig->data_type(), + sig->vector_width()-1,0); NetNet*tmp2 = new NetNet(inner_scope, inner_scope->local_symbol(), NetNet::WIRE, tmp2_vec); tmp2->local_flag(true); @@ -2420,12 +2420,12 @@ NetAssign_* PAssign_::elaborate_lval(Design*des, NetScope*scope) const rval_->test_width(des, scope, mode); // Create a L-value that matches the function return type. NetNet*tmp; - netvector_t*tmp_vec = new netvector_t(rval_->expr_type(), - rval_->expr_width()-1, 0, - rval_->has_sign()); + const netvector_t*tmp_vec = new netvector_t(rval_->expr_type(), + rval_->expr_width()-1, 0, + rval_->has_sign()); 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); } else { 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) { while (lv) { - NetScope*sig_scope = lv->scope(); + const NetScope*sig_scope = lv->scope(); if (! sig_scope->program_block()) return true; lv = lv->more; } @@ -2752,7 +2752,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const if (delay || event_) { 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::REG, tmp2_vec); tmp->local_flag(true); @@ -2797,7 +2797,7 @@ NetProc* PAssign::elaborate(Design*des, NetScope*scope) const // If the expression is a constant, handle // certain special iteration counts. - if (NetEConst*ce = dynamic_cast(count)) { + if (const NetEConst*ce = dynamic_cast(count)) { long val = ce->value().as_long(); // We only need the real statement. if (val <= 0) { @@ -2946,7 +2946,7 @@ NetProc* PAssignNB::elaborate(Design*des, NetScope*scope) const ivl_assert(*this, event); // Some constant values are special. - if (NetEConst*ce = dynamic_cast(count)) { + if (const NetEConst*ce = dynamic_cast(count)) { long val = ce->value().as_long(); // We only need the assignment statement. 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 // midst of a block. Report the error. Continue on with the // elaboration so that other errors might be found. - if (PChainConstructor*supernew = dynamic_cast (list_[idx])) { + if (const PChainConstructor*supernew = dynamic_cast (list_[idx])) { if (debug_elaborate) { cerr << get_fileline() << ": PBlock::elaborate: " << "Found super.new statement, idx=" << idx << ", " @@ -3335,7 +3335,7 @@ NetProc* PChainConstructor::elaborate(Design*des, NetScope*scope) const // The scope is the .new function, so scope->parent() // is the class. Use that to get the class type that we are // constructing. - NetScope*scope_class = scope->parent(); + const NetScope*scope_class = scope->parent(); const netclass_t*class_this = scope_class->class_def(); ivl_assert(*this, class_this); @@ -3376,7 +3376,7 @@ NetProc* PChainConstructor::elaborate(Design*des, NetScope*scope) const continue; } - if (NetExpr*tmp = def->port_defe(idx)) { + if (const NetExpr*tmp = def->port_defe(idx)) { parms[idx] = tmp->dup_expr(); continue; } @@ -3429,7 +3429,7 @@ NetProc* PCondit::elaborate(Design*des, NetScope*scope) const // then look at the value and elaborate either the if statement // or the else statement. I don't need both. If there is no // else_ statement, then use an empty block as a noop. - if (NetEConst*ce = dynamic_cast(expr)) { + if (const NetEConst*ce = dynamic_cast(expr)) { verinum val = ce->value(); if (debug_elaborate) { 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 // empty blocks. If this is the case, remove the blocks as // null statements. - if (NetBlock*tmp = dynamic_cast(i)) { + if (const NetBlock*tmp = dynamic_cast(i)) { if (tmp->proc_first() == 0) { delete i; i = 0; } } - if (NetBlock*tmp = dynamic_cast(e)) { + if (const NetBlock*tmp = dynamic_cast(e)) { if (tmp->proc_first() == 0) { delete e; e = 0; @@ -3642,7 +3642,7 @@ NetProc* PCallTask::elaborate_usr(Design*des, NetScope*scope) const ivl_assert(*this, task); ivl_assert(*this, task->type() == NetScope::TASK); - NetTaskDef*def = task->task_def(); + const NetTaskDef*def = task->task_def(); if (def == 0) { cerr << get_fileline() << ": internal error: task " << path_ << " 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]) { rv = elaborate_rval_expr(des, scope, port->net_type(), args[parms_idx]); - if (NetEEvent*evt = dynamic_cast (rv)) { + if (const NetEEvent*evt = dynamic_cast (rv)) { cerr << evt->get_fileline() << ": error: An event '" << evt->event()->name() << "' can not be a user " "task argument." << endl; @@ -4651,7 +4651,7 @@ NetProc* PDelayStatement::elaborate(Design*des, NetScope*scope) const NetExpr*dex = elaborate_delay_expr(delay_, des, scope); NetPDelay *obj; - if (NetEConst*tmp = dynamic_cast(dex)) { + if (const NetEConst*tmp = dynamic_cast(dex)) { if (statement_) obj = new NetPDelay(tmp->value().as_ulong64(), statement_->elaborate(des, scope)); @@ -4951,7 +4951,7 @@ cerr << endl; named event, then handle this case all at once and skip the rest of the expression handling. */ - if (PEIdent*id = dynamic_cast(expr_[idx]->expr())) { + if (const PEIdent*id = dynamic_cast(expr_[idx]->expr())) { symbol_search_results 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 false is almost certainly not what is intended. */ ivl_assert(*this, expr->expr_width() == 1); - if (NetEConst*ce = dynamic_cast(expr)) { + if (const NetEConst*ce = dynamic_cast(expr)) { verinum val = ce->value(); 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 // iteration counts. - if (NetEConst*ce = dynamic_cast(expr)) { + if (const NetEConst*ce = dynamic_cast(expr)) { long val = ce->value().as_long(); if (val <= 0) { delete expr; @@ -6254,7 +6254,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const PExpr*exp = delays[idx]; NetExpr*cur = elab_and_eval(des, scope, exp, -1); - if (NetEConst*con = dynamic_cast (cur)) { + if (const NetEConst*con = dynamic_cast (cur)) { verinum fn = con->value(); delay_value[idx] = des->scale_to_precision(fn.as_ulong64(), scope); @@ -6310,7 +6310,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const typedef std::vector::const_iterator str_vec_iter; for (str_vec_iter cur = src.begin(); ( 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 * now assume it's a single bit. */ if (psig == 0) continue; @@ -6318,7 +6318,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const } for (str_vec_iter cur = dst.begin(); ( 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. */ if (psig == 0) continue; 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) { if (! pclass->type->initialize_static.empty()) { - std::vector&stmt_list = pclass->type->initialize_static; + const std::vector&stmt_list = pclass->type->initialize_static; NetBlock*stmt = new NetBlock(NetBlock::SEQU, 0); for (size_t idx = 0 ; idx < stmt_list.size() ; idx += 1) { 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 " << "scope " << scope_path(scope) << endl; - flag = elaborate_(des, scope) & flag; + flag = elaborate_(des, scope) && 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) { } - ~elaborate_package_t() { } + ~elaborate_package_t() override { } - virtual void elaborate_runrun() + virtual void elaborate_runrun() override { if (! package_->elaborate_scope(des, scope_)) 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) { } - ~elaborate_root_scope_t() { } + ~elaborate_root_scope_t() override { } - virtual void elaborate_runrun() + virtual void elaborate_runrun() override { Module::replace_t root_repl; for (list::iterator cur = Module::user_defparms.begin() @@ -7025,9 +7025,9 @@ class top_defparams : public elaborator_work_item_t { : elaborator_work_item_t(des__) { } - ~top_defparams() { } + ~top_defparams() override { } - virtual void elaborate_runrun() + virtual void elaborate_runrun() override { if (debug_scopes) { cerr << "debug: top_defparams::elaborate_runrun()" << endl; @@ -7056,9 +7056,9 @@ class later_defparams : public elaborator_work_item_t { : elaborator_work_item_t(des__) { } - ~later_defparams() { } + ~later_defparams() override { } - virtual void elaborate_runrun() + virtual void elaborate_runrun() override { if (debug_scopes) { 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) { - Module*mp = (*mod).second; + const Module*mp = (*mod).second; if (mp->has_explicit_timescale()) continue; cerr << " : -- module " << (*mod).first @@ -7445,7 +7445,7 @@ static void check_timescales() return; for (pkg = pform_packages.begin(); pkg != pform_packages.end(); ++pkg) { - PPackage*pp = *pkg; + const PPackage*pp = *pkg; if (pp->has_explicit_timescale()) continue; cerr << " : -- package " << pp->pscope_name() @@ -7656,7 +7656,7 @@ Design* elaborate(listroots) // creates all the NetNet and NetMemory objects for declared // objects. 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; if (! pack->elaborate_sig(des, scope)) { @@ -7680,7 +7680,7 @@ Design* elaborate(listroots) } 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; scope->set_num_ports( rmod->port_count() ); @@ -7708,7 +7708,7 @@ Design* elaborate(listroots) for (unsigned pin = 0; pin < mport.size(); pin += 1) { // This really does more than we need and adds extra // 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) { // Elaboration may actually fail with // erroneous input source @@ -7729,13 +7729,13 @@ Design* elaborate(listroots) // run through the pform again and generate the full netlist. 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; rc &= pkg->elaborate(des, scope); } 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; rc &= rmod->elaborate(des, scope); } diff --git a/emit.cc b/emit.cc index 39339c281..06069406d 100644 --- a/emit.cc +++ b/emit.cc @@ -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 * 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) return; - NetProc*cur = last_; + const NetProc*cur = last_; do { cur = cur->next_; cur->emit_proc(tgt); @@ -467,7 +467,7 @@ void NetScope::emit_scope(struct target_t*tgt) const tgt->scope(this); - for (NetEvent*cur = events_ ; cur ; cur = cur->snext_) + for (const NetEvent*cur = events_ ; cur ; cur = cur->snext_) tgt->event(cur); for (map::const_iterator cur = classes_.begin() @@ -566,7 +566,7 @@ int Design::emit(struct target_t*tgt) const // emit nodes bool nodes_rc = true; if (nodes_) { - NetNode*cur = nodes_->node_next_; + const NetNode*cur = nodes_->node_next_; do { nodes_rc = nodes_rc && cur->emit_node(tgt); cur = cur->node_next_; @@ -575,7 +575,7 @@ int Design::emit(struct target_t*tgt) const 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; } diff --git a/eval_attrib.cc b/eval_attrib.cc index 527df43ad..8f119c87b 100644 --- a/eval_attrib.cc +++ b/eval_attrib.cc @@ -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 * 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&att, if (!tmp) continue; - if (NetEConst *ce = dynamic_cast(tmp)) { + if (const NetEConst *ce = dynamic_cast(tmp)) { table[idx].val = ce->value(); - } else if (NetECReal *cer = dynamic_cast(tmp)) { + } else if (const NetECReal *cer = dynamic_cast(tmp)) { table[idx].val = verinum(cer->value().as_long()); } else { cerr << exp->get_fileline() << ": error: ``" diff --git a/eval_tree.cc b/eval_tree.cc index df8680d73..09b4f3bb6 100644 --- a/eval_tree.cc +++ b/eval_tree.cc @@ -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 * 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. NetEBAdd*se = dynamic_cast(left_); - NetEConst*lc = se? dynamic_cast(se->right_) : NULL; - NetEConst*rc = dynamic_cast(right_); + const NetEConst*lc = se? dynamic_cast(se->right_) : NULL; + const NetEConst*rc = dynamic_cast(right_); if (lc != 0 && rc != 0) { ivl_assert(*this, se != 0); @@ -1194,12 +1194,12 @@ NetEConst* NetEConcat::eval_arguments_(const vector&vals, NetEConst* NetESelect::eval_tree() { eval_expr(expr_); - NetEConst*expr = dynamic_cast(expr_); + const NetEConst*expr = dynamic_cast(expr_); long bval = 0; if (base_) { eval_expr(base_); - NetEConst*base = dynamic_cast(base_); + const NetEConst*base = dynamic_cast(base_); if (base == 0) return 0; @@ -1242,11 +1242,11 @@ NetEConst* NetESelect::eval_tree() static void print_ternary_cond(NetExpr*expr) { - if (NetEConst*c = dynamic_cast(expr)) { + if (const NetEConst*c = dynamic_cast(expr)) { cerr << c->value() << endl; return; } - if (NetECReal*c = dynamic_cast(expr)) { + if (const NetECReal*c = dynamic_cast(expr)) { cerr << c->value() << endl; return; } @@ -2499,7 +2499,7 @@ NetExpr* NetEUFunc::eval_tree() return 0; } - NetFuncDef*def = func_->func_def(); + const NetFuncDef*def = func_->func_def(); ivl_assert(*this, def); vectorargs(parms_.size()); diff --git a/exposenodes.cc b/exposenodes.cc index 56687cc48..c3fb51086 100644 --- a/exposenodes.cc +++ b/exposenodes.cc @@ -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 * 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; - virtual void lpm_mux(Design*des, NetMux*obj); - virtual void lpm_part_select(Design*des, NetPartSelect*obj); - virtual void lpm_substitute(Design*des, NetSubstitute*obj); + virtual void lpm_mux(Design*des, NetMux*obj) override; + virtual void lpm_part_select(Design*des, NetPartSelect*obj) override; + virtual void lpm_substitute(Design*des, NetSubstitute*obj) override; }; static bool expose_nexus(Nexus*nex) diff --git a/expr_synth.cc b/expr_synth.cc index 668df7482..eea33c99f 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -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 * 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); 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::IMPLICIT, osig_vec); 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); } - 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::IMPLICIT, osig_vec); osig->set_line(*this); @@ -576,7 +576,7 @@ NetNet* NetEBLogic::synthesize(Design*des, NetScope*scope, NetExpr*root) olog->set_line(*this); 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::IMPLICIT, osig_tmp); 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 constant. Evaluate the shift amount, and simply reconnect the left operand to the output, but shifted. */ - if (NetEConst*rcon = dynamic_cast(right_)) { + if (const NetEConst*rcon = dynamic_cast(right_)) { verinum shift_v = rcon->value(); long shift = shift_v.as_long(); @@ -628,7 +628,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root) if (shift == 0) 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::IMPLICIT, osig_vec); osig->set_line(*this); @@ -650,7 +650,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root) psel->set_line(*this); 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::IMPLICIT, psig_vec); psig->set_line(*this); @@ -678,8 +678,8 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root) znum); des->add_node(zcon); - netvector_t*zsig_vec = new netvector_t(osig->data_type(), - znum.len()-1, 0); + const netvector_t*zsig_vec = new netvector_t(osig->data_type(), + znum.len()-1, 0); NetNet*zsig = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, zsig_vec); zsig->set_line(*this); @@ -709,7 +709,7 @@ NetNet* NetEBShift::synthesize(Design*des, NetScope*scope, NetExpr*root) 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::IMPLICIT, osig_vec); osig->set_line(*this); @@ -966,7 +966,7 @@ NetNet* NetEUBits::synthesize(Design*des, NetScope*scope, NetExpr*root) } 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::IMPLICIT, osig_vec); osig->set_line(*this); @@ -1009,8 +1009,8 @@ NetNet* NetEUnary::synthesize(Design*des, NetScope*scope, NetExpr*root) if (expr_->has_sign() == false) return sub; - netvector_t*sig_vec = new netvector_t(sub->data_type(), - sub->vector_width()-1, 0); + const netvector_t*sig_vec = new netvector_t(sub->data_type(), + sub->vector_width()-1, 0); NetNet*sig = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, sig_vec); sig->set_line(*this); @@ -1084,7 +1084,7 @@ NetNet* NetEUReduce::synthesize(Design*des, NetScope*scope, NetExpr*root) gate->set_line(*this); 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::IMPLICIT, osig_vec); 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 // it is constant. In this case we can generate fixed part selects. - if (NetEConst*base_const = dynamic_cast(base_)) { + if (const NetEConst*base_const = dynamic_cast(base_)) { verinum base_tmp = base_const->value(); unsigned select_width = expr_width(); @@ -1194,8 +1194,8 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root) des->add_node(sel); ivl_assert(*this, select_width > 0); - netvector_t*tmp_vec = new netvector_t(sub->data_type(), - select_width-1, 0); + const netvector_t*tmp_vec = new netvector_t(sub->data_type(), + select_width-1, 0); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); tmp->set_line(*this); @@ -1243,8 +1243,8 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root) sel->set_line(*this); des->add_node(sel); - netvector_t*tmp_vec = new netvector_t(sub->data_type(), - expr_width()-1, 0); + const netvector_t*tmp_vec = new netvector_t(sub->data_type(), + expr_width()-1, 0); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::IMPLICIT, tmp_vec); tmp->local_flag(true); @@ -1321,7 +1321,7 @@ NetNet* NetESelect::synthesize(Design *des, NetScope*scope, NetExpr*root) con->set_line(*this); 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::IMPLICIT, tmp_vec); tmp->set_line(*this); @@ -1376,7 +1376,7 @@ NetNet* NetETernary::synthesize(Design *des, NetScope*scope, NetExpr*root) ivl_assert(*this, csig->vector_width() == 1); 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); osig->set_line(*this); osig->local_flag(true); @@ -1421,8 +1421,8 @@ NetNet* NetESignal::synthesize(Design*des, NetScope*scope, NetExpr*root) // If this is a synthesis with a specific value for the // signal, then replace it (here) with a constant value. if (net_->scope()==scope && net_->name()==scope->genvar_tmp) { - netvector_t*tmp_vec = new netvector_t(net_->data_type(), - net_->vector_width()-1, 0); + const netvector_t*tmp_vec = new netvector_t(net_->data_type(), + net_->vector_width()-1, 0); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::IMPLICIT, tmp_vec); tmp->set_line(*this); @@ -1452,8 +1452,8 @@ NetNet* NetESignal::synthesize(Design*des, NetScope*scope, NetExpr*root) return tmp; } - netvector_t*tmp_vec = new netvector_t(net_->data_type(), - net_->vector_width()-1, 0); + const netvector_t*tmp_vec = new netvector_t(net_->data_type(), + net_->vector_width()-1, 0); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::IMPLICIT, tmp_vec); tmp->set_line(*this); @@ -1462,7 +1462,7 @@ NetNet* NetESignal::synthesize(Design*des, NetScope*scope, NetExpr*root) // For NetExpr objects, the word index is already converted to // a canonical (lsb==0) address. Just use the index directly. - if (NetEConst*index_co = dynamic_cast (word_)) { + if (const NetEConst*index_co = dynamic_cast (word_)) { long index = index_co->value().as_long(); connect(tmp->pin(0), net_->pin(index)); @@ -1611,8 +1611,8 @@ NetNet* NetEUFunc::synthesize(Design*des, NetScope*scope, NetExpr*root) des->add_node(net); /* Create an output signal and connect it to the function. */ - netvector_t*osig_vec = new netvector_t(result_sig_->expr_type(), - result_sig_->vector_width()-1, 0); + const netvector_t*osig_vec = new netvector_t(result_sig_->expr_type(), + result_sig_->vector_width()-1, 0); NetNet*osig = new NetNet(scope_, scope_->local_symbol(), NetNet::WIRE, osig_vec); osig->set_line(*this); @@ -1626,7 +1626,7 @@ NetNet* NetEUFunc::synthesize(Design*des, NetScope*scope, NetExpr*root) } /* 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) { unsigned width = def->port(idx)->vector_width(); NetNet*tmp; diff --git a/libmisc/StringHeap.cc b/libmisc/StringHeap.cc index d14580eb5..264168693 100644 --- a/libmisc/StringHeap.cc +++ b/libmisc/StringHeap.cc @@ -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 * 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); #ifdef CHECK_WITH_VALGRIND string_pool_count += 1; - string_pool = (char**)realloc(string_pool, - string_pool_count*sizeof(char**)); + string_pool = static_cast(realloc(string_pool, + string_pool_count*sizeof(char**))); string_pool[string_pool_count-1] = buf; #endif return buf; @@ -72,19 +72,19 @@ const char* StringHeap::add(const char*text) // same pointer. if (rem > 0) { char*old = cell_base_; - cell_base_ = (char*)realloc(cell_base_, cell_ptr_); + cell_base_ = static_cast(realloc(cell_base_, cell_ptr_)); assert(cell_base_ != 0); assert(cell_base_ == old); } // start new cell - cell_base_ = (char*)malloc(DEFAULT_CELL_SIZE); + cell_base_ = static_cast(malloc(DEFAULT_CELL_SIZE)); cell_ptr_ = 0; rem = DEFAULT_CELL_SIZE; assert(cell_base_ != 0); #ifdef CHECK_WITH_VALGRIND string_pool_count += 1; - string_pool = (char **) realloc(string_pool, - string_pool_count*sizeof(char **)); + string_pool = static_cast(realloc(string_pool, + string_pool_count*sizeof(char **))); string_pool[string_pool_count-1] = cell_base_; #endif } diff --git a/load_module.cc b/load_module.cc index fef785659..3d93be221 100644 --- a/load_module.cc +++ b/load_module.cc @@ -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 * 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 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. */ - while (struct dirent*de = readdir(dir)) { + while (const struct dirent*de = readdir(dir)) { unsigned namsiz = strlen(de->d_name); char*key = 0; diff --git a/net_assign.cc b/net_assign.cc index e47010df9..35b6b6ae6 100644 --- a/net_assign.cc +++ b/net_assign.cc @@ -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 * 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 sum = 0; - for (NetAssign_*cur = lval_ ; cur ; cur = cur->more) + for (const NetAssign_*cur = lval_ ; cur ; cur = cur->more) sum += cur->lwidth(); return sum; } diff --git a/net_design.cc b/net_design.cc index 7a6b5585d..771b7327e 100644 --- a/net_design.cc +++ b/net_design.cc @@ -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 * 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) return; - NetEConst*val = dynamic_cast((*cur).second.val); + const NetEConst*val = dynamic_cast((*cur).second.val); ivl_assert(*expr, val); verinum value = val->value(); @@ -659,7 +659,7 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur) continue; if (value_range->low_expr) { - NetEConst*tmp = dynamic_cast(value_range->low_expr); + const NetEConst*tmp = dynamic_cast(value_range->low_expr); ivl_assert(*value_range->low_expr, tmp); if (value_range->low_open_flag && value <= tmp->value()) continue; @@ -668,7 +668,7 @@ void NetScope::evaluate_parameter_logic_(Design*des, param_ref_t cur) } if (value_range->high_expr) { - NetEConst*tmp = dynamic_cast(value_range->high_expr); + const NetEConst*tmp = dynamic_cast(value_range->high_expr); ivl_assert(*value_range->high_expr, tmp); if (value_range->high_open_flag && value >= tmp->value()) continue; diff --git a/net_event.cc b/net_event.cc index c87ac54f3..c82dd2a90 100644 --- a/net_event.cc +++ b/net_event.cc @@ -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 * 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 cnt = 0; - NetEvProbe*cur = probes_; + const NetEvProbe*cur = probes_; while (cur) { cnt += 1; cur = cur->enext_; @@ -105,7 +105,7 @@ const NetEvProbe* NetEvent::probe(unsigned idx) const unsigned NetEvent::ntrig() const { unsigned cnt = 0; - NetEvTrig*cur = trig_; + const NetEvTrig*cur = trig_; while (cur) { cnt += 1; cur = cur->enext_; @@ -198,7 +198,7 @@ void NetEvent::find_similar_event(list&event_list) continue; unsigned tcnt = 0; - for (NetEvProbe*cur = tmp->probes_ ; cur ; cur = cur->enext_) + for (const NetEvProbe*cur = tmp->probes_ ; cur ; cur = cur->enext_) tcnt += 1; if (tcnt == probe_count) diff --git a/net_func.cc b/net_func.cc index 3f3a5610f..1bd714aa4 100644 --- a/net_func.cc +++ b/net_func.cc @@ -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 * 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 { - NetFuncDef*fdef = def_->func_def(); + const NetFuncDef*fdef = def_->func_def(); /* Port 0 is the return port. */ if (port == 0) { diff --git a/net_func_eval.cc b/net_func_eval.cc index 8c0a751be..e986c4f2d 100644 --- a/net_func_eval.cc +++ b/net_func_eval.cc @@ -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 * 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; } - NetEConst*word_const = dynamic_cast(word_result); + const NetEConst*word_const = dynamic_cast(word_result); ivl_assert(loc, word_const); if (!word_const->value().is_defined()) @@ -353,7 +353,7 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc, return false; } - NetEConst*base_const = dynamic_cast(base_result); + const NetEConst*base_const = dynamic_cast(base_result); ivl_assert(loc, base_const); long base = base_const->value().as_long(); @@ -361,10 +361,10 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc, if (old_lval == 0) old_lval = make_const_x(lval->sig()->vector_width()); - NetEConst*lval_const = dynamic_cast(old_lval); + const NetEConst*lval_const = dynamic_cast(old_lval); ivl_assert(loc, lval_const); verinum lval_v = lval_const->value(); - NetEConst*rval_const = dynamic_cast(rval_result); + const NetEConst*rval_const = dynamic_cast(rval_result); ivl_assert(loc, rval_const); verinum rval_v = rval_const->value(); @@ -392,10 +392,10 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc, if (op_ == 0) { rval_result = fix_assign_value(lval->sig(), rval_result); } else if (dynamic_cast(rval_result)) { - NetECReal*lval_const = dynamic_cast(old_lval); + const NetECReal*lval_const = dynamic_cast(old_lval); ivl_assert(loc, lval_const); verireal lval_r = lval_const->value(); - NetECReal*rval_const = dynamic_cast(rval_result); + const NetECReal*rval_const = dynamic_cast(rval_result); ivl_assert(loc, rval_const); verireal rval_r = rval_const->value(); @@ -404,10 +404,10 @@ bool NetAssign::eval_func_lval_(const LineInfo&loc, delete rval_result; rval_result = new NetECReal(lval_r); } else { - NetEConst*lval_const = dynamic_cast(old_lval); + const NetEConst*lval_const = dynamic_cast(old_lval); ivl_assert(loc, lval_const); verinum lval_v = lval_const->value(); - NetEConst*rval_const = dynamic_cast(rval_result); + const NetEConst*rval_const = dynamic_cast(rval_result); ivl_assert(loc, rval_const); 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 // expect the RHS to be a vector value. - NetEConst*rval_const = dynamic_cast(rval_result); + const NetEConst*rval_const = dynamic_cast(rval_result); ivl_assert(*this, rval_const); if (op_) { @@ -557,13 +557,13 @@ bool NetCase::evaluate_function_vect_(const LineInfo&loc, if (case_expr == 0) return false; - NetEConst*case_const = dynamic_cast (case_expr); + const NetEConst*case_const = dynamic_cast (case_expr); ivl_assert(loc, case_const); verinum case_val = case_const->value(); delete case_expr; - NetProc*default_statement = 0; + const NetProc*default_statement = 0; for (unsigned cnt = 0 ; cnt < items_.size() ; cnt += 1) { const Item*item = &items_[cnt]; @@ -577,7 +577,7 @@ bool NetCase::evaluate_function_vect_(const LineInfo&loc, if (item_expr == 0) return false; - NetEConst*item_const = dynamic_cast (item_expr); + const NetEConst*item_const = dynamic_cast (item_expr); ivl_assert(loc, item_const); verinum item_val = item_const->value(); @@ -619,13 +619,13 @@ bool NetCase::evaluate_function_real_(const LineInfo&loc, if (case_expr == 0) return false; - NetECReal*case_const = dynamic_cast (case_expr); + const NetECReal*case_const = dynamic_cast (case_expr); ivl_assert(loc, case_const); double case_val = case_const->value().as_double(); delete case_expr; - NetProc*default_statement = 0; + const NetProc*default_statement = 0; for (unsigned cnt = 0 ; cnt < items_.size() ; cnt += 1) { const Item*item = &items_[cnt]; @@ -639,7 +639,7 @@ bool NetCase::evaluate_function_real_(const LineInfo&loc, if (item_expr == 0) return false; - NetECReal*item_const = dynamic_cast (item_expr); + const NetECReal*item_const = dynamic_cast (item_expr); ivl_assert(loc, item_const); double item_val = item_const->value().as_double(); @@ -677,7 +677,7 @@ bool NetCondit::evaluate_function(const LineInfo&loc, return false; } - NetEConst*cond_const = dynamic_cast (cond); + const NetEConst*cond_const = dynamic_cast (cond); ivl_assert(loc, cond_const); long val = cond_const->value().as_long(); @@ -767,7 +767,7 @@ bool NetDoWhile::evaluate_function(const LineInfo&loc, break; } - NetEConst*cond_const = dynamic_cast (cond); + const NetEConst*cond_const = dynamic_cast (cond); ivl_assert(loc, cond_const); long val = cond_const->value().as_long(); @@ -843,7 +843,7 @@ bool NetForLoop::evaluate_function(const LineInfo&loc, break; } - NetEConst*cond_const = dynamic_cast (cond); + const NetEConst*cond_const = dynamic_cast (cond); ivl_assert(loc, cond_const); 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); if (count_expr == 0) return false; - NetEConst*count_const = dynamic_cast (count_expr); + const NetEConst*count_const = dynamic_cast (count_expr); ivl_assert(loc, count_const); long count = count_const->value().as_long(); @@ -948,7 +948,7 @@ bool NetWhile::evaluate_function(const LineInfo&loc, break; } - NetEConst*cond_const = dynamic_cast (cond); + const NetEConst*cond_const = dynamic_cast (cond); ivl_assert(loc, cond_const); 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); ivl_assert(loc, sub_exp); - NetEConst*sub_const = dynamic_cast (sub_exp); + const NetEConst*sub_const = dynamic_cast (sub_exp); ivl_assert(loc, sub_exp); 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); ivl_assert(loc, base_val); - NetEConst*base_const = dynamic_cast(base_val); + const NetEConst*base_const = dynamic_cast(base_val); ivl_assert(loc, base_const); base = base_const->value().as_long(); @@ -1096,14 +1096,14 @@ NetExpr* NetESignal::evaluate_function(const LineInfo&loc, var = var->ref; } - NetExpr*value = 0; + const NetExpr*value = 0; if (var->nwords > 0) { ivl_assert(loc, word_); NetExpr*word_result = word_->evaluate_function(loc, context_map); if (word_result == 0) return 0; - NetEConst*word_const = dynamic_cast(word_result); + const NetEConst*word_const = dynamic_cast(word_result); ivl_assert(loc, word_const); 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, map&context_map) const { - NetFuncDef*def = func_->func_def(); + const NetFuncDef*def = func_->func_def(); ivl_assert(*this, def); vectorargs(parms_.size()); diff --git a/net_nex_input.cc b/net_nex_input.cc index 8c45056c8..cd0e26cf0 100644 --- a/net_nex_input.cc +++ b/net_nex_input.cc @@ -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 * 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); bool const_select = result->size() == 0; if (always_sens && const_select) { - if (NetEConst *val = dynamic_cast (base_)) { + if (const NetEConst *val = dynamic_cast (base_)) { assert(select_type() == IVL_SEL_OTHER); - if (NetESignal *sig = dynamic_cast (expr_)) { + if (const NetESignal *sig = dynamic_cast (expr_)) { delete tmp; tmp = sig->nex_input_base(rem_out, always_sens, nested_func, 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 '" << name() << "'." << endl; } - if (always_sens) if (NetEConst *val = dynamic_cast (word_)) { + if (always_sens) if (const NetEConst *val = dynamic_cast (word_)) { const_select = true; 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 particular, index expressions are statement inputs as well, 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); result->add(*tmp); delete tmp; diff --git a/net_proc.cc b/net_proc.cc index fe4ab5a8f..23b170d1c 100644 --- a/net_proc.cc +++ b/net_proc.cc @@ -133,7 +133,7 @@ void NetCase::prune() // If the guard expression is not constant, assume // all bits are needed, so no pruning can be done. - NetEConst*gc = dynamic_cast(items_[idx].guard); + const NetEConst*gc = dynamic_cast(items_[idx].guard); if (gc == 0) return; diff --git a/netclass.h b/netclass.h index 1e7d28445..e4477af36 100644 --- a/netclass.h +++ b/netclass.h @@ -1,7 +1,7 @@ #ifndef 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 * 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 { public: 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 // 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 // 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 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; 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; 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_; } protected: - bool test_compatibility(ivl_type_t that) const; + bool test_compatibility(ivl_type_t that) const override; private: perm_string name_; diff --git a/netdarray.h b/netdarray.h index 8fc466e3b..ca306553b 100644 --- a/netdarray.h +++ b/netdarray.h @@ -1,7 +1,7 @@ #ifndef 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 * 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: explicit netdarray_t(ivl_type_t vec); - ~netdarray_t(); + ~netdarray_t() override; // This is the "base_type()" virtual method of the // nettype_base_t. The ivl_target api expects this to return // 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. - 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 // 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. 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: - bool test_compatibility(ivl_type_t that) const; - bool test_equivalence(ivl_type_t that) const; + bool test_compatibility(ivl_type_t that) const override; + bool test_equivalence(ivl_type_t that) const override; }; #endif /* IVL_netdarray_H */ diff --git a/netenum.h b/netenum.h index 6d5b7196e..c4f0e167d 100644 --- a/netenum.h +++ b/netenum.h @@ -1,7 +1,7 @@ #ifndef 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 * 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: explicit netenum_t(ivl_type_t base_type, size_t name_count, bool integer_flag); - ~netenum_t(); + ~netenum_t() override; - virtual ivl_variable_type_t base_type() const; - virtual bool packed() const; - virtual long packed_width() const; - netranges_t slice_dimensions() const; - bool get_signed() const; + virtual ivl_variable_type_t base_type() const override; + virtual bool packed() const override; + virtual long packed_width() const override; + netranges_t slice_dimensions() const override; + bool get_signed() const override; bool get_isint() const; // The size() is the number of enumeration literals. diff --git a/netlist.cc b/netlist.cc index b9e3425b6..c2cf782cc 100644 --- a/netlist.cc +++ b/netlist.cc @@ -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 * and/or modify it in source code form under the terms of the GNU @@ -1013,7 +1013,7 @@ NetProcTop::~NetProcTop() bool flag = false; 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) { cerr << get_fileline() << ": warning: '" << net->name() << "' 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); if (! lval) return; - NetNet*sig = lval->sig(); + const NetNet*sig = lval->sig(); if (! sig) return; if ((sig->data_type() != IVL_VT_BOOL) && @@ -3451,7 +3451,7 @@ bool NetScope::check_synth(ivl_process_type_t pr_type, { bool result = false; // 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; cerr << cur->get_fileline() << ": warning: An event (" << cur->name() << ") cannot be synthesized " diff --git a/netlist.h b/netlist.h index 46a24ccec..e04c8e42c 100644 --- a/netlist.h +++ b/netlist.h @@ -210,7 +210,7 @@ class NetPins : public LineInfo { public: explicit NetPins(unsigned npins); - virtual ~NetPins(); + virtual ~NetPins() override; unsigned pin_count() const { return npins_; } @@ -260,7 +260,7 @@ class NetObj : public NetPins, public Attrib { // The name of the object must be a permallocated string. A // lex_strings string, for example. explicit NetObj(NetScope*s, perm_string n, unsigned npins); - virtual ~NetObj(); + virtual ~NetObj() override; NetScope* scope(); const NetScope* scope() const; @@ -278,7 +278,7 @@ class NetObj : public NetPins, public Attrib { void dump_obj_attr(std::ostream&, unsigned) const; - virtual void show_type(std::ostream&fd) const; + virtual void show_type(std::ostream&fd) const override; private: NetScope*scope_; @@ -320,7 +320,7 @@ class NetBranch : public NetPins, public IslandBranch { public: explicit NetBranch(ivl_discipline_t dis); explicit NetBranch(ivl_discipline_t dis, perm_string name); - ~NetBranch(); + ~NetBranch() override; // If the branch is named, this returns the name. perm_string name() const { return name_; } @@ -515,7 +515,7 @@ class NetBus : public NetObj { public: NetBus(NetScope*scope, unsigned pin_count); - ~NetBus(); + ~NetBus() override; unsigned find_link(const Link&that) const; @@ -535,7 +535,7 @@ class NetNode : public NetObj { // The name parameter must be a permallocated string. explicit NetNode(NetScope*s, perm_string n, unsigned npins); - virtual ~NetNode(); + virtual ~NetNode() override; virtual bool emit_node(struct target_t*) const; virtual void dump_node(std::ostream&, unsigned) const; @@ -560,7 +560,7 @@ class NetDelaySrc : public NetObj { public: explicit NetDelaySrc(NetScope*s, perm_string n, unsigned nsrc, bool condit_src, bool conditional, bool parallel); - ~NetDelaySrc(); + ~NetDelaySrc() override; // These functions set the delays from the values in the // source. These set_delays functions implement the various @@ -683,7 +683,7 @@ class NetNet : public NetObj, public PortType { explicit NetNet(NetScope*s, perm_string n, Type t, ivl_type_t type); - virtual ~NetNet(); + virtual ~NetNet() override; Type type() const; void type(Type t); @@ -956,7 +956,7 @@ class NetScope : public Definitions, public Attrib { NetScope(NetScope*up, const hname_t&name, TYPE t, NetScope*in_unit=0, bool nest=false, bool program=false, bool interface=false, bool compilation_unit=false); - ~NetScope(); + ~NetScope() override; /* Rename the scope using the name generated by inserting as many pad characters as required between prefix and suffix @@ -1367,13 +1367,13 @@ class NetAbs : public NetNode { public: NetAbs(NetScope*s, perm_string n, unsigned width); - ~NetAbs(); + ~NetAbs() override; unsigned width() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned width_; @@ -1388,7 +1388,7 @@ class NetAddSub : public NetNode { public: NetAddSub(NetScope*s, perm_string n, unsigned width); - ~NetAddSub(); + ~NetAddSub() override; // Get the width of the device (that is, the width of the // operands and results). @@ -1404,9 +1404,9 @@ class NetAddSub : public NetNode { const Link& pin_DataB() const; const Link& pin_Result() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned width_; @@ -1421,7 +1421,7 @@ class NetArrayDq : public NetNode { public: NetArrayDq(NetScope*s, perm_string name, NetNet*mem, unsigned awid); - ~NetArrayDq(); + ~NetArrayDq() override; unsigned width() const; unsigned awidth() const; @@ -1434,8 +1434,8 @@ class NetArrayDq : public NetNode { const Link& pin_Address() const; const Link& pin_Result() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: NetNet*mem_; @@ -1454,8 +1454,8 @@ class NetCastInt4 : public NetNode { unsigned width() const { return width_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: unsigned width_; @@ -1468,8 +1468,8 @@ class NetCastInt2 : public NetNode { unsigned width() const { return width_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: unsigned width_; @@ -1488,8 +1488,8 @@ class NetCastReal : public NetNode { bool signed_flag() const { return signed_flag_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: bool signed_flag_; @@ -1503,7 +1503,7 @@ class NetCLShift : public NetNode { public: NetCLShift(NetScope*s, perm_string n, unsigned width, unsigned width_dist, bool right_flag, bool signed_flag); - ~NetCLShift(); + ~NetCLShift() override; unsigned width() const; unsigned width_dist() const; @@ -1519,8 +1519,8 @@ class NetCLShift : public NetNode { const Link& pin_Result() const; const Link& pin_Distance() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: unsigned width_; @@ -1547,7 +1547,7 @@ class NetCompare : public NetNode { public: NetCompare(NetScope*scope, perm_string n, unsigned width); - ~NetCompare(); + ~NetCompare() override; unsigned width() const; @@ -1574,9 +1574,9 @@ class NetCompare : public NetNode { const Link& pin_DataA() const; const Link& pin_DataB() const; - virtual void functor_node(Design*, functor_t*); - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void functor_node(Design*, functor_t*) override; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: unsigned width_; @@ -1602,7 +1602,7 @@ class NetConcat : public NetNode { public: NetConcat(NetScope*scope, perm_string n, unsigned wid, unsigned cnt, bool transparent_flag = false); - ~NetConcat(); + ~NetConcat() override; unsigned width() const; // This is true if the concatenation is a transparent @@ -1611,9 +1611,9 @@ class NetConcat : public NetNode { // ignored. bool transparent() const { return transparent_; } - void dump_node(std::ostream&, unsigned ind) const; - bool emit_node(struct target_t*) const; - void functor_node(Design*des, functor_t*fun); + void dump_node(std::ostream&, unsigned ind) const override; + bool emit_node(struct target_t*) const override; + void functor_node(Design*des, functor_t*fun) override; private: unsigned width_; @@ -1636,7 +1636,7 @@ class NetDivide : public NetNode { public: NetDivide(NetScope*scope, perm_string n, unsigned width, unsigned wa, unsigned wb); - ~NetDivide(); + ~NetDivide() override; unsigned width_r() const; unsigned width_a() const; @@ -1653,9 +1653,9 @@ class NetDivide : public NetNode { const Link& pin_DataB() const; const Link& pin_Result() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned width_r_; @@ -1680,7 +1680,7 @@ class NetModulo : public NetNode { public: NetModulo(NetScope*s, perm_string n, unsigned width, unsigned wa, unsigned wb); - ~NetModulo(); + ~NetModulo() override; unsigned width_r() const; unsigned width_a() const; @@ -1697,9 +1697,9 @@ class NetModulo : public NetNode { const Link& pin_DataB() const; const Link& pin_Result() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned width_r_; @@ -1717,7 +1717,7 @@ class NetFF : public NetNode { public: NetFF(NetScope*s, perm_string n, bool negedge, unsigned vector_width); - ~NetFF(); + ~NetFF() override; bool is_negedge() const; unsigned width() const; @@ -1746,9 +1746,9 @@ class NetFF : public NetNode { void sset_value(const verinum&val); const verinum& sset_value() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: bool negedge_; @@ -1766,7 +1766,7 @@ class NetLatch : public NetNode { public: NetLatch(NetScope*s, perm_string n, unsigned vector_width); - ~NetLatch(); + ~NetLatch() override; unsigned width() const; @@ -1778,9 +1778,9 @@ class NetLatch : public NetNode { const Link& pin_Data() const; const Link& pin_Q() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned width_; @@ -1800,7 +1800,7 @@ class NetMult : public NetNode { public: NetMult(NetScope*sc, perm_string n, unsigned width, unsigned wa, unsigned wb); - ~NetMult(); + ~NetMult() override; bool get_signed() const; void set_signed(bool); @@ -1819,9 +1819,9 @@ class NetMult : public NetNode { const Link& pin_DataB() const; const Link& pin_Result() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: bool signed_; @@ -1852,7 +1852,7 @@ class NetMux : public NetNode { public: NetMux(NetScope*scope, perm_string n, unsigned width, unsigned size, unsigned selw); - ~NetMux(); + ~NetMux() override; unsigned width() const; unsigned size() const; @@ -1866,9 +1866,9 @@ class NetMux : public NetNode { const Link& pin_Data(unsigned) const; const Link& pin_Sel() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned width_; @@ -1891,7 +1891,7 @@ class NetPow : public NetNode { public: NetPow(NetScope*sc, perm_string n, unsigned width, unsigned wa, unsigned wb); - ~NetPow(); + ~NetPow() override; bool get_signed() const; void set_signed(bool); @@ -1910,9 +1910,9 @@ class NetPow : public NetNode { const Link& pin_DataB() const; const Link& pin_Result() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: bool signed_; @@ -1939,13 +1939,13 @@ class NetReplicate : public NetNode { public: NetReplicate(NetScope*scope, perm_string n, unsigned wid, unsigned rpt); - ~NetReplicate(); + ~NetReplicate() override; unsigned width() const; unsigned repeat() const; - void dump_node(std::ostream&, unsigned ind) const; - bool emit_node(struct target_t*) const; + void dump_node(std::ostream&, unsigned ind) const override; + bool emit_node(struct target_t*) const override; private: unsigned width_; @@ -1961,7 +1961,7 @@ class NetUserFunc : public NetNode { public: NetUserFunc(NetScope*s, perm_string n, NetScope*def, NetEvWait*trigger__); - ~NetUserFunc(); + ~NetUserFunc() override; unsigned port_width(unsigned port) const; @@ -1969,8 +1969,8 @@ class NetUserFunc : public NetNode { const NetEvWait* trigger() const { return trigger_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: NetScope*def_; @@ -1987,7 +1987,7 @@ class NetSysFunc : public NetNode { NetSysFunc(NetScope*s, perm_string n, const struct sfunc_return_type*def, unsigned ports, NetEvWait*trigger__); - ~NetSysFunc(); + ~NetSysFunc() override; ivl_variable_type_t data_type() const; unsigned vector_width() const; @@ -1995,8 +1995,8 @@ class NetSysFunc : public NetNode { const NetEvWait* trigger() const { return trigger_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: const struct sfunc_return_type*def_; @@ -2012,7 +2012,7 @@ class NetTran : public NetNode, public IslandBranch { // Create a TRAN_VP NetTran(NetScope*scope, perm_string n, unsigned wid, unsigned part, unsigned off); - ~NetTran(); + ~NetTran() override; ivl_switch_type_t type() const { return type_; } @@ -2021,8 +2021,8 @@ class NetTran : public NetNode, public IslandBranch { unsigned part_width() const; unsigned part_offset() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: ivl_switch_type_t type_; @@ -2042,7 +2042,7 @@ class NetExpr : public LineInfo { public: explicit NetExpr(unsigned w =0); explicit NetExpr(ivl_type_t t); - virtual ~NetExpr() =0; + virtual ~NetExpr() override =0; virtual void expr_scan(struct expr_scan_t*) const =0; virtual void dump(std::ostream&) const; @@ -2136,18 +2136,18 @@ class NetEArrayPattern : public NetExpr { public: NetEArrayPattern(ivl_type_t lv_type, std::vector&items); - ~NetEArrayPattern(); + ~NetEArrayPattern() override; inline size_t item_size() const { return items_.size(); } const NetExpr* item(size_t idx) const { return items_[idx]; } - void expr_scan(struct expr_scan_t*) const; - void dump(std::ostream&) const; + void expr_scan(struct expr_scan_t*) const override; + void dump(std::ostream&) const override; - NetEArrayPattern* dup_expr() const; + NetEArrayPattern* dup_expr() const override; NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - NetNet* synthesize(Design *des, NetScope *scope, NetExpr *root); + bool nested_func = false) const override; + NetNet* synthesize(Design *des, NetScope *scope, NetExpr *root) override; private: std::vector items_; @@ -2163,29 +2163,29 @@ class NetEConst : public NetExpr { public: explicit NetEConst(ivl_type_t type, const verinum&val); explicit NetEConst(const verinum&val); - ~NetEConst(); + ~NetEConst() override; const verinum&value() const; - virtual void cast_signed(bool flag); - virtual bool has_width() const; - virtual ivl_variable_type_t expr_type() const; + virtual void cast_signed(bool flag) override; + virtual bool has_width() const override; + virtual ivl_variable_type_t expr_type() const override; /* This method allows the constant value to be converted to an unsized value. This is used after evaluating a unsized constant expression. */ void trim(); - virtual void expr_scan(struct expr_scan_t*) const; - virtual void dump(std::ostream&) const; + virtual void expr_scan(struct expr_scan_t*) const override; + virtual void dump(std::ostream&) const override; - virtual NetEConst* dup_expr() const; - virtual NetNet*synthesize(Design*, NetScope*scope, NetExpr*); + virtual NetEConst* dup_expr() const override; + virtual NetNet*synthesize(Design*, NetScope*scope, NetExpr*) override; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; + bool nested_func = false) const override; virtual NetExpr*evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: verinum value_; @@ -2196,14 +2196,14 @@ class NetEConstEnum : public NetEConst { public: explicit NetEConstEnum(perm_string name, const netenum_t*enum_set, const verinum&val); - ~NetEConstEnum(); + ~NetEConstEnum() override; perm_string name() const; - virtual void expr_scan(struct expr_scan_t*) const; - virtual void dump(std::ostream&) const; + virtual void expr_scan(struct expr_scan_t*) const override; + virtual void dump(std::ostream&) const override; - virtual NetEConstEnum* dup_expr() const; + virtual NetEConstEnum* dup_expr() const override; private: perm_string name_; @@ -2214,15 +2214,15 @@ class NetEConstParam : public NetEConst { public: explicit NetEConstParam(const NetScope*scope, perm_string name, const verinum&val); - ~NetEConstParam(); + ~NetEConstParam() override; perm_string name() const; const NetScope*scope() const; - virtual void expr_scan(struct expr_scan_t*) const; - virtual void dump(std::ostream&) const; + virtual void expr_scan(struct expr_scan_t*) const override; + virtual void dump(std::ostream&) const override; - virtual NetEConstParam* dup_expr() const; + virtual NetEConstParam* dup_expr() const override; private: const NetScope*scope_; @@ -2236,23 +2236,23 @@ class NetECReal : public NetExpr { public: explicit NetECReal(const verireal&val); - ~NetECReal(); + ~NetECReal() override; const verireal&value() const; // The type of this expression is ET_REAL - ivl_variable_type_t expr_type() const; + ivl_variable_type_t expr_type() const override; - virtual void expr_scan(struct expr_scan_t*) const; - virtual void dump(std::ostream&) const; + virtual void expr_scan(struct expr_scan_t*) const override; + virtual void dump(std::ostream&) const override; - virtual NetECReal* dup_expr() const; - virtual NetNet*synthesize(Design*, NetScope*scope, NetExpr*); + virtual NetECReal* dup_expr() const override; + virtual NetNet*synthesize(Design*, NetScope*scope, NetExpr*) override; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; + bool nested_func = false) const override; virtual NetExpr*evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: verireal value_; @@ -2261,10 +2261,10 @@ class NetECReal : public NetExpr { class NetECString : public NetEConst { public: explicit NetECString(const std::string& val); - ~NetECString(); + ~NetECString() override; // The type of a string is IVL_VT_STRING - ivl_variable_type_t expr_type() const; + ivl_variable_type_t expr_type() const override; }; class NetECRealParam : public NetECReal { @@ -2272,15 +2272,15 @@ class NetECRealParam : public NetECReal { public: explicit NetECRealParam(const NetScope*scope, perm_string name, const verireal&val); - ~NetECRealParam(); + ~NetECRealParam() override; perm_string name() const; const NetScope*scope() const; - virtual void expr_scan(struct expr_scan_t*) const; - virtual void dump(std::ostream&) const; + virtual void expr_scan(struct expr_scan_t*) const override; + virtual void dump(std::ostream&) const override; - virtual NetECRealParam* dup_expr() const; + virtual NetECRealParam* dup_expr() const override; private: const NetScope*scope_; @@ -2325,7 +2325,7 @@ class NetPartSelect : public NetNode { bool signed_flag__ = false); explicit NetPartSelect(NetNet*sig, NetNet*sel, unsigned wid, bool signed_flag__ = false); - ~NetPartSelect(); + ~NetPartSelect() override; unsigned base() const; unsigned width() const; @@ -2333,9 +2333,9 @@ class NetPartSelect : public NetNode { /* Is the select signal signed? */ inline bool signed_flag() const { return signed_flag_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - bool emit_node(struct target_t*tgt) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + bool emit_node(struct target_t*tgt) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned off_; @@ -2365,14 +2365,14 @@ class NetSubstitute : public NetNode { public: NetSubstitute(NetNet*sig, NetNet*sub, unsigned wid, unsigned off); - ~NetSubstitute(); + ~NetSubstitute() override; inline unsigned width() const { return wid_; } inline unsigned base() const { return off_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*tgt) const; - virtual void functor_node(Design*des, functor_t*fun); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*tgt) const override; + virtual void functor_node(Design*des, functor_t*fun) override; private: unsigned wid_; @@ -2394,14 +2394,14 @@ class NetBUFZ : public NetNode { public: explicit NetBUFZ(NetScope*s, perm_string n, unsigned wid, bool transp, int port_info_index = -1); - ~NetBUFZ(); + ~NetBUFZ() override; unsigned width() const; bool transparent() const { return transparent_; } int port_info_index() const { return port_info_index_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: unsigned width_; @@ -2440,14 +2440,14 @@ class NetCaseCmp : public NetNode { public: explicit NetCaseCmp(NetScope*s, perm_string n, unsigned wid, kind_t eeq); - ~NetCaseCmp(); + ~NetCaseCmp() override; unsigned width() const; // What kind of case compare? inline kind_t kind() const { return kind_; } - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; private: unsigned width_; @@ -2472,16 +2472,16 @@ class NetConst : public NetNode { public: explicit NetConst(NetScope*s, perm_string n, verinum::V v); explicit NetConst(NetScope*s, perm_string n, const verinum&val); - ~NetConst(); + ~NetConst() override; inline const verinum&value(void) const { return value_; } verinum::V value(unsigned idx) const; inline unsigned width() const { return value_.len(); } inline bool is_string() const { return value_.is_string(); } - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*, functor_t*); - virtual void dump_node(std::ostream&, unsigned ind) const; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*, functor_t*) override; + virtual void dump_node(std::ostream&, unsigned ind) const override; private: verinum value_; @@ -2500,15 +2500,15 @@ class NetLiteral : public NetNode { public: // A read-valued literal. explicit NetLiteral(NetScope*s, perm_string n, const verireal&val); - ~NetLiteral(); + ~NetLiteral() override; ivl_variable_type_t data_type() const; const verireal& value_real() const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*, functor_t*); - virtual void dump_node(std::ostream&, unsigned ind) const; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*, functor_t*) override; + virtual void dump_node(std::ostream&, unsigned ind) const override; private: verireal real_; @@ -2547,9 +2547,9 @@ class NetLogic : public NetNode { unsigned width() const; bool is_cassign() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*, functor_t*); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*, functor_t*) override; private: TYPE type_; @@ -2568,13 +2568,13 @@ class NetSignExtend : public NetNode { public: explicit NetSignExtend(NetScope*s, perm_string n, unsigned wid); - ~NetSignExtend(); + ~NetSignExtend() override; unsigned width() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*, functor_t*); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*, functor_t*) override; private: unsigned width_; @@ -2597,9 +2597,9 @@ class NetUReduce : public NetNode { TYPE type() const; unsigned width() const; - virtual void dump_node(std::ostream&, unsigned ind) const; - virtual bool emit_node(struct target_t*) const; - virtual void functor_node(Design*, functor_t*); + virtual void dump_node(std::ostream&, unsigned ind) const override; + virtual bool emit_node(struct target_t*) const override; + virtual void functor_node(Design*, functor_t*) override; private: TYPE type_; @@ -2660,8 +2660,8 @@ class NetUDP : public NetNode { public: explicit NetUDP(NetScope*s, perm_string n, unsigned pins, PUdp*u); - virtual bool emit_node(struct target_t*) const; - virtual void dump_node(std::ostream&, unsigned ind) const; + virtual bool emit_node(struct target_t*) const override; + virtual void dump_node(std::ostream&, unsigned ind) const override; /* Use these methods to scan the truth table of the device. "first" returns the first item in the table, and @@ -2699,7 +2699,7 @@ class NetProc : public virtual LineInfo { public: explicit NetProc(); - virtual ~NetProc(); + virtual ~NetProc() override; // Find the nexa that are input by the statement. This is used // for example by @* to find the inputs to the process for the @@ -2807,17 +2807,17 @@ class NetAlloc : public NetProc { public: explicit NetAlloc(NetScope*); - ~NetAlloc(); + ~NetAlloc() override; const std::string name() const; const NetScope* scope() const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; private: NetScope*scope_; @@ -2959,7 +2959,7 @@ class NetAssignBase : public NetProc { public: NetAssignBase(NetAssign_*lv, NetExpr*rv); - virtual ~NetAssignBase() =0; + virtual ~NetAssignBase() override =0; // This is the (procedural) value that is to be assigned when // the assignment is executed. @@ -2976,8 +2976,8 @@ class NetAssignBase : public NetProc { const NetExpr* get_delay() const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&o); + bool nested_func = false) const override; + virtual void nex_output(NexusSet&o) override; // This returns the total width of the accumulated l-value. It @@ -2986,12 +2986,12 @@ class NetAssignBase : public NetProc { bool synth_async(Design*des, NetScope*scope, NexusSet&nex_map, NetBus&nex_out, - NetBus&enables, std::vector&bitmasks); + NetBus&enables, std::vector&bitmasks) override; // This dumps all the lval structures. void dump_lval(std::ostream&) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: NetAssign_*lval_; @@ -3004,18 +3004,18 @@ class NetAssign : public NetAssignBase { public: explicit NetAssign(NetAssign_*lv, NetExpr*rv); explicit NetAssign(NetAssign_*lv, char op, NetExpr*rv); - ~NetAssign(); + ~NetAssign() override; - bool is_asynchronous(); + bool is_asynchronous() override; inline char assign_operator(void) const { return op_; } - virtual bool emit_proc(struct target_t*) const; - virtual int match_proc(struct proc_match_t*); - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual bool emit_proc(struct target_t*) const override; + virtual int match_proc(struct proc_match_t*) override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: void eval_func_lval_op_real_(const LineInfo&loc, verireal&lv, const verireal&rv) const; @@ -3030,13 +3030,13 @@ class NetAssignNB : public NetAssignBase { public: explicit NetAssignNB(NetAssign_*lv, NetExpr*rv, NetEvWait*ev, NetExpr*cnt); - ~NetAssignNB(); + ~NetAssignNB() override; - virtual bool emit_proc(struct target_t*) const; - virtual int match_proc(struct proc_match_t*); - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual bool emit_proc(struct target_t*) const override; + virtual int match_proc(struct proc_match_t*) override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; unsigned nevents() const; const NetEvent*event(unsigned) const; @@ -3061,7 +3061,7 @@ class NetBlock : public NetProc { enum Type { SEQU, PARA, PARA_JOIN_ANY, PARA_JOIN_NONE }; NetBlock(Type t, NetScope*subscope); - ~NetBlock(); + ~NetBlock() override; Type type() const { return type_; } NetScope* subscope() const { return subscope_; } @@ -3073,12 +3073,12 @@ class NetBlock : public NetProc { const NetProc*proc_next(const NetProc*cur) const; bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; // synthesize as asynchronous logic, and return true. bool synth_async(Design*des, NetScope*scope, - NexusSet&nex_map, NetBus&nex_out, - NetBus&enables, std::vector&bitmasks); + NexusSet&nex_map, NetBus&nex_out, + NetBus&enables, std::vector&bitmasks) override; bool synth_sync(Design*des, NetScope*scope, bool&ff_negedge, @@ -3087,7 +3087,7 @@ class NetBlock : public NetProc { std::vector&ff_aset_value, NexusSet&nex_map, NetBus&nex_out, std::vector&bitmasks, - const std::vector&events); + const std::vector&events) override; // This version of emit_recurse scans all the statements of // the begin-end block sequentially. It is typically of use @@ -3095,13 +3095,13 @@ class NetBlock : public NetProc { void emit_recurse(struct target_t*) const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual int match_proc(struct proc_match_t*); - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual int match_proc(struct proc_match_t*) override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: const Type type_; @@ -3112,8 +3112,8 @@ class NetBlock : public NetProc { class NetBreak : public NetProc { public: - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool emit_proc(struct target_t*) const; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool emit_proc(struct target_t*) const override; bool evaluate_function(const LineInfo &loc, std::map &ctx) const final; }; @@ -3138,7 +3138,7 @@ class NetCase : public NetProc { enum TYPE { EQ, EQX, EQZ }; NetCase(ivl_case_quality_t q, TYPE c, NetExpr*ex, unsigned cnt); - ~NetCase(); + ~NetCase() override; void set_case(unsigned idx, NetExpr*ex, NetProc*st); @@ -3153,19 +3153,19 @@ class NetCase : public NetProc { inline const NetProc*stat(unsigned idx) const { return items_[idx].statement; } virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&out); + bool nested_func = false) const override; + virtual void nex_output(NexusSet&out) override; bool synth_async(Design*des, NetScope*scope, - NexusSet&nex_map, NetBus&nex_out, - NetBus&enables, std::vector&bitmasks); + NexusSet&nex_map, NetBus&nex_out, + NetBus&enables, std::vector&bitmasks) override; - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: bool evaluate_function_vect_(const LineInfo&loc, @@ -3199,11 +3199,11 @@ class NetCAssign : public NetAssignBase { public: explicit NetCAssign(NetAssign_*lv, NetExpr*rv); - ~NetCAssign(); + ~NetCAssign() override; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool emit_proc(struct target_t*) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool emit_proc(struct target_t*) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: // not implemented NetCAssign(const NetCAssign&); @@ -3220,7 +3220,7 @@ class NetCondit : public NetProc { public: explicit NetCondit(NetExpr*ex, NetProc*i, NetProc*e); - ~NetCondit(); + ~NetCondit() override; const NetExpr*expr() const; NetExpr*expr(); @@ -3235,30 +3235,30 @@ class NetCondit : public NetProc { bool emit_recurse_else(struct target_t*) const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&o); + bool nested_func = false) const override; + virtual void nex_output(NexusSet&o) override; - bool is_asynchronous(); + bool is_asynchronous() override; bool synth_async(Design*des, NetScope*scope, - NexusSet&nex_map, NetBus&nex_out, - NetBus&enables, std::vector&bitmasks); + NexusSet&nex_map, NetBus&nex_out, + NetBus&enables, std::vector&bitmasks) override; bool synth_sync(Design*des, NetScope*scope, - bool&ff_negedge, - NetNet*ff_clk, NetBus&ff_ce, - NetBus&ff_aclr,NetBus&ff_aset, - std::vector&ff_aset_value, - NexusSet&nex_map, NetBus&nex_out, - std::vector&bitmasks, - const std::vector&events); + bool&ff_negedge, + NetNet*ff_clk, NetBus&ff_ce, + NetBus&ff_aclr,NetBus&ff_aset, + std::vector&ff_aset_value, + NexusSet&nex_map, NetBus&nex_out, + std::vector&bitmasks, + const std::vector&events) override; - virtual bool emit_proc(struct target_t*) const; - virtual int match_proc(struct proc_match_t*); - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual bool emit_proc(struct target_t*) const override; + virtual int match_proc(struct proc_match_t*) override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: NetExpr* expr_; @@ -3268,8 +3268,8 @@ class NetCondit : public NetProc { class NetContinue : public NetProc { public: - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool emit_proc(struct target_t*) const; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool emit_proc(struct target_t*) const override; bool evaluate_function(const LineInfo &loc, std::map &ctx) const final; }; @@ -3283,13 +3283,13 @@ class NetContribution : public NetProc { public: explicit NetContribution(NetEAccess*lval, NetExpr*rval); - ~NetContribution(); + ~NetContribution() override; const NetEAccess* lval() const; const NetExpr* rval() const; - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; private: NetEAccess*lval_; @@ -3306,11 +3306,11 @@ class NetDeassign : public NetAssignBase { public: explicit NetDeassign(NetAssign_*l); - ~NetDeassign(); + ~NetDeassign() override; - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: // not implemented NetDeassign(const NetDeassign&); @@ -3330,19 +3330,19 @@ class NetDisable : public NetProc { public: explicit NetDisable(NetScope*tgt, bool flow_control = false); - ~NetDisable(); + ~NetDisable() override; const NetScope*target() const; bool flow_control() const { return flow_control_; } virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: NetScope*target_; @@ -3373,14 +3373,14 @@ class NetDoWhile : public NetProc { void emit_proc_recurse(struct target_t*) const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: NetExpr* cond_; @@ -3437,7 +3437,7 @@ class NetEvent : public LineInfo { // include the scope. Also, the name passed here should be // perm-allocated. explicit NetEvent (perm_string n); - ~NetEvent(); + ~NetEvent() override; perm_string name() const; @@ -3516,16 +3516,16 @@ class NetEvTrig : public NetProc { public: explicit NetEvTrig(NetEvent*tgt); - ~NetEvTrig(); + ~NetEvTrig() override; const NetEvent*event() const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: NetEvent*event_; @@ -3539,17 +3539,17 @@ class NetEvNBTrig : public NetProc { public: explicit NetEvNBTrig(NetEvent*tgt, NetExpr*dly); - ~NetEvNBTrig(); + ~NetEvNBTrig() override; const NetExpr*delay() const; const NetEvent*event() const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: NetEvent*event_; @@ -3562,7 +3562,7 @@ class NetEvWait : public NetProc { public: explicit NetEvWait(NetProc*st); - ~NetEvWait(); + ~NetEvWait() override; void add_event(NetEvent*tgt); void replace_event(NetEvent*orig, NetEvent*repl); @@ -3576,25 +3576,25 @@ class NetEvWait : public NetProc { NetProc*statement(); const NetProc*statement() const; - virtual bool emit_proc(struct target_t*) const; + virtual bool emit_proc(struct target_t*) const override; bool emit_recurse(struct target_t*) const; - virtual int match_proc(struct proc_match_t*); + virtual int match_proc(struct proc_match_t*) override; // It is possible that this is the root of a combinational // process. This method checks. - virtual bool is_asynchronous(); + virtual bool is_asynchronous() override; // It is possible that this is the root of a synchronous // process? This method checks. - virtual bool is_synchronous(); + virtual bool is_synchronous() override; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&out); + bool nested_func = false) const override; + virtual void nex_output(NexusSet&out) override; virtual bool synth_async(Design*des, NetScope*scope, NexusSet&nex_map, NetBus&nex_out, - NetBus&enables, std::vector&bitmasks); + NetBus&enables, std::vector&bitmasks) override; virtual bool synth_sync(Design*des, NetScope*scope, bool&ff_negedge, @@ -3603,13 +3603,13 @@ class NetEvWait : public NetProc { std::vector&ff_aset_value, NexusSet&nex_map, NetBus&nex_out, std::vector&bitmasks, - const std::vector&events); + const std::vector&events) override; - virtual void dump(std::ostream&, unsigned ind) const; + virtual void dump(std::ostream&, unsigned ind) const override; // This will ignore any statement. virtual void dump_inline(std::ostream&) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: NetProc*statement_; @@ -3628,8 +3628,8 @@ class NetEvProbe : public NetNode { enum edge_t { ANYEDGE, POSEDGE, NEGEDGE, EDGE }; explicit NetEvProbe(NetScope*s, perm_string n, - NetEvent*tgt, edge_t t, unsigned p); - ~NetEvProbe(); + NetEvent*tgt, edge_t t, unsigned p); + ~NetEvProbe() override; edge_t edge() const; NetEvent* event(); @@ -3637,8 +3637,8 @@ class NetEvProbe : public NetNode { void find_similar_probes(std::list&); - virtual bool emit_node(struct target_t*) const; - virtual void dump_node(std::ostream&, unsigned ind) const; + virtual bool emit_node(struct target_t*) const override; + virtual void dump_node(std::ostream&, unsigned ind) const override; private: NetEvent*event_; @@ -3656,11 +3656,11 @@ class NetForce : public NetAssignBase { public: explicit NetForce(NetAssign_*l, NetExpr*r); - ~NetForce(); + ~NetForce() override; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool emit_proc(struct target_t*) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool emit_proc(struct target_t*) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; }; /* @@ -3671,19 +3671,19 @@ class NetForever : public NetProc { public: explicit NetForever(NetProc*s); - ~NetForever(); + ~NetForever() override; void emit_recurse(struct target_t*) const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: NetProc*statement_; @@ -3694,19 +3694,19 @@ class NetForLoop : public NetProc { public: explicit NetForLoop(NetNet*index, NetExpr*initial_expr, NetExpr*cond, NetProc*sub, NetProc*step); - ~NetForLoop(); + ~NetForLoop() override; void emit_recurse(struct target_t*) const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; bool emit_recurse_init(struct target_t*) const; bool emit_recurse_stmt(struct target_t*) const; @@ -3716,7 +3716,7 @@ class NetForLoop : public NetProc { // synthesize as asynchronous logic, and return true. bool synth_async(Design*des, NetScope*scope, NexusSet&nex_map, NetBus&nex_out, - NetBus&enables, std::vector&bitmasks); + NetBus&enables, std::vector&bitmasks) override; private: NetNet*index_; @@ -3731,17 +3731,17 @@ class NetFree : public NetProc { public: explicit NetFree(NetScope*); - ~NetFree(); + ~NetFree() override; const std::string name() const; const NetScope* scope() const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; private: NetScope*scope_; @@ -3763,7 +3763,7 @@ class NetFuncDef : public NetBaseDef { public: NetFuncDef(NetScope*, NetNet*result, const std::vector&po, const std::vector&pd); - ~NetFuncDef(); + ~NetFuncDef() override; // Return true if the function returns "void". We still treat // it as a function since we need to check that the contents @@ -3805,19 +3805,19 @@ class NetPDelay : public NetProc { public: NetPDelay(uint64_t d, NetProc*st); NetPDelay(NetExpr* d, NetProc*st); - ~NetPDelay(); + ~NetPDelay() override; uint64_t delay() const; const NetExpr*expr() const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; bool emit_proc_recurse(struct target_t*) const; @@ -3834,20 +3834,20 @@ class NetRepeat : public NetProc { public: explicit NetRepeat(NetExpr*e, NetProc*s); - ~NetRepeat(); + ~NetRepeat() override; const NetExpr*expr() const; void emit_recurse(struct target_t*) const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual DelayType delay_type(bool print_delay=false) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual DelayType delay_type(bool print_delay=false) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: NetExpr*expr_; @@ -3864,11 +3864,11 @@ class NetRelease : public NetAssignBase { public: explicit NetRelease(NetAssign_*l); - ~NetRelease(); + ~NetRelease() override; - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; private: }; @@ -3885,7 +3885,7 @@ class NetSTask : public NetProc { public: NetSTask(const char*na, ivl_sfunc_as_task_t sfat, const std::vector&); - ~NetSTask(); + ~NetSTask() override; const char* name() const; ivl_sfunc_as_task_t sfunc_as_task() const; @@ -3895,13 +3895,13 @@ class NetSTask : public NetProc { const NetExpr* parm(unsigned idx) const; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual void nex_output(NexusSet&); - virtual bool emit_proc(struct target_t*) const; - virtual void dump(std::ostream&, unsigned ind) const; - virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const; + bool nested_func = false) const override; + virtual void nex_output(NexusSet&) override; + virtual bool emit_proc(struct target_t*) const override; + virtual void dump(std::ostream&, unsigned ind) const override; + virtual bool check_synth(ivl_process_type_t pr_type, const NetScope*scope) const override; virtual bool evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; private: const char* name_; @@ -3926,7 +3926,7 @@ class NetTaskDef : public NetBaseDef { public: NetTaskDef(NetScope*n, const std::vector&po, const std::vector&pd); - ~NetTaskDef(); + ~NetTaskDef() override; void dump(std::ostream&, unsigned) const; DelayType delay_type(bool print_delay=false) const; @@ -3946,17 +3946,17 @@ class NetELast : public NetExpr { public: explicit NetELast(NetNet*sig); - ~NetELast(); + ~NetELast() override; inline const NetNet*sig() const { return sig_; } - virtual ivl_variable_type_t expr_type() const; - virtual void dump(std::ostream&) const; + virtual ivl_variable_type_t expr_type() const override; + virtual void dump(std::ostream&) const override; - virtual void expr_scan(struct expr_scan_t*) const; - virtual NetELast*dup_expr() const; + virtual void expr_scan(struct expr_scan_t*) const override; + virtual NetELast*dup_expr() const override; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; + bool nested_func = false) const override; private: NetNet*sig_; @@ -3971,7 +3971,7 @@ class NetEUFunc : public NetExpr { public: NetEUFunc(NetScope*, NetScope*, NetESignal*, std::vector&, bool); - ~NetEUFunc(); + ~NetEUFunc() override; const NetESignal*result_sig() const; @@ -3980,17 +3980,17 @@ class NetEUFunc : public NetExpr { const NetScope* func() const; - virtual void dump(std::ostream&) const; + virtual void dump(std::ostream&) const override; - virtual void expr_scan(struct expr_scan_t*) const; - virtual NetEUFunc*dup_expr() const; + virtual void expr_scan(struct expr_scan_t*) const override; + virtual NetEUFunc*dup_expr() const override; virtual NexusSet* nex_input(bool rem_out = true, bool always_sens = false, - bool nested_func = false) const; - virtual NetExpr* eval_tree(); + bool nested_func = false) const override; + virtual NetExpr* eval_tree() override; virtual NetExpr*evaluate_function(const LineInfo&loc, - std::map&ctx) const; + std::map&ctx) const override; - virtual NetNet* synthesize(Design*des, NetScope*scope, NetExpr*root); + virtual NetNet* synthesize(Design*des, NetScope*scope, NetExpr*root) override; private: NetScope*scope_; @@ -4356,7 +4356,7 @@ class NetEBLogic : public NetEBinary { public: NetEBLogic(char op, NetExpr*l, NetExpr*r); - ~NetEBLogic(); + ~NetEBLogic() override; virtual NetEBLogic* dup_expr() const override; virtual NetNet* synthesize(Design*, NetScope*scope, NetExpr*root) override; @@ -4537,7 +4537,7 @@ class NetESelect : public NetExpr { virtual NetEConst* eval_tree() override; virtual NetExpr*evaluate_function(const LineInfo&loc, std::map&ctx) const override; - virtual NetESelect* dup_expr() const; + virtual NetESelect* dup_expr() const override; virtual NetNet*synthesize(Design*des, NetScope*scope, NetExpr*root) override; virtual void dump(std::ostream&) const override; diff --git a/netmisc.cc b/netmisc.cc index 0280a9ff5..5da5b143e 100644 --- a/netmisc.cc +++ b/netmisc.cc @@ -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 * and/or modify it in source code form under the terms of the GNU @@ -34,8 +34,8 @@ using namespace std; NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig) { - netvector_t*zero_vec = new netvector_t(sig->data_type(), - sig->vector_width()-1, 0); + const netvector_t*zero_vec = new netvector_t(sig->data_type(), + sig->vector_width()-1, 0); NetNet*zero_net = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, zero_vec); zero_net->set_line(*sig); @@ -68,8 +68,8 @@ NetNet* sub_net_from(Design*des, NetScope*scope, long val, NetNet*sig) connect(zero_net->pin(0), adder->pin_DataA()); connect(adder->pin_DataB(), sig->pin(0)); - netvector_t*tmp_vec = new netvector_t(sig->data_type(), - sig->vector_width()-1, 0); + const netvector_t*tmp_vec = new netvector_t(sig->data_type(), + sig->vector_width()-1, 0); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); tmp->set_line(*sig); @@ -85,8 +85,8 @@ NetNet* cast_to_int2(Design*des, NetScope*scope, NetNet*src, unsigned wid) if (src->data_type() == IVL_VT_BOOL) return src; - netvector_t*tmp_vec = new netvector_t(IVL_VT_BOOL, wid-1, 0, - src->get_signed()); + const netvector_t*tmp_vec = new netvector_t(IVL_VT_BOOL, wid-1, 0, + src->get_signed()); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); tmp->set_line(*src); tmp->local_flag(true); @@ -106,7 +106,7 @@ NetNet* cast_to_int4(Design*des, NetScope*scope, NetNet*src, unsigned wid) if (src->data_type() != IVL_VT_REAL) 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); tmp->set_line(*src); 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) 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); tmp->set_line(*src); tmp->local_flag(true); @@ -514,7 +514,7 @@ void indices_to_expressions(Design*des, NetScope*scope, // Track if we detect any non-constant expressions // here. This may allow for a special case. - NetEConst*word_const = dynamic_cast (word_index); + const NetEConst*word_const = dynamic_cast (word_index); if (word_const == 0) flags.variable = true; 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. NetExpr*tmp_scaled = 0; - if (NetEConst*tmp_const = dynamic_cast (tmp)) { + if (const NetEConst*tmp_const = dynamic_cast (tmp)) { // Special case: the index is constant, so this // iteration can be replaced with a constant // 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); 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); sig->local_flag(true); @@ -774,7 +774,7 @@ NetNet* make_const_z(Design*des, NetScope*scope, unsigned long wid) NetExpr* condition_reduce(NetExpr*expr) { if (expr->expr_type() == IVL_VT_REAL) { - if (NetECReal *tmp = dynamic_cast(expr)) { + if (const NetECReal *tmp = dynamic_cast(expr)) { verinum::V res; if (tmp->value().as_double() == 0.0) res = verinum::V0; 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) { - if (NetEConst*tmp = dynamic_cast(expr) ) { + if (const NetEConst*tmp = dynamic_cast(expr) ) { value = tmp->value().as_double(); return true; } - if (NetECReal*rtmp = dynamic_cast(expr)) { + if (const NetECReal*rtmp = dynamic_cast(expr)) { value = rtmp->value().as_double(); return true; } @@ -1431,7 +1431,7 @@ void collapse_partselect_pv_to_concat(Design*des, NetNet*sig) unsigned idx = 0; unsigned device_count = 0; while (idx < ps_map.size()) { - NetPartSelect*ps_obj = ps_map[idx]; + const NetPartSelect*ps_obj = ps_map[idx]; if (ps_obj == 0) return; diff --git a/netparray.h b/netparray.h index d2f1d8c1e..4b06acebe 100644 --- a/netparray.h +++ b/netparray.h @@ -1,7 +1,7 @@ #ifndef 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) * * This source code is free software; you can redistribute it @@ -31,7 +31,7 @@ class netsarray_t : public netarray_t { public: explicit netsarray_t(const netranges_t&packed, ivl_type_t etype); - ~netsarray_t(); + ~netsarray_t() override; public: // Virtual methods from the ivl_type_s type... @@ -57,17 +57,17 @@ class netparray_t : public netsarray_t { public: explicit netparray_t(const netranges_t&packed, ivl_type_t etype); - ~netparray_t(); + ~netparray_t() override; public: // Virtual methods from the ivl_type_s type... - bool packed(void) const; - long packed_width(void) const; - netranges_t slice_dimensions() const; + bool packed(void) const override; + long packed_width(void) const override; + netranges_t slice_dimensions() const override; private: - bool test_compatibility(ivl_type_t that) const; - bool test_equivalence(ivl_type_t that) const; + bool test_compatibility(ivl_type_t that) const override; + bool test_equivalence(ivl_type_t that) const override; }; inline netparray_t::netparray_t(const netranges_t&pd, ivl_type_t etype) @@ -82,14 +82,14 @@ class netuarray_t : public netsarray_t { public: explicit netuarray_t(const netranges_t&packed, ivl_type_t etype); - ~netuarray_t(); + ~netuarray_t() override; public: // Virtual methods from the ivl_type_s type... - netranges_t slice_dimensions() const; + netranges_t slice_dimensions() const override; 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) diff --git a/netqueue.h b/netqueue.h index 826893390..480e71547 100644 --- a/netqueue.h +++ b/netqueue.h @@ -1,7 +1,7 @@ #ifndef 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 * 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: explicit netqueue_t(ivl_type_t vec, long max_idx); - ~netqueue_t(); + ~netqueue_t() override; // This is the "base_type()" virtual method of the // nettype_base_t. The ivl_target api expects this to return // 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_; } - std::ostream& debug_dump(std::ostream&) const; + std::ostream& debug_dump(std::ostream&) const override; private: long max_idx_; diff --git a/netscalar.h b/netscalar.h index 41506a7ba..52c9d466c 100644 --- a/netscalar.h +++ b/netscalar.h @@ -1,7 +1,7 @@ #ifndef 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 * 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: inline explicit netreal_t() { } - ~netreal_t(); + ~netreal_t() override; - ivl_variable_type_t base_type() const; - bool get_signed() const { return true; } - bool get_scalar() const { return true; } + ivl_variable_type_t base_type() const override; + bool get_signed() const override { 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: static netreal_t type_real; @@ -42,11 +42,11 @@ class netstring_t : public ivl_type_s { public: 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: static netstring_t type_string; diff --git a/netstruct.h b/netstruct.h index 99be27456..47fe09e30 100644 --- a/netstruct.h +++ b/netstruct.h @@ -1,7 +1,7 @@ #ifndef 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 * 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: netstruct_t(); - ~netstruct_t(); + ~netstruct_t() override; // If this is a union (instead of struct) then this flag is // 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; 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 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 // 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 // the record is not packed. - long packed_width() const; - netranges_t slice_dimensions() const; + long packed_width() const override; + netranges_t slice_dimensions() const override; // Return the base type of the packed record, or // 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: - bool test_compatibility(ivl_type_t that) const; - bool test_equivalence(ivl_type_t that) const; + bool test_compatibility(ivl_type_t that) const override; + bool test_equivalence(ivl_type_t that) const override; private: bool union_; diff --git a/nettypes.h b/nettypes.h index 5726d8751..5cd523eba 100644 --- a/nettypes.h +++ b/nettypes.h @@ -1,7 +1,7 @@ #ifndef 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 * 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: inline explicit netarray_t(ivl_type_t etype) : element_type_(etype) { } - ~netarray_t(); + ~netarray_t() override; public: // Some virtual methods have a common implementation for arrays. // 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: inline ivl_type_t element_type() const { return element_type_; } diff --git a/netvector.h b/netvector.h index 11de49657..f2dfeff9d 100644 --- a/netvector.h +++ b/netvector.h @@ -1,7 +1,7 @@ #ifndef 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 * 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. explicit netvector_t(ivl_variable_type_t type); - ~netvector_t(); + ~netvector_t() override; // Vectors can be interpreted as signed or unsigned when // handled as vectors. 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 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; } 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; - bool packed(void) const; - long packed_width() const; - netranges_t slice_dimensions() const; + bool packed(void) const override; + long packed_width() const override; + netranges_t slice_dimensions() const override; - std::ostream& debug_dump(std::ostream&) const; + std::ostream& debug_dump(std::ostream&) const override; public: // 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); private: - bool test_compatibility(ivl_type_t that) const; - bool test_equivalence(ivl_type_t that) const; + bool test_compatibility(ivl_type_t that) const override; + bool test_equivalence(ivl_type_t that) const override; private: netranges_t packed_dims_; diff --git a/nodangle.cc b/nodangle.cc index 0a79846ac..69b00db7b 100644 --- a/nodangle.cc +++ b/nodangle.cc @@ -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 * 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 { public: - void event(Design*des, NetEvent*ev); - void signal(Design*des, NetNet*sig); + void event(Design*des, NetEvent*ev) override; + void signal(Design*des, NetNet*sig) override; unsigned iteration; unsigned stotal, etotal; @@ -230,7 +230,7 @@ void nodangle_f::signal(Design*, NetNet*sig) if (cur == &sig->pin(idx)) continue; - NetNet*cursig = dynamic_cast(cur->get_obj()); + const NetNet*cursig = dynamic_cast(cur->get_obj()); if (cursig == 0) continue; diff --git a/pad_to_width.cc b/pad_to_width.cc index 5ec66a862..f3eae3d42 100644 --- a/pad_to_width.cc +++ b/pad_to_width.cc @@ -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 * and/or modify it in source code form under the terms of the GNU @@ -106,8 +106,8 @@ NetNet*pad_to_width(Design*des, NetNet*net, unsigned wid, const LineInfo&info) connect(cc->pin(2), con->pin(0)); // Make a NetNet for the NetConst to NetConcat link. - netvector_t*tmp_vec = new netvector_t(net->data_type(), - wid - net->vector_width() - 1, 0); + const netvector_t*tmp_vec = new netvector_t(net->data_type(), + wid - net->vector_width() - 1, 0); NetNet*tmp = new NetNet(scope, scope->local_symbol(), NetNet::WIRE, tmp_vec); tmp->set_line(info); @@ -162,7 +162,7 @@ NetNet*crop_to_width(Design*des, NetNet*net, unsigned wid) ps->set_line(*net); 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::WIRE, tmp_vec); tmp->set_line(*net); diff --git a/parse.y b/parse.y index a1ec69054..d5f0e92eb 100644 --- a/parse.y +++ b/parse.y @@ -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 // that case. if (net_type == NetNet::IMPLICIT) { - if (vector_type_t*dtype = dynamic_cast (data_type)) { + if (const vector_type_t*dtype = dynamic_cast (data_type)) { if (!dtype->implicit_flag) net_type = NetNet::IMPLICIT_REG; } else if (data_type) { @@ -4998,7 +4998,7 @@ module_item */ | attribute_list_opt K_inout data_type_or_implicit list_of_port_identifiers ';' { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE; - if (vector_type_t*dtype = dynamic_cast ($3)) { + if (const vector_type_t*dtype = dynamic_cast ($3)) { if (dtype->implicit_flag) use_type = NetNet::NONE; } @@ -5010,7 +5010,7 @@ module_item | attribute_list_opt K_input data_type_or_implicit list_of_port_identifiers ';' { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE; - if (vector_type_t*dtype = dynamic_cast ($3)) { + if (const vector_type_t*dtype = dynamic_cast ($3)) { if (dtype->implicit_flag) use_type = NetNet::NONE; } @@ -5022,7 +5022,7 @@ module_item | attribute_list_opt K_output data_type_or_implicit list_of_variable_port_identifiers ';' { NetNet::Type use_type = $3 ? NetNet::IMPLICIT : NetNet::NONE; - if (vector_type_t*dtype = dynamic_cast ($3)) { + if (const vector_type_t*dtype = dynamic_cast ($3)) { if (dtype->implicit_flag) use_type = NetNet::NONE; else diff --git a/pform.cc b/pform.cc index e1d5221be..dfc84e1d1 100644 --- a/pform.cc +++ b/pform.cc @@ -138,7 +138,7 @@ void parm_to_defparam_list(const string¶m) unsigned off = param.find('='); if (off > param.size()) { key = strdup(param.c_str()); - value = (char*)malloc(1); + value = static_cast(malloc(1)); *value = '\0'; } else { @@ -2007,7 +2007,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name, // XXXX ivl_assert(loc, pins[0]->get_wire_type() == NetNet::REG); - PAssign*pa = dynamic_cast(init_expr); + const PAssign*pa = dynamic_cast(init_expr); ivl_assert(*init_expr, pa); const PEIdent*id = dynamic_cast(pa->lval()); @@ -2088,7 +2088,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name, // XXXX ivl_assert(*init_expr, pins[0]->get_wire_type() == NetNet::REG); - PAssign*pa = dynamic_cast(init_expr); + const PAssign*pa = dynamic_cast(init_expr); ivl_assert(*init_expr, pa); const PEIdent*id = dynamic_cast(pa->lval()); @@ -2157,7 +2157,7 @@ static void pform_set_net_range(PWire *wire, if (!vec_type) return; - list *range = vec_type->pdims.get(); + const list *range = vec_type->pdims.get(); if (range) wire->set_range(*range, rt); wire->set_signed(vec_type->signed_flag); @@ -2745,7 +2745,7 @@ vector*pform_make_task_ports(const struct vlltype&loc, // If this is a non-ansi port declaration and the type is an implicit type // this is only a port declaration. - vector_type_t*vec_type = dynamic_cast(vtype); + const vector_type_t*vec_type = dynamic_cast(vtype); if (allow_implicit && (!vtype || (vec_type && vec_type->implicit_flag))) 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); - vector_type_t *vt = dynamic_cast (dt); + const vector_type_t *vt = dynamic_cast (dt); bool have_init_expr = false; for (list::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); } - vector_type_t*vec_type = dynamic_cast (data_type); + const vector_type_t*vec_type = dynamic_cast (data_type); for (std::vector::iterator it= wires->begin(); it != wires->end() ; ++it) { @@ -3428,8 +3428,8 @@ int pform_parse(const char*path) if (strcmp(path, "-") == 0) { vl_input = stdin; } else if (ivlpp_string) { - char*cmdline = (char*)malloc(strlen(ivlpp_string) + - strlen(path) + 4); + char*cmdline = static_cast(malloc(strlen(ivlpp_string) + + strlen(path) + 4)); strcpy(cmdline, ivlpp_string); strcat(cmdline, " \""); strcat(cmdline, path); diff --git a/pform_package.cc b/pform_package.cc index ea602c5cc..7e949f391 100644 --- a/pform_package.cc +++ b/pform_package.cc @@ -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) * * 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()) return nullptr; - for (auto &exp : pkg->exports) { + for (const auto &exp : pkg->exports) { // *::* will match all imports, P::* will match all imports // from a package and P::ID will match a specific identifier // from a package. diff --git a/pform_types.h b/pform_types.h index c35926662..833b1c623 100644 --- a/pform_types.h +++ b/pform_types.h @@ -1,7 +1,7 @@ #ifndef 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 * 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 { public: 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 // pform_dump dumps type type in pform format, and the debug_dump // 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); - virtual SymbolType symbol_type() const; + virtual SymbolType symbol_type() const override; private: // Elaborate the type to an ivl_type_s type. @@ -208,10 +208,10 @@ public: struct typeref_t : public data_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; - NetScope *find_scope(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 override; - std::ostream& debug_dump(std::ostream&out) const; + std::ostream& debug_dump(std::ostream&out) const override; private: PScope *scope; @@ -220,13 +220,13 @@ private: struct type_parameter_t : data_type_t { 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; }; 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) { } // 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 base_type; std::unique_ptr< std::list > names; @@ -254,8 +254,8 @@ struct struct_member_t : public LineInfo { }; struct struct_type_t : public data_type_t { - virtual void pform_dump(std::ostream&out, unsigned indent) const; - ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; + virtual void pform_dump(std::ostream&out, unsigned indent) const override; + ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override; bool packed_flag; bool union_flag; @@ -279,9 +279,9 @@ struct atom_type_t : public data_type_t { enum type_code type_code; 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; @@ -304,9 +304,9 @@ struct vector_type_t : public data_type_t { inline explicit vector_type_t(ivl_variable_type_t bt, bool sf, std::list*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 std::ostream& debug_dump(std::ostream&out) const; - ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; + virtual void pform_dump(std::ostream&out, unsigned indent) const override; + virtual std::ostream& debug_dump(std::ostream&out) const override; + ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override; ivl_variable_type_t base_type; 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*pd) : array_base_t(btype, pd) { } - virtual void pform_dump(std::ostream&out, unsigned indent) const; - ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; + virtual void pform_dump(std::ostream&out, unsigned indent) const override; + 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) { } public: - virtual void pform_dump(std::ostream&out, unsigned indent) const; - ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const; + virtual void pform_dump(std::ostream&out, unsigned indent) const override; + ivl_type_t elaborate_type_raw(Design*des, NetScope*scope) const override; }; struct real_type_t : public data_type_t { public: enum type_t { REAL, SHORTREAL }; 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_; } @@ -366,16 +366,16 @@ struct real_type_t : public data_type_t { struct string_type_t : public data_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 { 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; // 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. std::vector initialize_static; - ivl_type_t elaborate_type_raw(Design*, NetScope*) const; + ivl_type_t elaborate_type_raw(Design*, NetScope*) const override; perm_string name; - virtual SymbolType symbol_type() const; + virtual SymbolType symbol_type() const override; }; ivl_type_t elaborate_array_type(Design *des, NetScope *scope, diff --git a/sync.cc b/sync.cc index 41c210ac2..fb318c4e7 100644 --- a/sync.cc +++ b/sync.cc @@ -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 * and/or modify it in source code form under the terms of the GNU @@ -40,7 +40,7 @@ bool NetEvWait::is_synchronous() return false; for (unsigned pdx = 0 ; pdx < ev->nprobe() ; pdx += 1) { - NetEvProbe*pr = ev->probe(pdx); + const NetEvProbe*pr = ev->probe(pdx); /* No level sensitive clocks. */ if (pr->edge() == NetEvProbe::ANYEDGE) diff --git a/synth.cc b/synth.cc index cd7516d3d..7b3becc6f 100644 --- a/synth.cc +++ b/synth.cc @@ -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 * 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_; NetScope*scope_; - virtual int assign(NetAssign*); - virtual int assign_nb(NetAssignNB*); - virtual int event_wait(NetEvWait*); - virtual int condit(NetCondit*); + virtual int assign(NetAssign*) override; + virtual int assign_nb(NetAssignNB*) override; + virtual int event_wait(NetEvWait*) override; + virtual int condit(NetCondit*) override; }; @@ -114,7 +114,7 @@ class synth_f : public functor_t { public: synth_f() { top_ = NULL; } - void process(Design*, NetProcTop*); + void process(Design*, NetProcTop*) override; private: void proc_always_(Design*); diff --git a/synth2.cc b/synth2.cc index 1f7c9d7f2..ff9010dc6 100644 --- a/synth2.cc +++ b/synth2.cc @@ -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 * 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; 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::WIRE, tmp_vec); sig->local_flag(true); @@ -421,14 +421,14 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope, // Evaluate the index expression to a constant. const NetExpr*base_expr_raw = lval_->get_base(); 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)) { ivl_assert(*this, 0); } ivl_assert(*this, base_off >= 0); 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::WIRE, tmp_type); @@ -451,7 +451,7 @@ bool NetAssignBase::synth_async(Design*des, NetScope*scope, const NetExpr*base_expr_raw = lval_->get_base(); 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)) { cerr << get_fileline() << ": sorry: assignment to variable " "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_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::WIRE, tmp_type); @@ -679,7 +679,7 @@ static NetNet* mux_selector_reduce_width(Design*des, NetScope*scope, // This is the output signal, osig. 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::TRI, osig_vec); osig->local_flag(true); @@ -699,7 +699,7 @@ static NetNet* mux_selector_reduce_width(Design*des, NetScope*scope, des->add_node(ps0); 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::TRI, ps0_vec); ps0_sig->local_flag(true); @@ -717,7 +717,7 @@ static NetNet* mux_selector_reduce_width(Design*des, NetScope*scope, des->add_node(ps1); 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::TRI, ps1_vec); ps1_sig->local_flag(true); @@ -819,7 +819,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope, continue; } - NetEConst*ge = dynamic_cast(items_[item].guard); + const NetEConst*ge = dynamic_cast(items_[item].guard); if (ge == 0) { cerr << items_[item].guard->get_fileline() << ": sorry: " << "variable case item expressions with a variable " @@ -939,7 +939,7 @@ bool NetCase::synth_async(Design*des, NetScope*scope, // the pin. if (out_mux[mdx]->pin_Result().nexus()->pick_any_net() == 0) { 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::WIRE, tmp_vec); 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; switch (type()) { @@ -1185,7 +1185,7 @@ bool NetCase::synth_async_casez_(Design*des, NetScope*scope, // Make a NetNet for the result. 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::WIRE, tmp_vec); 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. 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(); } @@ -1389,7 +1389,7 @@ bool NetCondit::synth_async(Design*des, NetScope*scope, mux->set_line(*this); des->add_node(mux); - netvector_t*tmp_type = 0; + const netvector_t*tmp_type = 0; if (mux_width==1) tmp_type = new netvector_t(mux_data_type); else @@ -1477,7 +1477,7 @@ bool NetForLoop::synth_async(Design*des, NetScope*scope, NetAssign*step_assign = dynamic_cast (step_statement_); char assign_operator = step_assign->assign_operator(); 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. LocalVar index_var; @@ -1814,11 +1814,11 @@ bool NetCondit::synth_sync(Design*des, NetScope*scope, case NetEvProbe::NEGEDGE: { bool is_inverter = false; NetNode*node = rst->pin(0).nexus()->pick_any_node(); - if (NetLogic*gate = dynamic_cast(node)) { + if (const NetLogic*gate = dynamic_cast(node)) { if (gate->type() == NetLogic::NOT) is_inverter = true; } - if (NetUReduce*gate = dynamic_cast(node)) { + if (const NetUReduce*gate = dynamic_cast(node)) { if (gate->type() == NetUReduce::NOR) 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()); 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])) { 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 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 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 { public: - void process(Design*, NetProcTop*); + void process(Design*, NetProcTop*) override; private: }; diff --git a/verinum.cc b/verinum.cc index c150a2161..81d013722 100644 --- a/verinum.cc +++ b/verinum.cc @@ -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 * 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; for (unsigned idx = nbits_ ; idx > 0 ; idx -= 8) { char char_val = 0; - V*bp = bits_+idx; + const V*bp = bits_+idx; if (*(--bp) == V1) char_val |= 0x80; if (*(--bp) == V1) char_val |= 0x40; diff --git a/vpi_modules.cc b/vpi_modules.cc index 12ec42c5c..dc3129302 100644 --- a/vpi_modules.cc +++ b/vpi_modules.cc @@ -253,7 +253,7 @@ bool load_vpi_module(const char*path) ivl_dlclose(dll); return true; } - vpip_set_callback_t set_callback = (vpip_set_callback_t)function; + vpip_set_callback_t set_callback = static_cast(function); if (!set_callback(&vpi_routines, vpip_routines_version)) { cerr << "error: Failed to link '" << path << "'. " "Try rebuilding it with iverilog-vpi." << endl; diff --git a/vvp/delay.cc b/vvp/delay.cc index 1b9881094..c05d60d89 100644 --- a/vvp/delay.cc +++ b/vvp/delay.cc @@ -1082,7 +1082,7 @@ struct __vpiModPath* vpip_make_modpath(vvp_net_t *net) #ifdef CHECK_WITH_VALGRIND mp_count += 1; mp_list = static_cast - (realloc(static_cast(mp_list), + (realloc(mp_list, mp_count*sizeof(struct __vpiModPath **))); mp_list[mp_count-1] = obj; #endif @@ -1451,7 +1451,7 @@ struct __vpiInterModPath* vpip_make_intermodpath(vvp_net_t *net, vpiPortInfo* po #ifdef CHECK_WITH_VALGRIND imp_count += 1; imp_list = static_cast - (realloc(static_cast(imp_list), + (realloc(imp_list, imp_count*sizeof(struct __vpiInterModPath **))); imp_list[imp_count-1] = obj; #endif diff --git a/vvp/vpi_modules.cc b/vvp/vpi_modules.cc index d6dd3a2f2..91e1cec30 100644 --- a/vvp/vpi_modules.cc +++ b/vvp/vpi_modules.cc @@ -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. */ dll_list_cnt += 1; dll_list = static_cast - (realloc(static_cast(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; vpi_mode_flag = VPI_MODE_REGISTER; diff --git a/vvp/vpi_scope.cc b/vvp/vpi_scope.cc index f06cdcc62..806465b51 100644 --- a/vvp/vpi_scope.cc +++ b/vvp/vpi_scope.cc @@ -150,7 +150,7 @@ static void delete_sub_scopes(__vpiScope *scope) citer != scope->classes.end(); ++ citer ) { class_list_count += 1; class_list = static_cast - (realloc(static_cast(class_list), + (realloc(class_list, class_list_count*sizeof(class_type **))); 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*))); else scope->item = static_cast - (realloc(static_cast(scope->item), + (realloc(scope->item, sizeof(automatic_hooks_s*)*scope->nitem)); scope->item[idx] = item; diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index af6d9bf92..bea53698c 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -1204,7 +1204,7 @@ void* __vpiSignal::operator new(size_t siz) VALGRIND_CREATE_MEMPOOL(alloc_array, 0, 1); signal_pool_count += 1; signal_pool = static_cast - (realloc(static_cast(signal_pool), + (realloc(signal_pool, signal_pool_count*sizeof(vpiSignal_plug **))); signal_pool[signal_pool_count-1] = alloc_array; #endif diff --git a/vvp/vpi_tasks.cc b/vvp/vpi_tasks.cc index 3b3663aa9..fe506c5f3 100644 --- a/vvp/vpi_tasks.cc +++ b/vvp/vpi_tasks.cc @@ -581,7 +581,7 @@ static struct __vpiUserSystf* allocate_def(void) } def_table = static_cast - (realloc(static_cast(def_table), + (realloc(def_table, (def_count+1)*sizeof(struct __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) { vpi_call_error_lst = static_cast - (realloc(static_cast(vpi_call_error_lst), + (realloc(vpi_call_error_lst, (vpi_call_error_num + 1) * sizeof(vpi_call_error_s))); vpi_call_error_lst[vpi_call_error_num].type = type;