Compare commits

...

16 Commits

Author SHA1 Message Date
Oscar Gustafsson a6a936cc55
Merge afc1b2a51b into a7502173d3 2025-10-29 12:20:33 +01:00
Cary R a7502173d3 Fix MSYS2 builds after cleanup 2025-10-25 11:09:39 -07:00
Cary R d697312cf8 Cleanup ivt casting for cppcheck 2025-10-25 10:54:12 -07:00
Martin Whitaker efb0ea2ec7 Try a different way to disable PLI1 in MSYS2 CLANG CI. 2025-10-25 15:54:50 +01:00
Martin Whitaker 70094ce564 Disable PLI1 support in MSYS2/CLANG CI. 2025-10-25 15:49:11 +01:00
Martin Whitaker e32584f228 Remove spurious space in MSYS2 PKGBUILD. 2025-10-25 15:23:12 +01:00
Martin Whitaker 9bf45a85e2 Fix errors in MSYS2 PKGBUILD. 2025-10-25 15:15:51 +01:00
Martin Whitaker 97da696b5a Add missing gperf dependency in MSYS2 PKGBUILD. 2025-10-25 14:33:22 +01:00
Martin Whitaker d392dcf07f Fix syntax error in github workflow. 2025-10-25 14:22:51 +01:00
Martin Whitaker e4b3f1bc69 Make MSYS2 build instructions more prominent in the documentation. 2025-10-25 14:16:00 +01:00
Martin Whitaker b69cb8efda Update documentation to describe the --enable-libveriuser config option.
Also fix a typo in the --with-valgrind description.
2025-10-25 14:16:00 +01:00
Martin Whitaker d766248bc1 Update CI to also test ucrt64 and clang64 builds in MSYS2. 2025-10-25 14:16:00 +01:00
Martin Whitaker 587d87bb96 Update MSYS2 PKGBUILD to support ucrt64 and clang64 as well as mingw64.
Also allow extra configuration options to be passed via the
IVL_CONFIG_OPTIONS environment variable and add some missing
dependencies. Don't include --enable-libveriuser by default.
Update the README accordingly, with sensible line wrapping.
2025-10-25 14:16:00 +01:00
Martin Whitaker da853622e9 Don't delete vvp/libvvp.h when running 'make clean'. 2025-10-25 14:16:00 +01:00
Cary R cc496c3cf3 More ivl cppcheck cleanup 2025-10-23 10:01:06 -07:00
Oscar Gustafsson afc1b2a51b Fix issues with waveform viewer documentation and mention Surfer 2025-07-06 12:47:35 +02:00
44 changed files with 358 additions and 292 deletions

6
.github/test.sh vendored
View File

@ -9,7 +9,11 @@ status=0
perl vvp_reg.pl || status=1
perl vpi_reg.pl --with-pli1 || status=1
if [ "x$1" = "xno-pli1" ] ; then
perl vpi_reg.pl || status=1
else
perl vpi_reg.pl --with-pli1 || status=1
fi
python3 vvp_reg.py || status=1

View File

