support the .event/or statement.
This commit is contained in:
parent
e1a4b457c2
commit
60d068a33e
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||||
*
|
*
|
||||||
* $Id: README.txt,v 1.14 2001/04/13 03:55:18 steve Exp $
|
* $Id: README.txt,v 1.15 2001/04/14 05:10:56 steve Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
VVP SIMULATION ENGINE
|
VVP SIMULATION ENGINE
|
||||||
|
|
@ -220,6 +220,15 @@ single symbol for the addressed bit. However, if there are several
|
||||||
events of the same edge in an event OR expression, the compiler may
|
events of the same edge in an event OR expression, the compiler may
|
||||||
combine up to 4 into a single event.
|
combine up to 4 into a single event.
|
||||||
|
|
||||||
|
If many more events need to be conbined together (for example due to
|
||||||
|
an event or expression in the Verilog) then this form can be used:
|
||||||
|
|
||||||
|
<label> .event/or <symbols_list>;
|
||||||
|
|
||||||
|
In this case, the symbols list all the events that are to be combined
|
||||||
|
to trigger this event. Only one of the input events needs to trigger
|
||||||
|
to make this one go.
|
||||||
|
|
||||||
|
|
||||||
THREAD STATEMENTS:
|
THREAD STATEMENTS:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.31 2001/04/13 03:55:18 steve Exp $"
|
#ident "$Id: compile.cc,v 1.32 2001/04/14 05:10:56 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "compile.h"
|
# include "compile.h"
|
||||||
|
|
@ -322,6 +322,7 @@ void compile_event(char*label, char*type,
|
||||||
obj->ival = 0xaa;
|
obj->ival = 0xaa;
|
||||||
obj->oval = 2;
|
obj->oval = 2;
|
||||||
obj->mode = 1;
|
obj->mode = 1;
|
||||||
|
obj->out = 0;
|
||||||
|
|
||||||
obj->event = (struct vvp_event_s*) malloc(sizeof (struct vvp_event_s));
|
obj->event = (struct vvp_event_s*) malloc(sizeof (struct vvp_event_s));
|
||||||
obj->event->threads = 0;
|
obj->event->threads = 0;
|
||||||
|
|
@ -353,6 +354,7 @@ void compile_named_event(char*label, char*name)
|
||||||
obj->ival = 0xaa;
|
obj->ival = 0xaa;
|
||||||
obj->oval = 2;
|
obj->oval = 2;
|
||||||
obj->mode = 2;
|
obj->mode = 2;
|
||||||
|
obj->out = 0;
|
||||||
|
|
||||||
obj->event = (struct vvp_event_s*) malloc(sizeof (struct vvp_event_s));
|
obj->event = (struct vvp_event_s*) malloc(sizeof (struct vvp_event_s));
|
||||||
obj->event->threads = 0;
|
obj->event->threads = 0;
|
||||||
|
|
@ -362,6 +364,48 @@ void compile_named_event(char*label, char*name)
|
||||||
free(name);
|
free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void compile_event_or(char*label, unsigned argc, struct symb_s*argv)
|
||||||
|
{
|
||||||
|
vvp_ipoint_t fdx = functor_allocate(1);
|
||||||
|
functor_t obj = functor_index(fdx);
|
||||||
|
|
||||||
|
{ symbol_value_t val;
|
||||||
|
val.num = fdx;
|
||||||
|
sym_set_value(sym_functors, label, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
obj->ival = 0xaa;
|
||||||
|
obj->oval = 2;
|
||||||
|
obj->mode = 2;
|
||||||
|
obj->out = 0;
|
||||||
|
|
||||||
|
obj->event = new struct vvp_event_s;
|
||||||
|
obj->event->threads = 0;
|
||||||
|
obj->event->ival = obj->ival;
|
||||||
|
|
||||||
|
/* Link the outputs of the named events to me. */
|
||||||
|
|
||||||
|
for (unsigned idx = 0 ; idx < argc ; idx += 1) {
|
||||||
|
symbol_value_t val = sym_get_value(sym_functors, argv[idx].text);
|
||||||
|
vvp_ipoint_t tmp = val.num;
|
||||||
|
|
||||||
|
assert(tmp);
|
||||||
|
|
||||||
|
tmp = ipoint_index(tmp, argv[idx].idx);
|
||||||
|
|
||||||
|
functor_t fport = functor_index(tmp);
|
||||||
|
assert(fport->out == 0);
|
||||||
|
fport->out = fdx;
|
||||||
|
|
||||||
|
free(argv[idx].text);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
free(argv);
|
||||||
|
|
||||||
|
free(label);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The parser uses this function to compile an link an executable
|
* The parser uses this function to compile an link an executable
|
||||||
* opcode. I do this by looking up the opcode in the opcode_table. The
|
* opcode. I do this by looking up the opcode in the opcode_table. The
|
||||||
|
|
@ -714,6 +758,9 @@ void compile_dump(FILE*fd)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.cc,v $
|
* $Log: compile.cc,v $
|
||||||
|
* Revision 1.32 2001/04/14 05:10:56 steve
|
||||||
|
* support the .event/or statement.
|
||||||
|
*
|
||||||
* Revision 1.31 2001/04/13 03:55:18 steve
|
* Revision 1.31 2001/04/13 03:55:18 steve
|
||||||
* More complete reap of all threads.
|
* More complete reap of all threads.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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.14 2001/04/05 01:34:26 steve Exp $"
|
#ident "$Id: compile.h,v 1.15 2001/04/14 05:10:56 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
|
|
@ -76,6 +76,8 @@ extern void compile_event(char*label, char*type,
|
||||||
|
|
||||||
extern void compile_named_event(char*label, char*name);
|
extern void compile_named_event(char*label, char*name);
|
||||||
|
|
||||||
|
extern void compile_event_or(char*label, unsigned argc, struct symb_s*argv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A code statement is a label, an opcode and up to 3 operands. There
|
* A code statement is a label, an opcode and up to 3 operands. There
|
||||||
* are a few lexical types that the parser recognizes of the operands,
|
* are a few lexical types that the parser recognizes of the operands,
|
||||||
|
|
@ -137,6 +139,9 @@ extern void compile_dump(FILE*fd);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: compile.h,v $
|
* $Log: compile.h,v $
|
||||||
|
* Revision 1.15 2001/04/14 05:10:56 steve
|
||||||
|
* support the .event/or statement.
|
||||||
|
*
|
||||||
* Revision 1.14 2001/04/05 01:34:26 steve
|
* Revision 1.14 2001/04/05 01:34:26 steve
|
||||||
* Add the .var/s and .net/s statements for VPI support.
|
* Add the .var/s and .net/s statements for VPI support.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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: functor.cc,v 1.10 2001/04/03 03:18:34 steve Exp $"
|
#ident "$Id: functor.cc,v 1.11 2001/04/14 05:10:56 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "functor.h"
|
# include "functor.h"
|
||||||
|
|
@ -190,6 +190,9 @@ static void functor_set_mode1(functor_t fp)
|
||||||
|
|
||||||
/* the new value is the new old value. */
|
/* the new value is the new old value. */
|
||||||
ep->ival = fp->ival;
|
ep->ival = fp->ival;
|
||||||
|
|
||||||
|
if (fp->out)
|
||||||
|
schedule_assign(fp->out, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -205,6 +208,9 @@ static void functor_set_mode2(functor_t fp)
|
||||||
ep->threads = 0;
|
ep->threads = 0;
|
||||||
vthread_schedule_list(tmp);
|
vthread_schedule_list(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fp->out)
|
||||||
|
schedule_assign(fp->out, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -300,6 +306,9 @@ const unsigned char ft_var[16] = {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: functor.cc,v $
|
* $Log: functor.cc,v $
|
||||||
|
* Revision 1.11 2001/04/14 05:10:56 steve
|
||||||
|
* support the .event/or statement.
|
||||||
|
*
|
||||||
* Revision 1.10 2001/04/03 03:18:34 steve
|
* Revision 1.10 2001/04/03 03:18:34 steve
|
||||||
* support functor_set push for blocking assignment.
|
* support functor_set push for blocking assignment.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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: functor.h,v 1.10 2001/04/04 17:43:19 steve Exp $"
|
#ident "$Id: functor.h,v 1.11 2001/04/14 05:10:56 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "pointers.h"
|
# include "pointers.h"
|
||||||
|
|
@ -27,6 +27,11 @@
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
*
|
||||||
|
* The major mode is selected by the mode parameter.
|
||||||
|
*
|
||||||
|
* MODE 0: TABLE MODE FUNCTORS
|
||||||
|
*
|
||||||
* The vvp_ipoint_t is an integral type that is 32bits. The low 2 bits
|
* The vvp_ipoint_t is an integral type that is 32bits. The low 2 bits
|
||||||
* select the port of the referenced functor, and the remaining 30
|
* select the port of the referenced functor, and the remaining 30
|
||||||
* index the functor itself. All together, the 32 bits can completely
|
* index the functor itself. All together, the 32 bits can completely
|
||||||
|
|
@ -50,10 +55,26 @@
|
||||||
* output value is picked from the lookup table that the table pointer
|
* output value is picked from the lookup table that the table pointer
|
||||||
* points to.
|
* points to.
|
||||||
*
|
*
|
||||||
* If the functor is an event functor, however, the event member
|
* MODE 1: EDGE EVENT FUNCTORS
|
||||||
* points to an extended structure where thread state is stored.
|
|
||||||
*
|
*
|
||||||
* The major mode is selected by the mode parameter.
|
* These functors take inputs like mode 0 functors, but the input is
|
||||||
|
* compared with the preveous input for that bit, and the results of
|
||||||
|
* that comparison are used to detect edges. The functor may be
|
||||||
|
* programmed to detect posedge, negedge, or any edge events. These
|
||||||
|
* functors can have %wait instructions waiting on them.
|
||||||
|
*
|
||||||
|
* MODE 2: NAMED EVENT FUNCTORS
|
||||||
|
*
|
||||||
|
* These fuctors do not bother to check for edges. Any event on the
|
||||||
|
* input causes an event to be detected. Like mode-1 functors, these
|
||||||
|
* can have %wait instructions waiting on them. Mode-2 functors do not
|
||||||
|
* have structural inputs, however. They take their inputs from %set
|
||||||
|
* instructions.
|
||||||
|
*
|
||||||
|
* Mode-2 events can also be used to combine other mode-1 and mode-2
|
||||||
|
* functors by setting their outputs to put to the mode-2
|
||||||
|
* functor. Since the mode-2 functor does not take input, any number
|
||||||
|
* of mode-1 and mode-2 functors may point in.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct functor_s {
|
struct functor_s {
|
||||||
|
|
@ -155,6 +176,9 @@ extern const unsigned char ft_var[];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: functor.h,v $
|
* $Log: functor.h,v $
|
||||||
|
* Revision 1.11 2001/04/14 05:10:56 steve
|
||||||
|
* support the .event/or statement.
|
||||||
|
*
|
||||||
* Revision 1.10 2001/04/04 17:43:19 steve
|
* Revision 1.10 2001/04/04 17:43:19 steve
|
||||||
* support decimal strings from signals.
|
* support decimal strings from signals.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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: lexor.lex,v 1.11 2001/04/05 01:34:26 steve Exp $"
|
#ident "$Id: lexor.lex,v 1.12 2001/04/14 05:10:56 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
|
|
||||||
/* A label is any non-blank text that appears left justified. */
|
/* A label is any non-blank text that appears left justified. */
|
||||||
^[.$_a-zA-Z][.$_a-zA-Z0-9<>]* {
|
^[.$_a-zA-Z][.$_a-zA-Z0-9<>/]* {
|
||||||
yylval.text = strdup(yytext);
|
yylval.text = strdup(yytext);
|
||||||
return T_LABEL; }
|
return T_LABEL; }
|
||||||
|
|
||||||
|
|
@ -66,6 +66,7 @@
|
||||||
|
|
||||||
/* These are some keywords that are recognized. */
|
/* These are some keywords that are recognized. */
|
||||||
".event" { return K_EVENT; }
|
".event" { return K_EVENT; }
|
||||||
|
".event/or" { return K_EVENT_OR; }
|
||||||
".functor" { return K_FUNCTOR; }
|
".functor" { return K_FUNCTOR; }
|
||||||
".net" { return K_NET; }
|
".net" { return K_NET; }
|
||||||
".net/s" { return K_NET_S; }
|
".net/s" { return K_NET_S; }
|
||||||
|
|
@ -98,7 +99,7 @@
|
||||||
|
|
||||||
/* Symbols are pretty much what is left. They are used to refer to
|
/* Symbols are pretty much what is left. They are used to refer to
|
||||||
labels so the rule must match a string that a label would match. */
|
labels so the rule must match a string that a label would match. */
|
||||||
[.$_a-zA-Z][.$_a-zA-Z0-9<>]* {
|
[.$_a-zA-Z][.$_a-zA-Z0-9<>/]* {
|
||||||
yylval.text = strdup(yytext);
|
yylval.text = strdup(yytext);
|
||||||
return T_SYMBOL; }
|
return T_SYMBOL; }
|
||||||
|
|
||||||
|
|
@ -125,6 +126,9 @@ int yywrap()
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: lexor.lex,v $
|
* $Log: lexor.lex,v $
|
||||||
|
* Revision 1.12 2001/04/14 05:10:56 steve
|
||||||
|
* support the .event/or statement.
|
||||||
|
*
|
||||||
* Revision 1.11 2001/04/05 01:34:26 steve
|
* Revision 1.11 2001/04/05 01:34:26 steve
|
||||||
* Add the .var/s and .net/s statements for VPI support.
|
* Add the .var/s and .net/s statements for VPI support.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
13
vvp/parse.y
13
vvp/parse.y
|
|
@ -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.18 2001/04/05 01:34:26 steve Exp $"
|
#ident "$Id: parse.y,v 1.19 2001/04/14 05:10:56 steve Exp $"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# include "parse_misc.h"
|
# include "parse_misc.h"
|
||||||
|
|
@ -51,7 +51,7 @@ extern FILE*yyin;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
%token K_EVENT K_FUNCTOR K_NET K_NET_S K_SCOPE K_THREAD
|
%token K_EVENT K_EVENT_OR K_FUNCTOR K_NET K_NET_S K_SCOPE K_THREAD
|
||||||
%token K_VAR K_VAR_S K_vpi_call
|
%token K_VAR K_VAR_S K_vpi_call
|
||||||
%token K_vpi_module
|
%token K_vpi_module
|
||||||
|
|
||||||
|
|
@ -122,6 +122,12 @@ statement
|
||||||
| T_LABEL K_EVENT T_STRING ';'
|
| T_LABEL K_EVENT T_STRING ';'
|
||||||
{ compile_named_event($1, $3); }
|
{ compile_named_event($1, $3); }
|
||||||
|
|
||||||
|
| T_LABEL K_EVENT_OR symbols ';'
|
||||||
|
{ struct symbv_s obj = $3;
|
||||||
|
compile_event_or($1, obj.cnt, obj.vect);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Instructions may have a label, and have zero or more
|
/* Instructions may have a label, and have zero or more
|
||||||
operands. The meaning of and restrictions on the operands depends
|
operands. The meaning of and restrictions on the operands depends
|
||||||
on the specific instruction. */
|
on the specific instruction. */
|
||||||
|
|
@ -323,6 +329,9 @@ int compile_design(const char*path)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $Log: parse.y,v $
|
* $Log: parse.y,v $
|
||||||
|
* Revision 1.19 2001/04/14 05:10:56 steve
|
||||||
|
* support the .event/or statement.
|
||||||
|
*
|
||||||
* Revision 1.18 2001/04/05 01:34:26 steve
|
* Revision 1.18 2001/04/05 01:34:26 steve
|
||||||
* Add the .var/s and .net/s statements for VPI support.
|
* Add the .var/s and .net/s statements for VPI support.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue