mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-22 05:47:31 +02:00
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:
+16
-13
@@ -17,7 +17,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#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
|
#endif
|
||||||
|
|
||||||
# include "vvp_priv.h"
|
# include "vvp_priv.h"
|
||||||
@@ -241,7 +241,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||||||
{
|
{
|
||||||
unsigned pdx;
|
unsigned pdx;
|
||||||
const char*ltype = "?";
|
const char*ltype = "?";
|
||||||
unsigned init_val = 0;
|
char identity_val = '0';
|
||||||
|
|
||||||
|
|
||||||
switch (ivl_logic_type(lptr)) {
|
switch (ivl_logic_type(lptr)) {
|
||||||
@@ -264,7 +264,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||||||
|
|
||||||
case IVL_LO_AND:
|
case IVL_LO_AND:
|
||||||
ltype = "AND";
|
ltype = "AND";
|
||||||
init_val = 0x55;
|
identity_val = '1';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IVL_LO_BUF:
|
case IVL_LO_BUF:
|
||||||
@@ -281,6 +281,7 @@ static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|||||||
|
|
||||||
case IVL_LO_NAND:
|
case IVL_LO_NAND:
|
||||||
ltype = "NAND";
|
ltype = "NAND";
|
||||||
|
identity_val = '1';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IVL_LO_NOR:
|
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);
|
assert(ivl_logic_pins(lptr) <= 5);
|
||||||
|
|
||||||
for (pdx = 1 ; pdx < ivl_logic_pins(lptr) ; pdx += 1) {
|
fprintf(vvp_out, "L_%s .functor %s", ivl_logic_name(lptr), ltype);
|
||||||
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);
|
|
||||||
|
|
||||||
for (pdx = 1 ; pdx < ivl_logic_pins(lptr) ; pdx += 1) {
|
for (pdx = 1 ; pdx < ivl_logic_pins(lptr) ; pdx += 1) {
|
||||||
ivl_nexus_t nex = ivl_logic_pin(lptr, pdx);
|
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);
|
draw_nexus_input(nex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for ( ; pdx < 5 ; pdx += 1) {
|
||||||
|
fprintf(vvp_out, ", C<%c>", identity_val);
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(vvp_out, ";\n");
|
fprintf(vvp_out, ";\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -424,15 +423,14 @@ static void draw_lpm_mux(ivl_lpm_t net)
|
|||||||
for (idx = 0 ; idx < width ; idx += 1) {
|
for (idx = 0 ; idx < width ; idx += 1) {
|
||||||
ivl_nexus_t a = ivl_lpm_data2(net, 0, idx);
|
ivl_nexus_t a = ivl_lpm_data2(net, 0, idx);
|
||||||
ivl_nexus_t b = ivl_lpm_data2(net, 1, 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);
|
ivl_lpm_name(net), idx);
|
||||||
fprintf(vvp_out, ", ");
|
|
||||||
draw_nexus_input(a);
|
draw_nexus_input(a);
|
||||||
fprintf(vvp_out, ", ");
|
fprintf(vvp_out, ", ");
|
||||||
draw_nexus_input(b);
|
draw_nexus_input(b);
|
||||||
fprintf(vvp_out, ", ");
|
fprintf(vvp_out, ", ");
|
||||||
draw_nexus_input(s);
|
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 $
|
* $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
|
* Revision 1.22 2001/04/30 00:00:27 steve
|
||||||
* detect multiple drivers on nexa.
|
* detect multiple drivers on nexa.
|
||||||
*
|
*
|
||||||
|
|||||||
+12
-16
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Stephen Williams ([email protected])
|
* Copyright (c) 2001 Stephen Williams ([email protected])
|
||||||
*
|
*
|
||||||
* $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
|
VVP SIMULATION ENGINE
|
||||||
@@ -87,23 +87,19 @@ label is required for functors.
|
|||||||
|
|
||||||
The general syntax of a functor is:
|
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
|
The symbol list is 4 names of labels of other functors. These connect
|
||||||
connect inputs of the functor of the statement to the output of other
|
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
|
functors. If the input is unconnected, use a C<?> symbol instead. The
|
||||||
program. The references .ftype describes the behavoir of the
|
type selects the truth lookup table to use for the functor
|
||||||
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
|
The initial values of all the inputs and the output is x. Any other
|
||||||
LSB is port 0, and the MSB port 3. If there are any constant inputs,
|
value is passed around as run-time behavior. If the inputs have C<?>
|
||||||
then the constantat the input becomes the initial value of the
|
symbols, then the inputs are initialized to the specified bit value,
|
||||||
corresponding input, replacing the value given in the <init>
|
and if this causes the output to be something other then x, a
|
||||||
position. Also, the output of the functor is calculated at compile
|
propagation event is created to be executed at the start of run time.
|
||||||
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.
|
|
||||||
|
|
||||||
Almost all of the structural aspects of a simulation can be
|
Almost all of the structural aspects of a simulation can be
|
||||||
represented by functors, which perform the very basic task of
|
represented by functors, which perform the very basic task of
|
||||||
|
|||||||
+8
-4
@@ -17,7 +17,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#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
|
#endif
|
||||||
|
|
||||||
# include "compile.h"
|
# 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, and map the name to the vvp_ipoint_t address for the
|
||||||
* functor. Also resolve the inputs to the functor.
|
* functor. Also resolve the inputs to the functor.
|
||||||
*/
|
*/
|
||||||
void compile_functor(char*label, char*type, unsigned init,
|
void compile_functor(char*label, char*type, unsigned argc, struct symb_s*argv)
|
||||||
unsigned argc, struct symb_s*argv)
|
|
||||||
{
|
{
|
||||||
vvp_ipoint_t fdx = functor_allocate(1);
|
vvp_ipoint_t fdx = functor_allocate(1);
|
||||||
functor_t obj = functor_index(fdx);
|
functor_t obj = functor_index(fdx);
|
||||||
@@ -297,7 +296,7 @@ void compile_functor(char*label, char*type, unsigned init,
|
|||||||
|
|
||||||
assert(argc <= 4);
|
assert(argc <= 4);
|
||||||
|
|
||||||
obj->ival = init;
|
obj->ival = 0x33;
|
||||||
obj->oval = 2;
|
obj->oval = 2;
|
||||||
obj->mode = 0;
|
obj->mode = 0;
|
||||||
|
|
||||||
@@ -1065,6 +1064,11 @@ void compile_dump(FILE*fd)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.cc,v $
|
* $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
|
* Revision 1.51 2001/05/02 01:57:25 steve
|
||||||
* Support behavioral subtraction.
|
* Support behavioral subtraction.
|
||||||
*
|
*
|
||||||
|
|||||||
+7
-2
@@ -19,7 +19,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#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
|
#endif
|
||||||
|
|
||||||
# include <stdio.h>
|
# 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
|
* of the functor. The compile should match those port parameters up
|
||||||
* to existing functors to manage the linking.
|
* 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);
|
unsigned argc, struct symb_s*argv);
|
||||||
|
|
||||||
|
|
||||||
@@ -174,6 +174,11 @@ extern void compile_dump(FILE*fd);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.h,v $
|
* $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
|
* Revision 1.19 2001/05/01 01:09:39 steve
|
||||||
* Add support for memory objects. (Stephan Boettcher)
|
* Add support for memory objects. (Stephan Boettcher)
|
||||||
*
|
*
|
||||||
|
|||||||
+11
-5
@@ -19,7 +19,7 @@
|
|||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
*/
|
||||||
#if !defined(WINNT)
|
#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
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
@@ -107,12 +107,13 @@ statement
|
|||||||
/* Functor statements define functors. The functor must have a
|
/* 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. */
|
||||||
|
|
||||||
: T_LABEL K_FUNCTOR T_SYMBOL ',' T_NUMBER ',' symbols ';'
|
: T_LABEL K_FUNCTOR T_SYMBOL ',' symbols ';'
|
||||||
{ struct symbv_s obj = $7;
|
{ struct symbv_s obj = $5;
|
||||||
compile_functor($1, $3, $5, obj.cnt, obj.vect);
|
compile_functor($1, $3, obj.cnt, obj.vect);
|
||||||
}
|
}
|
||||||
|
|
||||||
| T_LABEL K_FUNCTOR T_SYMBOL',' T_NUMBER ';'
|
| 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
|
/* UDP statements define or instantiate UDPs. Definitions take a
|
||||||
@@ -425,6 +426,11 @@ int compile_design(const char*path)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: parse.y,v $
|
* $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
|
* Revision 1.23 2001/05/01 01:09:39 steve
|
||||||
* Add support for memory objects. (Stephan Boettcher)
|
* Add support for memory objects. (Stephan Boettcher)
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user