Remove the init parameter of functors, and instead use
the special C<?> symbols to initialize inputs. This is clearer and more regular.
This commit is contained in:
parent
06437b7fba
commit
0f9eb13245
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vvp_scope.c,v 1.22 2001/04/30 00:00:27 steve Exp $"
|
||||
#ident "$Id: vvp_scope.c,v 1.23 2001/05/02 04:05:16 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vvp_priv.h"
|
||||
|
|
@ -241,7 +241,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||
{
|
||||
unsigned pdx;
|
||||
const char*ltype = "?";
|
||||
unsigned init_val = 0;
|
||||
char identity_val = '0';
|
||||
|
||||
|
||||
switch (ivl_logic_type(lptr)) {
|
||||
|
|
@ -264,7 +264,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||
|
||||
case IVL_LO_AND:
|
||||
ltype = "AND";
|
||||
init_val = 0x55;
|
||||
identity_val = '1';
|
||||
break;
|
||||
|
||||
case IVL_LO_BUF:
|
||||
|
|
@ -281,6 +281,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||
|
||||
case IVL_LO_NAND:
|
||||
ltype = "NAND";
|
||||
identity_val = '1';
|
||||
break;
|
||||
|
||||
case IVL_LO_NOR:
|
||||
|
|
@ -312,13 +313,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||
|
||||
assert(ivl_logic_pins(lptr) <= 5);
|
||||
|
||||
for (pdx = 1 ; pdx < ivl_logic_pins(lptr) ; pdx += 1) {
|
||||
unsigned mask = 3 << (pdx - 1);
|
||||
init_val = (init_val & ~mask) | (2 << (pdx - 1));
|
||||
}
|
||||
|
||||
fprintf(vvp_out, "L_%s .functor %s, 0x%x",
|
||||
ivl_logic_name(lptr), ltype, init_val);
|
||||
fprintf(vvp_out, "L_%s .functor %s", ivl_logic_name(lptr), ltype);
|
||||
|
||||
for (pdx = 1 ; pdx < ivl_logic_pins(lptr) ; pdx += 1) {
|
||||
ivl_nexus_t nex = ivl_logic_pin(lptr, pdx);
|
||||
|
|
@ -326,6 +321,10 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||
draw_nexus_input(nex);
|
||||
}
|
||||
|
||||
for ( ; pdx < 5 ; pdx += 1) {
|
||||
fprintf(vvp_out, ", C<%c>", identity_val);
|
||||
}
|
||||
|
||||
fprintf(vvp_out, ";\n");
|
||||
}
|
||||
|
||||
|
|
@ -424,15 +423,14 @@ static void draw_lpm_mux(ivl_lpm_t net)
|
|||
for (idx = 0 ; idx < width ; idx += 1) {
|
||||
ivl_nexus_t a = ivl_lpm_data2(net, 0, idx);
|
||||
ivl_nexus_t b = ivl_lpm_data2(net, 1, idx);
|
||||
fprintf(vvp_out, "L_%s/%u .functor MUXZ, 0x6a",
|
||||
fprintf(vvp_out, "L_%s/%u .functor MUXZ, ",
|
||||
ivl_lpm_name(net), idx);
|
||||
fprintf(vvp_out, ", ");
|
||||
draw_nexus_input(a);
|
||||
fprintf(vvp_out, ", ");
|
||||
draw_nexus_input(b);
|
||||
fprintf(vvp_out, ", ");
|
||||
draw_nexus_input(s);
|
||||
fprintf(vvp_out, ";\n");
|
||||
fprintf(vvp_out, ", C<1>;\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -511,6 +509,11 @@ int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|||
|
||||
/*
|
||||
* $Log: vvp_scope.c,v $
|
||||
* Revision 1.23 2001/05/02 04:05:16 steve
|
||||
* Remove the init parameter of functors, and instead use
|
||||
* the special C<?> symbols to initialize inputs. This is
|
||||
* clearer and more regular.
|
||||
*
|
||||
* Revision 1.22 2001/04/30 00:00:27 steve
|
||||
* detect multiple drivers on nexa.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* $Id: README.txt,v 1.21 2001/05/01 01:09:39 steve Exp $
|
||||
* $Id: README.txt,v 1.22 2001/05/02 04:05:17 steve Exp $
|
||||
*/
|
||||
|
||||
VVP SIMULATION ENGINE
|
||||
|
|
@ -87,23 +87,19 @@ label is required for functors.
|
|||
|
||||
The general syntax of a functor is:
|
||||
|
||||
<label> .functor <type>, <init> [, symbol_list]
|
||||
<label> .functor <type>, symbol_list ;
|
||||
|
||||
The symbol list is 0-4 names of labels of other functors. These
|
||||
connect inputs of the functor of the statement to the output of other
|
||||
functors. The type is the label of a .ftype statement elsewhere in the
|
||||
program. The references .ftype describes the behavoir of the
|
||||
functor.
|
||||
The symbol list is 4 names of labels of other functors. These connect
|
||||
inputs of the functor of the statement to the output of other
|
||||
functors. If the input is unconnected, use a C<?> symbol instead. The
|
||||
type selects the truth lookup table to use for the functor
|
||||
implementation. Most of the core gate types have built in tables.
|
||||
|
||||
The <init> value is the 8-bit initial value of the 4 input ports. The
|
||||
LSB is port 0, and the MSB port 3. If there are any constant inputs,
|
||||
then the constantat the input becomes the initial value of the
|
||||
corresponding input, replacing the value given in the <init>
|
||||
position. Also, the output of the functor is calculated at compile
|
||||
time given the init and constant input values. If the output is
|
||||
different from "x", then a propagation event is schedule for the
|
||||
functor so that when the simulation starts, the non-x value gets
|
||||
propagated.
|
||||
The initial values of all the inputs and the output is x. Any other
|
||||
value is passed around as run-time behavior. If the inputs have C<?>
|
||||
symbols, then the inputs are initialized to the specified bit value,
|
||||
and if this causes the output to be something other then x, a
|
||||
propagation event is created to be executed at the start of run time.
|
||||
|
||||
Almost all of the structural aspects of a simulation can be
|
||||
represented by functors, which perform the very basic task of
|
||||
|
|
|
|||
|
|
@ -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.51 2001/05/02 01:57:25 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.52 2001/05/02 04:05:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compile.h"
|
||||
|
|
@ -287,8 +287,7 @@ static void inputs_connect(vvp_ipoint_t fdx, unsigned argc, struct symb_s*argv)
|
|||
* functor, and map the name to the vvp_ipoint_t address for the
|
||||
* functor. Also resolve the inputs to the functor.
|
||||
*/
|
||||
void compile_functor(char*label, char*type, unsigned init,
|
||||
unsigned argc, struct symb_s*argv)
|
||||
void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
|
||||
{
|
||||
vvp_ipoint_t fdx = functor_allocate(1);
|
||||
functor_t obj = functor_index(fdx);
|
||||
|
|
@ -297,7 +296,7 @@ void compile_functor(char*label, char*type, unsigned init,
|
|||
|
||||
assert(argc <= 4);
|
||||
|
||||
obj->ival = init;
|
||||
obj->ival = 0x33;
|
||||
obj->oval = 2;
|
||||
obj->mode = 0;
|
||||
|
||||
|
|
@ -1065,6 +1064,11 @@ void compile_dump(FILE*fd)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.52 2001/05/02 04:05:17 steve
|
||||
* Remove the init parameter of functors, and instead use
|
||||
* the special C<?> symbols to initialize inputs. This is
|
||||
* clearer and more regular.
|
||||
*
|
||||
* Revision 1.51 2001/05/02 01:57:25 steve
|
||||
* Support behavioral subtraction.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.19 2001/05/01 01:09:39 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.20 2001/05/02 04:05:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -58,7 +58,7 @@ extern void compile_load_vpi_module(char*name);
|
|||
* of the functor. The compile should match those port parameters up
|
||||
* to existing functors to manage the linking.
|
||||
*/
|
||||
extern void compile_functor(char*label, char*type, unsigned init,
|
||||
extern void compile_functor(char*label, char*type,
|
||||
unsigned argc, struct symb_s*argv);
|
||||
|
||||
|
||||
|
|
@ -174,6 +174,11 @@ extern void compile_dump(FILE*fd);
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.20 2001/05/02 04:05:17 steve
|
||||
* Remove the init parameter of functors, and instead use
|
||||
* the special C<?> symbols to initialize inputs. This is
|
||||
* clearer and more regular.
|
||||
*
|
||||
* Revision 1.19 2001/05/01 01:09:39 steve
|
||||
* Add support for memory objects. (Stephan Boettcher)
|
||||
*
|
||||
|
|
|
|||
16
vvp/parse.y
16
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.23 2001/05/01 01:09:39 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.24 2001/05/02 04:05:17 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -107,12 +107,13 @@ statement
|
|||
/* Functor statements define functors. The functor must have a
|
||||
label and a type name, and may have operands. */
|
||||
|
||||
: T_LABEL K_FUNCTOR T_SYMBOL ',' T_NUMBER ',' symbols ';'
|
||||
{ struct symbv_s obj = $7;
|
||||
compile_functor($1, $3, $5, obj.cnt, obj.vect);
|
||||
: T_LABEL K_FUNCTOR T_SYMBOL ',' symbols ';'
|
||||
{ struct symbv_s obj = $5;
|
||||
compile_functor($1, $3, obj.cnt, obj.vect);
|
||||
}
|
||||
|
||||
| T_LABEL K_FUNCTOR T_SYMBOL',' T_NUMBER ';'
|
||||
{ compile_functor($1, $3, $5, 0, 0); }
|
||||
{ compile_functor($1, $3, 0, 0); }
|
||||
|
||||
|
||||
/* UDP statements define or instantiate UDPs. Definitions take a
|
||||
|
|
@ -425,6 +426,11 @@ int compile_design(const char*path)
|
|||
|
||||
/*
|
||||
* $Log: parse.y,v $
|
||||
* Revision 1.24 2001/05/02 04:05:17 steve
|
||||
* Remove the init parameter of functors, and instead use
|
||||
* the special C<?> symbols to initialize inputs. This is
|
||||
* clearer and more regular.
|
||||
*
|
||||
* Revision 1.23 2001/05/01 01:09:39 steve
|
||||
* Add support for memory objects. (Stephan Boettcher)
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue