diff --git a/ivl_target.h b/ivl_target.h index 3ff1e4503..5f69916f4 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.69 2001/06/19 03:01:10 steve Exp $" +#ident "$Id: ivl_target.h,v 1.70 2001/06/30 23:03:16 steve Exp $" #endif #ifdef __cplusplus @@ -317,12 +317,17 @@ typedef int (ivl_scope_f)(ivl_scope_t net, void*cd); * A design has a root named scope that is an instance of the top * level module in the design. This is a hook for naming the * design, or for starting the scope scan. + * + * ivl_design_time_precision + * A design as a time precision. This is the size in seconds (a + * signed power of 10) of a simulation tick. */ extern const char* ivl_design_flag(ivl_design_t des, const char*key); extern int ivl_design_process(ivl_design_t des, ivl_process_f fun, void*cd); extern ivl_scope_t ivl_design_root(ivl_design_t des); +extern int ivl_design_time_precision(ivl_design_t des); /* * These methods apply to ivl_net_const_t objects. @@ -884,6 +889,10 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.70 2001/06/30 23:03:16 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.69 2001/06/19 03:01:10 steve * Add structural EEQ gates (Stephan Boettcher) * diff --git a/t-dll-api.cc b/t-dll-api.cc index 63b7fcc28..cdd379a31 100644 --- a/t-dll-api.cc +++ b/t-dll-api.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll-api.cc,v 1.51 2001/06/16 23:45:05 steve Exp $" +#ident "$Id: t-dll-api.cc,v 1.52 2001/06/30 23:03:16 steve Exp $" #endif # include "t-dll.h" @@ -47,6 +47,11 @@ extern "C" ivl_scope_t ivl_design_root(ivl_design_t des) return des->root_; } +extern "C" int ivl_design_time_precision(ivl_design_t des) +{ + return des->time_precision; +} + extern "C" ivl_expr_type_t ivl_expr_type(ivl_expr_t net) { if (net == 0) @@ -1227,6 +1232,10 @@ extern "C" ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net) /* * $Log: t-dll-api.cc,v $ + * Revision 1.52 2001/06/30 23:03:16 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.51 2001/06/16 23:45:05 steve * Add support for structural multiply in t-dll. * Add code generators and vvp support for both diff --git a/t-dll.cc b/t-dll.cc index 6f03128af..08e07ba46 100644 --- a/t-dll.cc +++ b/t-dll.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.cc,v 1.51 2001/06/19 03:01:10 steve Exp $" +#ident "$Id: t-dll.cc,v 1.52 2001/06/30 23:03:16 steve Exp $" #endif # include "compiler.h" @@ -318,6 +318,7 @@ bool dll_target::start_design(const Design*des) // Initialize the design object. des_.self = des; + des_.time_precision = des->get_precision(); des_.root_ = new struct ivl_scope_s; des_.root_->name_ = strdup(des->find_root_scope()->name().c_str()); des_.root_->child_ = 0; @@ -1381,6 +1382,10 @@ extern const struct target tgt_dll = { "dll", &dll_target_obj }; /* * $Log: t-dll.cc,v $ + * Revision 1.52 2001/06/30 23:03:16 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.51 2001/06/19 03:01:10 steve * Add structural EEQ gates (Stephan Boettcher) * diff --git a/t-dll.h b/t-dll.h index 9584c13ca..c4e29a66b 100644 --- a/t-dll.h +++ b/t-dll.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: t-dll.h,v 1.51 2001/06/30 21:07:26 steve Exp $" +#ident "$Id: t-dll.h,v 1.52 2001/06/30 23:03:16 steve Exp $" #endif # include "target.h" @@ -38,6 +38,8 @@ typedef shl_t ivl_dll_t; struct ivl_design_s { + int time_precision; + ivl_scope_t root_; ivl_process_t threads_; @@ -539,6 +541,10 @@ struct ivl_statement_s { /* * $Log: t-dll.h,v $ + * Revision 1.52 2001/06/30 23:03:16 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.51 2001/06/30 21:07:26 steve * Support non-const right shift (unsigned). * diff --git a/tgt-vvp/vvp.c b/tgt-vvp/vvp.c index 8242852a0..aff2f9559 100644 --- a/tgt-vvp/vvp.c +++ b/tgt-vvp/vvp.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvp.c,v 1.8 2001/05/22 02:14:47 steve Exp $" +#ident "$Id: vvp.c,v 1.9 2001/06/30 23:03:16 steve Exp $" #endif /* @@ -71,6 +71,15 @@ int target_design(ivl_design_t des) draw_execute_header(des); + { int pre = ivl_design_time_precision(des); + char sign = '+'; + if (pre < 0) { + pre = -pre; + sign = '-'; + } + fprintf(vvp_out, ":vpi_time_precision %c %d;\n", sign, pre); + } + draw_module_declarations(des); root = ivl_design_root(des); diff --git a/vvp/README.txt b/vvp/README.txt index 7ee92ef02..65fb93a37 100644 --- a/vvp/README.txt +++ b/vvp/README.txt @@ -1,7 +1,7 @@ /* * Copyright (c) 2001 Stephen Williams (steve@icarus.com) * - * $Id: README.txt,v 1.31 2001/06/18 00:51:23 steve Exp $ + * $Id: README.txt,v 1.32 2001/06/30 23:03:16 steve Exp $ */ VVP SIMULATION ENGINE @@ -47,6 +47,18 @@ the rest of the program is compiled. The compiler looks in the standard VPI_MODULE_PATH for files named "name.vpi", and tries to dynamic load them. +* :vpi_time_precision [+|-]; + +This header statement specifies the time precision of a single tick of +the simulation clock. This is mostly used for display (and VPI) +purposes, because the engine itself does not care about units. The +compiler scales time values ahead of time. + +The value is the size of a simulation tick in seconds, and is +expressed as a power of 10. For example, +0 is 1 second, and -9 is 1 +nano-second. If the record is left out, then the precision is taken to +be +0. + LABELS AND SYMBOLS Labels and symbols consist of the characters: diff --git a/vvp/compile.cc b/vvp/compile.cc index 347503048..23b48909b 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: compile.cc,v 1.82 2001/06/30 21:07:26 steve Exp $" +#ident "$Id: compile.cc,v 1.83 2001/06/30 23:03:16 steve Exp $" #endif # include "arith.h" @@ -245,6 +245,11 @@ void compile_load_vpi_module(char*name) free(name); } +void compile_vpi_time_precision(long pre) +{ + vpip_set_time_precision(pre); +} + /* * Add a functor to the symbol table */ @@ -1450,6 +1455,10 @@ vvp_ipoint_t debug_lookup_functor(const char*name) /* * $Log: compile.cc,v $ + * Revision 1.83 2001/06/30 23:03:16 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.82 2001/06/30 21:07:26 steve * Support non-const right shift (unsigned). * diff --git a/vvp/compile.h b/vvp/compile.h index ab451b5da..f67ef0ae1 100644 --- a/vvp/compile.h +++ b/vvp/compile.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: compile.h,v 1.28 2001/06/16 23:45:05 steve Exp $" +#ident "$Id: compile.h,v 1.29 2001/06/30 23:03:17 steve Exp $" #endif # include @@ -48,6 +48,8 @@ extern unsigned compile_errors; extern const char* module_path; extern void compile_load_vpi_module(char*name); +extern void compile_vpi_time_precision(long pre); + /* * This function is called by the parser to compile a functor * statement. The strings passed in are allocated by the lexor, but @@ -198,6 +200,10 @@ extern void compile_net(char*label, char*name, /* * $Log: compile.h,v $ + * Revision 1.29 2001/06/30 23:03:17 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.28 2001/06/16 23:45:05 steve * Add support for structural multiply in t-dll. * Add code generators and vvp support for both diff --git a/vvp/lexor.lex b/vvp/lexor.lex index 4e537f166..bd17713b5 100644 --- a/vvp/lexor.lex +++ b/vvp/lexor.lex @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: lexor.lex,v 1.23 2001/06/18 03:10:34 steve Exp $" +#ident "$Id: lexor.lex,v 1.24 2001/06/30 23:03:17 steve Exp $" #endif # include "parse_misc.h" @@ -32,6 +32,7 @@ /* These are some special header keywords. */ ^":vpi_module" { return K_vpi_module; } +^":vpi_time_precision" { return K_vpi_time_precision; } /* A label is any non-blank text that appears left justified. */ @@ -145,6 +146,10 @@ int yywrap() /* * $Log: lexor.lex,v $ + * Revision 1.24 2001/06/30 23:03:17 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.23 2001/06/18 03:10:34 steve * 1. Logic with more than 4 inputs * 2. Id and name mangling diff --git a/vvp/parse.y b/vvp/parse.y index 06e190b91..7844bb025 100644 --- a/vvp/parse.y +++ b/vvp/parse.y @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: parse.y,v 1.32 2001/06/16 23:45:05 steve Exp $" +#ident "$Id: parse.y,v 1.33 2001/06/30 23:03:17 steve Exp $" #endif # include "parse_misc.h" @@ -60,7 +60,7 @@ extern FILE*yyin; %token K_UDP K_UDP_C K_UDP_S %token K_MEM K_MEM_P K_MEM_I %token K_VAR K_VAR_S K_vpi_call K_vpi_func K_disable K_fork -%token K_vpi_module +%token K_vpi_module K_vpi_time_precision %token T_INSTR %token T_LABEL @@ -93,6 +93,10 @@ header_lines header_line : K_vpi_module T_STRING ';' { compile_load_vpi_module($2); } + | K_vpi_time_precision '+' T_NUMBER ';' + { compile_vpi_time_precision($3); } + | K_vpi_time_precision '-' T_NUMBER ';' + { compile_vpi_time_precision(-$3); } ; /* A program is simply a list of statements. No other structure. */ @@ -474,6 +478,10 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.33 2001/06/30 23:03:17 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.32 2001/06/16 23:45:05 steve * Add support for structural multiply in t-dll. * Add code generators and vvp support for both diff --git a/vvp/vpi_priv.cc b/vvp/vpi_priv.cc index 4f5260fe4..ee33a41b5 100644 --- a/vvp/vpi_priv.cc +++ b/vvp/vpi_priv.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_priv.cc,v 1.6 2001/06/21 22:54:12 steve Exp $" +#ident "$Id: vpi_priv.cc,v 1.7 2001/06/30 23:03:17 steve Exp $" #endif # include "vpi_priv.h" @@ -44,8 +44,7 @@ static int vpip_get_global(int property) switch (property) { case vpiTimePrecision: - fprintf(stderr, "vpi Sorry: vpiTimePrecision not supported\n"); - return 0; + return vpip_get_time_precision(); default: fprintf(stderr, "vpi error: bad global property: %d\n", property); @@ -152,6 +151,10 @@ extern "C" void vpi_sim_vcontrol(int operation, va_list ap) /* * $Log: vpi_priv.cc,v $ + * Revision 1.7 2001/06/30 23:03:17 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.6 2001/06/21 22:54:12 steve * Support cbValueChange callbacks. * diff --git a/vvp/vpi_priv.h b/vvp/vpi_priv.h index be8b22d03..6151d3a28 100644 --- a/vvp/vpi_priv.h +++ b/vvp/vpi_priv.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_priv.h,v 1.17 2001/06/21 22:54:12 steve Exp $" +#ident "$Id: vpi_priv.h,v 1.18 2001/06/30 23:03:17 steve Exp $" #endif # include "vpi_user.h" @@ -249,8 +249,15 @@ extern void vpip_execute_vpi_call(vthread_t thr, vpiHandle obj); vpiHandle vpip_sim_time(void); +extern int vpip_get_time_precision(void); +extern void vpip_set_time_precision(int pres); + /* * $Log: vpi_priv.h,v $ + * Revision 1.18 2001/06/30 23:03:17 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.17 2001/06/21 22:54:12 steve * Support cbValueChange callbacks. * diff --git a/vvp/vpi_time.cc b/vvp/vpi_time.cc index 9de1782e8..b63141996 100644 --- a/vvp/vpi_time.cc +++ b/vvp/vpi_time.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: vpi_time.cc,v 1.2 2001/04/03 03:46:14 steve Exp $" +#ident "$Id: vpi_time.cc,v 1.3 2001/06/30 23:03:17 steve Exp $" #endif # include "vpi_priv.h" @@ -25,6 +25,9 @@ # include # include + +static int vpi_time_precision = 0; + static struct __vpiSystemTime { struct __vpiHandle base; struct t_vpi_time value; @@ -73,8 +76,23 @@ vpiHandle vpip_sim_time(void) return &time_handle.base; } +int vpip_get_time_precision(void) +{ + return vpi_time_precision; +} + +void vpip_set_time_precision(int pre) +{ + vpi_time_precision = pre; +} + + /* * $Log: vpi_time.cc,v $ + * Revision 1.3 2001/06/30 23:03:17 steve + * support fast programming by only writing the bits + * that are listed in the input file. + * * Revision 1.2 2001/04/03 03:46:14 steve * VPI access time as a decimal string, and * stub vpi access to the scopes.