From 3ec8a867db4319b197c30a6f32d18e470e69aac2 Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Tue, 24 Jun 2008 08:46:16 -0700 Subject: [PATCH 1/6] Spelling fixes comments, documentation, a variable name, and a couple of messages --- elaborate.cc | 4 ++-- scripts/CREATE_VERSION.sh | 2 +- t-dll.cc | 2 +- tgt-fpga/iverilog-fpga.man | 2 +- vvp/README.txt | 2 +- vvp/npmos.h | 2 +- vvp/opcodes.txt | 2 +- vvp/schedule.cc | 2 +- vvp/vvp_island.cc | 6 +++--- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/elaborate.cc b/elaborate.cc index a0d8d73a0..4c7df215b 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -1158,7 +1158,7 @@ void PGModule::elaborate_mod_(Design*des, Module*rmod, NetScope*scope) const /* Input to module. elaborate the expression to the desired width. If this in an instance - array, then let the net determine it's own + array, then let the net determine its own width. We use that, then, to decide how to hook it up. @@ -2954,7 +2954,7 @@ NetForce* PForce::elaborate(Design*des, NetScope*scope) const dev = new NetForce(lval, rexp); if (debug_elaborate) { - cerr << get_fileline() << ": debug: ELaborate force," + cerr << get_fileline() << ": debug: Elaborate force," << " lval width=" << lval->lwidth() << " rval width=" << rexp->expr_width() << " rval=" << *rexp diff --git a/scripts/CREATE_VERSION.sh b/scripts/CREATE_VERSION.sh index 2cbec4707..ac018e4a0 100644 --- a/scripts/CREATE_VERSION.sh +++ b/scripts/CREATE_VERSION.sh @@ -8,6 +8,6 @@ # sh scripts/CREATE_VERSION.sh # -echo "Building verion.h with git describe" +echo "Building version.h with git describe" tmp=`git describe | sed -e 's;\(.*\);#define VERSION_TAG "\1";'` echo "$tmp" > version.h diff --git a/t-dll.cc b/t-dll.cc index 5b6a22a52..0d9380ac4 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -1946,7 +1946,7 @@ void dll_target::lpm_mux(const NetMux*net) { ivl_lpm_t obj = new struct ivl_lpm_s; obj->type = IVL_LPM_MUX; - obj->name = net->name(); // The NetMux perallocates its name. + obj->name = net->name(); // The NetMux permallocates its name. obj->scope = find_scope(des_, net->scope()); assert(obj->scope); diff --git a/tgt-fpga/iverilog-fpga.man b/tgt-fpga/iverilog-fpga.man index 608077d81..a9f263a9c 100644 --- a/tgt-fpga/iverilog-fpga.man +++ b/tgt-fpga/iverilog-fpga.man @@ -160,7 +160,7 @@ device pins are connected. .SH EXAMPLES .TB 8 -.I COMPILING WITH XILINX FOUNDATION/iSE +.I COMPILING WITH XILINX FOUNDATION/ISE Compile a single-file design with command line tools like so: .nf diff --git a/vvp/README.txt b/vvp/README.txt index cdd51086f..188f58e36 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -802,7 +802,7 @@ syntax is: The is the label for a variable array, and the is the canonical word index as an unsigned integer. The second form -retrives the index from thread space ( bits starting at ). +retrieves the index from thread space ( bits starting at ). * The &PV<> argument diff --git a/vvp/npmos.h b/vvp/npmos.h index 0f938b382..dc97b7290 100644 --- a/vvp/npmos.h +++ b/vvp/npmos.h @@ -43,7 +43,7 @@ * * This class also implements the NMOS device, which is the same as * the PMOS device, but the Control input inverted. The enable_invert - * flag to the costructor activates this invertion. + * flag to the constructor activates this inversion. */ class vvp_fun_pmos_ : public vvp_net_fun_t { diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 292d7fb53..ef5c909b1 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -474,7 +474,7 @@ part. If any bit of the desired value is outside the vector, then that bit is set to X. The index register 1 is interpreted as a signed value. Even though the -address is cannonical (from 0 to the width of the signal) the value in +address is canonical (from 0 to the width of the signal) the value in index register 1 may be <0 or >=wid. The load instruction handles filling in the out-of-bounds bits with x. diff --git a/vvp/schedule.cc b/vvp/schedule.cc index c2546120d..50944c695 100644 --- a/vvp/schedule.cc +++ b/vvp/schedule.cc @@ -780,7 +780,7 @@ void schedule_simulate(void) ctim->rwsync = 0; /* If out of rw events, then run the rosync - events and delete this timestep. This also + events and delete this time step. This also deletes threads as needed. */ if (ctim->active == 0) { run_rosync(ctim); diff --git a/vvp/vvp_island.cc b/vvp/vvp_island.cc index 439afca78..c258309a6 100644 --- a/vvp/vvp_island.cc +++ b/vvp/vvp_island.cc @@ -357,11 +357,11 @@ class vvp_island_tran : public vvp_island { void vvp_island_tran::run_island() { // Test to see if any of the branches are enabled. - bool runable = false; + bool runnable = false; for (vvp_island_branch*cur = branches_ ; cur ; cur = cur->next_branch) { - runable |= cur->run_test_enabled(); + runnable |= cur->run_test_enabled(); } - if (runable == false) + if (runnable == false) return; for (vvp_island_branch*cur = branches_ ; cur ; cur = cur->next_branch) From 8c5480309446e74f776e5a0d981d69e84e6f50cb Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Wed, 25 Jun 2008 13:59:39 -0700 Subject: [PATCH 2/6] vpi_get_value of integer values replaces x/z bits with 0. In arithmetic expressions, vectors with x/z are replaced with 0, but vpi_get_value replaces x/z bits with 0 bits without replacing the whole vector. --- vvp/vpi_signal.cc | 3 +-- vvp/vvp_net.cc | 11 ++++++++--- vvp/vvp_net.h | 9 ++++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index 54ef5dd47..c3bdf03e9 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -298,8 +298,7 @@ static void format_vpiIntVal(vvp_fun_signal_vec*sig, int base, unsigned wid, { vvp_vector4_t sub = sig->vec4_value().subvalue(base, wid); long val = 0; - bool flag = vector4_to_value(sub, val, signed_flag); - if (! flag) val = 0; + bool flag = vector4_to_value(sub, val, signed_flag, false); vp->value.integer = val; } diff --git a/vvp/vvp_net.cc b/vvp/vvp_net.cc index b9d6b60be..eb5f154b4 100644 --- a/vvp/vvp_net.cc +++ b/vvp/vvp_net.cc @@ -1133,10 +1133,12 @@ ostream& operator<< (ostream&out, const vvp_vector4_t&that) return out; } -bool vector4_to_value(const vvp_vector4_t&vec, long&val, bool is_signed) +bool vector4_to_value(const vvp_vector4_t&vec, long&val, + bool is_signed, bool is_arithmetic) { long res = 0; long msk = 1; + bool rc_flag = true; for (unsigned idx = 0 ; idx < vec.size() ; idx += 1) { switch (vec.value(idx)) { @@ -1146,7 +1148,10 @@ bool vector4_to_value(const vvp_vector4_t&vec, long&val, bool is_signed) res |= msk; break; default: - return false; + if (is_arithmetic) + return false; + else + rc_flag = false; } msk <<= 1L; @@ -1158,7 +1163,7 @@ bool vector4_to_value(const vvp_vector4_t&vec, long&val, bool is_signed) } val = res; - return true; + return rc_flag; } bool vector4_to_value(const vvp_vector4_t&vec, unsigned long&val) diff --git a/vvp/vvp_net.h b/vvp/vvp_net.h index 832689e72..2d352c4e3 100644 --- a/vvp/vvp_net.h +++ b/vvp/vvp_net.h @@ -381,8 +381,15 @@ template extern T coerce_to_width(const T&that, unsigned width); * place (this follows the rules of Verilog conversions from vector4 * to real and integers) and the return value becomes false to * indicate an error. + * + * The "is_arithmetic" flag true will cause a result to be entirely 0 + * if any bits are X/Z. That is normally what you want if this value + * is in the midst of an arithmetic expression. If is_arithmetic=false + * then the X/Z bits will be replaced with 0 bits, and the return + * value will be "false", but the other bits will be transferred. This + * is what you want if you are doing "vpi_get_value", for example. */ -extern bool vector4_to_value(const vvp_vector4_t&a, long&val, bool is_signed); +extern bool vector4_to_value(const vvp_vector4_t&a, long&val, bool is_signed, bool is_arithmetic =true); extern bool vector4_to_value(const vvp_vector4_t&a, unsigned long&val); extern bool vector4_to_value(const vvp_vector4_t&a, double&val, bool is_signed); From 4163eb28d0aa1e7a7d90bc1e926f9ad4b3ae7f92 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 25 Jun 2008 10:49:57 -0700 Subject: [PATCH 3/6] Copy file and line info during a macro expansion. The file and line number information needs to be copied when doing a macro expansion. This prevents a macro that expands to an `ifdef of other construct that needs to push the stack from core dumping. --- ivlpp/lexor.lex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index c4ac34fc3..dc1c7ebee 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -1362,6 +1362,8 @@ static void do_expand(int use_args) } isp->next = istack; + isp->path = strdup(istack->path); + isp->lineno = istack->lineno; istack->yybs = YY_CURRENT_BUFFER; istack = isp; From 897f14e60a4b1c49a009d19790f9fda93173b0e2 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 25 Jun 2008 11:35:59 -0700 Subject: [PATCH 4/6] Fix memory leak in recent patch. --- ivlpp/lexor.lex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index dc1c7ebee..301602298 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -1362,7 +1362,7 @@ static void do_expand(int use_args) } isp->next = istack; - isp->path = strdup(istack->path); + isp->path = istack->path; isp->lineno = istack->lineno; istack->yybs = YY_CURRENT_BUFFER; istack = isp; From c17ffcae2cf4302125471ba1d425e586c803be25 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 25 Jun 2008 14:22:42 -0700 Subject: [PATCH 5/6] Rework previous patch to use the correct method. --- ivlpp/lexor.lex | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ivlpp/lexor.lex b/ivlpp/lexor.lex index 301602298..7e4796047 100644 --- a/ivlpp/lexor.lex +++ b/ivlpp/lexor.lex @@ -115,7 +115,7 @@ static void ifdef_enter(void) struct ifdef_stack_t*cur; cur = (struct ifdef_stack_t*) calloc(1, sizeof(struct ifdef_stack_t)); - cur->path = strdup(istack->path); + if (istack->path) cur->path = strdup(istack->path); cur->lineno = istack->lineno; cur->next = ifdef_stack; @@ -131,8 +131,10 @@ static void ifdef_leave(void) cur = ifdef_stack; ifdef_stack = cur->next; - if (strcmp(istack->path,cur->path) != 0) - { + /* If either path is from a non-file context e.g.(macro expansion) + * we assume that the non-file part is from this file. */ + if (istack->path != NULL && cur->path != NULL && + strcmp(istack->path,cur->path) != 0) { fprintf ( stderr, @@ -1362,8 +1364,6 @@ static void do_expand(int use_args) } isp->next = istack; - isp->path = istack->path; - isp->lineno = istack->lineno; istack->yybs = YY_CURRENT_BUFFER; istack = isp; From 12783674cb4d14193b4ae827b06ce3d004e48ff1 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 25 Jun 2008 15:42:57 -0700 Subject: [PATCH 6/6] Clean up compiler warning. --- vvp/vpi_signal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vvp/vpi_signal.cc b/vvp/vpi_signal.cc index c3bdf03e9..eacbf1732 100644 --- a/vvp/vpi_signal.cc +++ b/vvp/vpi_signal.cc @@ -298,7 +298,7 @@ static void format_vpiIntVal(vvp_fun_signal_vec*sig, int base, unsigned wid, { vvp_vector4_t sub = sig->vec4_value().subvalue(base, wid); long val = 0; - bool flag = vector4_to_value(sub, val, signed_flag, false); + vector4_to_value(sub, val, signed_flag, false); vp->value.integer = val; }