Compare commits

..
6 Commits
Author SHA1 Message Date
steve 87e813766a Detect and ignore specify edge expressions 2007-06-14 03:50:00 +00:00
steve e24e77660f Detect and use the nan function. 2007-06-13 01:03:57 +00:00
steve 8ec6d9983d Put instantiated modules in the proper generated scope. 2007-06-12 04:05:45 +00:00
steve ae82eccdc4 handle constant inf values. 2007-06-12 02:36:58 +00:00
steve fa18d9bc01 Do not propogate until initialized. 2007-06-12 02:25:00 +00:00
steve 16ec4cb685 displan pmos gates. 2007-06-12 02:23:40 +00:00
13 changed files with 165 additions and 43 deletions
+6 -1
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_net.cc,v 1.206 2007/06/04 02:19:07 steve Exp $"
#ident "$Id: elab_net.cc,v 1.207 2007/06/12 04:05:45 steve Exp $"
#endif
# include "config.h"
@@ -2221,6 +2221,8 @@ bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig,
endl;
cerr << get_line() << ": : Index expression is: "
<< *index_tail.msb << endl;
cerr << get_line() << ": : Context scope is: "
<< scope_path(scope) << endl;
des->errors += 1;
return false;
}
@@ -3016,6 +3018,9 @@ NetNet* PEUnary::elaborate_net(Design*des, NetScope*scope,
/*
* $Log: elab_net.cc,v $
* Revision 1.207 2007/06/12 04:05:45 steve
* Put instantiated modules in the proper generated scope.
*
* Revision 1.206 2007/06/04 02:19:07 steve
* Handle bit/part select of array words in nets.
*
+18 -2
View File
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: lexor.lex,v 1.95 2007/04/19 02:52:53 steve Exp $"
#ident "$Id: lexor.lex,v 1.96 2007/06/14 03:50:00 steve Exp $"
#endif
# include "config.h"
@@ -109,6 +109,7 @@ static int comment_enter;
%s UDPTABLE
%x PPTIMESCALE
%x PPDEFAULT_NETTYPE
%s EDGES
W [ \t\b\f\r]+
@@ -167,7 +168,7 @@ W [ \t\b\f\r]+
with "*" and return that. */
"("{W}*"*"{W}*")" { return '*'; }
<EDGES>"]" { BEGIN(0); return yytext[0]; }
[}{;:\[\],()#=.@&!?<>%|^~+*/-] { return yytext[0]; }
\" { BEGIN(CSTRING); }
@@ -210,6 +211,17 @@ W [ \t\b\f\r]+
<UDPTABLE>[pP] { return 'p'; }
<UDPTABLE>[01\?\*\-] { return yytext[0]; }
<EDGES>"01" { return K_edge_descriptor; }
<EDGES>"0x" { return K_edge_descriptor; }
<EDGES>"0z" { return K_edge_descriptor; }
<EDGES>"10" { return K_edge_descriptor; }
<EDGES>"1x" { return K_edge_descriptor; }
<EDGES>"1z" { return K_edge_descriptor; }
<EDGES>"x0" { return K_edge_descriptor; }
<EDGES>"x1" { return K_edge_descriptor; }
<EDGES>"z0" { return K_edge_descriptor; }
<EDGES>"z1" { return K_edge_descriptor; }
[a-zA-Z_][a-zA-Z0-9$_]* {
int rc = lexor_keyword_code(yytext, yyleng);
switch (rc) {
@@ -230,6 +242,10 @@ W [ \t\b\f\r]+
}
break;
case K_edge:
BEGIN(EDGES);
break;
default:
yylval.text = 0;
break;
+35 -21
View File
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: parse.y,v 1.238 2007/06/04 02:19:07 steve Exp $"
#ident "$Id: parse.y,v 1.239 2007/06/14 03:50:00 steve Exp $"
#endif
# include "config.h"
@@ -157,7 +157,8 @@ static list<perm_string>* list_from_identifier(list<perm_string>*tmp, char*id)
%token K_LOR K_LAND K_NAND K_NOR K_NXOR K_TRIGGER
%token K_always K_and K_assign K_begin K_bool K_buf K_bufif0 K_bufif1 K_case
%token K_casex K_casez K_cmos K_deassign K_default K_defparam K_disable
%token K_edge K_else K_end K_endcase K_endfunction K_endgenerate K_endmodule
%token K_edge K_edge_descriptor
%token K_else K_end K_endcase K_endfunction K_endgenerate K_endmodule
%token K_endprimitive K_endspecify K_endtable K_endtask K_event K_for
%token K_force K_forever K_fork K_function K_generate K_genvar
%token K_highz0 K_highz1 K_if K_ifnone
@@ -2758,25 +2759,38 @@ spec_polarity
;
spec_reference_event
: K_posedge expression
{ delete $2; }
| K_negedge expression
{ delete $2; }
| K_posedge expr_primary K_TAND expression
{ delete $2;
delete $4;
}
| K_negedge expr_primary K_TAND expression
{ delete $2;
delete $4;
}
| expr_primary K_TAND expression
{ delete $1;
delete $3;
}
| expr_primary
{ delete $1; }
;
: K_posedge expression
{ delete $2; }
| K_negedge expression
{ delete $2; }
| K_posedge expr_primary K_TAND expression
{ delete $2;
delete $4;
}
| K_negedge expr_primary K_TAND expression
{ delete $2;
delete $4;
}
| K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression
{ delete $5;
delete $7;
}
| expr_primary K_TAND expression
{ delete $1;
delete $3;
}
| expr_primary
{ delete $1; }
;
/* The edge_descriptor is detected by the lexor as the various
2-letter edge sequences that are supported here. For now, we
don't care what they are, because we do not yet support specify
edge events. */
edge_descriptor_list
: edge_descriptor_list ',' K_edge_descriptor
| K_edge_descriptor
;
spec_notifier_opt
: /* empty */
+17 -2
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: pform.cc,v 1.147 2007/06/02 03:42:13 steve Exp $"
#ident "$Id: pform.cc,v 1.148 2007/06/12 04:05:45 steve Exp $"
#endif
# include "config.h"
@@ -920,6 +920,14 @@ void pform_makegates(PGBuiltin::Type type,
* constraints, and sometimes different syntax. The X_modgate
* functions handle the instantiations of modules (and UDP objects) by
* making PGModule objects.
*
* The first pform_make_modgate handles the case of a module
* instantiated with ports passed by position. The "wires" is an
* ordered array of port expressions.
*
* The second pform_make_modgate handles the case of a module
* instantiated with ports passed by name. The "bind" argument is the
* ports matched with names.
*/
static void pform_make_modgate(perm_string type,
perm_string name,
@@ -992,7 +1000,11 @@ static void pform_make_modgate(perm_string type,
cur->set_parameters(overrides->by_order);
}
pform_cur_module->add_gate(cur);
if (pform_cur_generate)
pform_cur_generate->add_gate(cur);
else
pform_cur_module->add_gate(cur);
}
void pform_make_modgates(perm_string type,
@@ -1778,6 +1790,9 @@ int pform_parse(const char*path, FILE*file)
/*
* $Log: pform.cc,v $
* Revision 1.148 2007/06/12 04:05:45 steve
* Put instantiated modules in the proper generated scope.
*
* Revision 1.147 2007/06/02 03:42:13 steve
* Properly evaluate scope path expressions.
*
+8 -2
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: stub.c,v 1.147 2007/03/02 06:13:22 steve Exp $"
#ident "$Id: stub.c,v 1.148 2007/06/12 02:23:40 steve Exp $"
#endif
/*
@@ -1231,6 +1231,9 @@ static void show_logic(ivl_net_logic_t net)
case IVL_LO_OR:
fprintf(out, " or %s", name);
break;
case IVL_LO_PMOS:
fprintf(out, " pmos %s", name);
break;
case IVL_LO_PULLDOWN:
fprintf(out, " pulldown %s", name);
break;
@@ -1247,7 +1250,7 @@ static void show_logic(ivl_net_logic_t net)
break;
default:
fprintf(out, " unsupported gate %s", name);
fprintf(out, " unsupported gate<type=%d> %s", ivl_logic_type(net), name);
break;
}
@@ -1491,6 +1494,9 @@ int target_design(ivl_design_t des)
/*
* $Log: stub.c,v $
* Revision 1.148 2007/06/12 02:23:40 steve
* displan pmos gates.
*
* Revision 1.147 2007/03/02 06:13:22 steve
* Add support for edge sensitive spec paths.
*
+15 -1
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: eval_real.c,v 1.21 2007/06/07 03:20:15 steve Exp $"
#ident "$Id: eval_real.c,v 1.22 2007/06/12 02:36:58 steve Exp $"
#endif
/*
@@ -142,6 +142,17 @@ static int draw_realnum_real(ivl_expr_t exp)
unsigned long mant;
int sign = 0;
/* Handle the special case that the value is +-inf. */
if (isinf(value)) {
if (value > 0)
fprintf(vvp_out, " %%loadi/wr %d, 0, %d; load=+inf\n",
res, 0x3fff);
else
fprintf(vvp_out, " %%loadi/wr %d, 0, %d; load=-inf\n",
res, 0x7fff);
return res;
}
if (value < 0) {
sign = 0x4000;
value *= -1;
@@ -426,6 +437,9 @@ int draw_eval_real(ivl_expr_t exp)
/*
* $Log: eval_real.c,v $
* Revision 1.22 2007/06/12 02:36:58 steve
* handle constant inf values.
*
* Revision 1.21 2007/06/07 03:20:15 steve
* Properly handle signed conversion to real
*
+14 -1
View File
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: config.h.in,v 1.23 2007/02/02 04:33:01 steve Exp $"
#ident "$Id: config.h.in,v 1.24 2007/06/13 01:03:57 steve Exp $"
#endif
#if defined(__cplusplus)
@@ -50,6 +50,7 @@
# undef HAVE_READLINE_HISTORY_H
# undef HAVE_INTTYPES_H
# undef HAVE_LROUND
# undef HAVE_NAN
/* Figure if I can use readline. */
#undef USE_READLINE
@@ -85,6 +86,8 @@ typedef unsigned long vvp_time64_t;
# endif
#endif
# include <math.h>
/* getrusage, /proc/self/statm */
# undef HAVE_SYS_RESOURCE_H
@@ -98,6 +101,13 @@ extern long lround(double x);
#endif
#endif
#if !defined(HAVE_NAN)
# define nan(x) (NAN)
#endif
#if !defined(INFINITY)
# define INFINITY HUGE_VAL
#endif
/*
* When doing dynamic linking, we need a uniform way to identify the
@@ -119,6 +129,9 @@ extern long lround(double x);
/*
* $Log: config.h.in,v $
* Revision 1.24 2007/06/13 01:03:57 steve
* Detect and use the nan function.
*
* Revision 1.23 2007/02/02 04:33:01 steve
* Use inttypes.h instead of stdint.h for portability.
*
+1 -1
View File
@@ -75,7 +75,7 @@ esac
# Check that these functions exist. They are mostly C99
# functions that older compilers may not yet support.
AC_CHECK_FUNCS(lround)
AC_CHECK_FUNCS(lround nan)
# see how we can give some resource usage stats with -v
# Linux does not provide mem stats in rusage, use /proc/self/statm.
+6 -2
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: npmos.cc,v 1.13 2005/06/22 00:04:49 steve Exp $"
#ident "$Id: npmos.cc,v 1.14 2007/06/12 02:25:00 steve Exp $"
#endif
# include "npmos.h"
@@ -76,7 +76,8 @@ void vvp_fun_pmos_::generate_output_(vvp_net_ptr_t ptr)
}
}
vvp_send_vec8(ptr.ptr()->out, out);
if (out.size() > 0)
vvp_send_vec8(ptr.ptr()->out, out);
}
@@ -120,6 +121,9 @@ void vvp_fun_rpmos::recv_vec8(vvp_net_ptr_t ptr, vvp_vector8_t bit)
/*
* $Log: npmos.cc,v $
* Revision 1.14 2007/06/12 02:25:00 steve
* Do not propogate until initialized.
*
* Revision 1.13 2005/06/22 00:04:49 steve
* Reduce vvp_vector4 copies by using const references.
*
+5 -2
View File
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2001-2003 Stephen Williams ([email protected])
*
* $Id: opcodes.txt,v 1.77 2007/06/07 03:20:16 steve Exp $
* $Id: opcodes.txt,v 1.78 2007/06/12 02:36:58 steve Exp $
*/
@@ -433,9 +433,12 @@ auto-increment feature.
This opcode loads an immediate value, floating point, into the word
register selected by <bit>. The mantissa is an unsigned integer value,
up to 32 bits, that multiplied by 2**(<exp>-0x1000) to make a real
value. The sign bit is OR-ed into the <exp> value at bit 0x2000, and
value. The sign bit is OR-ed into the <exp> value at bit 0x4000, and
is removed from the <exp> before calculating the real value.
If <exp>==0x3fff and <mant> == 0, the value is +inf.
If <exp>==0x7fff and <mant> == 0, the value is -inf.
If <exp>--0x3fff and <mant> != 0, the value is NaN.
* %mod <bit-l>, <bit-r>, <wid>
* %mod/s <bit-l>, <bit-r>, <wid>
+23 -1
View File
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: vthread.cc,v 1.164 2007/06/07 03:20:16 steve Exp $"
#ident "$Id: vthread.cc,v 1.166 2007/06/13 01:03:57 steve Exp $"
#endif
# include "config.h"
@@ -2194,6 +2194,22 @@ bool of_LOADI_WR(vthread_t thr, vvp_code_t cp)
unsigned idx = cp->bit_idx[0];
double mant = cp->number;
int exp = cp->bit_idx[1];
// Detect +infinity
if (exp==0x3fff && cp->number==0) {
thr->words[idx].w_real = INFINITY;
return true;
}
// Detect -infinity
if (exp==0x7fff && cp->number==0) {
thr->words[idx].w_real = -INFINITY;
return true;
}
// Detect NaN
if ( (exp&0x3fff) == 0x3fff ) {
thr->words[idx].w_real = nan("");
}
double sign = (exp & 0x4000)? -1.0 : 1.0;
exp &= 0x1fff;
@@ -3473,6 +3489,12 @@ bool of_JOIN_UFUNC(vthread_t thr, vvp_code_t cp)
/*
* $Log: vthread.cc,v $
* Revision 1.166 2007/06/13 01:03:57 steve
* Detect and use the nan function.
*
* Revision 1.165 2007/06/12 02:36:58 steve
* handle constant inf values.
*
* Revision 1.164 2007/06/07 03:20:16 steve
* Properly handle signed conversion to real
*
+9 -4
View File
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: vvp_net.cc,v 1.63 2007/04/15 02:07:24 steve Exp $"
#ident "$Id: vvp_net.cc,v 1.64 2007/06/12 02:36:58 steve Exp $"
# include "config.h"
# include "vvp_net.h"
@@ -630,6 +630,8 @@ bool vector4_to_value(const vvp_vector4_t&vec, double&val, bool signed_flag)
return true;
}
bool flag = true;
if (vec.value(vec.size()-1) != BIT4_1) {
signed_flag = false;
}
@@ -647,7 +649,7 @@ bool vector4_to_value(const vvp_vector4_t&vec, double&val, bool signed_flag)
res += pow(2.0, (int)idx);
break;
default:
return false;
flag = false;
}
}
res *= -1.0;
@@ -660,12 +662,12 @@ bool vector4_to_value(const vvp_vector4_t&vec, double&val, bool signed_flag)
res += pow(2.0, (int)idx);
break;
default:
return false;
flag = false;
}
}
}
val = res;
return true;
return flag;
}
template <class T> T coerce_to_width(const T&that, unsigned width)
@@ -2293,6 +2295,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a,
/*
* $Log: vvp_net.cc,v $
* Revision 1.64 2007/06/12 02:36:58 steve
* handle constant inf values.
*
* Revision 1.63 2007/04/15 02:07:24 steve
* Fix div/mod calculation that caused a hang for some divisions.
*
+8 -3
View File
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: vvp_net.h,v 1.57 2007/03/22 16:08:19 steve Exp $"
#ident "$Id: vvp_net.h,v 1.58 2007/06/12 02:36:58 steve Exp $"
# include "config.h"
# include <stddef.h>
@@ -254,8 +254,10 @@ template <class T> extern T coerce_to_width(const T&that, unsigned width);
/*
* These functions extract the value of the vector as a native type,
* if possible, and return true to indicate success. If the vector has
* any X or Z bits, the resulting value will be unchanged and the
* return value becomes false to indicate an error.
* any X or Z bits, the resulting value will have 0 bits in their
* place (this follows the rules of Verilog conversions from vector4
* to real and integers) and the return value becomes false to
* indicate an error.
*/
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);
@@ -1040,6 +1042,9 @@ inline void vvp_send_vec4_pv(vvp_net_ptr_t ptr, const vvp_vector4_t&val,
/*
* $Log: vvp_net.h,v $
* Revision 1.58 2007/06/12 02:36:58 steve
* handle constant inf values.
*
* Revision 1.57 2007/03/22 16:08:19 steve
* Spelling fixes from Larry
*