support postpone of $systask parameters. (Stephan Boettcher)

This commit is contained in:
steve 2001-07-11 04:43:57 +00:00
parent 7b2d4c9ef6
commit 4e700bffb8
6 changed files with 101 additions and 52 deletions

View File

@ -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.86 2001/07/07 02:57:33 steve Exp $"
#ident "$Id: compile.cc,v 1.87 2001/07/11 04:43:57 steve Exp $"
#endif
# include "arith.h"
@ -1110,33 +1110,6 @@ void compile_codelabel(char*label)
}
struct postponed_handles_list_s {
struct postponed_handles_list_s*next;
vpiHandle *handle;
char*name;
};
static struct postponed_handles_list_s *late_handles;
static vpiHandle postpone_vpi_symbol_lookup(vpiHandle *handle,
char*name)
{
*handle = compile_vpi_lookup(name);
if (*handle)
free(name);
else {
struct postponed_handles_list_s*res =
(struct postponed_handles_list_s*)
malloc(sizeof(struct postponed_handles_list_s));
res->handle = handle;
res->name = name;
res->next = late_handles;
late_handles = res;
}
return *handle;
}
void compile_disable(char*label, struct symb_s symb)
{
vvp_cpoint_t ptr = codespace_allocate();
@ -1155,7 +1128,7 @@ void compile_disable(char*label, struct symb_s symb)
vvp_code_t code = codespace_index(ptr);
code->opcode = of_DISABLE;
postpone_vpi_symbol_lookup(&code->handle, symb.text);
compile_vpi_lookup(&code->handle, symb.text);
free(label);
}
@ -1198,7 +1171,7 @@ void compile_fork(char*label, struct symb_s dest, struct symb_s scope)
}
/* Figure out the target SCOPE. */
postpone_vpi_symbol_lookup((vpiHandle*)&code->fork->scope, scope.text);
compile_vpi_lookup((vpiHandle*)&code->fork->scope, scope.text);
free(label);
free(dest.text);
@ -1281,7 +1254,16 @@ void compile_thread(char*start_sym)
free(start_sym);
}
vpiHandle compile_vpi_lookup(const char*label)
struct postponed_handles_list_s {
struct postponed_handles_list_s*next;
vpiHandle *handle;
char*name;
};
static struct postponed_handles_list_s *late_handles;
void compile_vpi_lookup(vpiHandle *handle, char*label)
{
symbol_value_t val;
@ -1301,7 +1283,20 @@ vpiHandle compile_vpi_lookup(const char*label)
// check for memory word M<mem,base,wid>
}
return (vpiHandle) val.ptr;
if (!val.ptr) {
struct postponed_handles_list_s*res =
(struct postponed_handles_list_s*)
malloc(sizeof(struct postponed_handles_list_s));
res->handle = handle;
res->name = label;
res->next = late_handles;
late_handles = res;
} else {
free(label);
}
*handle = (vpiHandle) val.ptr;
}
/*
@ -1520,7 +1515,7 @@ void compile_cleanup(void)
while (lhandle) {
struct postponed_handles_list_s *tmp = lhandle;
lhandle = lhandle->next;
postpone_vpi_symbol_lookup(tmp->handle, tmp->name);
compile_vpi_lookup(tmp->handle, tmp->name);
free(tmp);
}
lhandle = late_handles;
@ -1549,6 +1544,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/*
* $Log: compile.cc,v $
* Revision 1.87 2001/07/11 04:43:57 steve
* support postpone of $systask parameters. (Stephan Boettcher)
*
* Revision 1.86 2001/07/07 02:57:33 steve
* Add the .shift/r functor.
*

View File

@ -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.31 2001/07/07 02:57:33 steve Exp $"
#ident "$Id: compile.h,v 1.32 2001/07/11 04:43:57 steve Exp $"
#endif
# include <stdio.h>
@ -92,7 +92,7 @@ extern void compile_shiftr(char*label, long width,
extern void compile_vpi_symbol(const char*label, vpiHandle obj);
extern vpiHandle compile_vpi_lookup(const char*label);
extern void compile_vpi_lookup(vpiHandle *objref, char*label);
/*
* The `compile_udp_def' function creates a UDP. The `table' is a
@ -204,6 +204,9 @@ extern void compile_net(char*label, char*name,
/*
* $Log: compile.h,v $
* Revision 1.32 2001/07/11 04:43:57 steve
* support postpone of $systask parameters. (Stephan Boettcher)
*
* Revision 1.31 2001/07/07 02:57:33 steve
* Add the .shift/r functor.
*

View File

@ -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.35 2001/07/07 02:57:33 steve Exp $"
#ident "$Id: parse.y,v 1.36 2001/07/11 04:43:57 steve Exp $"
#endif
# include "parse_misc.h"
@ -345,14 +345,20 @@ operand
the struct argv_s type.
Each argument of the call is represented as a vpiHandle
object. If the argument is a symbol, it is located in the sym_vpi
symbol table. if it is someother supported object, the necessary
object. If the argument is a symbol, the symbol name will be
kept, until the argument_list is complete. Then, all symbol
lookups will be attemted. Postoned lookups will point into the
resulting $$->argv.
If it is some other supported object, the necessary
vpiHandle object is created to support it. */
argument_opt
: ',' argument_list
{ $$ = $2; }
|
{
argv_sym_lookup(&$2);
$$ = $2;
}
| /* empty */
{ struct argv_s tmp;
argv_init(&tmp);
$$ = tmp;
@ -371,13 +377,22 @@ argument_list
argv_add(&tmp, $3);
$$ = tmp;
}
| T_SYMBOL
{ struct argv_s tmp;
argv_init(&tmp);
argv_sym_add(&tmp, $1);
$$ = tmp;
}
| argument_list ',' T_SYMBOL
{ struct argv_s tmp = $1;
argv_sym_add(&tmp, $3);
$$ = tmp;
}
;
argument
: T_STRING
{ $$ = vpip_make_string_const($1); }
| T_SYMBOL
{ $$ = compile_vpi_lookup($1); free($1); }
| T_VECTOR
{ $$ = vpip_make_binary_const($1.idx, $1.text); }
;
@ -489,6 +504,9 @@ int compile_design(const char*path)
/*
* $Log: parse.y,v $
* Revision 1.36 2001/07/11 04:43:57 steve
* support postpone of $systask parameters. (Stephan Boettcher)
*
* Revision 1.35 2001/07/07 02:57:33 steve
* Add the .shift/r functor.
*

View File

@ -17,10 +17,11 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: parse_misc.cc,v 1.5 2001/05/02 23:16:50 steve Exp $"
#ident "$Id: parse_misc.cc,v 1.6 2001/07/11 04:43:57 steve Exp $"
#endif
# include "parse_misc.h"
# include "compile.h"
# include <stdio.h>
# include <malloc.h>
@ -63,6 +64,7 @@ void argv_init(struct argv_s*obj)
{
obj->argc = 0;
obj->argv = 0;
obj->syms = 0;
}
void argv_add(struct argv_s*obj, vpiHandle item)
@ -73,8 +75,29 @@ void argv_add(struct argv_s*obj, vpiHandle item)
obj->argc += 1;
}
void argv_sym_add(struct argv_s*obj, char *item)
{
argv_add(obj, 0x0);
obj->syms = (char**)
realloc(obj->syms, (obj->argc)*sizeof(char*));
obj->syms[obj->argc-1] = item;
}
void argv_sym_lookup(struct argv_s*obj)
{
if (!obj->syms)
return;
for (unsigned i=0; i < obj->argc; i++)
if (!obj->argv[i])
compile_vpi_lookup(&obj->argv[i], obj->syms[i]);
free(obj->syms);
}
/*
* $Log: parse_misc.cc,v $
* Revision 1.6 2001/07/11 04:43:57 steve
* support postpone of $systask parameters. (Stephan Boettcher)
*
* Revision 1.5 2001/05/02 23:16:50 steve
* Document memory related opcodes,
* parser uses numbv_s structures instead of the

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: parse_misc.h,v 1.5 2001/05/02 23:16:50 steve Exp $"
#ident "$Id: parse_misc.h,v 1.6 2001/07/11 04:43:57 steve Exp $"
#endif
@ -64,18 +64,22 @@ struct numbv_s {
extern void numbv_init(struct numbv_s*obj);
extern void numbv_add(struct numbv_s*obj, long item);
struct argv_s {
unsigned argc;
vpiHandle*argv;
char **syms;
};
extern void argv_init(struct argv_s*obj);
extern void argv_add(struct argv_s*obj, vpiHandle);
extern void argv_sym_add(struct argv_s*obj, char *);
extern void argv_sym_lookup(struct argv_s*obj);
/*
* $Log: parse_misc.h,v $
* Revision 1.6 2001/07/11 04:43:57 steve
* support postpone of $systask parameters. (Stephan Boettcher)
*
* Revision 1.5 2001/05/02 23:16:50 steve
* Document memory related opcodes,
* parser uses numbv_s structures instead of the

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#if !defined(WINNT)
#ident "$Id: vpi_scope.cc,v 1.5 2001/06/10 16:47:49 steve Exp $"
#ident "$Id: vpi_scope.cc,v 1.6 2001/07/11 04:43:57 steve Exp $"
#endif
# include "compile.h"
@ -107,18 +107,18 @@ void compile_scope_decl(char*label, char*name, char*parent)
free(label);
if (parent) {
vpiHandle obj = compile_vpi_lookup(parent);
static vpiHandle obj;
compile_vpi_lookup(&obj, parent);
assert(obj);
struct __vpiScope*sp = (struct __vpiScope*) obj;
attach_to_scope_(sp, &scope->base);
free(parent);
}
}
void compile_scope_recall(char*symbol)
{
vpiHandle obj = compile_vpi_lookup(symbol);
current_scope = (struct __vpiScope*)obj;
free(symbol);
compile_vpi_lookup((vpiHandle*)&current_scope, symbol);
assert(current_scope);
}
struct __vpiScope* vpip_peek_current_scope(void)
@ -134,6 +134,9 @@ void vpip_attach_to_current_scope(vpiHandle obj)
/*
* $Log: vpi_scope.cc,v $
* Revision 1.6 2001/07/11 04:43:57 steve
* support postpone of $systask parameters. (Stephan Boettcher)
*
* Revision 1.5 2001/06/10 16:47:49 steve
* support scan of scope from VPI.
*