Merge branch 'v10-branch' of github.com:steveicarus/iverilog into v10-branch

This commit is contained in:
Stephen Williams 2019-03-20 09:36:06 -07:00
commit d46e7ace70
59 changed files with 736 additions and 307 deletions

View File

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

View File

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

2
aclocal.m4 vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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)
{ {
signal(SIGINT, &signals_handler); #ifndef __MINGW32__
signal(SIGHUP, &signals_handler);
#endif
signal(SIGINT, &signals_handler);
signal(SIGTERM, &signals_handler);
} }
static void signals_revert(void) static void signals_revert(void)
{ {
signal(SIGINT, SIG_DFL); #ifndef __MINGW32__
signal(SIGHUP, SIG_DFL);
#endif
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
} }
/* /*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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: {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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