diff --git a/libveriuser/mc_scan_plusargs.c b/libveriuser/mc_scan_plusargs.c index 59ea48a70..965050740 100644 --- a/libveriuser/mc_scan_plusargs.c +++ b/libveriuser/mc_scan_plusargs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2002-2013 Michael Ruff (mruff at chiaro.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -27,7 +27,7 @@ char *mc_scan_plusargs(char *plusarg) { int argc, diff; - char **argv, *a, *p; + char **argv; s_vpi_vlog_info vpi_vlog_info; /* get command line */ @@ -37,6 +37,7 @@ char *mc_scan_plusargs(char *plusarg) /* for each argument */ argv = vpi_vlog_info.argv; for (argc = 0; argc < vpi_vlog_info.argc; argc++, argv++) { + char *a, *p; a = *argv; p = plusarg; diff --git a/libveriuser/veriusertfs.c b/libveriuser/veriusertfs.c index 114dcf45d..cf7b156a7 100644 --- a/libveriuser/veriusertfs.c +++ b/libveriuser/veriusertfs.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2012 Michael Ruff (mruff at chiaro.com) + * Copyright (c) 2002-2013 Michael Ruff (mruff at chiaro.com) * Michael Runyan (mrunyan at chiaro.com) * * This source code is free software; you can redistribute it @@ -78,9 +78,9 @@ void veriusertfs_register_table(p_tfcell vtable) p_tfcell tf; s_vpi_systf_data tf_data; p_pli_data data; - static char trace_buf[1024]; if (!pli_trace && (path = getenv("PLI_TRACE"))) { + static char trace_buf[1024]; if (strcmp(path,"-") == 0) pli_trace = stdout; else { diff --git a/parse.y b/parse.y index 88f8dcbef..53cf517a0 100644 --- a/parse.y +++ b/parse.y @@ -1866,6 +1866,10 @@ tf_port_list /* IEEE1800-2005: A.2.7 */ timeunits_declaration /* IEEE1800-2005: A.1.2 */ : K_timeunit TIME_LITERAL ';' { pform_set_timeunit($2, false, false); } + | K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' + { pform_set_timeunit($2, false, false); + pform_set_timeprecision($4, false, false); + } | K_timeprecision TIME_LITERAL ';' { pform_set_timeprecision($2, false, false); } ; @@ -3921,14 +3925,20 @@ cont_assign_list /* We allow zero, one or two unique declarations. */ local_timeunit_prec_decl_opt : /* Empty */ - | local_timeunit_prec_decl - | local_timeunit_prec_decl local_timeunit_prec_decl + | K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' + { pform_set_timeunit($2, true, false); + have_timeunit_decl = true; + pform_set_timeprecision($4, true, false); + have_timeprec_decl = true; + } + | local_timeunit_prec_decl + | local_timeunit_prec_decl local_timeunit_prec_decl2 ; /* By setting the appropriate have_time???_decl we allow only one declaration of each type in this module. */ local_timeunit_prec_decl - : K_timeunit TIME_LITERAL ';' + : K_timeunit TIME_LITERAL ';' { pform_set_timeunit($2, true, false); have_timeunit_decl = true; } @@ -3937,6 +3947,21 @@ local_timeunit_prec_decl have_timeprec_decl = true; } ; +local_timeunit_prec_decl2 + : K_timeunit TIME_LITERAL ';' + { pform_set_timeunit($2, true, false); + have_timeunit_decl = true; + } + | K_timeprecision TIME_LITERAL ';' + { pform_set_timeprecision($2, true, false); + have_timeprec_decl = true; + } + /* As the second item this form is always a check. */ + | K_timeunit TIME_LITERAL '/' TIME_LITERAL ';' + { pform_set_timeunit($2, true, true); + pform_set_timeprecision($4, true, true); + } + ; /* This is the global structure of a module. A module in a start section, with optional ports, then an optional list of module @@ -4440,6 +4465,10 @@ module_item | K_timeunit_check TIME_LITERAL ';' { pform_set_timeunit($2, true, true); } + | K_timeunit_check TIME_LITERAL '/' TIME_LITERAL ';' + { pform_set_timeunit($2, true, true); + pform_set_timeprecision($4, true, true); + } | K_timeprecision_check TIME_LITERAL ';' { pform_set_timeprecision($2, true, true); } ; diff --git a/tgt-vlog95/scope.c b/tgt-vlog95/scope.c index 37b6ae685..bf54eaaf8 100644 --- a/tgt-vlog95/scope.c +++ b/tgt-vlog95/scope.c @@ -830,7 +830,7 @@ int emit_scope(ivl_scope_t scope, ivl_scope_t parent) char *package_name = 0; ivl_scope_type_t sc_type = ivl_scope_type(scope); unsigned is_auto = ivl_scope_is_auto(scope); - unsigned idx, count; + unsigned idx; /* Output the scope definition. */ switch (sc_type) { @@ -957,6 +957,7 @@ int emit_scope(ivl_scope_t scope, ivl_scope_t parent) emit_scope_variables(scope); if (sc_type == IVL_SCT_MODULE) { + unsigned count; /* Output the LPM devices. */ count = ivl_scope_lpms(scope); for (idx = 0; idx < count; idx += 1) { diff --git a/tgt-vvp/eval_expr.c b/tgt-vvp/eval_expr.c index f965a75f8..11d5fdd44 100644 --- a/tgt-vvp/eval_expr.c +++ b/tgt-vvp/eval_expr.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -121,7 +121,6 @@ int number_is_immediate(ivl_expr_t expr, unsigned lim_wid, int negative_ok_flag) long get_number_immediate(ivl_expr_t expr) { long imm = 0; - unsigned idx; switch (ivl_expr_type(expr)) { case IVL_EX_ULONG: @@ -131,6 +130,7 @@ long get_number_immediate(ivl_expr_t expr) case IVL_EX_NUMBER: { const char*bits = ivl_expr_bits(expr); unsigned nbits = ivl_expr_width(expr); + unsigned idx; /* We can not copy more bits than fit into a long. */ if (nbits > 8*sizeof(long)) nbits = 8*sizeof(long); for (idx = 0 ; idx < nbits ; idx += 1) switch (bits[idx]){ @@ -157,7 +157,6 @@ long get_number_immediate(ivl_expr_t expr) uint64_t get_number_immediate64(ivl_expr_t expr) { uint64_t imm = 0; - unsigned idx; switch (ivl_expr_type(expr)) { case IVL_EX_ULONG: @@ -167,6 +166,7 @@ uint64_t get_number_immediate64(ivl_expr_t expr) case IVL_EX_NUMBER: { const char*bits = ivl_expr_bits(expr); unsigned nbits = ivl_expr_width(expr); + unsigned idx; for (idx = 0 ; idx < nbits ; idx += 1) switch (bits[idx]){ case '0': break; diff --git a/tgt-vvp/stmt_assign.c b/tgt-vvp/stmt_assign.c index cf61c32cc..6faaa5efd 100644 --- a/tgt-vvp/stmt_assign.c +++ b/tgt-vvp/stmt_assign.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011,2013 Stephen Williams (steve@icarus.com) + * Copyright (c) 2011-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -482,8 +482,6 @@ static void set_vec_to_lval_slice(ivl_lval_t lval, unsigned bit, unsigned wid) */ static void set_vec_to_lval(ivl_statement_t net, struct vector_info res) { - ivl_lval_t lval; - unsigned wid = res.wid; unsigned lidx; unsigned cur_rbit = 0; @@ -492,7 +490,7 @@ static void set_vec_to_lval(ivl_statement_t net, struct vector_info res) unsigned bidx; unsigned bit_limit = wid - cur_rbit; - lval = ivl_stmt_lval(net, lidx); + ivl_lval_t lval = ivl_stmt_lval(net, lidx); /* Reduce bit_limit to the width of this l-value. */ if (bit_limit > ivl_lval_width(lval)) diff --git a/tgt-vvp/vvp_process.c b/tgt-vvp/vvp_process.c index e352fcccf..07e878354 100644 --- a/tgt-vvp/vvp_process.c +++ b/tgt-vvp/vvp_process.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -2037,7 +2037,6 @@ static int show_statement(ivl_statement_t net, ivl_scope_t sscope) { const ivl_statement_type_t code = ivl_statement_type(net); int rc = 0; - unsigned saved_file_line = 0; switch (code) { @@ -2057,6 +2056,7 @@ static int show_statement(ivl_statement_t net, ivl_scope_t sscope) if (ivl_stmt_block_scope(net)) rc += show_stmt_block_named(net, sscope); else { + unsigned saved_file_line = 0; /* This block could really represent a single statement. * If so only emit a single %file_line opcode. */ if (show_file_line) { diff --git a/vpi/cppcheck.sup b/vpi/cppcheck.sup index 0ec47e24c..8bf16a13f 100644 --- a/vpi/cppcheck.sup +++ b/vpi/cppcheck.sup @@ -4,34 +4,63 @@ // fstapi.c from GTKWave obsoleteFunctionsasctime:fstapi.c:652 +variableScope:fstapi.c:751 variableScope:fstapi.c:1707 variableScope:fstapi.c:1965 variableScope:fstapi.c:2109 variableScope:fstapi.c:2268 variableScope:fstapi.c:2269 +variableScope:fstapi.c:2828 +variableScope:fstapi.c:2853 variableScope:fstapi.c:2976 variableScope:fstapi.c:3304 variableScope:fstapi.c:3313 -variableScope:fstapi.c:4982 +variableScope:fstapi.c:3820 +variableScope:fstapi.c:3823 +variableScope:fstapi.c:4390 +variableScope:fstapi.c:4444 +variableScope:fstapi.c:4748 +variableScope:fstapi.c:4751 +variableScope:fstapi.c:4987 +variableScope:fstapi.c:5093 +variableScope:fstapi.c:5092 +variableScope:fstapi.c:5124 // lxt2_write.c from GTKWave obsoleteFunctionsalloca:lxt2_write.c:1813 obsoleteFunctionsalloca:lxt2_write.c:1819 +variableScope:lxt2_write.c:33 variableScope:lxt2_write.c:63 +variableScope:lxt2_write.c:196 +variableScope:lxt2_write.c:463 +variableScope:lxt2_write.c:464 variableScope:lxt2_write.c:523 variableScope:lxt2_write.c:581 variableScope:lxt2_write.c:587 +variableScope:lxt2_write.c:1157 variableScope:lxt2_write.c:1613 variableScope:lxt2_write.c:2060 // lxt_write.c from GTKWave variableScope:lxt_write.c:31 +variableScope:lxt_write.c:83 +variableScope:lxt_write.c:527 +variableScope:lxt_write.c:528 variableScope:lxt_write.c:587 variableScope:lxt_write.c:640 +variableScope:lxt_write.c:780 +variableScope:lxt_write.c:880 variableScope:lxt_write.c:1056 variableScope:lxt_write.c:1057 variableScope:lxt_write.c:1058 +variableScope:lxt_write.c:1194 variableScope:lxt_write.c:1850 +variableScope:lxt_write.c:2029 +variableScope:lxt_write.c:2030 +variableScope:lxt_write.c:2147 +variableScope:lxt_write.c:2148 +variableScope:lxt_write.c:2265 +variableScope:lxt_write.c:2266 variableScope:lxt_write.c:2595 variableScope:lxt_write.c:2596 variableScope:lxt_write.c:2597 diff --git a/vpi/fstapi.c b/vpi/fstapi.c index f4f6611b3..cf5959745 100644 --- a/vpi/fstapi.c +++ b/vpi/fstapi.c @@ -3399,6 +3399,11 @@ if(gzread_pass_status) { break; } + + if((hdr_incomplete) && (!seclen)) + { + break; + } if(!hdr_seen && (sectype != FST_BL_HDR)) { diff --git a/vpi/mt19937int.c b/vpi/mt19937int.c index ef480c690..ac6fe01e0 100644 --- a/vpi/mt19937int.c +++ b/vpi/mt19937int.c @@ -1,4 +1,3 @@ - /* * NOTE: This code as been slightly modified to interface with the * PLI implementations of $random. The copyright and license @@ -84,13 +83,13 @@ unsigned long genrand(struct context_s *context) { unsigned long y; - static unsigned long mag01[2]={0x0, MATRIX_A}; - /* mag01[x] = x * MATRIX_A for x=0,1 */ unsigned long *mt = context->mt; int mti = context->mti; if (mti >= N) { /* generate N words at one time */ + /* mag01[x] = x * MATRIX_A for x=0,1 */ + static unsigned long mag01[2]={0x0, MATRIX_A}; int kk; if (mti == N+1) /* if sgenrand() has not been called, */ @@ -120,4 +119,3 @@ genrand(struct context_s *context) return y; } - diff --git a/vpi/sys_fileio.c b/vpi/sys_fileio.c index 5feaa6699..b503d4f81 100644 --- a/vpi/sys_fileio.c +++ b/vpi/sys_fileio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -535,12 +535,10 @@ static PLI_INT32 sys_fread_compiletf(ICARUS_VPI_CONST PLI_BYTE8*name) static unsigned fread_word(FILE *fp, vpiHandle word, unsigned words, unsigned bpe, s_vpi_vecval *vector) { - unsigned rtn, clr_mask, bnum; - int bidx, byte; + int bidx; s_vpi_value val; struct t_vpi_vecval *cur = &vector[words-1]; - - rtn = 0; + unsigned rtn = 0; /* Get the current bits from the register and copy them to * my local vector. */ @@ -553,7 +551,8 @@ static unsigned fread_word(FILE *fp, vpiHandle word, /* Copy the bytes to the local vector MSByte first. */ for (bidx = bpe-1; bidx >= 0; bidx -= 1) { - byte = fgetc(fp); + unsigned clr_mask, bnum; + int byte = fgetc(fp); if (byte == EOF) break; /* Clear the current byte and load the new value. */ bnum = bidx % 4; diff --git a/vpi/sys_fst.c b/vpi/sys_fst.c index 67fcce1d9..916c5847c 100644 --- a/vpi/sys_fst.c +++ b/vpi/sys_fst.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -479,24 +479,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) unsigned size; PLI_INT32 item_type; - /* list of types to iterate upon */ - int i; - static int types[] = { - /* Value */ - vpiNamedEvent, - vpiNet, -// vpiParameter, - vpiReg, - vpiVariables, - /* Scope */ - vpiFunction, - vpiModule, - vpiNamedBegin, - vpiNamedFork, - vpiTask, - -1 - }; - /* Get the displayed type for the various $var and $scope types. */ /* Not all of these are supported now, but they should be in a * future development version. */ @@ -667,8 +649,25 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) case vpiNamedFork: if (depth > 0) { - int nskip = (vcd_names_search(&fst_tab, fullname) != 0); char *defname = NULL; + /* list of types to iterate upon */ + static int types[] = { + /* Value */ + vpiNamedEvent, + vpiNet, + /* vpiParameter, */ + vpiReg, + vpiVariables, + /* Scope */ + vpiFunction, + vpiModule, + vpiNamedBegin, + vpiNamedFork, + vpiTask, + -1 + }; + int i; + int nskip = (vcd_names_search(&fst_tab, fullname) != 0); /* We have to always scan the scope because the * depth could be different for this call. */ diff --git a/vpi/sys_lxt.c b/vpi/sys_lxt.c index 19785944f..06692c0f6 100644 --- a/vpi/sys_lxt.c +++ b/vpi/sys_lxt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2011 Stephen Williams (steve@icarus.com) + * Copyright (c) 2002-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -528,22 +528,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) const char* ident; int nexus_id; - /* list of types to iterate upon */ - int i; - static int types[] = { - /* Value */ - vpiNet, - vpiReg, - vpiVariables, - /* Scope */ - vpiFunction, - vpiModule, - vpiNamedBegin, - vpiNamedFork, - vpiTask, - -1 - }; - switch (vpi_get(vpiType, item)) { case vpiMemoryWord: @@ -662,23 +646,37 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) case vpiNamedFork: if (depth > 0) { - int nskip; - vpiHandle argv; - - const char* fullname = - vpi_get_str(vpiFullName, item); + const char* fullname = vpi_get_str(vpiFullName, item); + /* list of types to iterate upon */ + static int types[] = { + /* Value */ + /* vpiNamedEvent, */ + vpiNet, + /* vpiParameter, */ + vpiReg, + vpiVariables, + /* Scope */ + vpiFunction, + vpiModule, + vpiNamedBegin, + vpiNamedFork, + vpiTask, + -1 + }; + int i; + int nskip = (vcd_names_search(&lxt_tab, fullname) != 0); #if 0 vpi_printf("LXT info: scanning scope %s, %u levels\n", fullname, depth); #endif - nskip = 0 != vcd_names_search(&lxt_tab, fullname); - if (!nskip) + if (nskip) { + vpi_printf("LXT warning: ignoring signals in " + "previously scanned scope %s\n", fullname); + } else { vcd_names_add(&lxt_tab, fullname); - else - vpi_printf("LXT warning: ignoring signals in " - "previously scanned scope %s\n", fullname); + } name = vpi_get_str(vpiName, item); @@ -686,7 +684,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) for (i=0; types[i]>0; i++) { vpiHandle hand; - argv = vpi_iterate(types[i], item); + vpiHandle argv = vpi_iterate(types[i], item); while (argv && (hand = vpi_scan(argv))) { scan_item(depth-1, hand, nskip); } diff --git a/vpi/sys_lxt2.c b/vpi/sys_lxt2.c index 57e0550ca..1643d1e6a 100644 --- a/vpi/sys_lxt2.c +++ b/vpi/sys_lxt2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2011 Stephen Williams (steve@icarus.com) + * Copyright (c) 2003-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -591,22 +591,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) const char* ident; int nexus_id; - /* list of types to iterate upon */ - int i; - static int types[] = { - /* Value */ - vpiNet, - vpiReg, - vpiVariables, - /* Scope */ - vpiFunction, - vpiModule, - vpiNamedBegin, - vpiNamedFork, - vpiTask, - -1 - }; - switch (vpi_get(vpiType, item)) { case vpiMemoryWord: @@ -717,23 +701,37 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) case vpiNamedFork: if (depth > 0) { - int nskip; - vpiHandle argv; - - const char* fullname = - vpi_get_str(vpiFullName, item); + const char* fullname = vpi_get_str(vpiFullName, item); + /* list of types to iterate upon */ + static int types[] = { + /* Value */ + /* vpiNamedEvent, */ + vpiNet, + /* vpiParameter, */ + vpiReg, + vpiVariables, + /* Scope */ + vpiFunction, + vpiModule, + vpiNamedBegin, + vpiNamedFork, + vpiTask, + -1 + }; + int i; + int nskip = vcd_scope_names_test(fullname); #if 0 vpi_printf("LXT2 info: scanning scope %s, %u levels\n", fullname, depth); #endif - nskip = vcd_scope_names_test(fullname); - if (!nskip) + if (nskip) { + vpi_printf("LXT2 warning: ignoring signals in " + "previously scanned scope %s\n", fullname); + } else { vcd_scope_names_add(fullname); - else - vpi_printf("LXT2 warning: ignoring signals in " - "previously scanned scope %s\n", fullname); + } name = vpi_get_str(vpiName, item); @@ -741,7 +739,7 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) for (i=0; types[i]>0; i++) { vpiHandle hand; - argv = vpi_iterate(types[i], item); + vpiHandle argv = vpi_iterate(types[i], item); while (argv && (hand = vpi_scan(argv))) { scan_item(depth-1, hand, nskip); } diff --git a/vpi/sys_scanf.c b/vpi/sys_scanf.c index d4b45bab3..f9e500fcd 100644 --- a/vpi/sys_scanf.c +++ b/vpi/sys_scanf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2012 Stephen Williams (steve@icarus.com) + * Copyright (c) 2006-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -469,7 +469,6 @@ static int scan_format_decimal(vpiHandle callh, vpiHandle argv, { vpiHandle arg; char *strval = malloc(1); - unsigned len = 0; s_vpi_value val; int ch; @@ -495,6 +494,7 @@ static int scan_format_decimal(vpiHandle callh, vpiHandle argv, strval[0] = 'z'; strval[1] = 0; } else { + unsigned len = 0; /* To match a + or - we must have a digit after it. */ if (ch == '+') { diff --git a/vpi/sys_vcd.c b/vpi/sys_vcd.c index 85b6739d4..f8d91a38a 100644 --- a/vpi/sys_vcd.c +++ b/vpi/sys_vcd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999-2011 Stephen Williams (steve@icarus.com) + * Copyright (c) 1999-2013 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -85,13 +85,14 @@ static void gen_new_vcd_id(void) static char *truncate_bitvec(char *s) { - char l, r; + char r; r=*s; if(r=='1') return s; else s += 1; for(;;s++) { + char l; l=r; r=*s; if(!r) return (s-1); if(l!=r) return(((l=='0')&&(r=='1'))?s:s-1); @@ -508,24 +509,6 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) unsigned size; PLI_INT32 item_type; - /* list of types to iterate upon */ - int i; - static int types[] = { - /* Value */ - vpiNamedEvent, - vpiNet, -// vpiParameter, - vpiReg, - vpiVariables, - /* Scope */ - vpiFunction, - vpiModule, - vpiNamedBegin, - vpiNamedFork, - vpiTask, - -1 - }; - /* Get the displayed type for the various $var and $scope types. */ /* Not all of these are supported now, but they should be in a * future development version. */ @@ -690,6 +673,23 @@ static void scan_item(unsigned depth, vpiHandle item, int skip) case vpiNamedFork: if (depth > 0) { + /* list of types to iterate upon */ + static int types[] = { + /* Value */ + vpiNamedEvent, + vpiNet, + /* vpiParameter, */ + vpiReg, + vpiVariables, + /* Scope */ + vpiFunction, + vpiModule, + vpiNamedBegin, + vpiNamedFork, + vpiTask, + -1 + }; + int i; int nskip = (vcd_names_search(&vcd_tab, fullname) != 0); /* We have to always scan the scope because the diff --git a/vvp/array.cc b/vvp/array.cc index a798c920d..8a7f1fed9 100644 --- a/vvp/array.cc +++ b/vvp/array.cc @@ -184,7 +184,6 @@ struct __vpiArrayVthrA : public __vpiHandle { case BIT4_Z: /* Return UINT_MAX to indicate an X base. */ return UINT_MAX; - break; case BIT4_1: tval |= 1<leaf_flag); + if (cur->parent) assert(! cur->parent->leaf_flag); - assert(!cur->leaf_flag); - if (cur->parent) assert(! cur->parent->leaf_flag); + while (cur->count == node_width) { + /* Create a new node to hold half the data from cur. */ + struct tree_node_ *new_node = new struct tree_node_; + new_node->leaf_flag = false; + new_node->count = cur->count / 2; + /* cur is not root; new_node becomes sibling. */ + if (cur->parent) new_node->parent = cur->parent; - while (cur->count == node_width) - { - /* Create a new node to hold half the data from cur. */ - new_node = new struct tree_node_; - new_node->leaf_flag = false; - new_node->count = cur->count / 2; - if (cur->parent) - /* cur is not root; new_node becomes sibling. */ - new_node->parent = cur->parent; + /* Move the last half of the data from the end of the old node + * to the beginning of the new node. At the same time, reduce + * the size of the old node. */ + unsigned idx1 = new_node->count; + unsigned idx2 = cur->count; + while (idx1 > 0) { + idx1 -= 1; + idx2 -= 1; + new_node->child[idx1] = cur->child[idx2]; + new_node->child[idx1]->parent = new_node; + cur->count -= 1; + } - /* Move the last half of the data from the end of the old node - to the beginning of the new node. At the same time, reduce - the size of the old node. */ - idx1 = new_node->count; - idx2 = cur->count; - while (idx1 > 0) { - idx1 -= 1; - idx2 -= 1; - new_node->child[idx1] = cur->child[idx2]; - new_node->child[idx1]->parent = new_node; - cur->count -= 1; - } + assert(new_node->count > 0); + assert(cur->count > 0); - assert(new_node->count > 0); - assert(cur->count > 0); + if (cur->parent == 0) { + /* cur is root. Move first half of children to another + * new node, and put the two new nodes in cur. The plan + * here is to make cur into the new root and split its + * contents into 2 children. */ - if (cur->parent == 0) { - /* cur is root. Move first half of children to - another new node, and put the two new nodes - in cur. The plan here is to make cur into - the new root and split its contents into 2 - children. */ + new_node->parent = cur; + struct tree_node_*new2_node = new struct tree_node_; + new2_node->leaf_flag = false; + new2_node->count = cur->count; + new2_node->parent = cur; + for (unsigned idx = 0; idx < cur->count; idx += 1) { + new2_node->child[idx] = cur->child[idx]; + new2_node->child[idx]->parent = new2_node; + } + cur->child[0] = new2_node; + cur->child[1] = new_node; + cur->count = 2; + /* no more ancestors, stop the while loop */ + break; + } - new_node->parent = cur; - struct tree_node_*new2_node = new struct tree_node_; - new2_node->leaf_flag = false; - new2_node->count = cur->count; - new2_node->parent = cur; - for (idx = 0; idx < cur->count; idx += 1) { - new2_node->child[idx] = cur->child[idx]; - new2_node->child[idx]->parent = new2_node; - } - cur->child[0] = new2_node; - cur->child[1] = new_node; - cur->count = 2; - /* no more ancestors, stop the while loop */ - break; - } + /* cur is not root. hook new_node to cur->parent. */ + unsigned idx = 0; + while (cur->parent->child[idx] != cur) { + assert(idx < cur->parent->count); + idx += 1; + } + idx += 1; - /* cur is not root. hook new_node to cur->parent. */ - idx = 0; - while (cur->parent->child[idx] != cur) { - assert(idx < cur->parent->count); - idx += 1; - } + for (unsigned tmp = cur->parent->count ; tmp > idx ; tmp -= 1) { + cur->parent->child[tmp] = cur->parent->child[tmp-1]; + } - idx += 1; + cur->parent->child[idx] = new_node; + cur->parent->count += 1; - for (tmp = cur->parent->count ; tmp > idx ; tmp -= 1) - cur->parent->child[tmp] = cur->parent->child[tmp-1]; - - cur->parent->child[idx] = new_node; - cur->parent->count += 1; - - /* check the ancestor */ - cur = cur->parent; - } + /* check the ancestor */ + cur = cur->parent; + } } /* diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 86fb6eba5..fc43da193 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -1149,7 +1149,6 @@ static int PV_get_base(struct __vpiPV*rfp) case BIT4_Z: /* We use INT_MIN to indicate an X base. */ return INT_MIN; - break; case BIT4_1: tval |= 1<