diff --git a/PExpr.h b/PExpr.h index f91025e70..78c3055bb 100644 --- a/PExpr.h +++ b/PExpr.h @@ -412,7 +412,7 @@ class PEIdent : public PExpr { // the values written to the msb/lsb arguments. If there are // invalid bits (xz) in either expression, then the defined // flag is set to *false*. - bool calculate_parts_(Design*, NetScope*, long&msb, long&lsb, bool&defined) const; + void calculate_parts_(Design*, NetScope*, long&msb, long&lsb, bool&defined) const; NetExpr* calculate_up_do_base_(Design*, NetScope*, bool need_const) const; bool calculate_up_do_width_(Design*, NetScope*, unsigned long&wid) const; @@ -426,7 +426,7 @@ class PEIdent : public PExpr { // [2:0][x] - BAD // [y][x] - BAD // Leave the last index for special handling. - bool calculate_packed_indices_(Design*des, NetScope*scope, NetNet*net, + bool calculate_packed_indices_(Design*des, NetScope*scope, const NetNet*net, std::list&prefix_indices) const; private: @@ -554,7 +554,7 @@ class PEIdent : public PExpr { bool var_allowed_in_sv) const; - bool eval_part_select_(Design*des, NetScope*scope, NetNet*sig, + bool eval_part_select_(Design*des, NetScope*scope, const NetNet*sig, long&midx, long&lidx) const; }; @@ -959,8 +959,8 @@ class PECallFunction : public PExpr { NetExpr* elaborate_expr_method_(Design*des, NetScope*scope, symbol_search_results&search_results) const; - NetExpr* elaborate_expr_method_par_(Design*des, NetScope*scope, - symbol_search_results&search_results) + NetExpr* elaborate_expr_method_par_(Design*des, const NetScope*scope, + const symbol_search_results&search_results) const; @@ -972,16 +972,16 @@ class PECallFunction : public PExpr { unsigned test_width_sfunc_(Design*des, NetScope*scope, width_mode_t&mode); unsigned test_width_method_(Design*des, NetScope*scope, - symbol_search_results&search_results, + const symbol_search_results&search_results, width_mode_t&mode); NetExpr*elaborate_base_(Design*des, NetScope*scope, NetScope*dscope, unsigned flags) const; unsigned elaborate_arguments_(Design*des, NetScope*scope, - NetFuncDef*def, bool need_const, - std::vector&parms, - unsigned parm_off) const; + const NetFuncDef*def, bool need_const, + std::vector&parms, + unsigned parm_off) const; }; /* diff --git a/PGate.cc b/PGate.cc index 59ad57048..6da02060e 100644 --- a/PGate.cc +++ b/PGate.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 @@ -148,7 +148,7 @@ PGAssign::~PGAssign() PGBuiltin::PGBuiltin(Type t, perm_string name, list*pins, - list*del) + const list*del) : PGate(name, pins, del), type_(t) { } diff --git a/PGate.h b/PGate.h index bdad01489..d171f2230 100644 --- a/PGate.h +++ b/PGate.h @@ -159,7 +159,7 @@ class PGBuiltin : public PGate { public: explicit PGBuiltin(Type t, perm_string name, std::list*pins, - std::list*del); + const std::list*del); explicit PGBuiltin(Type t, perm_string name, std::list*pins, PExpr*del); @@ -244,7 +244,7 @@ class PGModule : public PGate { void elaborate_udp_(Design*, PUdp *udp, NetScope*scope) const; void elaborate_scope_mod_(Design*des, Module*mod, NetScope*sc) const; void elaborate_scope_mod_instances_(Design*des, Module*mod, NetScope*sc) const; - bool elaborate_sig_mod_(Design*des, NetScope*scope, Module*mod) const; + bool elaborate_sig_mod_(Design*des, NetScope*scope, const Module*mod) const; // Not currently used. #if 0 bool elaborate_sig_udp_(Design*des, NetScope*scope, PUdp*udp) const; diff --git a/Statement.h b/Statement.h index 283d7424d..6e5e8d7a3 100644 --- a/Statement.h +++ b/Statement.h @@ -265,7 +265,7 @@ class PCallTask : public Statement { ivl_type_t type, perm_string method_name, const char*sys_task_name) const; - bool test_task_calls_ok_(Design*des, NetScope*scope) const; + bool test_task_calls_ok_(Design*des, const NetScope*scope) const; PPackage*package_; pform_name_t path_; @@ -463,7 +463,7 @@ class PEventStatement : public Statement { NetProc* elaborate_st(Design*des, NetScope*scope, NetProc*st) const; NetProc* elaborate_wait(Design*des, NetScope*scope, NetProc*st) const; - NetProc* elaborate_wait_fork(Design*des, NetScope*scope) const; + NetProc* elaborate_wait_fork(Design*des, const NetScope*scope) const; private: std::vectorexpr_; diff --git a/elab_expr.cc b/elab_expr.cc index fe5dc8f20..73eed88ac 100644 --- a/elab_expr.cc +++ b/elab_expr.cc @@ -1519,7 +1519,7 @@ static NetFuncDef* find_function_definition(Design*des, NetScope*, } unsigned PECallFunction::test_width_method_(Design*, NetScope*, - symbol_search_results&search_results, + const symbol_search_results&search_results, width_mode_t&) { if (!gn_system_verilog()) @@ -3024,7 +3024,7 @@ NetExpr* PECallFunction::elaborate_base_(Design*des, NetScope*scope, NetScope*ds if (! check_call_matches_definition_(des, dscope)) return 0; - NetFuncDef*def = dscope->func_def(); + const NetFuncDef*def = dscope->func_def(); bool need_const = NEED_CONST & flags; @@ -3124,7 +3124,7 @@ NetExpr* PECallFunction::elaborate_base_(Design*des, NetScope*scope, NetScope*ds * def->port(0) will be the "this" argument and should be skipped. */ unsigned PECallFunction::elaborate_arguments_(Design*des, NetScope*scope, - NetFuncDef*def, bool need_const, + const NetFuncDef*def, bool need_const, vector&parms, unsigned parm_off) const { @@ -3408,7 +3408,7 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope, return 0; } - NetFuncDef*def = method->func_def(); + const NetFuncDef*def = method->func_def(); ivl_assert(*this, def); NetNet*res = method->find_signal(method->basename()); @@ -3509,8 +3509,8 @@ NetExpr* PECallFunction::elaborate_expr_method_(Design*des, NetScope*scope, * expression of some sort (it's a parameter value) and most methods are * stable in the sense that they generate a constant value for a constant input. */ -NetExpr* PECallFunction::elaborate_expr_method_par_(Design*des, NetScope*scope, - symbol_search_results&search_results) +NetExpr* PECallFunction::elaborate_expr_method_par_(Design*des, const NetScope*scope, + const symbol_search_results&search_results) const { ivl_assert(*this, search_results.par_val); @@ -4047,7 +4047,7 @@ NetExpr* PEFNumber::elaborate_expr(Design*, NetScope*, unsigned, unsigned) const return tmp; } -bool PEIdent::calculate_packed_indices_(Design*des, NetScope*scope, NetNet*net, +bool PEIdent::calculate_packed_indices_(Design*des, NetScope*scope, const NetNet*net, list&prefix_indices) const { unsigned dimensions = net->unpacked_dimensions() + net->packed_dimensions(); @@ -4120,7 +4120,7 @@ bool PEIdent::calculate_bits_(Design*des, NetScope*scope, * function calculates their values. Note that this method does *not* * convert the values to canonical form. */ -bool PEIdent::calculate_parts_(Design*des, NetScope*scope, +void PEIdent::calculate_parts_(Design*des, NetScope*scope, long&msb, long&lsb, bool&defined) const { defined = true; @@ -4173,7 +4173,6 @@ bool PEIdent::calculate_parts_(Design*des, NetScope*scope, delete msb_ex; delete lsb_ex; - return true; } bool PEIdent::calculate_up_do_width_(Design*des, NetScope*scope, @@ -5274,9 +5273,7 @@ NetExpr* PEIdent::elaborate_expr_param_part_(Design*des, NetScope*scope, { long msv, lsv; bool parts_defined_flag; - bool flag = calculate_parts_(des, scope, msv, lsv, parts_defined_flag); - if (!flag) - return 0; + calculate_parts_(des, scope, msv, lsv, parts_defined_flag); const NetEConst*par_ex = dynamic_cast (par); ivl_assert(*this, par_ex); @@ -5851,9 +5848,7 @@ NetExpr* PEIdent::elaborate_expr_net_part_(Design*des, NetScope*scope, long msv, lsv; bool parts_defined_flag; - bool flag = calculate_parts_(des, scope, msv, lsv, parts_defined_flag); - if (!flag) - return 0; + calculate_parts_(des, scope, msv, lsv, parts_defined_flag); /* But wait... if the part select expressions are not fully defined, then fall back on the tested width. */ @@ -6722,7 +6717,7 @@ NetExpr* PENewClass::elaborate_expr_constructor_(Design*des, NetScope*scope, } - NetFuncDef*def = new_scope->func_def(); + const NetFuncDef*def = new_scope->func_def(); if (def == 0) { cerr << get_fileline() << ": internal error: " << "Scope " << scope_path(new_scope) diff --git a/elab_lval.cc b/elab_lval.cc index bde944622..4f1859c43 100644 --- a/elab_lval.cc +++ b/elab_lval.cc @@ -254,7 +254,7 @@ NetAssign_* PEIdent::elaborate_lval(Design*des, NetAssign_*PEIdent::elaborate_lval_var_(Design *des, NetScope *scope, bool is_force, bool is_cassign, NetNet *reg, ivl_type_t data_type, - pform_name_t tail_path) const + const pform_name_t tail_path) const { // We are processing the tail of a string of names. For // example, the Verilog may be "a.b.c", so we are processing @@ -761,8 +761,7 @@ bool PEIdent::elaborate_lval_net_part_(Design*des, // values into msb and lsb. long msb, lsb; bool parts_defined_flag; - bool flag = calculate_parts_(des, scope, msb, lsb, parts_defined_flag); - if (!flag) return false; + calculate_parts_(des, scope, msb, lsb, parts_defined_flag); NetNet*reg = lv->sig(); ivl_assert(*this, reg); diff --git a/elab_net.cc b/elab_net.cc index c5bfb6165..b615ae5db 100644 --- a/elab_net.cc +++ b/elab_net.cc @@ -206,7 +206,7 @@ bool PEConcat::is_collapsible_net(Design*des, NetScope*scope, * results, which may be the whole vector, or a single bit, or * anything in between. The values are in canonical indices. */ -bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig, +bool PEIdent::eval_part_select_(Design*des, NetScope*scope, const NetNet*sig, long&midx, long&lidx) const { list prefix_indices; diff --git a/elab_scope.cc b/elab_scope.cc index b51410088..bd9065fd3 100644 --- a/elab_scope.cc +++ b/elab_scope.cc @@ -58,7 +58,7 @@ using namespace std; -void set_scope_timescale(Design*des, NetScope*scope, PScope*pscope) +void set_scope_timescale(Design*des, NetScope*scope, const PScope*pscope) { scope->time_unit(pscope->time_unit); scope->time_precision(pscope->time_precision); diff --git a/elab_sig.cc b/elab_sig.cc index 0bb89f21f..575105eb1 100644 --- a/elab_sig.cc +++ b/elab_sig.cc @@ -90,8 +90,8 @@ void Statement::elaborate_sig(Design*, NetScope*) const { } -static void sig_check_data_type(Design*des, NetScope*scope, - PWire *wire, NetNet *sig) +static void sig_check_data_type(Design*des, const NetScope*scope, + const PWire *wire, NetNet *sig) { ivl_type_t type = sig->net_type(); @@ -141,8 +141,8 @@ static void sig_check_data_type(Design*des, NetScope*scope, } } -static void sig_check_port_type(Design*des, NetScope*scope, - PWire *wire, NetNet *sig) +static void sig_check_port_type(Design*des, const NetScope*scope, + const PWire *wire, const NetNet *sig) { if (sig->port_type() == NetNet::PREF) { cerr << wire->get_fileline() << ": sorry: " @@ -460,7 +460,7 @@ bool PGAssign::elaborate_sig(Design*, NetScope*) const } bool PGModule::elaborate_sig_mod_(Design*des, NetScope*scope, - Module*rmod) const + const Module*rmod) const { bool flag = true; diff --git a/elaborate.cc b/elaborate.cc index 23406a7d1..05432eb8f 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -60,7 +60,7 @@ using namespace std; // Implemented in elab_scope.cc -extern void set_scope_timescale(Design*des, NetScope*scope, PScope*pscope); +extern void set_scope_timescale(Design*des, NetScope*scope, const PScope*pscope); void PGate::elaborate(Design*, NetScope*) const { @@ -1203,7 +1203,7 @@ static void isolate_and_connect(Design*des, NetScope*scope, const PGModule*mod, void elaborate_unpacked_port(Design *des, NetScope *scope, NetNet *port_net, PExpr *expr, NetNet::PortType port_type, - Module *mod, unsigned int port_idx) + const Module *mod, unsigned int port_idx) { NetNet *expr_net = elaborate_unpacked_array(des, scope, *expr, port_net, expr); @@ -3360,7 +3360,7 @@ NetProc* PChainConstructor::elaborate(Design*des, NetScope*scope) const if (NetScope*new_scope = class_super->get_constructor()) { int missing_parms = 0; - NetFuncDef*def = new_scope->func_def(); + const NetFuncDef*def = new_scope->func_def(); ivl_assert(*this, def); NetESignal*eres = new NetESignal(var_this); @@ -4052,7 +4052,7 @@ NetProc* PCallTask::elaborate_method_(Design*des, NetScope*scope, * task call is allowed in the current context. If so, return true. If * not, print an error message and return false; */ -bool PCallTask::test_task_calls_ok_(Design*des, NetScope*scope) const +bool PCallTask::test_task_calls_ok_(Design*des, const NetScope*scope) const { if (scope->in_func()) { cerr << get_fileline() << ": error: Functions cannot enable/call " @@ -4130,7 +4130,7 @@ NetProc* PCallTask::elaborate_void_function_(Design*des, NetScope*scope, NetProc* PCallTask::elaborate_build_call_(Design*des, NetScope*scope, NetScope*task, NetExpr*use_this) const { - NetBaseDef*def = 0; + const NetBaseDef*def = 0; if (task->type() == NetScope::TASK) { def = task->task_def(); @@ -4147,7 +4147,7 @@ NetProc* PCallTask::elaborate_build_call_(Design*des, NetScope*scope, } } else if (task->type() == NetScope::FUNC) { - NetFuncDef*tmp = task->func_def(); + const NetFuncDef*tmp = task->func_def(); if (!tmp->is_void()) return elaborate_non_void_function_(des, scope); def = tmp; @@ -5271,7 +5271,7 @@ NetProc* PEventStatement::elaborate_wait(Design*des, NetScope*scope, * * @(0) ; */ -NetProc* PEventStatement::elaborate_wait_fork(Design*des, NetScope*scope) const +NetProc* PEventStatement::elaborate_wait_fork(Design*des, const NetScope*scope) const { ivl_assert(*this, scope); ivl_assert(*this, expr_.size() == 1); @@ -6259,7 +6259,7 @@ void PSpecPath::elaborate(Design*des, NetScope*scope) const delay_value[idx] = des->scale_to_precision(fn.as_ulong64(), scope); - } else if (NetECReal*rcon = dynamic_cast(cur)) { + } else if (const NetECReal*rcon = dynamic_cast(cur)) { delay_value[idx] = get_scaled_time_from_real(des, scope, rcon); diff --git a/expr_synth.cc b/expr_synth.cc index eea33c99f..8699602b6 100644 --- a/expr_synth.cc +++ b/expr_synth.cc @@ -31,7 +31,7 @@ using namespace std; -static NetNet* convert_to_real_const(Design*des, NetScope*scope, NetEConst*expr) +static NetNet* convert_to_real_const(Design*des, NetScope*scope, const NetEConst*expr) { verireal vrl(expr->value().as_double()); NetECReal rlval(vrl); @@ -53,7 +53,7 @@ static bool process_binary_args(Design*des, NetScope*scope, NetExpr*root, cases of constants, which can be converted more directly. */ if (left->expr_type() == IVL_VT_REAL) { lsig = left->synthesize(des, scope, root); - } else if (NetEConst*tmpc = dynamic_cast (left)) { + } else if (const NetEConst*tmpc = dynamic_cast (left)) { lsig = convert_to_real_const(des, scope, tmpc); } else { NetNet*tmp = left->synthesize(des, scope, root); @@ -62,7 +62,7 @@ static bool process_binary_args(Design*des, NetScope*scope, NetExpr*root, if (right->expr_type() == IVL_VT_REAL) { rsig = right->synthesize(des, scope, root); - } else if (NetEConst*tmpc = dynamic_cast (right)) { + } else if (const NetEConst*tmpc = dynamic_cast (right)) { rsig = convert_to_real_const(des, scope, tmpc); } else { NetNet*tmp = right->synthesize(des, scope, root); @@ -1483,7 +1483,7 @@ NetNet* NetESignal::synthesize(Design*des, NetScope*scope, NetExpr*root) return tmp; } -static NetEvWait* make_func_trigger(Design*des, NetScope*scope, NetExpr*root) +static NetEvWait* make_func_trigger(Design*des, NetScope*scope, const NetExpr*root) { NetEvWait*trigger = 0; diff --git a/lexor.lex b/lexor.lex index ef291f9d6..8f6c87a4b 100644 --- a/lexor.lex +++ b/lexor.lex @@ -920,7 +920,7 @@ void lex_end_table() BEGIN(INITIAL); } -static unsigned truncate_to_integer_width(verinum::V*bits, unsigned size) +static unsigned truncate_to_integer_width(const verinum::V*bits, unsigned size) { if (size <= integer_width) return size; diff --git a/map_named_args.cc b/map_named_args.cc index fc108feef..e43db84b6 100644 --- a/map_named_args.cc +++ b/map_named_args.cc @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 Lars-Peter Clausen +// SPDX-FileCopyrightText: 2023-2025 Lars-Peter Clausen // SPDX-License-Identifier: GPL-2.0-or-later #include "PExpr.h" @@ -62,7 +62,7 @@ std::vector map_named_args(Design *des, return args; } -std::vector map_named_args(Design *des, NetBaseDef *def, +std::vector map_named_args(Design *des, const NetBaseDef *def, const std::vector &parms, unsigned int off) { diff --git a/map_named_args.h b/map_named_args.h index f0017198f..3196c1e2f 100644 --- a/map_named_args.h +++ b/map_named_args.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 Lars-Peter Clausen +// SPDX-FileCopyrightText: 2023-2025 Lars-Peter Clausen // SPDX-License-Identifier: GPL-2.0-or-later #ifndef MAP_NAMED_ARGS_H @@ -15,7 +15,7 @@ std::vector map_named_args(Design *des, const std::vector &names, const std::vector &parms); -std::vector map_named_args(Design *des, NetBaseDef *def, +std::vector map_named_args(Design *des, const NetBaseDef *def, const std::vector &parms, unsigned int off); diff --git a/net_design.cc b/net_design.cc index 771b7327e..f813751c2 100644 --- a/net_design.cc +++ b/net_design.cc @@ -214,7 +214,7 @@ NetScope* Design::find_scope(const hname_t&path) const return 0; } -static bool is_design_unit(NetScope*scope) +static bool is_design_unit(const NetScope*scope) { return (scope->type() == NetScope::MODULE && !scope->nested_module()) || (scope->type() == NetScope::PACKAGE); diff --git a/net_func_eval.cc b/net_func_eval.cc index e986c4f2d..19327ea27 100644 --- a/net_func_eval.cc +++ b/net_func_eval.cc @@ -242,7 +242,7 @@ void NetAssign::eval_func_lval_op_real_(const LineInfo&loc, } void NetAssign::eval_func_lval_op_(const LineInfo&loc, - verinum&lv, verinum&rv) const + verinum&lv, const verinum&rv) const { unsigned lv_width = lv.len(); bool lv_sign = lv.has_sign(); diff --git a/net_link.cc b/net_link.cc index 1f782bd8b..ae638621f 100644 --- a/net_link.cc +++ b/net_link.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 @@ -164,7 +164,7 @@ Link::DIR Link::get_dir() const return dir_; } -void Link::drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay) +void Link::drivers_delays(const NetExpr*rise, const NetExpr*fall, const NetExpr*decay) { find_nexus_()->drivers_delays(rise, fall, decay); } @@ -358,7 +358,7 @@ bool Nexus::drivers_present() const return false; } -void Nexus::drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay) +void Nexus::drivers_delays(const NetExpr*rise, const NetExpr*fall, const NetExpr*decay) { for (Link*cur = first_nlink() ; cur ; cur = cur->next_nlink()) { if (cur->get_dir() != Link::OUTPUT) @@ -600,7 +600,7 @@ void NexusSet::add(Nexus*that, unsigned base, unsigned wid) items_.push_back(cur); } -void NexusSet::add(NexusSet&that) +void NexusSet::add(const NexusSet&that) { for (size_t idx = 0 ; idx < that.items_.size() ; idx += 1) add(that.items_[idx]->lnk.nexus(), that.items_[idx]->base, that.items_[idx]->wid); diff --git a/net_scope.cc b/net_scope.cc index 1380a7fef..1efc464e6 100644 --- a/net_scope.cc +++ b/net_scope.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000-2024 Stephen Williams (steve@icarus.com) + * Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com) * Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch) * * This source code is free software; you can redistribute it @@ -52,7 +52,7 @@ void Definitions::add_enumeration_set(const enum_type_t*key, netenum_t*enum_set) tmp = enum_set; } -bool Definitions::add_enumeration_name(netenum_t*enum_set, perm_string name) +bool Definitions::add_enumeration_name(const netenum_t*enum_set, perm_string name) { netenum_t::iterator enum_val = enum_set->find_name(name); assert(enum_val != enum_set->end_name()); @@ -708,7 +708,7 @@ void NetScope::add_signal_placeholder(PWire*wire) signal_placeholders_[wire->basename()] = wire; } -void NetScope::rem_signal_placeholder(PWire*wire) +void NetScope::rem_signal_placeholder(const PWire*wire) { signal_placeholders_.erase(wire->basename()); } diff --git a/netlist.cc b/netlist.cc index c2cf782cc..b63d142be 100644 --- a/netlist.cc +++ b/netlist.cc @@ -3271,7 +3271,7 @@ bool NetForever::check_synth(ivl_process_type_t pr_type, * structure for synthesis. */ static void print_for_idx_warning(const NetProc*proc, const char*check, - ivl_process_type_t pr_type, NetNet*idx) + ivl_process_type_t pr_type, const NetNet*idx) { cerr << proc->get_fileline() << ": warning: A for statement must use " "the index (" << idx->name() << ") in the " << check @@ -3293,7 +3293,7 @@ static void check_for_const_synth(const NetExpr*expr, const NetProc*proc, static void check_for_bin_synth(const NetExpr*left,const NetExpr*right, const char*str, const char*check, const NetProc*proc, - ivl_process_type_t pr_type, NetNet*index) + ivl_process_type_t pr_type, const NetNet*index) { const NetESignal*lsig = dynamic_cast(left); const NetESignal*rsig = dynamic_cast(right); @@ -3327,7 +3327,7 @@ static void print_for_step_warning(const NetProc*proc, } static void print_for_step_warning(const NetProc*proc, - ivl_process_type_t pr_type, NetNet*idx) + ivl_process_type_t pr_type, const NetNet*idx) { cerr << proc->get_fileline() << ": warning: A for statement step must " "be an assignment to the index variable (" @@ -3336,7 +3336,7 @@ static void print_for_step_warning(const NetProc*proc, } static void check_for_bstep_synth(const NetExpr*expr, const NetProc*proc, - ivl_process_type_t pr_type, NetNet*index) + ivl_process_type_t pr_type, const NetNet*index) { if (const NetECast*tmp = dynamic_cast(expr)) { expr = tmp->expr(); diff --git a/netlist.h b/netlist.h index e04c8e42c..ab3b58485 100644 --- a/netlist.h +++ b/netlist.h @@ -125,7 +125,7 @@ class Link { DIR get_dir() const; // Set the delay for all the drivers to this nexus. - void drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay); + void drivers_delays(const NetExpr*rise, const NetExpr*fall, const NetExpr*decay); // A link has a drive strength for 0 and 1 values. The drive0 // strength is for when the link has the value 0, and drive1 @@ -373,7 +373,7 @@ class Nexus { const char* name() const; - void drivers_delays(NetExpr*rise, NetExpr*fall, NetExpr*decay); + void drivers_delays(const NetExpr*rise, const NetExpr*fall, const NetExpr*decay); void drivers_drive(ivl_drive_t d0, ivl_drive_t d1); Link*first_nlink(); @@ -475,7 +475,7 @@ class NexusSet { // Add the nexus/part to the set, if it is not already present. void add(Nexus*that, unsigned base, unsigned wid); - void add(NexusSet&that); + void add(const NexusSet&that); // Remove the nexus from the set, if it is present. void rem(const NexusSet&that); @@ -911,7 +911,7 @@ class Definitions { // up this enumeration based on the pform type. void add_enumeration_set(const enum_type_t*key, netenum_t*enum_set); - bool add_enumeration_name(netenum_t*enum_set, perm_string enum_name); + bool add_enumeration_name(const netenum_t*enum_set, perm_string enum_name); // Look up the enumeration set that was added with the given // key. This is used by enum_type_t::elaborate_type to locate @@ -1020,7 +1020,7 @@ class NetScope : public Definitions, public Attrib { when using $bits in a range definition), regardless of the order in which the signals are elaborated. */ void add_signal_placeholder(PWire*); - void rem_signal_placeholder(PWire*); + void rem_signal_placeholder(const PWire*); PWire* find_signal_placeholder(perm_string name); /* These methods manage signals. The add_ and rem_signal @@ -3019,7 +3019,7 @@ class NetAssign : public NetAssignBase { private: void eval_func_lval_op_real_(const LineInfo&loc, verireal&lv, const verireal&rv) const; - void eval_func_lval_op_(const LineInfo&loc, verinum&lv, verinum&rv) const; + void eval_func_lval_op_(const LineInfo&loc, verinum&lv, const verinum&rv) const; bool eval_func_lval_(const LineInfo&loc, std::map&ctx, const NetAssign_*lval, NetExpr*rval_result) const; diff --git a/netmisc.cc b/netmisc.cc index 5da5b143e..9e4162800 100644 --- a/netmisc.cc +++ b/netmisc.cc @@ -543,7 +543,7 @@ static void make_strides(const netranges_t&dims, vector&stride) * word. If any of the indices are out of bounds, return nil instead * of an expression. */ -static NetExpr* normalize_variable_unpacked(const netranges_t&dims, list&indices) +static NetExpr* normalize_variable_unpacked(const netranges_t&dims, const list&indices) { // Make strides for each index. The stride is the distance (in // words) to the next element in the canonical array. @@ -574,19 +574,19 @@ static NetExpr* normalize_variable_unpacked(const netranges_t&dims, list&i return canonical_expr; } -NetExpr* normalize_variable_unpacked(const NetNet*net, list&indices) +NetExpr* normalize_variable_unpacked(const NetNet*net, const list&indices) { const netranges_t&dims = net->unpacked_dims(); return normalize_variable_unpacked(dims, indices); } -NetExpr* normalize_variable_unpacked(const netsarray_t*stype, list&indices) +NetExpr* normalize_variable_unpacked(const netsarray_t*stype, const list&indices) { const netranges_t&dims = stype->static_dimensions(); return normalize_variable_unpacked(dims, indices); } -NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netranges_t&dims, list&indices) +NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netranges_t&dims, const list&indices) { // Make strides for each index. The stride is the distance (in // words) to the next element in the canonical array. @@ -671,13 +671,13 @@ NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netranges_t&dims, return canonical_expr; } -NetExpr* normalize_variable_unpacked(const NetNet*net, list&indices) +NetExpr* normalize_variable_unpacked(const NetNet*net, const list&indices) { const netranges_t&dims = net->unpacked_dims(); return normalize_variable_unpacked(*net, dims, indices); } -NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*stype, list&indices) +NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*stype, const list&indices) { const netranges_t&dims = stype->static_dimensions(); return normalize_variable_unpacked(loc, dims, indices); @@ -1375,7 +1375,7 @@ const_bool const_logical(const NetExpr*expr) return C_NON; } -uint64_t get_scaled_time_from_real(Design*des, NetScope*scope, NetECReal*val) +uint64_t get_scaled_time_from_real(const Design*des, NetScope*scope, const NetECReal*val) { verireal fn = val->value(); @@ -1530,7 +1530,7 @@ bool evaluate_index_prefix(Design*des, NetScope*scope, * replace the exprs. */ NetExpr*collapse_array_exprs(Design*des, NetScope*scope, - const LineInfo*loc, NetNet*net, + const LineInfo*loc, const NetNet*net, const list&indices) { // First elaborate all the expressions as far as possible. @@ -1589,7 +1589,7 @@ NetExpr*collapse_array_exprs(Design*des, NetScope*scope, * them to an expression that normalizes the list to a single index * expression over a canonical equivalent 1-dimensional array. */ -NetExpr*collapse_array_indices(Design*des, NetScope*scope, NetNet*net, +NetExpr*collapse_array_indices(Design*des, NetScope*scope, const NetNet*net, const list&indices) { listprefix_indices; @@ -1787,7 +1787,7 @@ NetScope* find_method_containing_scope(const LineInfo&, NetScope*scope) * Print a warning if we find a mixture of default and explicit timescale * based delays in the design, since this is likely an error. */ -void check_for_inconsistent_delays(NetScope*scope) +void check_for_inconsistent_delays(const NetScope*scope) { static bool used_implicit_timescale = false; static bool used_explicit_timescale = false; diff --git a/netmisc.h b/netmisc.h index 596033d1f..be460ad04 100644 --- a/netmisc.h +++ b/netmisc.h @@ -271,11 +271,11 @@ extern void indices_to_expressions(Design*des, NetScope*scope, indices_flags&flags, std::list&indices,std::list&indices_const); -extern NetExpr*normalize_variable_unpacked(const NetNet*net, std::list&indices); -extern NetExpr*normalize_variable_unpacked(const netsarray_t*net, std::list&indices); +extern NetExpr*normalize_variable_unpacked(const NetNet*net, const std::list&indices); +extern NetExpr*normalize_variable_unpacked(const netsarray_t*net, const std::list&indices); -extern NetExpr*normalize_variable_unpacked(const NetNet*net, std::list&indices); -extern NetExpr*normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*net, std::list&indices); +extern NetExpr*normalize_variable_unpacked(const NetNet*net, const std::list&indices); +extern NetExpr*normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*net, const std::list&indices); extern NetExpr*make_canonical_index(Design*des, NetScope*scope, // loc for error messages @@ -454,9 +454,9 @@ const_bool const_logical(const NetExpr*expr); * When scaling a real value to a time we need to do some standard * processing. */ -extern uint64_t get_scaled_time_from_real(Design*des, +extern uint64_t get_scaled_time_from_real(const Design*des, NetScope*scope, - NetECReal*val); + const NetECReal*val); extern void collapse_partselect_pv_to_concat(Design*des, NetNet*sig); @@ -464,11 +464,11 @@ extern bool evaluate_index_prefix(Design*des, NetScope*scope, std::list&prefix_indices, const std::list&indices); -extern NetExpr*collapse_array_indices(Design*des, NetScope*scope, NetNet*net, +extern NetExpr*collapse_array_indices(Design*des, NetScope*scope, const NetNet*net, const std::list&indices); extern NetExpr*collapse_array_exprs(Design*des, NetScope*scope, - const LineInfo*loc, NetNet*net, + const LineInfo*loc, const NetNet*net, const std::list&indices); extern void assign_unpacked_with_bufz(Design*des, NetScope*scope, @@ -481,6 +481,6 @@ extern NetPartSelect* detect_partselect_lval(Link&pin); * Print a warning if we find a mixture of default and explicit timescale * based delays in the design, since this is likely an error. */ -extern void check_for_inconsistent_delays(NetScope*scope); +extern void check_for_inconsistent_delays(const NetScope*scope); #endif /* IVL_netmisc_H */ diff --git a/parse.y b/parse.y index d5f0e92eb..ee2b2404e 100644 --- a/parse.y +++ b/parse.y @@ -268,7 +268,7 @@ static std::list* make_named_number(const struct vlltype &loc, return lst; } -static long check_enum_seq_value(const YYLTYPE&loc, verinum *arg, bool zero_ok) +static long check_enum_seq_value(const YYLTYPE&loc, const verinum *arg, bool zero_ok) { long value = 1; // We can never have an undefined value in an enumeration name @@ -308,8 +308,8 @@ static void check_end_label(const struct vlltype&loc, const char *type, delete[] end; } -static void check_for_loop(const struct vlltype&loc, PExpr*init, - PExpr*cond, Statement*step) +static void check_for_loop(const struct vlltype&loc, const PExpr*init, + const PExpr*cond, const Statement*step) { if (generation_flag >= GN_VER2012) return; diff --git a/pform.cc b/pform.cc index dfc84e1d1..108dc1785 100644 --- a/pform.cc +++ b/pform.cc @@ -606,7 +606,7 @@ PPackage* pform_push_package_scope(const struct vlltype&loc, perm_string name, return pkg_scope; } -PTask* pform_push_task_scope(const struct vlltype&loc, char*name, +PTask* pform_push_task_scope(const struct vlltype&loc, const char*name, LexicalScope::lifetime_t lifetime) { perm_string task_name = lex_strings.make(name); @@ -677,7 +677,7 @@ PFunction* pform_push_function_scope(const struct vlltype&loc, const char*name, return func; } -PBlock* pform_push_block_scope(const struct vlltype&loc, char*name, +PBlock* pform_push_block_scope(const struct vlltype&loc, const char*name, PBlock::BL_TYPE bt) { perm_string block_name; @@ -1678,7 +1678,7 @@ void pform_generate_case_item(const struct vlltype&li, list*expr_list) } } -void pform_generate_block_name(char*name) +void pform_generate_block_name(const char*name) { assert(pform_cur_generate != 0); assert(pform_cur_generate->scope_name == 0); @@ -2638,7 +2638,7 @@ void pform_module_define_port(const struct vlltype&li, * this one to create the wire and stash it. */ PWire *pform_makewire(const vlltype&li, const pform_ident_t&name, - NetNet::Type type, std::list *indices) + NetNet::Type type, const std::list *indices) { PWire*cur = pform_get_or_make_wire(li, name, type, NetNet::NOT_A_PORT, SR_NET); ivl_assert(li, cur); @@ -2911,7 +2911,7 @@ static void pform_set_type_parameter(const struct vlltype&loc, perm_string name, void pform_set_parameter(const struct vlltype&loc, perm_string name, bool is_local, bool is_type, - data_type_t*data_type, list*udims, + data_type_t*data_type, const list*udims, PExpr*expr, LexicalScope::range_t*value_range) { LexicalScope*scope = lexical_scope; diff --git a/pform.h b/pform.h index d1335d8c5..3665da832 100644 --- a/pform.h +++ b/pform.h @@ -1,7 +1,7 @@ #ifndef IVL_pform_H #define IVL_pform_H /* - * 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 @@ -212,7 +212,7 @@ PPackage *pform_find_potential_import(const struct vlltype&loc, LexicalScope*sco extern PExpr* pform_package_ident(const struct vlltype&loc, - PPackage*pkg, pform_name_t*ident); + PPackage*pkg, const pform_name_t*ident); /* * Interface related functions. @@ -255,13 +255,13 @@ extern PFunction*pform_push_constructor_scope(const struct vlltype&loc); extern PPackage* pform_push_package_scope(const struct vlltype&loc, perm_string name, LexicalScope::lifetime_t lifetime); -extern PTask*pform_push_task_scope(const struct vlltype&loc, char*name, +extern PTask*pform_push_task_scope(const struct vlltype&loc, const char*name, LexicalScope::lifetime_t lifetime); extern PFunction*pform_push_function_scope(const struct vlltype&loc, const char*name, LexicalScope::lifetime_t lifetime); -extern PBlock*pform_push_block_scope(const struct vlltype&loc, char*name, +extern PBlock*pform_push_block_scope(const struct vlltype&loc, const char*name, PBlock::BL_TYPE tt); extern void pform_put_behavior_in_scope(AProcess*proc); @@ -294,7 +294,7 @@ extern void pform_start_generate_else(const struct vlltype&li); extern void pform_start_generate_case(const struct vlltype&lp, PExpr*test); extern void pform_start_generate_nblock(const struct vlltype&lp, char*name); extern void pform_generate_case_item(const struct vlltype&lp, std::list*test); -extern void pform_generate_block_name(char*name); +extern void pform_generate_block_name(const char*name); extern void pform_endgenerate(bool end_conditional); /* @@ -342,7 +342,7 @@ extern PForeach* pform_make_foreach(const struct vlltype&loc, extern PWire *pform_makewire(const struct vlltype&li, const pform_ident_t&name, NetNet::Type type, - std::list *indices); + const std::list *indices); /* This form handles assignment declarations. */ @@ -401,10 +401,10 @@ extern LexicalScope::range_t* pform_parameter_value_range(bool exclude_flag, bool hig_open, PExpr*hig_expr); extern void pform_set_parameter(const struct vlltype&loc, - perm_string name, - bool is_local, bool is_type, - data_type_t*data_type, std::list*udims, - PExpr*expr, LexicalScope::range_t*value_range); + perm_string name, + bool is_local, bool is_type, + data_type_t*data_type, const std::list*udims, + PExpr*expr, LexicalScope::range_t*value_range); extern void pform_set_specparam(const struct vlltype&loc, perm_string name, std::list*range, @@ -520,7 +520,7 @@ extern PExpr* pform_genvar_compressed(const struct vlltype &loc, * parses the source file and places all the modules it finds into the * mod list. The dump function dumps a module to the output stream. */ -extern void pform_dump(std::ostream&out, Module*mod); +extern void pform_dump(std::ostream&out, const Module*mod); /* ** pform_discipline.cc * Functions for handling the parse of natures and disciplines. These @@ -554,10 +554,10 @@ extern AContrib*pform_contribution_statement(const struct vlltype&loc, PExpr*lval, PExpr*rval); extern PExpr* pform_make_branch_probe_expression(const struct vlltype&loc, - char*name, char*n1, char*n2); + const char*name, const char*n1, const char*n2); extern PExpr* pform_make_branch_probe_expression(const struct vlltype&loc, - char*name, char*branch); + const char*name, const char*branch); /* * Parse configuration file with format =, where key diff --git a/pform_analog.cc b/pform_analog.cc index b5058d655..c1e0c1775 100644 --- a/pform_analog.cc +++ b/pform_analog.cc @@ -1,5 +1,5 @@ /* - * 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 @@ -44,7 +44,7 @@ void pform_make_analog_behavior(const struct vlltype&loc, ivl_process_type_t pt, } PExpr* pform_make_branch_probe_expression(const struct vlltype&loc, - char*name, char*n1, char*n2) + const char*name, const char*n1, const char*n2) { vector parms (2); parms[0].parm = new PEIdent(lex_strings.make(n1), loc.lexical_pos); @@ -59,7 +59,7 @@ PExpr* pform_make_branch_probe_expression(const struct vlltype&loc, } PExpr* pform_make_branch_probe_expression(const struct vlltype&loc, - char*name, char*branch_name) + const char*name, const char*branch_name) { vector parms (1); parms[0].parm = new PEIdent(lex_strings.make(branch_name), loc.lexical_pos); diff --git a/pform_dump.cc b/pform_dump.cc index 13883775b..6dc130687 100644 --- a/pform_dump.cc +++ b/pform_dump.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 @@ -1811,7 +1811,7 @@ void Module::dump(ostream&out) const out << "endmodule" << endl; } -void pform_dump(ostream&out, Module*mod) +void pform_dump(ostream&out, const Module*mod) { mod->dump(out); } diff --git a/pform_package.cc b/pform_package.cc index 7e949f391..05c440751 100644 --- a/pform_package.cc +++ b/pform_package.cc @@ -229,7 +229,7 @@ void pform_package_export(const struct vlltype &loc, PPackage *pkg, const char * } PExpr* pform_package_ident(const struct vlltype&loc, - PPackage*pkg, pform_name_t*ident_name) + PPackage*pkg, const pform_name_t*ident_name) { ivl_assert(loc, ident_name); PEIdent*tmp = new PEIdent(pkg, *ident_name, loc.lexical_pos); diff --git a/syn-rules.y b/syn-rules.y index 201db1b63..3ce56c833 100644 --- a/syn-rules.y +++ b/syn-rules.y @@ -1,7 +1,7 @@ %{ /* - * 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 @@ -185,9 +185,9 @@ static syn_token_t*ptr_ = 0; */ struct tokenize : public proc_match_t { tokenize() { } - ~tokenize() { } + ~tokenize() override { } - int assign(NetAssign*dev) + int assign(NetAssign*dev) override { syn_token_t*cur; cur = new syn_token_t; @@ -202,7 +202,7 @@ struct tokenize : public proc_match_t { return 0; } - int assign_nb(NetAssignNB*dev) + int assign_nb(NetAssignNB*dev) override { syn_token_t*cur; cur = new syn_token_t; @@ -217,7 +217,7 @@ struct tokenize : public proc_match_t { return 0; } - int condit(NetCondit*dev) + int condit(NetCondit*dev) override { syn_token_t*cur; @@ -257,7 +257,7 @@ struct tokenize : public proc_match_t { return 0; } - int event_wait(NetEvWait*dev) + int event_wait(NetEvWait*dev) override { syn_token_t*cur; @@ -345,9 +345,9 @@ static int yylex() } struct syn_rules_f : public functor_t { - ~syn_rules_f() { } + ~syn_rules_f() override { } - void process(class Design*, class NetProcTop*top) + void process(class Design*, class NetProcTop*top) override { /* If the scope that contains this process as a cell attribute attached to it, then skip synthesis. */