Separate out the lookup_sys_func table, for eventual

support for function type tables.

 Remove ipal compile flags.
This commit is contained in:
steve 2004-03-09 04:29:42 +00:00
parent 20b7a23bde
commit a0ed5e9e29
5 changed files with 110 additions and 75 deletions

View File

@ -16,7 +16,7 @@
# 59 Temple Place - Suite 330
# Boston, MA 02111-1307, USA
#
#ident "$Id: Makefile.in,v 1.162 2004/02/10 19:25:00 steve Exp $"
#ident "$Id: Makefile.in,v 1.163 2004/03/09 04:29:42 steve Exp $"
#
#
SHELL = /bin/sh
@ -64,9 +64,6 @@ LDFLAGS = @rdynamic@ @LDFLAGS@
# installed. Some of them depend on external things, so are only
# compiled if the prerequisites are installed.
TARGETS = tgt-null
ifeq ('@HAVE_IPAL@','yes')
TARGETS += tgt-pal
endif
all: dep ivl@EXEEXT@
for dir in $(SUBDIRS); do (cd $$dir ; $(MAKE) $@); done
@ -125,7 +122,7 @@ net_design.o net_event.o net_expr.o net_force.o net_func.o \
net_link.o net_modulo.o net_nex_input.o net_nex_output.o \
net_proc.o net_scope.o net_udp.o net_variable.o pad_to_width.o \
parse.o parse_misc.o pform.o pform_dump.o \
set_width.o symbol_search.o sync.o \
set_width.o symbol_search.o sync.o sys_funcs.o \
verinum.o verireal.o target.o targets.o \
Attrib.o HName.o LineInfo.o Module.o PData.o PDelays.o PEvent.o \
PExpr.o PGate.o \
@ -145,12 +142,12 @@ ivl@EXEEXT@: $O ivl.def
$(CXX) -o ivl@EXEEXT@ $O $(dllib) @EXTRALIBS@
dlltool --dllname ivl@EXEEXT@ --def ivl.def \
--output-lib libivl.a --output-exp ivl.exp
$(CXX) -o ivl@EXEEXT@ ivl.exp $O $(dllib) @EXTRALIBS@
$(CXX) -o ivl@EXEEXT@ ivl.exp $O $(dllib) @EXTRALIBS@
else
ivl@EXEEXT@: $O
$(CXX) $(LDFLAGS) -o ivl@EXEEXT@ $O $(dllib)
endif
endif
ifeq (@WIN32@,yes)

View File

@ -1,7 +1,7 @@
#ifndef __compiler_H
#define __compiler_H
/*
* Copyright (c) 1999-2000 Stephen Williams (steve@icarus.com)
* Copyright (c) 1999-2004 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
@ -19,12 +19,12 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: compiler.h,v 1.20 2004/02/18 17:11:54 steve Exp $"
#ident "$Id: compiler.h,v 1.21 2004/03/09 04:29:42 steve Exp $"
#endif
# include <list>
# include <map>
# include <string>
# include "netlist.h"
# include "StringHeap.h"
/*
@ -111,8 +111,32 @@ extern map<perm_string,unsigned> missing_modules;
*/
extern StringHeapLex lex_strings;
/*
* system task/function listings.
*/
/*
* This table describes all the return values of various system
* functions. This table is used to elaborate expressions that are
* system function calls.
*/
struct sfunc_return_type {
const char* name;
NetExpr::TYPE type;
unsigned wid;
int signed_flag;
};
extern const struct sfunc_return_type* lookup_sys_func(const char*name);
/*
* $Log: compiler.h,v $
* Revision 1.21 2004/03/09 04:29:42 steve
* Separate out the lookup_sys_func table, for eventual
* support for function type tables.
*
* Remove ipal compile flags.
*
* Revision 1.20 2004/02/18 17:11:54 steve
* Use perm_strings for named langiage items.
*
@ -136,29 +160,5 @@ extern StringHeapLex lex_strings;
*
* Revision 1.14 2003/01/30 16:23:07 steve
* Spelling fixes.
*
* Revision 1.13 2002/08/12 01:34:58 steve
* conditional ident string using autoconfig.
*
* Revision 1.12 2002/05/28 20:40:37 steve
* ivl indexes the search path for libraries, and
* supports case insensitive module-to-file lookup.
*
* Revision 1.11 2002/05/28 00:50:39 steve
* Add the ivl -C flag for bulk configuration
* from the driver, and use that to run library
* modules through the preprocessor.
*
* Revision 1.10 2002/05/24 01:13:00 steve
* Support language generation flag -g.
*
* Revision 1.9 2002/04/22 00:53:39 steve
* Do not allow implicit wires in sensitivity lists.
*
* Revision 1.8 2002/04/15 00:04:22 steve
* Timescale warnings.
*
* Revision 1.7 2001/11/16 05:07:19 steve
* Add support for +libext+ in command files.
*/
#endif

View File

