Content-free portability fixes.

These are patches from ITOH Yasufumi and Larry Doolittle of pr2120948.
They change nothing, but make the code compile with older compilers.
This commit is contained in:
Stephen Williams 2008-09-29 18:06:47 -07:00
parent 2251844124
commit 3aaea46144
45 changed files with 422 additions and 277 deletions

View File

@ -35,16 +35,16 @@ typedef shl_t ivl_dll_t;
#endif
#if defined(__MINGW32__)
static inline ivl_dll_t ivl_dlopen(const char *name)
static __inline__ ivl_dll_t ivl_dlopen(const char *name)
{ return (void *)LoadLibrary(name); }
static inline void *ivl_dlsym(ivl_dll_t dll, const char *nm)
static __inline__ void *ivl_dlsym(ivl_dll_t dll, const char *nm)
{ return (void *)GetProcAddress((HINSTANCE)dll,nm);}
static inline void ivl_dlclose(ivl_dll_t dll)
static __inline__ void ivl_dlclose(ivl_dll_t dll)
{ (void)FreeLibrary((HINSTANCE)dll);}
static inline const char *dlerror(void)
static __inline__ const char *dlerror(void)
{
static char msg[256];
unsigned long err = GetLastError();
@ -61,10 +61,10 @@ static inline const char *dlerror(void)
}
#elif defined(HAVE_DLFCN_H)
static inline ivl_dll_t ivl_dlopen(const char*name)
static __inline__ ivl_dll_t ivl_dlopen(const char*name)
{ return dlopen(name,RTLD_LAZY); }
static inline void* ivl_dlsym(ivl_dll_t dll, const char*nm)
static __inline__ void* ivl_dlsym(ivl_dll_t dll, const char*nm)
{
void*sym = dlsym(dll, nm);
/* Not found? try without the leading _ */
@ -73,24 +73,24 @@ static inline void* ivl_dlsym(ivl_dll_t dll, const char*nm)
return sym;
}
static inline void ivl_dlclose(ivl_dll_t dll)
static __inline__ void ivl_dlclose(ivl_dll_t dll)
{ dlclose(dll); }
#elif defined(HAVE_DL_H)
static inline ivl_dll_t ivl_dlopen(const char*name)
static __inline__ ivl_dll_t ivl_dlopen(const char*name)
{ return shl_load(name, BIND_IMMEDIATE, 0); }
static inline void* ivl_dlsym(ivl_dll_t dll, const char*nm)
static __inline__ void* ivl_dlsym(ivl_dll_t dll, const char*nm)
{
void*sym;
int rc = shl_findsym(&dll, nm, TYPE_PROCEDURE, &sym);
return (rc == 0) ? sym : 0;
}
static inline void ivl_dlclose(ivl_dll_t dll)
static __inline__ void ivl_dlclose(ivl_dll_t dll)
{ shl_unload(dll); }
static inline const char*dlerror(void)
static __inline__ const char*dlerror(void)
{ return strerror( errno ); }
#endif

View File

@ -93,4 +93,4 @@
* junk, and support gcc 3.0. (Stephan Boettcher)
*
*/
#endif // __config_H
#endif /* __config_H */

View File

@ -353,6 +353,8 @@ static int t_compile()
#ifdef __MINGW32__
unsigned ncmd_start = ncmd;
#else
int rtn;
#endif
/* Build the ivl command and pipe it to the preprocessor. */
@ -416,7 +418,7 @@ static int t_compile()
free(cmd);
return rc;
#else
int rtn = 0;
rtn = 0;
if (rc != 0) {
if (rc == 127) {
fprintf(stderr, "Failed to execute: %s\n", cmd);

View File

@ -1257,7 +1257,7 @@ extern const char*ivl_lpm_string(ivl_lpm_t net);
*/
extern unsigned ivl_lval_width(ivl_lval_t net);
extern ivl_expr_t ivl_lval_mux(ivl_lval_t net); // XXXX Obsolete?
extern ivl_expr_t ivl_lval_mux(ivl_lval_t net); /* XXXX Obsolete? */
extern ivl_expr_t ivl_lval_idx(ivl_lval_t net);
extern ivl_expr_t ivl_lval_part_off(ivl_lval_t net);
extern ivl_signal_t ivl_lval_sig(ivl_lval_t net);

View File

@ -698,7 +698,7 @@ static int is_defined(const char*name)
* These variables are also used for storing the actual arguments when
* a macro is instantiated.
*/
#define MAX_DEF_ARG 256 // allows argument IDs to be stored in a single char
#define MAX_DEF_ARG 256 /* allows argument IDs to be stored in a single char */
#define DEF_BUF_CHUNK 256
@ -707,14 +707,14 @@ static int def_buf_size = 0;
static int def_buf_free = 0;
static int def_argc = 0;
static int def_argo[MAX_DEF_ARG]; // offset of first character in arg
static int def_argl[MAX_DEF_ARG]; // length of arg string.
static int def_argo[MAX_DEF_ARG]; /* offset of first character in arg */
static int def_argl[MAX_DEF_ARG]; /* length of arg string. */
/*
* Return a pointer to the start of argument 'arg'. Returned pointers
* may go stale after a call to def_buf_grow_to_fit.
*/
static inline char* def_argv(int arg)
static /* inline */ char* def_argv(int arg)
{
return def_buf + def_argo[arg];
}

View File

@ -102,6 +102,8 @@ static int flist_read_flags(const char*path)
char*cp = line_buf + strspn(line_buf, " \t\r\b\f");
/* Remove trailing white space. */
char*tail = cp + strlen(cp);
char*arg;
while (tail > cp) {
if (! isspace(tail[-1]))
break;
@ -117,7 +119,7 @@ static int flist_read_flags(const char*path)
continue;
/* The arg points to the argument to the keyword. */
char*arg = strchr(cp, ':');
arg = strchr(cp, ':');
if (arg) *arg++ = 0;
if (strcmp(cp,"D") == 0) {

View File

@ -99,7 +99,7 @@ PLI_INT32 acc_fetch_fulltype(handle obj)
return accTopModule;
else
return accModuleInstance;
// FIXME accCellInstance
/* FIXME accCellInstance */
case vpiNamedEvent: return accNamedEvent;

View File

@ -55,7 +55,7 @@ handle acc_next(PLI_INT32 *type, handle scope, handle prev)
* rescan all the items up to the previous one, then return
* the next one.
*/
iter = vpi_iterate(vpiScope, scope); // ICARUS extension
iter = vpi_iterate(vpiScope, scope); /* ICARUS extension */
if (prev) {
while ((hand = vpi_scan(iter))) {
if (hand == prev) break;

View File

@ -366,7 +366,7 @@ PLI_INT32 tf_isetrealdelay(double dly, void*obj)
s_cb_data cb;
s_vpi_time ti = {vpiSimTime};
// Scale delay to SimTime
/* Scale delay to SimTime */
ivl_u64_t delay = ((dly
* pow(10, tf_gettimeprecision() - tf_gettimeunit()))
+ 0.5);

View File

@ -216,11 +216,11 @@ static void show_lpm_arithmetic_pins(ivl_lpm_t net)
static void show_lpm_abs(ivl_lpm_t net)
{
unsigned width = ivl_lpm_width(net);
ivl_nexus_t nex;
fprintf(out, " LPM_ABS %s: <width=%u>\n",
ivl_lpm_basename(net), width);
ivl_nexus_t nex;
nex = ivl_lpm_q(net, 0);
fprintf(out, " Q: %s\n", ivl_nexus_name(ivl_lpm_q(net, 0)));
@ -281,12 +281,13 @@ static void show_lpm_array(ivl_lpm_t net)
static void show_lpm_cast_int(ivl_lpm_t net)
{
unsigned width = ivl_lpm_width(net);
ivl_nexus_t q, a;
fprintf(out, " LPM_CAST_INT %s: <width=%u>\n",
ivl_lpm_basename(net), width);
ivl_nexus_t q = ivl_lpm_q(net,0);
ivl_nexus_t a = ivl_lpm_data(net,0);
q = ivl_lpm_q(net,0);
a = ivl_lpm_data(net,0);
fprintf(out, " O: %s\n", ivl_nexus_name(ivl_lpm_q(net,0)));
fprintf(out, " A: %s\n", ivl_nexus_name(ivl_lpm_data(net,0)));
@ -306,12 +307,13 @@ static void show_lpm_cast_int(ivl_lpm_t net)
static void show_lpm_cast_real(ivl_lpm_t net)
{
unsigned width = ivl_lpm_width(net);
ivl_nexus_t q, a;
fprintf(out, " LPM_CAST_REAL %s: <width=%u>\n",
ivl_lpm_basename(net), width);
ivl_nexus_t q = ivl_lpm_q(net,0);
ivl_nexus_t a = ivl_lpm_data(net,0);
q = ivl_lpm_q(net,0);
a = ivl_lpm_data(net,0);
fprintf(out, " O: %s\n", ivl_nexus_name(ivl_lpm_q(net,0)));
fprintf(out, " A: %s\n", ivl_nexus_name(ivl_lpm_data(net,0)));
@ -1088,7 +1090,7 @@ static void signal_nexus_const(ivl_signal_t sig,
break;
case IVL_VT_REAL:
fprintf(out, "%lf", ivl_const_real(con));
fprintf(out, "%f", ivl_const_real(con));
break;
default:
@ -1486,12 +1488,13 @@ static void show_logic(ivl_net_logic_t net)
static int show_scope(ivl_scope_t net, void*x)
{
unsigned idx;
char *is_auto;
fprintf(out, "scope: %s (%u parameters, %u signals, %u logic)",
ivl_scope_name(net), ivl_scope_params(net),
ivl_scope_sigs(net), ivl_scope_logs(net));
char *is_auto = ivl_scope_is_auto(net) ? "automatic " : "";
is_auto = ivl_scope_is_auto(net) ? "automatic " : "";
switch (ivl_scope_type(net)) {
case IVL_SCT_MODULE:
fprintf(out, " module %s", ivl_scope_tname(net));

View File

@ -28,6 +28,9 @@ void show_switch(ivl_switch_t net)
{
const char*name = ivl_switch_basename(net);
int has_enable = 0;
ivl_nexus_t nexa, nexb;
ivl_variable_type_t nex_type_a, nex_type_b;
const char*nex_name;
switch (ivl_switch_type(net)) {
case IVL_SW_TRAN:
@ -61,14 +64,14 @@ void show_switch(ivl_switch_t net)
fprintf(out, " island=%p\n", ivl_switch_island(net));
ivl_nexus_t nexa = ivl_switch_a(net);
const char*nex_name = nexa? ivl_nexus_name(nexa) : "";
ivl_variable_type_t nex_type_a = nexa? type_of_nexus(nexa) : IVL_VT_NO_TYPE;
nexa = ivl_switch_a(net);
nex_name = nexa? ivl_nexus_name(nexa) : "";
nex_type_a = nexa? type_of_nexus(nexa) : IVL_VT_NO_TYPE;
fprintf(out, " A: %s <type=%s>\n", nex_name, data_type_string(nex_type_a));
ivl_nexus_t nexb = ivl_switch_b(net);
nexb = ivl_switch_b(net);
nex_name = nexb? ivl_nexus_name(nexb) : "";
ivl_variable_type_t nex_type_b = nexb? type_of_nexus(nexb) : IVL_VT_NO_TYPE;
nex_type_b = nexb? type_of_nexus(nexb) : IVL_VT_NO_TYPE;
fprintf(out, " B: %s <type=%s>\n", nex_name, data_type_string(nex_type_b));
/* The A/B pins of the switch must be present, and must match. */

View File

@ -33,16 +33,19 @@
static void draw_lpm_mux_ab(ivl_lpm_t net, const char*muxz)
{
unsigned width = ivl_lpm_width(net);
ivl_expr_t d_rise, d_fall, d_decay;
const char*dly;
const char* input[3];
/* Only support A-B muxes in this function. */
assert(ivl_lpm_size(net) == 2);
assert(ivl_lpm_selects(net) == 1);
ivl_expr_t d_rise = ivl_lpm_delay(net, 0);
ivl_expr_t d_fall = ivl_lpm_delay(net, 1);
ivl_expr_t d_decay = ivl_lpm_delay(net, 2);
d_rise = ivl_lpm_delay(net, 0);
d_fall = ivl_lpm_delay(net, 1);
d_decay = ivl_lpm_delay(net, 2);
const char*dly = "";
dly = "";
if (d_rise != 0) {
dly = "/d";
if (number_is_immediate(d_rise, 64, 0) &&
@ -74,7 +77,6 @@ static void draw_lpm_mux_ab(ivl_lpm_t net, const char*muxz)
}
}
const char* input[3];
input[0] = draw_net_input(ivl_lpm_data(net,0));
input[1] = draw_net_input(ivl_lpm_data(net,1));
input[2] = draw_net_input(ivl_lpm_select(net));

View File

@ -146,12 +146,14 @@ static struct vvp_nexus_data*new_nexus_data()
static int nexus_drive_is_strength_aware(ivl_nexus_ptr_t nptr)
{
ivl_net_logic_t log;
if (ivl_nexus_ptr_drive0(nptr) != IVL_DR_STRONG)
return 1;
if (ivl_nexus_ptr_drive1(nptr) != IVL_DR_STRONG)
return 1;
ivl_net_logic_t log = ivl_nexus_ptr_log(nptr);
log = ivl_nexus_ptr_log(nptr);
if (log != 0) {
/* These logic gates are able to generate unusual
strength values and so their outputs are considered
@ -325,9 +327,11 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
cptr = ivl_nexus_ptr_con(nptr);
if (cptr) {
char *result = 0;
ivl_expr_t d_rise, d_fall, d_decay;
/* Constants should have exactly 1 pin, with a literal value. */
assert(nptr_pin == 0);
char *result = 0;
switch (ivl_const_type(cptr)) {
case IVL_VT_LOGIC:
@ -353,17 +357,18 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
break;
}
ivl_expr_t d_rise = ivl_const_delay(cptr, 0);
ivl_expr_t d_fall = ivl_const_delay(cptr, 1);
ivl_expr_t d_decay = ivl_const_delay(cptr, 2);
d_rise = ivl_const_delay(cptr, 0);
d_fall = ivl_const_delay(cptr, 1);
d_decay = ivl_const_delay(cptr, 2);
/* We have a delayed constant, so we need to build some code. */
if (d_rise != 0) {
char tmp[128];
fprintf(vvp_out, "L_%p/d .functor BUFZ 1, %s, "
"C4<0>, C4<0>, C4<0>;\n", cptr, result);
free(result);
// Is this a fixed or variable delay?
/* Is this a fixed or variable delay? */
if (number_is_immediate(d_rise, 64, 0) &&
number_is_immediate(d_fall, 64, 0) &&
number_is_immediate(d_decay, 64, 0)) {
@ -394,7 +399,6 @@ static char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
fprintf(vvp_out, ", v%p_0;\n", sig);
}
char tmp[128];
snprintf(tmp, sizeof tmp, "L_%p", cptr);
result = strdup(tmp);
}

View File

@ -33,20 +33,24 @@ static void draw_tran_island(ivl_island_t island)
void draw_switch_in_scope(ivl_switch_t sw)
{
ivl_island_t island = ivl_switch_island(sw);
ivl_island_t island;
ivl_nexus_t nex_a, nex_b, enable;
const char*str_a, *str_b, *str_e;
island = ivl_switch_island(sw);
if (ivl_island_flag_test(island, 0) == 0)
draw_tran_island(island);
ivl_nexus_t nex_a = ivl_switch_a(sw);
nex_a = ivl_switch_a(sw);
assert(nex_a);
const char*str_a = draw_net_input(nex_a);
str_a = draw_net_input(nex_a);
ivl_nexus_t nex_b = ivl_switch_b(sw);
nex_b = ivl_switch_b(sw);
assert(nex_b);
const char*str_b = draw_net_input(nex_b);
str_b = draw_net_input(nex_b);
ivl_nexus_t enable = ivl_switch_enable(sw);
const char*str_e = 0;
enable = ivl_switch_enable(sw);
str_e = 0;
if (enable)
str_e = draw_net_input(enable);

View File

@ -28,13 +28,14 @@
static void function_argument_logic(ivl_signal_t port, ivl_expr_t exp)
{
struct vector_info res;
unsigned pwidth;
/* ports cannot be arrays. */
assert(ivl_signal_dimensions(port) == 0);
res = draw_eval_expr_wid(exp, ivl_signal_width(port), 0);
/* We could have extra bits so only select the ones we need. */
unsigned pwidth = ivl_signal_width(port);
pwidth = ivl_signal_width(port);
fprintf(vvp_out, " %%set/v v%p_0, %u, %u;\n", port, res.base,
(res.wid > pwidth) ? pwidth : res.wid);
@ -87,6 +88,7 @@ struct vector_info draw_ufunc_expr(ivl_expr_t exp, unsigned wid)
ivl_scope_t def = ivl_expr_def(exp);
ivl_signal_t retval = ivl_scope_port(def, 0);
struct vector_info res;
unsigned load_wid;
/* If this is an automatic function, allocate the local storage. */
if (ivl_scope_is_auto(def)) {
@ -127,7 +129,7 @@ struct vector_info draw_ufunc_expr(ivl_expr_t exp, unsigned wid)
assert(res.base != 0);
unsigned load_wid = swid;
load_wid = swid;
if (load_wid > ivl_signal_width(retval))
load_wid = ivl_signal_width(retval);

View File

@ -167,6 +167,8 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result,
case IVL_EX_SELECT: {
ivl_expr_t vexpr = ivl_expr_oper1(expr);
ivl_expr_t bexpr;
assert(vexpr);
/* This code is only for signals or selects. */
@ -177,7 +179,7 @@ static int get_vpi_taskfunc_signal_arg(struct args_info *result,
/* Add &APV<> code here when it is finished. */
if (ivl_expr_oper1(vexpr)) return 0;
ivl_expr_t bexpr = ivl_expr_oper2(expr);
bexpr = ivl_expr_oper2(expr);
assert(bexpr);
/* This is a constant bit/part select. */
@ -339,9 +341,10 @@ static void draw_vpi_taskfunc_args(const char*call_string,
fprintf(vvp_out, "%s", call_string);
for (idx = 0 ; idx < parm_count ; idx += 1) {
struct args_info*ptr;
fprintf(vvp_out, ", %s", args[idx].text);
free(args[idx].text);
struct args_info*ptr;
/* Clear the nested children vectors. */
for (ptr = &args[idx]; ptr != NULL; ptr = ptr->child) {
if (ptr->vec_flag) {

View File

@ -139,6 +139,7 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix)
unsigned word = 0;
if (ivl_signal_dimensions(sig) > 0) {
ivl_expr_t ixe;
/* Detect the special case that this is a
variable array. In this case, the ix/getv
@ -152,7 +153,7 @@ static void eval_logic_into_integer(ivl_expr_t expr, unsigned ix)
break;
}
ivl_expr_t ixe = ivl_expr_oper1(expr);
ixe = ivl_expr_oper1(expr);
if (number_is_immediate(ixe, 8*sizeof(unsigned long), 0))
word = get_number_immediate(ixe);
else {
@ -938,6 +939,8 @@ static struct vector_info draw_binary_expr_logic(ivl_expr_t exp,
{
ivl_expr_t le = ivl_expr_oper1(exp);
ivl_expr_t re = ivl_expr_oper2(exp);
struct vector_info lv;
struct vector_info rv;
if (ivl_expr_opcode(exp) == '&') {
if (number_is_immediate(re, IMM_WID, 0) && !number_is_unknown(re))
@ -946,9 +949,6 @@ static struct vector_info draw_binary_expr_logic(ivl_expr_t exp,
return draw_logic_immediate(exp, re, le, wid);
}
struct vector_info lv;
struct vector_info rv;
lv = draw_eval_expr_wid(le, wid, STUFF_OK_XZ);
rv = draw_eval_expr_wid(re, wid, STUFF_OK_XZ);
@ -1625,6 +1625,9 @@ static struct vector_info draw_number_expr(ivl_expr_t exp, unsigned wid)
unsigned nwid;
struct vector_info res;
const char*bits = ivl_expr_bits(exp);
unsigned long val;
unsigned val_bits;
unsigned val_addr;
res.wid = wid;
@ -1687,9 +1690,9 @@ static struct vector_info draw_number_expr(ivl_expr_t exp, unsigned wid)
destination. Use the %mov to handle the remaining general
bits. */
idx = 0;
unsigned long val = 0;
unsigned val_bits = 0;
unsigned val_addr = res.base;
val = 0;
val_bits = 0;
val_addr = res.base;
while (idx < nwid) {
char src = 0;
switch (bits[idx]) {
@ -1719,8 +1722,9 @@ static struct vector_info draw_number_expr(ivl_expr_t exp, unsigned wid)
}
if (src != 0) {
assert(val_bits == 0);
unsigned cnt;
assert(val_bits == 0);
for (cnt = 1 ; idx+cnt < nwid ; cnt += 1)
if (bits[idx+cnt] != bits[idx])
break;
@ -2031,9 +2035,10 @@ static void draw_signal_dest(ivl_expr_t exp, struct vector_info res,
if (ivl_signal_data_type(sig) == IVL_VT_REAL) {
int tmp;
assert(add_index < 0);
int tmp = allocate_word();
tmp = allocate_word();
fprintf(vvp_out, " %%load/wr %d, v%p_%u;\n", tmp, sig, word);
fprintf(vvp_out, " %%cvt/vr %u, %d, %u;\n", res.base, tmp, res.wid);
clr_word(tmp);
@ -2142,6 +2147,7 @@ static struct vector_info draw_select_signal(ivl_expr_t sube,
/* Use this word of the signal. */
unsigned use_word = 0;
unsigned use_wid;
/* If this is an access to an array, try to get the index as a
constant. If it is (and the array is not a reg array then
@ -2190,7 +2196,7 @@ static struct vector_info draw_select_signal(ivl_expr_t sube,
res.wid = wid;
assert(res.base);
unsigned use_wid = res.wid;
use_wid = res.wid;
if (use_wid > bit_wid)
use_wid = bit_wid;

View File

@ -72,9 +72,12 @@ static int draw_binary_real(ivl_expr_t exp)
case 'X':
{
struct vector_info vi;
int res;
const char*sign_flag;
vi = draw_eval_expr(exp, STUFF_OK_XZ);
int res = allocate_word();
const char*sign_flag = ivl_expr_signed(exp)? "/s" : "";
res = allocate_word();
sign_flag = ivl_expr_signed(exp)? "/s" : "";
fprintf(vvp_out, " %%ix/get%s %d, %u, %u;\n",
sign_flag, res, vi.base, vi.wid);
@ -113,7 +116,7 @@ static int draw_binary_real(ivl_expr_t exp)
fprintf(vvp_out, " %%pow/wr %d, %d;\n", l, r);
break;
case 'm': { // min(l,r)
case 'm': { /* min(l,r) */
int lab_out = local_count++;
int lab_r = local_count++;
/* If r is NaN, the go out and accept l as result. */
@ -131,7 +134,7 @@ static int draw_binary_real(ivl_expr_t exp)
break;
}
case 'M': { // max(l,r)
case 'M': { /* max(l,r) */
int lab_out = local_count++;
int lab_r = local_count++;
/* If r is NaN, the go out and accept l as result. */
@ -451,14 +454,20 @@ static int draw_ternary_real(ivl_expr_t exp)
static int draw_unary_real(ivl_expr_t exp)
{
ivl_expr_t sube;
int sub;
/* If the opcode is a ~ then the sub expression must not be a
* real expression, so use vector evaluation and then convert
* that result to a real value. */
if (ivl_expr_opcode(exp) == '~') {
struct vector_info vi;
int res;
const char*sign_flag;
vi = draw_eval_expr(exp, STUFF_OK_XZ);
int res = allocate_word();
const char*sign_flag = ivl_expr_signed(exp)? "/s" : "";
res = allocate_word();
sign_flag = ivl_expr_signed(exp)? "/s" : "";
fprintf(vvp_out, " %%ix/get%s %d, %u, %u;\n",
sign_flag, res, vi.base, vi.wid);
@ -470,9 +479,12 @@ static int draw_unary_real(ivl_expr_t exp)
if (ivl_expr_opcode(exp) == '!') {
struct vector_info vi;
int res;
const char*sign_flag;
vi = draw_eval_expr(exp, STUFF_OK_XZ);
int res = allocate_word();
const char*sign_flag = ivl_expr_signed(exp)? "/s" : "";
res = allocate_word();
sign_flag = ivl_expr_signed(exp)? "/s" : "";
fprintf(vvp_out, " %%ix/get%s %d, %u, %u;\n",
sign_flag, res, vi.base, vi.wid);
@ -482,9 +494,8 @@ static int draw_unary_real(ivl_expr_t exp)
return res;
}
ivl_expr_t sube = ivl_expr_oper1(exp);
int sub = draw_eval_real(sube);
sube = ivl_expr_oper1(exp);
sub = draw_eval_real(sube);
if (ivl_expr_opcode(exp) == '+')
return sub;

View File

@ -84,6 +84,8 @@ static void draw_modpath_record(const char*label, const char*driver,
int ppos = ivl_path_source_posedge(path);
int pneg = ivl_path_source_negedge(path);
const char*edge = ppos? " +" : pneg ? " -" : "";
ivl_signal_t src_sig;
fprintf(vvp_out, ",\n %s%s", src_drivers[idx], edge);
fprintf(vvp_out,
" (%"PRIu64",%"PRIu64",%"PRIu64
@ -109,7 +111,7 @@ static void draw_modpath_record(const char*label, const char*driver,
fprintf(vvp_out, ")");
ivl_signal_t src_sig = find_path_source_port(path);
src_sig = find_path_source_port(path);
fprintf(vvp_out, " v%p_0", src_sig);
}
@ -140,9 +142,10 @@ void cleanup_modpath(void)
{
while (modpath_list) {
struct modpath_item*cur = modpath_list;
char modpath_label[64];
modpath_list = cur->next;
char modpath_label[64];
snprintf(modpath_label, sizeof modpath_label, "V_%p/m", cur->path_sig);
draw_modpath_record(modpath_label, cur->drive_label, cur->path_sig);
free(cur->drive_label);

View File

@ -41,23 +41,23 @@ static struct allocation_score_s {
/* This is the largest bit to have lookaside values. */
static unsigned lookaside_top = 0;
static inline ivl_expr_t peek_exp(unsigned addr)
static __inline__ ivl_expr_t peek_exp(unsigned addr)
{
return allocation_map[addr].exp;
}
static inline unsigned peek_exp_bit(unsigned addr)
static __inline__ unsigned peek_exp_bit(unsigned addr)
{
return allocation_map[addr].exp_bit;
}
static inline void set_exp(unsigned addr, ivl_expr_t exp, unsigned ebit)
static __inline__ void set_exp(unsigned addr, ivl_expr_t exp, unsigned ebit)
{
allocation_map[addr].exp = exp;
allocation_map[addr].exp_bit = ebit;
}
static inline void set_sig(unsigned addr, ivl_signal_t exp, unsigned sig_word, unsigned ebit)
static __inline__ void set_sig(unsigned addr, ivl_signal_t exp, unsigned sig_word, unsigned ebit)
{
allocation_map[addr].sig = exp;
allocation_map[addr].sig_word = sig_word;

View File

@ -46,7 +46,7 @@ static const char*version_string =
FILE*vvp_out = 0;
int vvp_errors = 0;
inline static void draw_execute_header(ivl_design_t des)
__inline__ static void draw_execute_header(ivl_design_t des)
{
#if !defined(__MINGW32__)
const char*cp = ivl_design_flag(des, "VVP_EXECUTABLE");
@ -57,7 +57,7 @@ inline static void draw_execute_header(ivl_design_t des)
#endif
}
inline static void draw_module_declarations(ivl_design_t des)
__inline__ static void draw_module_declarations(ivl_design_t des)
{
const char*cp = ivl_design_flag(des, "VPI_MODULE_LIST");
@ -84,6 +84,8 @@ int target_design(ivl_design_t des)
int rc;
ivl_scope_t *roots;
unsigned nroots, i;
unsigned size;
unsigned idx;
const char*path = ivl_design_flag(des, "-o");
assert(path);
@ -123,10 +125,9 @@ int target_design(ivl_design_t des)
rc = ivl_design_process(des, draw_process, 0);
/* Dump the file name table. */
unsigned size = ivl_file_table_size();
size = ivl_file_table_size();
fprintf(vvp_out, "# The file index is used to find the file name in "
"the following table.\n:file_names %u;\n", size);
unsigned idx;
for (idx = 0; idx < size; idx++) {
fprintf(vvp_out, " \"%s\";\n", ivl_file_table_item(idx));
}

View File

@ -46,4 +46,4 @@
* Isolate configure from containing config.h
*
*/
#endif // __vvp_config_H
#endif /* __vvp_config_H */

View File

@ -609,7 +609,7 @@ static int show_stmt_assign_nb(ivl_statement_t net)
ivl_signal_t sig;
unsigned nevents = ivl_stmt_nevent(net);
// If we have an event control build the control structure.
/* If we have an event control build the control structure. */
if (nevents) {
assert(del == 0);
@ -679,13 +679,13 @@ static int show_stmt_assign_nb(ivl_statement_t net)
for (lidx = 0 ; lidx < ivl_stmt_lvals(net) ; lidx += 1) {
unsigned bit_limit = wid - cur_rbit;
unsigned bidx;
lval = ivl_stmt_lval(net, lidx);
if (bit_limit > ivl_lval_width(lval))
bit_limit = ivl_lval_width(lval);
unsigned bidx;
bidx = res.base < 4? res.base : (res.base+cur_rbit);
assign_to_lvector(lval, bidx, delay, del, bit_limit, nevents);
@ -940,6 +940,8 @@ static int show_stmt_case_r(ivl_statement_t net, ivl_scope_t sscope)
static void force_real_to_lval(ivl_statement_t net, int res)
{
const char*command_name;
ivl_lval_t lval;
ivl_signal_t lsig;
switch (ivl_statement_type(net)) {
case IVL_ST_CASSIGN:
@ -955,8 +957,8 @@ static void force_real_to_lval(ivl_statement_t net, int res)
}
assert(ivl_stmt_lvals(net) == 1);
ivl_lval_t lval = ivl_stmt_lval(net, 0);
ivl_signal_t lsig = ivl_lval_sig(lval);
lval = ivl_stmt_lval(net, 0);
lsig = ivl_lval_sig(lval);
assert(ivl_lval_width(lval) == 1);
assert(ivl_lval_part_off(lval) == 0);
@ -1041,10 +1043,11 @@ static void force_vector_to_lval(ivl_statement_t net, struct vector_info rvec)
static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
{
ivl_signal_t rsig;;
ivl_signal_t rsig;
ivl_lval_t lval;
ivl_signal_t lsig;
const char*command_name;
ivl_expr_t part_off_ex;
ivl_expr_t lword_idx, rword_idx;
unsigned long use_lword = 0, use_rword = 0;
@ -1072,7 +1075,7 @@ static void force_link_rval(ivl_statement_t net, ivl_expr_t rval)
/* We do not currently support driving a signal to a bit or
* part select (this could give us multiple drivers). */
ivl_expr_t part_off_ex = ivl_lval_part_off(lval);
part_off_ex = ivl_lval_part_off(lval);
if (ivl_signal_width(lsig) > ivl_signal_width(rsig) ||
(part_off_ex && get_number_immediate(part_off_ex) != 0)) {
fprintf(stderr, "%s:%u: vvp-tgt sorry: cannot %s signal to "
@ -1139,9 +1142,13 @@ static int show_stmt_cassign(ivl_statement_t net)
static int show_stmt_deassign(ivl_statement_t net)
{
ivl_signal_t sig = ivl_lval_sig(ivl_stmt_lval(net, 0));
unsigned lidx;
if (sig && ivl_signal_data_type(sig) == IVL_VT_REAL) {
ivl_lval_t lval;
assert(ivl_stmt_lvals(net) == 1);
ivl_lval_t lval = ivl_stmt_lval(net, 0);
lval = ivl_stmt_lval(net, 0);
assert(ivl_lval_width(lval) == 1);
assert(ivl_lval_part_off(lval) == 0);
assert(ivl_lval_idx(lval) == 0);
@ -1150,21 +1157,22 @@ static int show_stmt_deassign(ivl_statement_t net)
return 0;
}
unsigned lidx;
for (lidx = 0 ; lidx < ivl_stmt_lvals(net) ; lidx += 1) {
ivl_lval_t lval = ivl_stmt_lval(net, lidx);
ivl_signal_t lsig = ivl_lval_sig(lval);
ivl_expr_t word_idx = ivl_lval_idx(lval);
unsigned long use_word = 0;
unsigned use_wid;
ivl_expr_t part_off_ex;
unsigned part_off;
assert(lsig != 0);
assert(ivl_lval_mux(lval) == 0);
unsigned use_wid = ivl_lval_width(lval);
ivl_expr_t part_off_ex = ivl_lval_part_off(lval);
unsigned part_off = 0;
use_wid = ivl_lval_width(lval);
part_off_ex = ivl_lval_part_off(lval);
part_off = 0;
if (part_off_ex != 0) {
assert(number_is_immediate(part_off_ex, 64, 0));
part_off = get_number_immediate(part_off_ex);
@ -1425,11 +1433,14 @@ static int show_stmt_noop(ivl_statement_t net)
static int show_stmt_release(ivl_statement_t net)
{
ivl_signal_t sig = ivl_lval_sig(ivl_stmt_lval(net, 0));
unsigned lidx;
if (sig && ivl_signal_data_type(sig) == IVL_VT_REAL) {
unsigned type = 0;
ivl_lval_t lval;
assert(ivl_stmt_lvals(net) == 1);
ivl_lval_t lval = ivl_stmt_lval(net, 0);
lval = ivl_stmt_lval(net, 0);
assert(ivl_lval_width(lval) == 1);
assert(ivl_lval_part_off(lval) == 0);
assert(ivl_lval_idx(lval) == 0);
@ -1440,8 +1451,6 @@ static int show_stmt_release(ivl_statement_t net)
return 0;
}
unsigned lidx;
for (lidx = 0 ; lidx < ivl_stmt_lvals(net) ; lidx += 1) {
ivl_lval_t lval = ivl_stmt_lval(net, lidx);
ivl_signal_t lsig = ivl_lval_sig(lval);
@ -1449,12 +1458,16 @@ static int show_stmt_release(ivl_statement_t net)
ivl_expr_t word_idx = ivl_lval_idx(lval);
unsigned long use_word = 0;
unsigned use_wid;
ivl_expr_t part_off_ex;
unsigned part_off;
assert(lsig != 0);
assert(ivl_lval_mux(lval) == 0);
unsigned use_wid = ivl_lval_width(lval);
ivl_expr_t part_off_ex = ivl_lval_part_off(lval);
unsigned part_off = 0;
use_wid = ivl_lval_width(lval);
part_off_ex = ivl_lval_part_off(lval);
part_off = 0;
if (part_off_ex != 0) {
assert(number_is_immediate(part_off_ex, 64, 0));
part_off = get_number_immediate(part_off_ex);

View File

@ -36,7 +36,7 @@
* Escape non-symbol characters in ids, and quotes in strings.
*/
inline static char hex_digit(unsigned i)
__inline__ static char hex_digit(unsigned i)
{
i &= 0xf;
return i>=10 ? i-10+'A' : i+'0';
@ -322,6 +322,8 @@ char* draw_Cr_to_string(double value)
char tmp[256];
uint64_t mant = 0;
int sign, expo, vexp;
double fract;
if (isinf(value)) {
if (value > 0)
@ -335,19 +337,18 @@ char* draw_Cr_to_string(double value)
return strdup(tmp);
}
int sign = 0;
sign = 0;
if (value < 0) {
sign = 0x4000;
value *= -1;
}
int expo;
double fract = frexp(value, &expo);
fract = frexp(value, &expo);
fract = ldexp(fract, 63);
mant = fract;
expo -= 63;
int vexp = expo + 0x1000;
vexp = expo + 0x1000;
assert(vexp >= 0);
assert(vexp < 0x2000);
vexp += sign;
@ -1085,9 +1086,11 @@ static const char* draw_lpm_output_delay(ivl_lpm_t net)
static void draw_lpm_abs(ivl_lpm_t net)
{
const char*src_table[1];
const char*dly;
draw_lpm_data_inputs(net, 0, 1, src_table);
const char*dly = draw_lpm_output_delay(net);
dly = draw_lpm_output_delay(net);
fprintf(vvp_out, "L_%p%s .abs %s;\n",
net, dly, src_table[0]);
@ -1096,9 +1099,11 @@ static void draw_lpm_abs(ivl_lpm_t net)
static void draw_lpm_cast_int(ivl_lpm_t net)
{
const char*src_table[1];
const char*dly;
draw_lpm_data_inputs(net, 0, 1, src_table);
const char*dly = draw_lpm_output_delay(net);
dly = draw_lpm_output_delay(net);
fprintf(vvp_out, "L_%p%s .cast/int %u, %s;\n",
net, dly, ivl_lpm_width(net), src_table[0]);
@ -1107,11 +1112,13 @@ static void draw_lpm_cast_int(ivl_lpm_t net)
static void draw_lpm_cast_real(ivl_lpm_t net)
{
const char*src_table[1];
const char*dly;
const char*is_signed = "";
draw_lpm_data_inputs(net, 0, 1, src_table);
const char*dly = draw_lpm_output_delay(net);
dly = draw_lpm_output_delay(net);
const char*is_signed = "";
if (ivl_lpm_signed(net)) is_signed = ".s";
fprintf(vvp_out, "L_%p%s .cast/real%s %s;\n",
@ -1126,6 +1133,7 @@ static void draw_lpm_add(ivl_lpm_t net)
ivl_variable_type_t dta = data_type_of_nexus(ivl_lpm_data(net,0));
ivl_variable_type_t dtb = data_type_of_nexus(ivl_lpm_data(net,1));
ivl_variable_type_t dto = IVL_VT_LOGIC;
const char*dly;
if (dta == IVL_VT_REAL || dtb == IVL_VT_REAL)
dto = IVL_VT_REAL;
@ -1179,7 +1187,7 @@ static void draw_lpm_add(ivl_lpm_t net)
draw_lpm_data_inputs(net, 0, 2, src_table);
const char*dly = draw_lpm_output_delay(net);
dly = draw_lpm_output_delay(net);
fprintf(vvp_out, "L_%p%s .arith/%s %u, %s, %s;\n",
net, dly, type, width, src_table[0], src_table[1]);
@ -1193,8 +1201,10 @@ static void draw_lpm_array(ivl_lpm_t net)
{
ivl_nexus_t nex;
ivl_signal_t mem = ivl_lpm_array(net);
const char*tmp;
nex = ivl_lpm_select(net);
const char*tmp = draw_net_input(nex);
tmp = draw_net_input(nex);
fprintf(vvp_out, "L_%p .array/port v%p, %s;\n", net, mem, tmp);
}
@ -1208,6 +1218,7 @@ static void draw_lpm_cmp(ivl_lpm_t net)
ivl_variable_type_t dta = data_type_of_nexus(ivl_lpm_data(net,0));
ivl_variable_type_t dtb = data_type_of_nexus(ivl_lpm_data(net,1));
ivl_variable_type_t dtc = IVL_VT_LOGIC;
const char*dly;
if (dta == IVL_VT_REAL || dtb == IVL_VT_REAL)
dtc = IVL_VT_REAL;
@ -1259,7 +1270,7 @@ static void draw_lpm_cmp(ivl_lpm_t net)
draw_lpm_data_inputs(net, 0, 2, src_table);
const char*dly = draw_lpm_output_delay(net);
dly = draw_lpm_output_delay(net);
fprintf(vvp_out, "L_%p%s .cmp/%s%s %u, %s, %s;\n",
net, dly, type, signed_string, width,

View File

@ -23,6 +23,22 @@
# include <iostream>
# include <cassert>
# include <math.h> // Needed to get pow for as_double().
# include <stdio.h> // Needed to get snprintf for as_string().
#if !defined(HAVE_LROUND)
/*
* If the system doesn't provide the lround function, then we provide
* it ourselves here. It is simply the nearest integer, rounded away
* from zero.
*/
extern "C" long int lround(double x)
{
if (x >= 0.0)
return (long)floor(x+0.5);
else
return (long)ceil(x-0.5);
}
#endif
static verinum::V add_with_carry(verinum::V l, verinum::V r, verinum::V&c);

View File

@ -143,8 +143,10 @@ static int lookup_keyword(const char*text)
*/
static void process_quoted_string(void)
{
char*endp;
yylval.string_val = strdup(yytext+1);
char*endp = yylval.string_val+strlen(yylval.string_val);
endp = yylval.string_val+strlen(yylval.string_val);
assert(endp[-1] == '"');
endp[-1] = 0;
}

View File

@ -29,9 +29,10 @@
*/
static unsigned is_numeric_obj(vpiHandle obj)
{
assert(obj);
unsigned rtn = 0;
assert(obj);
switch(vpi_get(vpiType, obj)) {
case vpiConstant:
case vpiParameter:
@ -60,10 +61,11 @@ static unsigned is_numeric_obj(vpiHandle obj)
static PLI_INT32 sys_clog2_compiletf(PLI_BYTE8 *name)
{
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
vpiHandle argv, arg;
assert(callh != 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle arg;
(void) name; // Not used!
argv = vpi_iterate(vpiArgument, callh);
(void) name; /* Not used! */
/* We must have an argument. */
if (argv == 0) {
@ -86,11 +88,13 @@ static PLI_INT32 sys_clog2_compiletf(PLI_BYTE8 *name)
/* We can have a maximum of one argument. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s $clog2 takes at most one argument.\n", msg);
@ -109,7 +113,7 @@ static PLI_INT32 sys_clog2_calltf(PLI_BYTE8 *name)
vpiHandle arg;
s_vpi_value val;
s_vpi_vecval vec;
(void) name; // Not used!/
(void) name; /* Not used! */
/* Get the argument. */
arg = vpi_scan(argv);

View File

@ -60,29 +60,30 @@ struct strobe_cb_info {
unsigned mcd;
};
// The number of decimal digits needed to represent a
// nr_bits binary number is floor(nr_bits*log_10(2))+1,
// where log_10(2) = 0.30102999566398.... and I approximate
// this transcendental number as 146/485, to avoid the vagaries
// of floating-point. The smallest nr_bits for which this
// approximation fails is 2621,
// 2621*log_10(2)=789.9996, but (2621*146+484)/485=790 (exactly).
// In cases like this, all that happens is we allocate one
// unneeded char for the output. I add a "L" suffix to 146
// to make sure the computation is done as long ints, otherwise
// on a 16-bit int machine (allowed by ISO C) we would mangle
// this computation for bit-length of 224. I'd like to put
// in a test for nr_bits < LONG_MAX/146, but don't know how
// to fail, other than crashing.
//
// In an April 2000 thread in comp.unix.programmer, with subject
// "integer -> string", I <LRDoolittle@lbl.gov> give the 28/93
// approximation, but overstate its accuracy: that version first
// fails when the number of bits is 289, not 671.
//
// This result does not include space for a trailing '\0', if any.
//
inline static int calc_dec_size(int nr_bits, int is_signed)
/*
* The number of decimal digits needed to represent a
* nr_bits binary number is floor(nr_bits*log_10(2))+1,
* where log_10(2) = 0.30102999566398.... and I approximate
* this transcendental number as 146/485, to avoid the vagaries
* of floating-point. The smallest nr_bits for which this
* approximation fails is 2621,
* 2621*log_10(2)=789.9996, but (2621*146+484)/485=790 (exactly).
* In cases like this, all that happens is we allocate one
* unneeded char for the output. I add a "L" suffix to 146
* to make sure the computation is done as long ints, otherwise
* on a 16-bit int machine (allowed by ISO C) we would mangle
* this computation for bit-length of 224. I'd like to put
* in a test for nr_bits < LONG_MAX/146, but don't know how
* to fail, other than crashing.
*
* In an April 2000 thread in comp.unix.programmer, with subject
* "integer -> string", I <LRDoolittle@lbl.gov> give the 28/93
* approximation, but overstate its accuracy: that version first
* fails when the number of bits is 289, not 671.
*
* This result does not include space for a trailing '\0', if any.
*/
__inline__ static int calc_dec_size(int nr_bits, int is_signed)
{
int r;
if (is_signed) --nr_bits;
@ -378,7 +379,7 @@ static int format_str_char(vpiHandle scope, unsigned int mcd,
use_count = 0;
break;
// new Verilog 2001 format specifiers...
/* new Verilog 2001 format specifiers... */
case 'l':
case 'L':
case 'u':
@ -445,7 +446,7 @@ static int format_str_char(vpiHandle scope, unsigned int mcd,
{ char* value_str = value.value.str;
if (leading_zero==1){
// Strip away all leading zeros from string
/* Strip away all leading zeros from string */
unsigned int i=0;
while(i< (strlen(value_str)-1) && value_str[i]=='0')
i++;
@ -511,11 +512,12 @@ static int format_str_char(vpiHandle scope, unsigned int mcd,
}
if (fsize==-1){
// simple %d parameter, or %0d parameter.
// Size is now determined by the width
// of the vector or integer. If %0d, then
// set the size to 0 so that the minimum
// size is used.
/* simple %d parameter, or %0d parameter.
* Size is now determined by the width
* of the vector or integer. If %0d, then
* set the size to 0 so that the minimum
* size is used.
*/
fsize = (leading_zero==1)
? 0
: vpi_get_dec_size(argv[idx]);
@ -871,7 +873,7 @@ static int get_default_format(char *name)
int default_format;
switch(name[ strlen(name)-1 ]){
// writE/strobE or monitoR or displaY/fdisplaY or sformaT
/* writE/strobE or monitoR or displaY/fdisplaY or sformaT */
case 'e':
case 'r':
case 't':
@ -1938,7 +1940,7 @@ static PLI_INT32 sys_swrite_compiletf(PLI_BYTE8 *name)
}
/* The first argument must be a register. */
reg = vpi_scan(argv); //* This should never be zero. */
reg = vpi_scan(argv); /* This should never be zero. */
if (vpi_get(vpiType, reg) != vpiReg) {
vpi_printf("ERROR: %s's first argument must be a register.\n", name);
vpi_control(vpiFinish, 1);
@ -1998,7 +2000,7 @@ static PLI_INT32 sys_sformat_compiletf(PLI_BYTE8 *name)
}
/* The first argument must be a register. */
arg = vpi_scan(argv); //* This should never be zero. */
arg = vpi_scan(argv); /* This should never be zero. */
if (vpi_get(vpiType, arg) != vpiReg) {
vpi_printf("ERROR: %s's first argument must be a register.\n", name);
vpi_control(vpiFinish, 1);
@ -2201,7 +2203,7 @@ void sys_display_register()
s_cb_data cb_data;
s_vpi_systf_data tf_data;
//============================== display
/*============================== display */
tf_data.type = vpiSysTask;
tf_data.tfname = "$display";
tf_data.calltf = sys_display_calltf;
@ -2234,7 +2236,7 @@ void sys_display_register()
tf_data.user_data = "$displayb";
vpi_register_systf(&tf_data);
//============================== write
/*============================== write */
tf_data.type = vpiSysTask;
tf_data.tfname = "$write";
tf_data.calltf = sys_display_calltf;
@ -2267,7 +2269,7 @@ void sys_display_register()
tf_data.user_data = "$writeb";
vpi_register_systf(&tf_data);
//============================== strobe
/*============================== strobe */
tf_data.type = vpiSysTask;
tf_data.tfname = "$strobe";
tf_data.calltf = sys_strobe_calltf;
@ -2300,7 +2302,7 @@ void sys_display_register()
tf_data.user_data = "$strobeb";
vpi_register_systf(&tf_data);
//============================== fstrobe
/*============================== fstrobe */
tf_data.type = vpiSysTask;
tf_data.tfname = "$fstrobe";
tf_data.calltf = sys_strobe_calltf;
@ -2333,7 +2335,7 @@ void sys_display_register()
tf_data.user_data = "$fstrobeb";
vpi_register_systf(&tf_data);
//============================== monitor
/*============================== monitor */
tf_data.type = vpiSysTask;
tf_data.tfname = "$monitor";
tf_data.calltf = sys_monitor_calltf;
@ -2382,7 +2384,7 @@ void sys_display_register()
tf_data.user_data = "$monitoroff";
vpi_register_systf(&tf_data);
//============================== fdisplay
/*============================== fdisplay */
tf_data.type = vpiSysTask;
tf_data.tfname = "$fdisplay";
tf_data.calltf = sys_fdisplay_calltf;
@ -2415,7 +2417,7 @@ void sys_display_register()
tf_data.user_data = "$fdisplayb";
vpi_register_systf(&tf_data);
//============================== fwrite
/*============================== fwrite */
tf_data.type = vpiSysTask;
tf_data.tfname = "$fwrite";
tf_data.calltf = sys_fdisplay_calltf;
@ -2448,7 +2450,7 @@ void sys_display_register()
tf_data.user_data = "$fwriteb";
vpi_register_systf(&tf_data);
//============================== swrite
/*============================== swrite */
tf_data.type = vpiSysTask;
tf_data.tfname = "$swrite";
tf_data.calltf = sys_swrite_calltf;
@ -2489,7 +2491,7 @@ void sys_display_register()
tf_data.user_data = "$sformat";
vpi_register_systf(&tf_data);
//============================ timeformat
/*============================ timeformat */
tf_data.type = vpiSysTask;
tf_data.tfname = "$timeformat";
tf_data.calltf = sys_timeformat_calltf;

View File

@ -34,9 +34,10 @@
static PLI_INT32 sys_fopen_compiletf(PLI_BYTE8 *name)
{
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle argv;
vpiHandle arg;
assert(callh != 0);
argv = vpi_iterate(vpiArgument, callh);
/* Check that there is a file name argument and that it is a string. */
if (argv == 0) {
@ -68,11 +69,13 @@ static PLI_INT32 sys_fopen_compiletf(PLI_BYTE8 *name)
/* Make sure there are no extra arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s takes at most two string arguments.\n",
@ -95,6 +98,7 @@ static PLI_INT32 sys_fopen_calltf(PLI_BYTE8*name)
unsigned idx;
vpiHandle item = vpi_scan(argv);
vpiHandle mode = vpi_scan(argv);
unsigned len;
/* Get the mode handle if it exists. */
if (mode) {
@ -177,7 +181,7 @@ static PLI_INT32 sys_fopen_calltf(PLI_BYTE8*name)
* Verify that the file name is composed of only printable
* characters.
*/
unsigned len = strlen(val.value.str);
len = strlen(val.value.str);
for (idx = 0; idx < len; idx++) {
if (! isprint(val.value.str[idx])) {
char msg [64];
@ -217,10 +221,11 @@ static PLI_INT32 sys_fopenrwa_calltf(PLI_BYTE8*name)
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle file = vpi_scan(argv);
vpi_free_object(argv);
s_vpi_value val;
char *mode;
unsigned idx, len;
vpi_free_object(argv);
/* Get the mode. */
mode = name + strlen(name) - 1;
@ -242,7 +247,7 @@ static PLI_INT32 sys_fopenrwa_calltf(PLI_BYTE8*name)
* Verify that the file name is composed of only printable
* characters.
*/
unsigned idx, len = strlen(val.value.str);
len = strlen(val.value.str);
for (idx = 0; idx < len; idx++) {
if (! isprint(val.value.str[idx])) {
char msg [64];
@ -272,12 +277,12 @@ static PLI_INT32 sys_fclose_calltf(PLI_BYTE8*name)
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle fd = vpi_scan(argv);
vpi_free_object(argv);
(void) name; /* Not used! */
s_vpi_value val;
PLI_UINT32 fd_mcd;
vpi_free_object(argv);
(void) name; /* Not used! */
val.format = vpiIntVal;
vpi_get_value(fd, &val);
fd_mcd = val.value.integer;
@ -406,11 +411,13 @@ static PLI_INT32 sys_fgets_compiletf(PLI_BYTE8*name)
/* Make sure there are no extra arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s takes two arguments.\n", msg, name);
@ -590,11 +597,13 @@ static PLI_INT32 sys_fseek_compiletf(PLI_BYTE8*name)
/* Make sure there are no extra arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s takes three arguments.\n", msg, name);
@ -727,7 +736,7 @@ void sys_fileio_register()
{
s_vpi_systf_data tf_data;
//============================== fopen
/*============================== fopen */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$fopen";
@ -737,7 +746,7 @@ void sys_fileio_register()
tf_data.user_data = "$fopen";
vpi_register_systf(&tf_data);
//============================== fopenr
/*============================== fopenr */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$fopenr";
@ -747,17 +756,17 @@ void sys_fileio_register()
tf_data.user_data = "$fopenr";
vpi_register_systf(&tf_data);
//============================== fopenw
/*============================== fopenw */
tf_data.tfname = "$fopenw";
tf_data.user_data = "$fopenw";
vpi_register_systf(&tf_data);
//============================== fopena
/*============================== fopena */
tf_data.tfname = "$fopena";
tf_data.user_data = "$fopena";
vpi_register_systf(&tf_data);
//============================== fclose
/*============================== fclose */
tf_data.type = vpiSysTask;
tf_data.tfname = "$fclose";
tf_data.calltf = sys_fclose_calltf;
@ -766,7 +775,7 @@ void sys_fileio_register()
tf_data.user_data = "$fclose";
vpi_register_systf(&tf_data);
//============================== fflush
/*============================== fflush */
tf_data.type = vpiSysTask;
tf_data.tfname = "$fflush";
tf_data.calltf = sys_fflush_calltf;
@ -775,7 +784,7 @@ void sys_fileio_register()
tf_data.user_data = "$fflush";
vpi_register_systf(&tf_data);
//============================== fputc
/*============================== fputc */
tf_data.type = vpiSysTask;
tf_data.tfname = "$fputc";
tf_data.calltf = sys_fputc_calltf;
@ -784,7 +793,7 @@ void sys_fileio_register()
tf_data.user_data = "$fputc";
vpi_register_systf(&tf_data);
//============================== fgetc
/*============================== fgetc */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$fgetc";
@ -794,7 +803,7 @@ void sys_fileio_register()
tf_data.user_data = "$fgetc";
vpi_register_systf(&tf_data);
//============================== fgets
/*============================== fgets */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$fgets";
@ -804,7 +813,7 @@ void sys_fileio_register()
tf_data.user_data = "$fgets";
vpi_register_systf(&tf_data);
//============================== ungetc
/*============================== ungetc */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$ungetc";
@ -814,7 +823,7 @@ void sys_fileio_register()
tf_data.user_data = "$ungetc";
vpi_register_systf(&tf_data);
//============================== ftell
/*============================== ftell */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$ftell";
@ -824,7 +833,7 @@ void sys_fileio_register()
tf_data.user_data = "$ftell";
vpi_register_systf(&tf_data);
//============================== fseek
/*============================== fseek */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$fseek";
@ -834,7 +843,7 @@ void sys_fileio_register()
tf_data.user_data = "$fseek";
vpi_register_systf(&tf_data);
//============================== rewind
/*============================== rewind */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$rewind";
@ -845,7 +854,7 @@ void sys_fileio_register()
vpi_register_systf(&tf_data);
/* $feof() is from 1364-2005. */
//============================== feof
/*============================== feof */
tf_data.type = vpiSysFunc;
tf_data.sysfunctype = vpiIntFunc;
tf_data.tfname = "$feof";

View File

@ -202,7 +202,7 @@ struct vcd_names_list_s lxt_tab;
static int dumpvars_status = 0; /* 0:fresh 1:cb installed, 2:callback done */
static PLI_UINT64 dumpvars_time;
inline static int dump_header_pending(void)
__inline__ static int dump_header_pending(void)
{
return dumpvars_status != 2;
}
@ -312,7 +312,7 @@ static PLI_INT32 finish_cb(p_cb_data cause)
return 0;
}
inline static int install_dumpvars_callback(void)
__inline__ static int install_dumpvars_callback(void)
{
struct t_cb_data cb;
static struct t_vpi_time time;
@ -712,7 +712,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
/* This dumps all the modules in the design if none are given. */
if (!argv || !(item = vpi_scan(argv))) {
argv = vpi_iterate(vpiModule, 0x0);
assert(argv); // There must be at least one top level module.
assert(argv); /* There must be at least one top level module. */
item = vpi_scan(argv);
}

View File

@ -204,7 +204,7 @@ struct vcd_names_list_s lxt_tab;
static int dumpvars_status = 0; /* 0:fresh 1:cb installed, 2:callback done */
static PLI_UINT64 dumpvars_time;
inline static int dump_header_pending(void)
__inline__ static int dump_header_pending(void)
{
return dumpvars_status != 2;
}
@ -311,7 +311,7 @@ static PLI_INT32 finish_cb(p_cb_data cause)
return 0;
}
inline static int install_dumpvars_callback(void)
__inline__ static int install_dumpvars_callback(void)
{
struct t_cb_data cb;
static struct t_vpi_time time;
@ -724,7 +724,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
/* This dumps all the modules in the design if none are given. */
if (!argv || !(item = vpi_scan(argv))) {
argv = vpi_iterate(vpiModule, 0x0);
assert(argv); // There must be at least one top level module.
assert(argv); /* There must be at least one top level module. */
item = vpi_scan(argv);
}

View File

@ -41,9 +41,10 @@ PLI_UINT64 timerec_to_time64(const struct t_vpi_time*time)
*/
unsigned is_constant_obj(vpiHandle obj)
{
assert(obj);
unsigned rtn = 0;
assert(obj);
switch(vpi_get(vpiType, obj)) {
case vpiConstant:
case vpiParameter:
@ -60,9 +61,10 @@ unsigned is_constant_obj(vpiHandle obj)
*/
unsigned is_numeric_obj(vpiHandle obj)
{
assert(obj);
unsigned rtn = 0;
assert(obj);
switch(vpi_get(vpiType, obj)) {
case vpiConstant:
case vpiParameter:
@ -92,9 +94,10 @@ unsigned is_numeric_obj(vpiHandle obj)
*/
unsigned is_string_obj(vpiHandle obj)
{
assert(obj);
unsigned rtn = 0;
assert(obj);
switch(vpi_get(vpiType, obj)) {
case vpiConstant:
case vpiParameter: {
@ -147,11 +150,13 @@ PLI_INT32 sys_no_arg_compiletf(PLI_BYTE8 *name)
/* Make sure there are no arguments. */
if (argv != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 0;
argc = 0;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s does not take an argument.\n", msg, name);
@ -188,11 +193,13 @@ PLI_INT32 sys_one_numeric_arg_compiletf(PLI_BYTE8 *name)
/* Make sure there are no extra arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s takes a single numeric argument.\n", msg, name);
@ -223,11 +230,13 @@ PLI_INT32 sys_one_opt_numeric_arg_compiletf(PLI_BYTE8 *name)
/* Make sure there are no extra arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s takes at most one numeric argument.\n",
@ -282,11 +291,13 @@ PLI_INT32 sys_two_numeric_args_compiletf(PLI_BYTE8 *name)
/* Make sure there are no extra arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s takes two numeric arguments.\n", msg, name);
@ -322,11 +333,13 @@ PLI_INT32 sys_one_string_arg_compiletf(PLI_BYTE8 *name)
/* Make sure there are no extra arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s %s takes a single string argument.\n", msg, name);

View File

@ -43,7 +43,7 @@ static struct context_s global_context = {
#if defined(__GCC__)
.mti =
#else
// For MSVC simply use the fact that mti is located first
/* For MSVC simply use the fact that mti is located first */
#endif
NP1 };

View File

@ -46,7 +46,7 @@ static int byte_getc(struct byte_source*byte)
}
ch = fgetc(byte->fd);
// fprintf(stderr, "byte_getc --> '%c' (%d)\n", ch, ch);
/* fprintf(stderr, "byte_getc --> '%c' (%d)\n", ch, ch); */
return ch;
}
@ -594,7 +594,7 @@ void sys_scanf_register()
{
s_vpi_systf_data tf_data;
//============================== fscanf
/*============================== fscanf */
tf_data.type = vpiSysFunc;
tf_data.tfname = "$fscanf";
tf_data.calltf = sys_fscanf_calltf;
@ -603,7 +603,7 @@ void sys_scanf_register()
tf_data.user_data = "$fscanf";
vpi_register_systf(&tf_data);
//============================== sscanf
/*============================== sscanf */
tf_data.type = vpiSysFunc;
tf_data.tfname = "$sscanf";
tf_data.calltf = sys_sscanf_calltf;

View File

@ -127,6 +127,7 @@ static const char*edge_str(int vpi_edge)
void sdf_iopath_delays(int vpi_edge, const char*src, const char*dst,
const struct sdf_delval_list_s*delval_list)
{
s_vpi_delay delays;
if (sdf_cur_cell == 0)
return;
@ -140,7 +141,6 @@ void sdf_iopath_delays(int vpi_edge, const char*src, const char*dst,
delay_vals[idx].real = delval_list->val[idx];
}
s_vpi_delay delays;
delays.da = delay_vals;
delays.no_of_delays = delval_list->count;
delays.time_type = vpiScaledRealTime;

View File

@ -144,7 +144,7 @@ struct vcd_names_list_s vcd_var = { 0 };
static int dumpvars_status = 0; /* 0:fresh 1:cb installed, 2:callback done */
static PLI_UINT64 dumpvars_time;
inline static int dump_header_pending(void)
__inline__ static int dump_header_pending(void)
{
return dumpvars_status != 2;
}
@ -258,7 +258,7 @@ static PLI_INT32 finish_cb(p_cb_data cause)
return 0;
}
inline static int install_dumpvars_callback(void)
__inline__ static int install_dumpvars_callback(void)
{
struct t_cb_data cb;
static struct t_vpi_time time;
@ -714,13 +714,14 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
/* This dumps all the modules in the design if none are given. */
if (!argv || !(item = vpi_scan(argv))) {
argv = vpi_iterate(vpiModule, 0x0);
assert(argv); // There must be at least one top level module.
assert(argv); /* There must be at least one top level module. */
item = vpi_scan(argv);
}
for ( ; item; item = vpi_scan(argv)) {
const char *scname;
int add_var = 0;
int dep;
vcd_names_sort(&vcd_tab);
@ -744,7 +745,7 @@ static PLI_INT32 sys_dumpvars_calltf(PLI_BYTE8*name)
}
}
int dep = draw_scope(item, callh);
dep = draw_scope(item, callh);
scan_item(depth, item, 0);

View File

@ -131,15 +131,19 @@ vpiHandle va_process_argument(vpiHandle callh, const char *name,
*/
static PLI_INT32 va_single_argument_compiletf(PLI_BYTE8 *ud)
{
assert(ud != 0);
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle arg;
t_single_data *data = (t_single_data *) ud;
const char *name = data->name;
vpiHandle callh, argv, arg;
t_single_data *data;
const char *name;
va_single_t* fun_data;
va_single_t* fun_data = malloc(sizeof(va_single_t));
assert(ud != 0);
callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
argv = vpi_iterate(vpiArgument, callh);
data = (t_single_data *) ud;
name = data->name;
fun_data = malloc(sizeof(va_single_t));
/* Check that malloc gave use some memory. */
if (fun_data == 0) {
@ -180,10 +184,12 @@ static PLI_INT32 va_single_argument_calltf(PLI_BYTE8 *ud)
{
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
s_vpi_value val;
va_single_t* fun_data;
(void) ud; /* Not used! */
/* Retrieve the function and argument data. */
va_single_t* fun_data = vpi_get_userdata(callh);
fun_data = vpi_get_userdata(callh);
/* Calculate the result */
val.format = vpiRealVal;
@ -202,15 +208,19 @@ static PLI_INT32 va_single_argument_calltf(PLI_BYTE8 *ud)
*/
static PLI_INT32 va_double_argument_compiletf(PLI_BYTE8 *ud)
{
assert(ud != 0);
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle arg;
t_double_data *data = (t_double_data *) ud;
const char *name = data->name;
vpiHandle callh, argv, arg;
t_double_data *data;
const char *name;
va_double_t* fun_data;
va_double_t* fun_data = malloc(sizeof(va_double_t));
assert(ud != 0);
callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
argv = vpi_iterate(vpiArgument, callh);
data = (t_double_data *) ud;
name = data->name;
fun_data = malloc(sizeof(va_double_t));
/* Check that malloc gave use some memory. */
if (fun_data == 0) {
@ -259,10 +269,12 @@ static PLI_INT32 va_double_argument_calltf(PLI_BYTE8 *ud)
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
s_vpi_value val;
double first_arg;
va_double_t* fun_data;
(void) ud; /* Not used! */
/* Retrieve the function and argument data. */
va_double_t* fun_data = vpi_get_userdata(callh);
fun_data = vpi_get_userdata(callh);
/* Calculate the result */
val.format = vpiRealVal;

View File

@ -163,15 +163,19 @@ vpiHandle va_process_argument(vpiHandle callh, const char *name,
*/
static PLI_INT32 va_single_argument_compiletf(PLI_BYTE8 *ud)
{
assert(ud != 0);
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle arg;
t_single_data *data = (t_single_data *) ud;
const char *name = data->name;
vpiHandle callh, argv, arg;
t_single_data *data;
const char *name;
va_single_t* fun_data;
va_single_t* fun_data = malloc(sizeof(va_single_t));
assert(ud != 0);
callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
argv = vpi_iterate(vpiArgument, callh);
data = (t_single_data *) ud;
name = data->name;
fun_data = malloc(sizeof(va_single_t));
/* Check that malloc gave use some memory. */
if (fun_data == 0) {
@ -212,10 +216,12 @@ static PLI_INT32 va_single_argument_calltf(PLI_BYTE8 *ud)
{
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
s_vpi_value val;
va_single_t* fun_data;
(void) ud; /* Not used! */
/* Retrieve the function and argument data. */
va_single_t* fun_data = vpi_get_userdata(callh);
fun_data = vpi_get_userdata(callh);
/* Calculate the result */
val.format = vpiRealVal;
@ -234,15 +240,19 @@ static PLI_INT32 va_single_argument_calltf(PLI_BYTE8 *ud)
*/
static PLI_INT32 va_double_argument_compiletf(PLI_BYTE8 *ud)
{
assert(ud != 0);
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle arg;
t_double_data *data = (t_double_data *) ud;
const char *name = data->name;
vpiHandle callh, argv, arg;
t_double_data *data;
const char *name;
va_double_t* fun_data;
va_double_t* fun_data = malloc(sizeof(va_double_t));
assert(ud != 0);
callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
argv = vpi_iterate(vpiArgument, callh);
data = (t_double_data *) ud;
name = data->name;
fun_data = malloc(sizeof(va_double_t));
/* Check that malloc gave use some memory. */
if (fun_data == 0) {
@ -291,10 +301,12 @@ static PLI_INT32 va_double_argument_calltf(PLI_BYTE8 *ud)
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
s_vpi_value val;
double first_arg;
va_double_t* fun_data;
(void) ud; /* Not used! */
/* Retrieve the function and argument data. */
va_double_t* fun_data = vpi_get_userdata(callh);
fun_data = vpi_get_userdata(callh);
/* Calculate the result */
val.format = vpiRealVal;

View File

@ -36,10 +36,11 @@
*/
static PLI_INT32 simparam_compiletf(PLI_BYTE8 *name_ext)
{
vpiHandle callh = vpi_handle(vpiSysTfCall, 0);
vpiHandle callh, argv, arg;
callh = vpi_handle(vpiSysTfCall, 0);
assert(callh != 0);
vpiHandle argv = vpi_iterate(vpiArgument, callh);
vpiHandle arg;
argv = vpi_iterate(vpiArgument, callh);
/* We must have at least one argument. */
if (argv == 0) {
@ -87,11 +88,13 @@ static PLI_INT32 simparam_compiletf(PLI_BYTE8 *name_ext)
/* We can have a maximum of two arguments. */
if (vpi_scan(argv) != 0) {
char msg [64];
unsigned argc;
snprintf(msg, 64, "ERROR: %s line %d:",
vpi_get_str(vpiFile, callh),
(int)vpi_get(vpiLineNo, callh));
unsigned argc = 1;
argc = 1;
while (vpi_scan(argv)) argc += 1;
vpi_printf("%s $simparam%s takes at most two arguments.\n",
@ -250,7 +253,7 @@ static PLI_INT32 simparam_str_sizetf(PLI_BYTE8 *name_ext)
{
(void) name_ext; /* Not used! */
return MAX_STRING_RESULT; // 128 characters max!
return MAX_STRING_RESULT; /* 128 characters max! */
}
/*

View File

@ -143,7 +143,7 @@ struct vcd_id_s
int nex;
};
static inline unsigned ihash(int nex)
static __inline__ unsigned ihash(int nex)
{
unsigned a = nex;
a ^= a>>16;

View File

@ -32,4 +32,4 @@
# define _FILE_OFFSET_BITS 64
#endif
#endif // __config_H
#endif /* __config_H */

View File

@ -275,8 +275,8 @@ class resolv_list_s {
const char*label() const { return label_; }
private:
friend void ::resolv_submit(struct resolv_list_s*cur);
friend void ::compile_cleanup(void);
friend void resolv_submit(struct resolv_list_s*cur);
friend void compile_cleanup(void);
char*label_;
struct resolv_list_s*next;

View File

@ -2,6 +2,19 @@ AC_INIT(Makefile.in)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
#######################
## test for underscores. The vpi module loader in vvm needs to know this
## in order to know the name of the start symbol for the .vpi module.
#######################
AX_C_UNDERSCORES_LEADING
AX_C_UNDERSCORES_TRAILING
#######################
## end of test for underscores
#######################
AC_PROG_CXX
AC_PROG_RANLIB
AC_CHECK_TOOL(STRIP, strip, true)
@ -90,18 +103,6 @@ AX_LD_RDYNAMIC
AX_LD_EXTRALIBS
#######################
## test for underscores. The vpi module loader in vvm needs to know this
## in order to know the name of the start symbol for the .vpi module.
#######################
AX_C_UNDERSCORES_LEADING
AX_C_UNDERSCORES_TRAILING
#######################
## end of test for underscores
#######################
AX_CPP_IDENT
# If not otherwise specified, set the libdir64 variable

View File

@ -219,7 +219,7 @@ int main(int argc, char*argv[])
to the vvp debug file. Open it for output. */
if (char*path = getenv("VVP_DEBUG")) {
debug_file.open(path, ios_base::out);
debug_file.open(path, ios::out);
}
design_path = argv[optind];

View File

@ -130,7 +130,7 @@ header_line
;
footer_lines
: K_file_names T_NUMBER ';' { file_names.reserve($2) }
: K_file_names T_NUMBER ';' { file_names.reserve($2); }
name_strings
name_strings