Merge branch 'v10-branch' of github.com:steveicarus/iverilog into v10-branch
This commit is contained in:
commit
d46e7ace70
22
BUGS.txt
22
BUGS.txt
|
|
@ -116,13 +116,17 @@ programs.
|
||||||
|
|
||||||
RESEARCHING EXISTING/PAST BUGS, AND FILING REPORTS
|
RESEARCHING EXISTING/PAST BUGS, AND FILING REPORTS
|
||||||
|
|
||||||
The URL <http://sourceforge.net/tracker/?group_id=149850> is the main
|
The URL <https://sourceforge.net/p/iverilog/bugs/> is the main
|
||||||
bug tracking system. Once you believe you have found a bug, you may
|
bug tracking system, although some users have reported bugs at
|
||||||
browse the bugs database for existing bugs that may be related to
|
<https://github.com/steveicarus/iverilog/issues/>. Once you believe
|
||||||
yours. You might find that your bug has already been fixed in a later
|
you have found a bug, you may browse the bugs database for existing
|
||||||
release or snapshot. If that's the case, then you are set. Also,
|
bugs that may be related to yours. You might find that your bug has
|
||||||
consider if you are reporting a bug or really asking for a new
|
already been fixed in a later release or snapshot. If that's the case,
|
||||||
feature, and use the appropriate tracker.
|
then you are set. Also, consider if you are reporting a bug or really
|
||||||
|
asking for a new feature, and use the appropriate tracker.
|
||||||
|
|
||||||
|
system (although you will also find bug rep
|
||||||
|
|
||||||
|
|
||||||
The bug database supports basic keyword searches, and you can
|
The bug database supports basic keyword searches, and you can
|
||||||
optionally limit your search to active bugs, or fixed bugs. You may
|
optionally limit your search to active bugs, or fixed bugs. You may
|
||||||
|
|
@ -145,7 +149,7 @@ version from git. Please see the developer documentation for more
|
||||||
detailed instructions -- <http://iverilog.wikia.com/wiki/>.
|
detailed instructions -- <http://iverilog.wikia.com/wiki/>.
|
||||||
|
|
||||||
When you make a patch, submit it to the "Patches" tracker at
|
When you make a patch, submit it to the "Patches" tracker at
|
||||||
<http://sourceforge.net/tracker/?group_id=149850>. Patches added to
|
<https://sourceforge.net/p/iverilog/patches/>. Patches added to
|
||||||
the "Patches" tracker enter the developer workflow, are checked,
|
the "Patches" tracker enter the developer workflow, are checked,
|
||||||
applied to the appropriate git branch, and are pushed. Then the
|
applied to the appropriate git branch, and are pushed. Then the
|
||||||
tracker item is closed.
|
tracker item is closed.
|
||||||
|
|
@ -158,7 +162,7 @@ clarification before applying it.)
|
||||||
|
|
||||||
COPYRIGHT ISSUES
|
COPYRIGHT ISSUES
|
||||||
|
|
||||||
Icarus Verilog is Copyright (c) 1998-2008 Stephen Williams except
|
Icarus Verilog is Copyright (c) 1998-2018 Stephen Williams except
|
||||||
where otherwise noted. Minor patches are covered as derivative works
|
where otherwise noted. Minor patches are covered as derivative works
|
||||||
(or editorial comment or whatever the appropriate legal term is) and
|
(or editorial comment or whatever the appropriate legal term is) and
|
||||||
folded into the rest of ivl. However, if a submission can reasonably
|
folded into the rest of ivl. However, if a submission can reasonably
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
THE ICARUS VERILOG COMPILATION SYSTEM
|
THE ICARUS VERILOG COMPILATION SYSTEM
|
||||||
Copyright 2000-2004 Stephen Williams
|
Copyright 2000-2019 Stephen Williams
|
||||||
|
|
||||||
|
|
||||||
1.0 What is ICARUS Verilog?
|
1.0 What is ICARUS Verilog?
|
||||||
|
|
@ -47,7 +47,7 @@ on a UNIX-like system:
|
||||||
|
|
||||||
- bison and flex
|
- bison and flex
|
||||||
|
|
||||||
- gperf 2.7
|
- gperf 2.7 or later
|
||||||
The lexical analyzer doesn't recognize keywords directly,
|
The lexical analyzer doesn't recognize keywords directly,
|
||||||
but instead matches symbols and looks them up in a hash
|
but instead matches symbols and looks them up in a hash
|
||||||
table in order to get the proper lexical code. The gperf
|
table in order to get the proper lexical code. The gperf
|
||||||
|
|
@ -56,7 +56,7 @@ on a UNIX-like system:
|
||||||
A version problem with this program is the most common cause
|
A version problem with this program is the most common cause
|
||||||
of difficulty. See the Icarus Verilog FAQ.
|
of difficulty. See the Icarus Verilog FAQ.
|
||||||
|
|
||||||
- readline 4.2
|
- readline 4.2 or later
|
||||||
On Linux systems, this usually means the readline-devel
|
On Linux systems, this usually means the readline-devel
|
||||||
rpm. In any case, it is the development headers of readline
|
rpm. In any case, it is the development headers of readline
|
||||||
that are needed.
|
that are needed.
|
||||||
|
|
@ -67,7 +67,7 @@ on a UNIX-like system:
|
||||||
If you are building from git, you will also need software to generate
|
If you are building from git, you will also need software to generate
|
||||||
the configure scripts.
|
the configure scripts.
|
||||||
|
|
||||||
- autoconf 2.53
|
- autoconf 2.53 or later
|
||||||
This generates configure scripts from configure.in. The 2.53
|
This generates configure scripts from configure.in. The 2.53
|
||||||
or later versions are known to work, autoconf 2.13 is
|
or later versions are known to work, autoconf 2.13 is
|
||||||
reported to *not* work.
|
reported to *not* work.
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ AC_DEFUN([AX_C99_STRTOD],
|
||||||
[# On MinGW we need to jump through hoops to get a C99 compliant strtod().
|
[# On MinGW we need to jump through hoops to get a C99 compliant strtod().
|
||||||
# mingw-w64 doesn't need this, and the 64-bit version doesn't support it.
|
# mingw-w64 doesn't need this, and the 64-bit version doesn't support it.
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
*-*-mingw32)
|
*-pc-mingw32)
|
||||||
LDFLAGS+=" -Wl,--undefined=___strtod,--wrap,strtod,--defsym,___wrap_strtod=___strtod"
|
LDFLAGS+=" -Wl,--undefined=___strtod,--wrap,strtod,--defsym,___wrap_strtod=___strtod"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
||||||
|
|
@ -264,7 +264,7 @@ that contain Verilog source files. During elaboration, the compiler
|
||||||
notices the instantiation of undefined module types. If the user
|
notices the instantiation of undefined module types. If the user
|
||||||
specifies library search directories, the compiler will search the
|
specifies library search directories, the compiler will search the
|
||||||
directory for files with the name of the missing module type. If it
|
directory for files with the name of the missing module type. If it
|
||||||
finds such a file, it loads it as a Verilog source file, they tries
|
finds such a file, it loads it as a Verilog source file, then tries
|
||||||
again to elaborate the module.
|
again to elaborate the module.
|
||||||
|
|
||||||
Library module files should contain only a single module, but this is
|
Library module files should contain only a single module, but this is
|
||||||
|
|
|
||||||
11
elab_expr.cc
11
elab_expr.cc
|
|
@ -2535,7 +2535,13 @@ NetExpr* PECastSize::elaborate_expr(Design*des, NetScope*scope,
|
||||||
ivl_assert(*this, size_);
|
ivl_assert(*this, size_);
|
||||||
ivl_assert(*this, base_);
|
ivl_assert(*this, base_);
|
||||||
|
|
||||||
NetExpr*sub = base_->elaborate_expr(des, scope, base_->expr_width(), flags);
|
// When changing size, a cast behaves exactly like an assignment,
|
||||||
|
// so the result size affects the final expression width.
|
||||||
|
unsigned cast_width = base_->expr_width();
|
||||||
|
if (cast_width < expr_width_)
|
||||||
|
cast_width = expr_width_;
|
||||||
|
|
||||||
|
NetExpr*sub = base_->elaborate_expr(des, scope, cast_width, flags);
|
||||||
|
|
||||||
// Perform the cast. The extension method (zero/sign), if needed,
|
// Perform the cast. The extension method (zero/sign), if needed,
|
||||||
// depends on the type of the base expression.
|
// depends on the type of the base expression.
|
||||||
|
|
@ -2589,7 +2595,7 @@ NetExpr* PECastType::elaborate_expr(Design*des, NetScope*scope,
|
||||||
|
|
||||||
// Find rounded up length that can fit the whole casted array of vectors
|
// Find rounded up length that can fit the whole casted array of vectors
|
||||||
int len = base->expr_width() + vector->packed_width() - 1;
|
int len = base->expr_width() + vector->packed_width() - 1;
|
||||||
if(base->expr_width() > vector->packed_width()) {
|
if(base->expr_width() > (unsigned)vector->packed_width()) {
|
||||||
len /= vector->packed_width();
|
len /= vector->packed_width();
|
||||||
} else {
|
} else {
|
||||||
len /= base->expr_width();
|
len /= base->expr_width();
|
||||||
|
|
@ -2753,6 +2759,7 @@ NetExpr* PEConcat::elaborate_expr(Design*, NetScope*,
|
||||||
tmp->set_line(*this);
|
tmp->set_line(*this);
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
cerr << get_fileline() << ": internal error: "
|
cerr << get_fileline() << ": internal error: "
|
||||||
<< "I don't know how to elaborate(ivl_type_t)"
|
<< "I don't know how to elaborate(ivl_type_t)"
|
||||||
|
|
|
||||||
|
|
@ -1201,7 +1201,12 @@ bool PEIdent::elaborate_lval_net_packed_member_(Design*des, NetScope*scope,
|
||||||
if (!name_tail.index.empty())
|
if (!name_tail.index.empty())
|
||||||
use_sel = name_tail.index.back().sel;
|
use_sel = name_tail.index.back().sel;
|
||||||
|
|
||||||
ivl_assert(*this, use_sel == index_component_t::SEL_NONE || use_sel == index_component_t::SEL_BIT);
|
if (use_sel != index_component_t::SEL_NONE && use_sel != index_component_t::SEL_BIT) {
|
||||||
|
cerr << get_fileline() << ": sorry: Assignments to part selects of "
|
||||||
|
"a struct member are not yet supported." << endl;
|
||||||
|
des->errors += 1;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (! name_tail.index.empty()) {
|
if (! name_tail.index.empty()) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1102,6 +1102,7 @@ NetEConst* NetEBShift::eval_arguments_(const NetExpr*l, const NetExpr*r) const
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
lv.has_sign(false);
|
lv.has_sign(false);
|
||||||
|
// fallthrough
|
||||||
case 'R':
|
case 'R':
|
||||||
val = cast_to_width(lv >> shift, wid);
|
val = cast_to_width(lv >> shift, wid);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1553,6 +1554,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const
|
||||||
|
|
||||||
case 'A':
|
case 'A':
|
||||||
invert = true;
|
invert = true;
|
||||||
|
// fallthrough
|
||||||
case '&': {
|
case '&': {
|
||||||
res = verinum::V1;
|
res = verinum::V1;
|
||||||
for (unsigned idx = 0 ; idx < val.len() ; idx += 1)
|
for (unsigned idx = 0 ; idx < val.len() ; idx += 1)
|
||||||
|
|
@ -1562,6 +1564,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const
|
||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
invert = true;
|
invert = true;
|
||||||
|
// fallthrough
|
||||||
case '|': {
|
case '|': {
|
||||||
res = verinum::V0;
|
res = verinum::V0;
|
||||||
for (unsigned idx = 0 ; idx < val.len() ; idx += 1)
|
for (unsigned idx = 0 ; idx < val.len() ; idx += 1)
|
||||||
|
|
@ -1571,6 +1574,7 @@ NetEConst* NetEUReduce::eval_arguments_(const NetExpr*ex) const
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
invert = true;
|
invert = true;
|
||||||
|
// fallthrough
|
||||||
case '^': {
|
case '^': {
|
||||||
/* Reduction XOR. */
|
/* Reduction XOR. */
|
||||||
unsigned ones = 0, unknown = 0;
|
unsigned ones = 0, unknown = 0;
|
||||||
|
|
@ -1622,6 +1626,7 @@ NetExpr* NetECast::eval_arguments_(const NetExpr*ex) const
|
||||||
res_val = cast_to_width(res_val, expr_width());
|
res_val = cast_to_width(res_val, expr_width());
|
||||||
res = new NetEConst(res_val);
|
res = new NetEConst(res_val);
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case 'v':
|
case 'v':
|
||||||
if (const NetECReal*val = dynamic_cast<const NetECReal*>(ex)) {
|
if (const NetECReal*val = dynamic_cast<const NetECReal*>(ex)) {
|
||||||
verinum res_val(val->value().as_double(), false);
|
verinum res_val(val->value().as_double(), false);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2015 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2018 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
|
||||||
|
|
@ -335,6 +335,7 @@ NetNet* NetEBComp::synthesize(Design*des, NetScope*scope, NetExpr*root)
|
||||||
des->errors += 1;
|
des->errors += 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case 'e': // ==
|
case 'e': // ==
|
||||||
connect(dev->pin_AEB(), osig->pin(0));
|
connect(dev->pin_AEB(), osig->pin(0));
|
||||||
break;
|
break;
|
||||||
|
|
@ -353,6 +354,7 @@ NetNet* NetEBComp::synthesize(Design*des, NetScope*scope, NetExpr*root)
|
||||||
des->errors += 1;
|
des->errors += 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case 'n': // !=
|
case 'n': // !=
|
||||||
connect(dev->pin_ANEB(), osig->pin(0));
|
connect(dev->pin_ANEB(), osig->pin(0));
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ LDRELOCFLAGS = @LDRELOCFLAGS@
|
||||||
|
|
||||||
LDTARGETFLAGS = @LDTARGETFLAGS@
|
LDTARGETFLAGS = @LDTARGETFLAGS@
|
||||||
|
|
||||||
CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ @PICFLAG@
|
CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ -DICARUS_VPI_CONST=const @PICFLAG@
|
||||||
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
||||||
|
|
||||||
A = a_close.o a_compare_handles.o a_configure.o a_fetch_argc.o \
|
A = a_close.o a_compare_handles.o a_configure.o a_fetch_argc.o \
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2014 Michael Ruff (mruff at chiaro.com)
|
* Copyright (c) 2002-2018 Michael Ruff (mruff at chiaro.com)
|
||||||
* Michael Runyan (mrunyan at chiaro.com)
|
* Michael Runyan (mrunyan at chiaro.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
|
|
@ -42,8 +42,9 @@ typedef struct t_pli_data {
|
||||||
int paramvc; /* parameter number for misctf */
|
int paramvc; /* parameter number for misctf */
|
||||||
} s_pli_data, *p_pli_data;
|
} s_pli_data, *p_pli_data;
|
||||||
|
|
||||||
static PLI_INT32 compiletf(char *);
|
static PLI_INT32 compiletf(ICARUS_VPI_CONST PLI_BYTE8 *);
|
||||||
static PLI_INT32 calltf(char *);
|
static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8 *);
|
||||||
|
static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8 *);
|
||||||
static PLI_INT32 callback(p_cb_data);
|
static PLI_INT32 callback(p_cb_data);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -150,7 +151,7 @@ void veriusertfs_register_table(p_tfcell vtable)
|
||||||
tf_data.tfname = tf->tfname;
|
tf_data.tfname = tf->tfname;
|
||||||
tf_data.compiletf = compiletf;
|
tf_data.compiletf = compiletf;
|
||||||
tf_data.calltf = calltf;
|
tf_data.calltf = calltf;
|
||||||
tf_data.sizetf = (PLI_INT32 (*)(PLI_BYTE8 *))tf->sizetf;
|
tf_data.sizetf = sizetf;
|
||||||
tf_data.user_data = (char *)data;
|
tf_data.user_data = (char *)data;
|
||||||
|
|
||||||
if (pli_trace) {
|
if (pli_trace) {
|
||||||
|
|
@ -180,7 +181,7 @@ void veriusertfs_register_table(p_tfcell vtable)
|
||||||
* This function calls the veriusertfs checktf and sets up all the
|
* This function calls the veriusertfs checktf and sets up all the
|
||||||
* callbacks misctf requires.
|
* callbacks misctf requires.
|
||||||
*/
|
*/
|
||||||
static PLI_INT32 compiletf(char *data)
|
static PLI_INT32 compiletf(ICARUS_VPI_CONST PLI_BYTE8*data)
|
||||||
{
|
{
|
||||||
p_pli_data pli;
|
p_pli_data pli;
|
||||||
p_tfcell tf;
|
p_tfcell tf;
|
||||||
|
|
@ -260,7 +261,7 @@ static PLI_INT32 compiletf(char *data)
|
||||||
/*
|
/*
|
||||||
* This function is the wrapper for the veriusertfs calltf routine.
|
* This function is the wrapper for the veriusertfs calltf routine.
|
||||||
*/
|
*/
|
||||||
static PLI_INT32 calltf(char *data)
|
static PLI_INT32 calltf(ICARUS_VPI_CONST PLI_BYTE8*data)
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
p_pli_data pli;
|
p_pli_data pli;
|
||||||
|
|
@ -283,6 +284,32 @@ static PLI_INT32 calltf(char *data)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function is the wrapper for the veriusertfs sizetf routine.
|
||||||
|
*/
|
||||||
|
static PLI_INT32 sizetf(ICARUS_VPI_CONST PLI_BYTE8*data)
|
||||||
|
{
|
||||||
|
int rc = 32;
|
||||||
|
p_pli_data pli;
|
||||||
|
p_tfcell tf;
|
||||||
|
|
||||||
|
/* cast back from opaque */
|
||||||
|
pli = (p_pli_data)data;
|
||||||
|
tf = pli->tf;
|
||||||
|
|
||||||
|
/* execute sizetf */
|
||||||
|
if (tf->sizetf) {
|
||||||
|
if (pli_trace) {
|
||||||
|
fprintf(pli_trace, "Call %s->sizetf(%d, %d)\n",
|
||||||
|
tf->tfname, tf->data, reason_sizetf);
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = tf->sizetf(tf->data, reason_sizetf);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function is the wrapper for all the misctf callbacks
|
* This function is the wrapper for all the misctf callbacks
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
6
main.cc
6
main.cc
|
|
@ -933,16 +933,22 @@ int main(int argc, char*argv[])
|
||||||
switch (generation_flag) {
|
switch (generation_flag) {
|
||||||
case GN_VER2012:
|
case GN_VER2012:
|
||||||
lexor_keyword_mask |= GN_KEYWORDS_1800_2012;
|
lexor_keyword_mask |= GN_KEYWORDS_1800_2012;
|
||||||
|
// fallthrough
|
||||||
case GN_VER2009:
|
case GN_VER2009:
|
||||||
lexor_keyword_mask |= GN_KEYWORDS_1800_2009;
|
lexor_keyword_mask |= GN_KEYWORDS_1800_2009;
|
||||||
|
// fallthrough
|
||||||
case GN_VER2005_SV:
|
case GN_VER2005_SV:
|
||||||
lexor_keyword_mask |= GN_KEYWORDS_1800_2005;
|
lexor_keyword_mask |= GN_KEYWORDS_1800_2005;
|
||||||
|
// fallthrough
|
||||||
case GN_VER2005:
|
case GN_VER2005:
|
||||||
lexor_keyword_mask |= GN_KEYWORDS_1364_2005;
|
lexor_keyword_mask |= GN_KEYWORDS_1364_2005;
|
||||||
|
// fallthrough
|
||||||
case GN_VER2001:
|
case GN_VER2001:
|
||||||
lexor_keyword_mask |= GN_KEYWORDS_1364_2001_CONFIG;
|
lexor_keyword_mask |= GN_KEYWORDS_1364_2001_CONFIG;
|
||||||
|
// fallthrough
|
||||||
case GN_VER2001_NOCONFIG:
|
case GN_VER2001_NOCONFIG:
|
||||||
lexor_keyword_mask |= GN_KEYWORDS_1364_2001;
|
lexor_keyword_mask |= GN_KEYWORDS_1364_2001;
|
||||||
|
// fallthrough
|
||||||
case GN_VER1995:
|
case GN_VER1995:
|
||||||
lexor_keyword_mask |= GN_KEYWORDS_1364_1995;
|
lexor_keyword_mask |= GN_KEYWORDS_1364_1995;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2016 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2012-2018 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
|
||||||
|
|
@ -23,6 +23,10 @@
|
||||||
# include <typeinfo>
|
# include <typeinfo>
|
||||||
# include "ivl_assert.h"
|
# include "ivl_assert.h"
|
||||||
|
|
||||||
|
#if __cplusplus < 201103L
|
||||||
|
#define unique_ptr auto_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -1018,7 +1022,7 @@ NetExpr* NetESignal::evaluate_function(const LineInfo&loc,
|
||||||
NetExpr* NetETernary::evaluate_function(const LineInfo&loc,
|
NetExpr* NetETernary::evaluate_function(const LineInfo&loc,
|
||||||
map<perm_string,LocalVar>&context_map) const
|
map<perm_string,LocalVar>&context_map) const
|
||||||
{
|
{
|
||||||
auto_ptr<NetExpr> cval (cond_->evaluate_function(loc, context_map));
|
unique_ptr<NetExpr> cval (cond_->evaluate_function(loc, context_map));
|
||||||
|
|
||||||
switch (const_logical(cval.get())) {
|
switch (const_logical(cval.get())) {
|
||||||
|
|
||||||
|
|
|
||||||
57
parse.y
57
parse.y
|
|
@ -627,6 +627,7 @@ static void current_function_set_statement(const YYLTYPE&loc, vector<Statement*>
|
||||||
%type <decl_assignments> list_of_variable_decl_assignments
|
%type <decl_assignments> list_of_variable_decl_assignments
|
||||||
|
|
||||||
%type <data_type> data_type data_type_or_implicit data_type_or_implicit_or_void
|
%type <data_type> data_type data_type_or_implicit data_type_or_implicit_or_void
|
||||||
|
%type <data_type> simple_type_or_string
|
||||||
%type <class_type> class_identifier
|
%type <class_type> class_identifier
|
||||||
%type <struct_member> struct_union_member
|
%type <struct_member> struct_union_member
|
||||||
%type <struct_members> struct_union_member_list
|
%type <struct_members> struct_union_member_list
|
||||||
|
|
@ -1881,6 +1882,60 @@ signing /* IEEE1800-2005: A.2.2.1 */
|
||||||
| K_unsigned { $$ = false; }
|
| K_unsigned { $$ = false; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
simple_type_or_string /* IEEE1800-2005: A.2.2.1 */
|
||||||
|
: integer_vector_type
|
||||||
|
{ ivl_variable_type_t use_vtype = $1;
|
||||||
|
bool reg_flag = false;
|
||||||
|
if (use_vtype == IVL_VT_NO_TYPE) {
|
||||||
|
use_vtype = IVL_VT_LOGIC;
|
||||||
|
reg_flag = true;
|
||||||
|
}
|
||||||
|
vector_type_t*tmp = new vector_type_t(use_vtype, false, 0);
|
||||||
|
tmp->reg_flag = reg_flag;
|
||||||
|
FILE_NAME(tmp, @1);
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
| non_integer_type
|
||||||
|
{ real_type_t*tmp = new real_type_t($1);
|
||||||
|
FILE_NAME(tmp, @1);
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
| atom2_type
|
||||||
|
{ atom2_type_t*tmp = new atom2_type_t($1, true);
|
||||||
|
FILE_NAME(tmp, @1);
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
| K_integer
|
||||||
|
{ list<pform_range_t>*pd = make_range_from_width(integer_width);
|
||||||
|
vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, true, pd);
|
||||||
|
tmp->reg_flag = true;
|
||||||
|
tmp->integer_flag = true;
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
| K_time
|
||||||
|
{ list<pform_range_t>*pd = make_range_from_width(64);
|
||||||
|
vector_type_t*tmp = new vector_type_t(IVL_VT_LOGIC, false, pd);
|
||||||
|
tmp->reg_flag = !gn_system_verilog();
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
| TYPE_IDENTIFIER
|
||||||
|
{ $$ = $1.type;
|
||||||
|
delete[]$1.text;
|
||||||
|
}
|
||||||
|
| PACKAGE_IDENTIFIER K_SCOPE_RES
|
||||||
|
{ lex_in_package_scope($1); }
|
||||||
|
TYPE_IDENTIFIER
|
||||||
|
{ lex_in_package_scope(0);
|
||||||
|
$$ = $4.type;
|
||||||
|
delete[]$4.text;
|
||||||
|
}
|
||||||
|
| K_string
|
||||||
|
{ string_type_t*tmp = new string_type_t;
|
||||||
|
FILE_NAME(tmp, @1);
|
||||||
|
$$ = tmp;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
statement /* IEEE1800-2005: A.6.4 */
|
statement /* IEEE1800-2005: A.6.4 */
|
||||||
: attribute_list_opt statement_item
|
: attribute_list_opt statement_item
|
||||||
{ pform_bind_attributes($2->attributes, $1);
|
{ pform_bind_attributes($2->attributes, $1);
|
||||||
|
|
@ -3773,7 +3828,7 @@ expr_primary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
| data_type '\'' '(' expression ')'
|
| simple_type_or_string '\'' '(' expression ')'
|
||||||
{ PExpr*base = $4;
|
{ PExpr*base = $4;
|
||||||
if (gn_system_verilog()) {
|
if (gn_system_verilog()) {
|
||||||
PECastType*tmp = new PECastType($1, base);
|
PECastType*tmp = new PECastType($1, base);
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,11 @@ void pform_package_import(const struct vlltype&, PPackage*pkg, const char*ident)
|
||||||
|
|
||||||
scope->imports[cur->first] = pkg;
|
scope->imports[cur->first] = pkg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (set<enum_type_t*>::const_iterator cur = pkg->enum_sets.begin()
|
||||||
|
; cur != pkg->enum_sets.end() ; ++ cur) {
|
||||||
|
scope->enum_sets.insert(*cur);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_pform_types_H
|
#ifndef IVL_pform_types_H
|
||||||
#define IVL_pform_types_H
|
#define IVL_pform_types_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007-2016 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2007-2018 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -33,6 +33,10 @@
|
||||||
# include <map>
|
# include <map>
|
||||||
# include <memory>
|
# include <memory>
|
||||||
|
|
||||||
|
#if __cplusplus < 201103L
|
||||||
|
#define unique_ptr auto_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* parse-form types.
|
* parse-form types.
|
||||||
*/
|
*/
|
||||||
|
|
@ -117,7 +121,7 @@ struct name_component_t {
|
||||||
struct decl_assignment_t {
|
struct decl_assignment_t {
|
||||||
perm_string name;
|
perm_string name;
|
||||||
std::list<pform_range_t>index;
|
std::list<pform_range_t>index;
|
||||||
std::auto_ptr<PExpr> expr;
|
std::unique_ptr<PExpr> expr;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pform_tf_port_t {
|
struct pform_tf_port_t {
|
||||||
|
|
@ -170,14 +174,14 @@ struct enum_type_t : public data_type_t {
|
||||||
ivl_variable_type_t base_type;
|
ivl_variable_type_t base_type;
|
||||||
bool signed_flag;
|
bool signed_flag;
|
||||||
bool integer_flag; // True if "integer" was used
|
bool integer_flag; // True if "integer" was used
|
||||||
std::auto_ptr< list<pform_range_t> > range;
|
std::unique_ptr< list<pform_range_t> > range;
|
||||||
std::auto_ptr< list<named_pexpr_t> > names;
|
std::unique_ptr< list<named_pexpr_t> > names;
|
||||||
LineInfo li;
|
LineInfo li;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct struct_member_t : public LineInfo {
|
struct struct_member_t : public LineInfo {
|
||||||
std::auto_ptr<data_type_t> type;
|
std::unique_ptr<data_type_t> type;
|
||||||
std::auto_ptr< list<decl_assignment_t*> > names;
|
std::unique_ptr< list<decl_assignment_t*> > names;
|
||||||
void pform_dump(std::ostream&out, unsigned indent) const;
|
void pform_dump(std::ostream&out, unsigned indent) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -188,7 +192,7 @@ struct struct_type_t : public data_type_t {
|
||||||
|
|
||||||
bool packed_flag;
|
bool packed_flag;
|
||||||
bool union_flag;
|
bool union_flag;
|
||||||
std::auto_ptr< list<struct_member_t*> > members;
|
std::unique_ptr< list<struct_member_t*> > members;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct atom2_type_t : public data_type_t {
|
struct atom2_type_t : public data_type_t {
|
||||||
|
|
@ -234,7 +238,7 @@ struct vector_type_t : public data_type_t {
|
||||||
bool reg_flag; // True if "reg" was used
|
bool reg_flag; // True if "reg" was used
|
||||||
bool integer_flag; // True if "integer" was used
|
bool integer_flag; // True if "integer" was used
|
||||||
bool implicit_flag; // True if this type is implicitly logic/reg
|
bool implicit_flag; // True if this type is implicitly logic/reg
|
||||||
std::auto_ptr< list<pform_range_t> > pdims;
|
std::unique_ptr< list<pform_range_t> > pdims;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct array_base_t : public data_type_t {
|
struct array_base_t : public data_type_t {
|
||||||
|
|
@ -243,7 +247,7 @@ struct array_base_t : public data_type_t {
|
||||||
: base_type(btype), dims(pd) { }
|
: base_type(btype), dims(pd) { }
|
||||||
|
|
||||||
data_type_t*base_type;
|
data_type_t*base_type;
|
||||||
std::auto_ptr< list<pform_range_t> > dims;
|
std::unique_ptr< list<pform_range_t> > dims;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -376,4 +380,8 @@ extern std::ostream& operator<< (std::ostream&out, const pform_name_t&);
|
||||||
extern std::ostream& operator<< (std::ostream&out, const name_component_t&that);
|
extern std::ostream& operator<< (std::ostream&out, const name_component_t&that);
|
||||||
extern std::ostream& operator<< (std::ostream&out, const index_component_t&that);
|
extern std::ostream& operator<< (std::ostream&out, const index_component_t&that);
|
||||||
|
|
||||||
|
#if __cplusplus < 201103L
|
||||||
|
#undef unique_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* IVL_pform_types_H */
|
#endif /* IVL_pform_types_H */
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2000-2018 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
|
||||||
|
|
@ -1457,6 +1457,7 @@ extern "C" unsigned ivl_lpm_selects(ivl_lpm_t net)
|
||||||
case IVL_LPM_CONCATZ:
|
case IVL_LPM_CONCATZ:
|
||||||
cerr << "error: ivl_lpm_selects() is no longer supported for "
|
cerr << "error: ivl_lpm_selects() is no longer supported for "
|
||||||
"IVL_LPM_CONCAT, use ivl_lpm_size() instead." << endl;
|
"IVL_LPM_CONCAT, use ivl_lpm_size() instead." << endl;
|
||||||
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
3
t-dll.cc
3
t-dll.cc
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2015 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2000-2018 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
|
||||||
|
|
@ -2489,6 +2489,7 @@ void dll_target::scope(const NetScope*net)
|
||||||
case NetScope::PACKAGE:
|
case NetScope::PACKAGE:
|
||||||
cerr << "?:?" << ": internal error: "
|
cerr << "?:?" << ": internal error: "
|
||||||
<< "Package scopes should not have parents." << endl;
|
<< "Package scopes should not have parents." << endl;
|
||||||
|
// fallthrough
|
||||||
case NetScope::MODULE:
|
case NetScope::MODULE:
|
||||||
scop->type_ = IVL_SCT_MODULE;
|
scop->type_ = IVL_SCT_MODULE;
|
||||||
scop->tname_ = net->module_name();
|
scop->tname_ = net->module_name();
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* VHDL code generation for statements.
|
* VHDL code generation for statements.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2013 Nick Gasson (nick@nickg.me.uk)
|
* Copyright (C) 2008-2018 Nick Gasson (nick@nickg.me.uk)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -683,8 +683,10 @@ static void get_nexuses_from_expr(ivl_expr_t expr, set<ivl_nexus_t> &out)
|
||||||
break;
|
break;
|
||||||
case IVL_EX_TERNARY:
|
case IVL_EX_TERNARY:
|
||||||
get_nexuses_from_expr(ivl_expr_oper3(expr), out);
|
get_nexuses_from_expr(ivl_expr_oper3(expr), out);
|
||||||
|
// fallthrough
|
||||||
case IVL_EX_BINARY:
|
case IVL_EX_BINARY:
|
||||||
get_nexuses_from_expr(ivl_expr_oper2(expr), out);
|
get_nexuses_from_expr(ivl_expr_oper2(expr), out);
|
||||||
|
// fallthrough
|
||||||
case IVL_EX_UNARY:
|
case IVL_EX_UNARY:
|
||||||
get_nexuses_from_expr(ivl_expr_oper1(expr), out);
|
get_nexuses_from_expr(ivl_expr_oper1(expr), out);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1248,6 +1250,7 @@ static void process_number(vhdl_binop_expr *all, vhdl_var_ref *test,
|
||||||
switch (bits[i]) {
|
switch (bits[i]) {
|
||||||
case 'x':
|
case 'x':
|
||||||
if (is_casez) break;
|
if (is_casez) break;
|
||||||
|
// fallthrough
|
||||||
case '?':
|
case '?':
|
||||||
case 'z':
|
case 'z':
|
||||||
continue; // Ignore these.
|
continue; // Ignore these.
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ void vhdl_element::print() const
|
||||||
// Trap allocations of vhdl_element subclasses.
|
// Trap allocations of vhdl_element subclasses.
|
||||||
// This records the pointer allocated in a static field of vhdl_element
|
// This records the pointer allocated in a static field of vhdl_element
|
||||||
// so we can delete it just before the code generator exits.
|
// so we can delete it just before the code generator exits.
|
||||||
void* vhdl_element::operator new(size_t size) throw (bad_alloc)
|
void* vhdl_element::operator new(size_t size)
|
||||||
{
|
{
|
||||||
// Let the default new handle the allocation
|
// Let the default new handle the allocation
|
||||||
void* ptr = ::operator new(size);
|
void* ptr = ::operator new(size);
|
||||||
|
|
@ -171,4 +171,3 @@ int vhdl_element::free_all_objects()
|
||||||
|
|
||||||
return freed;
|
return freed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class vhdl_element {
|
||||||
public:
|
public:
|
||||||
virtual ~vhdl_element() {}
|
virtual ~vhdl_element() {}
|
||||||
|
|
||||||
void* operator new(size_t size) throw (std::bad_alloc);
|
void* operator new(size_t size);
|
||||||
void operator delete(void* ptr);
|
void operator delete(void* ptr);
|
||||||
|
|
||||||
virtual void emit(std::ostream &of, int level=0) const = 0;
|
virtual void emit(std::ostream &of, int level=0) const = 0;
|
||||||
|
|
@ -74,4 +74,3 @@ std::string nl_string(int level);
|
||||||
void blank_line(std::ostream &of, int level);
|
void blank_line(std::ostream &of, int level);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com)
|
* Copyright (C) 2011-2018 Cary R. (cygcary@yahoo.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -447,6 +447,7 @@ static void emit_expr_binary(ivl_scope_t scope, ivl_expr_t expr, unsigned wid,
|
||||||
ivl_expr_file(expr), ivl_expr_lineno(expr));
|
ivl_expr_file(expr), ivl_expr_lineno(expr));
|
||||||
vlog_errors += 1;
|
vlog_errors += 1;
|
||||||
}
|
}
|
||||||
|
//fallthrough
|
||||||
case '+':
|
case '+':
|
||||||
case '-':
|
case '-':
|
||||||
case '*':
|
case '*':
|
||||||
|
|
@ -492,6 +493,7 @@ static void emit_expr_binary(ivl_scope_t scope, ivl_expr_t expr, unsigned wid,
|
||||||
ivl_expr_file(expr), ivl_expr_lineno(expr));
|
ivl_expr_file(expr), ivl_expr_lineno(expr));
|
||||||
vlog_errors += 1;
|
vlog_errors += 1;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'r':
|
case 'r':
|
||||||
emit_expr(scope, oper1, wid, 0, 0, 0);
|
emit_expr(scope, oper1, wid, 0, 0, 0);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2015 Cary R. (cygcary@yahoo.com)
|
* Copyright (C) 2011-2018 Cary R. (cygcary@yahoo.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -1055,6 +1055,7 @@ static void emit_lpm_as_ca(ivl_scope_t scope, ivl_lpm_t lpm,
|
||||||
"should not be generated.\n",
|
"should not be generated.\n",
|
||||||
ivl_lpm_file(lpm), ivl_lpm_lineno(lpm));
|
ivl_lpm_file(lpm), ivl_lpm_lineno(lpm));
|
||||||
vlog_errors += 1;
|
vlog_errors += 1;
|
||||||
|
// fallthrough
|
||||||
case IVL_LPM_CONCAT:
|
case IVL_LPM_CONCAT:
|
||||||
emit_lpm_concat(scope, lpm);
|
emit_lpm_concat(scope, lpm);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2167,10 +2168,9 @@ void dump_nexus_information(ivl_scope_t scope, ivl_nexus_t nex)
|
||||||
case IVL_VT_BOOL: fprintf(stderr, " bool"); break;
|
case IVL_VT_BOOL: fprintf(stderr, " bool"); break;
|
||||||
case IVL_VT_LOGIC: fprintf(stderr, " logic"); break;
|
case IVL_VT_LOGIC: fprintf(stderr, " logic"); break;
|
||||||
case IVL_VT_STRING: fprintf(stderr, " string"); break;
|
case IVL_VT_STRING: fprintf(stderr, " string"); break;
|
||||||
case IVL_VT_DARRAY: fprintf(stderr, " dynamic array");
|
case IVL_VT_DARRAY: fprintf(stderr, " dynamic array"); break;
|
||||||
case IVL_VT_CLASS: fprintf(stderr, " class");
|
case IVL_VT_CLASS: fprintf(stderr, " class"); break;
|
||||||
case IVL_VT_QUEUE: fprintf(stderr, " queue");
|
case IVL_VT_QUEUE: fprintf(stderr, " queue"); break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (ivl_signal_signed(sig)) fprintf(stderr, " <signed>");
|
if (ivl_signal_signed(sig)) fprintf(stderr, " <signed>");
|
||||||
} else fprintf(stderr, "Error: No/missing information!");
|
} else fprintf(stderr, "Error: No/missing information!");
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001-2018 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
|
||||||
|
|
@ -823,6 +823,7 @@ static void draw_udp_in_scope(ivl_net_logic_t lptr)
|
||||||
* (.resolv, etc.) can be built before we build the .udp call.
|
* (.resolv, etc.) can be built before we build the .udp call.
|
||||||
* This matches what is done for the other primitives.
|
* This matches what is done for the other primitives.
|
||||||
*/
|
*/
|
||||||
|
assert(ivl_logic_pins(lptr) > 0);
|
||||||
ninp = ivl_logic_pins(lptr) - 1;
|
ninp = ivl_logic_pins(lptr) - 1;
|
||||||
input_strings = calloc(ninp, sizeof(char*));
|
input_strings = calloc(ninp, sizeof(char*));
|
||||||
for (pdx = 0 ; pdx < ninp ; pdx += 1) {
|
for (pdx = 0 ; pdx < ninp ; pdx += 1) {
|
||||||
|
|
@ -885,7 +886,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
||||||
ivl_drive_t str1 = ivl_logic_drive1(lptr);
|
ivl_drive_t str1 = ivl_logic_drive1(lptr);
|
||||||
|
|
||||||
int level;
|
int level;
|
||||||
int ninp;
|
unsigned ninp;
|
||||||
const char **input_strings;
|
const char **input_strings;
|
||||||
|
|
||||||
switch (ivl_logic_type(lptr)) {
|
switch (ivl_logic_type(lptr)) {
|
||||||
|
|
@ -1018,8 +1019,8 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
||||||
|
|
||||||
/* Get all the input label that I will use for parameters to
|
/* Get all the input label that I will use for parameters to
|
||||||
the functor that I create later. */
|
the functor that I create later. */
|
||||||
|
assert(ivl_logic_pins(lptr) > 0);
|
||||||
ninp = ivl_logic_pins(lptr) - 1;
|
ninp = ivl_logic_pins(lptr) - 1;
|
||||||
assert(ninp >= 0);
|
|
||||||
input_strings = calloc(ninp, sizeof(char*));
|
input_strings = calloc(ninp, sizeof(char*));
|
||||||
for (pdx = 0 ; pdx < (unsigned)ninp ; pdx += 1)
|
for (pdx = 0 ; pdx < (unsigned)ninp ; pdx += 1)
|
||||||
input_strings[pdx] = draw_net_input(ivl_logic_pin(lptr, pdx+1));
|
input_strings[pdx] = draw_net_input(ivl_logic_pin(lptr, pdx+1));
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef VERIUSER_H
|
#ifndef VERIUSER_H
|
||||||
#define VERIUSER_H
|
#define VERIUSER_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2002-2018 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
|
||||||
|
|
@ -159,6 +159,7 @@ extern void veriusertfs_register_table(p_tfcell vtable);
|
||||||
|
|
||||||
/* callback reasons */
|
/* callback reasons */
|
||||||
#define reason_checktf 1
|
#define reason_checktf 1
|
||||||
|
#define reason_sizetf 2
|
||||||
#define reason_calltf 3
|
#define reason_calltf 3
|
||||||
#define reason_paramvc 7
|
#define reason_paramvc 7
|
||||||
#define reason_synch 8
|
#define reason_synch 8
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef IVL_expression_H
|
#ifndef IVL_expression_H
|
||||||
#define IVL_expression_H
|
#define IVL_expression_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2011-2018 Stephen Williams (steve@icarus.com)
|
||||||
* Copyright CERN 2015 / Stephen Williams (steve@icarus.com),
|
* Copyright CERN 2015 / Stephen Williams (steve@icarus.com),
|
||||||
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
* @author Maciej Suminski (maciej.suminski@cern.ch)
|
||||||
*
|
*
|
||||||
|
|
@ -38,6 +38,10 @@ class VTypeArray;
|
||||||
class VTypePrimitive;
|
class VTypePrimitive;
|
||||||
class ExpName;
|
class ExpName;
|
||||||
|
|
||||||
|
#if __cplusplus < 201103L
|
||||||
|
#define unique_ptr auto_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ExprVisitor {
|
struct ExprVisitor {
|
||||||
virtual ~ExprVisitor() {};
|
virtual ~ExprVisitor() {};
|
||||||
virtual void operator() (Expression*s) = 0;
|
virtual void operator() (Expression*s) = 0;
|
||||||
|
|
@ -255,8 +259,8 @@ class ExpAggregate : public Expression {
|
||||||
void dump(ostream&out, int indent) const;
|
void dump(ostream&out, int indent) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::auto_ptr<Expression>expr_;
|
std::unique_ptr<Expression>expr_;
|
||||||
std::auto_ptr<prange_t> range_;
|
std::unique_ptr<prange_t> range_;
|
||||||
private: // not implemented
|
private: // not implemented
|
||||||
choice_t& operator= (const choice_t&);
|
choice_t& operator= (const choice_t&);
|
||||||
};
|
};
|
||||||
|
|
@ -718,7 +722,7 @@ class ExpName : public Expression {
|
||||||
const list<index_t*>&indices, int field_size);
|
const list<index_t*>&indices, int field_size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::auto_ptr<ExpName> prefix_;
|
std::unique_ptr<ExpName> prefix_;
|
||||||
perm_string name_;
|
perm_string name_;
|
||||||
Expression*index_;
|
Expression*index_;
|
||||||
Expression*lsb_;
|
Expression*lsb_;
|
||||||
|
|
@ -899,4 +903,8 @@ class ExpTime : public Expression {
|
||||||
timeunit_t unit_;
|
timeunit_t unit_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if __cplusplus < 201103L
|
||||||
|
#undef unique_ptr
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* IVL_expression_H */
|
#endif /* IVL_expression_H */
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ else
|
||||||
INCLUDE_PATH = -I. -I.. -I$(srcdir) -I$(srcdir)/..
|
INCLUDE_PATH = -I. -I.. -I$(srcdir) -I$(srcdir)/..
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS = $(INCLUDE_PATH) @file64_support@ @CPPFLAGS@ @DEFS@ @PICFLAG@
|
CPPFLAGS = $(INCLUDE_PATH) @file64_support@ @CPPFLAGS@ @DEFS@ -DICARUS_VPI_CONST=const @PICFLAG@
|
||||||
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
||||||
CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
|
CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
|
|
|
||||||
463
vpi/fstapi.c
463
vpi/fstapi.c
|
|
@ -283,7 +283,7 @@ static char *fstRealpath(const char *path, char *resolved_path)
|
||||||
#if (defined(__MACH__) && defined(__APPLE__))
|
#if (defined(__MACH__) && defined(__APPLE__))
|
||||||
if(!resolved_path)
|
if(!resolved_path)
|
||||||
{
|
{
|
||||||
resolved_path = malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */
|
resolved_path = (char *)malloc(PATH_MAX+1); /* fixes bug on Leopard when resolved_path == NULL */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -293,7 +293,7 @@ return(realpath(path, resolved_path));
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
if(!resolved_path)
|
if(!resolved_path)
|
||||||
{
|
{
|
||||||
resolved_path = malloc(PATH_MAX+1);
|
resolved_path = (char *)malloc(PATH_MAX+1);
|
||||||
}
|
}
|
||||||
return(_fullpath(resolved_path, path, PATH_MAX));
|
return(_fullpath(resolved_path, path, PATH_MAX));
|
||||||
#else
|
#else
|
||||||
|
|
@ -317,7 +317,7 @@ static void *fstMmap2(size_t __len, int __fd, off_t __off)
|
||||||
{
|
{
|
||||||
(void)__off;
|
(void)__off;
|
||||||
|
|
||||||
unsigned char *pnt = malloc(__len);
|
unsigned char *pnt = (unsigned char *)malloc(__len);
|
||||||
off_t cur_offs = lseek(__fd, 0, SEEK_CUR);
|
off_t cur_offs = lseek(__fd, 0, SEEK_CUR);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
|
|
@ -793,6 +793,8 @@ char *geom_handle_nam;
|
||||||
char *valpos_handle_nam;
|
char *valpos_handle_nam;
|
||||||
char *curval_handle_nam;
|
char *curval_handle_nam;
|
||||||
char *tchn_handle_nam;
|
char *tchn_handle_nam;
|
||||||
|
|
||||||
|
fstEnumHandle max_enumhandle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -970,12 +972,12 @@ fflush(xc->handle);
|
||||||
if(!xc->valpos_mem)
|
if(!xc->valpos_mem)
|
||||||
{
|
{
|
||||||
fflush(xc->valpos_handle);
|
fflush(xc->valpos_handle);
|
||||||
xc->valpos_mem = fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0);
|
xc->valpos_mem = (uint32_t *)fstMmap(NULL, xc->maxhandle * 4 * sizeof(uint32_t), PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->valpos_handle), 0);
|
||||||
}
|
}
|
||||||
if(!xc->curval_mem)
|
if(!xc->curval_mem)
|
||||||
{
|
{
|
||||||
fflush(xc->curval_handle);
|
fflush(xc->curval_handle);
|
||||||
xc->curval_mem = fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0);
|
xc->curval_mem = (unsigned char *)fstMmap(NULL, xc->maxvalpos, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->curval_handle), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1106,7 +1108,7 @@ xc->next_huge_break = FST_ACTIVATE_HUGE_BREAK;
|
||||||
*/
|
*/
|
||||||
void *fstWriterCreate(const char *nam, int use_compressed_hier)
|
void *fstWriterCreate(const char *nam, int use_compressed_hier)
|
||||||
{
|
{
|
||||||
struct fstWriterContext *xc = calloc(1, sizeof(struct fstWriterContext));
|
struct fstWriterContext *xc = (struct fstWriterContext *)calloc(1, sizeof(struct fstWriterContext));
|
||||||
|
|
||||||
xc->compress_hier = use_compressed_hier;
|
xc->compress_hier = use_compressed_hier;
|
||||||
fstDetermineBreakSize(xc);
|
fstDetermineBreakSize(xc);
|
||||||
|
|
@ -1120,7 +1122,7 @@ if((!nam)||
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int flen = strlen(nam);
|
int flen = strlen(nam);
|
||||||
char *hf = calloc(1, flen + 6);
|
char *hf = (char *)calloc(1, flen + 6);
|
||||||
|
|
||||||
memcpy(hf, nam, flen);
|
memcpy(hf, nam, flen);
|
||||||
strcpy(hf + flen, ".hier");
|
strcpy(hf + flen, ".hier");
|
||||||
|
|
@ -1131,7 +1133,7 @@ if((!nam)||
|
||||||
xc->curval_handle = tmpfile_open(&xc->curval_handle_nam); /* .bits */
|
xc->curval_handle = tmpfile_open(&xc->curval_handle_nam); /* .bits */
|
||||||
xc->tchn_handle = tmpfile_open(&xc->tchn_handle_nam); /* .tchn */
|
xc->tchn_handle = tmpfile_open(&xc->tchn_handle_nam); /* .tchn */
|
||||||
xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
|
xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
|
||||||
xc->vchg_mem = malloc(xc->vchg_alloc_siz);
|
xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz);
|
||||||
|
|
||||||
if(xc->hier_handle && xc->geom_handle && xc->valpos_handle && xc->curval_handle && xc->vchg_mem && xc->tchn_handle)
|
if(xc->hier_handle && xc->geom_handle && xc->valpos_handle && xc->curval_handle && xc->vchg_mem && xc->tchn_handle)
|
||||||
{
|
{
|
||||||
|
|
@ -1180,7 +1182,7 @@ if(xc)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
destlen = xc->maxvalpos;
|
destlen = xc->maxvalpos;
|
||||||
dmem = malloc(compressBound(destlen));
|
dmem = (unsigned char *)malloc(compressBound(destlen));
|
||||||
rc = compress2(dmem, &destlen, xc->curval_mem, xc->maxvalpos, 4); /* was 9...which caused performance drag on traces with many signals */
|
rc = compress2(dmem, &destlen, xc->curval_mem, xc->maxvalpos, 4); /* was 9...which caused performance drag on traces with many signals */
|
||||||
|
|
||||||
fputc(FST_BL_SKIP, xc->handle); /* temporarily tag the section, use FST_BL_VCDATA on finalize */
|
fputc(FST_BL_SKIP, xc->handle); /* temporarily tag the section, use FST_BL_VCDATA on finalize */
|
||||||
|
|
@ -1269,7 +1271,7 @@ if((xc->vchg_siz <= 1)||(xc->already_in_flush)) return;
|
||||||
xc->already_in_flush = 1; /* should really do this with a semaphore */
|
xc->already_in_flush = 1; /* should really do this with a semaphore */
|
||||||
|
|
||||||
xc->section_header_only = 0;
|
xc->section_header_only = 0;
|
||||||
scratchpad = malloc(xc->vchg_siz);
|
scratchpad = (unsigned char *)malloc(xc->vchg_siz);
|
||||||
|
|
||||||
vchg_mem = xc->vchg_mem;
|
vchg_mem = xc->vchg_mem;
|
||||||
|
|
||||||
|
|
@ -1279,7 +1281,7 @@ fputc(xc->fourpack ? '4' : (xc->fastpack ? 'F' : 'Z'), f);
|
||||||
fpos = 1;
|
fpos = 1;
|
||||||
|
|
||||||
packmemlen = 1024; /* maintain a running "longest" allocation to */
|
packmemlen = 1024; /* maintain a running "longest" allocation to */
|
||||||
packmem = malloc(packmemlen); /* prevent continual malloc...free every loop iter */
|
packmem = (unsigned char *)malloc(packmemlen); /* prevent continual malloc...free every loop iter */
|
||||||
|
|
||||||
for(i=0;i<xc->maxhandle;i++)
|
for(i=0;i<xc->maxhandle;i++)
|
||||||
{
|
{
|
||||||
|
|
@ -1399,13 +1401,13 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
idx = ((vm4ip[1]+7) & ~7);
|
idx = ((vm4ip[1]+7) & ~7);
|
||||||
switch(vm4ip[1] & 7)
|
switch(vm4ip[1] & 7)
|
||||||
{
|
{
|
||||||
case 0: do { acc = (pnt[idx+7-8] & 1) << 0;
|
case 0: do { acc = (pnt[idx+7-8] & 1) << 0; /* fallthrough */
|
||||||
case 7: acc |= (pnt[idx+6-8] & 1) << 1;
|
case 7: acc |= (pnt[idx+6-8] & 1) << 1; /* fallthrough */
|
||||||
case 6: acc |= (pnt[idx+5-8] & 1) << 2;
|
case 6: acc |= (pnt[idx+5-8] & 1) << 2; /* fallthrough */
|
||||||
case 5: acc |= (pnt[idx+4-8] & 1) << 3;
|
case 5: acc |= (pnt[idx+4-8] & 1) << 3; /* fallthrough */
|
||||||
case 4: acc |= (pnt[idx+3-8] & 1) << 4;
|
case 4: acc |= (pnt[idx+3-8] & 1) << 4; /* fallthrough */
|
||||||
case 3: acc |= (pnt[idx+2-8] & 1) << 5;
|
case 3: acc |= (pnt[idx+2-8] & 1) << 5; /* fallthrough */
|
||||||
case 2: acc |= (pnt[idx+1-8] & 1) << 6;
|
case 2: acc |= (pnt[idx+1-8] & 1) << 6; /* fallthrough */
|
||||||
case 1: acc |= (pnt[idx+0-8] & 1) << 7;
|
case 1: acc |= (pnt[idx+0-8] & 1) << 7;
|
||||||
*(--scratchpnt) = acc;
|
*(--scratchpnt) = acc;
|
||||||
idx -= 8;
|
idx -= 8;
|
||||||
|
|
@ -1441,7 +1443,7 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
free(packmem);
|
free(packmem);
|
||||||
dmem = packmem = malloc(compressBound(packmemlen = wrlen));
|
dmem = packmem = (unsigned char *)malloc(compressBound(packmemlen = wrlen));
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = compress2(dmem, &destlen, scratchpnt, wrlen, 4);
|
rc = compress2(dmem, &destlen, scratchpnt, wrlen, 4);
|
||||||
|
|
@ -1496,7 +1498,7 @@ for(i=0;i<xc->maxhandle;i++)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
free(packmem);
|
free(packmem);
|
||||||
dmem = packmem = malloc(packmemlen = (wrlen * 2) + 2);
|
dmem = packmem = (unsigned char *)malloc(packmemlen = (wrlen * 2) + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = (xc->fourpack) ? LZ4_compress((char *)scratchpnt, (char *)dmem, wrlen) : fastlz_compress(scratchpnt, wrlen, dmem);
|
rc = (xc->fourpack) ? LZ4_compress((char *)scratchpnt, (char *)dmem, wrlen) : fastlz_compress(scratchpnt, wrlen, dmem);
|
||||||
|
|
@ -1678,11 +1680,11 @@ fflush(xc->tchn_handle);
|
||||||
tlen = ftello(xc->tchn_handle);
|
tlen = ftello(xc->tchn_handle);
|
||||||
fstWriterFseeko(xc, xc->tchn_handle, 0, SEEK_SET);
|
fstWriterFseeko(xc, xc->tchn_handle, 0, SEEK_SET);
|
||||||
|
|
||||||
tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0);
|
tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->tchn_handle), 0);
|
||||||
if(tmem)
|
if(tmem)
|
||||||
{
|
{
|
||||||
unsigned long destlen = tlen;
|
unsigned long destlen = tlen;
|
||||||
unsigned char *dmem = malloc(compressBound(destlen));
|
unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen));
|
||||||
int rc = compress2(dmem, &destlen, tmem, tlen, 9);
|
int rc = compress2(dmem, &destlen, tmem, tlen, 9);
|
||||||
|
|
||||||
if((rc == Z_OK) && (((off_t)destlen) < tlen))
|
if((rc == Z_OK) && (((off_t)destlen) < tlen))
|
||||||
|
|
@ -1781,7 +1783,7 @@ struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
|
||||||
|
|
||||||
if(xc->parallel_enabled)
|
if(xc->parallel_enabled)
|
||||||
{
|
{
|
||||||
struct fstWriterContext *xc2 = malloc(sizeof(struct fstWriterContext));
|
struct fstWriterContext *xc2 = (struct fstWriterContext *)malloc(sizeof(struct fstWriterContext));
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
pthread_mutex_lock(&xc->mutex);
|
pthread_mutex_lock(&xc->mutex);
|
||||||
|
|
@ -1790,16 +1792,16 @@ if(xc->parallel_enabled)
|
||||||
xc->xc_parent = xc;
|
xc->xc_parent = xc;
|
||||||
memcpy(xc2, xc, sizeof(struct fstWriterContext));
|
memcpy(xc2, xc, sizeof(struct fstWriterContext));
|
||||||
|
|
||||||
xc2->valpos_mem = malloc(xc->maxhandle * 4 * sizeof(uint32_t));
|
xc2->valpos_mem = (uint32_t *)malloc(xc->maxhandle * 4 * sizeof(uint32_t));
|
||||||
memcpy(xc2->valpos_mem, xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t));
|
memcpy(xc2->valpos_mem, xc->valpos_mem, xc->maxhandle * 4 * sizeof(uint32_t));
|
||||||
|
|
||||||
/* curval mem is updated in the thread */
|
/* curval mem is updated in the thread */
|
||||||
#ifdef FST_REMOVE_DUPLICATE_VC
|
#ifdef FST_REMOVE_DUPLICATE_VC
|
||||||
xc2->curval_mem = malloc(xc->maxvalpos);
|
xc2->curval_mem = (unsigned char *)malloc(xc->maxvalpos);
|
||||||
memcpy(xc2->curval_mem, xc->curval_mem, xc->maxvalpos);
|
memcpy(xc2->curval_mem, xc->curval_mem, xc->maxvalpos);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xc->vchg_mem = malloc(xc->vchg_alloc_siz);
|
xc->vchg_mem = (unsigned char *)malloc(xc->vchg_alloc_siz);
|
||||||
xc->vchg_mem[0] = '!';
|
xc->vchg_mem[0] = '!';
|
||||||
xc->vchg_siz = 1;
|
xc->vchg_siz = 1;
|
||||||
|
|
||||||
|
|
@ -1908,11 +1910,11 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
/* write out geom section */
|
/* write out geom section */
|
||||||
fflush(xc->geom_handle);
|
fflush(xc->geom_handle);
|
||||||
tlen = ftello(xc->geom_handle);
|
tlen = ftello(xc->geom_handle);
|
||||||
tmem = fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0);
|
tmem = (unsigned char *)fstMmap(NULL, tlen, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->geom_handle), 0);
|
||||||
if(tmem)
|
if(tmem)
|
||||||
{
|
{
|
||||||
unsigned long destlen = tlen;
|
unsigned long destlen = tlen;
|
||||||
unsigned char *dmem = malloc(compressBound(destlen));
|
unsigned char *dmem = (unsigned char *)malloc(compressBound(destlen));
|
||||||
int rc = compress2(dmem, &destlen, tmem, tlen, 9);
|
int rc = compress2(dmem, &destlen, tmem, tlen, 9);
|
||||||
|
|
||||||
if((rc != Z_OK) || (((off_t)destlen) > tlen))
|
if((rc != Z_OK) || (((off_t)destlen) > tlen))
|
||||||
|
|
@ -1980,7 +1982,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
int zfd;
|
int zfd;
|
||||||
int fourpack_duo = 0;
|
int fourpack_duo = 0;
|
||||||
#ifndef __MINGW32__
|
#ifndef __MINGW32__
|
||||||
char *fnam = malloc(strlen(xc->filename) + 5 + 1);
|
char *fnam = (char *)malloc(strlen(xc->filename) + 5 + 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fixup_offs = ftello(xc->handle);
|
fixup_offs = ftello(xc->handle);
|
||||||
|
|
@ -1991,7 +1993,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
|
|
||||||
if(!xc->fourpack)
|
if(!xc->fourpack)
|
||||||
{
|
{
|
||||||
unsigned char *mem = malloc(FST_GZIO_LEN);
|
unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN);
|
||||||
zfd = dup(fileno(xc->handle));
|
zfd = dup(fileno(xc->handle));
|
||||||
fflush(xc->handle);
|
fflush(xc->handle);
|
||||||
zhandle = gzdopen(zfd, "wb4");
|
zhandle = gzdopen(zfd, "wb4");
|
||||||
|
|
@ -2022,8 +2024,8 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
fflush(xc->handle);
|
fflush(xc->handle);
|
||||||
|
|
||||||
lz4_maxlen = LZ4_compressBound(xc->hier_file_len);
|
lz4_maxlen = LZ4_compressBound(xc->hier_file_len);
|
||||||
mem = malloc(lz4_maxlen);
|
mem = (unsigned char *)malloc(lz4_maxlen);
|
||||||
hmem = fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0);
|
hmem = (unsigned char *)fstMmap(NULL, xc->hier_file_len, PROT_READ|PROT_WRITE, MAP_SHARED, fileno(xc->hier_handle), 0);
|
||||||
packed_len = LZ4_compress((char *)hmem, (char *)mem, xc->hier_file_len);
|
packed_len = LZ4_compress((char *)hmem, (char *)mem, xc->hier_file_len);
|
||||||
fstMunmap(hmem, xc->hier_file_len);
|
fstMunmap(hmem, xc->hier_file_len);
|
||||||
|
|
||||||
|
|
@ -2036,7 +2038,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
int packed_len_duo;
|
int packed_len_duo;
|
||||||
|
|
||||||
lz4_maxlen_duo = LZ4_compressBound(packed_len);
|
lz4_maxlen_duo = LZ4_compressBound(packed_len);
|
||||||
mem_duo = malloc(lz4_maxlen_duo);
|
mem_duo = (unsigned char *)malloc(lz4_maxlen_duo);
|
||||||
packed_len_duo = LZ4_compress((char *)mem, (char *)mem_duo, packed_len);
|
packed_len_duo = LZ4_compress((char *)mem, (char *)mem_duo, packed_len);
|
||||||
|
|
||||||
fstWriterVarint(xc->handle, packed_len); /* 1st round compressed length */
|
fstWriterVarint(xc->handle, packed_len); /* 1st round compressed length */
|
||||||
|
|
@ -2096,7 +2098,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
off_t offpnt, uclen;
|
off_t offpnt, uclen;
|
||||||
int flen = strlen(xc->filename);
|
int flen = strlen(xc->filename);
|
||||||
char *hf = calloc(1, flen + 5);
|
char *hf = (char *)calloc(1, flen + 5);
|
||||||
|
|
||||||
strcpy(hf, xc->filename);
|
strcpy(hf, xc->filename);
|
||||||
strcpy(hf+flen, ".pak");
|
strcpy(hf+flen, ".pak");
|
||||||
|
|
@ -2104,7 +2106,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
|
|
||||||
if(fp)
|
if(fp)
|
||||||
{
|
{
|
||||||
void *dsth;
|
gzFile dsth;
|
||||||
int zfd;
|
int zfd;
|
||||||
char gz_membuf[FST_GZIO_LEN];
|
char gz_membuf[FST_GZIO_LEN];
|
||||||
|
|
||||||
|
|
@ -2160,7 +2162,7 @@ if(xc && !xc->already_in_close && !xc->already_in_flush)
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
{
|
{
|
||||||
int flen = strlen(xc->filename);
|
int flen = strlen(xc->filename);
|
||||||
char *hf = calloc(1, flen + 6);
|
char *hf = (char *)calloc(1, flen + 6);
|
||||||
strcpy(hf, xc->filename);
|
strcpy(hf, xc->filename);
|
||||||
|
|
||||||
if(xc->compress_hier)
|
if(xc->compress_hier)
|
||||||
|
|
@ -2303,7 +2305,7 @@ if(xc && path && path[0])
|
||||||
const unsigned char *path2 = (const unsigned char *)path;
|
const unsigned char *path2 = (const unsigned char *)path;
|
||||||
PPvoid_t pv;
|
PPvoid_t pv;
|
||||||
#else
|
#else
|
||||||
char *path2 = alloca(slen + 1); /* judy lacks const qualifier in its JudyHSIns definition */
|
char *path2 = (char *)alloca(slen + 1); /* judy lacks const qualifier in its JudyHSIns definition */
|
||||||
PPvoid_t pv;
|
PPvoid_t pv;
|
||||||
strcpy(path2, path);
|
strcpy(path2, path);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -2586,7 +2588,7 @@ if(xc && nam)
|
||||||
xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
|
xc->vchg_alloc_siz = xc->fst_break_size + xc->fst_break_add_size;
|
||||||
if(xc->vchg_mem)
|
if(xc->vchg_mem)
|
||||||
{
|
{
|
||||||
xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2724,6 +2726,111 @@ if(xc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fstEnumHandle fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits, const char **literal_arr, const char **val_arr)
|
||||||
|
{
|
||||||
|
fstEnumHandle handle = 0;
|
||||||
|
unsigned int *literal_lens = NULL;
|
||||||
|
unsigned int *val_lens = NULL;
|
||||||
|
int lit_len_tot = 0;
|
||||||
|
int val_len_tot = 0;
|
||||||
|
int name_len;
|
||||||
|
char elem_count_buf[16];
|
||||||
|
int elem_count_len;
|
||||||
|
int total_len;
|
||||||
|
int pos = 0;
|
||||||
|
char *attr_str = NULL;
|
||||||
|
|
||||||
|
if(ctx && name && literal_arr && val_arr && (elem_count != 0))
|
||||||
|
{
|
||||||
|
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
|
||||||
|
|
||||||
|
uint32_t i;
|
||||||
|
|
||||||
|
name_len = strlen(name);
|
||||||
|
elem_count_len = sprintf(elem_count_buf, "%" PRIu32, elem_count);
|
||||||
|
|
||||||
|
literal_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int));
|
||||||
|
val_lens = (unsigned int *)calloc(elem_count, sizeof(unsigned int));
|
||||||
|
|
||||||
|
for(i=0;i<elem_count;i++)
|
||||||
|
{
|
||||||
|
literal_lens[i] = strlen(literal_arr[i]);
|
||||||
|
lit_len_tot += fstUtilityBinToEscConvertedLen((unsigned char*)literal_arr[i], literal_lens[i]);
|
||||||
|
|
||||||
|
val_lens[i] = strlen(val_arr[i]);
|
||||||
|
val_len_tot += fstUtilityBinToEscConvertedLen((unsigned char*)val_arr[i], val_lens[i]);
|
||||||
|
|
||||||
|
if(min_valbits > 0)
|
||||||
|
{
|
||||||
|
if(val_lens[i] < min_valbits)
|
||||||
|
{
|
||||||
|
val_len_tot += (min_valbits - val_lens[i]); /* additional converted len is same for '0' character */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
total_len = name_len + 1 + elem_count_len + 1 + lit_len_tot + elem_count + val_len_tot + elem_count;
|
||||||
|
|
||||||
|
attr_str = (char*)malloc(total_len);
|
||||||
|
pos = 0;
|
||||||
|
|
||||||
|
memcpy(attr_str+pos, name, name_len);
|
||||||
|
pos += name_len;
|
||||||
|
attr_str[pos++] = ' ';
|
||||||
|
|
||||||
|
memcpy(attr_str+pos, elem_count_buf, elem_count_len);
|
||||||
|
pos += elem_count_len;
|
||||||
|
attr_str[pos++] = ' ';
|
||||||
|
|
||||||
|
for(i=0;i<elem_count;i++)
|
||||||
|
{
|
||||||
|
pos += fstUtilityBinToEsc((unsigned char*)attr_str+pos, (unsigned char*)literal_arr[i], literal_lens[i]);
|
||||||
|
attr_str[pos++] = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<elem_count;i++)
|
||||||
|
{
|
||||||
|
if(min_valbits > 0)
|
||||||
|
{
|
||||||
|
if(val_lens[i] < min_valbits)
|
||||||
|
{
|
||||||
|
memset(attr_str+pos, '0', min_valbits - val_lens[i]);
|
||||||
|
pos += (min_valbits - val_lens[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pos += fstUtilityBinToEsc((unsigned char*)attr_str+pos, (unsigned char*)val_arr[i], val_lens[i]);
|
||||||
|
attr_str[pos++] = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
attr_str[pos-1] = 0;
|
||||||
|
|
||||||
|
#ifdef FST_DEBUG
|
||||||
|
fprintf(stderr, FST_APIMESS"fstWriterCreateEnumTable() total_len: %d, pos: %d\n", total_len, pos);
|
||||||
|
fprintf(stderr, FST_APIMESS"*%s*\n", attr_str);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
fstWriterSetAttrBegin(xc, FST_AT_MISC, FST_MT_ENUMTABLE, attr_str, handle = ++xc->max_enumhandle);
|
||||||
|
|
||||||
|
free(attr_str);
|
||||||
|
free(val_lens);
|
||||||
|
free(literal_lens);
|
||||||
|
}
|
||||||
|
|
||||||
|
return(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle)
|
||||||
|
{
|
||||||
|
struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
|
||||||
|
if(xc && handle)
|
||||||
|
{
|
||||||
|
fstWriterSetAttrBegin(xc, FST_AT_MISC, FST_MT_ENUMTABLE, NULL, handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* value and time change emission
|
* value and time change emission
|
||||||
*/
|
*/
|
||||||
|
|
@ -2758,7 +2865,7 @@ if((xc) && (handle <= xc->maxhandle))
|
||||||
if((fpos + len + 10) > xc->vchg_alloc_siz)
|
if((fpos + len + 10) > xc->vchg_alloc_siz)
|
||||||
{
|
{
|
||||||
xc->vchg_alloc_siz += (xc->fst_break_add_size + len); /* +len added in the case of extremely long vectors and small break add sizes */
|
xc->vchg_alloc_siz += (xc->fst_break_add_size + len); /* +len added in the case of extremely long vectors and small break add sizes */
|
||||||
xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||||
if(!xc->vchg_mem)
|
if(!xc->vchg_mem)
|
||||||
{
|
{
|
||||||
fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitValueChange, exiting.\n");
|
fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitValueChange, exiting.\n");
|
||||||
|
|
@ -2872,7 +2979,7 @@ if((xc) && (handle <= xc->maxhandle))
|
||||||
if((fpos + len + 10 + 5) > xc->vchg_alloc_siz)
|
if((fpos + len + 10 + 5) > xc->vchg_alloc_siz)
|
||||||
{
|
{
|
||||||
xc->vchg_alloc_siz += (xc->fst_break_add_size + len + 5); /* +len added in the case of extremely long vectors and small break add sizes */
|
xc->vchg_alloc_siz += (xc->fst_break_add_size + len + 5); /* +len added in the case of extremely long vectors and small break add sizes */
|
||||||
xc->vchg_mem = realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
xc->vchg_mem = (unsigned char *)realloc(xc->vchg_mem, xc->vchg_alloc_siz);
|
||||||
if(!xc->vchg_mem)
|
if(!xc->vchg_mem)
|
||||||
{
|
{
|
||||||
fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitVariableLengthValueChange, exiting.\n");
|
fprintf(stderr, FST_APIMESS"Could not realloc() in fstWriterEmitVariableLengthValueChange, exiting.\n");
|
||||||
|
|
@ -2949,7 +3056,7 @@ struct fstWriterContext *xc = (struct fstWriterContext *)ctx;
|
||||||
|
|
||||||
if(xc)
|
if(xc)
|
||||||
{
|
{
|
||||||
struct fstBlackoutChain *b = calloc(1, sizeof(struct fstBlackoutChain));
|
struct fstBlackoutChain *b = (struct fstBlackoutChain *)calloc(1, sizeof(struct fstBlackoutChain));
|
||||||
|
|
||||||
b->tim = xc->curtime;
|
b->tim = xc->curtime;
|
||||||
b->active = (enable != 0);
|
b->active = (enable != 0);
|
||||||
|
|
@ -3248,12 +3355,12 @@ const char *fstReaderPushScope(void *ctx, const char *nam, void *user_info)
|
||||||
struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
|
struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
|
||||||
if(xc)
|
if(xc)
|
||||||
{
|
{
|
||||||
struct fstCurrHier *ch = malloc(sizeof(struct fstCurrHier));
|
struct fstCurrHier *ch = (struct fstCurrHier *)malloc(sizeof(struct fstCurrHier));
|
||||||
int chl = xc->curr_hier ? xc->curr_hier->len : 0;
|
int chl = xc->curr_hier ? xc->curr_hier->len : 0;
|
||||||
int len = chl + 1 + strlen(nam);
|
int len = chl + 1 + strlen(nam);
|
||||||
if(len >= xc->flat_hier_alloc_len)
|
if(len >= xc->flat_hier_alloc_len)
|
||||||
{
|
{
|
||||||
xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? realloc(xc->curr_flat_hier_nam, len+1) : malloc(len+1);
|
xc->curr_flat_hier_nam = xc->curr_flat_hier_nam ? (char *)realloc(xc->curr_flat_hier_nam, len+1) : (char *)malloc(len+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(chl)
|
if(chl)
|
||||||
|
|
@ -3473,7 +3580,7 @@ return(xc ? xc->date : NULL);
|
||||||
int fstReaderGetFileType(void *ctx)
|
int fstReaderGetFileType(void *ctx)
|
||||||
{
|
{
|
||||||
struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
|
struct fstReaderContext *xc = (struct fstReaderContext *)ctx;
|
||||||
return(xc ? xc->filetype : FST_FT_VERILOG);
|
return(xc ? (int)xc->filetype : (int)FST_FT_VERILOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -3606,8 +3713,8 @@ int pass_status = 1;
|
||||||
if(!xc->fh)
|
if(!xc->fh)
|
||||||
{
|
{
|
||||||
off_t offs_cache = ftello(xc->f);
|
off_t offs_cache = ftello(xc->f);
|
||||||
char *fnam = malloc(strlen(xc->filename) + 6 + 16 + 32 + 1);
|
char *fnam = (char *)malloc(strlen(xc->filename) + 6 + 16 + 32 + 1);
|
||||||
unsigned char *mem = malloc(FST_GZIO_LEN);
|
unsigned char *mem = (unsigned char *)malloc(FST_GZIO_LEN);
|
||||||
off_t hl, uclen;
|
off_t hl, uclen;
|
||||||
off_t clen = 0;
|
off_t clen = 0;
|
||||||
gzFile zhandle = NULL;
|
gzFile zhandle = NULL;
|
||||||
|
|
@ -3704,8 +3811,8 @@ if(!xc->fh)
|
||||||
else
|
else
|
||||||
if(htyp == FST_BL_HIER_LZ4DUO)
|
if(htyp == FST_BL_HIER_LZ4DUO)
|
||||||
{
|
{
|
||||||
unsigned char *lz4_cmem = malloc(clen);
|
unsigned char *lz4_cmem = (unsigned char *)malloc(clen);
|
||||||
unsigned char *lz4_ucmem = malloc(uclen);
|
unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen);
|
||||||
unsigned char *lz4_ucmem2;
|
unsigned char *lz4_ucmem2;
|
||||||
uint64_t uclen2;
|
uint64_t uclen2;
|
||||||
int skiplen2 = 0;
|
int skiplen2 = 0;
|
||||||
|
|
@ -3713,7 +3820,7 @@ if(!xc->fh)
|
||||||
fstFread(lz4_cmem, clen, 1, xc->f);
|
fstFread(lz4_cmem, clen, 1, xc->f);
|
||||||
|
|
||||||
uclen2 = fstGetVarint64(lz4_cmem, &skiplen2);
|
uclen2 = fstGetVarint64(lz4_cmem, &skiplen2);
|
||||||
lz4_ucmem2 = malloc(uclen2);
|
lz4_ucmem2 = (unsigned char *)malloc(uclen2);
|
||||||
pass_status = (uclen2 == (uint64_t)LZ4_decompress_safe_partial ((char *)lz4_cmem + skiplen2, (char *)lz4_ucmem2, clen - skiplen2, uclen2, uclen2));
|
pass_status = (uclen2 == (uint64_t)LZ4_decompress_safe_partial ((char *)lz4_cmem + skiplen2, (char *)lz4_ucmem2, clen - skiplen2, uclen2, uclen2));
|
||||||
if(pass_status)
|
if(pass_status)
|
||||||
{
|
{
|
||||||
|
|
@ -3732,8 +3839,8 @@ if(!xc->fh)
|
||||||
else
|
else
|
||||||
if(htyp == FST_BL_HIER_LZ4)
|
if(htyp == FST_BL_HIER_LZ4)
|
||||||
{
|
{
|
||||||
unsigned char *lz4_cmem = malloc(clen);
|
unsigned char *lz4_cmem = (unsigned char *)malloc(clen);
|
||||||
unsigned char *lz4_ucmem = malloc(uclen);
|
unsigned char *lz4_ucmem = (unsigned char *)malloc(uclen);
|
||||||
|
|
||||||
fstFread(lz4_cmem, clen, 1, xc->f);
|
fstFread(lz4_cmem, clen, 1, xc->f);
|
||||||
pass_status = (uclen == LZ4_decompress_safe_partial ((char *)lz4_cmem, (char *)lz4_ucmem, clen, uclen, uclen));
|
pass_status = (uclen == LZ4_decompress_safe_partial ((char *)lz4_cmem, (char *)lz4_ucmem, clen, uclen, uclen));
|
||||||
|
|
@ -3970,7 +4077,7 @@ if(!xc->fh)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
str = malloc(FST_ID_NAM_ATTR_SIZ+1);
|
str = (char *)malloc(FST_ID_NAM_ATTR_SIZ+1);
|
||||||
|
|
||||||
if(fv)
|
if(fv)
|
||||||
{
|
{
|
||||||
|
|
@ -3984,35 +4091,35 @@ if(fv)
|
||||||
switch(xc->timescale)
|
switch(xc->timescale)
|
||||||
{
|
{
|
||||||
case 2: time_scale = 100; time_dimension[0] = 0; break;
|
case 2: time_scale = 100; time_dimension[0] = 0; break;
|
||||||
case 1: time_scale = 10;
|
case 1: time_scale = 10; /* fallthrough */
|
||||||
case 0: time_dimension[0] = 0; break;
|
case 0: time_dimension[0] = 0; break;
|
||||||
|
|
||||||
case -1: time_scale = 100; time_dimension[0] = 'm'; break;
|
case -1: time_scale = 100; time_dimension[0] = 'm'; break;
|
||||||
case -2: time_scale = 10;
|
case -2: time_scale = 10; /* fallthrough */
|
||||||
case -3: time_dimension[0] = 'm'; break;
|
case -3: time_dimension[0] = 'm'; break;
|
||||||
|
|
||||||
case -4: time_scale = 100; time_dimension[0] = 'u'; break;
|
case -4: time_scale = 100; time_dimension[0] = 'u'; break;
|
||||||
case -5: time_scale = 10;
|
case -5: time_scale = 10; /* fallthrough */
|
||||||
case -6: time_dimension[0] = 'u'; break;
|
case -6: time_dimension[0] = 'u'; break;
|
||||||
|
|
||||||
case -10: time_scale = 100; time_dimension[0] = 'p'; break;
|
case -10: time_scale = 100; time_dimension[0] = 'p'; break;
|
||||||
case -11: time_scale = 10;
|
case -11: time_scale = 10; /* fallthrough */
|
||||||
case -12: time_dimension[0] = 'p'; break;
|
case -12: time_dimension[0] = 'p'; break;
|
||||||
|
|
||||||
case -13: time_scale = 100; time_dimension[0] = 'f'; break;
|
case -13: time_scale = 100; time_dimension[0] = 'f'; break;
|
||||||
case -14: time_scale = 10;
|
case -14: time_scale = 10; /* fallthrough */
|
||||||
case -15: time_dimension[0] = 'f'; break;
|
case -15: time_dimension[0] = 'f'; break;
|
||||||
|
|
||||||
case -16: time_scale = 100; time_dimension[0] = 'a'; break;
|
case -16: time_scale = 100; time_dimension[0] = 'a'; break;
|
||||||
case -17: time_scale = 10;
|
case -17: time_scale = 10; /* fallthrough */
|
||||||
case -18: time_dimension[0] = 'a'; break;
|
case -18: time_dimension[0] = 'a'; break;
|
||||||
|
|
||||||
case -19: time_scale = 100; time_dimension[0] = 'z'; break;
|
case -19: time_scale = 100; time_dimension[0] = 'z'; break;
|
||||||
case -20: time_scale = 10;
|
case -20: time_scale = 10; /* fallthrough */
|
||||||
case -21: time_dimension[0] = 'z'; break;
|
case -21: time_dimension[0] = 'z'; break;
|
||||||
|
|
||||||
case -7: time_scale = 100; time_dimension[0] = 'n'; break;
|
case -7: time_scale = 100; time_dimension[0] = 'n'; break;
|
||||||
case -8: time_scale = 10;
|
case -8: time_scale = 10; /* fallthrough */
|
||||||
case -9:
|
case -9:
|
||||||
default: time_dimension[0] = 'n'; break;
|
default: time_dimension[0] = 'n'; break;
|
||||||
}
|
}
|
||||||
|
|
@ -4024,10 +4131,10 @@ xc->maxhandle = 0;
|
||||||
xc->num_alias = 0;
|
xc->num_alias = 0;
|
||||||
|
|
||||||
free(xc->signal_lens);
|
free(xc->signal_lens);
|
||||||
xc->signal_lens = malloc(num_signal_dyn*sizeof(uint32_t));
|
xc->signal_lens = (uint32_t *)malloc(num_signal_dyn*sizeof(uint32_t));
|
||||||
|
|
||||||
free(xc->signal_typs);
|
free(xc->signal_typs);
|
||||||
xc->signal_typs = malloc(num_signal_dyn*sizeof(unsigned char));
|
xc->signal_typs = (unsigned char *)malloc(num_signal_dyn*sizeof(unsigned char));
|
||||||
|
|
||||||
fstReaderFseeko(xc, xc->fh, 0, SEEK_SET);
|
fstReaderFseeko(xc, xc->fh, 0, SEEK_SET);
|
||||||
while(!feof(xc->fh))
|
while(!feof(xc->fh))
|
||||||
|
|
@ -4155,8 +4262,8 @@ while(!feof(xc->fh))
|
||||||
if(xc->maxhandle == num_signal_dyn)
|
if(xc->maxhandle == num_signal_dyn)
|
||||||
{
|
{
|
||||||
num_signal_dyn *= 2;
|
num_signal_dyn *= 2;
|
||||||
xc->signal_lens = realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t));
|
xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, num_signal_dyn*sizeof(uint32_t));
|
||||||
xc->signal_typs = realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char));
|
xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, num_signal_dyn*sizeof(unsigned char));
|
||||||
}
|
}
|
||||||
xc->signal_lens[xc->maxhandle] = len;
|
xc->signal_lens[xc->maxhandle] = len;
|
||||||
xc->signal_typs[xc->maxhandle] = vartype;
|
xc->signal_typs[xc->maxhandle] = vartype;
|
||||||
|
|
@ -4208,14 +4315,14 @@ if(fv) fprintf(fv, "$enddefinitions $end\n");
|
||||||
|
|
||||||
maxhandle_scanbuild = xc->maxhandle ? xc->maxhandle : 1; /*scan-build warning suppression, in reality we have at least one signal */
|
maxhandle_scanbuild = xc->maxhandle ? xc->maxhandle : 1; /*scan-build warning suppression, in reality we have at least one signal */
|
||||||
|
|
||||||
xc->signal_lens = realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t));
|
xc->signal_lens = (uint32_t *)realloc(xc->signal_lens, maxhandle_scanbuild*sizeof(uint32_t));
|
||||||
xc->signal_typs = realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char));
|
xc->signal_typs = (unsigned char *)realloc(xc->signal_typs, maxhandle_scanbuild*sizeof(unsigned char));
|
||||||
|
|
||||||
free(xc->process_mask);
|
free(xc->process_mask);
|
||||||
xc->process_mask = calloc(1, (maxhandle_scanbuild+7)/8);
|
xc->process_mask = (unsigned char *)calloc(1, (maxhandle_scanbuild+7)/8);
|
||||||
|
|
||||||
free(xc->temp_signal_value_buf);
|
free(xc->temp_signal_value_buf);
|
||||||
xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1);
|
xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1);
|
||||||
|
|
||||||
xc->var_count = xc->maxhandle + xc->num_alias;
|
xc->var_count = xc->maxhandle + xc->num_alias;
|
||||||
|
|
||||||
|
|
@ -4244,7 +4351,7 @@ if(sectype == FST_BL_ZWRAPPER)
|
||||||
FILE *fcomp;
|
FILE *fcomp;
|
||||||
off_t offpnt, uclen;
|
off_t offpnt, uclen;
|
||||||
char gz_membuf[FST_GZIO_LEN];
|
char gz_membuf[FST_GZIO_LEN];
|
||||||
void *zhandle;
|
gzFile zhandle;
|
||||||
int zfd;
|
int zfd;
|
||||||
int flen = strlen(xc->filename);
|
int flen = strlen(xc->filename);
|
||||||
char *hf;
|
char *hf;
|
||||||
|
|
@ -4254,7 +4361,7 @@ if(sectype == FST_BL_ZWRAPPER)
|
||||||
|
|
||||||
if(!seclen) return(0); /* not finished compressing, this is a failed read */
|
if(!seclen) return(0); /* not finished compressing, this is a failed read */
|
||||||
|
|
||||||
hf = calloc(1, flen + 16 + 32 + 1);
|
hf = (char *)calloc(1, flen + 16 + 32 + 1);
|
||||||
|
|
||||||
sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc);
|
sprintf(hf, "%s.upk_%d_%p", xc->filename, getpid(), (void *)xc);
|
||||||
fcomp = fopen(hf, "w+b");
|
fcomp = fopen(hf, "w+b");
|
||||||
|
|
@ -4417,7 +4524,7 @@ if(gzread_pass_status)
|
||||||
{
|
{
|
||||||
uint64_t clen = seclen - 24;
|
uint64_t clen = seclen - 24;
|
||||||
uint64_t uclen = fstReaderUint64(xc->f);
|
uint64_t uclen = fstReaderUint64(xc->f);
|
||||||
unsigned char *ucdata = malloc(uclen);
|
unsigned char *ucdata = (unsigned char *)malloc(uclen);
|
||||||
unsigned char *pnt = ucdata;
|
unsigned char *pnt = ucdata;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
|
@ -4426,11 +4533,11 @@ if(gzread_pass_status)
|
||||||
xc->longest_signal_value_len = 32; /* arbitrarily set at 32...this is much longer than an expanded double */
|
xc->longest_signal_value_len = 32; /* arbitrarily set at 32...this is much longer than an expanded double */
|
||||||
|
|
||||||
free(xc->process_mask);
|
free(xc->process_mask);
|
||||||
xc->process_mask = calloc(1, (xc->maxhandle+7)/8);
|
xc->process_mask = (unsigned char *)calloc(1, (xc->maxhandle+7)/8);
|
||||||
|
|
||||||
if(clen != uclen)
|
if(clen != uclen)
|
||||||
{
|
{
|
||||||
unsigned char *cdata = malloc(clen);
|
unsigned char *cdata = (unsigned char *)malloc(clen);
|
||||||
unsigned long destlen = uclen;
|
unsigned long destlen = uclen;
|
||||||
unsigned long sourcelen = clen;
|
unsigned long sourcelen = clen;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
@ -4452,9 +4559,9 @@ if(gzread_pass_status)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(xc->signal_lens);
|
free(xc->signal_lens);
|
||||||
xc->signal_lens = malloc(sizeof(uint32_t) * xc->maxhandle);
|
xc->signal_lens = (uint32_t *)malloc(sizeof(uint32_t) * xc->maxhandle);
|
||||||
free(xc->signal_typs);
|
free(xc->signal_typs);
|
||||||
xc->signal_typs = malloc(sizeof(unsigned char) * xc->maxhandle);
|
xc->signal_typs = (unsigned char *)malloc(sizeof(unsigned char) * xc->maxhandle);
|
||||||
|
|
||||||
for(i=0;i<xc->maxhandle;i++)
|
for(i=0;i<xc->maxhandle;i++)
|
||||||
{
|
{
|
||||||
|
|
@ -4481,7 +4588,7 @@ if(gzread_pass_status)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(xc->temp_signal_value_buf);
|
free(xc->temp_signal_value_buf);
|
||||||
xc->temp_signal_value_buf = malloc(xc->longest_signal_value_len + 1);
|
xc->temp_signal_value_buf = (unsigned char *)malloc(xc->longest_signal_value_len + 1);
|
||||||
|
|
||||||
free(ucdata);
|
free(ucdata);
|
||||||
}
|
}
|
||||||
|
|
@ -4510,9 +4617,9 @@ if(gzread_pass_status)
|
||||||
|
|
||||||
xc->num_blackouts = fstReaderVarint32(xc->f);
|
xc->num_blackouts = fstReaderVarint32(xc->f);
|
||||||
free(xc->blackout_times);
|
free(xc->blackout_times);
|
||||||
xc->blackout_times = calloc(xc->num_blackouts, sizeof(uint64_t));
|
xc->blackout_times = (uint64_t *)calloc(xc->num_blackouts, sizeof(uint64_t));
|
||||||
free(xc->blackout_activity);
|
free(xc->blackout_activity);
|
||||||
xc->blackout_activity = calloc(xc->num_blackouts, sizeof(unsigned char));
|
xc->blackout_activity = (unsigned char *)calloc(xc->num_blackouts, sizeof(unsigned char));
|
||||||
|
|
||||||
for(i=0;i<xc->num_blackouts;i++)
|
for(i=0;i<xc->num_blackouts;i++)
|
||||||
{
|
{
|
||||||
|
|
@ -4547,7 +4654,7 @@ return(hdr_seen);
|
||||||
|
|
||||||
void *fstReaderOpenForUtilitiesOnly(void)
|
void *fstReaderOpenForUtilitiesOnly(void)
|
||||||
{
|
{
|
||||||
struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext));
|
struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext));
|
||||||
|
|
||||||
return(xc);
|
return(xc);
|
||||||
}
|
}
|
||||||
|
|
@ -4555,7 +4662,7 @@ return(xc);
|
||||||
|
|
||||||
void *fstReaderOpen(const char *nam)
|
void *fstReaderOpen(const char *nam)
|
||||||
{
|
{
|
||||||
struct fstReaderContext *xc = calloc(1, sizeof(struct fstReaderContext));
|
struct fstReaderContext *xc = (struct fstReaderContext *)calloc(1, sizeof(struct fstReaderContext));
|
||||||
|
|
||||||
if((!nam)||(!(xc->f=fopen(nam, "rb"))))
|
if((!nam)||(!(xc->f=fopen(nam, "rb"))))
|
||||||
{
|
{
|
||||||
|
|
@ -4565,7 +4672,7 @@ if((!nam)||(!(xc->f=fopen(nam, "rb"))))
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int flen = strlen(nam);
|
int flen = strlen(nam);
|
||||||
char *hf = calloc(1, flen + 6);
|
char *hf = (char *)calloc(1, flen + 6);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
#if defined(__MINGW32__) || defined(FST_MACOSX)
|
#if defined(__MINGW32__) || defined(FST_MACOSX)
|
||||||
|
|
@ -4704,9 +4811,9 @@ uint32_t mc_mem_len; /* corresponds to largest value encountered in chain_table_
|
||||||
|
|
||||||
if(!xc) return(0);
|
if(!xc) return(0);
|
||||||
|
|
||||||
scatterptr = calloc(xc->maxhandle, sizeof(uint32_t));
|
scatterptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||||
headptr = calloc(xc->maxhandle, sizeof(uint32_t));
|
headptr = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||||
length_remaining = calloc(xc->maxhandle, sizeof(uint32_t));
|
length_remaining = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||||
|
|
||||||
if(fv)
|
if(fv)
|
||||||
{
|
{
|
||||||
|
|
@ -4768,7 +4875,7 @@ for(;;)
|
||||||
|
|
||||||
|
|
||||||
mem_required_for_traversal = fstReaderUint64(xc->f);
|
mem_required_for_traversal = fstReaderUint64(xc->f);
|
||||||
mem_for_traversal = malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */
|
mem_for_traversal = (unsigned char *)malloc(mem_required_for_traversal + 66); /* add in potential fastlz overhead */
|
||||||
#ifdef FST_DEBUG
|
#ifdef FST_DEBUG
|
||||||
fprintf(stderr, FST_APIMESS"sec: %u seclen: %d begtim: %d endtim: %d\n",
|
fprintf(stderr, FST_APIMESS"sec: %u seclen: %d begtim: %d endtim: %d\n",
|
||||||
secnum, (int)seclen, (int)beg_tim, (int)end_tim);
|
secnum, (int)seclen, (int)beg_tim, (int)end_tim);
|
||||||
|
|
@ -4794,7 +4901,7 @@ for(;;)
|
||||||
(int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
|
(int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
|
||||||
#endif
|
#endif
|
||||||
if(tsec_clen > seclen) break; /* corrupted tsec_clen: by definition it can't be larger than size of section */
|
if(tsec_clen > seclen) break; /* corrupted tsec_clen: by definition it can't be larger than size of section */
|
||||||
ucdata = malloc(tsec_uclen);
|
ucdata = (unsigned char *)malloc(tsec_uclen);
|
||||||
if(!ucdata) break; /* malloc fail as tsec_uclen out of range from corrupted file */
|
if(!ucdata) break; /* malloc fail as tsec_uclen out of range from corrupted file */
|
||||||
destlen = tsec_uclen;
|
destlen = tsec_uclen;
|
||||||
sourcelen = tsec_clen;
|
sourcelen = tsec_clen;
|
||||||
|
|
@ -4803,7 +4910,7 @@ for(;;)
|
||||||
|
|
||||||
if(tsec_uclen != tsec_clen)
|
if(tsec_uclen != tsec_clen)
|
||||||
{
|
{
|
||||||
cdata = malloc(tsec_clen);
|
cdata = (unsigned char *)malloc(tsec_clen);
|
||||||
fstFread(cdata, tsec_clen, 1, xc->f);
|
fstFread(cdata, tsec_clen, 1, xc->f);
|
||||||
|
|
||||||
rc = uncompress(ucdata, &destlen, cdata, sourcelen);
|
rc = uncompress(ucdata, &destlen, cdata, sourcelen);
|
||||||
|
|
@ -4822,7 +4929,7 @@ for(;;)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(time_table);
|
free(time_table);
|
||||||
time_table = calloc(tsec_nitems, sizeof(uint64_t));
|
time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t));
|
||||||
tpnt = ucdata;
|
tpnt = ucdata;
|
||||||
tpval = 0;
|
tpval = 0;
|
||||||
for(ti=0;ti<tsec_nitems;ti++)
|
for(ti=0;ti<tsec_nitems;ti++)
|
||||||
|
|
@ -4833,7 +4940,7 @@ for(;;)
|
||||||
tpnt += skiplen;
|
tpnt += skiplen;
|
||||||
}
|
}
|
||||||
|
|
||||||
tc_head = calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t));
|
tc_head = (uint32_t *)calloc(tsec_nitems /* scan-build */ ? tsec_nitems : 1, sizeof(uint32_t));
|
||||||
free(ucdata);
|
free(ucdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -4847,7 +4954,7 @@ for(;;)
|
||||||
{
|
{
|
||||||
if((beg_tim != time_table[0]) || (blocks_skipped))
|
if((beg_tim != time_table[0]) || (blocks_skipped))
|
||||||
{
|
{
|
||||||
unsigned char *mu = malloc(frame_uclen);
|
unsigned char *mu = (unsigned char *)malloc(frame_uclen);
|
||||||
uint32_t sig_offs = 0;
|
uint32_t sig_offs = 0;
|
||||||
|
|
||||||
if(fv)
|
if(fv)
|
||||||
|
|
@ -4876,7 +4983,7 @@ for(;;)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned char *mc = malloc(frame_clen);
|
unsigned char *mc = (unsigned char *)malloc(frame_clen);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
unsigned long destlen = frame_uclen;
|
unsigned long destlen = frame_uclen;
|
||||||
|
|
@ -5061,7 +5168,7 @@ for(;;)
|
||||||
#ifdef FST_DEBUG
|
#ifdef FST_DEBUG
|
||||||
fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
|
fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
|
||||||
#endif
|
#endif
|
||||||
chain_cmem = malloc(chain_clen);
|
chain_cmem = (unsigned char *)malloc(chain_clen);
|
||||||
if(!chain_cmem) goto block_err;
|
if(!chain_cmem) goto block_err;
|
||||||
fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
|
fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
|
||||||
fstFread(chain_cmem, chain_clen, 1, xc->f);
|
fstFread(chain_cmem, chain_clen, 1, xc->f);
|
||||||
|
|
@ -5072,8 +5179,8 @@ for(;;)
|
||||||
free(chain_table_lengths);
|
free(chain_table_lengths);
|
||||||
|
|
||||||
vc_maxhandle_largest = vc_maxhandle;
|
vc_maxhandle_largest = vc_maxhandle;
|
||||||
chain_table = calloc((vc_maxhandle+1), sizeof(off_t));
|
chain_table = (off_t *)calloc((vc_maxhandle+1), sizeof(off_t));
|
||||||
chain_table_lengths = calloc((vc_maxhandle+1), sizeof(uint32_t));
|
chain_table_lengths = (uint32_t *)calloc((vc_maxhandle+1), sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!chain_table || !chain_table_lengths) goto block_err;
|
if(!chain_table || !chain_table_lengths) goto block_err;
|
||||||
|
|
@ -5182,7 +5289,7 @@ for(;;)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mc_mem_len = 16384;
|
mc_mem_len = 16384;
|
||||||
mc_mem = malloc(mc_mem_len); /* buffer for compressed reads */
|
mc_mem = (unsigned char *)malloc(mc_mem_len); /* buffer for compressed reads */
|
||||||
|
|
||||||
/* check compressed VC data */
|
/* check compressed VC data */
|
||||||
if(idx > xc->maxhandle) idx = xc->maxhandle;
|
if(idx > xc->maxhandle) idx = xc->maxhandle;
|
||||||
|
|
@ -5212,7 +5319,7 @@ for(;;)
|
||||||
if(mc_mem_len < chain_table_lengths[i])
|
if(mc_mem_len < chain_table_lengths[i])
|
||||||
{
|
{
|
||||||
free(mc_mem);
|
free(mc_mem);
|
||||||
mc_mem = malloc(mc_mem_len = chain_table_lengths[i]);
|
mc_mem = (unsigned char *)malloc(mc_mem_len = chain_table_lengths[i]);
|
||||||
}
|
}
|
||||||
mc = mc_mem;
|
mc = mc_mem;
|
||||||
|
|
||||||
|
|
@ -5391,7 +5498,7 @@ for(;;)
|
||||||
|
|
||||||
vcdid_len = fstVcdIDForFwrite(vcd_id+1, idx+1);
|
vcdid_len = fstVcdIDForFwrite(vcd_id+1, idx+1);
|
||||||
{
|
{
|
||||||
unsigned char *vesc = malloc(len*4 + 1);
|
unsigned char *vesc = (unsigned char *)malloc(len*4 + 1);
|
||||||
int vlen = fstUtilityBinToEsc(vesc, vdata, len);
|
int vlen = fstUtilityBinToEsc(vesc, vdata, len);
|
||||||
fstWritex(xc, vesc, vlen);
|
fstWritex(xc, vesc, vlen);
|
||||||
free(vesc);
|
free(vesc);
|
||||||
|
|
@ -5718,7 +5825,7 @@ if(!xc->rvat_sig_offs)
|
||||||
{
|
{
|
||||||
uint32_t cur_offs = 0;
|
uint32_t cur_offs = 0;
|
||||||
|
|
||||||
xc->rvat_sig_offs = calloc(xc->maxhandle, sizeof(uint32_t));
|
xc->rvat_sig_offs = (uint32_t *)calloc(xc->maxhandle, sizeof(uint32_t));
|
||||||
for(i=0;i<xc->maxhandle;i++)
|
for(i=0;i<xc->maxhandle;i++)
|
||||||
{
|
{
|
||||||
xc->rvat_sig_offs[i] = cur_offs;
|
xc->rvat_sig_offs[i] = cur_offs;
|
||||||
|
|
@ -5822,14 +5929,14 @@ tsec_nitems = fstReaderUint64(xc->f);
|
||||||
fprintf(stderr, FST_APIMESS"time section unc: %d, com: %d (%d items)\n",
|
fprintf(stderr, FST_APIMESS"time section unc: %d, com: %d (%d items)\n",
|
||||||
(int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
|
(int)tsec_uclen, (int)tsec_clen, (int)tsec_nitems);
|
||||||
#endif
|
#endif
|
||||||
ucdata = malloc(tsec_uclen);
|
ucdata = (unsigned char *)malloc(tsec_uclen);
|
||||||
destlen = tsec_uclen;
|
destlen = tsec_uclen;
|
||||||
sourcelen = tsec_clen;
|
sourcelen = tsec_clen;
|
||||||
|
|
||||||
fstReaderFseeko(xc, xc->f, -24 - ((off_t)tsec_clen), SEEK_CUR);
|
fstReaderFseeko(xc, xc->f, -24 - ((off_t)tsec_clen), SEEK_CUR);
|
||||||
if(tsec_uclen != tsec_clen)
|
if(tsec_uclen != tsec_clen)
|
||||||
{
|
{
|
||||||
cdata = malloc(tsec_clen);
|
cdata = (unsigned char *)malloc(tsec_clen);
|
||||||
fstFread(cdata, tsec_clen, 1, xc->f);
|
fstFread(cdata, tsec_clen, 1, xc->f);
|
||||||
|
|
||||||
rc = uncompress(ucdata, &destlen, cdata, sourcelen);
|
rc = uncompress(ucdata, &destlen, cdata, sourcelen);
|
||||||
|
|
@ -5847,7 +5954,7 @@ if(tsec_uclen != tsec_clen)
|
||||||
fstFread(ucdata, tsec_uclen, 1, xc->f);
|
fstFread(ucdata, tsec_uclen, 1, xc->f);
|
||||||
}
|
}
|
||||||
|
|
||||||
xc->rvat_time_table = calloc(tsec_nitems, sizeof(uint64_t));
|
xc->rvat_time_table = (uint64_t *)calloc(tsec_nitems, sizeof(uint64_t));
|
||||||
tpnt = ucdata;
|
tpnt = ucdata;
|
||||||
tpval = 0;
|
tpval = 0;
|
||||||
for(ti=0;ti<tsec_nitems;ti++)
|
for(ti=0;ti<tsec_nitems;ti++)
|
||||||
|
|
@ -5866,7 +5973,7 @@ fstReaderFseeko(xc, xc->f, blkpos+32, SEEK_SET);
|
||||||
frame_uclen = fstReaderVarint64(xc->f);
|
frame_uclen = fstReaderVarint64(xc->f);
|
||||||
frame_clen = fstReaderVarint64(xc->f);
|
frame_clen = fstReaderVarint64(xc->f);
|
||||||
xc->rvat_frame_maxhandle = fstReaderVarint64(xc->f);
|
xc->rvat_frame_maxhandle = fstReaderVarint64(xc->f);
|
||||||
xc->rvat_frame_data = malloc(frame_uclen);
|
xc->rvat_frame_data = (unsigned char *)malloc(frame_uclen);
|
||||||
|
|
||||||
if(frame_uclen == frame_clen)
|
if(frame_uclen == frame_clen)
|
||||||
{
|
{
|
||||||
|
|
@ -5874,7 +5981,7 @@ if(frame_uclen == frame_clen)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned char *mc = malloc(frame_clen);
|
unsigned char *mc = (unsigned char *)malloc(frame_clen);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
unsigned long destlen = frame_uclen;
|
unsigned long destlen = frame_uclen;
|
||||||
|
|
@ -5907,12 +6014,12 @@ indx_pos = indx_pntr - chain_clen;
|
||||||
#ifdef FST_DEBUG
|
#ifdef FST_DEBUG
|
||||||
fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
|
fprintf(stderr, FST_APIMESS"indx_pos: %d (%d bytes)\n", (int)indx_pos, (int)chain_clen);
|
||||||
#endif
|
#endif
|
||||||
chain_cmem = malloc(chain_clen);
|
chain_cmem = (unsigned char *)malloc(chain_clen);
|
||||||
fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
|
fstReaderFseeko(xc, xc->f, indx_pos, SEEK_SET);
|
||||||
fstFread(chain_cmem, chain_clen, 1, xc->f);
|
fstFread(chain_cmem, chain_clen, 1, xc->f);
|
||||||
|
|
||||||
xc->rvat_chain_table = calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t));
|
xc->rvat_chain_table = (off_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(off_t));
|
||||||
xc->rvat_chain_table_lengths = calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t));
|
xc->rvat_chain_table_lengths = (uint32_t *)calloc((xc->rvat_vc_maxhandle+1), sizeof(uint32_t));
|
||||||
|
|
||||||
pnt = chain_cmem;
|
pnt = chain_cmem;
|
||||||
idx = 0;
|
idx = 0;
|
||||||
|
|
@ -6054,8 +6161,8 @@ if(!xc->rvat_chain_mem)
|
||||||
xc->rvat_chain_len = fstReaderVarint32WithSkip(xc->f, &skiplen);
|
xc->rvat_chain_len = fstReaderVarint32WithSkip(xc->f, &skiplen);
|
||||||
if(xc->rvat_chain_len)
|
if(xc->rvat_chain_len)
|
||||||
{
|
{
|
||||||
unsigned char *mu = malloc(xc->rvat_chain_len);
|
unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len);
|
||||||
unsigned char *mc = malloc(xc->rvat_chain_table_lengths[facidx]);
|
unsigned char *mc = (unsigned char *)malloc(xc->rvat_chain_table_lengths[facidx]);
|
||||||
unsigned long destlen = xc->rvat_chain_len;
|
unsigned long destlen = xc->rvat_chain_len;
|
||||||
unsigned long sourcelen = xc->rvat_chain_table_lengths[facidx];
|
unsigned long sourcelen = xc->rvat_chain_table_lengths[facidx];
|
||||||
int rc = Z_OK;
|
int rc = Z_OK;
|
||||||
|
|
@ -6086,7 +6193,7 @@ if(!xc->rvat_chain_mem)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int destlen = xc->rvat_chain_table_lengths[facidx] - skiplen;
|
int destlen = xc->rvat_chain_table_lengths[facidx] - skiplen;
|
||||||
unsigned char *mu = malloc(xc->rvat_chain_len = destlen);
|
unsigned char *mu = (unsigned char *)malloc(xc->rvat_chain_len = destlen);
|
||||||
fstFread(mu, destlen, 1, xc->f);
|
fstFread(mu, destlen, 1, xc->f);
|
||||||
/* data to process is for(j=0;j<destlen;j++) in mu[j] */
|
/* data to process is for(j=0;j<destlen;j++) in mu[j] */
|
||||||
xc->rvat_chain_mem = mu;
|
xc->rvat_chain_mem = mu;
|
||||||
|
|
@ -6387,17 +6494,17 @@ static uint32_t j_hash(const uint8_t *k, uint32_t length, uint32_t initval)
|
||||||
c += length;
|
c += length;
|
||||||
switch(len) /* all the case statements fall through */
|
switch(len) /* all the case statements fall through */
|
||||||
{
|
{
|
||||||
case 11: c+=((uint32_t)k[10]<<24);
|
case 11: c+=((uint32_t)k[10]<<24); /* fallthrough */
|
||||||
case 10: c+=((uint32_t)k[9]<<16);
|
case 10: c+=((uint32_t)k[9]<<16); /* fallthrough */
|
||||||
case 9 : c+=((uint32_t)k[8]<<8);
|
case 9 : c+=((uint32_t)k[8]<<8); /* fallthrough */
|
||||||
/* the first byte of c is reserved for the length */
|
/* the first byte of c is reserved for the length */
|
||||||
case 8 : b+=((uint32_t)k[7]<<24);
|
case 8 : b+=((uint32_t)k[7]<<24); /* fallthrough */
|
||||||
case 7 : b+=((uint32_t)k[6]<<16);
|
case 7 : b+=((uint32_t)k[6]<<16); /* fallthrough */
|
||||||
case 6 : b+=((uint32_t)k[5]<<8);
|
case 6 : b+=((uint32_t)k[5]<<8); /* fallthrough */
|
||||||
case 5 : b+=k[4];
|
case 5 : b+=k[4]; /* fallthrough */
|
||||||
case 4 : a+=((uint32_t)k[3]<<24);
|
case 4 : a+=((uint32_t)k[3]<<24); /* fallthrough */
|
||||||
case 3 : a+=((uint32_t)k[2]<<16);
|
case 3 : a+=((uint32_t)k[2]<<16); /* fallthrough */
|
||||||
case 2 : a+=((uint32_t)k[1]<<8);
|
case 2 : a+=((uint32_t)k[1]<<8); /* fallthrough */
|
||||||
case 1 : a+=k[0];
|
case 1 : a+=k[0];
|
||||||
/* case 0: nothing left to add */
|
/* case 0: nothing left to add */
|
||||||
}
|
}
|
||||||
|
|
@ -6432,7 +6539,7 @@ struct collchain_t *chain, *pchain;
|
||||||
|
|
||||||
if(!*base)
|
if(!*base)
|
||||||
{
|
{
|
||||||
*base = calloc(1, (hashmask + 1) * sizeof(void *));
|
*base = (struct collchain_t **)calloc(1, (hashmask + 1) * sizeof(void *));
|
||||||
}
|
}
|
||||||
ar = *base;
|
ar = *base;
|
||||||
|
|
||||||
|
|
@ -6455,7 +6562,7 @@ while(chain)
|
||||||
chain = chain->next;
|
chain = chain->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
chain = calloc(1, sizeof(struct collchain_t) + length - 1);
|
chain = (struct collchain_t *)calloc(1, sizeof(struct collchain_t) + length - 1);
|
||||||
memcpy(chain->mem, mem, length);
|
memcpy(chain->mem, mem, length);
|
||||||
chain->fullhash = hf;
|
chain->fullhash = hf;
|
||||||
chain->length = length;
|
chain->length = length;
|
||||||
|
|
@ -6501,9 +6608,46 @@ if(base && *base)
|
||||||
/*** ***/
|
/*** ***/
|
||||||
/************************/
|
/************************/
|
||||||
|
|
||||||
int fstUtilityBinToEsc(unsigned char *d, unsigned char *s, int len)
|
int fstUtilityBinToEscConvertedLen(const unsigned char *s, int len)
|
||||||
{
|
{
|
||||||
unsigned char *src = s;
|
const unsigned char *src = s;
|
||||||
|
int dlen = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i=0;i<len;i++)
|
||||||
|
{
|
||||||
|
switch(src[i])
|
||||||
|
{
|
||||||
|
case '\a': /* fallthrough */
|
||||||
|
case '\b': /* fallthrough */
|
||||||
|
case '\f': /* fallthrough */
|
||||||
|
case '\n': /* fallthrough */
|
||||||
|
case '\r': /* fallthrough */
|
||||||
|
case '\t': /* fallthrough */
|
||||||
|
case '\v': /* fallthrough */
|
||||||
|
case '\'': /* fallthrough */
|
||||||
|
case '\"': /* fallthrough */
|
||||||
|
case '\\': /* fallthrough */
|
||||||
|
case '\?': dlen += 2; break;
|
||||||
|
default: if((src[i] > ' ') && (src[i] <= '~')) /* no white spaces in output */
|
||||||
|
{
|
||||||
|
dlen++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dlen += 4;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(dlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len)
|
||||||
|
{
|
||||||
|
const unsigned char *src = s;
|
||||||
unsigned char *dst = d;
|
unsigned char *dst = d;
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -6602,3 +6746,76 @@ for(i=0;i<len;i++)
|
||||||
|
|
||||||
return(dst - s);
|
return(dst - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct fstETab *fstUtilityExtractEnumTableFromString(const char *s)
|
||||||
|
{
|
||||||
|
struct fstETab *et = NULL;
|
||||||
|
int num_spaces = 0;
|
||||||
|
int i;
|
||||||
|
int newlen;
|
||||||
|
|
||||||
|
if(s)
|
||||||
|
{
|
||||||
|
const char *csp = strchr(s, ' ');
|
||||||
|
int cnt = atoi(csp+1);
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
csp = strchr(csp+1, ' ');
|
||||||
|
if(csp) { num_spaces++; } else { break; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if(num_spaces == (2*cnt))
|
||||||
|
{
|
||||||
|
char *sp, *sp2;
|
||||||
|
|
||||||
|
et = (struct fstETab*)calloc(1, sizeof(struct fstETab));
|
||||||
|
et->elem_count = cnt;
|
||||||
|
et->name = strdup(s);
|
||||||
|
et->literal_arr = (char**)calloc(cnt, sizeof(char *));
|
||||||
|
et->val_arr = (char**)calloc(cnt, sizeof(char *));
|
||||||
|
|
||||||
|
sp = strchr(et->name, ' ');
|
||||||
|
*sp = 0;
|
||||||
|
|
||||||
|
sp = strchr(sp+1, ' ');
|
||||||
|
|
||||||
|
for(i=0;i<cnt;i++)
|
||||||
|
{
|
||||||
|
sp2 = strchr(sp+1, ' ');
|
||||||
|
*(char*)sp2 = 0;
|
||||||
|
et->literal_arr[i] = sp+1;
|
||||||
|
sp = sp2;
|
||||||
|
|
||||||
|
newlen = fstUtilityEscToBin(NULL, (unsigned char*)et->literal_arr[i], strlen(et->literal_arr[i]));
|
||||||
|
et->literal_arr[i][newlen] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(i=0;i<cnt;i++)
|
||||||
|
{
|
||||||
|
sp2 = strchr(sp+1, ' ');
|
||||||
|
if(sp2) { *sp2 = 0; }
|
||||||
|
et->val_arr[i] = sp+1;
|
||||||
|
sp = sp2;
|
||||||
|
|
||||||
|
newlen = fstUtilityEscToBin(NULL, (unsigned char*)et->val_arr[i], strlen(et->val_arr[i]));
|
||||||
|
et->val_arr[i][newlen] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(et);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void fstUtilityFreeEnumTable(struct fstETab *etab)
|
||||||
|
{
|
||||||
|
if(etab)
|
||||||
|
{
|
||||||
|
free(etab->literal_arr);
|
||||||
|
free(etab->val_arr);
|
||||||
|
free(etab->name);
|
||||||
|
free(etab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
32
vpi/fstapi.h
32
vpi/fstapi.h
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009-2017 Tony Bybell.
|
* Copyright (c) 2009-2018 Tony Bybell.
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* copy of this software and associated documentation files (the "Software"),
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
@ -39,6 +39,7 @@ extern "C" {
|
||||||
#define FST_RDLOAD "FSTLOAD | "
|
#define FST_RDLOAD "FSTLOAD | "
|
||||||
|
|
||||||
typedef uint32_t fstHandle;
|
typedef uint32_t fstHandle;
|
||||||
|
typedef uint32_t fstEnumHandle;
|
||||||
|
|
||||||
enum fstWriterPackType {
|
enum fstWriterPackType {
|
||||||
FST_WR_PT_ZLIB = 0,
|
FST_WR_PT_ZLIB = 0,
|
||||||
|
|
@ -196,9 +197,10 @@ enum fstMiscType {
|
||||||
FST_MT_SOURCESTEM = 4, /* use fstWriterSetSourceStem() to emit */
|
FST_MT_SOURCESTEM = 4, /* use fstWriterSetSourceStem() to emit */
|
||||||
FST_MT_SOURCEISTEM = 5, /* use fstWriterSetSourceInstantiationStem() to emit */
|
FST_MT_SOURCEISTEM = 5, /* use fstWriterSetSourceInstantiationStem() to emit */
|
||||||
FST_MT_VALUELIST = 6, /* use fstWriterSetValueList() to emit, followed by fstWriterCreateVar*() */
|
FST_MT_VALUELIST = 6, /* use fstWriterSetValueList() to emit, followed by fstWriterCreateVar*() */
|
||||||
FST_MT_UNKNOWN = 7,
|
FST_MT_ENUMTABLE = 7, /* use fstWriterCreateEnumTable() and fstWriterEmitEnumTableRef() to emit */
|
||||||
|
FST_MT_UNKNOWN = 8,
|
||||||
|
|
||||||
FST_MT_MAX = 7
|
FST_MT_MAX = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
enum fstArrayType {
|
enum fstArrayType {
|
||||||
|
|
@ -228,7 +230,10 @@ enum fstEnumValueType {
|
||||||
FST_EV_SV_UNSIGNED_LONGINT = 12,
|
FST_EV_SV_UNSIGNED_LONGINT = 12,
|
||||||
FST_EV_SV_UNSIGNED_BYTE = 13,
|
FST_EV_SV_UNSIGNED_BYTE = 13,
|
||||||
|
|
||||||
FST_EV_MAX = 13
|
FST_EV_REG = 14,
|
||||||
|
FST_EV_TIME = 15,
|
||||||
|
|
||||||
|
FST_EV_MAX = 15
|
||||||
};
|
};
|
||||||
|
|
||||||
enum fstPackType {
|
enum fstPackType {
|
||||||
|
|
@ -324,11 +329,21 @@ union {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct fstETab
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
uint32_t elem_count;
|
||||||
|
char **literal_arr;
|
||||||
|
char **val_arr;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* writer functions
|
* writer functions
|
||||||
*/
|
*/
|
||||||
void fstWriterClose(void *ctx);
|
void fstWriterClose(void *ctx);
|
||||||
void * fstWriterCreate(const char *nam, int use_compressed_hier);
|
void * fstWriterCreate(const char *nam, int use_compressed_hier);
|
||||||
|
fstEnumHandle fstWriterCreateEnumTable(void *ctx, const char *name, uint32_t elem_count, unsigned int min_valbits, const char **literal_arr, const char **val_arr);
|
||||||
/* used for Verilog/SV */
|
/* used for Verilog/SV */
|
||||||
fstHandle fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir vd,
|
fstHandle fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir vd,
|
||||||
uint32_t len, const char *nam, fstHandle aliasHandle);
|
uint32_t len, const char *nam, fstHandle aliasHandle);
|
||||||
|
|
@ -337,9 +352,10 @@ fstHandle fstWriterCreateVar(void *ctx, enum fstVarType vt, enum fstVarDir
|
||||||
fstHandle fstWriterCreateVar2(void *ctx, enum fstVarType vt, enum fstVarDir vd,
|
fstHandle fstWriterCreateVar2(void *ctx, enum fstVarType vt, enum fstVarDir vd,
|
||||||
uint32_t len, const char *nam, fstHandle aliasHandle,
|
uint32_t len, const char *nam, fstHandle aliasHandle,
|
||||||
const char *type, enum fstSupplementalVarType svt, enum fstSupplementalDataType sdt);
|
const char *type, enum fstSupplementalVarType svt, enum fstSupplementalDataType sdt);
|
||||||
|
void fstWriterEmitDumpActive(void *ctx, int enable);
|
||||||
|
void fstWriterEmitEnumTableRef(void *ctx, fstEnumHandle handle);
|
||||||
void fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val);
|
void fstWriterEmitValueChange(void *ctx, fstHandle handle, const void *val);
|
||||||
void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len);
|
void fstWriterEmitVariableLengthValueChange(void *ctx, fstHandle handle, const void *val, uint32_t len);
|
||||||
void fstWriterEmitDumpActive(void *ctx, int enable);
|
|
||||||
void fstWriterEmitTimeChange(void *ctx, uint64_t tim);
|
void fstWriterEmitTimeChange(void *ctx, uint64_t tim);
|
||||||
void fstWriterFlushContext(void *ctx);
|
void fstWriterFlushContext(void *ctx);
|
||||||
int fstWriterGetDumpSizeLimitReached(void *ctx);
|
int fstWriterGetDumpSizeLimitReached(void *ctx);
|
||||||
|
|
@ -422,8 +438,12 @@ void fstReaderSetVcdExtensions(void *ctx, int enable);
|
||||||
/*
|
/*
|
||||||
* utility functions
|
* utility functions
|
||||||
*/
|
*/
|
||||||
int fstUtilityBinToEsc(unsigned char *d, unsigned char *s, int len);
|
int fstUtilityBinToEscConvertedLen(const unsigned char *s, int len); /* used for mallocs for fstUtilityBinToEsc() */
|
||||||
|
int fstUtilityBinToEsc(unsigned char *d, const unsigned char *s, int len);
|
||||||
int fstUtilityEscToBin(unsigned char *d, unsigned char *s, int len);
|
int fstUtilityEscToBin(unsigned char *d, unsigned char *s, int len);
|
||||||
|
struct fstETab *fstUtilityExtractEnumTableFromString(const char *s);
|
||||||
|
void fstUtilityFreeEnumTable(struct fstETab *etab); /* must use to free fstETab properly */
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ if (lo<hi)
|
||||||
|
|
||||||
static void wave_msort(struct lxt2_wr_symbol **a, int num)
|
static void wave_msort(struct lxt2_wr_symbol **a, int num)
|
||||||
{
|
{
|
||||||
struct lxt2_wr_symbol **b = malloc(((num/2)+1) * sizeof(struct lxt2_wr_symbol *));
|
struct lxt2_wr_symbol **b = (struct lxt2_wr_symbol**)malloc(((num/2)+1) * sizeof(struct lxt2_wr_symbol *));
|
||||||
|
|
||||||
wave_mergesort(a, b, 0, num-1);
|
wave_mergesort(a, b, 0, num-1);
|
||||||
|
|
||||||
|
|
@ -583,7 +583,7 @@ unsigned int i;
|
||||||
if((lt)&&(lt->numfacs))
|
if((lt)&&(lt->numfacs))
|
||||||
{
|
{
|
||||||
struct lxt2_wr_symbol *s = lt->symchain;
|
struct lxt2_wr_symbol *s = lt->symchain;
|
||||||
struct lxt2_wr_symbol **aliascache = calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *));
|
struct lxt2_wr_symbol **aliascache = (struct lxt2_wr_symbol**)calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *));
|
||||||
unsigned int aliases_encountered, facs_encountered;
|
unsigned int aliases_encountered, facs_encountered;
|
||||||
|
|
||||||
lt->sorted_facs = (struct lxt2_wr_symbol **)calloc(lt->numfacs, sizeof(struct lxt2_wr_symbol *));
|
lt->sorted_facs = (struct lxt2_wr_symbol **)calloc(lt->numfacs, sizeof(struct lxt2_wr_symbol *));
|
||||||
|
|
@ -920,7 +920,7 @@ if(flags&LXT2_WR_SYM_F_DOUBLE)
|
||||||
s->len = 32;
|
s->len = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
s->value = malloc(s->len + 1);
|
s->value = (char*)malloc(s->len + 1);
|
||||||
memset(s->value, lt->initial_value, s->len);
|
memset(s->value, lt->initial_value, s->len);
|
||||||
s->value[s->len]=0;
|
s->value[s->len]=0;
|
||||||
|
|
||||||
|
|
@ -1017,7 +1017,7 @@ static void lxt2_wr_emit_do_breakfile(struct lxt2_wr_trace *lt)
|
||||||
{
|
{
|
||||||
unsigned int len = strlen(lt->lxtname);
|
unsigned int len = strlen(lt->lxtname);
|
||||||
int i;
|
int i;
|
||||||
char *tname = malloc(len + 30);
|
char *tname = (char*)malloc(len + 30);
|
||||||
FILE *f2, *clone;
|
FILE *f2, *clone;
|
||||||
off_t cnt, seg;
|
off_t cnt, seg;
|
||||||
char buf[32768];
|
char buf[32768];
|
||||||
|
|
@ -1810,13 +1810,13 @@ while(s->aliased_to) /* find root alias if exists */
|
||||||
valuelen = strlen(value); /* ensure string is proper length */
|
valuelen = strlen(value); /* ensure string is proper length */
|
||||||
if(valuelen == s->len)
|
if(valuelen == s->len)
|
||||||
{
|
{
|
||||||
vfix = wave_alloca(s->len+1);
|
vfix = (char*)wave_alloca(s->len+1);
|
||||||
strcpy(vfix, value);
|
strcpy(vfix, value);
|
||||||
value = vfix;
|
value = vfix;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vfix = wave_alloca(s->len+1);
|
vfix = (char*)wave_alloca(s->len+1);
|
||||||
|
|
||||||
if(valuelen < s->len)
|
if(valuelen < s->len)
|
||||||
{
|
{
|
||||||
|
|
@ -2088,7 +2088,7 @@ if((lt)&&(lt->blackout))
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
free(s->value);
|
free(s->value);
|
||||||
s->value = calloc(1, 1*sizeof(char));
|
s->value = (char*)calloc(1, 1*sizeof(char));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2101,9 +2101,11 @@ if((lt)&&(lt->blackout))
|
||||||
{
|
{
|
||||||
if((!(s->flags&LXT2_WR_SYM_F_ALIAS))&&(s->rows<2))
|
if((!(s->flags&LXT2_WR_SYM_F_ALIAS))&&(s->rows<2))
|
||||||
{
|
{
|
||||||
|
char tmp[16]; /* To get rid of the warning */
|
||||||
if(!(s->flags&(LXT2_WR_SYM_F_DOUBLE|LXT2_WR_SYM_F_STRING)))
|
if(!(s->flags&(LXT2_WR_SYM_F_DOUBLE|LXT2_WR_SYM_F_STRING)))
|
||||||
{
|
{
|
||||||
lxt2_wr_emit_value_bit_string(lt, s, 0, "x");
|
strcpy(tmp, "x");
|
||||||
|
lxt2_wr_emit_value_bit_string(lt, s, 0, tmp);
|
||||||
}
|
}
|
||||||
else if (s->flags&LXT2_WR_SYM_F_DOUBLE)
|
else if (s->flags&LXT2_WR_SYM_F_DOUBLE)
|
||||||
{
|
{
|
||||||
|
|
@ -2113,7 +2115,8 @@ if((lt)&&(lt->blackout))
|
||||||
}
|
}
|
||||||
else if (s->flags&LXT2_WR_SYM_F_STRING)
|
else if (s->flags&LXT2_WR_SYM_F_STRING)
|
||||||
{
|
{
|
||||||
lxt2_wr_emit_value_string(lt, s, 0, "UNDEF");
|
strcpy(tmp, "UNDEF");
|
||||||
|
lxt2_wr_emit_value_string(lt, s, 0, tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s=s->symchain;
|
s=s->symchain;
|
||||||
|
|
@ -2202,4 +2205,3 @@ if(lt)
|
||||||
lt->timezero = timeval;
|
lt->timezero = timeval;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ extern "C" {
|
||||||
#define ftello ftell
|
#define ftello ftell
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wavealloca.h>
|
#include "wavealloca.h"
|
||||||
|
|
||||||
#define LXT2_WR_HDRID (0x1380)
|
#define LXT2_WR_HDRID (0x1380)
|
||||||
#define LXT2_WR_VERSION (0x0001)
|
#define LXT2_WR_VERSION (0x0001)
|
||||||
|
|
@ -314,4 +314,3 @@ int lxt2_wr_emit_value_bit_string(struct lxt2_wr_trace *lt, struct lxt2_wr_sy
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,9 @@ static const int LZ4_minLength = (MFLIMIT+1);
|
||||||
#define GB *(1U<<30)
|
#define GB *(1U<<30)
|
||||||
|
|
||||||
#define MAXD_LOG 16
|
#define MAXD_LOG 16
|
||||||
|
#ifdef MAX_DISTANCE
|
||||||
|
#undef MAX_DISTANCE
|
||||||
|
#endif
|
||||||
#define MAX_DISTANCE ((1 << MAXD_LOG) - 1)
|
#define MAX_DISTANCE ((1 << MAXD_LOG) - 1)
|
||||||
|
|
||||||
#define ML_BITS 4
|
#define ML_BITS 4
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2014 Michael Ruff (mruff at chiaro.com)
|
* Copyright (c) 2003-2018 Michael Ruff (mruff at chiaro.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
|
||||||
|
|
@ -90,12 +90,12 @@ static void error_message(vpiHandle callh, const char* msg)
|
||||||
vpi_control(vpiFinish, 1);
|
vpi_control(vpiFinish, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PLI_INT32 sizetf_32 (PLI_BYTE8*name)
|
static PLI_INT32 sizetf_32 (ICARUS_VPI_CONST PLI_BYTE8*name)
|
||||||
{
|
{
|
||||||
(void)name; /* Parameter is not used. */
|
(void)name; /* Parameter is not used. */
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
static PLI_INT32 sizetf_64 (PLI_BYTE8*name)
|
static PLI_INT32 sizetf_64 (ICARUS_VPI_CONST PLI_BYTE8*name)
|
||||||
{
|
{
|
||||||
(void)name; /* Parameter is not used. */
|
(void)name; /* Parameter is not used. */
|
||||||
return 64;
|
return 64;
|
||||||
|
|
@ -288,4 +288,3 @@ void sys_convert_register(void)
|
||||||
res = vpi_register_systf(&tf_data);
|
res = vpi_register_systf(&tf_data);
|
||||||
vpip_make_systf_system_defined(res);
|
vpip_make_systf_system_defined(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2012-2014 Martin Whitaker. (icarus@martin-whitaker.me.uk)
|
* Copyright (C) 2012-2018 Martin Whitaker. (icarus@martin-whitaker.me.uk)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -33,6 +33,7 @@ static void check_net_arg(vpiHandle arg, vpiHandle callh, const char *name)
|
||||||
case vpiPartSelect:
|
case vpiPartSelect:
|
||||||
if (vpi_get(vpiType, vpi_handle(vpiParent, arg)) != vpiNet)
|
if (vpi_get(vpiType, vpi_handle(vpiParent, arg)) != vpiNet)
|
||||||
break;
|
break;
|
||||||
|
// fallthrough
|
||||||
case vpiNet:
|
case vpiNet:
|
||||||
if (vpi_get(vpiSize, arg) != 1)
|
if (vpi_get(vpiSize, arg) != 1)
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2017 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2018 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
|
||||||
|
|
@ -406,31 +406,31 @@ static unsigned int get_format_char(char **rtn, int ljust, int plus,
|
||||||
vpi_printf("WARNING: %s:%d: missing argument for %s%s.\n",
|
vpi_printf("WARNING: %s:%d: missing argument for %s%s.\n",
|
||||||
info->filename, info->lineno, info->name, fmtb);
|
info->filename, info->lineno, info->name, fmtb);
|
||||||
} else {
|
} else {
|
||||||
value.format = vpiStringVal;
|
value.format = vpiIntVal;
|
||||||
vpi_get_value(info->items[*idx], &value);
|
vpi_get_value(info->items[*idx], &value);
|
||||||
if (value.format == vpiSuppressVal) {
|
if (value.format == vpiSuppressVal) {
|
||||||
vpi_printf("WARNING: %s:%d: incompatible value for %s%s.\n",
|
vpi_printf("WARNING: %s:%d: incompatible value for %s%s.\n",
|
||||||
info->filename, info->lineno, info->name, fmtb);
|
info->filename, info->lineno, info->name, fmtb);
|
||||||
} else {
|
} else {
|
||||||
char ch = value.value.str[strlen(value.value.str)-1];
|
char ch = value.value.integer;
|
||||||
|
|
||||||
/* If the default buffer is too small, make it big enough. */
|
|
||||||
size = width + 1;
|
|
||||||
if (size > ini_size) result = realloc(result, size*sizeof(char));
|
|
||||||
|
|
||||||
/* If the width is less than one then use a width of one. */
|
/* If the width is less than one then use a width of one. */
|
||||||
if (width < 1) width = 1;
|
if (width < 1) width = 1;
|
||||||
|
size = width + 1;
|
||||||
|
assert(size <= ini_size);
|
||||||
|
|
||||||
if (ljust == 0) {
|
if (ljust == 0) {
|
||||||
if (width > 1) {
|
if (width > 1) {
|
||||||
char *cp = malloc((width+1)*sizeof(char));
|
memset(result, (ld_zero == 1 ? '0': ' '), width-1);
|
||||||
memset(cp, (ld_zero == 1 ? '0': ' '), width-1);
|
}
|
||||||
cp[width-1] = ch;
|
result[width-1] = ch;
|
||||||
cp[width] = '\0';
|
} else {
|
||||||
sprintf(result, "%*s", width, cp);
|
result[0] = ch;
|
||||||
free(cp);
|
if (width > 1) {
|
||||||
} else sprintf(result, "%c", ch);
|
memset(result+1, ' ', width-1);
|
||||||
} else sprintf(result, "%-*c", width, ch);
|
}
|
||||||
size = strlen(result) + 1;
|
}
|
||||||
|
result[width] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1138,7 +1138,7 @@ static int sys_check_args(vpiHandle callh, vpiHandle argv, const PLI_BYTE8*name,
|
||||||
name, vpi_get_str(vpiType, arg));
|
name, vpi_get_str(vpiType, arg));
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case vpiConstant:
|
case vpiConstant:
|
||||||
case vpiParameter:
|
case vpiParameter:
|
||||||
case vpiNet:
|
case vpiNet:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2003-2018 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* This source code is free software; you can redistribute it
|
* This source code is free software; you can redistribute it
|
||||||
* and/or modify it in source code form under the terms of the GNU
|
* and/or modify it in source code form under the terms of the GNU
|
||||||
|
|
@ -132,7 +132,7 @@ static PLI_INT32 sys_fopen_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (! fail) break;
|
if (! fail) break;
|
||||||
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
vpi_printf("WARNING: %s:%d: ",
|
vpi_printf("WARNING: %s:%d: ",
|
||||||
vpi_get_str(vpiFile, callh),
|
vpi_get_str(vpiFile, callh),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2015 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2002-2018 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
|
||||||
|
|
@ -549,6 +549,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
|
||||||
PLI_INT32 idx = vpi_get(vpiIndex, item);
|
PLI_INT32 idx = vpi_get(vpiIndex, item);
|
||||||
item = vpi_handle_by_index(array, idx);
|
item = vpi_handle_by_index(array, idx);
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case vpiIntegerVar:
|
case vpiIntegerVar:
|
||||||
case vpiBitVar:
|
case vpiBitVar:
|
||||||
case vpiByteVar:
|
case vpiByteVar:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2015 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2003-2018 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
|
||||||
|
|
@ -612,6 +612,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip)
|
||||||
PLI_INT32 idx = vpi_get(vpiIndex, item);
|
PLI_INT32 idx = vpi_get(vpiIndex, item);
|
||||||
item = vpi_handle_by_index(array, idx);
|
item = vpi_handle_by_index(array, idx);
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case vpiIntegerVar:
|
case vpiIntegerVar:
|
||||||
case vpiBitVar:
|
case vpiBitVar:
|
||||||
case vpiByteVar:
|
case vpiByteVar:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2014 Cary R. (cygcary@yahoo.com)
|
* Copyright (C) 2011-2018 Cary R. (cygcary@yahoo.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -781,6 +781,7 @@ static PLI_INT32 fill_variable_with_scaled_time(vpiHandle var, uint64_t c_time)
|
||||||
switch (words) {
|
switch (words) {
|
||||||
default:
|
default:
|
||||||
val_ptr[1].aval = (c_time >> 32) & 0xffffffff;
|
val_ptr[1].aval = (c_time >> 32) & 0xffffffff;
|
||||||
|
// fallthrough
|
||||||
case 1:
|
case 1:
|
||||||
val_ptr[0].aval = c_time & 0xffffffff;
|
val_ptr[0].aval = c_time & 0xffffffff;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2000-2018 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
|
||||||
|
|
@ -924,7 +924,7 @@ static PLI_INT32 sys_dist_erlang_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PLI_INT32 sys_rand_func_sizetf(PLI_BYTE8 *name)
|
static PLI_INT32 sys_rand_func_sizetf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
(void)name; /* Parameter is not used. */
|
(void)name; /* Parameter is not used. */
|
||||||
return 32;
|
return 32;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2018 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
|
||||||
|
|
@ -49,6 +49,7 @@ static void get_mem_params(vpiHandle argv, vpiHandle callh, const char *name,
|
||||||
case vpiConstant:
|
case vpiConstant:
|
||||||
case vpiParameter:
|
case vpiParameter:
|
||||||
if (vpi_get(vpiConstType, *start_item) != vpiRealConst) break;
|
if (vpi_get(vpiConstType, *start_item) != vpiRealConst) break;
|
||||||
|
// fallthrough
|
||||||
case vpiRealVar:
|
case vpiRealVar:
|
||||||
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
vpi_printf("WARNING: %s:%d: ", vpi_get_str(vpiFile, callh),
|
||||||
(int)vpi_get(vpiLineNo, callh));
|
(int)vpi_get(vpiLineNo, callh));
|
||||||
|
|
@ -67,6 +68,7 @@ static void get_mem_params(vpiHandle argv, vpiHandle callh, const char *name,
|
||||||
if (vpi_get(vpiConstType, *stop_item) != vpiRealConst) {
|
if (vpi_get(vpiConstType, *stop_item) != vpiRealConst) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
case vpiRealVar:
|
case vpiRealVar:
|
||||||
vpi_printf("WARNING: %s:%d: ",
|
vpi_printf("WARNING: %s:%d: ",
|
||||||
vpi_get_str(vpiFile, callh),
|
vpi_get_str(vpiFile, callh),
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2015 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2006-2018 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
|
||||||
|
|
@ -219,7 +219,7 @@ static double get_float(struct byte_source *src, unsigned width, int *match)
|
||||||
*/
|
*/
|
||||||
static int scan_format_float(vpiHandle callh, vpiHandle argv,
|
static int scan_format_float(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name,
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name,
|
||||||
char code)
|
char code)
|
||||||
{
|
{
|
||||||
vpiHandle arg;
|
vpiHandle arg;
|
||||||
|
|
@ -266,7 +266,7 @@ static int scan_format_float(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_float_time(vpiHandle callh, vpiHandle argv,
|
static int scan_format_float_time(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source*src, unsigned width,
|
struct byte_source*src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
vpiHandle scope = vpi_handle(vpiScope, callh);
|
vpiHandle scope = vpi_handle(vpiScope, callh);
|
||||||
int time_units = vpi_get(vpiTimeUnit, scope);
|
int time_units = vpi_get(vpiTimeUnit, scope);
|
||||||
|
|
@ -330,7 +330,7 @@ static int scan_format_float_time(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_base(vpiHandle callh, vpiHandle argv,
|
static int scan_format_base(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name,
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name,
|
||||||
const char *match, char code,
|
const char *match, char code,
|
||||||
PLI_INT32 type)
|
PLI_INT32 type)
|
||||||
{
|
{
|
||||||
|
|
@ -406,7 +406,7 @@ static int scan_format_base(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_binary(vpiHandle callh, vpiHandle argv,
|
static int scan_format_binary(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, int width,
|
struct byte_source *src, int width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
return scan_format_base(callh, argv, src, width, suppress_flag, name,
|
return scan_format_base(callh, argv, src, width, suppress_flag, name,
|
||||||
"01xzXZ?_", 'b', vpiBinStrVal);
|
"01xzXZ?_", 'b', vpiBinStrVal);
|
||||||
|
|
@ -420,7 +420,7 @@ static int scan_format_binary(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_char(vpiHandle callh, vpiHandle argv,
|
static int scan_format_char(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
vpiHandle arg;
|
vpiHandle arg;
|
||||||
s_vpi_value val;
|
s_vpi_value val;
|
||||||
|
|
@ -466,7 +466,7 @@ static int scan_format_char(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_decimal(vpiHandle callh, vpiHandle argv,
|
static int scan_format_decimal(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
vpiHandle arg;
|
vpiHandle arg;
|
||||||
char *strval = malloc(1);
|
char *strval = malloc(1);
|
||||||
|
|
@ -585,7 +585,7 @@ static int scan_format_decimal(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_hex(vpiHandle callh, vpiHandle argv,
|
static int scan_format_hex(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
return scan_format_base(callh, argv, src, width, suppress_flag, name,
|
return scan_format_base(callh, argv, src, width, suppress_flag, name,
|
||||||
"0123456789abcdefxzABCDEFXZ?_", 'h',
|
"0123456789abcdefxzABCDEFXZ?_", 'h',
|
||||||
|
|
@ -597,7 +597,7 @@ static int scan_format_hex(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_octal(vpiHandle callh, vpiHandle argv,
|
static int scan_format_octal(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
return scan_format_base(callh, argv, src, width, suppress_flag, name,
|
return scan_format_base(callh, argv, src, width, suppress_flag, name,
|
||||||
"01234567xzXZ?_", 'o', vpiOctStrVal);
|
"01234567xzXZ?_", 'o', vpiOctStrVal);
|
||||||
|
|
@ -608,7 +608,7 @@ static int scan_format_octal(vpiHandle callh, vpiHandle argv,
|
||||||
* Routine to return the current hierarchical path (implements %m).
|
* Routine to return the current hierarchical path (implements %m).
|
||||||
*/
|
*/
|
||||||
static int scan_format_module_path(vpiHandle callh, vpiHandle argv,
|
static int scan_format_module_path(vpiHandle callh, vpiHandle argv,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
vpiHandle scope, arg;
|
vpiHandle scope, arg;
|
||||||
char *module_path;
|
char *module_path;
|
||||||
|
|
@ -650,7 +650,7 @@ static int scan_format_module_path(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_string(vpiHandle callh, vpiHandle argv,
|
static int scan_format_string(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
vpiHandle arg;
|
vpiHandle arg;
|
||||||
char *strval = malloc(1);
|
char *strval = malloc(1);
|
||||||
|
|
@ -729,7 +729,7 @@ static int scan_format_string(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_two_state(vpiHandle callh, vpiHandle argv,
|
static int scan_format_two_state(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
vpiHandle arg;
|
vpiHandle arg;
|
||||||
p_vpi_vecval val_ptr;
|
p_vpi_vecval val_ptr;
|
||||||
|
|
@ -868,7 +868,7 @@ static int scan_format_two_state(vpiHandle callh, vpiHandle argv,
|
||||||
*/
|
*/
|
||||||
static int scan_format_four_state(vpiHandle callh, vpiHandle argv,
|
static int scan_format_four_state(vpiHandle callh, vpiHandle argv,
|
||||||
struct byte_source *src, unsigned width,
|
struct byte_source *src, unsigned width,
|
||||||
unsigned suppress_flag, PLI_BYTE8 *name)
|
unsigned suppress_flag, ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
vpiHandle arg;
|
vpiHandle arg;
|
||||||
p_vpi_vecval val_ptr;
|
p_vpi_vecval val_ptr;
|
||||||
|
|
@ -1006,7 +1006,7 @@ static int scan_format_four_state(vpiHandle callh, vpiHandle argv,
|
||||||
* passed to this function, which processes the rest of the function.
|
* passed to this function, which processes the rest of the function.
|
||||||
*/
|
*/
|
||||||
static int scan_format(vpiHandle callh, struct byte_source*src, vpiHandle argv,
|
static int scan_format(vpiHandle callh, struct byte_source*src, vpiHandle argv,
|
||||||
PLI_BYTE8 *name)
|
ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
{
|
{
|
||||||
s_vpi_value val;
|
s_vpi_value val;
|
||||||
vpiHandle item;
|
vpiHandle item;
|
||||||
|
|
@ -1258,6 +1258,7 @@ static int is_assignable_obj(vpiHandle obj)
|
||||||
break;
|
break;
|
||||||
case vpiPartSelect:
|
case vpiPartSelect:
|
||||||
if (! is_assignable_obj(vpi_handle(vpiParent, obj))) break;
|
if (! is_assignable_obj(vpi_handle(vpiParent, obj))) break;
|
||||||
|
// fallthrough
|
||||||
case vpiIntegerVar:
|
case vpiIntegerVar:
|
||||||
case vpiBitVar:
|
case vpiBitVar:
|
||||||
case vpiByteVar:
|
case vpiByteVar:
|
||||||
|
|
@ -1403,7 +1404,7 @@ static PLI_INT32 sys_sscanf_compiletf(ICARUS_VPI_CONST PLI_BYTE8 *name)
|
||||||
case vpiConstant:
|
case vpiConstant:
|
||||||
case vpiParameter:
|
case vpiParameter:
|
||||||
if (vpi_get(vpiConstType, reg) == vpiStringConst) break;
|
if (vpi_get(vpiConstType, reg) == vpiStringConst) break;
|
||||||
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
vpi_printf("ERROR: %s:%d: ", vpi_get_str(vpiFile, callh),
|
||||||
(int)vpi_get(vpiLineNo, callh));
|
(int)vpi_get(vpiLineNo, callh));
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2010-2018 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
|
||||||
|
|
@ -108,6 +108,7 @@ static PLI_INT32 ivl_enum_method_next_prev_compiletf(ICARUS_VPI_CONST PLI_BYTE8*
|
||||||
case vpiConstant:
|
case vpiConstant:
|
||||||
case vpiParameter:
|
case vpiParameter:
|
||||||
if (vpi_get(vpiConstType, arg_count) != vpiStringConst) break;
|
if (vpi_get(vpiConstType, arg_count) != vpiStringConst) break;
|
||||||
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
vpi_printf("%s:%d: compiler error: ",
|
vpi_printf("%s:%d: compiler error: ",
|
||||||
vpi_get_str(vpiFile, sys),
|
vpi_get_str(vpiFile, sys),
|
||||||
|
|
@ -226,7 +227,7 @@ static void fill_handle_with_init(vpiHandle arg, int is_two_state)
|
||||||
/*
|
/*
|
||||||
* Implement the next()/prev() enumeration methods.
|
* Implement the next()/prev() enumeration methods.
|
||||||
*/
|
*/
|
||||||
static PLI_INT32 ivl_enum_method_next_prev_calltf(PLI_BYTE8*name)
|
static PLI_INT32 ivl_enum_method_next_prev_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
||||||
{
|
{
|
||||||
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
|
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
|
||||||
vpiHandle argv = vpi_iterate(vpiArgument, sys);
|
vpiHandle argv = vpi_iterate(vpiArgument, sys);
|
||||||
|
|
@ -431,7 +432,7 @@ static PLI_INT32 ivl_enum_method_name_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
||||||
/*
|
/*
|
||||||
* Implement the name() enumeration method.
|
* Implement the name() enumeration method.
|
||||||
*/
|
*/
|
||||||
static PLI_INT32 ivl_enum_method_name_calltf(PLI_BYTE8*name)
|
static PLI_INT32 ivl_enum_method_name_calltf(ICARUS_VPI_CONST PLI_BYTE8*name)
|
||||||
{
|
{
|
||||||
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
|
vpiHandle sys = vpi_handle(vpiSysTfCall, 0);
|
||||||
vpiHandle argv = vpi_iterate(vpiArgument, sys);
|
vpiHandle argv = vpi_iterate(vpiArgument, sys);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2008-2014 Cary R. (cygcary@yahoo.com)
|
* Copyright (C) 2008-2018 Cary R. (cygcary@yahoo.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -247,7 +247,7 @@ static PLI_INT32 simparam_str_calltf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PLI_INT32 simparam_str_sizetf(PLI_BYTE8 *name_ext)
|
static PLI_INT32 simparam_str_sizetf(ICARUS_VPI_CONST PLI_BYTE8 *name_ext)
|
||||||
{
|
{
|
||||||
(void) name_ext; /* Parameter is not used. */
|
(void) name_ext; /* Parameter is not used. */
|
||||||
return MAX_STRING_RESULT; /* 128 characters max! */
|
return MAX_STRING_RESULT; /* 128 characters max! */
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) Tony Bybell 1999.
|
* Copyright (c) 1999 Tony Bybell.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
* modify it under the terms of the GNU General Public License
|
* copy of this software and associated documentation files (the "Software"),
|
||||||
* as published by the Free Software Foundation; either version 2
|
* to deal in the Software without restriction, including without limitation
|
||||||
* of the License, or (at your option) any later version.
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
* and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
* Software is furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
* DEALINGS IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef WAVE_ALLOCA_H
|
#ifndef WAVE_ALLOCA_H
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef VPI_USER_H
|
#ifndef VPI_USER_H
|
||||||
#define VPI_USER_H
|
#define VPI_USER_H
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 1999-2018 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
|
||||||
|
|
@ -46,7 +46,9 @@ EXTERN_C_START
|
||||||
# include <stdarg.h>
|
# include <stdarg.h>
|
||||||
# include "_pli_types.h"
|
# include "_pli_types.h"
|
||||||
|
|
||||||
|
#ifndef ICARUS_VPI_CONST
|
||||||
#define ICARUS_VPI_CONST
|
#define ICARUS_VPI_CONST
|
||||||
|
#endif
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
typedef class __vpiHandle *vpiHandle;
|
typedef class __vpiHandle *vpiHandle;
|
||||||
#else
|
#else
|
||||||
|
|
@ -63,7 +65,7 @@ typedef struct t_vpi_systf_data {
|
||||||
const char *tfname;
|
const char *tfname;
|
||||||
PLI_INT32 (*calltf) (ICARUS_VPI_CONST PLI_BYTE8*);
|
PLI_INT32 (*calltf) (ICARUS_VPI_CONST PLI_BYTE8*);
|
||||||
PLI_INT32 (*compiletf)(ICARUS_VPI_CONST PLI_BYTE8*);
|
PLI_INT32 (*compiletf)(ICARUS_VPI_CONST PLI_BYTE8*);
|
||||||
PLI_INT32 (*sizetf) (PLI_BYTE8*);
|
PLI_INT32 (*sizetf) (ICARUS_VPI_CONST PLI_BYTE8*);
|
||||||
ICARUS_VPI_CONST PLI_BYTE8 *user_data;
|
ICARUS_VPI_CONST PLI_BYTE8 *user_data;
|
||||||
} s_vpi_systf_data, *p_vpi_systf_data;
|
} s_vpi_systf_data, *p_vpi_systf_data;
|
||||||
|
|
||||||
|
|
@ -466,7 +468,7 @@ typedef struct t_cb_data {
|
||||||
p_vpi_time time;
|
p_vpi_time time;
|
||||||
p_vpi_value value;
|
p_vpi_value value;
|
||||||
PLI_INT32 index;
|
PLI_INT32 index;
|
||||||
char *user_data;
|
ICARUS_VPI_CONST PLI_BYTE8 *user_data;
|
||||||
} s_cb_data, *p_cb_data;
|
} s_cb_data, *p_cb_data;
|
||||||
|
|
||||||
#define cbValueChange 1
|
#define cbValueChange 1
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ else
|
||||||
INCLUDE_PATH = -I. -I.. -I$(srcdir) -I$(srcdir)/..
|
INCLUDE_PATH = -I. -I.. -I$(srcdir) -I$(srcdir)/..
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@
|
CPPFLAGS = $(INCLUDE_PATH) @CPPFLAGS@ @DEFS@ -DICARUS_VPI_CONST=const
|
||||||
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
CFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
||||||
CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
|
CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
|
||||||
LDFLAGS = @rdynamic@ @LDFLAGS@
|
LDFLAGS = @rdynamic@ @LDFLAGS@
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001-2018 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
|
||||||
|
|
@ -527,27 +527,40 @@ bool schedule_stopped(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are the signal handling infrastructure. The SIGINT signal
|
* These are the signal handling infrastructure. The SIGINT signal
|
||||||
* leads to an implicit $stop.
|
* leads to an implicit $stop. The SIGHUP and SIGTERM signals lead
|
||||||
|
* to an implicit $finish.
|
||||||
*/
|
*/
|
||||||
extern "C" void signals_handler(int)
|
extern bool stop_is_finish;
|
||||||
|
|
||||||
|
extern "C" void signals_handler(int signum)
|
||||||
{
|
{
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
// Windows implements the original UNIX semantics for signal,
|
// Windows implements the original UNIX semantics for signal,
|
||||||
// so we have to re-establish the signal handler each time a
|
// so we have to re-establish the signal handler each time a
|
||||||
// signal is caught.
|
// signal is caught.
|
||||||
signal(SIGINT, &signals_handler);
|
signal(signum, &signals_handler);
|
||||||
#endif
|
#endif
|
||||||
|
if (signum != SIGINT)
|
||||||
|
stop_is_finish = true;
|
||||||
schedule_stopped_flag = true;
|
schedule_stopped_flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signals_capture(void)
|
static void signals_capture(void)
|
||||||
{
|
{
|
||||||
|
#ifndef __MINGW32__
|
||||||
|
signal(SIGHUP, &signals_handler);
|
||||||
|
#endif
|
||||||
signal(SIGINT, &signals_handler);
|
signal(SIGINT, &signals_handler);
|
||||||
|
signal(SIGTERM, &signals_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void signals_revert(void)
|
static void signals_revert(void)
|
||||||
{
|
{
|
||||||
|
#ifndef __MINGW32__
|
||||||
|
signal(SIGHUP, SIG_DFL);
|
||||||
|
#endif
|
||||||
signal(SIGINT, SIG_DFL);
|
signal(SIGINT, SIG_DFL);
|
||||||
|
signal(SIGTERM, SIG_DFL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2003-2018 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
|
||||||
|
|
@ -373,6 +373,7 @@ static void cmd_trace(unsigned argc, char*argv[])
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("Only using the first argument to trace.\n");
|
printf("Only using the first argument to trace.\n");
|
||||||
|
// fallthrough
|
||||||
case 2:
|
case 2:
|
||||||
if ((strcmp(argv[1], "on") == 0) || (strcmp(argv[1], "1") == 0)) {
|
if ((strcmp(argv[1], "on") == 0) || (strcmp(argv[1], "1") == 0)) {
|
||||||
show_file_line = true;
|
show_file_line = true;
|
||||||
|
|
|
||||||
|
|
@ -796,7 +796,7 @@ static void real_signal_value(struct t_vpi_value*vp, double rval)
|
||||||
switch (vp->format) {
|
switch (vp->format) {
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
vp->format = vpiRealVal;
|
vp->format = vpiRealVal;
|
||||||
|
// fallthrough
|
||||||
case vpiRealVal:
|
case vpiRealVal:
|
||||||
vp->value.real = rval;
|
vp->value.real = rval;
|
||||||
break;
|
break;
|
||||||
|
|
@ -820,12 +820,12 @@ static void real_signal_value(struct t_vpi_value*vp, double rval)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vpiHexStrVal:
|
case vpiHexStrVal:
|
||||||
sprintf(rbuf, "%lx", (long)vlg_round(rval));
|
sprintf(rbuf, "%" PRIx64, (uint64_t)vlg_round(rval));
|
||||||
vp->value.str = rbuf;
|
vp->value.str = rbuf;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vpiBinStrVal: {
|
case vpiBinStrVal: {
|
||||||
unsigned long val = (unsigned long)vlg_round(rval);
|
uint64_t val = (uint64_t)vlg_round(rval);
|
||||||
unsigned len = 0;
|
unsigned len = 0;
|
||||||
|
|
||||||
while (val > 0) {
|
while (val > 0) {
|
||||||
|
|
@ -833,7 +833,7 @@ static void real_signal_value(struct t_vpi_value*vp, double rval)
|
||||||
val /= 2;
|
val /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (unsigned long)vlg_round(rval);
|
val = (uint64_t)vlg_round(rval);
|
||||||
for (unsigned idx = 0 ; idx < len ; idx += 1) {
|
for (unsigned idx = 0 ; idx < len ; idx += 1) {
|
||||||
rbuf[len-idx-1] = (val & 1)? '1' : '0';
|
rbuf[len-idx-1] = (val & 1)? '1' : '0';
|
||||||
val /= 2;
|
val /= 2;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001-2018 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
|
||||||
|
|
@ -129,7 +129,7 @@ void __vpiStringConst::vpi_get_value(p_vpi_value vp)
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
/* String parameters by default have vpiStringVal values. */
|
/* String parameters by default have vpiStringVal values. */
|
||||||
vp->format = vpiStringVal;
|
vp->format = vpiStringVal;
|
||||||
|
// fallthrough
|
||||||
case vpiStringVal:
|
case vpiStringVal:
|
||||||
rbuf = (char *) need_result_buf(size + 1, RBUF_VAL);
|
rbuf = (char *) need_result_buf(size + 1, RBUF_VAL);
|
||||||
strcpy(rbuf, value_);
|
strcpy(rbuf, value_);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008-2017 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2008-2018 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
|
||||||
|
|
@ -724,7 +724,7 @@ void vpip_vec4_get_value(const vvp_vector4_t&word_val, unsigned width,
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
// Use the following case to actually set the value!
|
// Use the following case to actually set the value!
|
||||||
vp->format = vpiVectorVal;
|
vp->format = vpiVectorVal;
|
||||||
|
// fallthrough
|
||||||
case vpiVectorVal: {
|
case vpiVectorVal: {
|
||||||
unsigned hwid = (width + 31)/32;
|
unsigned hwid = (width + 31)/32;
|
||||||
|
|
||||||
|
|
@ -784,6 +784,7 @@ void vpip_vec2_get_value(const vvp_vector2_t&word_val, unsigned width,
|
||||||
|
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
vp->format = vpiIntVal;
|
vp->format = vpiIntVal;
|
||||||
|
// fallthrough
|
||||||
case vpiIntVal:
|
case vpiIntVal:
|
||||||
vector2_to_value(word_val, vp->value.integer, signed_flag);
|
vector2_to_value(word_val, vp->value.integer, signed_flag);
|
||||||
break;
|
break;
|
||||||
|
|
@ -862,7 +863,7 @@ void vpip_real_get_value(double real, s_vpi_value*vp)
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
// Use the following case to actually set the value!
|
// Use the following case to actually set the value!
|
||||||
vp->format = vpiRealVal;
|
vp->format = vpiRealVal;
|
||||||
|
// fallthrough
|
||||||
case vpiRealVal:
|
case vpiRealVal:
|
||||||
vp->value.real = real;
|
vp->value.real = real;
|
||||||
break;
|
break;
|
||||||
|
|
@ -944,7 +945,7 @@ void vpip_string_get_value(const string&val, s_vpi_value*vp)
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
// Use the following case to actually set the value!
|
// Use the following case to actually set the value!
|
||||||
vp->format = vpiStringVal;
|
vp->format = vpiStringVal;
|
||||||
|
// fallthrough
|
||||||
case vpiStringVal:
|
case vpiStringVal:
|
||||||
rbuf = (char *) need_result_buf(val.size() + 1, RBUF_VAL);
|
rbuf = (char *) need_result_buf(val.size() + 1, RBUF_VAL);
|
||||||
strcpy(rbuf, val.c_str());
|
strcpy(rbuf, val.c_str());
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2016 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001-2018 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
|
||||||
|
|
@ -1200,6 +1200,7 @@ static int PV_get(int code, vpiHandle ref)
|
||||||
|
|
||||||
case vpiLeftRange:
|
case vpiLeftRange:
|
||||||
rval += rfp->width - 1;
|
rval += rfp->width - 1;
|
||||||
|
// fallthrough
|
||||||
case vpiRightRange:
|
case vpiRightRange:
|
||||||
rval += vpi_get(vpiRightRange, rfp->parent) + PV_get_base(rfp);
|
rval += vpi_get(vpiRightRange, rfp->parent) + PV_get_base(rfp);
|
||||||
return rval;
|
return rval;
|
||||||
|
|
|
||||||
|
|
@ -475,6 +475,7 @@ vpiHandle sysfunc_4net::vpi_put_value(p_vpi_value vp, int)
|
||||||
(int)vp->value.scalar);
|
(int)vp->value.scalar);
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case vpiIntVal: {
|
case vpiIntVal: {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001-2018 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
|
||||||
|
|
@ -131,6 +131,7 @@ static void timevar_get_value(vpiHandle ref, s_vpi_value*vp, bool is_int_func,
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
/* The default format is vpiTimeVal. */
|
/* The default format is vpiTimeVal. */
|
||||||
vp->format = vpiTimeVal;
|
vp->format = vpiTimeVal;
|
||||||
|
// fallthrough
|
||||||
case vpiTimeVal:
|
case vpiTimeVal:
|
||||||
vp->value.time = &time_value;
|
vp->value.time = &time_value;
|
||||||
vp->value.time->type = vpiSimTime;
|
vp->value.time->type = vpiSimTime;
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp)
|
||||||
|
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
vp->format = vpiRealVal;
|
vp->format = vpiRealVal;
|
||||||
|
// fallthrough
|
||||||
case vpiRealVal:
|
case vpiRealVal:
|
||||||
vp->value.real = val;
|
vp->value.real = val;
|
||||||
break;
|
break;
|
||||||
|
|
@ -131,17 +132,17 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vpiOctStrVal:
|
case vpiOctStrVal:
|
||||||
sprintf(rbuf, "%lo", (long)vlg_round(val));
|
sprintf(rbuf, "%" PRIo64, (uint64_t)vlg_round(val));
|
||||||
vp->value.str = rbuf;
|
vp->value.str = rbuf;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vpiHexStrVal:
|
case vpiHexStrVal:
|
||||||
sprintf(rbuf, "%lx", (long)vlg_round(val));
|
sprintf(rbuf, "%" PRIx64, (uint64_t)vlg_round(val));
|
||||||
vp->value.str = rbuf;
|
vp->value.str = rbuf;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case vpiBinStrVal: {
|
case vpiBinStrVal: {
|
||||||
unsigned long vali = (unsigned long)vlg_round(val);
|
uint64_t vali = (uint64_t)vlg_round(val);
|
||||||
unsigned len = 0;
|
unsigned len = 0;
|
||||||
|
|
||||||
while (vali > 0) {
|
while (vali > 0) {
|
||||||
|
|
@ -149,7 +150,7 @@ static void vthr_real_get_value(vpiHandle ref, s_vpi_value*vp)
|
||||||
vali /= 2;
|
vali /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
vali = (unsigned long)vlg_round(val);
|
vali = (uint64_t)vlg_round(val);
|
||||||
for (unsigned idx = 0 ; idx < len ; idx += 1) {
|
for (unsigned idx = 0 ; idx < len ; idx += 1) {
|
||||||
rbuf[len-idx-1] = (vali & 1)? '1' : '0';
|
rbuf[len-idx-1] = (vali & 1)? '1' : '0';
|
||||||
vali /= 2;
|
vali /= 2;
|
||||||
|
|
@ -258,6 +259,7 @@ void __vpiVThrStrStack::vpi_get_value(p_vpi_value vp)
|
||||||
|
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
vp->format = vpiStringVal;
|
vp->format = vpiStringVal;
|
||||||
|
// fallthrough
|
||||||
case vpiStringVal:
|
case vpiStringVal:
|
||||||
rbuf = (char *) need_result_buf(val.size()+1, RBUF_VAL);
|
rbuf = (char *) need_result_buf(val.size()+1, RBUF_VAL);
|
||||||
strcpy(rbuf, val.c_str());
|
strcpy(rbuf, val.c_str());
|
||||||
|
|
@ -376,6 +378,7 @@ void __vpiVThrVec4Stack::vpi_get_value(p_vpi_value vp)
|
||||||
break;
|
break;
|
||||||
case vpiObjTypeVal:
|
case vpiObjTypeVal:
|
||||||
vp->format = vpiVectorVal;
|
vp->format = vpiVectorVal;
|
||||||
|
// fallthrough
|
||||||
case vpiVectorVal:
|
case vpiVectorVal:
|
||||||
vpi_get_value_vector_(vp, val);
|
vpi_get_value_vector_(vp, val);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -100,6 +100,7 @@ void vpip_bin_str_to_vec4(vvp_vector4_t&vec4, const char*buf)
|
||||||
pad = BIT4_1;
|
pad = BIT4_1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
default: // Everything else gets '0' padded/
|
default: // Everything else gets '0' padded/
|
||||||
pad = BIT4_0;
|
pad = BIT4_0;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002-2013 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2002-2018 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
|
||||||
|
|
@ -126,6 +126,7 @@ void vpip_hex_str_to_vec4(vvp_vector4_t&val, const char*str)
|
||||||
pad = BIT4_1;
|
pad = BIT4_1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
default: // Everything else gets '0' padded.
|
default: // Everything else gets '0' padded.
|
||||||
pad = BIT4_0;
|
pad = BIT4_0;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,7 @@ void vpip_oct_str_to_vec4(vvp_vector4_t&val, const char*str)
|
||||||
pad = BIT4_1;
|
pad = BIT4_1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// fallthrough
|
||||||
default: // Everything else gets '0' padded.
|
default: // Everything else gets '0' padded.
|
||||||
pad = BIT4_0;
|
pad = BIT4_0;
|
||||||
break;
|
break;
|
||||||
|
|
@ -116,7 +117,6 @@ void vpip_oct_str_to_vec4(vvp_vector4_t&val, const char*str)
|
||||||
if (idx < tval.size()) val.set_bit(idx, tval.value(idx));
|
if (idx < tval.size()) val.set_bit(idx, tval.value(idx));
|
||||||
else val.set_bit(idx, pad);
|
else val.set_bit(idx, pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void vpip_vec4_to_oct_str(const vvp_vector4_t&bits, char*buf, unsigned nbuf)
|
void vpip_vec4_to_oct_str(const vvp_vector4_t&bits, char*buf, unsigned nbuf)
|
||||||
|
|
|
||||||
|
|
@ -3771,7 +3771,7 @@ bool of_MOD_S(vthread_t thr, vvp_code_t)
|
||||||
if (rv == 0)
|
if (rv == 0)
|
||||||
goto x_out;
|
goto x_out;
|
||||||
|
|
||||||
if ((lv == LONG_LONG_MIN) && (rv == -1))
|
if ((lv == LLONG_MIN) && (rv == -1))
|
||||||
goto zero_out;
|
goto zero_out;
|
||||||
|
|
||||||
/* Sign extend the signed operands when needed. */
|
/* Sign extend the signed operands when needed. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue