Compare commits

..

3 Commits

Author SHA1 Message Date
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
7 changed files with 104 additions and 102 deletions

View File

@ -77,9 +77,9 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- { msystem: MINGW64, env: x86_64 opt: pli1 } - { msystem: MINGW64, env: x86_64 }
- { msystem: UCRT64, env: ucrt-x86_64 opt: pli1 } - { msystem: UCRT64, env: ucrt-x86_64 }
- { msystem: CLANG64, env: clang-x86_64 opt: no-pli1 } - { msystem: CLANG64, env: clang-x86_64 }
name: 🟪 ${{ matrix.msystem}} name: 🟪 ${{ matrix.msystem}}
defaults: defaults:
run: run:
@ -110,7 +110,7 @@ jobs:
- name: Build and check - name: Build and check
run: | run: |
cd msys2 cd msys2
if [ ${{ matrix.opt }} = "pli1" ] ; then if [ ${{ matrix.msystem }} != "CLANG64" ] ; then
export IVL_CONFIG_OPTIONS="--enable-libveriuser" export IVL_CONFIG_OPTIONS="--enable-libveriuser"
fi fi
makepkg-mingw --noconfirm --noprogressbar -sCLf makepkg-mingw --noconfirm --noprogressbar -sCLf
@ -120,7 +120,11 @@ jobs:
- name: Test - name: Test
run: | run: |
./.github/test.sh ${{ matrix.opt }} if [ ${{ matrix.msystem }} = "CLANG64" ] ; then
./.github/test.sh no-pli1
else
./.github/test.sh
fi
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:

View File