@ -70,16 +70,6 @@ do_times=no
)
AC_MSG_RESULT($do_times)
AC_CHECK_HEADER(ipal.h, HAVE_IPAL=yes, HAVE_IPAL=)
AC_ARG_WITH(ipal,
[ --with-ipal enable PAL target],
if test "$with_ipal" = no; then
echo Disabling ipal support
HAVE_IPAL=
fi
)
AC_SUBST(HAVE_IPAL)
# --
# Look for a dl library to use. First look for the standard dlopen
# functions, and failing that look for the HP specific shl_load function.

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef HAVE_CVS_IDENT
#ident "$Id: elab_expr.cc,v 1.84 2004/02/20 06:22:56 steve Exp $"
#ident "$Id: elab_expr.cc,v 1.85 2004/03/09 04:29:42 steve Exp $"
#endif
# include "config.h"
@ -28,30 +28,6 @@
# include "netmisc.h"
# include "util.h"
/*
* This table describes all the return values of various system
* functions. This table is used to elaborate expressions that are
* system function calls.
*/
struct sfunc_return_type {
const char* name;
NetExpr::TYPE type;
unsigned wid;
int signed_flag;
};
static const struct sfunc_return_type sfunc_table[] = {
{ "$realtime", NetExpr::ET_REAL, 0, 0 },
{ "$bitstoreal", NetExpr::ET_REAL, 0, 0 },
{ "$itor", NetExpr::ET_REAL, 0, 0 },
{ "$realtobits", NetExpr::ET_VECTOR, 64, 0 },
{ "$time", NetExpr::ET_VECTOR, 64, 0 },
{ "$stime", NetExpr::ET_VECTOR, 32, 0 },
{ "$simtime", NetExpr::ET_VECTOR, 64, 0 },
{ 0, NetExpr::ET_VECTOR, 32, 0 }
};
NetExpr* PExpr::elaborate_expr(Design*des, NetScope*, bool) const
{
cerr << get_line() << ": internal error: I do not know how to elaborate"
@ -247,13 +223,11 @@ NetExpr* PECallFunction::elaborate_sfunc_(Design*des, NetScope*scope) const
/* Get the return type of the system function by looking it up
in the sfunc_table. */
unsigned sfunc_idx;
for (sfunc_idx = 0 ; sfunc_table[sfunc_idx].name ; sfunc_idx += 1)
if (strcmp(path_.peek_name(0), sfunc_table[sfunc_idx].name) == 0)
break;
const struct sfunc_return_type*sfunc_info
= lookup_sys_func(path_.peek_name(0));
NetExpr::TYPE sfunc_type = sfunc_table[sfunc_idx].type;
unsigned wid = sfunc_table[sfunc_idx].wid;
NetExpr::TYPE sfunc_type = sfunc_info->type;
unsigned wid = sfunc_info->wid;
/* How many parameters are there? The Verilog language allows
@ -977,6 +951,12 @@ NetExpr* PEUnary::elaborate_expr(Design*des, NetScope*scope, bool) const
/*
* $Log: elab_expr.cc,v $
* Revision 1.85 2004/03/09 04:29:42 steve
* Separate out the lookup_sys_func table, for eventual
* support for function type tables.
*
* Remove ipal compile flags.
*
* Revision 1.84 2004/02/20 06:22:56 steve
* parameter keys are per_strings.
*

68
sys_funcs.cc Normal file
View File

@ -0,0 +1,68 @@
/*
* Copyright (c) 2004 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ident "$Id: sys_funcs.cc,v 1.1 2004/03/09 04:29:42 steve Exp $"
# include "config.h"
# include "compiler.h"
/*
* Manage the information about system functions. This information is
* collected from the sources before elaboration and made available
* via the lookup_sys_func function.
*/
static const struct sfunc_return_type sfunc_table[] = {
{ "$realtime", NetExpr::ET_REAL, 0, 0 },
{ "$bitstoreal", NetExpr::ET_REAL, 0, 0 },
{ "$itor", NetExpr::ET_REAL, 0, 0 },
{ "$realtobits", NetExpr::ET_VECTOR, 64, 0 },
{ "$time", NetExpr::ET_VECTOR, 64, 0 },
{ "$stime", NetExpr::ET_VECTOR, 32, 0 },
{ "$simtime", NetExpr::ET_VECTOR, 64, 0 },
{ 0, NetExpr::ET_VECTOR, 32, 0 }
};
const struct sfunc_return_type* lookup_sys_func(const char*name)
{
unsigned idx = 0;
while (sfunc_table[idx].name) {
if (strcmp(sfunc_table[idx].name, name) == 0)
return sfunc_table + idx;
idx += 1;
}
/* No luch finding, so return the trailer, which give a
default description. */
return sfunc_table + idx;
}
/*
* $Log: sys_funcs.cc,v $
* Revision 1.1 2004/03/09 04:29:42 steve
* Separate out the lookup_sys_func table, for eventual
* support for function type tables.
*
* Remove ipal compile flags.
*
*/