@ -76,10 +76,11 @@ jobs:
strategy:
fail-fast: false
matrix:
include: [
{ msystem: MINGW64, arch: x86_64 }
]
name: 🟪 ${{ matrix.msystem}} · ${{ matrix.arch }}
include:
- { msystem: MINGW64, env: x86_64 }
- { msystem: UCRT64, env: ucrt-x86_64 }
- { msystem: CLANG64, env: clang-x86_64 }
name: 🟪 ${{ matrix.msystem}}
defaults:
run:
shell: msys2 {0}
@ -99,9 +100,8 @@ jobs:
install: >
git
base-devel
gperf
python-pip
mingw-w64-${{ matrix.arch }}-toolchain
mingw-w64-${{ matrix.env }}-perl
- uses: actions/setup-python@v5
with:
@ -110,6 +110,9 @@ jobs:
- name: Build and check
run: |
cd msys2
if [ ${{ matrix.msystem }} != "CLANG64" ] ; then
export IVL_CONFIG_OPTIONS="--enable-libveriuser"
fi
makepkg-mingw --noconfirm --noprogressbar -sCLf
- name: Install
@ -117,9 +120,13 @@ jobs:
- name: Test
run: |
./.github/test.sh
if [ ${{ matrix.msystem }} = "CLANG64" ] ; then
./.github/test.sh no-pli1
else
./.github/test.sh
fi
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.msystem }}-${{ matrix.arch }}
name: ${{ matrix.msystem }}
path: msys2/*.zst

View File

@ -103,6 +103,22 @@ reference the correct run time files and directories. The run time will check
that it is running a file with a compatible version e.g.(you can not run a
V0.9 file with the V0.8 run time).
.. code-block:: none
--enable-libvvp
The vvp progam is built as a small stub linked to a shared library,
libvvp.so, that may be linked with other programs so that they can host
a vvp simulation.
.. code-block:: none
--enable-libveriuser
PLI version 1 (the ACC and TF routines) were deprecated in IEEE 1364-2005.
These are supported in Icarus Verilog by the libveriuser library and cadpli
module. Starting with v13, these will only be built if this option is used.
A debug options is:
.. code-block:: none
@ -111,7 +127,7 @@ A debug options is:
This option adds extra memory cleanup code and pool management code to allow
better memory leak checking when valgrind is available. This option is not
need when checking for basic errors with valgrind.
needed when checking for basic errors with valgrind.
Compiling on Linux
------------------
@ -222,4 +238,3 @@ or the version branch that you are working on. Your pull request will be run
through continuous integration, and reviewed by one of the main
authors. Feedback may be offered to your PR, and once accepted, an approved
individual will merge it for you. Then you are done.

View File

@ -18,7 +18,7 @@ This section contains documents to help support Icarus Verilog users.
vvp_debug
vvp_library
vhdlpp_flags
gtkwave
waveform_viewer
vpi
icarus_verilog_extensions
icarus_verilog_quirks

View File

@ -99,13 +99,19 @@ time). ::
This option adds extra memory cleanup code and pool management code to allow
better memory leak checking when valgrind is available. This option is not
need when checking for basic errors with valgrind. ::
needed when checking for basic errors with valgrind. ::
--enable-libvvp
The vvp progam is built as a small stub linked to a shared library,
libvvp.so, that may be linked with other programs so that they can host
a vvp simulation.
a vvp simulation. ::
--enable-libveriuser
PLI version 1 (the ACC and TF routines) were deprecated in IEEE 1364-2005.
These are supported in Icarus Verilog by the libveriuser library and cadpli
module. Starting with v13, these will only be built if this option is used.
Compiling on Linux/Unix
-----------------------
@ -151,8 +157,8 @@ be updated to version 3. ::
Icarus Verilog is also available through the Homebrew package manager: "brew
install icarus-verilog".
Compiling for Windows
---------------------
Cross-Compiling for Windows
---------------------------
These are instructions for building Icarus Verilog binaries for
Windows using mingw cross compiler tools on Linux.
@ -180,4 +186,8 @@ bits that need to be compiled with the native compiler. (version.exe
for example is used by the build process but is not installed.) The
configure script should have gotten all that right.
There is also a MSYS2 build recipe which you can find under `msys2/` in the repository.
Compiling for Windows using MSYS2
---------------------------------
There is a MSYS2 build recipe which you can find under `msys2/` in the
repository. The accompanying README file provides further details.

View File

@ -105,7 +105,7 @@ behavior.
* -fst
Generate FST format outputs instead of VCD format waveform dumps. This is
the preferred output format if using GTKWave for viewing waveforms.
the preferred output format if using GTKWave or Surfer for viewing waveforms.
* -lxt/-lxt2

View File

@ -1,20 +1,31 @@
Waveforms With GTKWave
======================
Viewing Waveforms
=================
GTKWave is a VCD waveform viewer based on the GTK library. This viewer support
VCD and LXT formats for signal dumps. GTKWAVE is available on github
To view waveforms, either GTKWave or Surfer can be used.
GTKWave is a waveform viewer based on the GTK library. This viewer supports
VCD, FST, LXT, and LXT2 formats for waveform dumps. GTKWave is available on GitHub
`here <https://github.com/gtkwave/gtkwave>`_. Most Linux distributions already
include gtkwave prepackaged.
include gtkwave prepackaged and there are binaries for Windows available.
.. image:: GTKWave_Example2.png
Generating VCD/FST files for GTKWAVE ------------------------------------
Surfer is a waveform viewer based on the Rust egui library. This viewer supports
VCD and FST formats for waveform dumps. Surfer is available on GitLab
`here <https://gitlab.com/surfer-project/surfer>`_. It runs on Windows, Linux,
and MacOS, but can also run in a `web browser <https://app.surfer-project.org/>`_
and there is a VS Code
`extension <https://marketplace.visualstudio.com/items?itemName=surfer-project.surfer>`_.
Generating waveform dump files for viewing
------------------------------------------
Waveform dumps are written by the Icarus Verilog runtime program vvp. The user
uses $dumpfile and $dumpvars system tasks to enable waveform dumping, then the
vvp runtime takes care of the rest. The output is written into the file
specified by the $dumpfile system task. If the $dumpfile call is absent, the
compiler will choose the file name dump.vcd or dump.lxt or dump.fst, depending
compiler will choose the file name dump.vcd, dump.lxt, or dump.fst, depending
on runtime flags. The example below dumps everything in and below the test
module:
@ -30,9 +41,9 @@ module:
By default, the vvp runtime will generate VCD dump output. This is the default
because it is the most portable. However, when using gtkwave, the FST output
format is faster and most compact. Use the "-fst" extended argument to
activate LXT output. For example, if your compiled output is written into the
file "foo.vvp", the command:
format is faster and most compact. Use the "-fst", "-lxt", or "-lxt2" extended
argument to activate FST, LXT, or LXT2 output, respectively. For example, if
your compiled output is written into the file "foo.vvp", the command:
.. code-block:: console
@ -40,7 +51,7 @@ file "foo.vvp", the command:
will cause the dumpfile output to be written in FST format. Absent any
specific $dumpfile command, this file will be called dump.fst, which can be
viewed with the command:
viewed with GTKWave using the command:
.. code-block:: console
@ -105,7 +116,7 @@ Then the simulation file:
$time, value, value);
endmodule // test
Compile, run, and view waveforms with these commands:
Compile, run, and view waveforms with GTKWave using these commands:
.. code-block:: console
@ -113,6 +124,6 @@ Compile, run, and view waveforms with these commands:
% vvp dsn
% gtkwave test.vcd &
Click on the 'test', then 'c1' in the top left box on GTKWAVE, then drag the
Click on the 'test', then 'c1' in the top left box of GTKWave, then drag the
signals to the Signals box. You will be able to add signals to display,
scanning by scope.

18
PExpr.h
View File

@ -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<long>&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<NetExpr*>&parms,
unsigned parm_off) const;
const NetFuncDef*def, bool need_const,
std::vector<NetExpr*>&parms,
unsigned parm_off) const;
};
/*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2025 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* 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<PExpr*>*pins,
list<PExpr*>*del)
const list<PExpr*>*del)
: PGate(name, pins, del), type_(t)
{
}

View File

@ -159,7 +159,7 @@ class PGBuiltin : public PGate {
public:
explicit PGBuiltin(Type t, perm_string name,
std::list<PExpr*>*pins,
std::list<PExpr*>*del);
const std::list<PExpr*>*del);
explicit PGBuiltin(Type t, perm_string name,
std::list<PExpr*>*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;

View File

@ -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::vector<PEEvent*>expr_;

View File

@ -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<NetExpr*>&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<long>&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<const NetEConst*> (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)

View File

@ -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);

View File

@ -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<long> prefix_indices;

View File

@ -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);

View File

@ -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;

View File

@ -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) <noop>;
*/
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<NetECReal*>(cur)) {
} else if (const NetECReal*rcon = dynamic_cast<NetECReal*>(cur)) {
delay_value[idx] = get_scaled_time_from_real(des, scope,
rcon);

View File

@ -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<NetEConst*> (left)) {
} else if (const NetEConst*tmpc = dynamic_cast<NetEConst*> (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<NetEConst*> (right)) {
} else if (const NetEConst*tmpc = dynamic_cast<NetEConst*> (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;

View File

@ -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;

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 Lars-Peter Clausen <lars@metafoo.de>
// SPDX-FileCopyrightText: 2023-2025 Lars-Peter Clausen <lars@metafoo.de>
// SPDX-License-Identifier: GPL-2.0-or-later
#include "PExpr.h"
@ -62,7 +62,7 @@ std::vector<PExpr*> map_named_args(Design *des,
return args;
}
std::vector<PExpr*> map_named_args(Design *des, NetBaseDef *def,
std::vector<PExpr*> map_named_args(Design *des, const NetBaseDef *def,
const std::vector<named_pexpr_t> &parms,
unsigned int off)
{

View File

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2023 Lars-Peter Clausen <lars@metafoo.de>
// SPDX-FileCopyrightText: 2023-2025 Lars-Peter Clausen <lars@metafoo.de>
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef MAP_NAMED_ARGS_H
@ -15,7 +15,7 @@ std::vector<PExpr*> map_named_args(Design *des,
const std::vector<perm_string> &names,
const std::vector<named_pexpr_t> &parms);
std::vector<PExpr*> map_named_args(Design *des, NetBaseDef *def,
std::vector<PExpr*> map_named_args(Design *des, const NetBaseDef *def,
const std::vector<named_pexpr_t> &parms,
unsigned int off);

View File

@ -1,17 +1,21 @@
_realname=iverilog
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=ci
pkgver=devel
pkgrel=1
pkgdesc="Icarus Verilog, a Verilog simulation and synthesis tool (mingw-w64)"
pkgdesc="Icarus Verilog, a Verilog simulation tool (mingw-w64)"
arch=('any')
mingw_arch=('mingw64', 'ucrt64', 'clang64')
url="https://steveicarus.github.io/iverilog/"
license=('GPLv2+')
depends=("${MINGW_PACKAGE_PREFIX}-readline"
"${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("autoconf"
license=('spdx:GPL-2.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
"${MINGW_PACKAGE_PREFIX}-readline"
"${MINGW_PACKAGE_PREFIX}-bzip2"
"${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("gperf"
"man-db"
"${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-ghostscript")
source=()
@ -21,18 +25,17 @@ build() {
cd "${srcdir}"/../..
sh autoconf.sh
./configure \
--enable-libveriuser \
--prefix="${MINGW_PREFIX}" \
--host="$CARCH"-w64-mingw32
mingw32-make
${IVL_CONFIG_OPTIONS}
make
}
check() {
cd "${srcdir}"/../..
mingw32-make check
make check
}
package() {
cd "${srcdir}"/../..
mingw32-make DESTDIR="${pkgdir}" PACKAGE="${_realname}" install
make DESTDIR="${pkgdir}" PACKAGE="${_realname}" install
}

View File

@ -1,29 +1,53 @@
# MSYS2 build recipe
This subdir contains a [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) recipe for building iverilog on [MSYS2](https://www.msys2.org/). MSYS2 is a collection of tools and libraries for Windows, which is closely based on the packaging approach in [Arch Linux](https://www.archlinux.org/). Precisely, the package manager in MSYS2 is a port of [pacman](https://wiki.archlinux.org/index.php/pacman). Therefore, the structure of PKGBUILD recipes in MSYS2 is very similar to packages in Arch Linux and the build script (`makepkg-mingw`) is a port of [makepkg](https://wiki.archlinux.org/index.php/makepkg).
This directory contains a [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD)
recipe for building Icarus Verilog in [MSYS2](https://www.msys2.org/). MSYS2
is a collection of tools and libraries for Windows that is closely based on
the packaging approach in [Arch Linux](https://www.archlinux.org/). The package
manager in MSYS2 is a port of [pacman](https://wiki.archlinux.org/index.php/pacman).
Therefore the structure of PKGBUILD recipes in MSYS2 is very similar to that in
Arch Linux and the build script (`makepkg-mingw`) is a port of
[makepkg](https://wiki.archlinux.org/index.php/makepkg).
Other than that, PKGBUILD files are shell scripts containing some specific functions (build, package, check, etc.) and metadata (variables). The build system takes care of dependencies, creating temporary directories, generating a tarball, etc. Therefore, the recommended approach for building iverilog on Windows is the following:
Other than that, PKGBUILD files are shell scripts containing some specific
functions (build, package, check, etc.) and metadata (variables). The build
system takes care of dependencies, creating temporary directories, generating
a tarball, etc. Therefore, the recommended approach for building Icarus Verilog
on Windows is the following:
```sh
# Install the toolchain
pacman -S mingw-w64-x86_64-toolchain
# and/or mingw-w64-i686-toolchain
# Install the base development tools
pacman -S base-devel
# Retrieve iverilog sources. Optionally, retrieve a tarball, or an specific branch/version.
# Retrieve the Icarus Verilog sources. Optionally, retrieve a tarball, or a
# specific branch/version.
git clone https://github.com/steveicarus/iverilog
cd iverilog
# Call makepkg-mingw from subdir 'msys2'. It will build, check and package iverilog.
# Call makepkg-mingw from the directory 'msys2'. It will install dependencies,
# build, check, and package Icarus Verilog.
cd msys2
MINGW_INSTALLS=mingw64 makepkg-mingw --noconfirm --noprogressbar -sCLf
# or, set the envvar to 'mingw32', or unset it for building both packages at the same time
makepkg-mingw --noconfirm --noprogressbar -sCLf
# Optionally, install the tarball(s)/package(s). Or just distribute it/them.
pacman -U --noconfirm *.zst
```
NOTE: the continuous integration workflow in [github.com/steveicarus](https://github.com/steveicarus) uses the procedure above for building iverilog on MINGW32 and MINGW64 each time a commit is pushed or a Pull Request is updated. The two generated packages are uploaded as artifacts. Hence, users willing to test *nightly* builds or specific features, can download and install the tarballs from the corresponding CI run.
Additional configuration options can be passed to the configuration step
by setting the environment variable `IVL_CONFIG_OPTIONS` before calling
`makepkg-mingw`, e.g.
```sh
export IVL_CONFIG_OPTIONS=-"-enable-suffix=-devel --enable-libvvp"
```
Nevertheless, the content of functions `build` and `check` in the PKGBUILD file should be familiar for any user willing to build iverilog *manually*. Those can be executed in a shell (ignoring makepkg), as long as the few envvars are properly defined.
NOTE: the continuous integration workflow in [github.com/steveicarus/iverilog]
(https://github.com/steveicarus/iverilog) uses the above procedure for building
Icarus Verilog for Windows each time a commit is pushed or a pull request is
updated. The generated packages are uploaded as artifacts. Hence, users willing
to test *development* builds or specific features, can download and install the
tarballs from the corresponding CI run.
HINT: this document explains the most straightforward and automatec solution for building iverilog on Windows. However, intermediate and advanced users might want to check [iverilog.fandom.com/wiki/Installation_using_MSYS2](https://iverilog.fandom.com/wiki/Installation_using_MSYS2) for some specific tweaks, such as using a custom prefix for iverilog executables, or using MSYS2 packages/tarballs outside of MSYS2.
Nevertheless, the content of functions `build` and `check` in the PKGBUILD file
should be familiar to any user willing to build iverilog *manually*. Those can
be executed in a shell (ignoring makepkg), as long as the few environment
variables are properly defined.

View File

@ -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);

View File

@ -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();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* 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);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2024 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* Copyright (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());
}

View File

@ -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<const NetESignal*>(left);
const NetESignal*rsig = dynamic_cast<const NetESignal*>(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<const NetECast*>(expr)) {
expr = tmp->expr();
@ -3355,7 +3355,7 @@ static void check_for_bstep_synth(const NetExpr*expr, const NetProc*proc,
}
static void check_for_step_synth(const NetAssign*assign, const NetProc*proc,
ivl_process_type_t pr_type, NetNet*index)
ivl_process_type_t pr_type, const NetNet*index)
{
if (assign->l_val_count() != 1) {
print_for_step_warning(proc, pr_type);

View File

@ -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<perm_string,LocalVar>&ctx,
const NetAssign_*lval, NetExpr*rval_result) const;

View File

@ -543,7 +543,7 @@ static void make_strides(const netranges_t&dims, vector<long>&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<long>&indices)
static NetExpr* normalize_variable_unpacked(const netranges_t&dims, const list<long>&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<long>&i
return canonical_expr;
}
NetExpr* normalize_variable_unpacked(const NetNet*net, list<long>&indices)
NetExpr* normalize_variable_unpacked(const NetNet*net, const list<long>&indices)
{
const netranges_t&dims = net->unpacked_dims();
return normalize_variable_unpacked(dims, indices);
}
NetExpr* normalize_variable_unpacked(const netsarray_t*stype, list<long>&indices)
NetExpr* normalize_variable_unpacked(const netsarray_t*stype, const list<long>&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<NetExpr*>&indices)
NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netranges_t&dims, const list<NetExpr*>&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<NetExpr*>&indices)
NetExpr* normalize_variable_unpacked(const NetNet*net, const list<NetExpr*>&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<NetExpr*>&indices)
NetExpr* normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*stype, const list<NetExpr*>&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<index_component_t>&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<index_component_t>&indices)
{
list<long>prefix_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;

View File

@ -271,11 +271,11 @@ extern void indices_to_expressions(Design*des, NetScope*scope,
indices_flags&flags,
std::list<NetExpr*>&indices,std::list<long>&indices_const);
extern NetExpr*normalize_variable_unpacked(const NetNet*net, std::list<long>&indices);
extern NetExpr*normalize_variable_unpacked(const netsarray_t*net, std::list<long>&indices);
extern NetExpr*normalize_variable_unpacked(const NetNet*net, const std::list<long>&indices);
extern NetExpr*normalize_variable_unpacked(const netsarray_t*net, const std::list<long>&indices);
extern NetExpr*normalize_variable_unpacked(const NetNet*net, std::list<NetExpr*>&indices);
extern NetExpr*normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*net, std::list<NetExpr*>&indices);
extern NetExpr*normalize_variable_unpacked(const NetNet*net, const std::list<NetExpr*>&indices);
extern NetExpr*normalize_variable_unpacked(const LineInfo&loc, const netsarray_t*net, const std::list<NetExpr*>&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<long>&prefix_indices,
const std::list<index_component_t>&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<index_component_t>&indices);
extern NetExpr*collapse_array_exprs(Design*des, NetScope*scope,
const LineInfo*loc, NetNet*net,
const LineInfo*loc, const NetNet*net,
const std::list<index_component_t>&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 */

View File

@ -268,7 +268,7 @@ static std::list<named_pexpr_t>* 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;

View File

@ -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<PExpr*>*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<pform_range_t> *indices)
NetNet::Type type, const std::list<pform_range_t> *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<pform_range_t>*udims,
data_type_t*data_type, const list<pform_range_t>*udims,
PExpr*expr, LexicalScope::range_t*value_range)
{
LexicalScope*scope = lexical_scope;

26
pform.h
View File

@ -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<PExpr*>*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<pform_range_t> *indices);
const std::list<pform_range_t> *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<pform_range_t>*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<pform_range_t>*udims,
PExpr*expr, LexicalScope::range_t*value_range);
extern void pform_set_specparam(const struct vlltype&loc,
perm_string name,
std::list<pform_range_t>*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 <key>=<value>, where key

View File

@ -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<named_pexpr_t> 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<named_pexpr_t> parms (1);
parms[0].parm = new PEIdent(lex_strings.make(branch_name), loc.lexical_pos);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2024 Stephen Williams (steve@icarus.com)
* Copyright (c) 1998-2025 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* 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);
}

View File

@ -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);

View File

@ -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. */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008-2010 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
@ -34,8 +34,8 @@ bool dll_target::process(const NetAnalogTop*net)
{
bool rc_flag = true;
ivl_process_t obj = (struct ivl_process_s*)
calloc(1, sizeof(struct ivl_process_s));
ivl_process_t obj = static_cast<struct ivl_process_s*>
(calloc(1, sizeof(struct ivl_process_s)));
obj->type_ = net->type();
obj->analog_flag = 1;
@ -49,7 +49,7 @@ bool dll_target::process(const NetAnalogTop*net)
obj->attr = fill_in_attributes(net);
assert(stmt_cur_ == 0);
stmt_cur_ = (struct ivl_statement_s*)calloc(1, sizeof*stmt_cur_);
stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_));
rc_flag = net->statement()->emit_proc(this) && rc_flag;
assert(stmt_cur_);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2024 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
* Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch)
*
@ -317,7 +317,7 @@ extern "C" const char* ivl_event_name(ivl_event_t net)
unsigned need = strlen(sn) + 1 + strlen(net->name) + 1;
if (need > name_size) {
name_buffer = (char*)realloc(name_buffer, need);
name_buffer = static_cast<char*>(realloc(name_buffer, need));
name_size = need;
}
@ -1379,7 +1379,7 @@ extern "C" const char* ivl_lpm_name(ivl_lpm_t net)
unsigned need = strlen(sn) + 1 + strlen(net->name) + 1;
if (need > name_size) {
name_buffer = (char*)realloc(name_buffer, need);
name_buffer = static_cast<char*>(realloc(name_buffer, need));
name_size = need;
}
@ -1768,7 +1768,7 @@ extern "C" const char* ivl_nexus_name(ivl_nexus_t net)
assert(net);
if (net->name_ == 0) {
char tmp[2 * sizeof(net) + 5];
snprintf(tmp, sizeof tmp, "n%p", (void *)net);
snprintf(tmp, sizeof tmp, "n%p", static_cast<void *>(net));
net->name_ = api_strings.add(tmp);
}
return net->name_;
@ -2257,11 +2257,10 @@ extern "C" const char* ivl_scope_name(ivl_scope_t net)
unsigned needlen = scope_name_len(net);
if (name_size < needlen) {
name_buffer = (char*)realloc(name_buffer, needlen);
name_buffer = static_cast<char*>(realloc(name_buffer, needlen));
name_size = needlen;
}
push_scope_basename(net, name_buffer);
return name_buffer;
@ -2478,7 +2477,7 @@ extern "C" const char* ivl_signal_name(ivl_signal_t net)
needlen += strlen(net->name_) + 2;
if (name_size < needlen) {
name_buffer = (char*)realloc(name_buffer, needlen);
name_buffer = static_cast<char*>(realloc(name_buffer, needlen));
name_size = needlen;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2021 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -57,14 +57,14 @@ void dll_target::sub_off_from_expr_(long off)
assert(expr_ != 0);
char*bits;
ivl_expr_t tmpc = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t tmpc = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
tmpc->type_ = IVL_EX_NUMBER;
tmpc->value_ = IVL_VT_VECTOR;
tmpc->net_type= 0;
tmpc->width_ = expr_->width_;
tmpc->signed_ = expr_->signed_;
tmpc->sized_ = 1;
tmpc->u_.number_.bits_ = bits = (char*)malloc(tmpc->width_);
tmpc->u_.number_.bits_ = bits = static_cast<char*>(malloc(tmpc->width_));
for (unsigned idx = 0 ; idx < tmpc->width_ ; idx += 1) {
bits[idx] = (off & 1)? '1' : '0';
off >>= 1;
@ -73,7 +73,7 @@ void dll_target::sub_off_from_expr_(long off)
/* Now make the subtracter (x-4 in the above example)
that has as input A the index expression and input B
the constant to subtract. */
ivl_expr_t tmps = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t tmps = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
tmps->type_ = IVL_EX_BINARY;
tmps->value_ = IVL_VT_VECTOR;
tmps->net_type= 0;
@ -93,14 +93,14 @@ void dll_target::mul_expr_by_const_(long val)
assert(expr_ != 0);
char*bits;
ivl_expr_t tmpc = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t tmpc = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
tmpc->type_ = IVL_EX_NUMBER;
tmpc->value_ = IVL_VT_VECTOR;
tmpc->net_type= 0;
tmpc->width_ = expr_->width_;
tmpc->signed_ = expr_->signed_;
tmpc->sized_ = 1;
tmpc->u_.number_.bits_ = bits = (char*)malloc(tmpc->width_);
tmpc->u_.number_.bits_ = bits = static_cast<char*>(malloc(tmpc->width_));
for (unsigned idx = 0 ; idx < tmpc->width_ ; idx += 1) {
bits[idx] = (val & 1)? '1' : '0';
val >>= 1;
@ -109,7 +109,7 @@ void dll_target::mul_expr_by_const_(long val)
/* Now make the subtracter (x-4 in the above example)
that has as input A the index expression and input B
the constant to subtract. */
ivl_expr_t tmps = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t tmps = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
tmps->type_ = IVL_EX_BINARY;
tmps->value_ = IVL_VT_VECTOR;
tmpc->net_type= 0;
@ -126,7 +126,7 @@ void dll_target::mul_expr_by_const_(long val)
ivl_expr_t dll_target::expr_from_value_(const verinum&val)
{
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t expr = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
unsigned idx;
char*bits;
@ -136,7 +136,7 @@ ivl_expr_t dll_target::expr_from_value_(const verinum&val)
expr->width_= val.len();
expr->signed_ = val.has_sign()? 1 : 0;
expr->sized_= 1;
expr->u_.number_.bits_ = bits = (char*)malloc(expr->width_ + 1);
expr->u_.number_.bits_ = bits = static_cast<char*>(malloc(expr->width_ + 1));
for (idx = 0 ; idx < expr->width_ ; idx += 1)
switch (val.get(idx)) {
case verinum::V0:
@ -164,7 +164,7 @@ void dll_target::expr_access_func(const NetEAccess*net)
{
assert(expr_ == 0);
// Make a stub Branch Access Function expression node.
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_BACCESS;
expr_->value_ = IVL_VT_REAL;
expr_->net_type=0;
@ -180,7 +180,7 @@ void dll_target::expr_access_func(const NetEAccess*net)
void dll_target::expr_array_pattern(const NetEArrayPattern*net)
{
assert(expr_ == 0);
ivl_expr_t expr_tmp = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t expr_tmp = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_tmp->type_ = IVL_EX_ARRAY_PATTERN;
expr_tmp->value_= net->expr_type();
expr_tmp->net_type = net->net_type();
@ -213,7 +213,7 @@ void dll_target::expr_binary(const NetEBinary*net)
net->right()->expr_scan(this);
ivl_expr_t rght = expr_;
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_BINARY;
expr_->value_= get_expr_type(net);
@ -261,7 +261,7 @@ void dll_target::expr_const(const NetEConst*net)
{
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->value_= net->expr_type();
expr_->net_type=0;
FILE_NAME(expr_, net);
@ -279,7 +279,7 @@ void dll_target::expr_const(const NetEConst*net)
expr_->width_= net->expr_width();
expr_->signed_ = net->has_sign()? 1 : 0;
expr_->sized_= net->has_width()? 1 : 0;
expr_->u_.number_.bits_ = bits = (char*)malloc(expr_->width_);
expr_->u_.number_.bits_ = bits = static_cast<char*>(malloc(expr_->width_));
for (idx = 0 ; idx < expr_->width_ ; idx += 1)
switch (val.get(idx)) {
case verinum::V0:
@ -334,7 +334,7 @@ void dll_target::expr_rparam(const NetECRealParam*net)
void dll_target::expr_creal(const NetECReal*net)
{
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->width_ = net->expr_width();
expr_->signed_ = 1;
expr_->sized_ = 1;
@ -396,7 +396,7 @@ void dll_target::expr_new(const NetENew*net)
}
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->width_ = net->expr_width();
expr_->signed_ = 0;
expr_->sized_ = 1;
@ -411,7 +411,7 @@ void dll_target::expr_new(const NetENew*net)
void dll_target::expr_null(const NetENull*net)
{
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->width_ = net->expr_width();
expr_->signed_ = 0;
expr_->sized_ = 1;
@ -430,7 +430,7 @@ void dll_target::expr_property(const NetEProperty*net)
expr_ = 0;
}
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->width_ = net->expr_width();
expr_->signed_ = net->has_sign();
expr_->sized_ = 1;
@ -447,7 +447,7 @@ void dll_target::expr_event(const NetEEvent*net)
{
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_EVENT;
FILE_NAME(expr_, net);
@ -472,7 +472,7 @@ void dll_target::expr_scope(const NetEScope*net)
{
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_SCOPE;
FILE_NAME(expr_, net);
@ -493,7 +493,7 @@ void dll_target::expr_scopy(const NetEShallowCopy*net)
ivl_expr_t expr2 = expr_;
expr_ = 0;
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_SHALLOWCOPY;
FILE_NAME(expr_, net);
expr_->value_ = net->expr_type();
@ -507,7 +507,7 @@ void dll_target::expr_netenum(const NetENetenum*net)
{
assert(expr_ == 0);
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_ENUMTYPE;
FILE_NAME(expr_, net);
@ -529,7 +529,7 @@ void dll_target::expr_select(const NetESelect*net)
ivl_expr_t base = expr_;
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_SELECT;
expr_->value_= net->expr_type();
@ -548,7 +548,7 @@ void dll_target::expr_sfunc(const NetESFunc*net)
{
assert(expr_ == 0);
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t expr = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr->type_ = IVL_EX_SFUNC;
expr->value_= net->expr_type();
@ -579,7 +579,7 @@ void dll_target::expr_ternary(const NetETernary*net)
{
assert(expr_ == 0);
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t expr = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr->type_ = IVL_EX_TERNARY;
expr->value_= net->expr_type();
@ -621,7 +621,7 @@ void dll_target::expr_signal(const NetESignal*net)
expr_ = 0;
}
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_SIGNAL;
expr_->value_= net->expr_type();
@ -649,7 +649,7 @@ void dll_target::expr_ufunc(const NetEUFunc*net)
{
assert(expr_ == 0);
ivl_expr_t expr = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
ivl_expr_t expr = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr->type_ = IVL_EX_UFUNC;
expr->value_= net->expr_type();
@ -692,7 +692,7 @@ void dll_target::expr_unary(const NetEUnary*net)
ivl_expr_t sub = expr_;
expr_ = (ivl_expr_t)calloc(1, sizeof(struct ivl_expr_s));
expr_ = static_cast<ivl_expr_t>(calloc(1, sizeof(struct ivl_expr_s)));
expr_->type_ = IVL_EX_UNARY;
expr_->value_= net->expr_type();
expr_->net_type=0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -36,8 +36,8 @@ bool dll_target::process(const NetProcTop*net)
{
bool rc_flag = true;
ivl_process_t obj = (struct ivl_process_s*)
calloc(1, sizeof(struct ivl_process_s));
ivl_process_t obj = static_cast<struct ivl_process_s*>
(calloc(1, sizeof(struct ivl_process_s)));
obj->type_ = net->type();
obj->analog_flag = 0;
@ -61,7 +61,7 @@ bool dll_target::process(const NetProcTop*net)
statement back. The asserts check these conditions. */
assert(stmt_cur_ == 0);
stmt_cur_ = (struct ivl_statement_s*)calloc(1, sizeof*stmt_cur_);
stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_));
rc_flag = net->statement()->emit_proc(this) && rc_flag;
assert(stmt_cur_);
@ -83,7 +83,7 @@ void dll_target::task_def(const NetScope*net)
assert(def);
assert(def->proc());
assert(stmt_cur_ == 0);
stmt_cur_ = (struct ivl_statement_s*)calloc(1, sizeof*stmt_cur_);
stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_));
def->proc()->emit_proc(this);
assert(stmt_cur_);
@ -107,7 +107,7 @@ bool dll_target::func_def(const NetScope*net)
assert(def);
assert(def->proc());
assert(stmt_cur_ == 0);
stmt_cur_ = (struct ivl_statement_s*)calloc(1, sizeof*stmt_cur_);
stmt_cur_ = static_cast<struct ivl_statement_s*>(calloc(1, sizeof*stmt_cur_));
def->proc()->emit_proc(this);
assert(stmt_cur_);
@ -315,8 +315,8 @@ void dll_target::proc_assign_nb(const NetAssignNB*net)
if (net->nevents() > 0) {
stmt_cur_->u_.assign_.nevent = net->nevents();
if (net->nevents() > 1) {
stmt_cur_->u_.assign_.events = (ivl_event_t*)
calloc(net->nevents(), sizeof(ivl_event_t*));
stmt_cur_->u_.assign_.events = static_cast<ivl_event_t*>
(calloc(net->nevents(), sizeof(ivl_event_t*)));
}
for (unsigned edx = 0 ; edx < net->nevents() ; edx += 1) {
@ -377,10 +377,9 @@ void dll_target::proc_assign_nb(const NetAssignNB*net)
break;
}
for (unsigned bit = 0; bit < pr->pin_count();
bit += 1) {
ivl_nexus_t nex = (ivl_nexus_t)
pr->pin(bit).nexus()->t_cookie();
for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) {
ivl_nexus_t nex = static_cast<ivl_nexus_t>
(pr->pin(bit).nexus()->t_cookie());
assert(nex);
ev_tmp->pins[base+bit] = nex;
}
@ -436,8 +435,8 @@ bool dll_target::proc_block(const NetBlock*net)
break;
}
stmt_cur_->u_.block_.nstmt_ = count;
stmt_cur_->u_.block_.stmt_ = (struct ivl_statement_s*)
calloc(count, sizeof(struct ivl_statement_s));
stmt_cur_->u_.block_.stmt_ = static_cast<struct ivl_statement_s*>
(calloc(count, sizeof(struct ivl_statement_s)));
if (net->subscope())
stmt_cur_->u_.block_.scope = lookup_scope_(net->subscope());
@ -566,8 +565,8 @@ bool dll_target::proc_condit(const NetCondit*net)
FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_CONDIT;
stmt_cur_->u_.condit_.stmt_ = (struct ivl_statement_s*)
calloc(2, sizeof(struct ivl_statement_s));
stmt_cur_->u_.condit_.stmt_ = static_cast<struct ivl_statement_s*>
(calloc(2, sizeof(struct ivl_statement_s)));
assert(expr_ == 0);
net->expr()->expr_scan(this);
@ -617,8 +616,8 @@ bool dll_target::proc_delay(const NetPDelay*net)
assert(stmt_cur_->type_ == IVL_ST_NONE);
FILE_NAME(stmt_cur_, net);
ivl_statement_t tmp = (struct ivl_statement_s*)
calloc(1, sizeof(struct ivl_statement_s));
ivl_statement_t tmp = static_cast<struct ivl_statement_s*>
(calloc(1, sizeof(struct ivl_statement_s)));
if (const NetExpr*expr = net->expr()) {
@ -675,8 +674,8 @@ void dll_target::proc_do_while(const NetDoWhile*net)
FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_DO_WHILE;
stmt_cur_->u_.while_.stmt_ = (struct ivl_statement_s*)
calloc(1, sizeof(struct ivl_statement_s));
stmt_cur_->u_.while_.stmt_ = static_cast<struct ivl_statement_s*>
(calloc(1, sizeof(struct ivl_statement_s)));
assert(expr_ == 0);
net->expr()->expr_scan(this);
@ -721,8 +720,8 @@ void dll_target::proc_forever(const NetForever*net)
stmt_cur_->type_ = IVL_ST_FOREVER;
ivl_statement_t tmp = (struct ivl_statement_s*)
calloc(1, sizeof(struct ivl_statement_s));
ivl_statement_t tmp = static_cast<struct ivl_statement_s*>
(calloc(1, sizeof(struct ivl_statement_s)));
ivl_statement_t save_cur_ = stmt_cur_;
stmt_cur_ = tmp;
@ -747,7 +746,7 @@ bool dll_target::proc_forloop(const NetForLoop*net)
// Note that the init statement is optional. If it is not present,
// then the emit_recurse_init will not generate a statement.
tmp = (struct ivl_statement_s*)calloc(1, sizeof(struct ivl_statement_s));
tmp = static_cast<struct ivl_statement_s*> (calloc(1, sizeof(struct ivl_statement_s)));
stmt_cur_ = tmp;
rc = net->emit_recurse_init(this);
if (stmt_cur_->type_ != IVL_ST_NONE)
@ -758,13 +757,13 @@ bool dll_target::proc_forloop(const NetForLoop*net)
}
res = res && rc;
tmp = (struct ivl_statement_s*)calloc(1, sizeof(struct ivl_statement_s));
tmp = static_cast<struct ivl_statement_s*>(calloc(1, sizeof(struct ivl_statement_s)));
stmt_cur_ = tmp;
rc = net->emit_recurse_stmt(this);
save_cur_->u_.forloop_.stmt = stmt_cur_;
res = res && rc;
tmp = (struct ivl_statement_s*)calloc(1, sizeof(struct ivl_statement_s));
tmp = static_cast<struct ivl_statement_s*>(calloc(1, sizeof(struct ivl_statement_s)));
stmt_cur_ = tmp;
rc = net->emit_recurse_step(this);
if (stmt_cur_->type_ != IVL_ST_NONE)
@ -822,8 +821,8 @@ void dll_target::proc_repeat(const NetRepeat*net)
stmt_cur_->u_.while_.cond_ = expr_;
expr_ = 0;
ivl_statement_t tmp = (struct ivl_statement_s*)
calloc(1, sizeof(struct ivl_statement_s));
ivl_statement_t tmp = static_cast<struct ivl_statement_s*>
(calloc(1, sizeof(struct ivl_statement_s)));
ivl_statement_t save_cur_ = stmt_cur_;
stmt_cur_ = tmp;
@ -846,8 +845,8 @@ void dll_target::proc_stask(const NetSTask*net)
stmt_cur_->u_.stask_.name_ = net->name();
stmt_cur_->u_.stask_.sfunc_as_task_ = net->sfunc_as_task();
stmt_cur_->u_.stask_.nparm_= nparms;
stmt_cur_->u_.stask_.parms_= (ivl_expr_t*)
calloc(nparms, sizeof(ivl_expr_t));
stmt_cur_->u_.stask_.parms_= static_cast<ivl_expr_t*>
(calloc(nparms, sizeof(ivl_expr_t)));
for (unsigned idx = 0 ; idx < nparms ; idx += 1) {
if (net->parm(idx))
@ -933,8 +932,8 @@ bool dll_target::proc_wait(const NetEvWait*net)
FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_WAIT;
stmt_cur_->u_.wait_.stmt_ = (struct ivl_statement_s*)
calloc(1, sizeof(struct ivl_statement_s));
stmt_cur_->u_.wait_.stmt_ = static_cast<struct ivl_statement_s*>
(calloc(1, sizeof(struct ivl_statement_s)));
stmt_cur_->u_.wait_.nevent = net->nevents();
@ -951,8 +950,8 @@ bool dll_target::proc_wait(const NetEvWait*net)
// This event processing code is also in the NB assign above.
if (net->nevents() > 1) {
stmt_cur_->u_.wait_.events = (ivl_event_t*)
calloc(net->nevents(), sizeof(ivl_event_t*));
stmt_cur_->u_.wait_.events = static_cast<ivl_event_t*>
(calloc(net->nevents(), sizeof(ivl_event_t*)));
}
for (unsigned edx = 0 ; edx < net->nevents() ; edx += 1) {
@ -1013,8 +1012,8 @@ bool dll_target::proc_wait(const NetEvWait*net)
}
for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) {
ivl_nexus_t nex = (ivl_nexus_t)
pr->pin(bit).nexus()->t_cookie();
ivl_nexus_t nex = static_cast<ivl_nexus_t>
(pr->pin(bit).nexus()->t_cookie());
ivl_assert(*ev, nex);
ev_tmp->pins[base+bit] = nex;
}
@ -1043,8 +1042,8 @@ void dll_target::proc_while(const NetWhile*net)
FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_WHILE;
stmt_cur_->u_.while_.stmt_ = (struct ivl_statement_s*)
calloc(1, sizeof(struct ivl_statement_s));
stmt_cur_->u_.while_.stmt_ = static_cast<struct ivl_statement_s*>
(calloc(1, sizeof(struct ivl_statement_s)));
assert(expr_ == 0);
net->expr()->expr_scan(this);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000-2022 Stephen Williams (steve@icarus.com)
* Copyright (c) 2000-2025 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -42,14 +42,14 @@ struct dll_target dll_target_obj;
inline ivl_dll_t ivl_dlopen(const char *name)
{
ivl_dll_t res = (ivl_dll_t) LoadLibrary(name);
ivl_dll_t res = static_cast<ivl_dll_t>(LoadLibrary(name));
return res;
}
inline void * ivl_dlsym(ivl_dll_t dll, const char *nm)
{
return (void*)GetProcAddress((HMODULE)dll, nm);
return reinterpret_cast<void*>(GetProcAddress((HMODULE)dll, nm));
}
inline void ivl_dlclose(ivl_dll_t dll)
@ -419,13 +419,13 @@ void scope_add_logic(ivl_scope_t scope, ivl_net_logic_t net)
{
if (scope->nlog_ == 0) {
scope->nlog_ = 1;
scope->log_ = (ivl_net_logic_t*)malloc(sizeof(ivl_net_logic_t));
scope->log_ = static_cast<ivl_net_logic_t*>(malloc(sizeof(ivl_net_logic_t)));
scope->log_[0] = net;
} else {
scope->nlog_ += 1;
scope->log_ = (ivl_net_logic_t*)
realloc(scope->log_, scope->nlog_*sizeof(ivl_net_logic_t));
scope->log_ = static_cast<ivl_net_logic_t*>
(realloc(scope->log_, scope->nlog_*sizeof(ivl_net_logic_t)));
scope->log_[scope->nlog_-1] = net;
}
@ -435,13 +435,13 @@ void scope_add_event(ivl_scope_t scope, ivl_event_t net)
{
if (scope->nevent_ == 0) {
scope->nevent_ = 1;
scope->event_ = (ivl_event_t*)malloc(sizeof(ivl_event_t));
scope->event_ = static_cast<ivl_event_t*>(malloc(sizeof(ivl_event_t)));
scope->event_[0] = net;
} else {
scope->nevent_ += 1;
scope->event_ = (ivl_event_t*)
realloc(scope->event_, scope->nevent_*sizeof(ivl_event_t));
scope->event_ = static_cast<ivl_event_t*>
(realloc(scope->event_, scope->nevent_*sizeof(ivl_event_t)));
scope->event_[scope->nevent_-1] = net;
}
@ -452,15 +452,14 @@ static void scope_add_lpm(ivl_scope_t scope, ivl_lpm_t net)
if (scope->nlpm_ == 0) {
assert(scope->lpm_ == 0);
scope->nlpm_ = 1;
scope->lpm_ = (ivl_lpm_t*)malloc(sizeof(ivl_lpm_t));
scope->lpm_ = static_cast<ivl_lpm_t*>(malloc(sizeof(ivl_lpm_t)));
scope->lpm_[0] = net;
} else {
assert(scope->lpm_);
scope->nlpm_ += 1;
scope->lpm_ = (ivl_lpm_t*)
realloc(scope->lpm_,
scope->nlpm_*sizeof(ivl_lpm_t));
scope->lpm_ = static_cast<ivl_lpm_t*>
(realloc(scope->lpm_, scope->nlpm_*sizeof(ivl_lpm_t)));
scope->lpm_[scope->nlpm_-1] = net;
}
}
@ -713,7 +712,7 @@ bool dll_target::start_design(const Design*des)
add_root(*cur);
}
target_ = (target_design_f)ivl_dlsym(dll_, LU "target_design" TU);
target_ = reinterpret_cast<target_design_f>(ivl_dlsym(dll_, LU "target_design" TU));
if (target_ == 0) {
cerr << dll_path_ << ": error: target_design entry "
"point is missing." << endl;
@ -955,7 +954,7 @@ void dll_target::event(const NetEvent*net)
}
unsigned npins = obj->nany + obj->nneg + obj->npos + obj->nedg;
obj->pins = (ivl_nexus_t*)calloc(npins, sizeof(ivl_nexus_t));
obj->pins = static_cast<ivl_nexus_t*>(calloc(npins, sizeof(ivl_nexus_t)));
} else {
obj->pins = 0;
@ -1321,8 +1320,8 @@ ivl_event_t dll_target::make_lpm_trigger(const NetEvWait*net)
assert(ev->nprobe() == 1);
const NetEvProbe*pr = ev->probe(0);
for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) {
ivl_nexus_t nex = (ivl_nexus_t)
pr->pin(bit).nexus()->t_cookie();
ivl_nexus_t nex = static_cast<ivl_nexus_t>
(pr->pin(bit).nexus()->t_cookie());
assert(nex);
trigger->pins[bit] = nex;
}
@ -1453,7 +1452,7 @@ void dll_target::udp(const NetUDP*net)
} else {
u = new struct ivl_udp_s;
u->nrows = net->rows();
u->table = (ivl_udp_s::ccharp_t*)malloc((u->nrows+1)*sizeof(char*));
u->table = static_cast<ivl_udp_s::ccharp_t*>(malloc((u->nrows+1)*sizeof(char*)));
u->table[u->nrows] = 0x0;
u->nin = net->nin();
u->sequ = net->is_sequential();
@ -2397,7 +2396,7 @@ bool dll_target::net_const(const NetConst*net)
} else {
if (obj->width_ >= bits_cnt) {
bits_tmp = (char*)realloc(bits_tmp, obj->width_+1);
bits_tmp = static_cast<char*>(realloc(bits_tmp, obj->width_+1));
bits_cnt = obj->width_+1;
}
bits = bits_tmp;
@ -2869,7 +2868,8 @@ void dll_target::test_version(const char*target_name)
return;
}
target_query_f targ_query = (target_query_f)ivl_dlsym(dll_, LU "target_query" TU);
target_query_f targ_query = reinterpret_cast<target_query_f>
(ivl_dlsym(dll_, LU "target_query" TU));
if (targ_query == 0) {
cerr << "Target " << target_name
<< " has no version hooks." << endl;

View File

@ -62,6 +62,14 @@ CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
LDFLAGS = @rdynamic@ @LDFLAGS@
LIBS = @LIBS@ @EXTRALIBS@
ifeq (@WIN32@,yes)
SLDIR=$(bindir)
SLEXT=dll
else
SLDIR=$(libdir)
SLEXT=so
endif
dllib=@DLLIB@
MDIR1 = -DMODULE_DIR1='"$(libdir)/ivl$(suffix)"'
@ -101,7 +109,7 @@ else
endif
clean:
rm -f *.o *~ parse.cc parse.h lexor.cc tables.cc libvvp$(suffix).*
rm -f *.o *~ parse.cc parse.h lexor.cc tables.cc libvvp$(suffix).$(SLEXT)
rm -rf dep vvp@EXEEXT@ parse.output vvp.man vvp.ps vvp.pdf vvp.exp
distclean: clean
@ -130,14 +138,6 @@ ifeq (@LIBVVP@,yes)
CPPFLAGS+= -fpic
ifeq (@WIN32@,yes)
SLDIR=$(bindir)
SLEXT=dll
else
SLDIR=$(libdir)
SLEXT=so
endif
# To avoid setting LD_LIBRARY_PATH when running vvp from the build tree,
# add option -Wl,-rpath=`pwd` to the CXX command below.