@ -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, 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) { if (assign->l_val_count() != 1) {
print_for_step_warning(proc, pr_type); print_for_step_warning(proc, pr_type);

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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -34,8 +34,8 @@ bool dll_target::process(const NetAnalogTop*net)
{ {
bool rc_flag = true; bool rc_flag = true;
ivl_process_t obj = (struct ivl_process_s*) ivl_process_t obj = static_cast<struct ivl_process_s*>
calloc(1, sizeof(struct ivl_process_s)); (calloc(1, sizeof(struct ivl_process_s)));
obj->type_ = net->type(); obj->type_ = net->type();
obj->analog_flag = 1; obj->analog_flag = 1;
@ -49,7 +49,7 @@ bool dll_target::process(const NetAnalogTop*net)
obj->attr = fill_in_attributes(net); obj->attr = fill_in_attributes(net);
assert(stmt_cur_ == 0); 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; rc_flag = net->statement()->emit_proc(this) && rc_flag;
assert(stmt_cur_); 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 CERN 2013 / Stephen Williams (steve@icarus.com)
* Copyright (c) 2016 CERN Michele Castellana (michele.castellana@cern.ch) * 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; unsigned need = strlen(sn) + 1 + strlen(net->name) + 1;
if (need > name_size) { if (need > name_size) {
name_buffer = (char*)realloc(name_buffer, need); name_buffer = static_cast<char*>(realloc(name_buffer, need));
name_size = 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; unsigned need = strlen(sn) + 1 + strlen(net->name) + 1;
if (need > name_size) { if (need > name_size) {
name_buffer = (char*)realloc(name_buffer, need); name_buffer = static_cast<char*>(realloc(name_buffer, need));
name_size = need; name_size = need;
} }
@ -1768,7 +1768,7 @@ extern "C" const char* ivl_nexus_name(ivl_nexus_t net)
assert(net); assert(net);
if (net->name_ == 0) { if (net->name_ == 0) {
char tmp[2 * sizeof(net) + 5]; 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); net->name_ = api_strings.add(tmp);
} }
return net->name_; return net->name_;
@ -2257,11 +2257,10 @@ extern "C" const char* ivl_scope_name(ivl_scope_t net)
unsigned needlen = scope_name_len(net); unsigned needlen = scope_name_len(net);
if (name_size < needlen) { if (name_size < needlen) {
name_buffer = (char*)realloc(name_buffer, needlen); name_buffer = static_cast<char*>(realloc(name_buffer, needlen));
name_size = needlen; name_size = needlen;
} }
push_scope_basename(net, name_buffer); push_scope_basename(net, name_buffer);
return 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; needlen += strlen(net->name_) + 2;
if (name_size < needlen) { if (name_size < needlen) {
name_buffer = (char*)realloc(name_buffer, needlen); name_buffer = static_cast<char*>(realloc(name_buffer, needlen));
name_size = 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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -57,14 +57,14 @@ void dll_target::sub_off_from_expr_(long off)
assert(expr_ != 0); assert(expr_ != 0);
char*bits; 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->type_ = IVL_EX_NUMBER;
tmpc->value_ = IVL_VT_VECTOR; tmpc->value_ = IVL_VT_VECTOR;
tmpc->net_type= 0; tmpc->net_type= 0;
tmpc->width_ = expr_->width_; tmpc->width_ = expr_->width_;
tmpc->signed_ = expr_->signed_; tmpc->signed_ = expr_->signed_;
tmpc->sized_ = 1; 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) { for (unsigned idx = 0 ; idx < tmpc->width_ ; idx += 1) {
bits[idx] = (off & 1)? '1' : '0'; bits[idx] = (off & 1)? '1' : '0';
off >>= 1; 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) /* Now make the subtracter (x-4 in the above example)
that has as input A the index expression and input B that has as input A the index expression and input B
the constant to subtract. */ 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->type_ = IVL_EX_BINARY;
tmps->value_ = IVL_VT_VECTOR; tmps->value_ = IVL_VT_VECTOR;
tmps->net_type= 0; tmps->net_type= 0;
@ -93,14 +93,14 @@ void dll_target::mul_expr_by_const_(long val)
assert(expr_ != 0); assert(expr_ != 0);
char*bits; 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->type_ = IVL_EX_NUMBER;
tmpc->value_ = IVL_VT_VECTOR; tmpc->value_ = IVL_VT_VECTOR;
tmpc->net_type= 0; tmpc->net_type= 0;
tmpc->width_ = expr_->width_; tmpc->width_ = expr_->width_;
tmpc->signed_ = expr_->signed_; tmpc->signed_ = expr_->signed_;
tmpc->sized_ = 1; 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) { for (unsigned idx = 0 ; idx < tmpc->width_ ; idx += 1) {
bits[idx] = (val & 1)? '1' : '0'; bits[idx] = (val & 1)? '1' : '0';
val >>= 1; 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) /* Now make the subtracter (x-4 in the above example)
that has as input A the index expression and input B that has as input A the index expression and input B
the constant to subtract. */ 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->type_ = IVL_EX_BINARY;
tmps->value_ = IVL_VT_VECTOR; tmps->value_ = IVL_VT_VECTOR;
tmpc->net_type= 0; 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 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; unsigned idx;
char*bits; char*bits;
@ -136,7 +136,7 @@ ivl_expr_t dll_target::expr_from_value_(const verinum&val)
expr->width_= val.len(); expr->width_= val.len();
expr->signed_ = val.has_sign()? 1 : 0; expr->signed_ = val.has_sign()? 1 : 0;
expr->sized_= 1; 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) for (idx = 0 ; idx < expr->width_ ; idx += 1)
switch (val.get(idx)) { switch (val.get(idx)) {
case verinum::V0: case verinum::V0:
@ -164,7 +164,7 @@ void dll_target::expr_access_func(const NetEAccess*net)
{ {
assert(expr_ == 0); assert(expr_ == 0);
// Make a stub Branch Access Function expression node. // 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_->type_ = IVL_EX_BACCESS;
expr_->value_ = IVL_VT_REAL; expr_->value_ = IVL_VT_REAL;
expr_->net_type=0; 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) void dll_target::expr_array_pattern(const NetEArrayPattern*net)
{ {
assert(expr_ == 0); 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->type_ = IVL_EX_ARRAY_PATTERN;
expr_tmp->value_= net->expr_type(); expr_tmp->value_= net->expr_type();
expr_tmp->net_type = net->net_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); net->right()->expr_scan(this);
ivl_expr_t rght = expr_; 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_->type_ = IVL_EX_BINARY;
expr_->value_= get_expr_type(net); expr_->value_= get_expr_type(net);
@ -261,7 +261,7 @@ void dll_target::expr_const(const NetEConst*net)
{ {
assert(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_->value_= net->expr_type(); expr_->value_= net->expr_type();
expr_->net_type=0; expr_->net_type=0;
FILE_NAME(expr_, net); FILE_NAME(expr_, net);
@ -279,7 +279,7 @@ void dll_target::expr_const(const NetEConst*net)
expr_->width_= net->expr_width(); expr_->width_= net->expr_width();
expr_->signed_ = net->has_sign()? 1 : 0; expr_->signed_ = net->has_sign()? 1 : 0;
expr_->sized_= net->has_width()? 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) for (idx = 0 ; idx < expr_->width_ ; idx += 1)
switch (val.get(idx)) { switch (val.get(idx)) {
case verinum::V0: case verinum::V0:
@ -334,7 +334,7 @@ void dll_target::expr_rparam(const NetECRealParam*net)
void dll_target::expr_creal(const NetECReal*net) void dll_target::expr_creal(const NetECReal*net)
{ {
assert(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_->width_ = net->expr_width();
expr_->signed_ = 1; expr_->signed_ = 1;
expr_->sized_ = 1; expr_->sized_ = 1;
@ -396,7 +396,7 @@ void dll_target::expr_new(const NetENew*net)
} }
assert(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_->width_ = net->expr_width();
expr_->signed_ = 0; expr_->signed_ = 0;
expr_->sized_ = 1; expr_->sized_ = 1;
@ -411,7 +411,7 @@ void dll_target::expr_new(const NetENew*net)
void dll_target::expr_null(const NetENull*net) void dll_target::expr_null(const NetENull*net)
{ {
assert(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_->width_ = net->expr_width();
expr_->signed_ = 0; expr_->signed_ = 0;
expr_->sized_ = 1; expr_->sized_ = 1;
@ -430,7 +430,7 @@ void dll_target::expr_property(const NetEProperty*net)
expr_ = 0; expr_ = 0;
} }
assert(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_->width_ = net->expr_width();
expr_->signed_ = net->has_sign(); expr_->signed_ = net->has_sign();
expr_->sized_ = 1; expr_->sized_ = 1;
@ -447,7 +447,7 @@ void dll_target::expr_event(const NetEEvent*net)
{ {
assert(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_->type_ = IVL_EX_EVENT; expr_->type_ = IVL_EX_EVENT;
FILE_NAME(expr_, net); FILE_NAME(expr_, net);
@ -472,7 +472,7 @@ void dll_target::expr_scope(const NetEScope*net)
{ {
assert(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_->type_ = IVL_EX_SCOPE; expr_->type_ = IVL_EX_SCOPE;
FILE_NAME(expr_, net); FILE_NAME(expr_, net);
@ -493,7 +493,7 @@ void dll_target::expr_scopy(const NetEShallowCopy*net)
ivl_expr_t expr2 = expr_; ivl_expr_t expr2 = expr_;
expr_ = 0; 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; expr_->type_ = IVL_EX_SHALLOWCOPY;
FILE_NAME(expr_, net); FILE_NAME(expr_, net);
expr_->value_ = net->expr_type(); expr_->value_ = net->expr_type();
@ -507,7 +507,7 @@ void dll_target::expr_netenum(const NetENetenum*net)
{ {
assert(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_->type_ = IVL_EX_ENUMTYPE; expr_->type_ = IVL_EX_ENUMTYPE;
FILE_NAME(expr_, net); FILE_NAME(expr_, net);
@ -529,7 +529,7 @@ void dll_target::expr_select(const NetESelect*net)
ivl_expr_t base = expr_; 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_->type_ = IVL_EX_SELECT;
expr_->value_= net->expr_type(); expr_->value_= net->expr_type();
@ -548,7 +548,7 @@ void dll_target::expr_sfunc(const NetESFunc*net)
{ {
assert(expr_ == 0); 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->type_ = IVL_EX_SFUNC;
expr->value_= net->expr_type(); expr->value_= net->expr_type();
@ -579,7 +579,7 @@ void dll_target::expr_ternary(const NetETernary*net)
{ {
assert(expr_ == 0); 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->type_ = IVL_EX_TERNARY;
expr->value_= net->expr_type(); expr->value_= net->expr_type();
@ -621,7 +621,7 @@ void dll_target::expr_signal(const NetESignal*net)
expr_ = 0; 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_->type_ = IVL_EX_SIGNAL;
expr_->value_= net->expr_type(); expr_->value_= net->expr_type();
@ -649,7 +649,7 @@ void dll_target::expr_ufunc(const NetEUFunc*net)
{ {
assert(expr_ == 0); 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->type_ = IVL_EX_UFUNC;
expr->value_= net->expr_type(); expr->value_= net->expr_type();
@ -692,7 +692,7 @@ void dll_target::expr_unary(const NetEUnary*net)
ivl_expr_t sub = expr_; 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_->type_ = IVL_EX_UNARY;
expr_->value_= net->expr_type(); expr_->value_= net->expr_type();
expr_->net_type=0; 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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -36,8 +36,8 @@ bool dll_target::process(const NetProcTop*net)
{ {
bool rc_flag = true; bool rc_flag = true;
ivl_process_t obj = (struct ivl_process_s*) ivl_process_t obj = static_cast<struct ivl_process_s*>
calloc(1, sizeof(struct ivl_process_s)); (calloc(1, sizeof(struct ivl_process_s)));
obj->type_ = net->type(); obj->type_ = net->type();
obj->analog_flag = 0; obj->analog_flag = 0;
@ -61,7 +61,7 @@ bool dll_target::process(const NetProcTop*net)
statement back. The asserts check these conditions. */ statement back. The asserts check these conditions. */
assert(stmt_cur_ == 0); 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; rc_flag = net->statement()->emit_proc(this) && rc_flag;
assert(stmt_cur_); assert(stmt_cur_);
@ -83,7 +83,7 @@ void dll_target::task_def(const NetScope*net)
assert(def); assert(def);
assert(def->proc()); assert(def->proc());
assert(stmt_cur_ == 0); 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); def->proc()->emit_proc(this);
assert(stmt_cur_); assert(stmt_cur_);
@ -107,7 +107,7 @@ bool dll_target::func_def(const NetScope*net)
assert(def); assert(def);
assert(def->proc()); assert(def->proc());
assert(stmt_cur_ == 0); 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); def->proc()->emit_proc(this);
assert(stmt_cur_); assert(stmt_cur_);
@ -315,8 +315,8 @@ void dll_target::proc_assign_nb(const NetAssignNB*net)
if (net->nevents() > 0) { if (net->nevents() > 0) {
stmt_cur_->u_.assign_.nevent = net->nevents(); stmt_cur_->u_.assign_.nevent = net->nevents();
if (net->nevents() > 1) { if (net->nevents() > 1) {
stmt_cur_->u_.assign_.events = (ivl_event_t*) stmt_cur_->u_.assign_.events = static_cast<ivl_event_t*>
calloc(net->nevents(), sizeof(ivl_event_t*)); (calloc(net->nevents(), sizeof(ivl_event_t*)));
} }
for (unsigned edx = 0 ; edx < net->nevents() ; edx += 1) { for (unsigned edx = 0 ; edx < net->nevents() ; edx += 1) {
@ -377,10 +377,9 @@ void dll_target::proc_assign_nb(const NetAssignNB*net)
break; break;
} }
for (unsigned bit = 0; bit < pr->pin_count(); for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) {
bit += 1) { ivl_nexus_t nex = static_cast<ivl_nexus_t>
ivl_nexus_t nex = (ivl_nexus_t) (pr->pin(bit).nexus()->t_cookie());
pr->pin(bit).nexus()->t_cookie();
assert(nex); assert(nex);
ev_tmp->pins[base+bit] = nex; ev_tmp->pins[base+bit] = nex;
} }
@ -436,8 +435,8 @@ bool dll_target::proc_block(const NetBlock*net)
break; break;
} }
stmt_cur_->u_.block_.nstmt_ = count; stmt_cur_->u_.block_.nstmt_ = count;
stmt_cur_->u_.block_.stmt_ = (struct ivl_statement_s*) stmt_cur_->u_.block_.stmt_ = static_cast<struct ivl_statement_s*>
calloc(count, sizeof(struct ivl_statement_s)); (calloc(count, sizeof(struct ivl_statement_s)));
if (net->subscope()) if (net->subscope())
stmt_cur_->u_.block_.scope = lookup_scope_(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); FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_CONDIT; stmt_cur_->type_ = IVL_ST_CONDIT;
stmt_cur_->u_.condit_.stmt_ = (struct ivl_statement_s*) stmt_cur_->u_.condit_.stmt_ = static_cast<struct ivl_statement_s*>
calloc(2, sizeof(struct ivl_statement_s)); (calloc(2, sizeof(struct ivl_statement_s)));
assert(expr_ == 0); assert(expr_ == 0);
net->expr()->expr_scan(this); net->expr()->expr_scan(this);
@ -617,8 +616,8 @@ bool dll_target::proc_delay(const NetPDelay*net)
assert(stmt_cur_->type_ == IVL_ST_NONE); assert(stmt_cur_->type_ == IVL_ST_NONE);
FILE_NAME(stmt_cur_, net); FILE_NAME(stmt_cur_, net);
ivl_statement_t tmp = (struct ivl_statement_s*) ivl_statement_t tmp = static_cast<struct ivl_statement_s*>
calloc(1, sizeof(struct ivl_statement_s)); (calloc(1, sizeof(struct ivl_statement_s)));
if (const NetExpr*expr = net->expr()) { if (const NetExpr*expr = net->expr()) {
@ -675,8 +674,8 @@ void dll_target::proc_do_while(const NetDoWhile*net)
FILE_NAME(stmt_cur_, net); FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_DO_WHILE; stmt_cur_->type_ = IVL_ST_DO_WHILE;
stmt_cur_->u_.while_.stmt_ = (struct ivl_statement_s*) stmt_cur_->u_.while_.stmt_ = static_cast<struct ivl_statement_s*>
calloc(1, sizeof(struct ivl_statement_s)); (calloc(1, sizeof(struct ivl_statement_s)));
assert(expr_ == 0); assert(expr_ == 0);
net->expr()->expr_scan(this); net->expr()->expr_scan(this);
@ -721,8 +720,8 @@ void dll_target::proc_forever(const NetForever*net)
stmt_cur_->type_ = IVL_ST_FOREVER; stmt_cur_->type_ = IVL_ST_FOREVER;
ivl_statement_t tmp = (struct ivl_statement_s*) ivl_statement_t tmp = static_cast<struct ivl_statement_s*>
calloc(1, sizeof(struct ivl_statement_s)); (calloc(1, sizeof(struct ivl_statement_s)));
ivl_statement_t save_cur_ = stmt_cur_; ivl_statement_t save_cur_ = stmt_cur_;
stmt_cur_ = tmp; 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, // Note that the init statement is optional. If it is not present,
// then the emit_recurse_init will not generate a statement. // 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; stmt_cur_ = tmp;
rc = net->emit_recurse_init(this); rc = net->emit_recurse_init(this);
if (stmt_cur_->type_ != IVL_ST_NONE) if (stmt_cur_->type_ != IVL_ST_NONE)
@ -758,13 +757,13 @@ bool dll_target::proc_forloop(const NetForLoop*net)
} }
res = res && rc; 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; stmt_cur_ = tmp;
rc = net->emit_recurse_stmt(this); rc = net->emit_recurse_stmt(this);
save_cur_->u_.forloop_.stmt = stmt_cur_; save_cur_->u_.forloop_.stmt = stmt_cur_;
res = res && rc; 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; stmt_cur_ = tmp;
rc = net->emit_recurse_step(this); rc = net->emit_recurse_step(this);
if (stmt_cur_->type_ != IVL_ST_NONE) 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_; stmt_cur_->u_.while_.cond_ = expr_;
expr_ = 0; expr_ = 0;
ivl_statement_t tmp = (struct ivl_statement_s*) ivl_statement_t tmp = static_cast<struct ivl_statement_s*>
calloc(1, sizeof(struct ivl_statement_s)); (calloc(1, sizeof(struct ivl_statement_s)));
ivl_statement_t save_cur_ = stmt_cur_; ivl_statement_t save_cur_ = stmt_cur_;
stmt_cur_ = tmp; 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_.name_ = net->name();
stmt_cur_->u_.stask_.sfunc_as_task_ = net->sfunc_as_task(); stmt_cur_->u_.stask_.sfunc_as_task_ = net->sfunc_as_task();
stmt_cur_->u_.stask_.nparm_= nparms; stmt_cur_->u_.stask_.nparm_= nparms;
stmt_cur_->u_.stask_.parms_= (ivl_expr_t*) stmt_cur_->u_.stask_.parms_= static_cast<ivl_expr_t*>
calloc(nparms, sizeof(ivl_expr_t)); (calloc(nparms, sizeof(ivl_expr_t)));
for (unsigned idx = 0 ; idx < nparms ; idx += 1) { for (unsigned idx = 0 ; idx < nparms ; idx += 1) {
if (net->parm(idx)) if (net->parm(idx))
@ -933,8 +932,8 @@ bool dll_target::proc_wait(const NetEvWait*net)
FILE_NAME(stmt_cur_, net); FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_WAIT; stmt_cur_->type_ = IVL_ST_WAIT;
stmt_cur_->u_.wait_.stmt_ = (struct ivl_statement_s*) stmt_cur_->u_.wait_.stmt_ = static_cast<struct ivl_statement_s*>
calloc(1, sizeof(struct ivl_statement_s)); (calloc(1, sizeof(struct ivl_statement_s)));
stmt_cur_->u_.wait_.nevent = net->nevents(); 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. // This event processing code is also in the NB assign above.
if (net->nevents() > 1) { if (net->nevents() > 1) {
stmt_cur_->u_.wait_.events = (ivl_event_t*) stmt_cur_->u_.wait_.events = static_cast<ivl_event_t*>
calloc(net->nevents(), sizeof(ivl_event_t*)); (calloc(net->nevents(), sizeof(ivl_event_t*)));
} }
for (unsigned edx = 0 ; edx < net->nevents() ; edx += 1) { 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) { for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) {
ivl_nexus_t nex = (ivl_nexus_t) ivl_nexus_t nex = static_cast<ivl_nexus_t>
pr->pin(bit).nexus()->t_cookie(); (pr->pin(bit).nexus()->t_cookie());
ivl_assert(*ev, nex); ivl_assert(*ev, nex);
ev_tmp->pins[base+bit] = nex; ev_tmp->pins[base+bit] = nex;
} }
@ -1043,8 +1042,8 @@ void dll_target::proc_while(const NetWhile*net)
FILE_NAME(stmt_cur_, net); FILE_NAME(stmt_cur_, net);
stmt_cur_->type_ = IVL_ST_WHILE; stmt_cur_->type_ = IVL_ST_WHILE;
stmt_cur_->u_.while_.stmt_ = (struct ivl_statement_s*) stmt_cur_->u_.while_.stmt_ = static_cast<struct ivl_statement_s*>
calloc(1, sizeof(struct ivl_statement_s)); (calloc(1, sizeof(struct ivl_statement_s)));
assert(expr_ == 0); assert(expr_ == 0);
net->expr()->expr_scan(this); 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) * Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
@ -42,14 +42,14 @@ struct dll_target dll_target_obj;
inline ivl_dll_t ivl_dlopen(const char *name) 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; return res;
} }
inline void * ivl_dlsym(ivl_dll_t dll, const char *nm) 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) 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) { if (scope->nlog_ == 0) {
scope->nlog_ = 1; 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; scope->log_[0] = net;
} else { } else {
scope->nlog_ += 1; scope->nlog_ += 1;
scope->log_ = (ivl_net_logic_t*) scope->log_ = static_cast<ivl_net_logic_t*>
realloc(scope->log_, scope->nlog_*sizeof(ivl_net_logic_t)); (realloc(scope->log_, scope->nlog_*sizeof(ivl_net_logic_t)));
scope->log_[scope->nlog_-1] = net; 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) { if (scope->nevent_ == 0) {
scope->nevent_ = 1; 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; scope->event_[0] = net;
} else { } else {
scope->nevent_ += 1; scope->nevent_ += 1;
scope->event_ = (ivl_event_t*) scope->event_ = static_cast<ivl_event_t*>
realloc(scope->event_, scope->nevent_*sizeof(ivl_event_t)); (realloc(scope->event_, scope->nevent_*sizeof(ivl_event_t)));
scope->event_[scope->nevent_-1] = net; 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) { if (scope->nlpm_ == 0) {
assert(scope->lpm_ == 0); assert(scope->lpm_ == 0);
scope->nlpm_ = 1; 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; scope->lpm_[0] = net;
} else { } else {
assert(scope->lpm_); assert(scope->lpm_);
scope->nlpm_ += 1; scope->nlpm_ += 1;
scope->lpm_ = (ivl_lpm_t*) scope->lpm_ = static_cast<ivl_lpm_t*>
realloc(scope->lpm_, (realloc(scope->lpm_, scope->nlpm_*sizeof(ivl_lpm_t)));
scope->nlpm_*sizeof(ivl_lpm_t));
scope->lpm_[scope->nlpm_-1] = net; scope->lpm_[scope->nlpm_-1] = net;
} }
} }
@ -713,7 +712,7 @@ bool dll_target::start_design(const Design*des)
add_root(*cur); 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) { if (target_ == 0) {
cerr << dll_path_ << ": error: target_design entry " cerr << dll_path_ << ": error: target_design entry "
"point is missing." << endl; "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; 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 { } else {
obj->pins = 0; obj->pins = 0;
@ -1321,8 +1320,8 @@ ivl_event_t dll_target::make_lpm_trigger(const NetEvWait*net)
assert(ev->nprobe() == 1); assert(ev->nprobe() == 1);
const NetEvProbe*pr = ev->probe(0); const NetEvProbe*pr = ev->probe(0);
for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) { for (unsigned bit = 0; bit < pr->pin_count(); bit += 1) {
ivl_nexus_t nex = (ivl_nexus_t) ivl_nexus_t nex = static_cast<ivl_nexus_t>
pr->pin(bit).nexus()->t_cookie(); (pr->pin(bit).nexus()->t_cookie());
assert(nex); assert(nex);
trigger->pins[bit] = nex; trigger->pins[bit] = nex;
} }
@ -1453,7 +1452,7 @@ void dll_target::udp(const NetUDP*net)
} else { } else {
u = new struct ivl_udp_s; u = new struct ivl_udp_s;
u->nrows = net->rows(); 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->table[u->nrows] = 0x0;
u->nin = net->nin(); u->nin = net->nin();
u->sequ = net->is_sequential(); u->sequ = net->is_sequential();
@ -2397,7 +2396,7 @@ bool dll_target::net_const(const NetConst*net)
} else { } else {
if (obj->width_ >= bits_cnt) { 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_cnt = obj->width_+1;
} }
bits = bits_tmp; bits = bits_tmp;
@ -2869,7 +2868,8 @@ void dll_target::test_version(const char*target_name)
return; 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) { if (targ_query == 0) {
cerr << "Target " << target_name cerr << "Target " << target_name
<< " has no version hooks." << endl; << " has no version hooks." << endl;