Detect undefined system tasks at compile time.
This commit is contained in:
parent
b3c24adb11
commit
548ff4f89a
|
|
@ -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.10 2001/03/22 05:28:41 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.11 2001/03/22 22:38:13 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compile.h"
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
# include <stdlib.h>
|
||||
# include <assert.h>
|
||||
|
||||
unsigned compile_errors = 0;
|
||||
|
||||
/*
|
||||
* The opcode table lists all the code mnemonics, along with their
|
||||
|
|
@ -367,6 +368,8 @@ void compile_vpi_call(char*label, char*name, unsigned argc, vpiHandle*argv)
|
|||
/* Create a vpiHandle that bundles the call information, and
|
||||
store that handle in the instruction. */
|
||||
code->handle = vpip_build_vpi_call(name, argc, argv);
|
||||
if (code->handle == 0)
|
||||
compile_errors += 1;
|
||||
|
||||
/* Done with the lexor-allocated name string. */
|
||||
free(name);
|
||||
|
|
@ -515,6 +518,9 @@ void compile_dump(FILE*fd)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.11 2001/03/22 22:38:13 steve
|
||||
* Detect undefined system tasks at compile time.
|
||||
*
|
||||
* Revision 1.10 2001/03/22 05:28:41 steve
|
||||
* Add code label forward references.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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.7 2001/03/21 05:13:03 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.8 2001/03/22 22:38:14 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -39,6 +39,12 @@ extern void compile_init(void);
|
|||
|
||||
extern void compile_cleanup(void);
|
||||
|
||||
/*
|
||||
* This is a count of errors encountered during compilation. If this
|
||||
* is non-zero, then simulation is not recommended.
|
||||
*/
|
||||
extern unsigned compile_errors;
|
||||
|
||||
/*
|
||||
* This function is called by the parser to compile a functor
|
||||
* statement. The strings passed in are allocated by the lexor, but
|
||||
|
|
@ -111,6 +117,9 @@ extern void compile_dump(FILE*fd);
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.8 2001/03/22 22:38:14 steve
|
||||
* Detect undefined system tasks at compile time.
|
||||
*
|
||||
* Revision 1.7 2001/03/21 05:13:03 steve
|
||||
* Allow var objects as vpiHandle arguments to %vpi_call.
|
||||
*
|
||||
|
|
|
|||
11
vvp/main.cc
11
vvp/main.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: main.cc,v 1.5 2001/03/22 21:26:54 steve Exp $"
|
||||
#ident "$Id: main.cc,v 1.6 2001/03/22 22:38:14 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "config.h"
|
||||
|
|
@ -83,6 +83,12 @@ int main(int argc, char*argv[])
|
|||
fclose(fd);
|
||||
}
|
||||
|
||||
if (compile_errors > 0) {
|
||||
fprintf(stderr, "%s: Program not runnable, %u errors.\n",
|
||||
design_path, compile_errors);
|
||||
return compile_errors;
|
||||
}
|
||||
|
||||
schedule_simulate();
|
||||
|
||||
return 0;
|
||||
|
|
@ -90,6 +96,9 @@ int main(int argc, char*argv[])
|
|||
|
||||
/*
|
||||
* $Log: main.cc,v $
|
||||
* Revision 1.6 2001/03/22 22:38:14 steve
|
||||
* Detect undefined system tasks at compile time.
|
||||
*
|
||||
* Revision 1.5 2001/03/22 21:26:54 steve
|
||||
* Compile in a default VPI module dir.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
#! /bin/sh
|
||||
# mkinstalldirs --- make directory hierarchy
|
||||
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
|
||||
# Created: 1993-05-16
|
||||
# Public domain
|
||||
|
||||
# $Id: mkinstalldirs,v 1.1 2001/03/22 22:38:14 steve Exp $
|
||||
|
||||
errstatus=0
|
||||
|
||||
for file
|
||||
do
|
||||
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
|
||||
shift
|
||||
|
||||
pathcomp=
|
||||
for d
|
||||
do
|
||||
pathcomp="$pathcomp$d"
|
||||
case "$pathcomp" in
|
||||
-* ) pathcomp=./$pathcomp ;;
|
||||
esac
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
echo "mkdir $pathcomp" 1>&2
|
||||
|
||||
mkdir "$pathcomp" || lasterr=$?
|
||||
|
||||
if test ! -d "$pathcomp"; then
|
||||
errstatus=$lasterr
|
||||
fi
|
||||
fi
|
||||
|
||||
pathcomp="$pathcomp/"
|
||||
done
|
||||
done
|
||||
|
||||
exit $errstatus
|
||||
|
||||
# mkinstalldirs ends here
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#if !defined(WINNT)
|
||||
#ident "$Id: vpi_tasks.cc,v 1.3 2001/03/18 04:35:18 steve Exp $"
|
||||
#ident "$Id: vpi_tasks.cc,v 1.4 2001/03/22 22:38:14 steve Exp $"
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -152,6 +152,13 @@ vpiHandle vpip_build_vpi_call(const char*name,
|
|||
obj->nargs = argc;
|
||||
obj->args = argv;
|
||||
|
||||
if (obj->defn == 0) {
|
||||
fprintf(stderr, "%s: This task not defined "
|
||||
"by any modules. I cannot compile it.\n", name);
|
||||
free(obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* If there is a compiletf function, call it here. */
|
||||
if (obj->defn->info.compiletf)
|
||||
obj->defn->info.compiletf (obj->defn->info.user_data);
|
||||
|
|
@ -190,6 +197,9 @@ void vpi_register_systf(const struct t_vpi_systf_data*ss)
|
|||
|
||||
/*
|
||||
* $Log: vpi_tasks.cc,v $
|
||||
* Revision 1.4 2001/03/22 22:38:14 steve
|
||||
* Detect undefined system tasks at compile time.
|
||||
*
|
||||
* Revision 1.3 2001/03/18 04:35:18 steve
|
||||
* Add support for string constants to VPI.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue