diff --git a/vvp/compile.h b/vvp/compile.h index 3716e69e3..6013ffcf2 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.38 2001/12/06 03:31:24 steve Exp $" +#ident "$Id: compile.h,v 1.39 2001/12/14 02:04:49 steve Exp $" #endif # include @@ -73,7 +73,8 @@ extern void compile_vpi_time_precision(long pre); * to existing functors to manage the linking. */ extern void compile_functor(char*label, char*type, - vvp_delay_t delay, + vvp_delay_t delay, unsigned ostr0, + unsigned ostr1, unsigned argc, struct symb_s*argv); @@ -222,6 +223,9 @@ extern void compile_net(char*label, char*name, /* * $Log: compile.h,v $ + * Revision 1.39 2001/12/14 02:04:49 steve + * Support strength syntax on functors. + * * Revision 1.38 2001/12/06 03:31:24 steve * Support functor delays for gates and UDP devices. * (Stephan Boettcher) diff --git a/vvp/logic.cc b/vvp/logic.cc index ec623f893..b5afa4d58 100644 --- a/vvp/logic.cc +++ b/vvp/logic.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: logic.cc,v 1.4 2001/12/06 03:31:24 steve Exp $" +#ident "$Id: logic.cc,v 1.5 2001/12/14 02:04:49 steve Exp $" #endif # include "logic.h" @@ -37,9 +37,14 @@ * to 4 inputs. */ -inline table_functor_s::table_functor_s(truth_t t) - : table(t) -{} +table_functor_s::table_functor_s(truth_t t, unsigned str0, unsigned str1) +: table(t) +{ + assert(str0 <= 7); + assert(str1 <= 7); + odrive0 = str0; + odrive1 = str1; +} table_functor_s::~table_functor_s() {} @@ -63,19 +68,19 @@ void table_functor_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned) */ void compile_functor(char*label, char*type, - vvp_delay_t delay, + vvp_delay_t delay, unsigned ostr0, unsigned ostr1, unsigned argc, struct symb_s*argv) { functor_t obj; if (strcmp(type, "OR") == 0) { - obj = new table_functor_s(ft_OR); + obj = new table_functor_s(ft_OR, ostr0, ostr1); } else if (strcmp(type, "AND") == 0) { - obj = new table_functor_s(ft_AND); + obj = new table_functor_s(ft_AND, ostr0, ostr1); } else if (strcmp(type, "BUF") == 0) { - obj = new table_functor_s(ft_BUF); + obj = new table_functor_s(ft_BUF, ostr0, ostr1); } else if (strcmp(type, "BUFIF0") == 0) { obj = new vvp_bufif0_s; @@ -102,19 +107,19 @@ void compile_functor(char*label, char*type, obj = new table_functor_s(ft_EEQ); } else if (strcmp(type, "NAND") == 0) { - obj = new table_functor_s(ft_NAND); + obj = new table_functor_s(ft_NAND, ostr0, ostr1); } else if (strcmp(type, "NOR") == 0) { - obj = new table_functor_s(ft_NOR); + obj = new table_functor_s(ft_NOR, ostr0, ostr1); } else if (strcmp(type, "NOT") == 0) { - obj = new table_functor_s(ft_NOT); + obj = new table_functor_s(ft_NOT, ostr0, ostr1); } else if (strcmp(type, "XNOR") == 0) { - obj = new table_functor_s(ft_XNOR); + obj = new table_functor_s(ft_XNOR, ostr0, ostr1); } else if (strcmp(type, "XOR") == 0) { - obj = new table_functor_s(ft_XOR); + obj = new table_functor_s(ft_XOR, ostr0, ostr1); } else { yyerror("invalid functor type."); @@ -141,6 +146,9 @@ void compile_functor(char*label, char*type, /* * $Log: logic.cc,v $ + * Revision 1.5 2001/12/14 02:04:49 steve + * Support strength syntax on functors. + * * Revision 1.4 2001/12/06 03:31:24 steve * Support functor delays for gates and UDP devices. * (Stephan Boettcher) diff --git a/vvp/logic.h b/vvp/logic.h index 8da6f66bc..a5f6d2416 100644 --- a/vvp/logic.h +++ b/vvp/logic.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: logic.h,v 1.1 2001/11/06 03:07:22 steve Exp $" +#ident "$Id: logic.h,v 1.2 2001/12/14 02:04:49 steve Exp $" #endif # include "functor.h" @@ -28,11 +28,16 @@ * Table driven functor. oval = table[ival]; */ -struct table_functor_s: public functor_s { +class table_functor_s: public functor_s { + + public: typedef const unsigned char *truth_t; - explicit table_functor_s(truth_t t); + explicit table_functor_s(truth_t t, unsigned str0 =6, unsigned str1 =6); virtual ~table_functor_s(); + virtual void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str); + + private: truth_t table; }; @@ -56,6 +61,9 @@ extern const unsigned char ft_var[]; /* * $Log: logic.h,v $ + * Revision 1.2 2001/12/14 02:04:49 steve + * Support strength syntax on functors. + * * Revision 1.1 2001/11/06 03:07:22 steve * Code rearrange. (Stephan Boettcher) * diff --git a/vvp/parse.y b/vvp/parse.y index 40bab74f8..200755b2f 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.41 2001/12/06 03:31:25 steve Exp $" +#ident "$Id: parse.y,v 1.42 2001/12/14 02:04:49 steve Exp $" #endif # include "parse_misc.h" @@ -119,13 +119,18 @@ program statement /* Functor statements define functors. The functor must have a - label and a type name, and may have operands. */ + label and a type name, and may have operands. The functor may + also have a delay specification and output strengths. */ : T_LABEL K_FUNCTOR T_SYMBOL delay ',' symbols ';' - { compile_functor($1, $3, $4, $6.cnt, $6.vect); } + { compile_functor($1, $3, $4, 6, 6, $6.cnt, $6.vect); } - | T_LABEL K_FUNCTOR T_SYMBOL delay ',' T_NUMBER ';' - { compile_functor($1, $3, $4, 0, 0); } + | T_LABEL K_FUNCTOR T_SYMBOL delay + '[' T_NUMBER T_NUMBER ']' ',' symbols ';' + { unsigned str0 = $6; + unsigned str1 = $7; + compile_functor($1, $3, $4, str0, str1, $10.cnt, $10.vect); + } /* UDP statements define or instantiate UDPs. Definitions take a @@ -527,6 +532,9 @@ int compile_design(const char*path) /* * $Log: parse.y,v $ + * Revision 1.42 2001/12/14 02:04:49 steve + * Support strength syntax on functors. + * * Revision 1.41 2001/12/06 03:31:25 steve * Support functor delays for gates and UDP devices. * (Stephan Boettcher)