Index: vis_dev/vl2mv-2.3/INSTALL
===================================================================
--- vis_dev/vl2mv-2.3/INSTALL	(revision 18)
+++ vis_dev/vl2mv-2.3/INSTALL	(revision 18)
@@ -0,0 +1,176 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
+
Index: vis_dev/vl2mv-2.3/Makefile.in
===================================================================
--- vis_dev/vl2mv-2.3/Makefile.in	(revision 18)
+++ vis_dev/vl2mv-2.3/Makefile.in	(revision 18)
@@ -0,0 +1,822 @@
+# FileName	[ Makefile.in ]
+#
+# PackageName	[ vl2mv ]
+#
+# Synopsis	[ Package-wide Makefile ]
+#
+# Description	[ This file requires GNU's make program.
+#		  Run "configure" to generate the Makefile, or use
+#		  "config.status" (created by configure) to regenerate the
+#		  Makefile after modifying this file.
+#
+#		  Type "gmake help" for help about valid targets.
+#		 ]
+#
+# SeeAlso	[ configure.in ]
+#
+# Author	[ Stephen Edwards <sedwards@eecs.berkeley.edu>
+#		  Tom Shiple <shiple@eecs.berkeley.edu> ]
+#
+# Copyright	[
+#  Copyright (c) 1994-1996 The Regents of the Univ. of California.
+#  All rights reserved.
+#
+#  Permission is hereby granted, without written agreement and without license
+#  or royalty fees, to use, copy, modify, and distribute this software and its
+#  documentation for any purpose, provided that the above copyright notice and
+#  the following two paragraphs appear in all copies of this software.
+#
+#  IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+#  DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
+#  OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
+#  CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#  THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+#  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+#  FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN
+#  "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE
+#  MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+#  ]
+#
+# Revision	[$Id: Makefile.in,v 1.6 2010/04/10 03:51:10 fabio Exp $]
+
+# Default target:
+
+.PHONY : default
+
+default : all
+
+#----------------------------------------------------------------------
+# The list of packages to compile.  Change this if you are only compiling
+# part of vl2mv
+#----------------------------------------------------------------------
+
+#PKGS = parser
+PKGS = $(ALL_PKGS)
+
+#----------------------------------------------------------------------
+# This Makefile is designed for three different situations:
+#
+# 1. Single platform build (the default)
+#
+#    All packages listed in the PKGS variable
+#    local_srcdir = master_srcdir = .
+#
+# 2. Multi-platform build
+#
+#    All packages listed in the PKGS variable
+#    local_srcdir = master_srcdir = /where/source/files/reside
+#
+# 3. Multi-platform development (used at Berkeley)
+#
+#    Packages under development listed in the PKGS variable
+#    local_srcdir = ../common
+#    master_srcdir = /projects/vis/vis-devel/common
+#
+#    User has a directory structure that looks like
+#
+#	vis/common/src/		Subdirectory with package source files
+#				under development.
+#
+#	vis/$PLATFORM/		Subdirectory with this Makefile.
+#				Compilation is invoked here.
+#
+#	$PLATFORM is something like "alpha-g" (DEC Alpha, debug version)
+#
+#----------------------------------------------------------------------
+
+#----------------------------------------------------------------------
+# Information about all the packages
+#----------------------------------------------------------------------
+
+ALL_PKGS = parser set stack
+
+# Generate the list of all packages NOT in the PKGS list
+
+MISSING_PKGS = $(filter-out $(PKGS), $(ALL_PKGS))
+
+#----------------------------------------------------------------------
+# For safety
+#----------------------------------------------------------------------
+
+SHELL = /bin/sh
+.SUFFIXES:
+
+#----------------------------------------------------------------------
+# The name of the product and its version
+#----------------------------------------------------------------------
+
+PRODUCT = vl2mv
+VERSION = 2.3
+
+# Compile and version information
+#
+# CUR_DATE and CUR_VER are strings surrounded by double quotes that contain
+# spaces, e.g., "vl2mv release 3.0"
+
+VERDATE := -DCUR_DATE="\"$(shell date)\"" -DCUR_VER="\"$(PRODUCT) release $(VERSION)\""
+
+#----------------------------------------------------------------------
+# Source directories
+#----------------------------------------------------------------------
+
+# Directory containing master source files.  This directory is searched
+# for packages NOT listed in the PKGS variable.  Defaults to "."
+# Override with  ./configure --srcdir=
+master_srcdir = @srcdir@
+
+# Directory containing local source files.  This directory is searched
+# for packages listed in the PKGS variable.  Defaults to the master source
+# directory (see above).
+# Override with ./configure --with-local-srcdir=
+local_srcdir =  @local_srcdir@
+
+#----------------------------------------------------------------------
+# Directories used while building
+#----------------------------------------------------------------------
+
+# Directories to search for glu .h files (space-separated)
+gluincdir1 =	@gluincdir@
+
+# Directories to search for libglu.a (space-separated)
+glulibdir1 =	@glulibdir@
+
+# Directory where object files will be placed during the build
+objectdir =	obj
+
+# Directory where links to header files will be placed during the build
+headerdir =	$(local_srcdir)/include
+
+# Directories where documentation will be placed during the build
+docdir =	$(master_srcdir)/doc
+htmldocdir =	$(docdir)/html
+txtdocdir =	$(docdir)/txt
+helpdir =	$(master_srcdir)/share/help
+
+# Directories to search for VL2MV library files
+# Set by ./configure --with-vl2mv-libdir=
+vl2mvlibdir =	@vl2mvlibdir@
+
+#----------------------------------------------------------------------
+# Defaults for GLU library and header files
+#----------------------------------------------------------------------
+
+ifndef gluincdir1
+  gluincdir = ../glu-$(VERSION)/include ../../glu-$(VERSION)/include
+else
+  gluincdir = $(gluincdir1)
+endif
+
+ifndef glulibdir1
+  glulibdir = ../glu-$(VERSION) ../../glu-$(VERSION)
+else
+  glulibdir = $(glulibdir1)
+endif
+
+#----------------------------------------------------------------------
+# Installation names and directories
+#----------------------------------------------------------------------
+
+# Name of the library to create
+LIBRARY =	lib$(PRODUCT).a
+
+# Name of the man page
+MANPAGE =       vl2mv.1
+
+# Directory in which to install architecture-independent files
+# Set by ./configure --prefix=...
+prefix =	@prefix@
+
+# Directory in which to install architecture-dependent files
+# Set by ./configure --exec-prefix=...
+exec_prefix =	@exec_prefix@
+
+# Directory in which to install binaries
+bindir =	$(exec_prefix)/bin
+
+# Directory in which to install libraries
+libdir =	$(exec_prefix)/lib
+
+# Directory in which to install headers
+includedir =	$(prefix)/include
+
+# Directory in which to install architecture-independent library files
+datadir =	$(prefix)/share/vl2mv
+
+# Directory for the man page
+mandir = $(prefix)/man/man1
+
+#----------------------------------------------------------------------
+# The following are set by the configure script
+#----------------------------------------------------------------------
+
+AC_FLAGS =	@DEFS@
+LIBDIRS =	@LIBDIRS@
+RANLIB =	@RANLIB@
+CC =		@CC@
+LINKER =	@LINKER@
+LDFLAGS =	@LDFLAGS@
+CFLAGS =	@CFLAGS@
+OTHERLIBS =	@LIBS@ @LEXLIB@
+YACC =		@YACC@
+LEX =		@LEX@
+NAWK =		@AWK@
+SED =		@SED@
+INSTALL =	@INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA =	@INSTALL_DATA@
+AR =		@AR@
+
+
+#----------------------------------------------------------------------
+# Distributed files in the doc directory
+#----------------------------------------------------------------------
+
+DOCUMENTATION =
+
+#----------------------------------------------------------------------
+# Examples included in the distribution
+#----------------------------------------------------------------------
+
+# The "interesting" example files are anything in the examples subdirectories
+# except the RCS subdirectories
+#
+# This is a rather messy way to look for filenames in the local_srcdir,
+# then remove the local_srcdir prefix
+
+EXAMPLEFILES = $(patsubst $(local_srcdir)/%, %, \
+		$(filter-out %RCS, $(foreach example, $(EXAMPLES), \
+		  $(wildcard $(local_srcdir)/examples/*))))
+
+#----------------------------------------------------------------------
+# Include the make templates from all the packages
+#
+# Each of these templates (e.g., parser/parser.make) should contains lines
+# of the form
+#
+# CSRC += source1.c source2.c
+# HEADERS += header1.h header2.h
+# LEXSRC += file1.l
+# YACCSRC += file2.y
+# GENERATEDCSRC += ctlpLex.c ctlpRead.c
+#----------------------------------------------------------------------
+
+MAKEINCLUDES = $(foreach package, $(PKGS), \
+	$(local_srcdir)/src/$(package)/$(package).make)
+
+include $(MAKEINCLUDES)
+
+OBJECTS = $(addprefix $(objectdir)/,$(GENERATEDCSRC:.c=.o) $(CSRC:.c=.o))
+
+#----------------------------------------------------------------------
+# Include the dependency files from each package directory.
+# A missing dependency file does not produce an error.
+#----------------------------------------------------------------------
+
+DEPENDENCIES = $(foreach package, $(PKGS), \
+	$(local_srcdir)/src/$(package)/$(package).d)
+
+-include $(DEPENDENCIES)
+
+#----------------------------------------------------------------------
+# Header files and library search paths and names
+#
+# INCLUDEDIRS looks like "-I/projects/glu/ -I/projects/vis/ ..."
+# LIBRARYDIRS looks like "-L/projects/glu/ -L/projects/vis/ ..."
+# LIBS looks like "-lm -lglu -lvl2mv"
+#----------------------------------------------------------------------
+
+INCLUDEDIRS = $(addprefix -I,$(gluincdir)) \
+		$(foreach package, $(PKGS), -I$(local_srcdir)/src/$(package)) \
+		$(foreach package, $(MISSING_PKGS), \
+		-I$(master_srcdir)/src/$(package)) \
+		-I$(objectdir)
+
+LIBRARYDIRS = $(addprefix -L,$(vl2mvlibdir)) $(addprefix -L,$(glulibdir)) \
+		$(LIBDIRS)
+
+# Link against the vl2mv library only if some packages are missing
+# (i.e., we are compiling only a few packages locally)
+
+ifneq ($(strip $(MISSING_PKGS)),)
+  VL2MVLIBS = -l$(PRODUCT)
+else
+  VL2MVLIBS =
+endif
+
+GLULIBS = -lglu
+
+LIBS = $(VL2MVLIBS) $(GLULIBS) $(OTHERLIBS)
+
+#----------------------------------------------------------------------
+# Form the the list of directories to search for header files.
+#
+# VPATH looks like /projects/vis:/projects/glu/: ...
+#----------------------------------------------------------------------
+
+VPATH = $(local_srcdir): \
+	$(master_srcdir): \
+	$(addprefix :$(local_srcdir)/src/,$(PKGS)): \
+	$(addprefix :$(master_srcdir)/src/,$(MISSING_PKGS)): \
+	$(objectdir)
+
+#----------------------------------------------------------------------
+# Definitions for the distribution file
+#----------------------------------------------------------------------
+
+DISTRIBUTION = $(PRODUCT)-$(VERSION)
+
+# Directories to include in the distribution file
+
+DISTDIRS = src helpers obj doc examples $(addprefix src/,$(PKGS))
+
+# Build/install helper files
+
+HELPERS = $(addprefix helpers/, \
+	install-sh mkinstalldirs config.guess config.sub dependency.make)
+
+# Files to include in the distribution file
+
+DISTFILES = \
+	README INSTALL NEWS \
+	configure configure.in Makefile.in $(HELPERS) \
+	vl2mv.1 \
+	$(CSRC) $(HEADERS) $(LEXSRC) $(YACCSRC) $(MAKEINCLUDES) \
+	$(EXAMPLEFILES) \
+	$(addprefix doc/,$(DOCUMENTATION))
+
+#----------------------------------------------------------------------
+# Implicit rules
+#----------------------------------------------------------------------
+
+ALLCFLAGS = $(CFLAGS) $(AC_FLAGS) $(VERDATE) \
+		-DNAWK=\"$(NAWK)\" -DLIBRARY=\"$(datadir)\"
+
+# For compiling a source file into the object directory
+
+$(objectdir)/%.o : %.c
+	umask 2 ; $(CC) -c $(ALLCFLAGS) $(INCLUDEDIRS) -o $@ $<
+
+# Place object files into an archive
+
+%.a :
+	rm -f $@
+	umask 2; $(AR) cq $@ $^
+	$(RANLIB) $@
+
+######################################################################
+#				RULES				     #
+######################################################################
+
+#:
+#: Useful targets:
+#:
+
+#----------------------------------------------------------------------
+# Rule for getting help
+#----------------------------------------------------------------------
+
+.PHONY : help
+
+#: help -- Print a list of targets
+
+# This prints all lines in this Makefile that begin with #:
+
+help :
+	@sed -n "s/^#://p" Makefile
+
+#----------------------------------------------------------------------
+# Always executed once when the Makefile is run
+#----------------------------------------------------------------------
+
+# Make sure the directory in which to place the objects exists
+
+ignored := $(shell umask 2; test -d $(objectdir) || mkdir $(objectdir))
+
+#----------------------------------------------------------------------
+# Rules to compile and build libraries and executables
+#----------------------------------------------------------------------
+
+#.PHONY : all library compile-version delete-version
+.PHONY : all library
+
+#:
+#: all (the default) -- Compile the main executable
+# (force the version to be recompiled)
+
+#all : compile-version $(PRODUCT)
+all : $(PRODUCT)
+
+# Create the main executable
+
+$(PRODUCT) : $(OBJECTS) $(glulibdir)/libglu.a
+	umask 2 ; $(LINKER) -o $(PRODUCT) $(LDFLAGS) \
+		$(OBJECTS) $(LIBRARYDIRS) $(LIBS)
+
+# Force the "version" information to be recompiled
+
+compile-version : delete-version $(objectdir)/vmVers.o
+
+# Delete the object file related to the version
+
+delete-version :
+	rm -f $(objectdir)/vmVers.o
+
+# Build a library containing all the objects
+
+#: library -- Create a library of all the objects (useful in a central area)
+
+library : $(LIBRARY)
+
+$(LIBRARY) : $(OBJECTS)
+
+
+#----------------------------------------------------------------------
+# Rules for installation
+#----------------------------------------------------------------------
+
+.PHONY : install uninstall installdirs
+
+#:
+#: install -- Install the product and libraries in bindir, libdir,
+#:            datadir, etc.
+
+install : $(PRODUCT) $(LIBRARY) installdirs
+	@echo "Installing $(bindir)/$(PRODUCT)"
+	@$(INSTALL_PROGRAM) $(PRODUCT) $(bindir)/$(PRODUCT)
+	@echo "Installing $(libdir)/$(LIBRARY)"
+	@$(INSTALL_DATA) $(LIBRARY) $(libdir)/$(LIBRARY)
+	@echo "Installing $(mandir)/vl2mv.1"
+	@$(INSTALL_DATA) vl2mv.1 $(mandir)/vl2mv.1
+	@for header in $(HEADERS); do \
+		echo "Installing $(includedir)/$$header"; \
+		$(INSTALL_DATA) $(master_srcdir)/src/*/$$header \
+			$(includedir)/$$header; \
+	done
+
+#: uninstall -- Reverse the effects of "install"
+
+uninstall :
+	rm -f $(bindir)/$(PRODUCT)
+	rm -f $(libdir)/$(LIBRARY)
+	@for header in $(HEADERS); \
+	do \
+	  echo "Removing $(includedir)/$$header"; \
+	  rm -f $(includedir)/$$header; \
+	done
+
+installdirs :
+	$(master_srcdir)/helpers/mkinstalldirs \
+		$(bindir) $(libdir) $(includedir) $(datadir) $(datadir)/help \
+		$(mandir)
+
+#----------------------------------------------------------------------
+# Rules for checking the build
+#----------------------------------------------------------------------
+
+.PHONY : check
+
+# Determine the absolute executable path
+#
+# Starting from the current directory, change directory to the directory
+# part of the product name, then tack on the filename part of EXECUTABLE
+
+EXECUTABLE = $(PRODUCT)
+
+EXECUTABLEPATH := \
+	$(shell cd $(dir $(EXECUTABLE)) ; pwd)/$(notdir $(EXECUTABLE))
+
+# Determine the rootname of the examples
+
+EXAMPLEPATH = $(master_srcdir)/examples
+
+FULLEXAMPLEPATH := $(shell cd $(EXAMPLEPATH) ; pwd)
+
+# list of all examples to check
+
+EXAMPLES = ABypassCtrl ABypassSpec AdecSE1 BBypassSpec \
+Bcc BdecSE1 FIFOs FPMult FPMultLTL1 IFetchControl IFetchControl1 IntArith \
+IntLogic Jmp Mem PI_BUS PPC60X_bus abp abstr_fabr_4cycle am2901 am2910 amp \
+arbiter arbiter_bug arbiter_le atom_bakery bak_otLTLM1 bak_otLTLM2 \
+bak_otLTLM3 bak_otLTLM4 bak_otLTLM5 bakery bakery_ot ball barrel4 bcuvis32 biu\
+bpbs buf_bug  bufferAlloc bug checkers coherence controlvis counter \
+cp0IntEncoder cp0control crd ctlp3 ctlp3LTLM1 ctlp3LTLM2 ctlp3LTLM3 \
+daio_receiver dcnew drop4 eisenberg eisenbergLTLM1 eisenbergLTLM2 eleLTLM1 \
+ely1-3 ely2-3 ely2-4 ely3-4 ethernet.define.112 ethernet.define.212 \
+ethernet.define.312 ethernet.define.412 exampleS extIntControl fabric_beh \
+fabric_str freecell fru32 ftxr fysel8x8 gcd gcdLTL2 gigamax good_bakery gray \
+hwb30 ibuf ibuf_ctl ic_cntl icctl icctl_env idu32 island jam ldStoCtrl.save \
+ldStoCtrl lock luckySeven luckySevenONE matrix matrix_bug minMax mppLTLM1 \
+network nosel nullModem nullModemLTL1 nullmodemLTLM1 packstart palu paluLTL1 \
+parsepack parsesys pcuv peterson pf philo philo4 ping_pong_new prodcell \
+prodcellLTL2 rcnum rcnum16 rcnum25 rcv relinit reqAck reqAckRed reset rgraph \
+rotate32 rotate4 scheduler segf1 sfeistel sg1 shampoo short slider snd soap \
+soapLTL1 soapLTL3 soapLTL4 soapLTLM1 soapLTLM2 soapLTLM3 solitaireVL \
+spinner32 spinner4 spm starving_bakery storeBufferCtrl syncarb synch_bakery \
+tcp test three_processor ticTacToe tlbControl tlc two twoAll twoFifo1 twoQ \
+two_processor twoqLTLM1 twoqLTLM2 vMiim vcordic vcrc32_8 vending vlunc \
+vsa16a vsaR wallace8
+
+#:
+#: check -- Test the locally-built executable (runs check-examples)
+
+#:          Test each of the examples listed in CHECK_EXAMPLES
+#:	    You may want to invoke this with
+#:            gmake "CHECK_EXAMPLES=abp bakery" check-examples
+#:            gmake EXECUTABLE=vis-cmu check-examples
+#:            gmake EXECUTABLE=/projects/vis/vis-devel/alpha-g/vis \
+#:                    check-examples
+#:            gmake EXAMPLEPATH=/projects/vis/vis-devel/common/examples \
+#:                    check-examples
+#:            gmake EXAMPLEPATH=../common/examples check-examples
+#:            gmake VIS_LIBRARY_PATH=/projects/vis/vis-devel/share
+
+# For each example,
+#
+# 1) create the directory checkresults/<example>
+# 2) enter that directory
+# 3) create "check_script" by prepending a "set open_path" command
+#    to the example's check_script in the master source directory.  This
+#    makes VIS look in the master source directory for example files
+# 4) run VIS on that script, producing "result.raw"
+# 5) filter out relevant lines in the result, producing "result.filtered"
+#    and compare this with the "check_result" file in the master source
+#    directory.  Differences are written to "result.differences"
+
+check :
+	@test -d checkresults || mkdir checkresults
+	@echo "Checking examples.  Results will be in checkresults/<example>/result.raw"
+	@echo "Running executable $(EXECUTABLEPATH)"
+	@echo " (change with EXECUTABLE=...)"
+	@echo "Taking examples from $(FULLEXAMPLEPATH)"
+	@echo " (change with EXAMPLEPATH=...)"
+	@here=`pwd`  ; \
+	for example in $(EXAMPLES) ; \
+	do \
+	  cd $(FULLEXAMPLEPATH) ; \
+	  echo -n "Checking $$example ... " ; \
+	  test -d $$here/checkresults/$$example \
+	    || mkdir $$here/checkresults/$$example ; \
+	  $(EXECUTABLEPATH) $$example.v -o $$here/checkresults/$$example/$$example.mv >$$here/checkresults/$$example/result.out 2>$$here/checkresults/$$example/result.err ; \
+	  cat $$here/checkresults/$$example/result.err >> \
+	    $$here/checkresults/$$example/result.out ; \
+	  rm  $$here/checkresults/$$example/result.err ; \
+	  if egrep -v "\.v$$|uninitialize" $$here/checkresults/$$example/result.out ;\
+	  then \
+	    echo "failed (more checkresults/$$example/result.out)" ; \
+	  else \
+	    echo "passed" ; \
+	  fi ; \
+	done
+
+#----------------------------------------------------------------------
+# Rules that produce/delete the dependency file for every package
+#----------------------------------------------------------------------
+
+.PHONY : dependencies cleandependencies
+
+#:
+#: dependencies -- Create a list of dependency files.
+#:                 Useful when modifying header files.
+
+# Invoke the "dependency.make" Makefile on each package subdirectory,
+# passing the path, etc. to it.
+#
+# There's a strange feature in autoconf where lines of the form " VPATH="
+# are removed from the Makefile.  Thus, a flag is placed before the
+# VPATH= argument below.
+
+dependencies:
+ifeq ($(CC),gcc)
+	for pkg in $(PKGS) ; \
+	do \
+	  $(MAKE) --no-print-directory \
+		-f $(master_srcdir)/helpers/dependency.make \
+		CC="$(CC)" \
+		CFLAGS="$(CFLAGS)" VPATH="$(local_srcdir)/src/$$pkg" \
+		AC_FLAGS="$(AC_FLAGS)" \
+		INCLUDEDIRS="$(INCLUDEDIRS)" objectdir=$(objectdir) \
+		PKGNAME=$(local_srcdir)/src/$$pkg/$$pkg \
+		$(local_srcdir)/src/$$pkg/$$pkg.d ; \
+	done
+else
+	@echo "dependency requires gcc"
+	@echo "Reconfigure with gcc"
+endif
+
+cleandependencies:
+	rm -f $(local_srcdir)/src/*/*.d
+
+#----------------------------------------------------------------------
+# Rules for making a distribution file
+#----------------------------------------------------------------------
+
+.PHONY : dist
+
+#:
+#: dist -- Create a tarred, gzipped distribution file
+
+# Warning: "tar" under Digital Unix (on DEC Alphas) writes directories
+# that don't work under SunOS tar
+
+dist : $(DISTRIBUTION).tar.gz
+
+$(DISTRIBUTION).tar.gz : $(DISTFILES)
+ifeq ($(strip $(FULL_MISSING_PKGS)),)
+	rm -rf $(DISTRIBUTION)
+	umask 022; mkdir $(DISTRIBUTION)
+	for dir in $(DISTDIRS); \
+	do \
+	  umask 022; mkdir $(DISTRIBUTION)/$$dir; \
+	done
+	@echo "Copying distribution files"
+	@for file in $(patsubst $(local_srcdir)/%, %, $^); \
+	do \
+	  echo "  $$file"; \
+	  cp -p $(local_srcdir)/$$file $(DISTRIBUTION)/$$file; \
+	done
+	- chmod -R a+r $(DISTRIBUTION)
+	- chmod -R u+w $(DISTRIBUTION)
+	tar cf - $(DISTRIBUTION) | gzip > $(DISTRIBUTION).tar.gz
+	rm -rf $(DISTRIBUTION)
+else
+	@echo "Missing packages: $(FULL_MISSING_PKGS)"
+	@echo "Make sure PKGS lists all the packages"
+	@exit 1
+endif
+
+#----------------------------------------------------------------------
+# Rules for rebuilding the configure file and Makefile
+#----------------------------------------------------------------------
+
+${master_srcdir}/configure : configure.in
+	cd ${master_srcdir} && autoconf
+	chmod 0775 ${master_srcdir}/config*
+
+config.status : configure
+	./config.status --recheck
+
+Makefile : Makefile.in config.status
+	@echo "The master Makefile.in has been changed:"
+	@echo "run config.status"
+	@echo "Warning: This will overwrite any local Makefile modifications"
+	@exit 1
+
+#----------------------------------------------------------------------
+# Rules for cleaning
+#----------------------------------------------------------------------
+
+.PHONY : clean mostlyclean distclean
+
+#:
+#: clean -- Remove every file created by building
+
+clean mostlyclean :
+	rm -rf $(objectdir)/* $(LIBRARY) $(PRODUCT) \
+		$(foreach bddpkg, $(BDDPKGS), $(PRODUCT)-$(bddpkg)) \
+		checkresults include
+
+#: distclean -- Remove every file created by building or configuring
+
+distclean : clean cleandependencies
+	rm -f Makefile config.status config.cache config.log
+
+#----------------------------------------------------------------------
+# Rule for performing a lint-like check on the source code
+#
+# Note: This requires gcc
+#----------------------------------------------------------------------
+
+.PHONY : check-code
+
+#:
+#: check-code -- Run a lint-like check on the source code.
+#:               (useful for development)
+
+check-code : $(CSRC) $(BDD_CSRC) $(MDD_CSRC)
+ifeq ($(CC),gcc)
+	@rm -f *.o_checkcode
+	@for file in $^; \
+	do \
+	  echo "------------------------ Checking $$file"; \
+	  gcc -c $(CFLAGS) $(AC_FLAGS) $(VERDATE) $(INCLUDEDIRS) \
+		-Wall -Wno-comment -o $(objectdir)/checkcode_output.o $$file; \
+	  rm -f $(objectdir)/checkcode_output.o; \
+	done
+	@rm -f *.o_checkcode
+else
+	@echo "check-code requires gcc"
+	@echo "Reconfigure with gcc"
+endif
+
+#----------------------------------------------------------------------
+# Rule for generating function prototypes for all the
+# source and header files in all the PKGS
+#
+# Note: This requires "extproto," part of the ext package available from
+# ftp://ic.eecs.berkeley.edu/pub/Ext
+#----------------------------------------------------------------------
+
+.PHONY : proto
+
+#:
+#: proto -- Regenerate all the function prototypes in the packages
+#:	    Useful during development.  You may want to invoke it with
+#:	      gmake "PKGS=tst tbl" proto
+
+proto :
+	@cd $(local_srcdir)/src ; \
+	for pkg in $(PKGS); \
+	do \
+	  cd $$pkg ; \
+	  extproto *.h *.c ; \
+	  cd .. ; \
+	done
+
+#----------------------------------------------------------------------
+# Rules for generating the documentation and command help files
+# for all the packages
+#
+# Note: This requires "extdoc," part of the ext package, and
+# lynx, a textual WWW browser
+#----------------------------------------------------------------------
+
+.PHONY : allDoc doc indices helpfiles cleandoc
+
+#:
+#: allDoc -- Extract all the documentation (runs doc, indices, and helpfiles)
+
+allDoc : cleandoc doc indices helpfiles
+
+#: doc -- Extract HTML and text documentation on all the functions
+
+doc : $(htmldocdir) $(txtdocdir)
+	for pkg in $(PKGS); \
+	do \
+	  umask 2 ; extdoc --html=$(htmldocdir) --text=$(txtdocdir) \
+		$(local_srcdir)/src/$$pkg/$$pkg; \
+	done
+
+#: indices -- Generate function and command indices for the HTML documentation
+
+indices : $(htmldocdir)
+	umask 2 ; extindex $(htmldocdir)
+
+#: helpfiles -- Generate the help files from the HTML documentation
+
+helpfiles : $(helpdir)
+	for file in $(htmldocdir)/*Cmd.html ; \
+	do \
+	  echo Converting $$file ; \
+	  umask 2 ; lynx -dump $$file > $(helpdir)/`basename $$file .html`.txt ; \
+	done
+
+#: cleandoc -- Remove all the documentation generated by "allDoc"
+
+cleandoc :
+	-rm -f $(htmldocdir)/*.html
+	-rm -f $(txtdocdir)/*.txt
+	-rm -f $(helpdir)/*Cmd.txt
+
+$(htmldocdir) :
+	- umask 2 ; mkdir $(htmldocdir)
+
+$(txtdocdir) :
+	- umask 2 ; mkdir $(txtdocdir)
+
+$(helpdir) :
+	- umask 2 ; mkdir $(helpdir)
+
+
+
+#----------------------------------------------------------------------
+# Rules for debugging the Makefile
+#----------------------------------------------------------------------
+
+.PHONY : debug-make
+
+DEBUG_VARS =	ALL_PKGS \
+		PKGS \
+		MISSING_PKGS \
+		VPATH \
+		INCLUDEDIRS \
+		CSRC \
+		OBJECTS \
+		HEADERS \
+		MAKEINCLUDES \
+		CFLAGS \
+		AC_FLAGS \
+		master_srcdir \
+		local_srcdir \
+		RCSFILES \
+		RCSDIR \
+		LIBS \
+		VL2MVIBS \
+		DISTFILES \
+		EXAMPLEFILES
+
+#:
+#: debug-make -- Print a list of Makefile variables
+
+debug-make:
+	@$(foreach var, $(DEBUG_VARS), echo $(var)=$($(var)) ; )
Index: vis_dev/vl2mv-2.3/NEWS
===================================================================
--- vis_dev/vl2mv-2.3/NEWS	(revision 18)
+++ vis_dev/vl2mv-2.3/NEWS	(revision 18)
@@ -0,0 +1,9 @@
+Version 2.3
+
+* No news.
+
+Version 2.2
+
+* vl2mv 2.2 produces smaller blif-MV files than 2.1.
+
+* Dropped support of obsolete output formats (e.g., Shift)
Index: vis_dev/vl2mv-2.3/README
===================================================================
--- vis_dev/vl2mv-2.3/README	(revision 18)
+++ vis_dev/vl2mv-2.3/README	(revision 18)
@@ -0,0 +1,104 @@
+This is release 2.3 of VL2MV, a system for translating high-level verilog 
+desciption to BLIF-MV (a multi-valued extension of BLIF). BLIF-MV is the input 
+format used by VIS/SIS, an integrated verification/synthesis system. 
+For more information on VL2MV and BLIF-MV 
+visit http://vlsi.colorado.edu/~vis/usrDoc.html 
+
+---------------------------------------------------------------------------
+This is the list of architecture/operating system/compiler
+combinations we have tested. 
+
+     * Intel ia32/x86_64 / Linux / gcc
+     * Intel ia32 / Windows XP/Vista with Cygwin 1.5 / gcc 
+
+The following combinations are no longer supported, but should still
+work.
+
+     * Sun Sparc / Solaris 5.8 / gcc, cc
+     * Intel i386 / Solaris 5.8 / gcc, cc
+
+The following instructions are for the generic build process.  
+
+---------------------------------------------------------------------------
+Before compiling VL2MV, you will have to build GLU, a set of BDD packages and
+low-level utilities. You may obtain GLU from the Univeristy of Colorado VLSI
+lab at http://vlsi.colorado.edu/~vis/.
+
+To build GLU for a single operating System refer the GLU Readme file -
+http://vlsi.colorado.edu/~vis/Readme/README.glu
+
+Make sure that the GLU version is same as that of the VL2MV you are
+building  - after you unzip and untar the glu-version#.tar.gz, you 
+will have a  directory named glu-version#. If the version # does not
+match the version number of the VL2MV you are trying to build, then 
+move the directory to the version number that you require.
+
+eg. if you have glu-2.2 directory and you are building vl2mv-2.3
+(VL2MV version 2.3), then move glu-2.2 to glu-2.3
+
+> mv glu-2.2/ glu-2.3
+
+Also make sure that the variable VERSION in the Makefile.in under glu-version#/
+directory is set to that of the VL2MV package being installed (In the above 
+example, you should set VERSION = 2.3 in the Makefle.in)
+
+Now compile and build (and install) GLU. You are now ready to build VL2MV.
+
+1. Download the verion of VL2MV to the directory say <WORK_AREA>. You should
+have downloaded and unpacked GLU at <WORK_AREA> too.
+
+2. Unpack VL2MV. Let's say the tar ball you downloaded is vl2mv-2.3.tar.gz
+
+> gunzip vl2mv-2.3.tar.gz
+This will create a vl2mv-2.3.tar file. Untar it using 
+> tar -xvf vl2mv-2.3.tar
+This creates a directory named vl2mv-2.3/
+
+You can use 
+> gunzip vl2mv-2.3.tar.gz | tar -xvf 
+or
+> tar -xvzf vl2mv-2.3.tar.gz
+to do the same as mentioned before.
+
+3. Move into the vl2mv-2.3 directory thus produced and execute the configure
+script which will create the Makefile after determining some of the system
+specific parameters.
+
+> cd vl2mv-2.3
+> ./configure
+
+By default, this will use your system's native compiler (cc). If you do not
+have cc or if you wish to use gcc instead, use
+
+> ./configure --enable-gcc
+
+Read the configure file for more options ( users developing code for vl2mv 
+or vis may want to take a look ). Do not worry if some of the checks
+of the configure return "no." Concentrate on the warnings (if any) that the 
+configure script produces.
+
+Now a Makefile and configure.status file are created.
+
+4. Build the vl2mv system by 
+
+> make
+
+Sometimes, the build may stop and ask you to excute config.status. Do that by
+
+> ./config.status
+
+This will create a new Makefile and you will have to start the build process 
+again by typing "make" at the command promt.
+
+If the compilation goes through without any seg faults, you will find the 
+vl2mv binary under <WORK_AREA>/vl2mv-2.3/
+
+If you want to install, remove the binary created or run any self-tests that
+come alongwith the package, use
+> make install
+> make clean
+> make check
+
+Read INSTALL file under <WORK_AREA>/vl2mv-2.3/ for install instructions.
+For more options, read Makefile file created by running configure script 
+as explained under step 3.
Index: vis_dev/vl2mv-2.3/configure
===================================================================
--- vis_dev/vl2mv-2.3/configure	(revision 18)
+++ vis_dev/vl2mv-2.3/configure	(revision 18)
@@ -0,0 +1,6285 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="src/parser/main.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS glulibdir gluincdir vl2mvlibdir local_srcdir AR RANLIB ac_ct_RANLIB AWK SED build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LINKER LEX LEXLIB LEX_OUTPUT_ROOT LN_S SET_MAKE YACC LIBDIRS CPP EGREP LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+	      localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+			  [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+			  [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-gcc            Allow use of gcc if available
+  --enable-64             Use 64-bit pointers on 64-bit Alpha machines
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-glu-libdir=<libdir> Specify directories to search for the GLU library.                          Expects to find <libdir>/libglu.a
+  --with-glu-incdir=<incdir> Specify directories to search for the GLU headers
+  --with-vl2mv-libdir=<libdir> Specify directories to search for the vl2mv
+			  library and headers.  Defaults to \".\".
+			  Expects to find <libdir>/libvl2mv.a
+  --with-local-srcdir=<srcdir> Specify the root directory to search for
+			  source for packages (the PKGS list).
+			  Expects to find, e.g., <srcdir>/parser/main.c
+  --with-comp-mode=<mode> Specify a special compilation mode:
+			  optimize (the default): Produce optimized
+				code, with symbol table information
+				if supported on the platform/compiler,
+				and without asserts.
+			  debug: Produce unoptimized code with symbol table
+				information and asserts enabled
+			  purify: Unoptimized code linked with purify
+			  quantify: Optimized code without asserts
+				linked with quantify
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+	   test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=$`echo $ac_var`
+	echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Look for install.sh, config.guess, and config.sub in the "helpers" dir
+ac_aux_dir=
+for ac_dir in helpers $srcdir/helpers; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in helpers $srcdir/helpers" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in helpers $srcdir/helpers" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+
+#----------------------------------------------------------------------
+# Configuration options
+#----------------------------------------------------------------------
+
+# Give the configurer a chance to set the location of the GLU tree
+
+
+
+# Check whether --with-glu-libdir or --without-glu-libdir was given.
+if test "${with_glu_libdir+set}" = set; then
+  withval="$with_glu_libdir"
+  glulibdir=$withval
+else
+  glulibdir=""
+fi;
+
+
+
+# Check whether --with-glu-incdir or --without-glu-incdir was given.
+if test "${with_glu_incdir+set}" = set; then
+  withval="$with_glu_incdir"
+  gluincdir=$withval
+else
+  gluincdir=""
+fi;
+
+# Give the configurer a chance to set a different location for the VIS
+# headers and library
+
+
+
+# Check whether --with-vl2mv-libdir or --without-vl2mv-libdir was given.
+if test "${with_vl2mv_libdir+set}" = set; then
+  withval="$with_vl2mv_libdir"
+  vl2mvlibdir=$withval
+else
+  vl2mvlibdir="."
+fi;
+
+# Give the configurer a chance to set a different location for the vl2mv
+# source.  When specified, "srcdir" points to "master" source, and
+# "local_srcdir" points to the source under local development.
+
+
+
+# Check whether --with-local-srcdir or --without-local-srcdir was given.
+if test "${with_local_srcdir+set}" = set; then
+  withval="$with_local_srcdir"
+  local_srcdir=$withval
+else
+  local_srcdir=$srcdir
+fi;
+
+
+#----------------------------------------------------------------------
+# Checks for programs we need
+#----------------------------------------------------------------------
+
+# Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $AR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AR="$AR" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_AR" && ac_cv_path_AR="ar"
+  ;;
+esac
+fi
+AR=$ac_cv_path_AR
+
+if test -n "$AR"; then
+  echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_SED+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $SED in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_SED="$SED" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_SED" && ac_cv_path_SED="sed"
+  ;;
+esac
+fi
+SED=$ac_cv_path_SED
+
+if test -n "$SED"; then
+  echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+  ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+
+# Balakrisha Kumthekar (kumtheka@colorado.edu): making a special case
+# for ultrix install, since its annoying about setting groupids.
+case "$target" in
+  mips-dec-ultrix*)
+    INSTALL="helpers/install-sh -c"
+    INSTALL_PROGRAM="\${INSTALL}"
+    INSTALL_DATA="\${INSTALL} -m 644";;
+
+  *)
+  # Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+ ;;
+esac
+
+# Determine the name of the C compiler we're going to use
+
+# Check whether --enable-gcc or --disable-gcc was given.
+if test "${enable_gcc+set}" = set; then
+  enableval="$enable_gcc"
+  gcc_ok=$enableval
+else
+  gcc_ok=no
+fi;
+
+if test "$gcc_ok" != no; then
+  case "$gcc_ok" in
+    yes)
+      CC=gcc ;;
+    *)
+      CC=$gcc_ok
+  esac
+else
+# Balakrishna Kumthekar <kumtheka@colorado.edu>
+# As we do not support cc on RS6000, Cygwin and SunOS.
+   case "$target" in
+     rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*)
+       CC=gcc ;;
+     *)
+       CC=cc ;;
+   esac
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+	;;
+    conftest.$ac_ext )
+	# This is the source file.
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	# FIXME: I believe we export ac_cv_exeext for Libtool,
+	# but it would be cool to find out if it's true.  Does anybody
+	# maintain Libtool? --akim.
+	export ac_cv_exeext
+	break;;
+    * )
+	break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  export ac_cv_exeext
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Check whether --enable-64 or --disable-64 was given.
+if test "${enable_64+set}" = set; then
+  enableval="$enable_64"
+  use_sixty_four=$enableval
+else
+  use_sixty_four=no
+fi;
+
+if test "$gcc_ok" != no; then
+  use_sixty_four=yes
+fi
+
+
+# Determine the compiler flags to use
+
+DEBUG_CFLAGS="-g"
+DEBUG_LDFLAGS=""
+
+case "$target" in
+
+  sparc-sun-solaris* | i386-pc-solaris*)
+	# Sparc and X86 Solaris:
+	# -xO3: Highest safe level of optimization
+	# -native: Optimize for the native processor (if supported)
+	# -dalign: Generate double-word load/store for performance
+	#          (only for SPARC)
+	# and other arcane compilation flags.
+	if test "$GCC" = yes; then
+	  OPTIMIZE_CFLAGS="-O"
+	else
+	  case "$target" in
+	    sparc-sun-solaris*)
+	      ALIGN=" -dalign" ;;
+	    *)
+	      ALIGN="" ;;
+	  esac
+	  echo "$as_me:$LINENO: checking for -native" >&5
+echo $ECHO_N "checking for -native... $ECHO_C" >&6
+	  CFLAGS="-xO3 -native$ALIGN"
+
+if test "${ac_cv_have_native+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+   if test "$cross_compiling" = yes; then
+  ac_cv_have_native=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+	  main(){exit(0);}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_native=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_have_native=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+
+	  if test $ac_cv_have_native = yes ; then
+	    echo "$as_me:$LINENO: result: working" >&5
+echo "${ECHO_T}working" >&6
+	    OPTIMIZE_CFLAGS="-xO3 -native$ALIGN"
+	  else
+	    echo "$as_me:$LINENO: result: broken" >&5
+echo "${ECHO_T}broken" >&6
+	    echo "$as_me:$LINENO: checking for fallback optimization flags" >&5
+echo $ECHO_N "checking for fallback optimization flags... $ECHO_C" >&6
+	    CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    if test "${ac_cv_have_fallback+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+   if test "$cross_compiling" = yes; then
+  ac_cv_have_fallback=no
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+	    main(){exit(0);}
+
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_have_fallback=yes
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_have_fallback=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+
+	    if test $ac_cv_have_fallback = yes ; then
+	      echo "$as_me:$LINENO: result: working" >&5
+echo "${ECHO_T}working" >&6
+	      OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    else
+	      echo "$as_me:$LINENO: result: broken" >&5
+echo "${ECHO_T}broken" >&6
+	      OPTIMIZE_CFLAGS="-O"
+	    fi
+	  fi
+	fi
+	;;
+
+  mips-dec-ultrix*)
+	# MIPS-based DECstations running Ultrix:
+	# -std1: Produce non-ANSI code warnings, and define __STDC__
+	# -O: Use the global "ucode" optimizer
+	# -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks
+	OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;;
+
+  alpha-dec-osf*)
+	# DEC Alpha running OSF:
+
+	# 64-bit mode:
+	# -g3: Produce symbol table information for optimized code
+	# -O4: Enable every optimization
+	# -std: Enforce the ANSI standard with extensions, define __STDC__
+	# -ieee_with_no_inexact: Disable (potentially slow) signaling
+	#   for inexact floating-point results
+	# -tune host: Tune instructions for the compilation host machine
+
+	OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host"
+	DEBUG_CFLAGS="-g -std -ieee_with_no_inexact"
+
+	# -non_shared: Do not use shared libraries
+	# -om: Generate an OMAGIC file for the om optimizer
+	OPTIMIZE_LDFLAGS="-non_shared"
+
+	if test "$use_sixty_four" = "no"; then
+	  # 32-bit mode:
+	  # -xtaso: Make the compiler respond to #pragma pointer_size directives
+	  OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso"
+	  DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso"
+
+	  # -taso: Load the executable into the lower 31-bit address space
+	  OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso"
+	  DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso"
+
+	  cat >>confdefs.h <<\_ACEOF
+#define SIZEOF_VOID_P 4
+_ACEOF
+
+	  ac_sizeof_voidp=4
+	fi
+	;;
+
+  hppa*-*-hpux*)
+	# HP running HPUX
+	# -Aa: Behave as an ANSI compiler
+	# -D_HPUX_SOURCE: Include "HP-specific" symbols in the header
+	#   files (e.g., this means sys/resource.h has struct rusage)
+	OPTIMIZE_CFLAGS="-O -Aa -D_HPUX_SOURCE"
+	DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;;
+
+     *)
+	# Other systems:
+	OPTIMIZE_CFLAGS="-O" ;;
+
+esac
+
+if test "$GCC" = yes; then
+  case "$target" in
+    i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32)
+      echo "$as_me:$LINENO: checking for -mcpu and -malign compiler options" >&5
+echo $ECHO_N "checking for -mcpu and -malign compiler options... $ECHO_C" >&6
+      CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_have_mcpu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_have_mcpu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+      if test "$ac_have_mcpu" = yes; then
+	echo "$as_me:$LINENO: result: working" >&5
+echo "${ECHO_T}working" >&6
+	OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      else
+	echo "$as_me:$LINENO: result: broken" >&5
+echo "${ECHO_T}broken" >&6
+	OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    sparc-sun-solaris*)
+      echo "$as_me:$LINENO: checking for -mtune compiler option" >&5
+echo $ECHO_N "checking for -mtune compiler option... $ECHO_C" >&6
+      CFLAGS="-g -O6 -mtune=ultrasparc"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_have_mtune=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_have_mtune=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+      if test "$ac_have_mtune" = yes; then
+	echo "$as_me:$LINENO: result: working" >&5
+echo "${ECHO_T}working" >&6
+	OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc"
+      else
+	echo "$as_me:$LINENO: result: not working" >&5
+echo "${ECHO_T}not working" >&6
+	OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    *)
+      OPTIMIZE_CFLAGS="-g -O3"
+      ;;
+  esac
+  OPTIMIZE_LDFLAGS=""
+  DEBUG_CFLAGS="-g"
+  DEBUG_LDFLAGS=""
+fi
+
+
+# Check whether --with-comp-mode or --without-comp-mode was given.
+if test "${with_comp_mode+set}" = set; then
+  withval="$with_comp_mode"
+  comp_mode=$withval
+else
+  comp_mode=optimize
+fi;
+
+
+LINKER="$CC"
+
+case "$comp_mode" in
+  debug)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS" ;;
+  purify)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS"
+       cat >>confdefs.h <<\_ACEOF
+#define PURIFY 1
+_ACEOF
+
+       LINKER="purify -cache-dir=/tmp $CC" ;;
+  quantify)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       cat >>confdefs.h <<\_ACEOF
+#define QUANTIFY 1
+_ACEOF
+
+       cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+
+       LINKER="quantify $CC" ;;
+  optimize | *)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       cat >>confdefs.h <<\_ACEOF
+#define NDEBUG 1
+_ACEOF
+ ;;
+esac
+
+for ac_prog in flex lex
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_LEX+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$LEX"; then
+  ac_cv_prog_LEX="$LEX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_LEX="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+LEX=$ac_cv_prog_LEX
+if test -n "$LEX"; then
+  echo "$as_me:$LINENO: result: $LEX" >&5
+echo "${ECHO_T}$LEX" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$LEX" && break
+done
+test -n "$LEX" || LEX=":"
+
+if test -z "$LEXLIB"
+then
+  echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5
+echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6
+if test "${ac_cv_lib_fl_yywrap+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lfl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char yywrap ();
+int
+main ()
+{
+yywrap ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_fl_yywrap=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_fl_yywrap=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5
+echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6
+if test $ac_cv_lib_fl_yywrap = yes; then
+  LEXLIB="-lfl"
+else
+  echo "$as_me:$LINENO: checking for yywrap in -ll" >&5
+echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6
+if test "${ac_cv_lib_l_yywrap+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ll  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char yywrap ();
+int
+main ()
+{
+yywrap ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_l_yywrap=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_l_yywrap=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5
+echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6
+if test $ac_cv_lib_l_yywrap = yes; then
+  LEXLIB="-ll"
+fi
+
+fi
+
+fi
+
+if test "x$LEX" != "x:"; then
+  echo "$as_me:$LINENO: checking lex output file root" >&5
+echo $ECHO_N "checking lex output file root... $ECHO_C" >&6
+if test "${ac_cv_prog_lex_root+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # The minimal lex program is just a single line: %%.  But some broken lexes
+# (Solaris, I think it was) want two %% lines, so accommodate them.
+cat >conftest.l <<_ACEOF
+%%
+%%
+_ACEOF
+{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5
+  (eval $LEX conftest.l) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+if test -f lex.yy.c; then
+  ac_cv_prog_lex_root=lex.yy
+elif test -f lexyy.c; then
+  ac_cv_prog_lex_root=lexyy
+else
+  { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
+echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
+echo "${ECHO_T}$ac_cv_prog_lex_root" >&6
+rm -f conftest.l
+LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
+
+echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
+echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6
+if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # POSIX says lex can declare yytext either as a pointer or an array; the
+# default is implementation-dependent. Figure out which it is, since
+# not all implementations provide the %pointer and %array declarations.
+ac_cv_prog_lex_yytext_pointer=no
+echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
+ac_save_LIBS=$LIBS
+LIBS="$LIBS $LEXLIB"
+cat >conftest.$ac_ext <<_ACEOF
+`cat $LEX_OUTPUT_ROOT.c`
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_lex_yytext_pointer=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_save_LIBS
+rm -f "${LEX_OUTPUT_ROOT}.c"
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
+echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6
+if test $ac_cv_prog_lex_yytext_pointer = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define YYTEXT_POINTER 1
+_ACEOF
+
+fi
+
+fi
+echo "$as_me:$LINENO: checking if $LEX accepts the -o and -P options" >&5
+echo $ECHO_N "checking if $LEX accepts the -o and -P options... $ECHO_C" >&6
+
+if test "${ac_cv_flex_accepts_op+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+   ac_cv_flex_accepts_op=yes ;
+echo "%%\
+%%" | $LEX -Ptest -o/dev/null >/dev/null 2>&1 || ac_cv_flex_accepts_op=no
+fi
+
+if test $ac_cv_flex_accepts_op = yes ; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: WARNING: You either need a newer version of flex, or need to modify
+the defintion of LEX in the Makefile to point to a version that does
+accept -p -t and -o." >&5
+echo "$as_me: WARNING: You either need a newer version of flex, or need to modify
+the defintion of LEX in the Makefile to point to a version that does
+accept -p -t and -o." >&2;}
+fi
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+	@echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+# Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_AR+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $AR in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_AR="$AR" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_path_AR" && ac_cv_path_AR="ar"
+  ;;
+esac
+fi
+AR=$ac_cv_path_AR
+
+if test -n "$AR"; then
+  echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+for ac_prog in 'bison -y' byacc
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_YACC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$YACC"; then
+  ac_cv_prog_YACC="$YACC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_YACC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+YACC=$ac_cv_prog_YACC
+if test -n "$YACC"; then
+  echo "$as_me:$LINENO: result: $YACC" >&5
+echo "${ECHO_T}$YACC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$YACC" && break
+done
+test -n "$YACC" || YACC="yacc"
+
+echo "$as_me:$LINENO: checking if $YACC accepts the -p, -t, and -o options" >&5
+echo $ECHO_N "checking if $YACC accepts the -p, -t, and -o options... $ECHO_C" >&6
+if test "${ac_cv_yacc_accepts_pto+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+   ac_cv_yacc_accepts_pto=yes ;
+echo "%token terminal\
+%%\
+nonterminal: terminal\
+%%" > config.in
+$YACC -ptest -o /dev/null config.in >/dev/null 2>&1 || ac_cv_yacc_accepts_pto=norm -f config.in
+fi
+
+if test $ac_cv_yacc_accepts_pto = yes ; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: WARNING: You either need a newer version of bison, or need to modify
+the defintion of YACC in the Makefile to point to a version that does
+accept -p -t and -o." >&5
+echo "$as_me: WARNING: You either need a newer version of bison, or need to modify
+the defintion of YACC in the Makefile to point to a version that does
+accept -p -t and -o." >&2;}
+fi
+
+
+
+
+# add -lucb to LIBS and set LIBDIRS to -L/usr/ucblib
+# if there's a libucb.a available
+# (Solaris needs this for signals)
+
+ac_save_ldflags="$LDFLAGS"
+LDFLAGS=-L/usr/ucblib
+echo "$as_me:$LINENO: checking for main in -lucb" >&5
+echo $ECHO_N "checking for main in -lucb... $ECHO_C" >&6
+if test "${ac_cv_lib_ucb_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lucb  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ucb_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ucb_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ucb_main" >&5
+echo "${ECHO_T}$ac_cv_lib_ucb_main" >&6
+if test $ac_cv_lib_ucb_main = yes; then
+  LIBDIRS=-L/usr/ucblib
+fi
+
+LDFLAGS="$ac_save_ldflags"
+
+# add -lbsd if there's a libbsd.a available
+# (e.g., Linux needs this for bsd_ioctl)
+
+echo "$as_me:$LINENO: checking for main in -lbsd" >&5
+echo $ECHO_N "checking for main in -lbsd... $ECHO_C" >&6
+if test "${ac_cv_lib_bsd_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbsd  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_bsd_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_bsd_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_main" >&5
+echo "${ECHO_T}$ac_cv_lib_bsd_main" >&6
+if test $ac_cv_lib_bsd_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBSD 1
+_ACEOF
+
+  LIBS="-lbsd $LIBS"
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking for main in -lglu" >&5
+echo $ECHO_N "checking for main in -lglu... $ECHO_C" >&6
+if test "${ac_cv_lib_glu_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lglu  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_glu_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_glu_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_glu_main" >&5
+echo "${ECHO_T}$ac_cv_lib_glu_main" >&6
+if test $ac_cv_lib_glu_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBGLU 1
+_ACEOF
+
+  LIBS="-lglu $LIBS"
+
+fi
+
+
+echo "$as_me:$LINENO: checking for main in -lm" >&5
+echo $ECHO_N "checking for main in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_main+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+
+int
+main ()
+{
+main ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_main=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_main=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_main" >&5
+echo "${ECHO_T}$ac_cv_lib_m_main" >&6
+if test $ac_cv_lib_m_main = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_header in sys/time.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_time=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_time=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
+if test "${ac_cv_struct_tm+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <sys/types.h>
+#include <time.h>
+
+int
+main ()
+{
+struct tm *tp; tp->tm_sec;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_struct_tm=time.h
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_struct_tm=sys/time.h
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+echo "${ECHO_T}$ac_cv_struct_tm" >&6
+if test $ac_cv_struct_tm = sys/time.h; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TM_IN_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+
+for ac_func in strftime
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  # strftime is in -lintl on SCO UNIX.
+echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
+echo $ECHO_N "checking for strftime in -lintl... $ECHO_C" >&6
+if test "${ac_cv_lib_intl_strftime+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char strftime ();
+int
+main ()
+{
+strftime ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_intl_strftime=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_intl_strftime=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_strftime" >&6
+if test $ac_cv_lib_intl_strftime = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+LIBS="-lintl $LIBS"
+fi
+
+fi
+done
+
+
+for ac_func in vprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6
+if test "${ac_cv_func__doprnt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define _doprnt innocuous__doprnt
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char _doprnt (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef _doprnt
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char _doprnt ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+char (*f) () = _doprnt;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != _doprnt;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func__doprnt=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func__doprnt=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+
+
+
+for ac_func in getcwd gettimeofday strstr
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+          ac_config_files="$ac_config_files Makefile"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[	 ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[	 ]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*([^)]*)\)[	 ]*\(.*\),-D\1=\2,g
+t quote
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[	 `~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@glulibdir@,$glulibdir,;t t
+s,@gluincdir@,$gluincdir,;t t
+s,@vl2mvlibdir@,$vl2mvlibdir,;t t
+s,@local_srcdir@,$local_srcdir,;t t
+s,@AR@,$AR,;t t
+s,@RANLIB@,$RANLIB,;t t
+s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s,@AWK@,$AWK,;t t
+s,@SED@,$SED,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@target@,$target,;t t
+s,@target_cpu@,$target_cpu,;t t
+s,@target_vendor@,$target_vendor,;t t
+s,@target_os@,$target_os,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@LINKER@,$LINKER,;t t
+s,@LEX@,$LEX,;t t
+s,@LEXLIB@,$LEXLIB,;t t
+s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t
+s,@LN_S@,$LN_S,;t t
+s,@SET_MAKE@,$SET_MAKE,;t t
+s,@YACC@,$YACC,;t t
+s,@LIBDIRS@,$LIBDIRS,;t t
+s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+				     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
Index: vis_dev/vl2mv-2.3/configure.in
===================================================================
--- vis_dev/vl2mv-2.3/configure.in	(revision 18)
+++ vis_dev/vl2mv-2.3/configure.in	(revision 18)
@@ -0,0 +1,360 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.11)
+AC_INIT(src/parser/main.c)
+
+# Look for install.sh, config.guess, and config.sub in the "helpers" dir
+AC_CONFIG_AUX_DIR(helpers)
+
+#----------------------------------------------------------------------
+# Configuration options
+#----------------------------------------------------------------------
+
+# Give the configurer a chance to set the location of the GLU tree
+
+AC_SUBST(glulibdir)
+AC_ARG_WITH(glu-libdir,
+[  --with-glu-libdir=<libdir> Specify directories to search for the GLU library.                          Expects to find <libdir>/libglu.a],
+[glulibdir=$withval], [glulibdir=""])
+
+AC_SUBST(gluincdir)
+AC_ARG_WITH(glu-incdir,
+[  --with-glu-incdir=<incdir> Specify directories to search for the GLU headers],
+[gluincdir=$withval], [gluincdir=""])
+
+# Give the configurer a chance to set a different location for the VIS
+# headers and library
+
+AC_SUBST(vl2mvlibdir)
+AC_ARG_WITH(vl2mv-libdir,
+[  --with-vl2mv-libdir=<libdir> Specify directories to search for the vl2mv
+			  library and headers.  Defaults to \".\".
+			  Expects to find <libdir>/libvl2mv.a],
+[vl2mvlibdir=$withval],
+[vl2mvlibdir="."])
+
+# Give the configurer a chance to set a different location for the vl2mv
+# source.  When specified, "srcdir" points to "master" source, and
+# "local_srcdir" points to the source under local development.
+
+AC_SUBST(local_srcdir)
+AC_ARG_WITH(local-srcdir,
+[  --with-local-srcdir=<srcdir> Specify the root directory to search for
+			  source for packages (the PKGS list).
+			  Expects to find, e.g., <srcdir>/parser/main.c],
+[local_srcdir=$withval],
+[local_srcdir=$srcdir])
+
+dnl Checks for programs.
+
+#----------------------------------------------------------------------
+# Checks for programs we need
+#----------------------------------------------------------------------
+
+AC_PATH_PROG(AR, ar, ar)
+AC_PROG_RANLIB
+AC_PROG_AWK
+AC_PATH_PROG(SED, sed, sed)
+
+AC_CANONICAL_SYSTEM
+AC_SUBST(target)
+
+# Balakrisha Kumthekar (kumtheka@colorado.edu): making a special case
+# for ultrix install, since its annoying about setting groupids.
+case "$target" in
+  mips-dec-ultrix*)
+    INSTALL="helpers/install-sh -c"
+    INSTALL_PROGRAM="\${INSTALL}"
+    INSTALL_DATA="\${INSTALL} -m 644";;
+
+  *)
+  AC_PROG_INSTALL ;;
+esac
+
+# Determine the name of the C compiler we're going to use
+
+AC_ARG_ENABLE(gcc,
+  [  --enable-gcc            Allow use of gcc if available],
+  [gcc_ok=$enableval], [gcc_ok=no])
+
+if test "$gcc_ok" != no; then
+  case "$gcc_ok" in
+    yes)
+      CC=gcc ;;
+    *)
+      CC=$gcc_ok
+  esac
+else
+# Balakrishna Kumthekar <kumtheka@colorado.edu>
+# As we do not support cc on RS6000, Cygwin and SunOS.
+   case "$target" in
+     rs6000-ibm-aix* | *-pc-cygwin32 | sparc-sun-sunos*)
+       CC=gcc ;;
+     *)
+       CC=cc ;;
+   esac
+fi
+
+AC_PROG_CC
+
+AC_ARG_ENABLE(64,
+  [  --enable-64             Use 64-bit pointers on 64-bit Alpha machines],
+  [use_sixty_four=$enableval], [use_sixty_four=no])
+
+if test "$gcc_ok" != no; then
+  use_sixty_four=yes
+fi
+
+
+# Determine the compiler flags to use
+
+DEBUG_CFLAGS="-g"
+DEBUG_LDFLAGS=""
+
+case "$target" in
+
+  sparc-sun-solaris* | i386-pc-solaris*)
+	# Sparc and X86 Solaris:
+	# -xO3: Highest safe level of optimization
+	# -native: Optimize for the native processor (if supported)
+	# -dalign: Generate double-word load/store for performance
+	#          (only for SPARC)
+	# and other arcane compilation flags.
+	if test "$GCC" = yes; then
+	  OPTIMIZE_CFLAGS="-O"
+	else
+	  case "$target" in
+	    sparc-sun-solaris*)
+	      ALIGN=" -dalign" ;;
+	    *)
+	      ALIGN="" ;;
+	  esac
+	  AC_MSG_CHECKING([for -native])
+	  CFLAGS="-xO3 -native$ALIGN"
+	  AC_CACHE_VAL(ac_cv_have_native,
+	  [ AC_TRY_RUN([
+	  main(){exit(0);}
+	  ],ac_cv_have_native=yes,ac_cv_have_native=no,ac_cv_have_native=no)])
+	  if test $ac_cv_have_native = yes ; then
+	    AC_MSG_RESULT(working)
+	    OPTIMIZE_CFLAGS="-xO3 -native$ALIGN"
+	  else
+	    AC_MSG_RESULT(broken)
+	    AC_MSG_CHECKING([for fallback optimization flags])
+	    CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    AC_CACHE_VAL(ac_cv_have_fallback,
+	    [ AC_TRY_RUN([
+	    main(){exit(0);}
+	    ],ac_cv_have_fallback=yes,ac_cv_have_fallback=no,ac_cv_have_fallback=no)])
+	    if test $ac_cv_have_fallback = yes ; then
+	      AC_MSG_RESULT(working)
+	      OPTIMIZE_CFLAGS="-xO3 -fns -fsimple=2$ALIGN -ftrap=%none -xlibmil"
+	    else
+	      AC_MSG_RESULT(broken)
+	      OPTIMIZE_CFLAGS="-O"
+	    fi
+	  fi
+	fi
+	;;
+
+  mips-dec-ultrix*)
+	# MIPS-based DECstations running Ultrix:
+	# -std1: Produce non-ANSI code warnings, and define __STDC__
+	# -O: Use the global "ucode" optimizer
+	# -Olimit 5000: Don't optimize routines bigger than 5000 basic blocks
+	OPTIMIZE_CFLAGS="-std1 -O -Olimit 5000" ;;
+
+  alpha-dec-osf*)
+	# DEC Alpha running OSF:
+
+	# 64-bit mode:
+	# -g3: Produce symbol table information for optimized code
+	# -O4: Enable every optimization
+	# -std: Enforce the ANSI standard with extensions, define __STDC__
+	# -ieee_with_no_inexact: Disable (potentially slow) signaling
+	#   for inexact floating-point results
+	# -tune host: Tune instructions for the compilation host machine
+
+	OPTIMIZE_CFLAGS="-g3 -O4 -std -ieee_with_no_inexact -tune host"
+	DEBUG_CFLAGS="-g -std -ieee_with_no_inexact"
+
+	# -non_shared: Do not use shared libraries
+	# -om: Generate an OMAGIC file for the om optimizer
+	OPTIMIZE_LDFLAGS="-non_shared"
+
+	if test "$use_sixty_four" = "no"; then
+	  # 32-bit mode:
+	  # -xtaso: Make the compiler respond to #pragma pointer_size directives
+	  OPTIMIZE_CFLAGS="$OPTIMIZE_CFLAGS -xtaso"
+	  DEBUG_CFLAGS="$DEBUG_CFLAGS -xtaso"
+
+	  # -taso: Load the executable into the lower 31-bit address space
+	  OPTIMIZE_LDFLAGS="$OPTIMIZE_LDFLAGS -om -taso"
+	  DEBUG_LDFLAGS="$DEBUG_LDFLAGS -taso"
+
+	  AC_DEFINE(SIZEOF_VOID_P, 4)
+	  ac_sizeof_voidp=4
+	fi
+	;;
+
+  hppa*-*-hpux*)
+	# HP running HPUX
+	# -Aa: Behave as an ANSI compiler
+	# -D_HPUX_SOURCE: Include "HP-specific" symbols in the header
+	#   files (e.g., this means sys/resource.h has struct rusage)
+	OPTIMIZE_CFLAGS="-O -Aa -D_HPUX_SOURCE"
+	DEBUG_CFLAGS="-g -Aa -D_HPUX_SOURCE" ;;
+
+     *)
+	# Other systems:
+	OPTIMIZE_CFLAGS="-O" ;;
+
+esac
+
+if test "$GCC" = yes; then
+  case "$target" in
+    i686-pc-linux-gnu | i386-pc-solaris* | i386-pc-cygwin32)
+      AC_MSG_CHECKING([for -mcpu and -malign compiler options])
+      CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      AC_TRY_COMPILE(,,ac_have_mcpu=yes,ac_have_mcpu=no)
+      if test "$ac_have_mcpu" = yes; then
+	AC_MSG_RESULT(working)
+	OPTIMIZE_CFLAGS="-g -O6 -mcpu=pentiumpro -malign-double"
+      else
+	AC_MSG_RESULT(broken)
+	OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    sparc-sun-solaris*)
+      AC_MSG_CHECKING([for -mtune compiler option])
+      CFLAGS="-g -O6 -mtune=ultrasparc"
+      AC_TRY_COMPILE(,,ac_have_mtune=yes,ac_have_mtune=no)
+      if test "$ac_have_mtune" = yes; then
+	AC_MSG_RESULT(working)
+	OPTIMIZE_CFLAGS="-g -O6 -mtune=ultrasparc"
+      else
+	AC_MSG_RESULT(not working)
+	OPTIMIZE_CFLAGS="-g -O3"
+      fi
+      ;;
+    *)
+      OPTIMIZE_CFLAGS="-g -O3"
+      ;;
+  esac
+  OPTIMIZE_LDFLAGS=""
+  DEBUG_CFLAGS="-g"
+  DEBUG_LDFLAGS=""
+fi
+
+AC_ARG_WITH(comp-mode,
+[  --with-comp-mode=<mode> Specify a special compilation mode:
+			  optimize (the default): Produce optimized
+				code, with symbol table information
+				if supported on the platform/compiler,
+				and without asserts.
+			  debug: Produce unoptimized code with symbol table
+				information and asserts enabled
+			  purify: Unoptimized code linked with purify
+			  quantify: Optimized code without asserts
+				linked with quantify],
+[comp_mode=$withval],
+[comp_mode=optimize])
+AC_SUBST(LINKER)
+
+LINKER="$CC"
+
+case "$comp_mode" in
+  debug)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS" ;;
+  purify)
+       CFLAGS="$DEBUG_CFLAGS"
+       LDFLAGS="$DEBUG_LDFLAGS"
+       AC_DEFINE(PURIFY)
+       LINKER="purify -cache-dir=/tmp $CC" ;;
+  quantify)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       AC_DEFINE(QUANTIFY)
+       AC_DEFINE(NDEBUG)
+       LINKER="quantify $CC" ;;
+  optimize | *)
+       CFLAGS="$OPTIMIZE_CFLAGS"
+       LDFLAGS="$OPTIMIZE_LDFLAGS"
+       AC_DEFINE(NDEBUG) ;;
+esac
+
+AC_PROG_LEX
+AC_MSG_CHECKING(if $LEX accepts the -o and -P options)
+
+AC_CACHE_VAL(ac_cv_flex_accepts_op,
+[ ac_cv_flex_accepts_op=yes ;
+echo "%%\
+%%" | $LEX -Ptest -o/dev/null >/dev/null 2>&1 || ac_cv_flex_accepts_op=no ])
+if test $ac_cv_flex_accepts_op = yes ; then
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+  AC_MSG_WARN([You either need a newer version of flex, or need to modify
+the defintion of LEX in the Makefile to point to a version that does
+accept -p -t and -o.])
+fi
+
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PATH_PROG(AR, ar, ar)
+AC_PROG_RANLIB
+AC_PROG_YACC
+AC_MSG_CHECKING([if $YACC accepts the -p, -t, and -o options])
+AC_CACHE_VAL(ac_cv_yacc_accepts_pto,
+[ ac_cv_yacc_accepts_pto=yes ;
+echo "%token terminal\
+%%\
+nonterminal: terminal\
+%%" > config.in
+$YACC -ptest -o /dev/null config.in >/dev/null 2>&1 || ac_cv_yacc_accepts_pto=norm -f config.in ])
+if test $ac_cv_yacc_accepts_pto = yes ; then
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+  AC_MSG_WARN([You either need a newer version of bison, or need to modify
+the defintion of YACC in the Makefile to point to a version that does
+accept -p -t and -o.])
+fi
+
+dnl Checks for libraries.
+
+AC_SUBST(LIBDIRS)
+
+# add -lucb to LIBS and set LIBDIRS to -L/usr/ucblib
+# if there's a libucb.a available
+# (Solaris needs this for signals)
+
+ac_save_ldflags="$LDFLAGS"
+LDFLAGS=-L/usr/ucblib
+AC_CHECK_LIB(ucb,main,LIBDIRS=-L/usr/ucblib)
+LDFLAGS="$ac_save_ldflags"
+
+# add -lbsd if there's a libbsd.a available
+# (e.g., Linux needs this for bsd_ioctl)
+AC_CHECK_LIB(bsd,main)
+
+dnl Replace `main' with a function in -lglu:
+AC_CHECK_LIB(glu, main)
+dnl Replace `main' with a function in -lm:
+AC_CHECK_LIB(m, main)
+
+dnl Checks for header files.
+AC_CHECK_HEADERS(sys/time.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_TIME
+AC_STRUCT_TM
+
+dnl Checks for library functions.
+AC_HEADER_STDC
+AC_FUNC_STRFTIME
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS(getcwd gettimeofday strstr)
+
+
+AC_OUTPUT(Makefile)
Index: vis_dev/vl2mv-2.3/helpers/config.guess
===================================================================
--- vis_dev/vl2mv-2.3/helpers/config.guess	(revision 18)
+++ vis_dev/vl2mv-2.3/helpers/config.guess	(revision 18)
@@ -0,0 +1,1526 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
+
+timestamp='2008-01-23'
+
+# This file is free software; you can redistribute it and/or modify it
+# 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[456])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	eval $set_cc_for_build
+	if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
+	    | grep -q __ARM_EABI__
+	then
+	    echo ${UNAME_MACHINE}-unknown-linux-gnu
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel@ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes@openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf@swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green@stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: vis_dev/vl2mv-2.3/helpers/config.sub
===================================================================
--- vis_dev/vl2mv-2.3/helpers/config.sub	(revision 18)
+++ vis_dev/vl2mv-2.3/helpers/config.sub	(revision 18)
@@ -0,0 +1,1658 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+#   Free Software Foundation, Inc.
+
+timestamp='2008-01-16'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tile*)
+		basic_machine=tile-unknown
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
Index: vis_dev/vl2mv-2.3/helpers/dependency.make
===================================================================
--- vis_dev/vl2mv-2.3/helpers/dependency.make	(revision 18)
+++ vis_dev/vl2mv-2.3/helpers/dependency.make	(revision 18)
@@ -0,0 +1,32 @@
+# FileName	[dependency.make]
+#
+# PackageName	[vis]
+#
+# Synopsis	[Makefile to automatically create the dependency files.]
+#
+# Description	[This file is called from the main Makefile.]
+#
+# SeeAlso	[Makefile.in]
+#
+# Author	[Abelardo Pardo <abel@boulder.colorado.edu>]
+#
+# Copyright	[This file was created at the University of Colorado at Boulder.
+#  The University of Colorado at Boulder makes no warranty about the suitability
+#  of this software for any purpose.  It is presented on an AS IS basis.]
+#
+# Revision	[$Id: dependency.make,v 1.1.1.1 2001/07/09 23:22:45 fabio Exp $]
+
+include $(PKGNAME).make
+
+ifdef DEPENDENCYFILES
+$(PKGNAME).d : $(DEPENDENCYFILES) $(HEADERS) $(PKGNAME).make
+	@echo -n "Dependency file $(PKGNAME).d->"
+	@$(CC) -MM $(CFLAGS) $(AC_FLAGS) $(INCLUDEDIRS) \
+	$(filter %.c, $^) | \
+	sed 's/^[a-zA-Z0-9_]*\.o[ :]*/$(objectdir)\/&/g' > $@
+	@echo "Created."
+else
+$(PKGNAME).d :
+	@echo "No dependency files given in $(PKGNAME).make"
+	@echo "Define the variable DEPENDENCYFILES to create the dependencies"
+endif
Index: vis_dev/vl2mv-2.3/helpers/install-sh
===================================================================
--- vis_dev/vl2mv-2.3/helpers/install-sh	(revision 18)
+++ vis_dev/vl2mv-2.3/helpers/install-sh	(revision 18)
@@ -0,0 +1,238 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+tranformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
Index: vis_dev/vl2mv-2.3/helpers/mkinstalldirs
===================================================================
--- vis_dev/vl2mv-2.3/helpers/mkinstalldirs	(revision 18)
+++ vis_dev/vl2mv-2.3/helpers/mkinstalldirs	(revision 18)
@@ -0,0 +1,32 @@
+#!/bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Last modified: 1994-03-25
+# Public domain
+
+errstatus=0
+
+for file in ${1+"$@"} ; do 
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d in ${1+"$@"} ; do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp" 1>&2
+        mkdir "$pathcomp" || errstatus=$?
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
Index: vis_dev/vl2mv-2.3/src/parser/dataflow.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/dataflow.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/dataflow.c	(revision 18)
@@ -0,0 +1,164 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/dataflow.c,v 1.1.1.1 2001/07/09 23:22:38 fabio Exp $
+
+
+*/
+
+
+#include "util.h"
+#include "st.h"
+#include "list.h"
+#include "array.h"
+#include "set.h"
+#include "stack.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "dataflow.h"
+#include "verilog.h"
+
+int dflow_analysis = 0;
+int dflow_context = 0;
+lsList init_var_stack;
+
+void dataflow_init()
+{
+    init_var_stack = lsCreate();
+    push_stack(init_var_stack, set_empty());
+}
+
+void dataflow_end()
+{
+    lsGen gen;
+    lsHandle handle;
+    set_t *set;
+
+    gen = lsStart(init_var_stack);
+    while (lsNext(gen, (lsGeneric*)&set, &handle) != LS_NOMORE) {
+	set_destroy(set);
+    }
+    lsFinish(gen);
+    lsDestroy(init_var_stack, 0);
+    init_var_stack = 0;
+}
+
+
+void dataflow_analysis(analysis_type, id_sym, gen, kill) 
+int analysis_type;
+vl_id_range *id_sym;
+int gen;
+int kill;
+{
+    if (gen && kill) {
+	char buf[MAXSTRLEN];
+
+	sprintf("dataflow analysis: GEN and KILL '%s' at the same time",
+		id_sym->name);
+	internal_error(buf);
+    }
+
+    if (vl_currentModule) {
+
+	if (analysis_type & DF_UninitVar &&
+	    (dflow_context & DFLOW_Always)) {
+	    if (gen) 
+		record_uninitialized_var(id_sym);
+	    else if (kill)
+		record_initialized_var(id_sym);
+	}
+
+    }
+
+}
+
+void dataflow_dup_set()
+{
+    if (!init_var_stack) return;
+    push_stack(init_var_stack, (void*)set_dup(top_stack(init_var_stack)));
+}
+
+set_t *dataflow_pop_set()
+{
+    set_t *retval;
+
+    if (!init_var_stack) return NIL(set_t);
+    pop_stack(init_var_stack, (void**)&retval);
+    return retval;
+}
+
+void dataflow_replace_set(new_set)
+set_t *new_set;
+{
+    set_t *top_set;
+
+    if (!init_var_stack) return;
+    pop_stack(init_var_stack, (void**)&top_set);
+    push_stack(init_var_stack, new_set);
+    set_destroy(top_set);
+}
+
+set_t *dataflow_merge_set(set1, set2)
+set_t *set1, *set2;
+{
+    set_t *retval;
+
+    if (!init_var_stack) return NIL(set_t);
+    retval = set_intersect(set1, set2);
+    return retval;
+}
+
+void dataflow_free_set(set)
+set_t *set;
+{
+    if (set) set_destroy(set);
+}
+
+void record_uninitialized_var(id_sym)
+vl_id_range *id_sym;
+{
+    if (!init_var_stack) return;
+
+    if (!set_find(id_sym->name, (set_t*)top_stack(init_var_stack))) {
+	if (!set_find(id_sym->name, vl_currentModule->uninit_set)) {
+	    vl_id_range *id_range;
+
+	    if (st_lookup(vl_currentModule->sig_st, 
+			  id_sym->name, (char**)&id_range)) {
+		id_range->flags |= UninitializeVar;
+		set_add(id_range->name, vl_currentModule->uninit_set);
+	    } 
+	}
+    }
+}
+
+void record_initialized_var(id_sym)
+vl_id_range *id_sym;
+{
+    if (!init_var_stack) return;
+
+    if (!set_find(id_sym->name, (set_t*)top_stack(init_var_stack))) {
+	set_add(id_sym->name, (set_t*)top_stack(init_var_stack));
+    }
+}
+
+
+
Index: vis_dev/vl2mv-2.3/src/parser/dataflow.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/dataflow.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/dataflow.h	(revision 18)
@@ -0,0 +1,10 @@
+EXTERN void dataflow_analysis ARGS((int, vl_id_range *, int, int));
+EXTERN void dataflow_dup_set ARGS(());
+EXTERN set_t *dataflow_pop_set ARGS(());
+EXTERN void dataflow_replace_set ARGS((set_t*));
+EXTERN set_t *dataflow_merge_set ARGS((set_t*, set_t*));
+EXTERN void dataflow_free_set ARGS((set_t*));
+EXTERN void record_uninitialized_var ARGS((vl_id_range*));
+EXTERN void record_initialized_var ARGS((vl_id_range*));
+EXTERN void dataflow_init ARGS(());
+EXTERN void dataflow_end ARGS(());
Index: vis_dev/vl2mv-2.3/src/parser/main.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/main.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/main.c	(revision 18)
@@ -0,0 +1,376 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/main.c,v 1.2 2009/03/09 20:25:57 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#include "util.h"
+#include "array.h"
+#include "st.h"
+#include "list.h"
+#include "set.h"
+#include "stack.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_traverse.h"
+#include "vl_write.h"
+#include "vl_mux.h"
+#include "verilog.h"
+
+extern vl_descPtr vl_description;
+extern int YYTrace;
+extern lsList vl_module_stack;
+extern lsList vl_cur_type_stack;
+extern st_table *macros;
+extern int PrtEnable;
+extern int dumpSyncCkt;
+extern int dflow_analysis;
+extern int Loop_Unrolling;
+extern int Repeat_Unrolling;
+extern int do_encoding;
+extern int debug_mode;
+extern int Use_MV_Lib;
+extern int set_notation;
+extern int implicitDeclare;
+extern int implicitClocking;
+extern int combinationalReduction;
+extern int chk_IncompleteBranch;
+extern int vlTimedSystem;
+extern int wireRegister;
+extern int portPerLine;
+extern int compatibleChecking;
+extern int use_libraryGate;
+extern int vis_nond;
+extern int vl_noTimers;
+extern int decomposeTable;
+extern int smartEvent;
+extern int indexAssignment;
+extern int NoDetailedComment;
+extern int implicitClockWire;
+extern int arrayBoundNond;
+extern int RQautomata;
+extern int deadlock_semantic;
+extern int Zconnection;
+extern char *vl_filename;
+extern FILE *yyin;
+extern FILE *mv_file;
+extern FILE *open_file();
+extern stack_t file_stack;
+extern stack_t fname_stack;
+extern stack_t lineno_stack;
+extern stack_t buffer_stack;
+extern int instantiateAll;
+extern FILE *null_file;
+
+FILE *vl_OutStream=NIL(FILE);
+char *vl_OutStreamName=NIL(char);
+
+FILE *siserr;
+
+int noBus=0;
+
+int WarningLevel=0;
+int vlPhase=0;
+int encodeTimer=1;
+int userControlLibraryGate=0;
+
+char *opts = "AbBcdD:eEf:FgiIklMnNo:OpPrR:StT:uvwW:xyZz";
+int ith_module = 0;
+
+int Warn_Uninitialized = 0;
+int Warn_DuplicateInst = 0;
+
+#define VIS_LIB_PATH	"VIS_LIBRARY_PATH"
+#define SISLIB_MV       "sislib.mv"
+#define SISLIB_V        "sislib.v"
+
+UNUSED static char rcsid[] = "$Id: main.c,v 1.2 2009/03/09 20:25:57 fabio Exp $";
+
+static void usage ARGS((char *cmd));
+static void predefine_macros ARGS((st_table *macros));
+
+int main(int argc, char *argv[])
+{
+#ifdef _IBMR2
+    int c;
+#else
+    char c;
+#endif
+    lsHandle handle;
+    lsGen gen;
+    vl_module *mod;
+    int i;
+    int dumpOnly=0;
+    int use_stdout=0;
+    char *out_filename = NIL(char);
+    struct timeval tval;
+    struct timezone tzone;
+    struct tm *current_time;
+    char buf[MAXSTRLEN];
+    extern int optind;
+    extern char *optarg;
+    extern int use_rst_ckt;
+
+    mv_file = stdout;
+    siserr = stderr;
+
+    gettimeofday(&tval, &tzone);
+    current_time = localtime((time_t *)(&(tval.tv_sec)));
+
+
+    macros = st_init_table(strcmp, st_strhash);
+    predefine_macros(macros);
+
+
+    vl_module_stack = lsCreate();
+    vl_cur_type_stack = lsCreate();
+
+    if (argc <= 1) {
+	usage(argv[0]);
+    }
+
+    while ((c = getopt(argc, argv, opts)) != EOF) {
+	switch (c) {
+	case 'A': use_stdout=1; break;
+	case 'b': noBus=1; break;
+	case 'B': chk_IncompleteBranch = 0; break;
+	case 'c': implicitClocking = 0; vlTimedSystem = 1; break;
+	case 'C': compatibleChecking = 1; break;
+	case 'd': PrtEnable=1; dumpOnly=1; break;
+	case 'D':
+	    switch (*optarg) {
+	    case 'l': dflow_analysis |= DF_UninitVar; break;
+	    default: usage(argv[0]);
+	    }
+	    break;
+	case 'e': do_encoding = 1; break;
+	case 'E': smartEvent = 0; break;
+	case 'f': portPerLine = atoi(optarg); break;
+	case 'F': vl_noTimers = 1; break;
+	case 'g': debug_mode=1; break;
+	case 'i': implicitDeclare=0; break;
+	case 'I': instantiateAll=0; break;
+	case 'k': deadlock_semantic = 1; break;
+	case 'l': Use_MV_Lib=1; break;
+	case 'L': userControlLibraryGate = 1; break;
+	case 'M': NoDetailedComment=1; break;
+	case 'n': dumpSyncCkt=1; break;
+	case 'N': arrayBoundNond=1; break;
+	case 'o': out_filename = vlStrdup(optarg); break;
+	case 'O': combinationalReduction = 1; break;
+	case 'P': Repeat_Unrolling = ~Repeat_Unrolling; break;
+	case 'p': PrtEnable=1; break;
+	case 'R': if (!strcmp(optarg,"Uninitialized")) Warn_Uninitialized=1;
+		  if (!strcmp(optarg,"DuplicateInst")) Warn_DuplicateInst=1;
+	  break;
+	case 'r': use_rst_ckt = 1; break;
+	case 'S': set_notation=0; break;
+	case 't': YYTrace=1; break;
+	case 'T': decomposeTable = atoi(optarg); break;
+	case 'u': Loop_Unrolling=0; break;
+	case 'v': implicitClockWire=1; break;
+	case 'w': wireRegister=1; break;
+	case 'W': WarningLevel = atoi (optarg); break;
+	case 'x': indexAssignment = 1; break;
+	case 'y': RQautomata = 0; break;
+	case 'Z': vis_nond = 0; break;
+	case 'z': Zconnection = 1; break;
+	default: usage(argv[0]);
+	}
+    }
+
+
+    file_stack = create_stack();
+    fname_stack = create_stack();
+    lineno_stack = create_stack();
+    buffer_stack = create_stack();
+    vl_filename = argv[optind];
+    yyin = fopen(argv[optind],"r");
+    fprintf(stderr, "%s\n", vl_filename);
+    if (!yyin) {
+	fprintf(stderr, "failed to open file %s\n", vl_filename);
+	exit(1);
+    }
+
+
+    vlPhase = 0;
+    if (yyparse())
+	printf("-- parsing failure\n");
+    chk_mp_definitions(vl_description->mp_undefined);
+
+    if (!use_stdout) {
+	if (!out_filename) {
+	    char *tmp_filename;
+	    tmp_filename = basename(vl_filename);
+	    out_filename = chk_malloc(strlen(tmp_filename)+15);
+	    strcpy(out_filename, tmp_filename);
+	    strcat(out_filename, ".mv");
+	    vl_OutStreamName = vlStrdup(out_filename);
+	    vl_OutStream = mv_file = open_file(out_filename, "w");
+	    vl_chk_free(out_filename);
+	    out_filename = NIL(char);
+	} else {
+	    vl_OutStreamName = vlStrdup(out_filename);
+	    vl_OutStream = mv_file = open_file(out_filename, "w");
+	    vl_chk_free(out_filename);
+	    out_filename = NIL(char);
+	}
+    }
+
+    null_file = open_file("/dev/null", "w");
+    fprintf(mv_file, "%s ", HSIS_COMMENT);
+    for (i=0; i<argc; i++) {
+	fprintf(mv_file, "%s ", argv[i]);
+    }
+    fprintf(mv_file, "\n");
+    fprintf(mv_file, "%s version: %s\n", HSIS_COMMENT, VL2MV_VERSION);
+    strftime(buf, MAXSTRLEN, "%T %m/%d/%Y (%Z)", current_time);
+    fprintf(mv_file, "%s date:    %s\n", HSIS_COMMENT, buf);
+
+    vlPhase = 1;
+
+    for (gen=lsStart(vl_description->modules);
+	 lsNext(gen, (lsGeneric*)&mod, &handle) != LS_NOMORE; ) {
+	vl_step_desc(mod->name->name, (char*)mod, NIL(char));
+    }
+    lsFinish(gen);
+
+    if (!dumpOnly) {
+
+	vlPhase = 2;
+	PrtEnable = 1;
+	gen = lsStart(vl_description->modules);
+	while (lsNext(gen, (lsGeneric*)&mod, &handle) != LS_NOMORE) {
+	    vl_write_desc(mod->name->name, (char*)mod, NIL(char));
+	    ith_module++;
+	}
+	vl_dump_libs(mv_file, vl_description->decl_st);
+    }
+
+    if (use_libraryGate) {
+	if (!userControlLibraryGate) {
+	    char *visLibPath;
+	    if ((visLibPath=getenv(VIS_LIB_PATH))) {
+		char *file_path;
+		if ((file_path = util_file_search(SISLIB_MV,visLibPath,"r"))) {
+		    fprintf(mv_file, ".include %s\n", SISLIB_MV);
+		} else if ((file_path = util_file_search(SISLIB_V,
+							visLibPath, "r"))) {
+		   if (!(yyin = fopen(file_path, "r"))) {
+			fprintf(stderr, "fail to open %s\n", file_path);
+			exit(1);
+		   }
+		   yylineno = 1;
+		   if (yyparse()) {
+			fprintf(stderr, "parsing failure for library file %s\n",
+				file_path);
+			exit(1);
+		   }
+		   fclose(yyin);
+		} else {
+		    fprintf(stderr, "cannot file sislib.mv/sislib.v in $%s, insert \".include sislib.mv\" in your generated mv file\n",
+			    VIS_LIB_PATH);
+		    fprintf(mv_file, ".include %s\n", SISLIB_MV);
+		}
+	    } else {
+		fprintf(stderr, "cannot file sislib.mv/sislib.v in $%s, insert \".include sislib.mv\" in your generated mv file\n",
+			VIS_LIB_PATH);
+		fprintf(mv_file, ".include %s\n", SISLIB_MV);
+	    }
+	}
+    }
+
+    return 0;
+}
+
+static void usage(char *cmd)
+{
+    fprintf(stderr, "usage: %s -%s <filename>\n", cmd, opts);
+    fprintf(stderr, "\tversion %s\n", VL2MV_VERSION);
+    fprintf(stderr, "       -A        : dump output to stdout\n");
+    fprintf(stderr, "       -b        : no multiple output for bus connection\n");
+    fprintf(stderr, "       -B        : disable check incomplete branches\n");
+    fprintf(stderr, "       -c        : explicit clocking\n");
+
+    fprintf(stderr, "       -d        : dump internal representation only\n");
+
+
+    fprintf(stderr, "       -E        : turn off smart event (save register)\n");
+    fprintf(stderr, "       -f        : split line for long port lists\n");
+    fprintf(stderr, "       -F        : ignore all timing (watch out!!)\n");
+    fprintf(stderr, "       -g        : put debugging information\n");
+    fprintf(stderr, "       -i        : turn off auto declaration of 1-bit wires\n");
+    fprintf(stderr, "       -I        : supress declaration of modules of included file when `VL2MVundefMod is in place\n");
+    fprintf(stderr, "       -L        : users wish to control the generation of gates instead of using default search/generation schemes.\n");
+
+    fprintf(stderr, "       -M        : forbidden verbose comments\n");
+    fprintf(stderr, "       -n        : check if create physically clocked latches\n");
+    fprintf(stderr, "       -N        : use nondeterminism for out-of-bound array access\n");
+    fprintf(stderr, "       -o <file> : send output to <file>\n");
+    fprintf(stderr, "       -O        : combinational reduction\n");
+    fprintf(stderr, "       -P        : disable repeat loop unrolling\n");
+    fprintf(stderr, "       -p        : dump internal representation\n");
+
+    fprintf(stderr, "       -R <warn> : provide various warning messages\n");
+    fprintf(stderr, "          <warn> = Uninitialized DuplicateInst\n");
+    fprintf(stderr, "       -t        : dump parsing trace\n");
+    fprintf(stderr, "       -T <width>: decompose nonblocking assignment table wider than <width>\n");
+    fprintf(stderr, "       -u        : turn off loop unrolling\n");
+    fprintf(stderr, "       -v        : wire for 'clocks' in implicit clocking\n");
+    fprintf(stderr, "       -w        : put register to prevent self reference wire in alwyas stmt\n");
+    fprintf(stderr, "       -W <level>: set warning level\n");
+    fprintf(stderr, "       -x        : put in assignment to idnex variable in for-loop unrolling\n");
+    fprintf(stderr, "       -y        : do not attempt to make Timing Maching RQ (save states)\n");
+    fprintf(stderr, "       -z        : use wire-or for resolution function instead of conflict arbiter\n");
+    fprintf(stderr, "                   useful for hi-Z modeling\n");
+    fprintf(stderr, "       -Z        : (turn on) limit $ND to only continuous assignments for VIS\n");
+    fprintf(stderr, "                 : WARNING: when this is on, only \"assign <id> = $ND(...);\" is allowed\n");
+    exit(255);
+}
+
+void vl_exit(int code)
+{
+    if (vl_OutStream != NIL(FILE))
+	unlink(vl_OutStreamName);
+    exit(code);
+}
+
+char *predefined_symbols[] = {
+    "__vl2mv__",
+    "__synth__",
+    NULL
+};
+
+static void predefine_macros(st_table *macros)
+{
+    int i;
+    char *cp;
+
+    for (i=0 ; (cp=predefined_symbols[i]); i++) {
+	st_insert(macros, cp, " ");
+    }
+}
Index: vis_dev/vl2mv-2.3/src/parser/parser.make
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/parser.make	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/parser.make	(revision 18)
@@ -0,0 +1,30 @@
+CSRC += main.c dataflow.c util.c vl_clock.c vl_copy.c vl_create.c \
+	vl_edgedetector.c vl_flowgraph.c vl_latch.c vl_mux.c \
+	vl_nonblock.c vl_reset.c vl_resolution.c vl_traverse.c vl_vardecl.c \
+	vl_write.c vl_write_util.c
+HEADERS += vl_copy.h vl_create.h vl_defs.h vl_edgedetector.h vl_fg_defs.h \
+	vl_fg_types.h vl_flowgraph.h vl_mux.h vl_nonblock.h \
+	vlr_int.h vl_traverse.h vl_types.h vl_vardecl.h vl_write.h \
+	vl_write_util.h dataflow.h verilog.h
+LEXSRC += verilog.l
+YACCSRC += verilog.y
+GENERATEDCSRC += verilog_yacc.c verilog_lex.c
+
+$(objectdir)/verilog_yacc.c $(objectdir)/verilog_yacc.h : verilog.y verilog_lex.c
+	$(YACC) -d -t -o $(objectdir)/verilog_yacc.c $<
+#	-@mv y.tab.c $(objectdir)/verilog_yacc.c
+#	-@mv y.tab.h $(objectdir)/verilog_yacc.h
+	-@chmod 0644 $(objectdir)/verilog_yacc.c $(objectdir)/verilog_yacc.h
+
+$(objectdir)/verilog_lex.c: verilog.l
+	$(LEX) -o$(objectdir)/verilog_lex.c $<
+	-@chmod 0644 $(objectdir)/verilog_lex.c
+
+$(objectdir)/verilog_yacc.o: $(objectdir)/verilog_yacc.c
+
+$(objectdir)/verilog_lex.o: $(objectdir)/verilog_lex.c
+
+util.o : util.c $(objectdir)/verilog_yacc.h
+
+
+DEPENDENCYFILES = $(CSRC)
Index: vis_dev/vl2mv-2.3/src/parser/util.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/util.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/util.c	(revision 18)
@@ -0,0 +1,721 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/util.c,v 1.4 2009/03/09 20:25:57 fabio Exp $
+
+
+*/
+
+
+#include <stdio.h>
+#include "util.h"
+#include "st.h"
+#include "list.h"
+#include "array.h"
+#include "set.h"
+#include "vl_defs.h"
+#include "vl_types.h"
+#include "vlr_int.h"
+#include "verilog_yacc.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "verilog.h"
+
+void chk_error(str)
+char *str;
+{
+    fprintf(stderr, "internal utility error:%s\n", str);
+    vl_exit(ERR_CHK);
+}
+
+char *chk_malloc(unsigned n)
+{
+    char *retval;
+    if ((retval=(char*)malloc((n==0)?1:n)) == NIL(char))
+	chk_error("can't allocate memory ");
+    memset(retval, 0, n);
+    return retval;
+}
+
+void vl_chk_free(lsGeneric p)
+{
+    free((char *)p);
+}
+
+
+char* vlStrdup(char *str)
+{
+    char *retval;
+    unsigned length;
+
+    length = strlen(str)+1;
+    retval = (char*)chk_malloc(length);
+    strcpy(retval, str);
+    return retval;
+}
+
+
+void compile_error(char* str)
+{
+    extern int yylineno;
+
+    if (yylineno >=0)
+	fprintf(stderr, "line %d %s\n", yylineno, str);
+    else
+	fprintf(stderr, "%s\n", str);
+    vl_exit(ERR_COMPILE);
+}
+
+void semantic_error(char *str)
+{
+    fprintf(stderr, "semantic error: %s\n", str);
+    vl_exit(ERR_SEMANTIC);
+}
+
+void internal_error(char *str)
+{
+    fprintf(stderr, "internal error: %s\n", str);
+    vl_exit(ERR_INTERNAL);
+}
+
+void Translate_Warning(char *str)
+{
+    fprintf(stderr, "%s, translation might be imprecise\n",
+	    str);
+    vl_exit(ERR_SEMANTIC);
+}
+
+void Translate_Notice(char *str)
+{
+    fprintf(stderr, "%s\n", str);
+}
+
+int drive_strength(int strength0, int strength1)
+{
+    int retval = -1;
+
+    switch(strength0) {
+    case YYSUPPLY0:
+	switch(strength1) {
+	case YYSUPPLY1:retval = Supply1Supply0; break;
+	case YYSTRONG1:retval = Strong1Supply0; break;
+	case YYPULL1:  retval = Pull1Supply0; break;
+	case YYWEAK1:  retval = Weak1Supply0; break;
+	case YYHIGHZ1: retval = HighZ1Supply0; break;
+	default: compile_error("illegal strength0/strength1");
+	}
+	break;
+    case YYSTRONG0:
+	switch(strength1) {
+	case YYSUPPLY1:retval = Supply1Strong0; break;
+	case YYSTRONG1:retval = Strong1Strong0; break;
+	case YYPULL1:  retval = Pull1Strong0; break;
+	case YYWEAK1:  retval = Weak1Strong0; break;
+	case YYHIGHZ1: retval = HighZ1Strong0; break;
+	default: compile_error("illegal strength0/strength1");
+	}
+	break;
+    case YYPULL0:
+	switch(strength1) {
+	case YYSUPPLY1:retval = Supply1Pull0; break;
+	case YYSTRONG1:retval = Strong1Pull0; break;
+	case YYPULL1:  retval = Pull1Pull0; break;
+	case YYWEAK1:  retval = Weak1Pull0; break;
+	case YYHIGHZ1: retval = HighZ1Pull0; break;
+	default: compile_error("illegal strength0/strength1");
+	}
+	break;
+    case YYWEAK0:
+	switch(strength1) {
+	case YYSUPPLY1:retval = Supply1Weak0; break;
+	case YYSTRONG1:retval = Strong1Weak0; break;
+	case YYPULL1:  retval = Pull1Weak0; break;
+	case YYWEAK1:  retval = Weak1Weak0; break;
+	case YYHIGHZ1: retval = HighZ1Weak0; break;
+	default: compile_error("illegal strength0/strength1");
+	}
+	break;
+    case YYHIGHZ0:
+	switch(strength1) {
+	case YYSUPPLY1:retval = Supply1HighZ0; break;
+	case YYSTRONG1:retval = Strong1HighZ0; break;
+	case YYPULL1:  retval = Pull1HighZ0; break;
+	case YYWEAK1:  retval = Weak1HighZ0; break;
+	case YYHIGHZ1: retval = HighZ1HighZ0; break;
+	default: compile_error("illegal strength0/strength1");
+	}
+	break;
+    default: compile_error("illegal strength0/strength1");
+    }
+
+    return retval;
+}
+
+
+void insert_instances(lsList inst_list, void *inst_master)
+{
+    lsHandle handle;
+    extern int Warn_DuplicateInst;
+
+
+    if (vl_currentModule == NIL(vl_module)) {
+	compile_error("instantiate mod/prim/gate not within module");
+    } else {
+	lsGen gen;
+	typestruct *mpg;
+
+	for (gen = lsStart(inst_list);
+	     lsNext(gen, (lsGeneric*)&mpg, &handle) != LS_NOMORE; ) {
+	    if (((vl_mod_prim_inst*)mpg)->name) {
+		if (st_lookup(vl_currentModule->inst_st,
+			      ((vl_mod_prim_inst*)mpg)->name->name,
+			      (char**)&mpg)) {
+		    if (Warn_DuplicateInst) {
+			char buf[MAXSTRLEN];
+			sprintf(buf, "%s:%s:Duplicated instance name",
+				vl_currentModule->name->name,
+				((vl_mod_prim_inst*)mpg)->name->name);
+			Translate_Notice(buf);
+		    }
+		}
+		st_insert(vl_currentModule->inst_st,
+			  ((vl_mod_prim_inst*)mpg)->name->name, (char*)mpg);
+		((vl_mod_prim_inst*)mpg)->name->mpg_master_exp = inst_master;
+	    }
+	}
+	(void) lsFinish(gen);
+    }
+}
+
+
+void collect_latch(char *name)
+{
+    extern int rst_ckt;
+    extern int in_reset_stmt;
+    vl_id_range *id_sym, *latch_sym;
+    blif_latch *latch;
+    char latch_name[MAXSTRLEN];
+
+    if (!st_lookup(vl_currentModule->latch_st, name, (char**)&latch)) {
+	if (!st_lookup(vl_currentModule->sig_st, name, (char**)&id_sym)) {
+	    char buf[MAXSTRLEN];
+
+	    yylineno = -1;
+	    sprintf(buf, "%s %s", name, "undefined and used as latch");
+	    compile_error(buf);
+	    id_sym = vl_create_id_range(name, NIL(vl_range));
+	    st_insert(vl_currentModule->sig_st, name, (char*)id_sym);
+	}
+	sprintf(latch_name, "%s%s", name, SEP_LATCH);
+	latch_sym = vl_copy_id_range(id_sym);
+	latch_sym->flags = id_sym->flags;
+	latch_sym->syndrome_expr_list = lsCreate();
+	latch_sym->initial = lsCreate();
+	free(latch_sym->name);
+	latch_sym->name = vlStrdup(latch_name);
+	st_insert(vl_currentModule->sig_st,
+		  vlStrdup(latch_name), (char*)latch_sym);
+	latch = create_latch(id_sym, NIL(vl_term), NIL(vl_term));
+	latch->flags |= (rst_ckt || in_reset_stmt) ?
+	    NBASSIGN_IN_INITIAL : NBASSIGN_IN_ALWAYS;
+	st_insert(vl_currentModule->latch_st, name, (char*)latch);
+    } else {
+	latch->flags |= (rst_ckt || in_reset_stmt) ?
+	    NBASSIGN_IN_INITIAL : NBASSIGN_IN_ALWAYS;
+    }
+}
+
+
+void collect_quasi(char *name)
+{
+    vl_id_range *id_sym, *quasi_sym;
+    int dummy;
+    char quasi_name[MAXSTRLEN];
+
+    if (!st_lookup(vl_currentModule->quasi_st, name, (char**)&dummy)) {
+	if (!st_lookup(vl_currentModule->sig_st, name, (char**)&id_sym)) {
+	    char buf[MAXSTRLEN];
+
+	    yylineno = -1;
+	    sprintf(buf,
+		"%s undefined and used as lhs of quasi-continuous assignment",
+		    name);
+	    compile_error(buf);
+	    id_sym = vl_create_id_range(name, NIL(vl_range));
+	    st_insert(vl_currentModule->sig_st, name, (char*)id_sym);
+	}
+	sprintf(quasi_name, "%s%s", name, SEP_QUASI);
+	quasi_sym = vl_copy_id_range(id_sym);
+	quasi_sym->flags = id_sym->flags;
+	quasi_sym->syndrome_expr_list = lsCreate();
+	free(quasi_sym->name);
+	quasi_sym->name = vlStrdup(quasi_name);
+	st_insert(vl_currentModule->sig_st,
+		  vlStrdup(quasi_name), (char*)quasi_sym);
+	st_insert(vl_currentModule->quasi_st, name, (char*)0);
+    }
+}
+
+
+void extract_delay_strength(lsList delay_strength,
+			    vl_delay **delay,
+			    int *strength)
+{
+    int head, tail;
+
+    switch (lsLength(delay_strength)) {
+    case 0: break;
+    case 1:
+	lsFirstItem(delay_strength, (lsGeneric*)&head, 0);
+	if (head & LEAST_SB)
+	    *delay = (vl_delay*)(head & (~LEAST_SB));
+	else
+	    *strength = (head >> 2);
+	break;
+    case 2:
+	lsFirstItem(delay_strength, (lsGeneric*)&head, 0);
+	lsLastItem(delay_strength, (lsGeneric*)&tail, 0);
+	if (head & LEAST_SB || !(tail & LEAST_SB))
+	    compile_error("mod/prim/gate illegal drive_strength | delay");
+	*strength = (head >> 2);
+	*delay = (vl_delay*)(tail & (~LEAST_SB));
+	break;
+    default: compile_error("too many drive_strength | delay");
+    }
+}
+
+
+void associate_symbolic_value(vl_lval *lval, vl_expr *expr)
+{
+    vl_id_range *id_sym;
+    char *mbody;
+    extern char last_macro[];
+    extern st_table *macros;
+
+    if (expr->type==IntExpr || expr->type==BitExpr)
+	if (*last_macro &&  lval->type!=ConcatExpr) {
+	    if (st_lookup(vl_currentModule->sig_st,
+			  lval->name->name, (char**)&id_sym)) {
+		if (!st_lookup(id_sym->symbolic_values, last_macro, &mbody)) {
+		    st_lookup(macros, last_macro, &mbody);
+		    st_insert(id_sym->symbolic_values,
+			      vlStrdup(last_macro), vlStrdup(mbody));
+		}
+	    }
+	}
+}
+
+
+void dup_info_var_in_st(st_table *vars)
+{
+    st_generator *gen;
+    char *key;
+    var_info *cur_var;
+
+    gen = st_init_gen(vars);
+    while (st_gen(gen, &key, (char**)&cur_var)) {
+	st_insert(vars, key, (char*)copy_var_info(cur_var));
+    }
+    st_free_gen(gen);
+}
+
+void reset_cond_list_in_st(st_table *vars)
+{
+    st_generator *gen;
+    char *key;
+    var_info *cur_var;
+
+    gen = st_init_gen(vars);
+    while (st_gen(gen, &key, (char**)&cur_var)) {
+	lsDestroy(cur_var->cond_list,0);
+	cur_var->cond_list = lsCreate();
+    }
+    st_free_gen(gen);
+}
+
+int data_width(vl_expr *expr)
+{
+    int retval = 0, v;
+
+    switch(expr->type) {
+    case IntExpr:
+	for (retval=0, v=expr->u.intval; v>0; v >>= 1) retval++;
+	break;
+    case RealExpr:
+	for (retval=0, v=(int)expr->u.realval; v>0; v >>= 1) retval++;
+	break;
+    case BitExpr: break;
+    }
+
+    return retval;
+}
+
+char *strappend(char *str1, char *str2)
+{
+    char *retval;
+    strcat(str1, str2);
+    retval = str1 + strlen(str2);
+    return retval;
+}
+
+char *strappendS(char *str1, char *str2)
+{
+    strcat(str1, str2);
+    strcat(str1, " ");
+    return (str1 + strlen(str2)+1);
+}
+
+char *WRT_BLIF_DC(FILE *file)
+{
+    char *retval;
+
+    retval = vlStrdup(new_termname());
+    fprintf(file, ".names %s\n-\n", retval);
+    return retval;
+}
+
+char *WRT_BLIF_MV_DC(FILE *file, lsList domain)
+{
+    char *retval;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+    int i;
+
+    retval = vlStrdup(new_termname());
+
+    fprintf(file, ".mv %s %d ", retval, lsLength(domain));
+    for (enum_gen=lsStart(domain), i=0;
+	 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;
+	 i++) {
+	fprintf(file, "%s ", enum_elt->name);
+    }
+    lsFinish(enum_gen);
+    fprintf(file, "\n");
+
+    fprintf(file, ".names %s\n-\n", retval);
+    return retval;
+}
+
+char *WRT_BLIF_GND(FILE *file)
+{
+    char *retval;
+
+    retval = vlStrdup(new_termname());
+    fprintf(file, ".names %s\n", retval);
+    fprintf(file, "0\n");
+    return retval;
+}
+
+char *WRT_BLIF_SUP(file)
+FILE *file;
+{
+    char *retval;
+
+    retval = vlStrdup(new_termname());
+    fprintf(file, ".names %s\n", retval);
+    fprintf(file, "1\n");
+    return retval;
+}
+
+vl_term *true_term(file)
+FILE *file;
+{
+    vl_term *retval;
+
+    retval = vl_create_term(vl_create_id_range(vlStrdup(new_termname()),NIL(vl_range)),
+			       0, -1);
+    fprintf(file, ".names %s\n", retval->name->name);
+    fprintf(file, "1\n");
+    return retval;
+}
+
+vl_term *false_term(file)
+FILE *file;
+{
+    vl_term *retval;
+
+    retval = vl_create_term(vl_create_id_range(vlStrdup(new_termname()),NIL(vl_range)),
+			       0, -1);
+    fprintf(file, ".names %s\n", retval->name->name);
+    fprintf(file, "0\n");
+    return retval;
+}
+
+int ptrcmp(ptr1, ptr2)
+const char *ptr1;
+const char *ptr2;
+{
+    if (ptr1==ptr2) return 0;
+    if (ptr1 < ptr2) return -1;
+    if (ptr1 > ptr2) return 1;
+
+    return 0;
+}
+
+int ptrhash(key, modulus)
+char *key;
+int modulus;
+{
+    return ((int)key % modulus);
+}
+
+
+int declcmp(char *ptr1, char *ptr2)
+{
+    int l1, l2;
+    int r1, r2;
+
+    l1 = vl_eval_expr(get_decl_range_left(ptr1));
+    r1 = vl_eval_expr(get_decl_range_right(ptr1));
+    l2 = vl_eval_expr(get_decl_range_left(ptr2));
+    r2 = vl_eval_expr(get_decl_range_right(ptr2));
+
+    if (l1==l2 && r1==r2)
+	return 0;
+    else
+	return 1;
+}
+
+int declhash(key, modulus)
+char *key;
+int modulus;
+{
+    return ((int)key % modulus);
+}
+
+int str_matchtail(char *str, char *pat)
+{
+    char *cp;
+
+    if (strlen(str) < strlen(pat)) return 0;
+
+    cp = &str[strlen(str)-strlen(pat)];
+    return !strcmp(cp, pat);
+}
+
+char *strip_char (str, ch)
+char *str;
+char *ch;
+{
+    char *cp;
+
+    if (strlen(str) >= strlen(ch)) {
+	cp = &str[strlen(str)-strlen(ch)];
+	if (!strcmp(cp,ch)) *cp = '\0';
+    }
+    return str;
+}
+
+FILE *open_file(name, mode)
+char *name;
+char *mode;
+{
+    FILE *retval;
+
+    retval = fopen(name, mode);
+    if (!retval) {
+	char msg[MAXSTRLEN];
+
+	sprintf(msg, "can't open file %s", name);
+	chk_error(msg);
+    }
+    return retval;
+}
+
+void close_file(file)
+FILE *file;
+{
+    fclose(file);
+}
+
+char *num_to_binstr(num, width)
+int num, width;
+{
+    static char retval[MAXSTRLEN];
+    int i;
+
+    for (i=0; i<width; i++) {
+	retval[width-i-1] = (char)('0'+(num & 1));
+	num = (num >> 1);
+    }
+    retval[width] = '\0';
+
+    return retval;
+}
+
+
+int min_bit_width(a)
+int a;
+{
+    int retval;
+    int largest_num;
+
+
+    for (retval=1, largest_num=1;
+	 largest_num < a;
+	 largest_num = (largest_num << 1) | 1) retval++;
+
+    return retval;
+}
+
+
+st_table *st_union(st1, st2)
+st_table *st1;
+st_table *st2;
+{
+    st_generator *gen;
+    char *key;
+    var_info *vinfo, *vinfo1;
+
+    gen = st_init_gen(st2);
+    while (st_gen(gen, &key, (char**)&vinfo)) {
+	if (!st_lookup(st1, key, (char**)&vinfo1)) {
+	    st_insert(st1, key, (char*)vinfo);
+	}
+    }
+    st_free_gen(gen);
+
+    return st1;
+}
+
+
+char *sys_lib_encode(type, widthi, widtho)
+int type;
+int widthi, widtho;
+{
+    static char retval[MAXSTRLEN];
+
+    if (type == LIBplus || type == LIBminus) {
+	sprintf(retval, "%s%s_%d_%d", HSIS_LIB_HEADER, SYS_LIB_NAME(type),
+		widthi, widtho);
+    } else {
+	sprintf(retval, "%s%s_%d", HSIS_LIB_HEADER,SYS_LIB_NAME(type),widthi);
+    }
+    return retval;
+}
+
+
+char *lib_encode(type, width)
+int type;
+int width;
+{
+    static char retval[MAXSTRLEN];
+
+    sprintf(retval, "%s%d", LIB_NAME(type), width);
+    return retval;
+}
+
+
+char *gen_lib_encode(type, args)
+int type;
+lsList args;
+{
+    static char retval[MAXSTRLEN];
+    char *arg;
+    int i;
+    lsGen gen;
+    lsHandle handle;
+
+    sprintf(retval, "%s%s", LIB_NAME(type), SEP_LTRANGE);
+    for (gen=lsStart(args), i=0;
+	 lsNext(gen,(lsGeneric*)&arg,&handle)!=LS_NOMORE; i++) {
+	strcat(retval, arg);
+	if (i < lsLength(args)-1) strcat(retval, SEP_GATEPIN);
+    }
+    strcat(retval, SEP_RTRANGE);
+    lsFinish(gen);
+    return retval;
+}
+
+
+int ipower(base, power)
+int base;
+int power;
+{
+    register int i, retval;
+
+    for (retval=1, i=0; i<power; i++)
+	retval *= base;
+
+    return retval;
+}
+
+
+void chk_mp_definitions(st_table *undefined)
+{
+    if (st_count(undefined)>0) {
+	st_generator *gen;
+	char *key;
+	vl_id_range *id_sym;
+
+	gen = st_init_gen(undefined);
+	while (st_gen(gen, &key, (char**)&id_sym)) {
+	    fprintf(stderr, "undefined module/primitive: %s\n", key);
+	}
+	st_free_gen(gen);
+	vl_exit(1);
+    }
+}
+
+
+char *basename(filename)
+char *filename;
+{
+    char *retval;
+    int i;
+
+    retval = vlStrdup(filename);
+    for (i=strlen(retval)-1; i>0 && retval[i] != '/'; i--)
+	if (retval[i] == '.') {
+	    retval[i]='\0';
+	    break;
+	}
+    return retval;
+}
+
+
+char *extname(char *filename)
+{
+    char *retval;
+
+    retval = vlStrdup(filename);
+    return retval;
+}
+
+
+int gcd(int u, int v)
+{
+    int t;
+    while (u > 0) {
+	if (u < v) {
+	    t = u; u = v; v = t;
+	}
+	u = u-v;
+    }
+    return v;
+}
+
+
+int lcm(int u, int v)
+{
+    return ( u * v / gcd(u,v));
+}
Index: vis_dev/vl2mv-2.3/src/parser/verilog.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/verilog.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/verilog.h	(revision 18)
@@ -0,0 +1,90 @@
+#ifndef _VERILOG_H
+#define _VERILOG_H
+
+EXTERN int empty_file_stack ARGS((void));
+EXTERN int  find_macro ARGS((char *str));
+EXTERN int find_not_macro ARGS((char *str));
+EXTERN void lex_panic ARGS((char *mesg));
+EXTERN void pushd ARGS((char *filename));
+EXTERN void popd ARGS((void));
+
+EXTERN int yyparse ARGS((void));
+
+EXTERN void compile_error ARGS((char* str));
+EXTERN void semantic_error ARGS((char *str));
+EXTERN void internal_error ARGS((char *str));
+EXTERN void Translate_Warning ARGS((char *str));
+EXTERN void Translate_Notice ARGS((char *str));
+EXTERN void chk_mp_definitions ARGS((st_table *undefined));
+EXTERN int str_matchtail ARGS((char *str, char *pat));
+
+EXTERN void vl_exit ARGS((int code));
+EXTERN int lcm ARGS((int u, int v));
+EXTERN void collect_quasi ARGS((char *name));
+EXTERN void dup_info_var_in_st ARGS((st_table *vars));
+EXTERN void reset_cond_list_in_st ARGS((st_table *vars));
+EXTERN void reset_mvar_latch ARGS((FILE *file, int non_block_var,
+				   vl_id_range *id_sym,
+				   int lo, int hi, char *lname));
+EXTERN void instantiate_mvar_latch ARGS((FILE *file,
+					 int non_block_var,
+					 int mark_sel_var, int lo, int hi,
+					 vl_id_range *id_sym,
+					 vl_id_range *orig_id_sym,
+					 var_info *lhsvar,
+					 char *lname));
+EXTERN void instantiate_bin_scalar_latch ARGS((FILE *file,
+					       int non_block_var,
+					       int mark_sel_var,
+					       vl_id_range *id_sym,
+					       vl_id_range *orig_id_sym,
+					       var_info *lhsvar,
+					       char *lname));
+EXTERN void instantiate_bin_vector_latch ARGS((FILE *file,
+					       int non_block_var,
+					       int mark_sel_var,
+					       int lo, int hi,
+					       vl_id_range *id_sym,
+					       vl_id_range *orig_id_sym,
+					       var_info *lhsvar,
+					       char *lname));
+EXTERN void reset_bin_scalar_latch ARGS((FILE *file, int non_block_var,
+					 vl_id_range *id_sym, char *lname));
+EXTERN void reset_bin_vector_latch ARGS((FILE *file, int non_block_var,
+					 vl_id_range *id_sym,
+					 int lo, int hi, char *lname));
+EXTERN void create_mvar_nondeterminism ARGS((FILE *file,
+					     st_table *resultant_vars,
+					     char *var_name,
+					     vl_id_range *id_sym,
+					     int lo, int hi, 
+					     array_t *controls,
+					     array_t *vars_array));
+EXTERN void create_bin_scalar_nondeterminism ARGS((FILE *file,
+						   st_table *resultant_vars,
+						   char *var_name,
+						   vl_id_range *id_sym, 
+						   array_t *controls,
+						   array_t *vars_array));
+EXTERN void create_bin_vector_nondeterminism ARGS((FILE *file,
+						   st_table *resultant_vars,
+						   char *var_name, 
+						   vl_id_range *id_sym,
+						   int lo, int hi,
+						   array_t *controls,
+						   array_t *vars_array));
+
+EXTERN void collect_latch ARGS((char *name));
+EXTERN int drive_strength ARGS((int strength0, int strength1));
+EXTERN void extract_delay_strength ARGS((lsList delay_strength,
+					 vl_delay **delay,
+					 int *strength));
+EXTERN void insert_instances ARGS((lsList inst_list, void *inst_master));
+EXTERN void associate_symbolic_value ARGS((vl_lval *lval, vl_expr *expr));
+EXTERN void push_open_file ARGS((char *fname));
+EXTERN void register_vl2mv_synClock ARGS((char *cname, int edge, int pi, float rho));
+EXTERN void encodebit ARGS((char *instr, int *part1, int *part0));
+EXTERN void pop_close_file ARGS(());
+
+
+#endif /* _VERILOG_H */
Index: vis_dev/vl2mv-2.3/src/parser/verilog.l
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/verilog.l	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/verilog.l	(revision 18)
@@ -0,0 +1,892 @@
+%{
+/*
+ *  vl2mv: Verilog to BLIF-MV Translator Distribution
+ *
+ *  Copyright (c) 1992, 1993
+ *        Regents of the University of California
+ *  All rights reserved.
+ *
+ *  Use and copying of this software and preparation of derivative works
+ *  based upon this software are permitted.  However, any distribution of
+ *  this software or derivative works must include the above copyright
+ *  notice.
+ *
+ *  This software is made available AS IS, and neither the Electronics
+ *  Research Laboratory or the Universify of California make any
+ *  warranty about the software, its performance or its conformity to
+ *  any specification.
+ *
+ *
+ * $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/verilog.l,v 1.4 2009/03/09 20:25:57 fabio Exp $
+ *
+ * Lexical Scanner for Verilog
+ *
+ * Author: Szu-Tsung Cheng, stcheng@ic.berkeley.edu
+ *
+ * Date: September 18, 1992
+ */
+
+#include <stdio.h>
+#include "util.h"
+#include "st.h"
+#include "list.h"
+#include "array.h"
+#include "set.h"
+#include "stack.h"
+#include "vl_defs.h"
+#include "vl_types.h"
+#include "vlr_int.h"
+#include "verilog_yacc.h"
+#include "verilog.h"
+
+#ifdef FLEX_SCANNER
+#ifndef YY_FLEX_LEX_COMPAT
+#define YYLMAX YY_BUF_SIZE
+#else
+#define MAX_INCLUDE_DEPTH 20
+YY_BUFFER_STATE buffer_stack[MAX_INCLUDE_DEPTH];
+int buffer_stack_ptr = 0;
+#endif
+#endif
+
+extern vl_descPtr mod_list;
+extern char *vl_filename;
+extern st_table *aux_st;
+extern int reserve_type_name;
+extern int Loop_Unrolling;
+
+static int scan_table = 0;
+char yyid[MAXSTRLEN];
+char brep[MAXSTRLEN];
+int bexp0, bexp1;
+char last_macro[MAXSTRLEN];  /* last macro name get expanded */
+char curr_macro[MAXSTRLEN];
+char yytypetoken[MAXSTRLEN];
+st_table *macros;
+char ifelse_stack[MAXSTRLEN];
+int ifelseSP=0;
+
+%}
+
+%option yylineno
+
+%a 3000
+%e 1700
+%k 1000
+%n 700
+%o 4000
+%p 5000
+
+%Start Snormal Stable Sskip
+
+Space       [\f\n\r\t\b ]
+Alpha       [a-zA-Z]
+AlphaU      [a-zA-Z_]
+AlphaNum    [a-zA-Z0-9]
+AlphaNumU   [a-zA-Z0-9_]
+Digit       [0-9]
+DigitU      [0-9_]
+Number      {Digit}{DigitU}*
+Decimal     ({Number})?'[dD][ ]*{Number}
+Octal       ({Number})?'[oO][ ]*[0-7xXzZ?][0-7xXzZ?_]*
+Hexdecimal  ({Number})?'[hH][ ]*[0-9a-fA-FxXzZ?][0-9a-fA-FxXzZ?_]*
+Binary      ({Number})?'[bB][ ]*[01xXzZ?][01xXzZ?_]*
+
+%%
+
+			     strcpy(last_macro, curr_macro);
+			     curr_macro[0]='\0';
+
+			     if (ifelseSP==0) {
+			       if (scan_table)
+				 BEGIN Stable;
+			       else
+				 BEGIN Snormal;
+			     }
+
+<Sskip,Snormal,Stable>{Space}+ {
+#ifdef FLEX_SCANNER
+				   int i;
+				   for (i=0; i<yyleng; i++)
+				       if (yytext[i] == '\n') yylineno++;
+#endif
+				   continue;
+			       }
+
+<Sskip,Snormal,Stable>`ifdef[^\n]*\n {
+				 if (find_macro(yytext)) {
+				     ifelse_stack[ifelseSP++] = 1;
+				 } else {
+				     ifelse_stack[ifelseSP++] = 0;
+				     BEGIN Sskip;
+				 }
+				 if (ifelseSP == MAXSTRLEN)
+				     lex_panic("nested `if/`else too deep");
+			     }
+<Sskip,Snormal,Stable>`ifndef[^\n]*\n {
+				 if (find_not_macro(yytext)) {
+				     ifelse_stack[ifelseSP++] = 1;
+				 } else {
+				     ifelse_stack[ifelseSP++] = 0;
+				     BEGIN Sskip;
+				 }
+				 if (ifelseSP == MAXSTRLEN)
+				     lex_panic("nested `if/`else too deep");
+			     }
+<Sskip,Snormal,Stable>`else  {
+				 if (ifelse_stack[ifelseSP-1]) {
+				     ifelse_stack[ifelseSP-1] = 0;
+				     BEGIN Sskip;
+				 } else {
+				     if (scan_table)
+					 BEGIN Stable;
+				     else
+					 BEGIN Snormal;
+				 }
+			     }
+<Sskip,Snormal,Stable>`endif {
+				 if (!ifelse_stack[--ifelseSP]) {
+				     if (scan_table)
+					 BEGIN Stable;
+				     else
+					 BEGIN Snormal;
+				 }
+			     }
+<Sskip>[^\f\n\r\t\b ]+           { continue; }
+
+<Snormal,Stable>"/*"         { skipcommentblock(); continue; }
+<Snormal,Stable>"//"         { skipcommentline();  continue; }
+
+<Snormal,Stable>`timescale[^\n]*\n { continue; }
+
+<Snormal,Stable>`define[^\n]*\n {
+#ifdef FLEX_SCANNER
+				  yylineno++;
+#endif
+				  memorize_macro(yytext, macros);
+				  continue;
+				}
+<Snormal,Stable>`include[^\n]*\n {   char *cp;
+#ifdef FLEX_SCANNER
+				     yylineno++;
+#endif
+				     yytext[strlen(yytext)-1] = '\0';
+				     cp = strstr(yytext, "`include");
+				     cp += strlen("`include");
+				     while (*cp==' ' || *cp=='\t' || *cp=='\r')
+					 cp++;
+				     push_open_file(cp);
+				 }
+
+<Snormal,Stable>`VL2MVDataVar[^\n]*\n {
+				    char *cp;
+				    char varname[MAXSTRLEN],
+					 vartype[MAXSTRLEN];
+				    int i;
+				    vl_id_range *id_sym;
+#ifdef FLEX_SCANNER
+				    yylineno++;
+#endif
+				    cp = strstr(yytext, "`VL2MVDataVar");
+				    cp += strlen("`Vl2MVDataVar");
+				    while (*cp==' '||*cp=='\t'||*cp=='\r')
+					cp++;
+				    i =0;
+				    while (*cp!=' '&&*cp!='\t'&&*cp!='\r'&&
+					   *cp!='\0') {
+					varname[i++] = *cp;
+					cp++;
+				    }
+				    varname[i] = '\0';
+				    while (*cp==' '||*cp=='\t'||*cp=='\r')
+					cp++;
+				    i =0;
+				    while (*cp!=' '&&*cp!='\t'&&*cp!='\r'&&
+					   *cp!='\0'&&*cp!='\n') {
+					vartype[i++] = *cp;
+					cp++;
+				    }
+				    vartype[i] = '\0';
+				    if (vl_currentModule) {
+					if (st_lookup(vl_currentModule->sig_st,
+						      varname,
+						      (char**)&id_sym)) {
+					    if (id_sym->unintType)
+						vl_chk_free(id_sym->unintType);
+					    id_sym->unintType =
+						vlStrdup(vartype);
+					}
+				    }
+				}
+
+<Snormal,Stable>`VL2MVClock[^\n]*\n {  char *cp, cname[MAXSTRLEN],
+					    buf[MAXSTRLEN];
+				       int i;
+				       int edge, pi;
+				       float rho;
+				       /* VL2MVClock 1:0:-1 0 0.0 */
+#ifdef FLEX_SCANNER
+				       yylineno++;
+#endif
+				       yytext[strlen(yytext)-1] = '\0';
+				       cp = strstr(yytext, "`VL2MVClock");
+				       cp += strlen("`VL2MVClock");
+				       /* name */
+				       while (*cp==' '||*cp=='\t'||*cp=='\r')
+					   cp++;
+				       i=0;
+				       while (*cp!=' ' && *cp!='\t' &&
+					      *cp!='\r' && *cp!='\0') {
+					   cname[i++] = *cp; cp++;
+				       }
+				       cname[i] = '\0';
+
+				       /* pi */
+				       while (*cp==' '||*cp=='\t'||*cp=='\r')
+					   cp++;
+				       i=0;
+				       while (*cp!=' ' && *cp!='\t' &&
+					      *cp!='\r' && *cp!='\0') {
+					   buf[i++] = *cp; cp++;
+				       }
+				       pi = atoi(buf);
+
+				       /* edge */
+				       while (*cp==' '||*cp=='\t'||*cp=='\r')
+					   cp++;
+				       i=0;
+				       while (*cp!=' ' && *cp!='\t' &&
+					      *cp!='\r' && *cp!='\0') {
+					   buf[i++] = *cp; cp++;
+				       }
+				       edge = atoi(buf);
+
+				       /* rho */
+				       while (*cp==' '||*cp=='\t'||*cp=='\r')
+					   cp++;
+				       i=0;
+				       while (*cp!=' ' && *cp!='\t' &&
+					      *cp!='\r' && *cp!='\0') {
+					   buf[i++] = *cp; cp++;
+				       }
+				       rho = atof(buf);
+
+				       register_vl2mv_synClock(cname,
+					   edge, pi, rho);
+				       continue;
+				    }
+
+<Snormal,Stable>`VL2MVundefMod[^\n]*\n {   char *cp, modname[MAXSTRLEN];
+					   int i;
+#ifdef FLEX_SCANNER
+					   yylineno++;
+#endif
+					   i=0;
+					   yytext[strlen(yytext)-1] = '\0';
+					   cp = strstr(yytext,
+						       "`VL2MVundefMod");
+					   cp += strlen("`VL2MVundefMod");
+					   while (*cp==' ' || *cp=='\t' ||
+						  *cp=='\r')
+					       cp++;
+					   while (*cp!=' ' && *cp!='\t' &&
+						  *cp!='\r' && *cp!='\0') {
+					       modname[i++] = *cp;
+					       cp++;
+					   }
+					   modname[i] = '\0';
+					   if (mod_list)
+					       st_insert(mod_list->mod_holes,
+							 vlStrdup(modname), 0);
+					   continue;
+				       }
+
+<Snormal>">="               { return YYGEQ;  }
+<Snormal>"=<"               { return YYLEQ;  }
+<Snormal>"&&"               { return YYLOGAND;    }
+<Snormal>"||"               { return YYLOGOR;     }
+<Snormal>"==="              { return YYCASEEQUALITY;  }
+<Snormal>"=="               { return YYLOGEQUALITY;   }
+<Snormal>"!=="              { return YYCASEINEQUALITY; }
+<Snormal>"!="               { return YYLOGINEQUALITY; }
+<Snormal>"^~"               { return YYLOGXNOR; }
+<Snormal>"~^"               { return YYLOGXNOR; }
+<Snormal>"~&"               { return YYLOGNAND;      }
+<Snormal>"~|"               { return YYLOGNOR;       }
+<Snormal>"<<"               { return YYLSHIFT;      }
+<Snormal>">>"               { return YYRSHIFT;      }
+<Snormal>"?:"               { return YYCONDITIONAL; }
+
+<Snormal>\"[^"]*\"          { return YYSTRING; }
+
+<Snormal>always             { return YYALWAYS; }
+<Snormal>"*>"               { return YYALLPATH; }
+<Snormal>and                { return YYAND; }
+<Snormal>assign             { return YYASSIGN; }
+<Snormal>begin              { return YYBEGIN; }
+<Snormal>buf                { return YYBUF; }
+<Snormal>bufif0             { return YYBUFIF0; }
+<Snormal>bufif1             { return YYBUFIF1; }
+<Snormal>case               { return YYCASE; }
+<Snormal>casex              { return YYCASEX; }
+<Snormal>casez              { return YYCASEZ; }
+<Snormal>cmos               { return YYCMOS; }
+<Snormal>deassign           { return YYDEASSIGN; }
+<Snormal>default            { return YYDEFAULT; }
+<Snormal>defparam           { return YYDEFPARAM; }
+<Snormal>disable            { return YYDISABLE; }
+<Snormal>edge               { return YYEDGE; }
+<Snormal>else               { return YYELSE; }
+<Snormal>end                { return YYEND; }
+<Snormal>endcase            { return YYENDCASE; }
+<Snormal>endfunction        { return YYENDFUNCTION; }
+<Snormal>endmodule          { return YYENDMODULE; }
+<Snormal>endprimitive       { return YYENDPRIMITIVE; }
+<Snormal>endspecify         { return YYENDSPECIFY; }
+<Stable>endtable            { scan_table = 0; return YYENDTABLE; }
+<Snormal>endtask            { return YYENDTASK; }
+<Snormal>enum               { return YYENUM; }
+<Snormal>event              { return YYEVENT; }
+<Snormal>for                { return YYFOR; }
+<Snormal>forever            { return YYFOREVER; }
+<Snormal>fork               { return YYFORK; }
+<Snormal>function           { return YYFUNCTION; }
+<Snormal>highz0             { return YYHIGHZ0; }
+<Snormal>highz1             { return YYHIGHZ1; }
+<Snormal>if                 { return YYIF; }
+<Snormal>initial            { return YYINITIAL; }
+<Snormal>inout              { return YYINOUT; }
+<Snormal>input              { return YYINPUT; }
+<Snormal>integer            { return YYINTEGER; }
+<Snormal>join               { return YYJOIN; }
+<Snormal>large              { return YYLARGE; }
+<Snormal>"=>"               { return YYLEADTO; }
+<Snormal>macromodule        { return YYMACROMODULE; }
+<Snormal>medium             { return YYMEDIUM; }
+<Snormal>module             { return YYMODULE; }
+<Snormal>mREG               { return YYMREG; }
+<Snormal>"<="               { return YYNBASSIGN;  }
+<Snormal>nand               { return YYNAND; }
+<Snormal>negedge            { return YYNEGEDGE; }
+<Snormal>nmos               { return YYNMOS; }
+<Snormal>nor                { return YYNOR; }
+<Snormal>not                { return YYNOT; }
+<Snormal>notif0             { return YYNOTIF0; }
+<Snormal>notif1             { return YYNOTIF1; }
+<Snormal>or                 { return YYOR; }
+<Snormal>output             { return YYOUTPUT; }
+<Snormal>parameter          { return YYPARAMETER; }
+<Snormal>pmos               { return YYPMOS; }
+<Snormal>posedge            { return YYPOSEDGE; }
+<Snormal>primitive          { return YYPRIMITIVE; }
+<Snormal>pull0              { return YYPULL0; }
+<Snormal>pull1              { return YYPULL1; }
+<Snormal>pulldown           { return YYPULLDOWN; }
+<Snormal>pullup             { return YYPULLUP; }
+<Snormal>rcmos              { return YYRCMOS; }
+<Snormal>real               { return YYREAL; }
+<Snormal>reg                { return YYREG; }
+<Snormal>repeat             { return YYREPEAT; }
+<Snormal>"->"               { return YYRIGHTARROW; }
+<Snormal>rnmos              { return YYRNMOS; }
+<Snormal>rpmos              { return YYRPMOS; }
+<Snormal>rtran              { return YYRTRAN; }
+<Snormal>rtranif0           { return YYRTRANIF0; }
+<Snormal>rtranif1           { return YYRTRANIF1; }
+<Snormal>scalered           { return YYSCALARED; }
+<Snormal>small              { return YYSMALL; }
+<Snormal>specify            { return YYSPECIFY; }
+<Snormal>specparam          { return YYSPECPARAM; }
+<Snormal>strong0            { return YYSTRONG0; }
+<Snormal>strong1            { return YYSTRONG1; }
+<Snormal>supply0            { return YYSUPPLY0; }
+<Snormal>supply1            { return YYSUPPLY1; }
+<Snormal>swire              { return YYSWIRE; }
+<Snormal>table              { scan_table = 1; return YYTABLE; }
+<Snormal>task               { return YYTASK; }
+<Snormal>teslaTimer         { return YYTESLATIMER; }
+<Snormal>time               { return YYTIME; }
+<Snormal>tran               { return YYTRAN; }
+<Snormal>tranif0            { return YYTRANIF0; }
+<Snormal>tranif1            { return YYTRANIF1; }
+<Snormal>tri                { return YYTRI; }
+<Snormal>tri0               { return YYTRI0; }
+<Snormal>tri1               { return YYTRI1; }
+<Snormal>triand             { return YYTRIAND; }
+<Snormal>trior              { return YYTRIOR; }
+<Snormal>trireg             { return YYTRIREG; }
+<Snormal>typedef            { return YYTYPEDEF; }
+<Snormal>vectored           { return YYVECTORED; }
+<Snormal>wait               { return YYWAIT; }
+<Snormal>wand               { return YYWAND; }
+<Snormal>weak0              { return YYWEAK0; }
+<Snormal>weak1              { return YYWEAK1; }
+<Snormal>while              { return YYWHILE; }
+<Snormal>wire               { return YYWIRE; }
+<Snormal>wor                { return YYWOR; }
+<Snormal>xnor               { return YYXNOR; }
+<Snormal>xor                { return YYXOR; }
+
+<Snormal>\$setup                { return YYsysSETUP; }
+<Snormal>\$NDset                { return YYsysND; }
+<Snormal>\$ND                   { return YYsysND; }
+<Snormal>\${AlphaU}{AlphaNumU}* { return YYsysID; }
+
+<Snormal>`{AlphaU}{AlphaNumU}* {
+				char *macro;
+
+				strcpy(yyid, yytext);
+				/* macro expansion */
+				if (st_lookup(macros, yyid+1, &macro)) {
+				    expand_macro(yyid+1, macros);
+				    continue;
+				}
+				return YYIDE;
+			       }
+<Snormal>{AlphaU}{AlphaNumU}* {
+				vl_type *var_type;
+
+				yytypetoken[0] = '\0';
+				strcpy(yyid, yytext);
+
+				/* type name checking */
+				if (reserve_type_name)
+				    if (st_lookup(mod_list->type_st,
+						  yytext, (char**)&var_type))
+					return YYuTYPE;
+
+				/* enum name */
+				if (aux_st) {
+				    vl_enumerator *enum_elt;
+				    if (st_lookup(aux_st,
+						   yytext, (char**)&enum_elt)){
+					sprintf(yytypetoken, yytext);
+					sprintf(yytext, "%d", enum_elt->val);
+					return YYINUMBER;
+				    }
+				}
+
+
+				return YYIDE;
+			      }
+<Snormal>\\[^\n\t\b\r\f ]*    {
+				strcpy(yyid, yytext);
+				return YYIDE;
+			      }
+
+<Snormal>{Number}*\.{Number}+ { return YYRNUMBER; }
+<Snormal>{Number}+\.{Number}* { return YYRNUMBER; }
+<Snormal>{Number}             { return YYINUMBER; }
+<Snormal>{Binary}             {
+				binbin(yytext, brep);
+				encodebit(brep, &bexp1, &bexp0);
+				return YYINUMBER;
+			      }
+<Snormal>{Octal}              {
+				octbin(yytext, brep);
+				encodebit(brep, &bexp1, &bexp0);
+				return YYINUMBER;
+			      }
+<Snormal>{Decimal}            {
+				decbin(yytext, brep);
+				encodebit(brep, &bexp1, &bexp0);
+				return YYINUMBER;
+			      }
+<Snormal>{Hexdecimal}         {
+				hexbin(yytext, brep);
+				encodebit(brep, &bexp1, &bexp0);
+				return YYINUMBER;
+			      }
+
+<Stable>\(\?\?\)              { return '*'; }
+<Stable>\(01\)                { return 'r'; }
+<Stable>\(10\)                { return 'f'; }
+<Snormal,Stable>.             { return yytext[0]; }
+
+%%
+
+int yywrap()
+{
+    if (!empty_file_stack()) {
+	pop_close_file();
+	return 0;
+    } else {
+	return 1;
+    }
+}
+
+void skipcommentblock()
+{
+    int done, level = 0;
+    char c;
+
+    for (done=0; !done; yyleng = (yyleng > YYLMAX-2) ? YYLMAX-2 : yyleng) {
+	if ((c = input()) == '*') {
+	    yytext[yyleng++] = c;
+	    if ((c = input()) == '/') {
+		done = (level-- == 0);
+	    } else {
+		unput(c);
+	    }
+	} else if (c == '/') {
+	    yytext[yyleng++] = c;
+	    if ((c = input()) == '*') {
+		level++;
+	    } else {
+		unput(c);
+	    }
+	} else if (c == 0) {
+	    char buf[MAXSTRLEN];
+	    sprintf(buf, "incomplete comment (%d)\n", yylineno);
+	    fail(buf);
+	} else {
+#ifdef FLEX_SCANNER
+	    if (c == '\n') yylineno++;
+#endif
+	    yytext[yyleng++] = c;
+	}
+    }
+}
+
+void skipcommentline()
+{
+    int done;
+    char c;
+
+    for (done=0; !done; yyleng = (yyleng > YYLMAX-2) ? YYLMAX-2 : yyleng) {
+	if ((c = input()) == '\n') {
+	    done = 1;
+	} else {
+	    yytext[yyleng++] = c;
+	}
+    }
+    yytext[yyleng] = '\0';
+#ifdef FLEX_SCANNER
+    yylineno++;
+#endif
+
+}
+
+void binbin(instr, outstr)
+char *instr;
+char *outstr;
+{
+    char *cp, *firstcp;
+    int blen = 0, bpos=0;
+
+    blen = atoi(instr);
+    blen = (blen==0) ? MAXBITNUM : blen;
+    firstcp = strpbrk(instr, "bB")+1;
+    cp = instr + strlen(instr) - 1;
+    outstr[blen] = '\0';
+    for (bpos = blen-1; bpos >=0 && cp >= firstcp; cp--) {
+	if (*cp != '_' && *cp != ' ') {
+	    outstr[bpos] = *cp;
+	    bpos--;
+	}
+    }
+    for (; bpos >=0; bpos--) {
+	outstr[bpos] = '0';
+    }
+}
+
+char *hexnum[16] = {"0000","0001","0010","0011",
+		    "0100","0101","0110","0111",
+		    "1000","1001","1010","1011",
+		    "1100","1101","1110","1111"};
+
+void decbin(instr, outstr)
+char *instr;
+char *outstr;
+{
+    char *firstcp, buf[MAXSTRLEN];
+    int num, blen = 0;
+
+    utol(instr);
+    blen = atoi(instr);
+    blen = (blen==0) ? MAXBITNUM : blen;
+    firstcp = strpbrk(instr, "dD")+1;
+    while (*firstcp==' ') firstcp++;
+    num = atoi(firstcp); /* don't put x, z, ? in decimal string */
+    sprintf(buf, "%d'h%x", blen, num);
+    hexbin(buf, outstr);
+}
+
+void octbin(instr, outstr)
+char *instr;
+char *outstr;
+{
+    char *cp, *firstcp;
+    int blen = 0, bpos=0, i;
+
+    utol(instr);
+    blen = atoi(instr);
+    blen = (blen==0) ? MAXBITNUM : blen;
+    firstcp = strpbrk(instr, "oO")+1;
+    cp = instr + strlen(instr) - 1;
+    outstr[blen] = '\0';
+    for (bpos = blen-1; bpos >=0 && cp >= firstcp; cp--) {
+	if (*cp != '_' && *cp != ' ') {
+	    for (i = 3; i >= 1; i--) {
+		if (bpos >= 0) {
+		    if (*cp=='x' || *cp=='z' || *cp=='?') {
+			outstr[bpos] = *cp;
+			bpos--;
+		    } else if (isdigit(*cp)) {
+			outstr[bpos] = hexnum[*cp-'0'][i];
+			bpos--;
+		    }
+		}
+	    }
+	}
+    }
+    for (; bpos >=0; bpos--) {
+	outstr[bpos] = '0';
+    }
+}
+
+void hexbin(instr, outstr)
+char *instr;
+char *outstr;
+{
+    char *cp, *firstcp;
+    int blen = 0, bpos=0, i;
+
+    utol(instr);
+    blen = atoi(instr);
+    blen = (blen==0) ? MAXBITNUM : blen;
+    firstcp = strpbrk(instr, "hH")+1;
+    cp = instr + strlen(instr) - 1;
+    outstr[blen] = '\0';
+    for (bpos = blen-1; bpos >=0 && cp >= firstcp; cp--) {
+	if (*cp != '_' && *cp != ' ') {
+	    for (i = 3; i >= 0; i--) {
+		if (bpos >= 0) {
+		    if (*cp=='x' || *cp=='z' || *cp=='?') {
+			outstr[bpos] = *cp;
+			bpos--;
+		    } else if (isdigit(*cp)) {
+			outstr[bpos] = hexnum[*cp-'0'][i];
+			bpos--;
+		    } else if (isxdigit(*cp)) {
+			outstr[bpos] = hexnum[*cp-'a'+10][i];
+			bpos--;
+		    }
+		}
+	    }
+	}
+    }
+    for (; bpos >=0; bpos--) {
+	outstr[bpos] = '0';
+    }
+}
+
+char *utol(str)
+char *str;
+{
+    char *cp;
+
+    for (cp = str; *cp!='\0'; cp++) {
+	if (isupper(*cp)) *cp = tolower(*cp);
+    }
+    return str;
+}
+
+void encodebit(char *instr, int *part1, int *part0)
+{
+    int i, bmask;
+
+    *part1 = *part0 = 0;
+    i = strlen(instr);
+    i = (i > MAXBITNUM) ? MAXBITNUM-1 : i-1;
+    for (bmask = 1; i>=0; bmask <<= 1, i--) {
+	switch (instr[i]) {
+	case '1': *part1 |= bmask; break;
+	case '0': *part0 |= bmask; break;
+	case 'x':
+	case '?': *part1 |= bmask; *part0 |= bmask; break;
+	case 'z': break;
+	}
+    }
+}
+
+/*
+ * memorize_macro
+ *
+ *     insert a argumentless macro into macro table
+ */
+void memorize_macro(instr, macros)
+char *instr;
+st_table *macros;
+{
+    char *cp, *cp1, *cp2;
+    char mname[MAXSTRLEN];
+
+    cp = strstr(instr,MACRO_DEFINE) + strlen(MACRO_DEFINE);
+    sscanf(cp, "%s", mname);
+    cp = strstr(cp, mname) + strlen(mname);
+    cp1 = strstr(cp, "//");
+    cp2 = strstr(cp, "/*");
+    if (cp1 || cp2) {
+	if (cp1) *cp1='\0';
+	if (cp2) *cp2='\0';
+    }
+
+    st_insert(macros, vlStrdup(mname), vlStrdup(cp));
+}
+
+/*
+ * expand_macro
+ *
+ *     expand an argumentless macro into input stream (using unput)
+ */
+void expand_macro(mname, macros)
+char *mname;
+st_table *macros;
+{
+    char *mbody;
+    int i;
+
+    if (st_lookup(macros, mname, &mbody)) {
+	for (i=strlen(mbody)-1; i>=0; i--) {
+	    unput(mbody[i]);
+	}
+	strcpy(curr_macro, mname);
+    }
+}
+
+stack_t file_stack;
+stack_t fname_stack;
+stack_t lineno_stack;
+stack_t buffer_stack;
+
+void push_open_file(char *fname)
+{
+    FILE *infile;
+    char *filename;
+    char buf[MAXSTRLEN];
+
+    filename = vlStrdup(fname);
+    if (*filename == '"') {
+	unsigned int i, j;
+	j = strlen(filename)-1;
+	while (filename[j] == ' ' || filename[j] == '\t' ||
+	       filename[j] == '\r') j--;
+	if (filename[j] != '"') {
+	    sprintf(buf, "unbalanced \"\n");
+	    yyerror(buf);
+	}
+	filename[j] = '\0';
+	for(i=0; i<strlen(filename); i++) filename[i] = filename[i+1];
+    }
+    if ((infile = fopen(filename,"r"))==NULL) {
+	sprintf(buf, "fail to open file '%s'", filename);
+	yyerror(buf);
+    }
+
+    pushd(filename);
+
+    push_stack(file_stack, (void*)yyin);
+    push_stack(fname_stack, (void*)vl_filename);
+    push_stack(lineno_stack, (void*)yylineno);
+
+#if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT)
+    push_stack(buffer_stack, (void*) YY_CURRENT_BUFFER);
+    yy_switch_to_buffer(yy_create_buffer(infile, YY_BUF_SIZE));
+#else
+    yyin = infile;
+#endif
+    yylineno = 1;
+    vl_filename = filename;
+}
+
+void pop_close_file()
+{
+    FILE *infile;
+    int old_yylineno;
+    char *filename;
+#ifdef FLEX_SCANNER
+    YY_BUFFER_STATE buffer;
+#endif
+
+    fclose(yyin);
+    pop_stack(file_stack, (void**)&infile);
+    pop_stack(fname_stack, (void**)&filename);
+    pop_stack(lineno_stack, (void**)&old_yylineno);
+    popd();
+#if defined(FLEX_SCANNER) && !defined(YY_FLEX_LEX_COMPAT)
+    yy_delete_buffer(YY_CURRENT_BUFFER);
+    pop_stack(buffer_stack, (void**)&buffer);
+    yy_switch_to_buffer(buffer);
+#else
+    yyin = infile;
+#endif
+    yylineno = old_yylineno;
+    vl_chk_free(vl_filename);
+    vl_filename = filename;
+}
+
+int empty_file_stack()
+{
+    return (lsLength(file_stack)==0);
+}
+
+int find_macro(char *str)
+{
+    char *cp;
+    char *dummy;
+    char mname[MAXSTRLEN];
+
+    cp = strstr(str,MACRO_IFDEF) + strlen(MACRO_IFDEF);
+    sscanf(cp, "%s", mname);
+    return (st_lookup(macros, mname, &dummy));
+}
+
+int find_not_macro(char *str)
+{
+    char *cp;
+    char *dummy;
+    char mname[MAXSTRLEN];
+
+    cp = strstr(str,MACRO_IFNDEF) + strlen(MACRO_IFNDEF);
+    sscanf(cp, "%s", mname);
+    return (!st_lookup(macros, mname, &dummy));
+}
+
+void lex_panic(char *mesg)
+{
+    fprintf(stderr, "%s\n", mesg);
+    exit(1);
+}
+
+
+static stack_t dir_stack=0;
+
+void pushd(char *filename)
+{
+    int i;
+    char cwd[MAXSTRLEN], pwd[MAXSTRLEN];
+
+    if (!dir_stack) dir_stack = create_stack();
+
+    getcwd(pwd, MAXSTRLEN-1);
+
+    for (i=strlen(filename)-1; i>=0; i--)
+	if (filename[i] == '/') break;
+
+    strcpy(cwd, filename);
+    if (i==-1) { cwd[0]='.'; cwd[1]='\0'; }
+    else      { cwd[i]='\0'; }
+
+    push_stack(dir_stack, vlStrdup(pwd));
+    chdir(cwd);
+}
+
+void popd()
+{
+    char *cwd;
+
+    pop_stack(dir_stack, (void**)&cwd);
+    chdir(cwd);
+    free(cwd);
+}
Index: vis_dev/vl2mv-2.3/src/parser/verilog.y
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/verilog.y	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/verilog.y	(revision 18)
@@ -0,0 +1,3455 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/verilog.y,v 1.7 2009/03/16 20:57:20 fabio Exp $
+
+
+*/
+
+
+%{
+
+#include <stdio.h>
+#include "util.h"
+#include "list.h"
+#include "st.h"
+#include "array.h"
+#include "set.h"
+#include "stack.h"
+#include "vl_defs.h"
+#include "vl_types.h"
+#include "vlr_int.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_create.h"
+#include "verilog.h"
+
+
+
+
+
+#define NOND_SET "NDset"
+
+extern vl_descPtr mod_list;
+extern char yyid[];
+extern char brep[];
+extern int bexp0, bexp1;
+extern char last_macro[];
+extern st_table *macros;
+extern int compatibleChecking;
+extern char yytypetoken[];
+extern int instantiateAll;
+
+int YYTrace=0;
+
+char *vl_filename = "<stdin>";
+struct vl_desc *vl_description = NIL(struct vl_desc);
+struct vl_module *vl_currentModule=NIL(vl_module);
+struct vl_primitive *vl_currentPrimitive=NIL(vl_primitive);
+struct vl_function *vl_currentFunction=NIL(vl_function);
+lsList vl_module_stack;
+lsList vl_cur_type_stack;
+st_table *aux_st=NIL(st_table);
+char modName[MAXSTRLEN];
+char *cp;
+short eventType;
+int enum_val=0;
+int reserve_type_name=1;
+int task_mode=0;
+int timed_statement = 0;
+static int c_assign=0;
+
+EXTERN int yylex ARGS(());
+
+%}
+
+
+%union {
+    int             ival;
+    char            *charp;
+    typestructPtr   type;
+    lsList          lstp;
+    vl_bassign_stmtPtr      basgn;
+    vl_begin_end_stmtPtr    seqstmt;
+    vl_case_itemPtr caseitem;
+    vl_cont_assignPtr       casgn;
+    vl_declPtr      bascdcl;
+    vl_delayPtr     dlay;
+    vl_descPtr      desc;
+    vl_event_exprPtr        evnt;
+    vl_exprPtr      expr;
+    vl_fork_join_stmtPtr    parstmt;
+    vl_functionPtr  func;
+    vl_gate_instPtr gtinst;
+    vl_gate_inst_listPtr    gtlist;
+    vl_id_rangePtr  idrng;
+    vl_lvalPtr      lval;
+    vl_mod_prim_inst_listPtr modlist;
+    vl_modulePtr    modu;
+    vl_netdeclPtr   netdcl;
+    vl_paramdeclPtr paradcl;
+    vl_portPtr      port;
+    vl_port_connectPtr      connect;
+    vl_prim_entryPtr        ntry;
+    vl_primitivePtr prim;
+    vl_procstmtPtr  prcstmt;
+    vl_rangePtr     rang;
+    vl_range_or_typePtr     rngtyp;
+    vl_rangedeclPtr rangdcl;
+    vl_taskPtr      task;
+    vl_task_enable_stmtPtr  taskenablestmt;
+    vl_typePtr      typedcl;
+    vl_type_specifierPtr typespc;
+    vl_enumeratorPtr        enumtr;
+    vl_enum_typePtr         enumtp;
+    multi_concatPtr         mconcat;
+}
+
+
+%start source_text
+
+
+%token YYIDE
+%token YYINUMBER
+%token YYRNUMBER
+%token YYSTRING
+%token YYALLPATH
+%token YYALWAYS
+%token YYAND
+%token YYASSIGN
+%token YYBEGIN
+%token YYBUF
+%token YYBUFIF0
+%token YYBUFIF1
+%token YYCASE
+%token YYCASEX
+%token YYCASEZ
+%token YYCMOS
+%token YYCONDITIONAL
+%token YYDEASSIGN
+%token YYDEFAULT
+%token YYDEFPARAM
+%token YYDISABLE
+%token YYELSE
+%token YYEDGE
+%token YYEND
+%token YYENDCASE
+%token YYENDMODULE
+%token YYENDFUNCTION
+%token YYENDPRIMITIVE
+%token YYENDSPECIFY
+%token YYENDTABLE
+%token YYENDTASK
+%token YYENUM
+%token YYEVENT
+%token YYFOR
+%token YYFOREVER
+%token YYFORK
+%token YYFUNCTION
+%token YYGEQ
+%token YYHIGHZ0
+%token YYHIGHZ1
+%token YYIF
+%token YYINITIAL
+%token YYINOUT
+%token YYINPUT
+%token YYINTEGER
+%token YYJOIN
+%token YYLARGE
+%token YYLEADTO
+%token YYLEQ
+%token YYLOGAND
+%token YYCASEEQUALITY
+%token YYCASEINEQUALITY
+%token YYLOGNAND
+%token YYLOGNOR
+%token YYLOGOR
+%token YYLOGXNOR
+%token YYLOGEQUALITY
+%token YYLOGINEQUALITY
+%token YYLSHIFT
+%token YYMACROMODULE
+%token YYMEDIUM
+%token YYMODULE
+%token YYMREG
+%token YYNAND
+%token YYNBASSIGN
+%token YYNEGEDGE
+%token YYNMOS
+%token YYNOR
+%token YYNOT
+%token YYNOTIF0
+%token YYNOTIF1
+%token YYOR
+%token YYOUTPUT
+%token YYPARAMETER
+%token YYPMOS
+%token YYPOSEDGE
+%token YYPRIMITIVE
+%token YYPULL0
+%token YYPULL1
+%token YYPULLUP
+%token YYPULLDOWN
+%token YYRCMOS
+%token YYREAL
+%token YYREG
+%token YYREPEAT
+%token YYRIGHTARROW
+%token YYRNMOS
+%token YYRPMOS
+%token YYRSHIFT
+%token YYRTRAN
+%token YYRTRANIF0
+%token YYRTRANIF1
+%token YYSCALARED
+%token YYSMALL
+%token YYSPECIFY
+%token YYSPECPARAM
+%token YYSTRONG0
+%token YYSTRONG1
+%token YYSUPPLY0
+%token YYSUPPLY1
+%token YYSWIRE
+%token YYTABLE
+%token YYTASK
+%token YYTESLATIMER
+%token YYTIME
+%token YYTRAN
+%token YYTRANIF0
+%token YYTRANIF1
+%token YYTRI
+%token YYTRI0
+%token YYTRI1
+%token YYTRIAND
+%token YYTRIOR
+%token YYTRIREG
+%token YYuTYPE
+%token YYTYPEDEF
+%token YYVECTORED
+%token YYWAIT
+%token YYWAND
+%token YYWEAK0
+%token YYWEAK1
+%token YYWHILE
+%token YYWIRE
+%token YYWOR
+%token YYXNOR
+%token YYXOR
+%token YYsysSETUP
+%token YYsysID
+%token YYsysND
+
+%right YYCONDITIONAL
+%right '?' ':'
+%left YYOR
+%left YYLOGOR
+%left YYLOGAND
+%left '|'
+%left '^' YYLOGXNOR
+%left '&'
+%left YYLOGEQUALITY YYLOGINEQUALITY YYCASEEQUALITY YYCASEINEQUALITY
+%left '<' YYLEQ '>' YYGEQ YYNBASSIGN
+%left YYLSHIFT YYRSHIFT
+%left '+' '-'
+%left '*' '/' '%'
+%right '~' '!' YYUNARYOPERATOR
+
+%type <desc> source_text
+%type <desc> description
+%type <modu> module
+%type <prim> primitive
+%type <lstp> port_list_opt port_list
+%type <port> port
+%type <lstp> port_expression_opt port_expression
+%type <lstp> port_ref_list
+%type <idrng> port_reference
+%type <rang> port_reference_arg
+%type <type> module_item
+%type <lstp> module_item_clr
+%type <paradcl> parameter_declaration
+%type <rangdcl> input_declaration output_declaration inout_declaration
+%type <rangdcl> reg_declaration
+%type <netdcl>  net_declaration
+%type <bascdcl> time_declaration event_declaration
+%type <bascdcl> integer_declaration real_declaration
+%type <gtlist>  gate_instantiation
+%type <type> module_or_primitive_instantiation
+%type <paradcl> parameter_override
+%type <casgn>   continuous_assign
+%type <prcstmt> initial_statement always_statement
+%type <task> task
+%type <func> function
+%type <lstp> variable_list primitive_declaration_eclr
+%type <lstp> table_definition
+%type <lstp> table_entries combinational_entry_eclr sequential_entry_eclr
+%type <ntry> combinational_entry sequential_entry
+%type <lstp> input_list level_symbol_or_edge_eclr
+%type <ival> output_symbol state next_state
+%type <ival> level_symbol edge level_symbol_or_edge edge_symbol
+%type <type> primitive_declaration
+%type <lstp> tf_declaration_clr tf_declaration_eclr
+%type <lstp> statement_opt
+%type <rngtyp>  range_or_type_opt range_or_type
+%type <rang> range
+%type <type> tf_declaration
+%type <lstp> assignment_list
+%type <rang> range_opt
+%type <expr> expression
+%type <ival> drive_strength_opt drive_strength
+%type <ival> charge_strength_opt charge_strength
+%type <ival> nettype
+%type <rang> expandrange_opt expandrange
+%type <dlay> delay_opt delay
+%type <lstp> register_variable_list
+%type <lstp> name_of_event_list
+%type <idrng>  identifier
+%type <idrng>  register_variable
+%type <charp>  name_of_register
+%type <idrng>  name_of_event
+%type <ival> strength0 strength1
+%type <basgn>  assignment
+%type <lstp> drive_delay_clr gate_instance_list
+%type <ival> gatetype drive_delay
+%type <gtinst> gate_instance
+%type <lstp> terminal_list
+%type <idrng>  name_of_gate_instance name_of_module_or_primitive
+%type <expr> terminal
+%type <lstp> module_or_primitive_option_clr
+%type <ival> module_or_primitive_option
+%type <lstp> module_or_primitive_instance_list
+%type <dlay> delay_or_parameter_value_assignment
+%type <type> module_or_primitive_instance
+%type <lstp> module_connection_list module_port_connection_list
+%type <lstp> named_port_connection_list
+%type <connect> module_port_connection named_port_connection
+%type <type> statement
+%type <lstp> statement_clr case_item_eclr
+%type <caseitem> case_item
+%type <dlay> delay_control
+%type <evnt> event_control
+%type <lval> lvalue
+%type <lstp> expression_list
+%type <seqstmt>  seq_block
+%type <parstmt>  par_block
+%type <idrng> name_of_block
+%type <lstp> block_declaration_clr
+%type <type> block_declaration
+%type <taskenablestmt>  task_enable
+%type <lstp> concatenation
+%type <lstp> mintypmax_expression_list
+%type <expr> mintypmax_expression
+%type <expr> primary
+%type <expr> function_call
+%type <evnt> event_expression ored_event_expression
+%type <typedcl> type_declaration type_decorator_opt
+%type <charp> type_name enum_name
+%type <typespc> type_specifier
+%type <lstp> enum_lst_opt enumerator_list
+%type <enumtp> enum_specifier
+%type <enumtr> enumerator
+%type <lstp> nondeterminism_list
+%type <mconcat> multiple_concatenation
+
+/* The rules for if-then-else statements produce one harmless
+ * shift-reduce conflict. */
+%expect 1
+
+%%
+
+
+
+source_text
+	:
+	  {
+	      YYTRACE("source_text:");
+	      if (vl_description == NIL(struct vl_desc)) {
+		  $$ = vl_description = mod_list = vl_create_desc("stdin");
+	      }
+	  }
+	| source_text description
+	  {
+	      YYTRACE("source_text: source_text description");
+	  }
+	;
+
+description
+	: module
+	  {
+	      YYTRACE("description: module");
+	  }
+	| primitive
+	  {
+	      YYTRACE("description: primitive");
+	  }
+	| type_declaration
+	  {
+	      YYTRACE("module_item: type_declaration");
+	  }
+	;
+
+type_declaration
+	: YYTYPEDEF type_specifier type_name ';'
+	  {
+	      YYTRACE("type_declaration: YYTYPEDEF typesepcifier type_name ';'");
+	      vl_create_typedecl($3, $2);
+	      if (compatibleChecking)
+		  yyerror("type mechanism is not allowed");
+	  }
+	;
+
+module
+	: YYMODULE YYIDE
+	  {
+	      vl_id_rangePtr idptr;
+
+
+	      if (!empty_file_stack() && !instantiateAll && mod_list)
+		  st_insert(mod_list->mod_holes,vlStrdup(yyid),0);
+
+	      idptr = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	      vl_currentModule = vl_create_module(idptr, LS_NIL, LS_NIL);
+	      (void)push_stack(vl_module_stack, (void*)vl_currentModule);
+	      set_eliminate(idptr->name, mod_list->mp_undefined);
+	  }
+	  port_list_opt ';'
+	  {
+	      vl_currentModule->ports = $4;
+	  }
+	  module_item_clr
+	  YYENDMODULE
+	  {
+	      YYTRACE("module: YYMODULE YYIDE port_list_opt ';' module_item_clr YYENDMODULE");
+	      vl_currentModule->mod_items = $7;
+	      $$ = vl_currentModule;
+	      (void**)pop_stack(vl_module_stack, (void**)&vl_currentModule);
+	      vl_currentModule = (vl_module*)(void*)top_stack(vl_module_stack);
+	      assert(vl_currentModule == NIL(vl_module));
+	  }
+	| YYMACROMODULE YYIDE port_list_opt ';'
+		module_item_clr
+	  YYENDMODULE
+	  {
+	      YYTRACE("module: YYMACROMODULE YYIDE port_list_opt ';' module_item_clr YYENDMODULE");
+	      TODO("module: YYMACROMODULE YYIDE port_list_opt ';' module_item_clr YYENDMODULE");
+	  }
+	;
+
+port_list_opt
+	:
+	  {
+	      YYTRACE("port_list_opt:");
+	      $$ = LS_NIL;
+	  }
+	| '(' port_list ')'
+	  {
+	      YYTRACE("port_list_opt: '(' port_list ')'");
+	      $$ = $2;
+	  }
+	;
+
+port_list
+	: port
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("port_list: port");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| port_list ',' port
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("port_list: port_list ',' port");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+port
+	: port_expression_opt
+	  {
+	      YYTRACE("port: port_expression_opt");
+	      $$ = vl_create_port(ModulePort, NIL(vl_id_range), $1);
+	  }
+	| '.' YYIDE
+	  {
+	      $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	  '(' port_expression_opt ')'
+	  {
+	      YYTRACE("port: ',' YYIDE '(' port_expression_opt ')'");
+	      $$ = vl_create_port(NamedPort, $<idrng>3, $5);
+	  }
+	;
+
+port_expression_opt
+	:
+	   {
+	       YYTRACE("port_expression_opt:");
+	       $$ = LS_NIL;
+	   }
+	|  port_expression
+	   {
+	       YYTRACE("port_expression_opt: port_expression");
+	   }
+	;
+
+port_expression
+	: port_reference
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("port_expression: port_reference");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| '{' port_ref_list '}'
+	  {
+	      YYTRACE("port_expression: '{' port_ref_list '}'");
+	      $$ = $2;
+	  }
+	;
+
+port_ref_list
+	: port_reference
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("port_ref_list: port_reference");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| port_ref_list ',' port_reference
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("port_ref_list: port_ref_list ',' port_reference");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+port_reference
+	: YYIDE
+	  {
+	      $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	  port_reference_arg
+	  {
+	      YYTRACE("port_reference: YYIDE port_reference_arg");
+	      $$ = vl_create_id_range($<idrng>2->name, $3);
+	  }
+	;
+
+port_reference_arg
+	:
+	  {
+	      YYTRACE("port_reference_arg:");
+	      $$ = vl_create_range(NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '[' expression ']'
+	  {
+	      YYTRACE("port_reference_arg: '[' expression ']'");
+	      $$ = vl_create_range($2, NIL(vl_expr));
+	  }
+	| '[' expression ':' expression ']'
+	  {
+	      YYTRACE("port_reference_arg: '[' expression ':' expression ']'");
+	      $$ = vl_create_range($2, $4);
+	  }
+	;
+
+module_item_clr
+	:
+	  {
+	      YYTRACE("module_item_clr:");
+	      $$ = lsCreate();
+	  }
+	| module_item_clr module_item
+	  {
+	      lsHandle handle;
+	      int decomposed_assign = 0;
+	      lsHandle assignHandle;
+	      lsGen assignGen;
+	      vl_cont_assign *cont_assign, *new_cont_assign;
+	      lsList new_assigns;
+	      vl_bassign_stmt *assign;
+
+	      YYTRACE("module_item_clr: module_item_clr module_item");
+	      if (((vl_decl*)$2)->type == ContAssign)
+		  if (lsLength(((vl_cont_assign*)$2)->assigns) > 1) {
+		      decomposed_assign = 1;
+		      cont_assign = (vl_cont_assign*)$2;
+		      for (assignGen=lsStart(((vl_cont_assign*)$2)->assigns);
+			   lsNext(assignGen,(lsGeneric*)&assign,&assignHandle)
+			       != LS_NOMORE; ) {
+			  new_assigns = lsCreate();
+			  lsNewEnd(new_assigns, (lsGeneric)assign, 0);
+			  new_cont_assign =
+			      vl_create_cont_assign_stmt(cont_assign->strength,
+							 cont_assign->delay,
+							 new_assigns);
+			  lsNewEnd($1, (lsGeneric)new_cont_assign, 0);
+		      }
+		      lsFinish(assignGen);
+		      lsDestroy(cont_assign->assigns, 0);
+		      vl_chk_free((char*)$2);
+		  }
+	      if (!decomposed_assign)
+		  lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+module_item
+	: parameter_declaration
+	  {
+	      YYTRACE("module_item: parameter_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| input_declaration
+	  {
+	      YYTRACE("module_item: input_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| output_declaration
+	  {
+	      YYTRACE("module_item: output_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| inout_declaration
+	  {
+	      YYTRACE("module_item: inout_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| net_declaration
+	  {
+	      YYTRACE("module_item: net_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| reg_declaration
+	  {
+	      YYTRACE("module_item: reg_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| time_declaration
+	  {
+	      YYTRACE("module_item: time_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| integer_declaration
+	  {
+	      YYTRACE("module_item: integer_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| real_declaration
+	  {
+	      YYTRACE("module_item: real_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| event_declaration
+	  {
+	      YYTRACE("module_item: event_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| gate_instantiation
+	  {
+	      YYTRACE("module_item: gate_instantiation");
+	      $$ = (typestructPtr)$1;
+	  }
+	| module_or_primitive_instantiation
+	  {
+	      YYTRACE("module_item: module_or_primitive_instantiation");
+	      $$ = (typestructPtr)$1;
+	  }
+	| parameter_override
+	  {
+	      YYTRACE("module_item: parameter_override");
+	      $$ = (typestructPtr)$1;
+	  }
+	| continuous_assign
+	  {
+	      YYTRACE("module_item: continous_assign");
+	      $$ = (typestructPtr)$1;
+	  }
+	| specify_block
+	  {
+	      YYTRACE("module_item: specify_block");
+	      $$ = $<type>1;
+	  }
+	| initial_statement
+	  {
+	      YYTRACE("module_item: initial_statement");
+	      $$ = (typestructPtr)$1;
+	  }
+	| always_statement
+	  {
+	      YYTRACE("module_item: always_statement");
+	      $$ = (typestructPtr)$1;
+	  }
+	| task
+	  {
+	      YYTRACE("module_item: task");
+	      $$ = (typestructPtr)$1;
+	  }
+	| function
+	  {
+	      YYTRACE("module_item: function");
+	      $$ = (typestructPtr)$1;
+	  }
+	;
+
+primitive
+	: YYPRIMITIVE YYIDE
+	  {
+	      vl_id_rangePtr idptr;
+
+	      idptr = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	      vl_currentPrimitive = vl_create_primitive(idptr,
+							LS_NIL,
+							LS_NIL,
+							LS_NIL);
+	      set_eliminate(idptr->name, mod_list->mp_undefined);
+	  }
+	  '(' port_list ')' ';'
+		primitive_declaration_eclr
+		table_definition
+	  YYENDPRIMITIVE
+	  {
+	      YYTRACE("primitive: YYPRMITIVE YYIDE '(' variable_list ')' ';' primitive_declaration_eclr table_definition YYENDPRIMITIVE");
+	      vl_currentPrimitive->ports = $5;
+	      vl_currentPrimitive->decls = $8;
+	      vl_currentPrimitive->entries = $9;
+	      $$ = vl_currentPrimitive;
+	      vl_currentPrimitive = NIL(vl_primitive);
+	  }
+	;
+
+primitive_declaration_eclr
+	: primitive_declaration
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("primitive_declaration_eclr: primitive_declaration");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| primitive_declaration_eclr primitive_declaration
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("primitive_declaration_eclr: primitive_declaration_eclr primitive_declaration");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+primitive_declaration
+	: output_declaration
+	  {
+	      YYTRACE("primitive_declaration: output_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| reg_declaration
+	  {
+	      YYTRACE("primitive_decalration: reg_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| input_declaration
+	  {
+	      YYTRACE("primitive_decalration: input_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	;
+
+table_definition
+	: YYTABLE table_entries YYENDTABLE
+	  {
+	      YYTRACE("table_definition: YYTABLE table_entries YYENDTABLE");
+	      $$ = $2;
+	  }
+	;
+
+table_entries
+	: combinational_entry_eclr
+	  {
+	      YYTRACE("table_definition: combinational_entry_eclr");
+	      vl_currentPrimitive->type = CombPrimDecl;
+	  }
+	| sequential_entry_eclr
+	  {
+	      YYTRACE("table_definition: sequential_entry_eclr");
+	      vl_currentPrimitive->type = SeqPrimDecl;
+	  }
+	;
+
+combinational_entry_eclr
+	: combinational_entry
+	  {
+	      YYTRACE("combinational_entry_eclr: combinational_entry");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, LS_NH);
+	  }
+	| combinational_entry_eclr combinational_entry
+	  {
+	      YYTRACE("combinational_entry_eclr: combinational_entry_eclr combinational_entry");
+	      lsNewEnd($1, (lsGeneric)$2, LS_NH);
+	      $$ = $1;
+	  }
+	;
+
+combinational_entry
+	: input_list ':' output_symbol ';'
+	  {
+	      YYTRACE("combinational_entry: input_list ':' output_symbol ';'");
+	      $$ = vl_create_prim_entry($1, PrimNone, $3);
+	  }
+	;
+
+sequential_entry_eclr
+	: sequential_entry
+	  {
+	      YYTRACE("sequential_entry_eclr: sequential_entry");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, LS_NH);
+	  }
+	| sequential_entry_eclr sequential_entry
+	  {
+	      YYTRACE("sequential_entry_eclr: sequential_entry_eclr sequential_entry");
+	      lsNewEnd($1, (lsGeneric)$2, LS_NH);
+	      $$ = $1;
+	  }
+	;
+
+sequential_entry
+	: input_list ':' state ':' next_state ';'
+	  {
+	      YYTRACE("sequential_entry: input_list ':' state ':' next_state ';'");
+	      $$ = vl_create_prim_entry($1, $3, $5);
+	  }
+	;
+
+input_list
+	: level_symbol_or_edge_eclr
+	  {
+	      YYTRACE("input_list: level_symbol_or_edge_eclr");
+	  }
+	;
+
+level_symbol_or_edge_eclr
+	: level_symbol_or_edge
+	  {
+	      YYTRACE("level_symbol_or_edge_eclr: level_symbol_or_edge");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, LS_NH);
+	  }
+	| level_symbol_or_edge_eclr level_symbol_or_edge
+	  {
+	      YYTRACE("level_symbol_or_edge_eclr: level_symbol_or_edge_eclr level_symbol_or_edge");
+	      lsNewEnd($1, (lsGeneric)$2, LS_NH);
+	      $$ = $1;
+	  }
+	;
+
+level_symbol_or_edge
+	: level_symbol
+	  {
+	      YYTRACE("level_symbol_or_edge: level_symbol");
+	  }
+	| edge
+	  {
+	      YYTRACE("level_symbol_or_edge: edge");
+	  }
+	;
+
+edge
+	: '(' level_symbol level_symbol ')'
+	  {
+	      YYTRACE("edge: '(' level_symbol level_symbol ')'");
+	      switch ($2) {
+	      case Prim0: $$ = ($3==PrimX) ? Prim0X : PrimR; break;
+	      case Prim1: $$ = ($3==PrimX) ? Prim1X : PrimF; break;
+	      case PrimX:
+		  $$ = ($3==Prim1) ? PrimX1 : ($3==Prim0) ? PrimX0 : PrimXB;
+		  break;
+	      case PrimB: $$ = ($3==PrimX) ? PrimBX : PrimBB; break;
+	      case PrimQ:
+		  $$ = ($3==Prim1) ? PrimQ1 : ($3==Prim0) ? PrimQ0 : PrimQB;
+		  break;
+	      default: {
+		  char mesg[MAXSTRLEN];
+
+		  sprintf(mesg, "Unknown edge symbol (%d,%d)", $2, $3);
+		  compile_error(mesg);
+	      }
+	      }
+	  }
+	| edge_symbol
+	  {
+	      YYTRACE("edge: edge_symbol");
+	  }
+	;
+
+state
+	: level_symbol
+	  {
+	      YYTRACE("state: level_symbol");
+	  }
+	;
+
+next_state
+	: output_symbol
+	  {
+	      YYTRACE("next_state: output_symbol");
+	  }
+	| '-'
+	  {
+	      YYTRACE("next_state: '_'");
+	      $$ = PrimM;
+	  }
+	;
+
+output_symbol
+	: '0'
+	  {
+	      YYTRACE("output_symbol: '0'");
+	      $$ = Prim0;
+	  }
+	| '1'
+	  {
+	      YYTRACE("output_symbol: '1'");
+	      $$ = Prim1;
+	  }
+	| 'x'
+	  {
+	      YYTRACE("output_symbol: 'x'");
+	      $$ = PrimX;
+	  }
+	| 'X'
+	  {
+	      YYTRACE("output_symbol: 'X'");
+	      $$ = PrimX;
+	  }
+	;
+
+level_symbol
+	: '0'
+	  {
+	      YYTRACE("level_symbol: '0'");
+	      $$ = Prim0;
+	  }
+	| '1'
+	  {
+	      YYTRACE("level_symbol: '1'");
+	      $$ = Prim1;
+	  }
+	| 'x'
+	  {
+	      YYTRACE("level_symbol: 'x'");
+	      $$ = PrimX;
+	  }
+	| 'X'
+	  {
+	      YYTRACE("level_symbol: 'X'");
+	      $$ = PrimX;
+	  }
+	| '?'
+	  {
+	      YYTRACE("level_symbol: '?'");
+	      $$ = PrimQ;
+	  }
+	| 'b'
+	  {
+	      YYTRACE("level_symbol: 'b'");
+	      $$ = PrimB;
+	  }
+	| 'B'
+	  {
+	      YYTRACE("level_symbol: 'B'");
+	      $$ = PrimB;
+	  }
+	;
+
+edge_symbol
+	: 'r'
+	  {
+	      YYTRACE("edge_symbol: 'r'");
+	      $$ = PrimR;
+	  }
+	| 'R'
+	  {
+	      YYTRACE("edge_symbol: 'R'");
+	      $$ = PrimR;
+	  }
+	| 'f'
+	  {
+	      YYTRACE("edge_symbol: 'f'");
+	      $$ = PrimF;
+	  }
+	| 'F'
+	  {
+	      YYTRACE("edge_symbol: 'F'");
+	      $$ = PrimF;
+	  }
+	| 'p'
+	  {
+	      YYTRACE("edge_symbol: 'p'");
+	      $$ = PrimP;
+	  }
+	| 'P'
+	  {
+	      YYTRACE("edge_symbol: 'P'");
+	      $$ = PrimP;
+	  }
+	| 'n'
+	  {
+	      YYTRACE("edge_symbol: 'n'");
+	      $$ = PrimN;
+	  }
+	| 'N'
+	  {
+	      YYTRACE("edge_symbol: 'N'");
+	      $$ = PrimN;
+	  }
+	| '*'
+	  {
+	      YYTRACE("edge_symbol: '*'");
+	      $$ = PrimS;
+	  }
+	;
+
+task
+	: YYTASK YYIDE
+	  {
+	      $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	      task_mode = 1;
+	  }
+	  ';' tf_declaration_clr statement_opt
+	  YYENDTASK
+	  {
+	      YYTRACE("YYTASK YYIDE ';' tf_declaration_clr statement_opt YYENDTASK");
+	      $$ = vl_create_task($<idrng>3, $5, $6);
+	      task_mode = 0;
+	  }
+	;
+
+function
+	: YYFUNCTION range_or_type_opt YYIDE
+	  {
+	      int bad_type=0;
+
+	      $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+
+	      if (!$2) {
+
+		  vl_expr *zero;
+		  zero = vl_create_expr(IntExpr, 0, (double)0.0,
+					NIL(void), NIL(void), NIL(void));
+		  $2 = vl_create_range_or_type(Range_Dcl,
+					       vl_create_range(zero,zero));
+	      } else if (!$2->range) {
+		  bad_type = 1;
+	      }
+
+	      if (bad_type) {
+		  char buf[MAXSTRLEN];
+		  sprintf(buf, "bit width of function '%s' is not known",yyid);
+		  compile_error(buf);
+	      }
+
+	      vl_currentFunction = vl_create_function(0, $2->range, $<idrng>$,
+						      lsCreate(), lsCreate());
+	      vl_currentModule = (vl_module*)vl_currentFunction;
+	      push_stack(vl_module_stack, vl_currentModule);
+	  }
+	  ';' tf_declaration_eclr statement_opt
+	  YYENDFUNCTION
+	  {
+	      vl_id_range *func_out;
+	      short func_type=0;
+	      lsList out_ids;
+
+	      YYTRACE("YYFUNCTION range_or_type_opt YYIDE ';' tf_declaration_eclr statement_opt YYENDFUNCTION");
+	      if ($2 == NIL(vl_range_or_type)) {
+		  func_type = IntFuncDecl;
+	      } else {
+		  switch ($2->type) {
+		  case Range_Dcl: func_type = RangeFuncDecl; break;
+		  case Integer_Dcl: func_type = IntFuncDecl; break;
+		  case Real_Dcl: func_type = RealFuncDecl; break;
+		  default: internal_error("unknown function type");
+		  }
+	      }
+
+	      func_out = vl_create_id_range($<idrng>4->name, NIL(vl_range));
+	      func_out->flags |= OutPort;
+	      out_ids = lsCreate();
+	      lsNewEnd(out_ids, (lsGeneric)func_out, 0);
+	      if ($2->type == Range_Dcl)
+		  lsNewEnd($6, (lsGeneric)vl_create_rangedecl(NIL(vl_type),
+							      RegDecl,
+							      $2->range,
+							      out_ids, 0),
+			   0);
+	      else
+		  lsNewEnd($6, (lsGeneric)vl_create_rangedecl(NIL(vl_type),
+							      RegDecl,
+							      NIL(vl_range),
+							      out_ids, 0),
+			   0);
+
+	      ((vl_function*)vl_currentModule)->type = func_type;
+	      ((vl_function*)vl_currentModule)->decls = $6;
+	      ((vl_function*)vl_currentModule)->stmts = $7;
+	      $$ = (vl_function*)vl_currentModule;
+	      (void*)pop_stack(vl_module_stack, (void**)&vl_currentModule);
+	      vl_currentModule = (vl_module*)(void*)top_stack(vl_module_stack);
+	      lsNewBegin($$->ports, (lsGeneric)func_out, 0);
+	      vl_currentFunction = NIL(vl_function);
+	      assert(vl_currentModule != NIL(vl_module));
+	  }
+	;
+
+range_or_type_opt
+	:
+	  {
+	      YYTRACE("range_or_type_opt:");
+	      $$ = NIL(vl_range_or_type);
+	  }
+	| range_or_type
+	  {
+	      YYTRACE("range_or_type_opt: range_or_type");
+	      $$ = $1;
+	  }
+	;
+
+range_or_type
+	: range
+	  {
+	      YYTRACE("range_or_type: range");
+	      $$ = vl_create_range_or_type(Range_Dcl, $1);
+	  }
+	| YYINTEGER
+	  {
+	      YYTRACE("range_or_type: YYINTEGER");
+	      $$ = vl_create_range_or_type(Integer_Dcl, NIL(vl_range));
+	  }
+	| YYREAL
+	  {
+	      YYTRACE("range_or_type: YYREAL");
+	      $$ = vl_create_range_or_type(Real_Dcl, NIL(vl_range));
+	  }
+	;
+
+tf_declaration_clr
+	:
+	  {
+	      YYTRACE("tf_declaration_clr:");
+	      $$ = lsCreate();
+	  }
+	| tf_declaration_clr tf_declaration
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("tf_declaration_clr: tf_declaration_clr tf_declaration");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+tf_declaration_eclr
+	: tf_declaration
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("tf_declaration_eclr: tf_declaration");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| tf_declaration_eclr tf_declaration
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("tf_declaration_eclr: tf_decalration_eclr tf_declaration");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+tf_declaration
+	: parameter_declaration
+	  {
+	      YYTRACE("tf_declaration: parameter_decalration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| input_declaration
+	  {
+	      YYTRACE("tf_declaration: input_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| output_declaration
+	  {
+	      YYTRACE("tf_declaration: output_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| inout_declaration
+	  {
+	      YYTRACE("tf_declaration: inout_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| reg_declaration
+	  {
+	      YYTRACE("tf_declaration: reg_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| time_declaration
+	  {
+	      YYTRACE("tf_declaration: time_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| integer_declaration
+	  {
+	      YYTRACE("tf_declaration: integer_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| real_declaration
+	  {
+	      YYTRACE("tf_declaration: real_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| event_declaration
+	  {
+	      YYTRACE("tf_declaration: event_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	;
+
+type_name
+	: YYIDE
+	  {
+	      YYTRACE("type_name: YYIDE");
+	      $$ = vlStrdup(yyid);
+	  }
+	;
+
+type_specifier
+	: enum_specifier
+	  {
+	      YYTRACE("type_specifier: enum_specifier ';'");
+	      $$ = vl_create_type_specifier(EnumType, $1);
+	  }
+	;
+
+enum_specifier
+	: YYENUM {enum_val=0;} enum_name enum_lst_opt
+	  {
+	      YYTRACE("enum_specifier: YYENUM enum_name enum_lst_opt");
+	      $$ = vl_create_enum_type($3, $4);
+	  }
+	| YYENUM {enum_val=0;} '{' enumerator_list '}'
+	  {
+	      YYTRACE("enum_specifier: YYENUM '{' enumerator_list '}'");
+	      $$ = vl_create_enum_type(NIL(char), $4);
+	  }
+	;
+
+enum_name
+	: YYIDE
+	  {
+	      YYTRACE("enum_name: YYIDE");
+	      $$ = vlStrdup(yyid);
+	  }
+	;
+
+enum_lst_opt
+	: '{' enumerator_list '}'
+	  {
+	      YYTRACE("enum_lst_opt: '{' enumerator_list '}'");
+	      $$ = $2;
+	  }
+	|
+	  {
+	      YYTRACE("enum_lst_opt: ");
+	      $$ = (lsList)0;
+	  }
+	;
+
+enumerator_list
+	: enumerator
+	  {
+	      YYTRACE("enumerator_list: enumerator");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, 0);
+	  }
+	| enumerator_list ',' enumerator
+	  {
+	      YYTRACE("enumerator_list: enumerator_list ',' enumerator");
+	      lsNewEnd($$, (lsGeneric)$3, 0);
+	  }
+	;
+
+enumerator
+	: YYIDE
+	  {
+	      YYTRACE("enumerator: YYIDE");
+	      $$ = vl_create_enumerator(vlStrdup(yyid), enum_val++);
+	  }
+	| YYIDE {cp=vlStrdup(yyid);} '=' expression
+	  {
+	      YYTRACE("enumerator: YYIDE '=' expression");
+	      enum_val = vl_eval_expr($4);
+	      $$ = vl_create_enumerator(cp, enum_val++);
+	  }
+	;
+
+
+
+type_decorator_opt
+	: YYuTYPE
+	  {
+	      vl_type *var_type;
+	      int mustBe1;
+
+	      YYTRACE("type_decorator_opt: YYuTYPE");
+	      mustBe1 = st_lookup(mod_list->type_st, yyid, (char**)&var_type);
+	      assert(mustBe1);
+	      $$ = var_type;
+	  }
+	|
+	  {
+	      YYTRACE("type_decorator_opt: ");
+	      $$ = NIL(vl_type);
+	  }
+	;
+
+parameter_declaration
+	: YYPARAMETER assignment_list ';'
+	  {
+	      YYTRACE("parameter_declaration: YYPARAMETER assignment_list ';'");
+	      $$ = vl_create_paramdecl(ParamDecl, $2);
+	  }
+	;
+
+input_declaration
+	: YYINPUT range_opt variable_list ';'
+	  {
+	      YYTRACE("input_declaration: YYINPUT range_opt variable_list ';'");
+	      $$ = vl_create_rangedecl(NIL(vl_type), InputDecl, $2, $3, 0);
+	  }
+	;
+
+output_declaration
+	: YYOUTPUT range_opt variable_list ';'
+	  {
+	      YYTRACE("output_declaration: YYOUTPUT range_opt variable_list ';'");
+	      $$ = vl_create_rangedecl(NIL(vl_type), OutputDecl, $2, $3, 0);
+	  }
+	;
+
+inout_declaration
+	: YYINOUT range_opt variable_list ';'
+	  {
+	      YYTRACE("inout_declaration: YYINOUT range_opt variable_list ';'");
+	      $$ = vl_create_rangedecl(NIL(vl_type), InoutDecl, $2, $3, 0);
+	  }
+	;
+
+net_declaration
+	: type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt
+	    assignment_list ';'
+	  {
+	      YYTRACE("net_declaration: type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt assignment_list ';'");
+	      $$ = vl_create_netdecl_assigned($1, $2, $3, $4, $5, $6);
+	  }
+	| type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt
+	    variable_list ';'
+	  {
+	      YYTRACE("net_declaration: type_decorator_opt nettype drive_strength_opt expandrange_opt delay_opt variable_list ';'");
+	      $$ = vl_create_netdecl($1, $2, $3, $4, $5, $6);
+	  }
+	| type_decorator_opt YYTRIREG charge_strength_opt expandrange_opt delay_opt
+	    variable_list ';'
+	  {
+	      YYTRACE("net_declaration: type_decorator_opt YYTRIREG charge_strength_opt expandrange_opt delay_opt variable_list ';'");
+	      $$ = vl_create_netdecl($1, TriregDecl, $3, $4, $5, $6);
+	  }
+	;
+
+
+nettype
+	: YYSWIRE
+	  {
+	      YYTRACE("nettype: YYSWIRE");
+	      $$ = SWireDecl;
+	  }
+	| YYWIRE
+	  {
+	      YYTRACE("nettype: YYWIRE");
+	      $$ = WireDecl;
+	  }
+	| YYTRI
+	  {
+	      YYTRACE("nettype: YYTRI");
+	      $$ = TriDecl;
+	  }
+	| YYTRI1
+	  {
+	      YYTRACE("nettype: YYTRI1");
+	      $$ = Tri1Decl;
+	  }
+	| YYSUPPLY0
+	  {
+	      YYTRACE("nettype: YYSUPPLY0");
+	      $$ = Supply0Decl;
+	  }
+	| YYWAND
+	  {
+	      YYTRACE("nettype: YYWAND");
+	      $$ = WandDecl;
+	  }
+	| YYTRIAND
+	  {
+	      YYTRACE("nettype: YYTRIAND");
+	      $$ = TriandDecl;
+	  }
+	| YYTRI0
+	  {
+	      YYTRACE("nettype: YYTRI0");
+	      $$ = Tri0Decl;
+	  }
+	| YYSUPPLY1
+	  {
+	      YYTRACE("nettype: YYSUPPLY1");
+	      $$ = Supply1Decl;
+	  }
+	| YYWOR
+	  {
+	      YYTRACE("nettype: YYWOR");
+	      $$ = WorDecl;
+	  }
+	| YYTRIOR
+	  {
+	      YYTRACE("nettype: YYTRIOR");
+	      $$ = TriorDecl;
+	  }
+	;
+
+
+expandrange_opt
+	:
+	  {
+	      YYTRACE("expandrange_opt:");
+	      $$ = NIL(vl_range);
+	  }
+	| expandrange
+	  {
+	      YYTRACE("expandrange_opt: expandrange");
+	      $$ = $1;
+	  }
+	;
+
+expandrange
+	: range
+	  {
+	      YYTRACE("expandrange: range");
+	  }
+	| YYSCALARED range
+	  {
+	      YYTRACE("expandrange: YYSCALARED range");
+	      $$ = $2;
+	  }
+	| YYVECTORED range
+	  {
+	      YYTRACE("expandrange: YYVECTORED range");
+	      $$ = $2;
+	  }
+	;
+
+reg_declaration
+	: type_decorator_opt YYREG range_opt register_variable_list ';'
+	  {
+	      YYTRACE("reg_declaration: type_decorator_opt YYREG range_opt register_variable_list ';'");
+	      $$ = vl_create_rangedecl($1, RegDecl, $3, $4, 0);
+	  }
+	| type_decorator_opt YYMREG range_opt register_variable_list ';'
+	  {
+	      YYTRACE("reg_declaration: type_decorator_opt YYMREG range_opt register_variable_list ';'");
+	      $$ = vl_create_rangedecl($1, RegDecl, $3, $4, MVar);
+	  }
+	;
+
+time_declaration
+	: YYTIME register_variable_list ';'
+	  {
+	      YYTRACE("time_declaration: YYTIME register_variable_list ';'");
+	      $$ = vl_create_basicdecl(TimeDecl, $2);
+	  }
+	;
+
+integer_declaration
+	: YYINTEGER register_variable_list ';'
+	  {
+	      YYTRACE("integer_declaration: YYINTEGER register_variable_list ';'");
+	      $$ = vl_create_basicdecl(IntDecl, $2);
+	  }
+	;
+
+real_declaration
+	: YYREAL variable_list ';'
+	  {
+	      YYTRACE("real_declaration: YYREAL variable_list ';'");
+	      $$ = vl_create_basicdecl(RealDecl, $2);
+	  }
+	;
+
+event_declaration
+	: YYEVENT name_of_event_list ';'
+	  {
+	      YYTRACE("event_declaration: YYEVENT name_of_event_list ';'");
+	      $$ = vl_create_basicdecl(EventDecl, $2);
+	  }
+	;
+
+continuous_assign
+	: YYASSIGN {reserve_type_name=0; c_assign=1;}
+	  drive_strength_opt delay_opt assignment_list ';'
+	  {
+	      YYTRACE("continuous_assign: YYASSIGN drive_strength_opt delay_opt assignment_list ';'");
+	      $$ = vl_create_cont_assign_stmt($3, $4, $5);
+	      reserve_type_name=1;
+	      c_assign=0;
+	  }
+	;
+
+parameter_override
+	: YYDEFPARAM assignment_list ';'
+	  {
+	      YYTRACE("parameter_override: YYDEFPARAM assign_list ';'");
+	      $$ = vl_create_paramdecl(DefparamDecl, $2);
+	  }
+	;
+
+variable_list
+	: identifier
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("variable_list: identifier");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| variable_list ',' identifier
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("variable_list: variable_list ',' identifier");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+register_variable_list
+	: register_variable
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("register_variable_list: register_variable");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| register_variable_list ',' register_variable
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("register_variable_list: register_variable_list ',' register_variable");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+register_variable
+	: name_of_register
+	  {
+	      YYTRACE("register_variable: name_of_register");
+	      $$ = vl_create_id_range($1, NIL(vl_range));
+	  }
+	| name_of_register '[' expression ':' expression ']'
+	  {
+	      int lo, hi;
+
+	      YYTRACE("register_variable: name_of_register '[' expression ':' expression ']'");
+	      lo = vl_eval_expr($3);
+	      hi = vl_eval_expr($5);
+	      if (lo > hi)
+		  $$ = vl_create_id_range($1, vl_create_range($5, $3));
+	      else
+		  $$ = vl_create_id_range($1, vl_create_range($3, $5));
+	  }
+	;
+
+name_of_register
+	: YYIDE
+	  {
+	      YYTRACE("name_of_register: YYIDE");
+	      $$ = vlStrdup(yyid);
+	  }
+	;
+
+name_of_event_list
+	: name_of_event
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("name_of_event_list: name_of_event");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| name_of_event_list ',' name_of_event
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("name_of_event_list: name_of_event_list ',' name_of_event");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+name_of_event
+	: YYIDE
+	  {
+	      YYTRACE("name_of_event: YYIDE");
+	      $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	;
+
+charge_strength_opt
+	:
+	  {
+	      YYTRACE("charge_strength_opt:");
+	      $$ = 0;
+	  }
+	| charge_strength
+	  {
+	      YYTRACE("charge_strength_opt: charge_strength");
+	  }
+	;
+
+charge_strength
+	: '(' YYSMALL ')'
+	  {
+	      YYTRACE("charge_strength: '(' YYSMALL ')'");
+	      $$ = Small;
+	  }
+	| '(' YYMEDIUM ')'
+	  {
+	      YYTRACE("charge_strength: '(' YYMEDIUM ')'");
+	      $$ = Medium;
+	  }
+	| '(' YYLARGE ')'
+	  {
+	      YYTRACE("charge_strength: '(' YYLARGE ')'");
+	      $$ = Large;
+	  }
+	;
+
+drive_strength_opt
+	:
+	  {
+	      YYTRACE("drive_strength_opt:");
+	      $$ = 0;
+	  }
+	| drive_strength
+	  {
+	      YYTRACE("drive_strength_opt: drive_strength");
+	      $$ = $1;
+	  }
+	;
+
+drive_strength
+	: '(' strength0 ',' strength1 ')'
+	  {
+	      YYTRACE("drive_strength: '(' strength0 ',' strength1 ')'");
+	      $$ = drive_strength($2, $4);
+	  }
+	| '(' strength1 ',' strength0 ')'
+	  {
+	      YYTRACE("drive_strength: '(' strength1 ',' strength0 ')'");
+	      $$ = drive_strength($4, $2);
+	  }
+	;
+
+strength0
+	: YYSUPPLY0
+	  {
+	      YYTRACE("strength0: YYSUPPLY0");
+	      $$ = YYSUPPLY0;
+	  }
+	| YYSTRONG0
+	  {
+	      YYTRACE("strength0: YYSTRONG0");
+	      $$ = YYSTRONG0;
+	  }
+	| YYPULL0
+	  {
+	      YYTRACE("strength0: YYPULL0");
+	      $$ = YYPULL0;
+	  }
+	| YYWEAK0
+	  {
+	      YYTRACE("strength0: YYWEAK0");
+	      $$ = YYWEAK0;
+	  }
+	| YYHIGHZ0
+	  {
+	      YYTRACE("strength0: YYHIGHZ0");
+	      $$ = YYHIGHZ0;
+	  }
+	;
+
+strength1
+	: YYSUPPLY1
+	  {
+	      YYTRACE("strength1: YYSUPPLY1");
+	      $$ = YYSUPPLY1;
+	  }
+	| YYSTRONG1
+	  {
+	      YYTRACE("strength1: YYSTRONG1");
+	      $$ = YYSTRONG1;
+	  }
+	| YYPULL1
+	  {
+	      YYTRACE("strength1: YYPULL1");
+	      $$ = YYPULL1;
+	  }
+	| YYWEAK1
+	  {
+	      YYTRACE("strength1: YYWEAK1");
+	      $$ = YYWEAK1;
+	  }
+	| YYHIGHZ1
+	  {
+	      YYTRACE("strength1: YYHIGHZ1");
+	      $$ = YYHIGHZ1;
+	  }
+	;
+
+range_opt
+	:
+	  {
+	      YYTRACE("range_opt:");
+	      $$ = NIL(vl_range);
+	  }
+	| range
+	  {
+	      YYTRACE("range_opt: range");
+	      $$ = $1;
+	  }
+	;
+
+range
+	: '[' expression ':' expression ']'
+	  {
+	      YYTRACE("range: '[' expression ':' expression ']'");
+	      $$ = vl_create_range($2, $4);
+	  }
+	;
+
+assignment_list
+	: assignment
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("assignment_list: assignment");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| assignment_list ',' assignment
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("assignment_list: assignment_list ',' assignment");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+
+
+gate_instantiation
+	: gatetype drive_delay_clr gate_instance_list ';'
+	  {
+	      int strength=0;
+	      vl_delay *delay=NIL(vl_delay);
+
+	      YYTRACE("gate_instantiation: gatetype drive_delay_clr gate_instance_list ';'");
+
+	      extract_delay_strength($2, &delay, &strength);
+	      lsDestroy($2, NULL);
+
+
+	      $$ = vl_create_gate_inst_list($1, strength, delay, $3);
+
+	      insert_instances($3, $$);
+	  }
+	;
+
+drive_delay_clr
+	:
+	  {
+	      YYTRACE("drive_delay_clr:");
+	      $$ = lsCreate();
+	  }
+	| drive_delay_clr drive_delay
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("drive_delay_clr: drive_delay_clr drive_delay");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+drive_delay
+	: drive_strength
+	  {
+	      YYTRACE("drive_delay: drive_strength");
+	      $$ = $1 << 2;
+	  }
+	| delay
+	  {
+	      YYTRACE("drive_delay: delay");
+
+
+
+	      $$ = (int)($1) | LEAST_SB;
+	  }
+	;
+
+gatetype
+	: YYAND
+	  {
+	      YYTRACE("gatetype: YYAND");
+	      $$ = AndGate;
+	  }
+	| YYNAND
+	  {
+	      YYTRACE("gatetype: YYNAND");
+	      $$ = NandGate;
+	  }
+	| YYOR
+	  {
+	      YYTRACE("gatetype: YYOR");
+	      $$ = OrGate;
+	  }
+	| YYNOR
+	  {
+	      YYTRACE("gatetype: YYNOR");
+	      $$ = NorGate;
+	  }
+	| YYXOR
+	  {
+	      YYTRACE("gatetype: YYXOR");
+	      $$ = XorGate;
+	  }
+	| YYXNOR
+	  {
+	      YYTRACE("gatetype: YYXNOR");
+	      $$ = XnorGate;
+	  }
+	| YYBUF
+	  {
+	      YYTRACE("gatetype: YYBUF");
+	      $$ = BufGate;
+	  }
+	| YYBUFIF0
+	  {
+	      YYTRACE("gatetype: YYBIFIF0");
+	      $$ = Bufif0Gate;
+	  }
+	| YYBUFIF1
+	  {
+	      YYTRACE("gatetype: YYBIFIF1");
+	      $$ = Bufif1Gate;
+	  }
+	| YYNOT
+	  {
+	      YYTRACE("gatetype: YYNOT");
+	      $$ = NotGate;
+	  }
+	| YYNOTIF0
+	  {
+	      YYTRACE("gatetype: YYNOTIF0");
+	      $$ = Notif0Gate;
+	  }
+	| YYNOTIF1
+	  {
+	      YYTRACE("gatetype: YYNOTIF1");
+	      $$ = Notif1Gate;
+	  }
+	| YYPULLDOWN
+	  {
+	      YYTRACE("gatetype: YYPULLDOWN");
+	      $$ = PulldownGate;
+	  }
+	| YYPULLUP
+	  {
+	      YYTRACE("gatetype: YYPULLUP");
+	      $$ = PullupGate;
+	  }
+	| YYNMOS
+	  {
+	      YYTRACE("gatetype: YYNMOS");
+	      $$ = NmosGate;
+	  }
+	| YYPMOS
+	  {
+	      YYTRACE("gatetype: YYPMOS");
+	      $$ = PmosGate;
+	  }
+	| YYRNMOS
+	  {
+	      YYTRACE("gatetype: YYRNMOS");
+	      $$ = RnmosGate;
+	  }
+	| YYRPMOS
+	  {
+	      YYTRACE("gatetype: YYRPMOS");
+	      $$ = RpmosGate;
+	  }
+	| YYCMOS
+	  {
+	      YYTRACE("gatetype: YYCMOS");
+	      $$ = CmosGate;
+	  }
+	| YYRCMOS
+	  {
+	      YYTRACE("gatetype: YYRCMOS");
+	      $$ = RcmosGate;
+	  }
+	| YYTRAN
+	  {
+	      YYTRACE("gatetype: YYTRAN");
+	      $$ = TranGate;
+	  }
+	| YYRTRAN
+	  {
+	      YYTRACE("gatetype: YYRTRAN");
+	      $$ = RtranGate;
+	  }
+	| YYTRANIF0
+	  {
+	      YYTRACE("gatetype: YYTRANIF0");
+	      $$ = Tranif0Gate;
+	  }
+	| YYRTRANIF0
+	  {
+	      YYTRACE("gatetype: YYRTRANIF0");
+	      $$ = Rtranif0Gate;
+	  }
+	| YYTRANIF1
+	  {
+	      YYTRACE("gatetype: YYTRANIF1");
+	      $$ = Tranif1Gate;
+	  }
+	| YYRTRANIF1
+	  {
+	      YYTRACE("gatetype: YYRTRANIF1");
+	      $$ = Rtranif1Gate;
+	  }
+
+
+	| YYTESLATIMER
+	  {
+	      YYTRACE("gatetype: YYTESLATIMER");
+	      $$ = TeslaTimerGate;
+	  }
+	;
+
+gate_instance_list
+	: gate_instance
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("gate_instance_list: gate_instance");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| gate_instance_list ',' gate_instance
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("gate_instance_list: gate_instance_list ',' gate_instance");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+gate_instance
+	: '(' terminal_list ')'
+	  {
+	      YYTRACE("gate_instance: '(' terminal_list ')'");
+	      $$ = vl_create_gate_inst(NIL(vl_id_range), $2);
+	  }
+	| name_of_gate_instance '(' terminal_list ')'
+	  {
+	      YYTRACE("gate_instance: name_of_gate_instance '(' terminal_list ')'");
+	      $$ = vl_create_gate_inst($1, $3);
+	  }
+	;
+
+name_of_gate_instance
+	: YYIDE
+	  {
+	      YYTRACE("name_of_gate_instance: YYIDE");
+	      $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	;
+
+terminal_list
+	: terminal
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("terminal_list: terminal");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| terminal_list ',' terminal
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("terminal_list: terminal_list ',' terminal");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+terminal
+	: expression
+	  {
+	      YYTRACE("terminal: expression");
+	  }
+	;
+
+
+
+module_or_primitive_instantiation
+	: name_of_module_or_primitive module_or_primitive_option_clr
+	     module_or_primitive_instance_list ';'
+	  {
+	      int strength=0;
+	      vl_delay *delay=NIL(vl_delay);
+
+	      YYTRACE("module_or_primitive_instantiation: name_of_module_or_primitive module_or_primitive_option_clr module_or_primitive_instance_list ';'");
+
+	      extract_delay_strength($2, &delay, &strength);
+	      lsDestroy($2, NULL);
+
+
+	      $$ = vl_add_find_mod_prim_instances($1, delay, strength, $3);
+
+	      insert_instances($3, $$);
+	  }
+	;
+
+name_of_module_or_primitive
+	: YYIDE
+	  {
+	      YYTRACE("name_of_module_or_primitive: YYIDE");
+	      $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	;
+
+module_or_primitive_option_clr
+	:
+	  {
+	      YYTRACE("module_or_primitive_option_clr:");
+	      $$ = lsCreate();
+	  }
+	| module_or_primitive_option_clr module_or_primitive_option
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("module_or_primitive_option_clr: module_or_primitive_option_clr module_or_primitive_option");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+module_or_primitive_option
+	: drive_strength
+	  {
+	      YYTRACE("module_or_primitive_option:");
+	      $$ = $1 << 2;
+	  }
+	| delay_or_parameter_value_assignment
+	  {
+	      YYTRACE("module_or_primitive_option: delay");
+
+	      $$ = (int)($1) | LEAST_SB;
+	  }
+	;
+
+delay_or_parameter_value_assignment
+	: '#' YYINUMBER
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay_or_parameter_value_assignment: '#' YYINUMBER");
+	      expr = vl_create_expr(IntExpr, atoi(yytext), (double)0.0,
+				    NIL(void), NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '#' YYRNUMBER
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay_or_parameter_value_assignment: '#' YYRNUMBER");
+	      expr = vl_create_expr(IntExpr, 0, atof(yytext),
+				    NIL(void), NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '#' identifier
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay_or_parameter_value_assignment: '#' identifier");
+	      expr = vl_create_expr(IDExpr, 0, (double)0.0,
+				    $2, NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '#' '(' mintypmax_expression_list ')'
+	  {
+	      YYTRACE("delay_or_parameter_value_assignment: '#' '(' mintypmax_expression_list ')'");
+	      $$ = vl_create_delay(NIL(vl_expr), NIL(vl_expr), (vl_expr*)$3);
+	  }
+	;
+
+module_or_primitive_instance_list
+	: module_or_primitive_instance
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("module_or_primitive_instance_list: module_or_primitive_instance");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| module_or_primitive_instance_list ',' module_or_primitive_instance
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("module_or_primitive_instance_list: module_or_primitive_instance_list ',' module_or_primitive_instance");
+	      lsNewEnd($1, (lsGeneric)$3,  &handle);
+	      $$ = $1;
+	  }
+	;
+
+
+module_or_primitive_instance
+	: '(' module_connection_list ')'
+	  {
+	      YYTRACE("module_or_primitive_instance: '(' module_connection_list ')'");
+	      $$ = (typestructPtr)vl_create_mod_prim_inst(NIL(vl_id_range), $2);
+	  }
+	| identifier '(' module_connection_list ')'
+	  {
+	      YYTRACE("module_or_primitive_instance: '(' module_connection_list ')'");
+	      $$ = (typestructPtr)vl_create_mod_prim_inst($1, $3);
+	  }
+	;
+
+module_connection_list
+	: module_port_connection_list
+	  {
+	      YYTRACE("module_connection_list: module_port_connection_list");
+	  }
+	| named_port_connection_list
+	  {
+	      YYTRACE("module_connection_list: named_port_connection_list");
+	  }
+	;
+
+module_port_connection_list
+	: module_port_connection
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("module_port_connection_list: module_port_connection");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| module_port_connection_list ',' module_port_connection
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("module_port_connection_list: module_port_connection_list ',' module_port_connection");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+named_port_connection_list
+	: named_port_connection
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("named_port_connection_list: named_port_connection");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$<ival>1, &handle);
+	  }
+	| named_port_connection_list ',' named_port_connection
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("named_port_connection_list: named_port_connection_list ',' name_port_connection");
+	      lsNewEnd($1, (lsGeneric)$<ival>3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+module_port_connection
+	:
+	  {
+	      YYTRACE("module_port_connection:");
+	      $$ = vl_create_port_connect(ModuleConnect,
+					  NIL(vl_id_range), NIL(vl_expr));
+	  }
+	| expression
+	  {
+	      YYTRACE("module_port_connection: expression");
+	      $$ = vl_create_port_connect(ModuleConnect, NIL(vl_id_range), $1);
+	  }
+	;
+
+named_port_connection
+	: '.' identifier '(' expression ')'
+	  {
+	      YYTRACE("named_port_connection: '.' identifier '(' expression ')'");
+	      $$ = vl_create_port_connect(NamedConnect, $2, $4);
+	  }
+	;
+
+
+
+initial_statement
+	: YYINITIAL {reserve_type_name=0; timed_statement=0;} statement
+	  {
+	      YYTRACE("initial_statement: YYINITIAL statement");
+	      $$ = vl_create_procstmt(InitialStmt, $3);
+	      reserve_type_name=1;
+	      if (timed_statement) $$->flags |= TimedInitStmt;
+	  }
+	;
+
+always_statement
+	: YYALWAYS {reserve_type_name=0;} statement
+	  {
+	      YYTRACE("always_statement: YYALWAYS statement");
+	      $$ = vl_create_procstmt(AlwaysStmt, $3);
+	      reserve_type_name=1;
+	  }
+	;
+
+statement_opt
+	:
+	  {
+	      YYTRACE("statement_opt:");
+	      $$ = lsCreate();
+	  }
+	| statement
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("statement_opt: statement");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	;
+
+statement_clr
+	:
+	  {
+	      YYTRACE("statement_clr:");
+	      $$ = lsCreate();
+	  }
+	| statement_clr statement
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("statement_clr: statement_clr statement");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+
+statement
+	: ';'
+	  {
+	      YYTRACE("statement: ';'");
+	      $$ = NIL(typestruct);
+	  }
+	| assignment ';'
+	  {
+	      YYTRACE("statement: assignment ';'");
+	  }
+	| YYIF '(' expression ')' statement
+	  {
+	      YYTRACE("statement: YYIF '(' expression ')' statement");
+	      $$ = (typestructPtr)vl_create_if_else_stmt($3, $5, NIL(typestruct));
+	  }
+	| YYIF '(' expression ')' statement YYELSE statement
+	  {
+	      YYTRACE("statement: YYIF '(' expression ')' statement YYELSE statement");
+	      $$ = (typestructPtr)vl_create_if_else_stmt($3, $5, $7);
+	  }
+	| YYCASE '(' expression ')' case_item_eclr YYENDCASE
+	  {
+	      YYTRACE("statement: YYCASE '(' expression ')' case_item_eclr YYENDCASE");
+	      $$ = (typestructPtr)vl_create_case_stmt(CaseStmt, $3, $5);
+	  }
+	| YYCASEZ '(' expression ')' case_item_eclr YYENDCASE
+	  {
+	      YYTRACE("statement: YYCASEZ '(' expression ')' case_item_eclr YYENDCASE");
+	      $$ = (typestructPtr)vl_create_case_stmt(CasezStmt, $3, $5);
+	  }
+	| YYCASEX '(' expression ')' case_item_eclr YYENDCASE
+	  {
+	      YYTRACE("statement: YYCASEX '(' expression ')' case_item_eclr YYENDCASE");
+	      $$ = (typestructPtr)vl_create_case_stmt(CasexStmt, $3, $5);
+	  }
+	| YYFOREVER statement
+	  {
+	      YYTRACE("statement: YYFOREVER statement");
+	      $$ = (typestructPtr)vl_create_forever_stmt($2);
+	  }
+	| YYREPEAT '(' expression ')' statement
+	  {
+	      YYTRACE("statement: YYREPEAT '(' expression ')' statement");
+	      $$ = (typestructPtr)vl_create_repeat_stmt($3, $5);
+	  }
+	| YYWHILE '(' expression ')' statement
+	  {
+	      YYTRACE("statement: YYWHILE '(' expression ')' statement");
+	      $$ = (typestructPtr)vl_create_while_stmt($3, $5);
+	  }
+	| YYFOR '(' assignment ';' expression ';' assignment ')' statement
+	  {
+	      YYTRACE("statement: YYFOR '(' assignment ';' expression ';' assignment ')' statement");
+	      $$ = (typestructPtr)vl_create_for_stmt($3, $5, $7, $9);
+	  }
+	| delay_control statement
+	  {
+	      YYTRACE("statement: delay_control statement");
+	      $$ = (typestructPtr)vl_create_delay_control_stmt($1, $2);
+	  }
+	| event_control statement
+	  {
+	      YYTRACE("statement: event_control statement");
+	      $$ = (typestructPtr)vl_create_event_control_stmt($1, $2);
+	  }
+	| lvalue type_action '=' delay_control expression ';'
+	  {
+	      YYTRACE("statement: lvalue '=' delay_control expression ';'");
+	      $$ = (typestructPtr)vl_create_bassign_stmt(DelayBassignStmt, $1, $4, $5);
+	  }
+	| lvalue type_action '=' event_control expression ';'
+	  {
+	      YYTRACE("statement: lvalue '=' event_control expression ';'");
+	      $$ = (typestructPtr)vl_create_bassign_stmt(EventBassignStmt, $1, $4, $5);
+	  }
+	| lvalue type_action YYNBASSIGN delay_control expression ';'
+	  {
+	      YYTRACE("statement: lvalue YYNBASSIGN delay_control expression ';'");
+	      $$ = (typestructPtr)vl_create_bassign_stmt(DelayNbassignStmt, $1, $4, $5);
+	  }
+	| lvalue type_action YYNBASSIGN event_control expression ';'
+	  {
+	      YYTRACE("statement: lvalue YYNBASSIGN event_control expression ';'");
+	      $$ = (typestructPtr)vl_create_bassign_stmt(EventNbassignStmt, $1, $4, $5);
+	  }
+	| YYWAIT '(' expression ')' statement
+	  {
+	      YYTRACE("statement: YYWAIT '(' expression ')' statement");
+	      $$ = (typestructPtr)vl_create_wait_stmt($3, $5);
+	  }
+	| YYRIGHTARROW name_of_event ';'
+	  {
+	      YYTRACE("statement: YYRIGHTARROW name_of_event ';'");
+	      $$ = (typestructPtr)vl_create_send_event_stmt($2);
+	  }
+	| seq_block
+	  {
+	      YYTRACE("statement: seq_block");
+	  }
+	| par_block
+	  {
+	      YYTRACE("statement: par_block");
+	  }
+	| task_enable
+	  {
+	      YYTRACE("statement: task_enable");
+	  }
+	| system_task_enable
+	  {
+	      YYTRACE("statement: system_task_enable");
+	      TODO("statement: system_task_enable");
+	      $$ = NIL(typestruct);
+	  }
+	| YYDISABLE YYIDE
+	  {
+	      $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	  ';'
+	  {
+	      YYTRACE("statement: YYDISABLE YYIDE ';'");
+	      $$ = (typestructPtr)vl_create_disable_stmt($<idrng>3);
+	  }
+	| YYASSIGN assignment ';'
+	  {
+	      YYTRACE("statement: YYASSIGN assignment ';'");
+	      $2->type = AssignStmt;
+	      $$ = (typestructPtr)$2;
+	  }
+	| YYDEASSIGN lvalue ';'
+	  {
+	      YYTRACE("statement: YYDEASSIGN lvalue ';'");
+	      $$ = (typestructPtr)vl_create_deassign_stmt($2);
+	  }
+	;
+
+assignment
+	: lvalue type_action '=' expression
+	  {
+	      YYTRACE("assignment: lvalue '=' expression");
+	      associate_symbolic_value($1, $4);
+	      $$ = vl_create_bassign_stmt(BassignStmt, $1, NIL(void), $4);
+	      if (c_assign && $1->type != ConcatExpr) {
+		  vl_id_range *id_sym;
+		  if (!st_lookup(vl_currentModule->sig_st, $1->name->name, (char**)&id_sym))
+		      compile_error("continuous assignment to undeclared var");
+		  id_sym->flags |= WireVar;
+	      }
+	      pop_stack(vl_cur_type_stack, (void **) &aux_st);
+	  }
+	| lvalue type_action YYNBASSIGN expression
+	  {
+	      YYTRACE("assignment: lvalue YYNBASSIGN expression");
+	      associate_symbolic_value($1, $4);
+	      $$ = vl_create_bassign_stmt(NbassignStmt, $1, NIL(void), $4);
+	      if (c_assign && $1->type != ConcatExpr) {
+		  vl_id_range *id_sym;
+		  if (!st_lookup(vl_currentModule->sig_st, $1->name->name, (char**)&id_sym))
+		    compile_error("non-blocking assignment to undeclared var");
+		  id_sym->flags |= WireVar;
+	      }
+	      pop_stack(vl_cur_type_stack, (void **) &aux_st);
+	  }
+	;
+
+type_action
+	:
+	  {
+	      vl_id_range *id_sym;
+
+	      if ($<lval>0->type != ConcatExpr) {
+		  push_stack(vl_cur_type_stack, aux_st);
+
+		  if (st_lookup(vl_currentModule->sig_st,
+				$<lval>0->name->name, &id_sym))
+		      if (id_sym->id_type)
+			  aux_st =
+			    id_sym->id_type->specifier->u.enum_type->domain_st;
+		      else
+			  aux_st = NIL(st_table);
+		  else
+		      aux_st = NIL(st_table);
+	      }
+	  }
+	;
+
+type_action_expr
+	:
+	  { /* Partial patch: b = (v1 == a) ? v1 : v2, where v1 and v2
+	     * are enumerated values still compiled incorrectly. */
+	      vl_id_range *id_sym;
+
+	      if ($<expr>-1->type != ConcatExpr) {
+		  push_stack(vl_cur_type_stack, aux_st);
+		  if ($<expr>-1->type == IDExpr) {
+		      if (st_lookup(vl_currentModule->sig_st,
+				    $<expr>-1->u.name->name, &id_sym))
+			  if (id_sym->id_type)
+			      aux_st =
+				  id_sym->id_type->specifier->u.enum_type->domain_st;
+			  else
+			      aux_st = NIL(st_table);
+		      else
+			  aux_st = NIL(st_table);
+		  }
+		  else
+		      aux_st = NIL(st_table);
+	      }
+	  }
+	;
+
+case_item_eclr
+	: case_item
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("case_item_eclr: case_item");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| case_item_eclr case_item
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("case_item_eclr: case_item_eclr case_item");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+case_item
+	: expression_list ':' statement
+	  {
+	      YYTRACE("case_item: expression_list ':' statement");
+	      $$ = vl_create_case_item(CaseItem, $1, $3);
+	  }
+	| YYDEFAULT ':' statement
+	  {
+	      YYTRACE("case_item: YYDEFAULT ':' statement");
+	      $$ = vl_create_case_item(DefaultItem, (lsList)0, $3);
+	  }
+	| YYDEFAULT statement
+	  {
+	      YYTRACE("case_item: YYDEFAULT statement");
+	      $$ = vl_create_case_item(DefaultItem, (lsList)0, $2);
+	  }
+	;
+
+seq_block
+	: YYBEGIN statement_clr YYEND
+	  {
+	      YYTRACE("seq_block: YYBEGIN statement_clr YYEND");
+	      $$ = vl_create_begin_end_stmt(NIL(vl_id_range), LS_NH, $2);
+	  }
+	| YYBEGIN ':' name_of_block block_declaration_clr statement_clr YYEND
+	  {
+	      YYTRACE("seq_block: YYBEGIN ':' name_of_block block_declaration_clr statement_clr YYEND");
+	      $$ = vl_create_begin_end_stmt($3, $4, $5);
+	  }
+	;
+
+par_block
+	: YYFORK statement_clr YYJOIN
+	  {
+	      YYTRACE("par_block: YYFORK statement_clr YYJOIN");
+	      $$ = vl_create_fork_join_stmt(NIL(vl_id_range), LS_NH, $2);
+	      TODO("fork/join : dynamic process control");
+	  }
+	| YYFORK ':' name_of_block block_declaration_clr statement_clr YYJOIN
+	  {
+	      YYTRACE("par_block: YYFORK ':' name_of_block block_declaration_clr statement_clr YYJOIN");
+	      $$ = vl_create_fork_join_stmt($3, $4, $5);
+	      TODO("fork/join : dynamic process control");
+	  }
+	;
+
+name_of_block
+	: YYIDE
+	  {
+	      YYTRACE("name_of_block: YYIDE");
+	      $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	;
+
+block_declaration_clr
+	:
+	  {
+	      YYTRACE("block_declaration_clr:");
+	      $$ = lsCreate();
+	  }
+	| block_declaration_clr block_declaration
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("block_declaration_clr: block_declaration_clr block_declaration");
+	      lsNewEnd($1, (lsGeneric)$2, &handle);
+	      $$ = $1;
+	  }
+	;
+
+block_declaration
+	: parameter_declaration
+	  {
+	      YYTRACE("block_declaration: parameter_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| reg_declaration
+	  {
+	      YYTRACE("block_declaration: reg_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| integer_declaration
+	  {
+	      YYTRACE("block_declaration: integer_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| real_declaration
+	  {
+	      YYTRACE("block_declaration: real_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| time_declaration
+	  {
+	      YYTRACE("block_delcaration: time_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	| event_declaration
+	  {
+	      YYTRACE("block_declaration: event_declaration");
+	      $$ = (typestructPtr)$1;
+	  }
+	;
+
+
+task_enable
+	: YYIDE
+	  {
+	      $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	  ';'
+	  {
+	      YYTRACE("task_enable: YYIDE ';'");
+	      $$ = vl_create_task_enable_stmt(TaskEnableStmt, $<idrng>2, (lsList)0);
+	  }
+	| YYIDE
+	  {
+	      $<idrng>$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	 '(' expression_list ')' ';'
+	  {
+	      YYTRACE("task_enable: YYIDE '(' expression_list ')' ';'");
+	      $$ = vl_create_task_enable_stmt(TaskEnableStmt, $<idrng>2, $4);
+	  }
+	;
+
+system_task_enable
+	: name_of_system_task ';'
+	  {
+	      YYTRACE("system_task_enable: name_of_system_task ';'");
+	  }
+	| name_of_system_task '(' expression_list ')' ';'
+	  {
+	      YYTRACE("system_task_enable: name_of_system_task '(' expression_list ')'");
+	  }
+	;
+
+name_of_system_task
+	: system_identifier
+	  {
+	      YYTRACE("name_of_system_task: system_identifier");
+	  }
+	;
+
+
+
+specify_block
+	: YYSPECIFY specify_item_clr YYENDSPECIFY
+	  {
+	      YYTRACE("specify_block: YYSPECIFY specify_item_clr YYENDSPECIFY");
+	      TODO("specify_block: YYSPECIFY specify_item_clr YYENDSPECIFY");
+	  }
+	;
+
+specify_item_clr
+	:
+	| specify_item_clr specify_item
+	;
+
+specify_item
+	: specparam_declaration
+	| path_declaration
+	| level_sensitive_path_declaration
+	| edge_sensitive_path_declaration
+	| system_timing_check
+	;
+
+specparam_declaration
+	: YYSPECPARAM assignment_list ';'
+	;
+
+path_declaration
+	: path_description '=' path_delay_value ';'
+	;
+
+
+
+path_description
+	: '(' specify_terminal_descriptor YYLEADTO specify_terminal_descriptor ')'
+	| '(' path_list YYALLPATH path_list_or_edge_sensitive_path_list ')'
+	;
+
+path_list
+	: specify_terminal_descriptor
+	| path_list ',' specify_terminal_descriptor
+	;
+
+specify_terminal_descriptor
+	: YYIDE
+	| YYIDE '[' expression ']'
+	| YYIDE '[' expression ';' expression ']'
+	;
+
+path_list_or_edge_sensitive_path_list
+	: path_list
+	| '(' path_list ',' specify_terminal_descriptor
+	      polarity_operator YYCONDITIONAL
+	      expression ')'
+	;
+
+path_delay_value
+	: path_delay_expression
+	| '(' path_delay_expression ',' path_delay_expression ')'
+	| '(' path_delay_expression ',' path_delay_expression ','
+	      path_delay_expression ')'
+	| '(' path_delay_expression ',' path_delay_expression ','
+	      path_delay_expression ',' path_delay_expression ','
+	      path_delay_expression ',' path_delay_expression ')'
+	;
+
+path_delay_expression
+	: expression
+	  {
+	  }
+	;
+
+system_timing_check
+	: YYsysSETUP '(' ')' ';'
+	;
+
+level_sensitive_path_declaration
+	: YYIF '(' expression ')'
+	    '(' specify_terminal_descriptor polarity_operator_opt YYLEADTO
+		spec_terminal_desptr_or_edge_sensitive_spec_terminal_desptr
+	| YYIF '(' expression ')'
+	    '(' path_list ',' specify_terminal_descriptor
+		polarity_operator_opt YYALLPATH path_list ')'
+		path_list '=' path_delay_value ';'
+	;
+
+spec_terminal_desptr_or_edge_sensitive_spec_terminal_desptr
+	: specify_terminal_descriptor ')' path_list '=' path_delay_value ';'
+	| '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL
+	      expression ')' ')' '=' path_delay_value ';'
+	;
+
+polarity_operator_opt
+	:
+	| polarity_operator
+	;
+
+polarity_operator
+	: '+'
+	| '-'
+	;
+
+edge_sensitive_path_declaration
+	: '(' specify_terminal_descriptor YYLEADTO
+	    '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL
+		expression ')' ')' '=' path_delay_value ';'
+	| '(' edge_identifier specify_terminal_descriptor YYLEADTO
+	    '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL
+		expression ')' ')' '=' path_delay_value ';'
+	| '(' edge_identifier specify_terminal_descriptor YYALLPATH
+	    '(' path_list ',' specify_terminal_descriptor
+		polarity_operator YYCONDITIONAL
+		expression ')' ')' '=' path_delay_value ';'
+	| YYIF '(' expression ')'
+	    '(' specify_terminal_descriptor YYALLPATH
+	      '(' path_list ',' specify_terminal_descriptor
+		  polarity_operator YYCONDITIONAL
+		  expression ')' ')' '=' path_delay_value ';'
+	| YYIF '(' expression ')'
+	    '(' edge_identifier specify_terminal_descriptor YYLEADTO
+	      '(' specify_terminal_descriptor polarity_operator YYCONDITIONAL
+		  expression ')' ')' '=' path_delay_value ';'
+	| YYIF '(' expression ')'
+	    '(' edge_identifier specify_terminal_descriptor YYALLPATH
+	      '(' path_list ',' specify_terminal_descriptor
+		  polarity_operator YYCONDITIONAL
+		  expression ')' ')' '=' path_delay_value ';'
+	;
+
+edge_identifier
+	: YYPOSEDGE
+	| YYNEGEDGE
+	;
+
+
+
+lvalue
+	: identifier
+	  {
+	      YYTRACE("lvalue: YYIDE");
+	      $$ = vl_create_lval(IDExpr, $1,
+				  NIL(vl_range), (lsList)0);
+	  }
+	| identifier '[' expression ']'
+	  {
+	      YYTRACE("lvalue: YYIDE '[' expression ']'");
+	      $$ = vl_create_lval(BitSelExpr, $1,
+				  vl_create_range($3, NIL(vl_expr)),
+				  (lsList)0);
+	  }
+	| identifier '[' expression ':' expression ']'
+	  {
+	      YYTRACE("lvalue: YYIDE'[' expression ':' expression ']'");
+	      $$ = vl_create_lval(PartSelExpr, $1,
+				  vl_create_range($3, $5), (lsList)0);
+	  }
+	| concatenation
+	  {
+	      YYTRACE("lvalue: concatenation");
+	      $$ = vl_create_lval(ConcatExpr, NIL(vl_id_range), NIL(vl_range), $1);
+	  }
+	;
+
+mintypmax_expression_list
+	: mintypmax_expression
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("mintypmax_expression_list: mintypmax_expression");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| mintypmax_expression_list ',' mintypmax_expression
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("mintypmax_expression_list: mintypmax_expression_list ',' mintypmax_expression");
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+mintypmax_expression
+	: expression
+	  {
+	      YYTRACE("mintypmax_expression: expression");
+	      $$ = vl_create_expr(MinTypMaxExpr, 0, (double)0.0,
+				  $1, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| expression ':' expression
+	  {
+	      YYTRACE("mintypmax_expression: expression ':' expression");
+	      $$ = vl_create_expr(MinTypMaxExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression ':' expression ':' expression
+	  {
+	      YYTRACE("mintypmax_expression: expression ':' expression ':' expression");
+	      $$ = vl_create_expr(MinTypMaxExpr, 0, (double)0.0,
+				  $1, $3, $5);
+	  }
+	;
+
+expression_list
+	: expression
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("expression_list: expression");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, &handle);
+	  }
+	| expression_list ',' expression
+	  {
+	      lsHandle handle;
+
+	      YYTRACE("expression_list: expression_list ',' expression");
+	      $$ = lsCreate();
+	      lsNewEnd($1, (lsGeneric)$3, &handle);
+	      $$ = $1;
+	  }
+	;
+
+expression
+	: primary
+	  {
+	      YYTRACE("expression: primary");
+	  }
+	| '+' primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: '+' primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UplusExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '-' primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: '-' primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UminusExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+
+	  }
+	| '!' primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: '!' primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UnotExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+
+	  }
+	| '~' primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: '~' primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UcomplExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '&' primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: '&' primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UandExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '|' primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: '|' primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UorExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '^' primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: '^' primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UxorExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| YYLOGNAND primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: YYLOGNAND primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UnandExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| YYLOGNOR primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: YYLOGNOR primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UnorExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| YYLOGXNOR primary %prec YYUNARYOPERATOR
+	  {
+	      YYTRACE("expression: YYLOGXNOR primary %prec YYUNARYOPERATOR");
+	      $$ = vl_create_expr(UxnorExpr, 0, (double)0.0,
+				  $2, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| expression '+' expression
+	  {
+	      YYTRACE("expression: expression '+' expression");
+	      $$ = vl_create_expr(BplusExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '-' expression
+	  {
+	      YYTRACE("expression: expressio '-' expression");
+	      $$ = vl_create_expr(BminusExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '*' expression
+	  {
+	      YYTRACE("expression: expression '*' expression");
+	      $$ = vl_create_expr(BtimesExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '/' expression
+	  {
+	      YYTRACE("expression: expression '/' expression");
+	      $$ = vl_create_expr(BdivExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '%' expression
+	  {
+	      YYTRACE("expression: expression '%' expression");
+	      $$ = vl_create_expr(BremExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYLOGEQUALITY type_action_expr expression
+	  {
+	      YYTRACE("expression: expression YYLOGEQUALITY expression");
+	      $$ = vl_create_expr(Beq2Expr, 0, (double)0.0,
+				  $1, $4, NIL(vl_expr));
+	      pop_stack(vl_cur_type_stack, (void **) &aux_st);
+	  }
+	| expression YYLOGINEQUALITY type_action_expr expression
+	  {
+	      YYTRACE("expression: expression YYLOGINEQUALITY expression");
+	      $$ = vl_create_expr(Bneq2Expr, 0, (double)0.0,
+				  $1, $4, NIL(vl_expr));
+	      pop_stack(vl_cur_type_stack, (void **) &aux_st);
+	  }
+	| expression YYCASEEQUALITY type_action_expr expression
+	  {
+	      YYTRACE("expression: expression YYCASEEQUALITY expression");
+	      $$ = vl_create_expr(Beq3Expr, 0, (double)0.0,
+				  $1, $4, NIL(vl_expr));
+	      pop_stack(vl_cur_type_stack, (void **) &aux_st);
+	  }
+	| expression YYCASEINEQUALITY type_action_expr expression
+	  {
+	      YYTRACE("expression: expression YYCASEINEQUALITY expression");
+	      $$ = vl_create_expr(Bneq3Expr, 0, (double)0.0,
+				  $1, $4, NIL(vl_expr));
+	      pop_stack(vl_cur_type_stack, (void **) &aux_st);
+	  }
+	| expression YYLOGAND expression
+	  {
+	      YYTRACE("expression: expression YYLOGAND expression");
+	      $$ = vl_create_expr(BlandExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYLOGOR expression
+	  {
+	      YYTRACE("expression: expression YYLOGOR expression");
+	      $$ = vl_create_expr(BlorExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '<' expression
+	  {
+	      YYTRACE("expression: expression '<' expression");
+	      $$ = vl_create_expr(BltExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '>' expression
+	  {
+	      YYTRACE("expression: expression '>' expression");
+	      $$ = vl_create_expr(BgtExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '&' expression
+	  {
+	      YYTRACE("expression: expression '&' expression");
+	      $$ = vl_create_expr(BandExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '|' expression
+	  {
+	      YYTRACE("expression: expression '|' expression");
+	      $$ = vl_create_expr(BorExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '^' expression
+	  {
+	      YYTRACE("expression: expression '^' expression");
+	      $$ = vl_create_expr(BxorExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYLEQ expression
+	  {
+	      YYTRACE("expression: expression YYLEQ expression");
+	      $$ = vl_create_expr(BleExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYNBASSIGN expression
+	  {
+	      YYTRACE("expression: expression YYLEQ expression");
+	      $$ = vl_create_expr(BleExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYGEQ expression
+	  {
+	      YYTRACE("expression: expression YYGEQ expression");
+	      $$ = vl_create_expr(BgeExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYLSHIFT expression
+	  {
+	      YYTRACE("expression: expression YYLSHIFT expression");
+	      $$ = vl_create_expr(BlshiftExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYRSHIFT expression
+	  {
+	      YYTRACE("expression: expression YYRSHIFT expression");
+	      $$ = vl_create_expr(BrshiftExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression YYLOGXNOR expression
+	  {
+	      YYTRACE("expression: expression YYLOGXNOR expression");
+	      $$ = vl_create_expr(BxnorExpr, 0, (double)0.0,
+				  $1, $3, NIL(vl_expr));
+	  }
+	| expression '?' expression ':' expression
+	  {
+	      YYTRACE("expression: expression '?' expression ':' expression");
+	      $$ = vl_create_expr(TcondExpr, 0, (double)0.0,
+				  $1, $3, $5);
+	  }
+	| YYSTRING
+	  {
+	      YYTRACE("expression: YYSTRING");
+	      $$ = vl_create_expr(StringExpr, 0, (double)0.0,
+				  vlStrdup(yytext), NIL(vl_expr), NIL(vl_expr));
+	      TODO("<string> is not supported in generated FSMs");
+	  }
+	;
+
+primary
+	: YYINUMBER
+	  {
+	      YYTRACE("primary: YYINUMBER");
+	      if (strchr(yytext, '\'')) {
+		  $$ = vl_create_expr(BitExpr, 0, (double)0.0,
+			   (void*)bexp1, (void*)bexp0, (void*)vlStrdup(brep));
+	      } else {
+		  $$ = vl_create_expr(IntExpr, atoi(yytext), (double)0.0,
+				      NIL(vl_expr), NIL(vl_expr), NIL(vl_expr));
+	      }
+	  }
+	| YYRNUMBER
+	  {
+	      YYTRACE("primary: YYRNUMBER");
+	      $$ = vl_create_expr(RealExpr, 0, atof(yytext),
+				  NIL(vl_expr), NIL(vl_expr), NIL(vl_expr));
+	  }
+	| identifier
+	  {
+	      YYTRACE("primary: identifier");
+	      $$ = vl_create_expr(IDExpr, 0, (double)0.0,
+				  $1, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| identifier '[' expression ']'
+	  {
+	      YYTRACE("primary: identifier '[' expression ']'");
+	      $$ = vl_create_expr(BitSelExpr, 0, (double)0.0,
+				  vl_create_id_range($1->name,
+				    vl_create_range($3, NIL(vl_expr))),
+				  NIL(vl_expr), NIL(vl_expr));
+	  }
+	| identifier '[' expression ':'  expression ']'
+	  {
+	      YYTRACE("primary: identifier '[' expression ':' expression ']'");
+	      $$ = vl_create_expr(BitSelExpr, 0, (double)0.0,
+				  vl_create_id_range($1->name,
+				    vl_create_range($3, $5)),
+				  NIL(vl_expr), NIL(vl_expr));
+	  }
+	| concatenation
+	  {
+	      YYTRACE("primary: concatenation");
+	      $$ = vl_create_expr(ConcatExpr, 0, (double)0.0,
+				  $1, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| multiple_concatenation
+	  {
+	      YYTRACE("primary: multiple_concatenatin");
+	      $$ = vl_create_expr(ConcatExpr, 0, (double)0.0,
+				  $1->concat, $1->rep, NIL(vl_expr));
+	      vl_chk_free((char*)$1);
+	  }
+	| function_call
+	  {
+	      YYTRACE("primary: function_call");
+	  }
+	| '(' mintypmax_expression ')'
+	  {
+	      YYTRACE("primary: '(' mintypmax_expression ')'");
+	      $$ = $2;
+	  }
+
+	| YYsysID '(' nondeterminism_list ')'
+	  {
+	      YYTRACE("primary: YYsysID '(' nondeterminism_list ')'");
+	      TODO("System task (\"$sys-task(...)\")");
+	  }
+	| YYsysND '(' nondeterminism_list ')'
+	  {
+	      $$ = vl_create_expr(NondExpr, 0, (double)0.0,
+				  $3, NIL(vl_expr), NIL(vl_expr));
+	      if ($$ == NIL(vl_expr))
+		  yyerror("unsynchronized nondeterministic wire");
+	  }
+	;
+
+nondeterminism_list
+	: event_control
+	  {
+	      YYTRACE("nondeterminism_list : event_control");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, 0);
+	  }
+	| expression
+	  {
+	      YYTRACE("nondeterminism_list : expression");
+	      $$ = lsCreate();
+	      lsNewEnd($$, (lsGeneric)$1, 0);
+	  }
+	| nondeterminism_list ',' event_control
+	  {
+	      YYTRACE("nondeterminism_list : nondeterminism_list ',' event_control");
+	      lsNewEnd($$, (lsGeneric)$3, 0);
+	  }
+	| nondeterminism_list ',' expression
+	  {
+	      YYTRACE("nondeterminism_list : nondeterminism_list ',' expression");
+	      lsNewEnd($$, (lsGeneric)$3, 0);
+	  }
+	;
+
+
+
+concatenation
+	: '{' expression_list '}'
+	  {
+	      YYTRACE("concatenation: '{' expression_list '}'");
+	      $$ = $2;
+	  }
+	;
+
+multiple_concatenation
+	: '{' expression '{' expression_list '}' '}'
+	    {
+		YYTRACE("multiple_concatenation: '{' expression '{' expression_list '}' '}'");
+		$$ = vl_create_mconcat($2,$4);
+	    }
+	;
+
+function_call
+	: identifier '(' expression_list ')'
+	  {
+	      YYTRACE("function_call: identifier '(' expression_list ')'");
+	      $$ = vl_create_expr(FuncExpr, 0, (double)0.0,
+				  $1, $3, NIL(void));
+	  }
+
+	;
+
+system_identifier
+	: YYsysID
+	;
+
+
+
+identifier
+	: YYIDE
+	  {
+	      YYTRACE("identifier: YYIDE");
+	      $$ = vl_create_id_range(vlStrdup(yyid), NIL(vl_range));
+	  }
+	| identifier '.' YYIDE
+	  {
+	      YYTRACE("identifier: identifier '.' YYIDE");
+	      TODO("identifier: identifier '.' YYIDE --> cross hierarchy access");
+	  }
+	;
+
+delay_opt
+	:
+	  {
+	      YYTRACE("delay_opt:");
+	      $$ = NIL(vl_delay);
+	  }
+	| delay
+	  {
+	      YYTRACE("delay_opt: delay");
+	  }
+	;
+
+delay
+	: '#' YYINUMBER
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay: '#' YYINUMBER");
+	      expr = vl_create_expr(IntExpr, atoi(yytext), (double)0.0,
+				    NIL(void), NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '#' YYRNUMBER
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay: '#' YYRNUMBER");
+	      expr = vl_create_expr(IntExpr, 0, atof(yytext),
+				    NIL(void), NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '#' identifier
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay: '#' identifier");
+	      expr = vl_create_expr(IDExpr, 0, (double)0.0,
+				    $2, NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '#' '(' mintypmax_expression ')'
+	  {
+	      YYTRACE("delay: '#' '(' mintypmax_expression ')'");
+	      $$ = vl_create_delay($3, NIL(vl_expr), NIL(vl_expr));
+	  }
+	| '#' '(' mintypmax_expression ',' mintypmax_expression ')'
+	  {
+	      YYTRACE("delay: '#' '(' mintypmax_expression ',' mintypmax_expression ')'");
+	      $$ = vl_create_delay($3, $5, NIL(vl_expr));
+	  }
+	| '#' '(' mintypmax_expression ',' mintypmax_expression ','
+		  mintypmax_expression ')'
+	  {
+	      YYTRACE("delay: '#' '(' mintypmax_expression ',' mintypmax_expression ',' mintypmax_expression ')'");
+	      $$ = vl_create_delay($3, $5, $7);
+	  }
+	;
+
+delay_control
+	: '#' YYINUMBER
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay_control: '#' YYINUMBER");
+	      expr = vl_create_expr(IntExpr, atoi(yytext), (double)0.0,
+				    NIL(void), NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	      timed_statement = 1;
+	  }
+	| '#' YYRNUMBER
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay_control: '#' YYRNUMBER");
+	      expr = vl_create_expr(RealExpr, 0, atof(yytext),
+				    NIL(void), NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	      timed_statement = 1;
+	  }
+	| '#' identifier
+	  {
+	      vl_expr *expr;
+
+	      YYTRACE("delay_control: '#' identifier");
+	      expr = vl_create_expr(IDExpr, 0, (double)0.0,
+				    $2, NIL(void), NIL(void));
+	      $$ = vl_create_delay(expr, NIL(vl_expr), NIL(vl_expr));
+	      timed_statement = 1;
+	  }
+	| '#' '(' mintypmax_expression_list ')'
+	  {
+	      YYTRACE("delay_control: '#' '(' mintypmax_expression ')'");
+	      $$ = vl_create_delay((vl_expr*)$3, NIL(vl_expr), (vl_expr*)$3);
+	      timed_statement = 1;
+	  }
+	;
+
+event_control
+	: '@' identifier
+	  {
+	      vl_exprPtr expr;
+
+	      YYTRACE("event_control: '@' identifier");
+	      expr = vl_create_expr(IDExpr, 0, (double)0.0,
+				    $2, NIL(vl_expr), NIL(vl_expr));
+	      $$ = vl_create_event_expr(EventExpr, expr);
+	      timed_statement = 1;
+	  }
+	| '@' '(' event_expression ')'
+	  {
+	      YYTRACE("event_control: '@' '(' event_expression ')'");
+	      $$ = $3;
+	      timed_statement = 1;
+	  }
+	| '@' '(' ored_event_expression ')'
+	  {
+	      YYTRACE("event_control: '@' '(' ored_event_expression ')'");
+	      $$ = $3;
+	      timed_statement = 1;
+	  }
+	;
+
+
+event_expression
+	: expression
+	  {
+	      YYTRACE("event_expression: expression");
+	      $$ = vl_create_event_expr(EventExpr, $1);
+	  }
+	| YYPOSEDGE expression
+	  {
+	      YYTRACE("event_expression: YYPOSEDGE expression");
+	      $$ = vl_create_event_expr(PosedgeEventExpr, $2);
+	  }
+	| YYNEGEDGE expression
+	  {
+	      YYTRACE("event_expression: YYNEGEDGE expression");
+	      $$ = vl_create_event_expr(NegedgeEventExpr, $2);
+	  }
+	| YYEDGE expression
+	  {
+	      YYTRACE("event_expression: YYEDGE expression");
+	      $$ = vl_create_event_expr(EdgeEventExpr, $2);
+	  }
+	;
+
+ored_event_expression
+	: event_expression YYOR event_expression
+	  {
+	      lsList event_list;
+	      YYTRACE("ored_event_expression: event_expression YYOR event_expression");
+	      event_list = lsCreate();
+	      lsNewEnd(event_list, (lsGeneric)$1, LS_NH);
+	      lsNewEnd(event_list, (lsGeneric)$3, LS_NH);
+	      $$ = vl_create_event_expr(OrEventExpr, NIL(vl_expr));
+	      $$->list = event_list;
+	  }
+	| ored_event_expression YYOR event_expression
+	  {
+	      YYTRACE("ored_event_expression: ored_event_expression YYOR event_expression");
+	      lsNewEnd($1->list, (lsGeneric)$3, LS_NH);
+	      $$ = $1;
+	  }
+	;
+
+%%
+
+void yyerror(str)
+char *str;
+{
+    fprintf(stderr, "%s : (line:%d;file:%s) token :'%s', ",
+	    str, yylineno, vl_filename,
+#ifndef _snake
+	    (yytypetoken[0])?yytypetoken:yytext
+#else
+	    (yytypetoken[0])?yytypetoken:(char*)yytext
+#endif
+);
+    fprintf(stderr, "yacc token : '%s'\n", yytext);
+    if (vl_currentModule)
+	fprintf(stderr, "unexpected token '%s' seen in module '%s'\n",
+#ifndef _snake
+		(yytypetoken[0])?yytypetoken:yytext,
+#else
+		(yytypetoken[0])?yytypetoken:(char*)yytext,
+#endif
+		vl_currentModule->name->name);
+    exit (1);
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_clock.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_clock.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_clock.c	(revision 18)
@@ -0,0 +1,66 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_clock.c,v 1.2 2009/03/09 20:25:57 fabio Exp $
+
+
+*/
+
+#include "util.h"
+#include "st.h"
+#include "list.h"
+#include "array.h"
+#include "set.h"
+#include "stack.h"
+#include "graph.h"
+#include "vl_defs.h"
+#include "vl_types.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_fg_types.h"
+#include "vl_flowgraph.h"
+#include "vl_create.h"
+#include "vl_write_util.h"
+#include "verilog.h"
+
+extern vl_desc *mod_list;
+
+
+void register_vl2mv_synClock(char *cname, int edge, int pi, float rho)
+{
+    vl_synClock *synclock;
+    char buf[MAXSTRLEN];
+
+    if (edge > 1 || edge < 1 || pi < 0 || rho < 0.0) {
+	sprintf(buf, "invalid VL2MVClock spec.: name=%s edge=%d pi=%d rho=%f",
+		cname, edge, pi, rho);
+	compile_error(buf);
+    }
+
+    synclock = (vl_synClock*)chk_malloc(sizeof(vl_synClock));
+    synclock->name = vlStrdup(cname);
+    synclock->edge = edge;
+    synclock->pi   = pi;
+    synclock->rho  = rho;
+
+    if (mod_list)
+	st_insert(mod_list->synclock_st, vlStrdup(cname),
+		  (char*)synclock);
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_copy.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_copy.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_copy.c	(revision 18)
@@ -0,0 +1,1526 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_copy.c,v 1.4 2009/03/09 20:25:57 fabio Exp $
+
+
+*/
+
+
+#include "util.h"
+#include "st.h"
+#include "list.h"
+#include "array.h"
+#include "set.h"
+#include "stack.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_create.h"
+#include "vl_copy.h"
+#include "vl_traverse.h"
+#include "dataflow.h"
+#include "verilog.h"
+
+extern vl_desc *mod_list;
+static int    CpyTrace=0;
+static vl_module *creatingModule;
+
+EXTERN void vl_fprintf_stmt(FILE* file, ...);
+
+vl_module *vl_copy_rename_module(vl_module *mod, char *new_name)
+{
+    vl_module *retval;
+    vl_id_range *new_id;
+
+    if (mod == NULL) return NIL(vl_module);
+
+    ASSERT(mod->type==ModDecl, "Expecting ModDecl");
+
+    CpyTRACE("copying module\n");
+    new_id = vl_copy_id_range(mod->name);
+    vl_chk_free(new_id->name);
+    new_id->name = vlStrdup(new_name);
+    retval = vl_create_module(new_id, vl_copy_ports(mod->ports), (lsList)0);
+    creatingModule = retval;
+    retval->mod_items = vl_copy_mod_item_list(mod->mod_items);
+    retval->type = mod->type;
+
+    return retval;
+}
+
+vl_module *vl_copy_module(vl_module *mod)
+{
+    vl_module *retval;
+
+    if (mod == NULL) return NIL(vl_module);
+
+    ASSERT(mod->type==ModDecl, "Expecting ModDecl");
+
+    CpyTRACE("copying module\n");
+    retval = vl_create_module(vl_copy_id_range(mod->name),
+			      vl_copy_ports(mod->ports), (lsList)0);
+    creatingModule = retval;
+    retval->mod_items = vl_copy_mod_item_list(mod->mod_items);
+    retval->type = mod->type;
+
+    return retval;
+}
+
+
+vl_primitive *vl_copy_primitive(vl_primitive *prim)
+{
+    vl_primitive *retval;
+
+    if (prim == NULL) return NIL(vl_primitive);
+
+    ASSERT((prim->type==CombPrimDecl || prim->type==SeqPrimDecl),
+	   "Expecting PrimDecl");
+
+    CpyTRACE("copying primitive\n");
+    retval = vl_create_primitive(vl_copy_id_range(prim->name),
+				 vl_copy_ports(prim->ports),
+				 vl_copy_mod_item_list(prim->decls),
+				 vl_copy_prim_table(prim->type,prim->entries));
+    retval->type = prim->type;
+
+    return retval;
+}
+
+
+lsList vl_copy_prim_table(short type, lsList entries)
+{
+    vl_prim_entry *e, *entry;
+    int i;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    retval = lsCreate();
+
+    if (entries == NULL) return retval;
+
+    CpyTRACE("copying primitive table\n");
+    for(gen = lsStart(entries); lsNext(gen, (lsGeneric*)&e, &handle)
+				    != LS_NOMORE; ) {
+	entry = (vl_prim_entry*)chk_malloc(sizeof(vl_prim_entry));
+	for (i=0; i<10; i++) {
+	    if (type) type = type;
+	    entry->inputs[i] = e->inputs[i];
+	}
+	entry->state = e->state;
+	entry->next_state = e->next_state;
+	lsNewEnd(retval, (lsGeneric)entry, 0);
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+
+vl_decl *vl_copy_basicdecl(vl_decl *decl)
+{
+    vl_decl *retval;
+
+    CpyTRACE("copying Basic decl\n");
+
+    retval = (vl_decl*)chk_malloc(sizeof(vl_decl));
+    retval->type = decl->type;
+    switch(decl->type) {
+    case RealDecl:
+	retval->ids = vl_copy_id_list(decl->ids);
+	break;
+    case EventDecl:
+	retval->ids = vl_copy_id_list(decl->ids);
+	break;
+    case IntDecl:
+	retval->ids = vl_copy_id_range_list(decl->ids);
+	break;
+    case TimeDecl:
+	retval->ids = vl_copy_id_range_list(decl->ids);
+	break;
+    default:
+	internal_error("Unexpected Basic Decl type");	break;
+    }
+
+    return retval;
+}
+
+
+vl_rangedecl *vl_copy_rangedecl(vl_rangedecl *decl)
+{
+    vl_rangedecl *retval;
+    vl_module *orig_module;
+
+    CpyTRACE("copying Range decl\n");
+
+    switch(decl->type) {
+    case InputDecl:  break;
+    case OutputDecl: break;
+    case InoutDecl:  break;
+    case RegDecl:    break;
+    default: internal_error("Unexpected Range Decl");	break;
+    }
+
+
+    orig_module = vl_currentModule;
+    vl_currentModule = creatingModule;
+    retval = vl_create_rangedecl(NIL(vl_type), decl->type,
+				 vl_copy_range(decl->range),
+				 vl_copy_id_list(decl->ids), 0);
+    vl_currentModule = orig_module;
+
+
+
+    return retval;
+}
+
+vl_paramdecl *vl_copy_paramdecl(vl_paramdecl *decl)
+{
+    vl_module *orig_module;
+    vl_paramdecl *retval, *old_paramdecl;
+
+    CpyTRACE("Printing Parameter decl\n");
+
+    retval = (vl_paramdecl*)chk_malloc(sizeof(vl_paramdecl));
+    retval->type = decl->type;
+    switch(decl->type) {
+    case ParamDecl:    break;
+    case DefparamDecl: break;
+    default: internal_error("Unexpected Param Decl");	break;
+    }
+
+    {
+	vl_bassign_stmt *assign;
+	lsHandle handle;
+	lsGen gen;
+
+	retval->assigns = lsCreate();
+	gen = lsStart(decl->assigns);
+	if (lsNext(gen, (lsGeneric*)&assign, &handle) == LS_OK) {
+	    lsNewEnd(retval->assigns,
+		     (lsGeneric)vl_copy_bassign_stmt(assign), 0);
+	    while(lsNext(gen, (lsGeneric*)&assign, &handle) != LS_NOMORE) {
+		lsNewEnd(retval->assigns,
+			 (lsGeneric)vl_copy_bassign_stmt(assign), 0);
+	    }
+	}
+    }
+
+    old_paramdecl = retval;
+    orig_module = vl_currentModule;
+    vl_currentModule = creatingModule;
+    retval = vl_create_paramdecl(retval->type, retval->assigns);
+    vl_currentModule = orig_module;
+    vl_chk_free((char*)old_paramdecl);
+
+    return retval;
+}
+
+vl_netdecl *vl_copy_netdecl(vl_netdecl *decl)
+{
+    vl_netdecl *retval;
+
+    CpyTRACE("copying Net decl\n");
+    retval = (vl_netdecl*)chk_malloc(sizeof(vl_netdecl));
+    retval->type = decl->type;
+    switch(decl->type) {
+    case WireDecl: break;
+    case TriDecl:  break;
+    case Tri0Decl: break;
+    case Tri1Decl: break;
+    case Supply0Decl: break;
+    case Supply1Decl: break;
+    case WandDecl: break;
+    case TriandDecl:  break;
+    case WorDecl:  break;
+    case TriorDecl:   break;
+    case TriregDecl:  break;
+    default: internal_error("Unexpected Net Decl");	break;
+    }
+    retval->strength = vl_copy_strength(decl->strength);
+    retval->range = vl_copy_range(decl->range);
+    retval->delay = vl_copy_delay(decl->delay);
+    retval->ids = vl_copy_net_list(decl->ids);
+
+    return retval;
+}
+
+vl_task *vl_copy_task(vl_task *task)
+{
+    vl_task *retval;
+
+    CpyTRACE("copying Task\n");
+    retval = (vl_task*)chk_malloc(sizeof(vl_task));
+    ASSERT(task->type == TaskDecl, "Unexpected Task Type");
+
+    retval->type = task->type;
+    retval->name  = vl_copy_id_range(task->name);
+    retval->decls = vl_copy_decl_list(task->decls);
+    retval->stmts = vl_copy_stmt_list(task->stmts);
+
+    return retval;
+}
+
+vl_function *vl_copy_function(vl_function *func)
+{
+    vl_function *retval;
+
+    CpyTRACE("Printing Function\n");
+    retval = (vl_function*)chk_malloc(sizeof(vl_function));
+    retval->type = func->type;
+    switch(func->type) {
+    case IntFuncDecl:
+
+	break;
+    case RealFuncDecl:
+
+	break;
+    case RangeFuncDecl:
+
+	break;
+    default:
+	internal_error("Unexpected Function Type");
+    }
+    retval->name = vl_copy_id_range(func->name);
+    retval->decls = vl_copy_decl_list(func->decls);
+    retval->stmts = vl_copy_stmt_list(func->stmts);
+
+    return retval;
+}
+
+vl_gate_inst_list *vl_copy_gate_inst_list(vl_gate_inst_list *gatelist)
+{
+    vl_gate_inst_list *retval;
+
+    CpyTRACE("copying Gate Instance List\n");
+    retval = (vl_gate_inst_list*)chk_malloc(sizeof(vl_gate_inst_list));
+    retval->type = gatelist->type;
+
+    switch(gatelist->type) {
+    case AndGate:   break;
+    case NandGate:  break;
+    case OrGate:    break;
+    case NorGate:   break;
+    case XorGate:   break;
+    case XnorGate:  break;
+    case BufGate:   break;
+    case Bufif0Gate:break;
+    case Bufif1Gate:break;
+    case NotGate:   break;
+    case Notif0Gate:break;
+    case Notif1Gate:break;
+    case PulldownGate: break;
+    case PullupGate:   break;
+    case NmosGate:     break;
+    case RnmosGate:    break;
+    case PmosGate:     break;
+    case RpmosGate:    break;
+    case CmosGate:     break;
+    case RcmosGate:    break;
+    case TranGate:     break;
+    case RtranGate:    break;
+    case Tranif0Gate:  break;
+    case Rtranif0Gate: break;
+    case Tranif1Gate:  break;
+    case Rtranif1Gate: break;
+    default: internal_error("Unexpected Gate Type");	break;
+    }
+
+    retval->strength = vl_copy_strength(gatelist->strength);
+    retval->delays = vl_copy_delay(gatelist->delays);
+    retval->gates = vl_copy_gates(gatelist->gates);
+
+    return retval;
+}
+
+lsList vl_copy_gates(lsList gates)
+{
+    vl_gate_inst *gate;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    CpyTRACE("copying Gate Instances\n");
+
+    retval = lsCreate();
+    gen = lsStart(gates);
+    if (lsNext(gen, (lsGeneric*)&gate, &handle) == LS_OK) {
+	lsNewEnd(retval, (lsGeneric)vl_copy_gate(gate), 0);
+	while(lsNext(gen, (lsGeneric*)&gate, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_gate(gate), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+vl_mod_prim_inst_list *vl_copy_prim_inst_list(vl_mod_prim_inst_list *primlist)
+{
+    vl_mod_prim_inst_list *retval;
+
+    CpyTRACE("copying Primitive Instance List\n");
+
+    retval = (vl_mod_prim_inst_list*)chk_malloc(sizeof(vl_mod_prim_inst_list));
+    retval->type = primlist->type;
+
+    retval->name = vl_copy_id_range(primlist->name);
+    retval->strength = vl_copy_strength(primlist->strength);
+    retval->delays = vl_copy_delay(primlist->delays);
+    retval->mps = vl_copy_prims(primlist->mps);
+
+    return retval;
+}
+
+lsList vl_copy_prims(lsList prims)
+{
+    vl_mod_prim_inst *prim;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    CpyTRACE("copying Primitive Instances\n");
+    retval = lsCreate();
+    gen = lsStart(prims);
+    if (lsNext(gen, (lsGeneric*)&prim, &handle) == LS_OK) {
+	lsNewEnd(retval, (lsGeneric)vl_copy_prim(prim), 0);
+	while(lsNext(gen, (lsGeneric*)&prim, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_prim(prim), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+vl_mod_prim_inst_list *vl_copy_mod_inst_list(vl_mod_prim_inst_list *modinstlist)
+{
+    vl_mod_prim_inst_list *retval;
+
+    CpyTRACE("copying Module Instance List\n");
+    retval = (vl_mod_prim_inst_list*)chk_malloc(sizeof(vl_mod_prim_inst_list));
+    retval->type = modinstlist->type;
+    retval->name = vl_copy_id_range(modinstlist->name);
+    retval->delays =
+	(vl_delay*)vl_copy_param_vals((lsList)modinstlist->delays);
+    retval->mps = vl_copy_mod_insts(modinstlist->mps);
+
+    return retval;
+}
+
+lsList vl_copy_mod_insts(lsList modinsts)
+{
+    vl_mod_prim_inst *modinst;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    CpyTRACE("copying Module Instances\n");
+    retval = lsCreate();
+    gen = lsStart(modinsts);
+    if (lsNext(gen, (lsGeneric*)&modinst, &handle) == LS_OK) {
+	lsNewEnd(retval, (lsGeneric)vl_copy_modinst(modinst), 0);
+	while(lsNext(gen, (lsGeneric*)&modinst, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_modinst(modinst), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+
+vl_procstmt *vl_copy_procstmt(vl_procstmt *pstmt)
+{
+    vl_procstmt *retval;
+
+    CpyTRACE("copying Process stmt\n");
+
+    retval = (vl_procstmt*)chk_malloc(sizeof(vl_procstmt));
+    retval->type = pstmt->type;
+
+    switch(pstmt->type) {
+    case AlwaysStmt:  break;
+    case InitialStmt: break;
+    default: internal_error("Unexpected Process Statement Type");	break;
+    }
+
+    retval->stmt = vl_copy_stmt(pstmt->stmt);
+    retval->pc = vl_create_symbolic_var(vlStrdup(new_pc()));
+
+    return retval;
+}
+
+vl_begin_end_stmt *vl_copy_begin_end_stmt(vl_begin_end_stmt *bestmt)
+{
+    vl_begin_end_stmt *retval;
+
+    CpyTRACE("copying beginend\n");
+    ASSERT(bestmt->type == BeginEndStmt, "Unexpected BeginEndStmt Type");
+
+    retval = (vl_begin_end_stmt*)chk_malloc(sizeof(vl_begin_end_stmt));
+    retval->type = bestmt->type;
+
+    retval->decls = vl_copy_decl_list(bestmt->decls);
+    retval->stmts = vl_copy_stmt_list(bestmt->stmts);
+
+    return retval;
+}
+
+vl_if_else_stmt *vl_copy_if_else_stmt(vl_if_else_stmt *stmt)
+{
+    vl_if_else_stmt *retval;
+
+    CpyTRACE("copying if_else_stmt\n");
+    ASSERT(stmt->type == IfElseStmt, "Unexpected IfElseStmt Type");
+
+    retval = (vl_if_else_stmt*)chk_malloc(sizeof(vl_if_else_stmt));
+    retval->type = stmt->type;
+
+    retval->cond = vl_copy_expr(stmt->cond);
+    retval->if_stmt = vl_copy_stmt(stmt->if_stmt);
+
+    if (stmt->else_stmt) {
+	retval->else_stmt = vl_copy_stmt(stmt->else_stmt);
+    } else {
+	retval->else_stmt = NIL(void);
+    }
+
+    return retval;
+}
+
+vl_case_stmt *vl_copy_case_stmt(vl_case_stmt *stmt)
+{
+    vl_case_stmt *retval;
+
+    CpyTRACE("copying case_stmt\n");
+
+    retval = (vl_case_stmt*)chk_malloc(sizeof(vl_case_stmt));
+    retval->type = stmt->type;
+    switch(stmt->type) {
+    case CaseStmt:  break;
+    case CasexStmt: break;
+    case CasezStmt: break;
+    default: internal_error("Unexpected Case Type");	break;
+    }
+    retval->cond = vl_copy_expr(stmt->cond);
+
+    {
+	vl_case_item *item, *case_item;
+	lsHandle handle;
+	lsGen gen;
+
+	retval->case_items = lsCreate();
+	gen = lsStart(stmt->case_items);
+	while(lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+	    case_item = vl_copy_case_item(item);
+	    case_item->type = item->type;
+	    lsNewEnd(retval->case_items, (lsGeneric)case_item, 0);
+	}
+    }
+
+    return retval;
+}
+
+vl_forever_stmt *vl_copy_forever_stmt(vl_forever_stmt *stmt)
+{
+    vl_forever_stmt *retval;
+
+    CpyTRACE("Printing forever_stmt\n");
+    ASSERT(stmt->type == ForeverStmt, "Unexpected ForeverStmt Type");
+
+    retval = (vl_forever_stmt*)chk_malloc(sizeof(vl_forever_stmt));
+    retval->type = stmt->type;
+    retval->stmt = vl_copy_stmt(stmt->stmt);
+
+    return retval;
+}
+
+vl_repeat_stmt *vl_copy_repeat_stmt(vl_repeat_stmt *stmt)
+{
+    vl_repeat_stmt *retval;
+
+    CpyTRACE("copying repeat_stmt\n");
+    ASSERT(stmt->type == RepeatStmt, "Unexpected RepeatStmt Type");
+
+    retval = (vl_repeat_stmt*)chk_malloc(sizeof(vl_repeat_stmt));
+    retval->type = stmt->type;
+    retval->count = vl_copy_expr(stmt->count);
+    retval->stmt = vl_copy_stmt(stmt->stmt);
+
+    return retval;
+}
+
+vl_while_stmt *vl_copy_while_stmt(vl_while_stmt *stmt)
+{
+    vl_while_stmt *retval;
+
+    CpyTRACE("Printing while_stmt\n");
+    ASSERT(stmt->type == WhileStmt, "Unexpected WhileStmt Type");
+
+    retval = (vl_while_stmt*)chk_malloc(sizeof(vl_while_stmt));
+    retval->type = stmt->type;
+    retval->cond = vl_copy_expr(stmt->cond);
+    retval->stmt = vl_copy_stmt(stmt->stmt);
+
+    return retval;
+}
+
+vl_for_stmt *vl_copy_for_stmt(vl_for_stmt *stmt)
+{
+    vl_for_stmt *retval;
+
+    CpyTRACE("copying for_stmt\n");
+    ASSERT(stmt->type == ForStmt, "Unexpected ForStmt Type");
+
+    retval = (vl_for_stmt*)chk_malloc(sizeof(vl_for_stmt));
+    retval->type = stmt->type;
+    retval->init = vl_copy_bassign_stmt(stmt->init);
+    retval->cond = vl_copy_expr(stmt->cond);
+    retval->end = vl_copy_bassign_stmt(stmt->end);
+    retval->stmt = vl_copy_stmt(stmt->stmt);
+
+    return retval;
+}
+
+vl_delay_control_stmt *vl_copy_delay_control_stmt(vl_delay_control_stmt *stmt)
+{
+    vl_delay_control_stmt *retval;
+
+    CpyTRACE("copying delay_control_stmt\n");
+    ASSERT(stmt->type == DelayControlStmt, "Unexpected DelayControlStmt Type");
+
+    retval = (vl_delay_control_stmt*)chk_malloc(sizeof(vl_delay_control_stmt));
+    retval->type = stmt->type;
+    retval->delay = vl_copy_delay(stmt->delay);
+    retval->stmt = vl_copy_stmt(stmt->stmt);
+
+    return retval;
+}
+
+vl_event_control_stmt *vl_copy_event_control_stmt(vl_event_control_stmt *stmt)
+{
+    vl_event_control_stmt *retval;
+
+    CpyTRACE("copying event_control_stmt\n");
+    ASSERT(stmt->type == EventControlStmt, "Unexpected EventControlStmt Type");
+
+    retval = (vl_event_control_stmt*)chk_malloc(sizeof(vl_event_control_stmt));
+    retval->type = stmt->type;
+    retval->event = vl_copy_event_expr(stmt->event);
+    retval->stmt = vl_copy_stmt(stmt->stmt);
+
+    return retval;
+}
+
+
+vl_bassign_stmt *vl_copy_bassign_stmt(vl_bassign_stmt *bassign)
+{
+    vl_bassign_stmt *retval;
+
+    CpyTRACE("Printing bassign_stmt\n");
+
+    if (bassign->type == AssignStmt) {
+	vl_fprintf_stmt(stdout, "assign "); /* Fabio's temp. fix */
+    }
+
+    retval = (vl_bassign_stmt*)chk_malloc(sizeof(vl_bassign_stmt));
+    retval->type = bassign->type;
+
+    retval->lhs = vl_copy_lval(bassign->lhs);
+
+    bassign->control = NIL(void);
+    switch(bassign->type) {
+    case AssignStmt:
+    case BassignStmt:
+	break;
+    case NbassignStmt:
+	break;
+    case DelayBassignStmt:
+	retval->control = vl_copy_delay((vl_delay *)bassign->control);
+	break;
+    case DelayNbassignStmt:
+	retval->control = vl_copy_delay((vl_delay *)bassign->control);
+	break;
+    case EventBassignStmt:
+	retval->control = vl_copy_event_expr((vl_event_expr*)bassign->control);
+	break;
+    case EventNbassignStmt:
+	retval->control = vl_copy_event_expr((vl_event_expr*)bassign->control);
+	break;
+    default: internal_error("Unexpected Assign Type");	break;
+    }
+    retval->rhs = vl_copy_expr(bassign->rhs);
+
+    return retval;
+}
+
+vl_wait_stmt *vl_copy_wait_stmt(vl_wait_stmt *stmt)
+{
+    vl_wait_stmt *retval;
+
+    CpyTRACE("copying wait_stmt\n");
+    ASSERT(stmt->type == WaitStmt, "Unexpected WaitStmt Type");
+
+    retval = (vl_wait_stmt*)chk_malloc(sizeof(vl_wait_stmt));
+    retval->type = stmt->type;
+    retval->cond = vl_copy_expr(stmt->cond);
+    retval->stmt = vl_copy_stmt(stmt->stmt);
+
+    return retval;
+}
+
+vl_fork_join_stmt *vl_copy_fork_join_stmt(vl_fork_join_stmt *stmt)
+{
+    vl_fork_join_stmt *retval;
+
+    CpyTRACE("copying fork_join_stmt\n");
+    ASSERT(stmt->type == ForkJoinStmt, "Unexpected ForkJoinStmt Type");
+
+    retval = (vl_fork_join_stmt*)chk_malloc(sizeof(vl_fork_join_stmt));
+    retval->type = stmt->type;
+    retval->decls = vl_copy_decl_list(stmt->decls);
+    retval->stmts = vl_copy_stmt_list(stmt->stmts);
+
+    return retval;
+}
+
+
+vl_task_enable_stmt *vl_copy_task_enable_stmt(vl_task_enable_stmt *stmt)
+{
+    vl_task_enable_stmt *retval;
+
+    CpyTRACE("Printing task_enable_stmt\n");
+    ASSERT(((stmt->type == TaskEnableStmt) ||
+	    (stmt->type == SysTaskEnableStmt)),
+	   "Unexpected TaskEnableStmt Type");
+
+    retval = (vl_task_enable_stmt*)chk_malloc(sizeof(vl_task_enable_stmt));
+    retval->type = stmt->type;
+    retval->name = vl_copy_id_range(stmt->name);
+    if (stmt->args) {
+
+	retval->args = vl_copy_expr_list(stmt->args);
+    } else {
+	retval->args = (lsList)0;
+    }
+
+    return retval;
+}
+
+vl_disable_stmt *vl_copy_disable_stmt(vl_disable_stmt *stmt)
+{
+    vl_disable_stmt *retval;
+
+    CpyTRACE("copying disable_stmt\n");
+    ASSERT(stmt->type == DisableStmt, "Unexpected DisableStmt Type");
+
+    retval = (vl_disable_stmt*)chk_malloc(sizeof(vl_disable_stmt));
+    retval->type = stmt->type;
+    retval->name = vl_copy_id_range(stmt->name);
+
+    return retval;
+}
+
+vl_deassign_stmt *vl_copy_deassign_stmt(vl_deassign_stmt *stmt)
+{
+    vl_deassign_stmt *retval;
+
+    CpyTRACE("Printing deassign_stmt\n");
+    ASSERT(stmt->type == DeassignStmt, "Unexpected DeassignStmt Type");
+
+    retval = (vl_deassign_stmt*)chk_malloc(sizeof(vl_deassign_stmt));
+    retval->type = stmt->type;
+    retval->lhs = vl_copy_lval(stmt->lhs);
+
+    return retval;
+}
+
+vl_case_item *vl_copy_case_item(vl_case_item *item)
+{
+    vl_case_item *retval;
+
+    CpyTRACE("Printing case_item\n");
+    retval = (vl_case_item*)chk_malloc(sizeof(vl_case_item));
+    retval->type = item->type;
+    switch(item->type) {
+    case CaseItem: retval->exprs = vl_copy_expr_list(item->exprs); break;
+    case DefaultItem: break;
+    default: internal_error("Unexpected CaseItem Type"); break;
+    }
+    retval->stmt = vl_copy_stmt(item->stmt);
+
+    return retval;
+}
+
+vl_event_expr *vl_copy_event_expr(vl_event_expr *event)
+{
+    vl_event_expr *retval;
+
+    CpyTRACE("Printing event_expr\n");
+    if (event == NIL(vl_event_expr)) return NIL(vl_event_expr);
+
+    retval = (vl_event_expr*)chk_malloc(sizeof(vl_event_expr));
+    retval->type = event->type;
+    retval->list = (lsList)0;
+    switch(event->type) {
+    case OrEventExpr:  {
+	vl_event_expr *e;
+	lsHandle handle;
+	lsGen gen;
+
+	retval->list = lsCreate();
+	gen = lsStart(event->list);
+	if (lsNext(gen, (lsGeneric*)&e, &handle) == LS_OK) {
+	    lsNewEnd(retval->list, (lsGeneric)vl_copy_event_expr(e), 0);
+	    while(lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE) {
+		lsNewEnd(retval->list, (lsGeneric)vl_copy_event_expr(e), 0);
+	    }
+	}
+	(void) lsFinish(gen);
+
+	return retval;
+    }
+    case NegedgeEventExpr: retval->expr = vl_copy_expr(event->expr); break;
+    case PosedgeEventExpr: retval->expr = vl_copy_expr(event->expr); break;
+    case EdgeEventExpr: retval->expr = vl_copy_expr(event->expr); break;
+    case EventExpr:     retval->expr = vl_copy_expr(event->expr); break;
+    default: internal_error("Unexpected EventExpr Type"); break;
+    }
+
+    return retval;
+}
+
+vl_lval *vl_copy_lval(vl_lval *lval)
+{
+    vl_lval *retval;
+
+    CpyTRACE("Printing lval\n");
+
+    retval = (vl_lval*)chk_malloc(sizeof(vl_lval));
+    retval->type = lval->type;
+    switch(lval->type) {
+    case IDExpr: retval->name = vl_copy_id_range(lval->name); break;
+    case BitSelExpr:
+    case PartSelExpr:
+	retval->name = vl_copy_id_range(lval->name);
+	retval->range = vl_copy_range(lval->range);
+	break;
+    case ConcatExpr: {
+	vl_expr *e;
+	lsHandle handle;
+	lsGen gen;
+
+	retval->concat = lsCreate();
+	gen = lsStart(lval->concat);
+	if (lsNext(gen, (lsGeneric*)&e, &handle) == LS_OK) {
+	    lsNewEnd(lval->concat, (lsGeneric)vl_copy_expr(e), 0);
+	    while(lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE) {
+		lsNewEnd(lval->concat, (lsGeneric)vl_copy_expr(e), 0);
+	    }
+	}
+	(void) lsFinish(gen);
+
+	break;
+    }
+
+    default: internal_error("Unexpected Lval Type"); break;
+    }
+
+    return retval;
+}
+
+vl_expr *vl_copy_expr(vl_expr *expr)
+{
+    vl_expr *retval;
+
+    if (!expr) return NIL(vl_expr);
+    CpyTRACE("Printing expr\n");
+
+    retval = (vl_expr*)chk_malloc(sizeof(vl_expr));
+    retval->type = expr->type;
+    switch (expr->type) {
+    case BitExpr:
+	retval->u.exprs.e1 = expr->u.exprs.e1;
+	retval->u.exprs.e2 = expr->u.exprs.e2;
+	retval->u.exprs.e3 = (vl_expr*)vlStrdup((char*)expr->u.exprs.e3);
+	break;
+    case IntExpr:
+	retval->u.intval = expr->u.intval;
+	break;
+    case RealExpr:
+	retval->u.realval = expr->u.realval;
+	break;
+    case IDExpr:
+	retval->u.name = vl_copy_id_range(expr->u.name);
+	break;
+    case BitSelExpr:    case PartSelExpr:
+	retval->u.idrng = vl_copy_id_range_rec(expr->u.idrng);
+	break;
+    case ConcatExpr: {
+
+	vl_expr *e;
+	lsHandle handle;
+	lsGen gen;
+
+	retval->u.exprs.e1 = (vl_expr*)lsCreate();
+	gen = lsStart((lsList)(expr->u.exprs.e1));
+	if (lsNext(gen, (lsGeneric*)&e, &handle) == LS_OK) {
+	    lsNewEnd((lsList)retval->u.exprs.e1,
+		     (lsGeneric)vl_copy_expr(e), 0);
+	    while(lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE) {
+		lsNewEnd((lsList)retval->u.exprs.e1,
+			 (lsGeneric)vl_copy_expr(e), 0);
+	    }
+	}
+	(void) lsFinish(gen);
+	break;
+    }
+    case MinTypMaxExpr: {
+
+	retval->u.exprs.e1 = vl_copy_expr(expr->u.exprs.e1);
+	if (expr->u.exprs.e2) {
+	    retval->u.exprs.e2 = vl_copy_expr(expr->u.exprs.e2);
+	}
+	if (expr->u.exprs.e3) {
+	    retval->u.exprs.e3 = vl_copy_expr(expr->u.exprs.e3);
+	}
+	break;
+    }
+    case StringExpr: retval->u.string = vlStrdup(expr->u.string); break;
+    case FuncExpr:
+	retval->u.func_call.name = vl_copy_id_range(expr->u.func_call.name);
+	if (expr->u.func_call.args) {
+	    retval->u.func_call.args =
+		vl_copy_expr_list(expr->u.func_call.args);
+	}
+	break;
+    case UplusExpr:    case UminusExpr:
+    case UnotExpr:    case UcomplExpr:
+
+    case UandExpr:    case UnandExpr:
+    case UorExpr:    case UnorExpr:
+    case UxorExpr:    case UxnorExpr:
+	retval->u.exprs.e1 = vl_copy_expr(expr->u.exprs.e1);
+	break;
+
+    case BplusExpr:    case BminusExpr:
+    case BtimesExpr:    case BdivExpr:
+    case BremExpr:    case Beq2Expr:
+    case Bneq2Expr:    case Beq3Expr:
+    case Bneq3Expr:    case BlandExpr:
+    case BlorExpr:    case BltExpr:
+    case BleExpr:   case BgtExpr:
+    case BgeExpr:    case BandExpr:
+    case BorExpr:    case BxorExpr:
+    case BxnorExpr:    case BlshiftExpr:
+    case BrshiftExpr:
+	retval->u.exprs.e1 = vl_copy_expr(expr->u.exprs.e1);
+	retval->u.exprs.e2 = vl_copy_expr(expr->u.exprs.e2);
+	break;
+
+    case TcondExpr:
+	retval->u.exprs.e1 = vl_copy_expr(expr->u.exprs.e1);
+	retval->u.exprs.e2 = vl_copy_expr(expr->u.exprs.e2);
+	retval->u.exprs.e3 = vl_copy_expr(expr->u.exprs.e3);
+	break;
+    case NondExpr:
+	retval->u.expr_list = vl_copy_expr_list(expr->u.expr_list);
+	break;
+    }
+
+    return retval;
+}
+
+
+lsList vl_copy_expr_list(lsList exprs)
+{
+    void *expr;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    CpyTRACE("copying Expression List\n");
+    if (lsLength(exprs) <= 0) return (lsList)0;
+    retval = lsCreate();
+    gen = lsStart(exprs);
+    if (lsNext(gen, (lsGeneric*)&expr, &handle) == LS_OK) {
+	lsNewEnd(retval, (lsGeneric)vl_copy_expr(expr), 0);
+	while(lsNext(gen, (lsGeneric*)&expr, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_expr(expr), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+vl_range *vl_copy_range(vl_range *range)
+{
+    vl_range *retval;
+
+    CpyTRACE("copying range\n");
+
+    if (range == NIL(vl_range) ||
+	(range->left == NIL(vl_expr) && range->right == NIL(vl_expr)))
+	return NIL(vl_range);
+
+    retval = (vl_range*)chk_malloc(sizeof(vl_range));
+    retval->left = vl_copy_expr(range->left);
+    if (range->right) {
+	retval->right = vl_copy_expr(range->right);
+    }
+
+    return retval;
+}
+
+
+vl_delay *vl_copy_delay(vl_delay *delay)
+{
+    vl_delay *retval;
+
+    CpyTRACE("copying delay\n");
+    if (delay == NIL(vl_delay)) return NIL(vl_delay);
+
+    retval = (vl_delay*)chk_malloc(sizeof(vl_delay));
+    retval->delay1 = vl_copy_expr(delay->delay1);
+    if (delay->delay2) {
+	delay->delay2 = vl_copy_expr(delay->delay2);
+	if (delay->delay3) {
+	    delay->delay3 = vl_copy_expr(delay->delay3);
+	}
+    }
+
+    return retval;
+}
+
+
+lsList vl_copy_id_list(lsList ids)
+{
+    vl_id_range *id;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    retval = lsCreate();
+    gen = lsStart(ids);
+    if (lsNext(gen, (lsGeneric*)&id, &handle) == LS_OK) {
+	lsNewEnd(retval, (lsGeneric)vl_copy_id_range(id), 0);
+	while(lsNext(gen, (lsGeneric*)&id, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_id_range(id), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+
+lsList vl_copy_id_range_list(lsList ids)
+{
+    vl_id_range *id;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    if (ids == (lsList)0) return (lsList)0;
+    retval = lsCreate();
+    gen = lsStart(ids);
+    if (lsNext(gen, (lsGeneric*)&id, &handle) == LS_OK) {
+	lsNewEnd(retval, (lsGeneric)vl_copy_id_range(id), 0);
+	while(lsNext(gen, (lsGeneric*)&id, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_id_range(id), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+
+lsList vl_copy_net_list(lsList nets)
+{
+    void *net;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    retval = lsCreate();
+    gen = lsStart(nets);
+    if (lsNext(gen, (lsGeneric*)&net, &handle) == LS_OK) {
+	lsNewEnd(retval, vl_copy_net(net), 0);
+	while(lsNext(gen, (lsGeneric*)&net, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, vl_copy_net(net), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+
+void *vl_copy_net(void *net)
+{
+    void *retval=NIL(void);
+
+    switch(((vl_expr *)net)->type) {
+    case BassignStmt: retval = (void*)vl_copy_bassign_stmt(net); break;
+    case IDExpr: retval = (void*)vl_copy_expr(net); break;
+    default: retval = (void*)vl_copy_id_range((vl_id_range*)net); break;
+    }
+
+    return retval;
+}
+
+
+lsList vl_copy_ports (lsList ports)
+{
+    void *item;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    if (ports != (lsList)0) {
+	retval = lsCreate();
+	gen = lsStart(ports);
+	if (lsNext(gen, (lsGeneric*)&item, &handle) == LS_OK) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_port(item), 0);
+	    while (lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+		lsNewEnd(retval, (lsGeneric)vl_copy_port(item), 0);
+	    }
+	}
+	(void) lsFinish(gen);
+	return retval;
+    }
+
+    return (lsList)0;
+}
+
+vl_port *vl_copy_port(vl_portPtr port)
+{
+    vl_port *retval;
+
+    retval = (vl_port*)chk_malloc(sizeof(vl_port));
+    retval->type = port->type;
+    if (port->type == NamedPort) {
+	retval->id = vl_copy_id_range(port->id);
+    }
+
+    retval->port_exp = vl_copy_id_range_list(port->port_exp);
+
+    return retval;
+}
+
+
+lsList vl_copy_connects (lsList connects)
+{
+    void *item;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+
+    if (connects != (lsList)0) {
+	retval = lsCreate();
+	gen = lsStart(connects);
+	if (lsNext(gen, (lsGeneric*)&item, &handle) == LS_OK) {
+	    lsNewEnd(retval, (lsGeneric)vl_copy_port_connect(item), 0);
+	    while (lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+		lsNewEnd(retval, (lsGeneric)vl_copy_port_connect(item), 0);
+	    }
+	}
+	(void) lsFinish(gen);
+	return retval;
+    }
+
+    return (lsList)0;
+}
+
+vl_port_connect *vl_copy_port_connect(vl_port_connectPtr connect)
+{
+    vl_port_connect *retval=NIL(vl_port_connect);
+
+    retval = (vl_port_connect*)chk_malloc(sizeof(vl_port_connect));
+    retval->type = connect->type;
+    if (connect->type == NamedConnect) {
+	retval->id = vl_copy_id_range(connect->id);
+    }
+
+    retval->expr = vl_copy_expr(connect->expr);
+
+    return retval;
+}
+
+
+lsList vl_copy_mod_item_list (lsList mitems)
+{
+    void *item;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    CpyTRACE("copying Module Items\n");
+    if (mitems != (lsList)0) {
+	retval = lsCreate();
+	gen = lsStart(mitems);
+	if (lsNext(gen, (lsGeneric*)&item, &handle) == LS_OK) {
+	    lsNewEnd(retval, vl_copy_mod_item(item), 0);
+	    while(lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+		lsNewEnd(retval, vl_copy_mod_item(item), 0);
+	    }
+	}
+	(void) lsFinish(gen);
+
+	return retval;
+    }
+
+    return (lsList)0;
+}
+
+
+void *vl_copy_mod_item(void *item)
+{
+    void *retval=NIL(void);
+
+    switch(((vl_decl *)item)->type) {
+
+    case RealDecl:	case EventDecl:
+	retval = (void*)vl_copy_basicdecl((vl_decl *)item);
+	break;
+
+    case IntDecl:	case TimeDecl:
+	retval = (void*)vl_copy_basicdecl((vl_decl *)item);
+	break;
+
+    case InputDecl:	case OutputDecl:
+    case InoutDecl:	case RegDecl:
+	retval = (void*)vl_copy_rangedecl((vl_rangedecl *)item);
+	break;
+
+    case ParamDecl:	case DefparamDecl:
+	retval = (void*)vl_copy_paramdecl((vl_paramdecl *)item);
+	break;
+
+    case WireDecl:	case TriDecl:
+    case Tri0Decl:	case Tri1Decl:
+    case Supply0Decl:	case Supply1Decl:
+    case WandDecl:	case TriandDecl:
+    case WorDecl:	case TriorDecl:
+    case TriregDecl:
+	retval = (void*)vl_copy_netdecl((vl_netdecl *)item);
+	break;
+
+    case ContAssign:
+	retval = (void*)vl_copy_cont_assign((vl_cont_assign *)item);
+	break;
+
+    case TaskDecl:
+	retval = (void*)vl_copy_task((vl_task *)item);
+	break;
+
+    case IntFuncDecl:	case RealFuncDecl:
+    case RangeFuncDecl:
+	retval = (void*)vl_copy_function((vl_function *)item);
+	break;
+
+    case AndGate:	case NandGate:
+    case OrGate:	case NorGate:
+    case XorGate:	case XnorGate:
+    case BufGate:	case Bufif0Gate:
+    case Bufif1Gate:	case NotGate:
+    case Notif0Gate:	case Notif1Gate:
+    case PulldownGate:	case PullupGate:
+    case NmosGate:	case RnmosGate:
+    case PmosGate:	case RpmosGate:
+    case CmosGate:	case RcmosGate:
+    case TranGate:	case RtranGate:
+    case Tranif0Gate:	case Rtranif0Gate:
+    case Tranif1Gate:	case Rtranif1Gate:
+	retval = (void*)vl_copy_gate_inst_list((vl_gate_inst_list *)item);
+	break;
+
+    case ModInst: {
+	char *mp;
+
+	if (st_lookup(vl_description->mp_st,
+		       ((vl_mod_prim_inst_list *)item)->name->name,
+		       &mp)) {
+	    if (((typestructPtr)mp)->type == CombPrimDecl ||
+		((typestructPtr)mp)->type == SeqPrimDecl)
+		goto copy_prim_inst;
+	}
+	}
+
+	retval = (void*)vl_copy_mod_inst_list((vl_mod_prim_inst_list *)item);
+	break;
+
+copy_prim_inst:
+
+    case PrimInst:
+	retval = (void*)vl_copy_prim_inst_list((vl_mod_prim_inst_list *)item);
+	break;
+
+    case AlwaysStmt:
+    case InitialStmt:
+	retval = (void*)vl_copy_procstmt((vl_procstmt *)item);
+	break;
+
+    default: internal_error("Unexpected Module Item"); break;
+    }
+
+    return retval;
+}
+
+
+lsList vl_copy_decl_list (void *decls)
+{
+    void *decl;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    CpyTRACE("copying Decls\n");
+    if (decls == NIL(void)) return (lsList)0;
+    retval = lsCreate();
+    gen = lsStart(decls);
+    if (lsNext(gen, (lsGeneric*)&decl, &handle) == LS_OK) {
+	lsNewEnd(retval, vl_copy_decl(decl), 0);
+	while(lsNext(gen, (lsGeneric*)&decl, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, vl_copy_decl(decl), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+lsList vl_copy_stmt_list (void *stmts)
+{
+    void *stmt;
+    lsHandle handle;
+    lsGen gen;
+    lsList retval;
+
+    CpyTRACE("copying Statements\n");
+    retval = lsCreate();
+    gen = lsStart(stmts);
+    if (lsNext(gen, (lsGeneric*)&stmt, &handle) == LS_OK) {
+	lsNewEnd(retval, vl_copy_stmt(stmt), 0);
+	while(lsNext(gen, (lsGeneric*)&stmt, &handle) != LS_NOMORE) {
+	    lsNewEnd(retval, vl_copy_stmt(stmt), 0);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return retval;
+}
+
+int vl_copy_strength (int s)
+{
+    return s;
+}
+
+
+vl_gate_inst *vl_copy_gate (vl_gate_inst *gate)
+{
+    vl_gate_inst *retval;
+
+    retval = (vl_gate_inst*)chk_malloc(sizeof(vl_gate_inst));
+    retval->name = vl_copy_id_range(gate->name);
+    retval->terms = vl_copy_expr_list(gate->terms);
+
+    return retval;
+}
+
+vl_mod_prim_inst *vl_copy_prim (vl_mod_prim_inst *prim)
+{
+    vl_mod_prim_inst *retval;
+
+    retval = (vl_mod_prim_inst*)chk_malloc(sizeof(vl_mod_prim_inst));
+    retval->name = vl_copy_id_range(prim->name);
+    retval->ports = vl_copy_expr_list(prim->ports);
+
+    return retval;
+}
+
+lsList vl_copy_param_vals (lsList param_vals)
+{
+    if (param_vals == (lsList)0) return (lsList)0;
+
+    return vl_copy_expr_list(param_vals);
+}
+
+vl_mod_prim_inst *vl_copy_modinst (vl_mod_prim_inst *mod)
+{
+    vl_mod_prim_inst *retval;
+
+    retval = (vl_mod_prim_inst*)chk_malloc(sizeof(vl_mod_prim_inst));
+    retval->name = vl_copy_id_range(mod->name);
+    retval->ports = vl_copy_connects(mod->ports);
+
+    return retval;
+}
+
+void *vl_copy_stmt (void *stmt)
+{
+    void *retval=NIL(void);
+
+    if (stmt == NIL(void)) {
+	return NIL(void);
+    }
+
+    switch(((vl_bassign_stmt *)stmt)->type) {
+    case BeginEndStmt:
+	retval = (void*)vl_copy_begin_end_stmt((vl_begin_end_stmt *)stmt);
+	break;
+    case IfElseStmt:
+	retval = (void*)vl_copy_if_else_stmt((vl_if_else_stmt *)stmt);
+	break;
+    case CaseStmt:
+    case CasexStmt:
+    case CasezStmt:
+	retval = (void*)vl_copy_case_stmt((vl_case_stmt *)stmt);
+	break;
+    case CaseItem:
+	retval = (void*)vl_copy_stmt(((vl_case_item *)stmt)->stmt);
+	break;
+    case DefaultItem:
+	retval = (void*)vl_copy_stmt(((vl_case_item *)stmt)->stmt);
+	break;
+    case ForeverStmt:
+	retval = (void*)vl_copy_forever_stmt((vl_forever_stmt *)stmt);
+	break;
+    case RepeatStmt:
+	retval = (void*)vl_copy_repeat_stmt((vl_repeat_stmt *)stmt);
+	break;
+    case WhileStmt:
+	retval = (void*)vl_copy_while_stmt((vl_while_stmt *)stmt);
+	break;
+    case ForStmt:
+	retval = (void*)vl_copy_for_stmt((vl_for_stmt *)stmt);
+	break;
+    case DelayControlStmt:
+	retval = (void*)vl_copy_delay_control_stmt((vl_delay_control_stmt *)stmt);
+	break;
+    case EventControlStmt:
+	retval = (void*)vl_copy_event_control_stmt((vl_event_control_stmt *)stmt);
+	break;
+    case AssignStmt:
+    case BassignStmt:
+    case NbassignStmt:
+    case DelayBassignStmt:
+    case DelayNbassignStmt:
+    case EventBassignStmt:
+    case EventNbassignStmt:
+	retval = (void*)vl_copy_bassign_stmt((vl_bassign_stmt *)stmt);
+	break;
+    case WaitStmt:
+	retval = (void*)vl_copy_wait_stmt((vl_wait_stmt *)stmt);
+	break;
+    case ForkJoinStmt:
+	retval = (void*)vl_copy_fork_join_stmt((vl_fork_join_stmt *)stmt);
+	break;
+    case TaskEnableStmt:
+    case SysTaskEnableStmt:
+	retval = (void*)vl_copy_task_enable_stmt((vl_task_enable_stmt *)stmt);
+	break;
+    case DisableStmt:
+	retval = (void*)vl_copy_disable_stmt((vl_disable_stmt *)stmt);
+	break;
+    case DeassignStmt:
+	retval = (void*)vl_copy_deassign_stmt((vl_deassign_stmt *)stmt);
+	break;
+    case SendEventStmt:
+	retval = (void*)vl_copy_id_range(((vl_send_event_stmt *)stmt)->name);
+	break;
+    default: {
+	char msg[MAXSTRLEN];
+	sprintf(msg, "vl_copy_stmt:Unexpected Statement Type %d",
+		((vl_bassign_stmt *)stmt)->type);
+	internal_error(msg);
+    }
+    }
+
+    return retval;
+}
+
+void *vl_copy_decl (void *decl)
+{
+    void *retval=NIL(void);
+
+    switch(((vl_decl *)decl)->type) {
+    case RealDecl:    case EventDecl:
+    case IntDecl:     case TimeDecl:
+	retval = (void*)vl_copy_basicdecl((vl_decl *)decl);
+	break;
+
+    case InputDecl:    case OutputDecl:
+    case InoutDecl:    case RegDecl:
+	retval = (void*)vl_copy_rangedecl((vl_rangedecl *)decl);
+	break;
+    case ParamDecl:    case DefparamDecl:
+	retval = (void*)vl_copy_paramdecl((vl_paramdecl *)decl);
+	break;
+    case WireDecl:	case TriDecl:
+    case Tri0Decl:	case Tri1Decl:
+    case Supply0Decl:   case Supply1Decl:
+    case WandDecl:	case TriandDecl:
+    case WorDecl:	case TriorDecl:
+    case TriregDecl:
+	retval = (void*)vl_copy_netdecl((vl_netdecl *)decl);
+	break;
+    default:
+	internal_error("Unexprected Declaration Type");
+	break;
+    }
+
+    return retval;
+}
+
+vl_cont_assign *vl_copy_cont_assign (vl_cont_assign *assign)
+{
+    vl_cont_assign *retval;
+
+    retval = (vl_cont_assign*)chk_malloc(sizeof(vl_cont_assign));
+    retval->type = ContAssign;
+    retval->strength = vl_copy_strength(assign->strength);
+    retval->delay = vl_copy_delay(assign->delay);
+    retval->assigns = vl_copy_net_list(assign->assigns);
+
+    return retval;
+}
+
+vl_id_range *vl_copy_id_range_rec(vl_id_range *id_range)
+{
+    vl_id_range *retval;
+
+    CpyTRACE("Copying id_range\n");
+    retval = (vl_id_range *)chk_malloc(sizeof(vl_id_range));
+    retval->name = vlStrdup(id_range->name);
+    retval->flags = id_range->flags;
+    retval->range = vl_copy_range(id_range->range);
+    retval->initial = lsCreate();
+    retval->syndrome_expr_list = id_range->syndrome_expr_list;
+    retval->rst_syndrome_expr_list = id_range->rst_syndrome_expr_list;
+    retval->mpg_master_exp = id_range->mpg_master_exp;
+    retval->id_type = id_range->id_type;
+    return(retval);
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_copy.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_copy.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_copy.h	(revision 18)
@@ -0,0 +1,95 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_copy.h,v 1.1.1.1 2001/07/09 23:22:42 fabio Exp $
+
+
+*/
+
+
+#ifndef VL_COPY_H
+#define VL_COPY_H
+
+
+
+
+EXTERN vl_module* vl_copy_module ARGS((vl_module *));
+EXTERN vl_primitive* vl_copy_primitive ARGS((vl_primitive *));
+EXTERN lsList vl_copy_prim_table ARGS((short, lsList));
+EXTERN vl_decl* vl_copy_basicdecl ARGS((vl_decl *));
+EXTERN vl_decl* vl_copy_arr_decl ARGS((FILE *, vl_decl *));
+EXTERN vl_rangedecl* vl_copy_rangedecl ARGS((vl_rangedecl *));
+EXTERN vl_paramdecl* vl_copy_paramdecl ARGS((vl_paramdecl *));
+EXTERN vl_netdecl* vl_copy_netdecl ARGS((vl_netdecl *));
+EXTERN vl_task* vl_copy_task ARGS((vl_task *));
+EXTERN vl_function* vl_copy_function ARGS((vl_function *));
+EXTERN vl_gate_inst_list* vl_copy_gate_inst_list ARGS((vl_gate_inst_list *));
+EXTERN lsList vl_copy_gates ARGS((lsList));
+EXTERN vl_mod_prim_inst_list* vl_copy_prim_inst_list ARGS((vl_mod_prim_inst_list *));
+EXTERN lsList vl_copy_prims ARGS((lsList));
+EXTERN vl_mod_prim_inst_list* vl_copy_mod_inst_list ARGS((vl_mod_prim_inst_list *));
+EXTERN lsList vl_copy_mod_insts ARGS((lsList));
+EXTERN vl_procstmt* vl_copy_procstmt ARGS((vl_procstmt *));
+EXTERN vl_begin_end_stmt* vl_copy_begin_end_stmt ARGS((vl_begin_end_stmt *));
+EXTERN vl_if_else_stmt* vl_copy_if_else_stmt ARGS((vl_if_else_stmt *));
+EXTERN vl_case_stmt* vl_copy_case_stmt ARGS((vl_case_stmt *));
+EXTERN vl_forever_stmt* vl_copy_forever_stmt ARGS((vl_forever_stmt *));
+EXTERN vl_repeat_stmt* vl_copy_repeat_stmt ARGS((vl_repeat_stmt *));
+EXTERN vl_while_stmt* vl_copy_while_stmt ARGS((vl_while_stmt *));
+EXTERN vl_for_stmt* vl_copy_for_stmt ARGS((vl_for_stmt *));
+EXTERN vl_delay_control_stmt* vl_copy_delay_control_stmt ARGS((vl_delay_control_stmt *));
+EXTERN vl_event_control_stmt* vl_copy_event_control_stmt ARGS((vl_event_control_stmt *));
+EXTERN vl_bassign_stmt* vl_copy_bassign_stmt ARGS((vl_bassign_stmt *));
+EXTERN vl_wait_stmt* vl_copy_wait_stmt ARGS((vl_wait_stmt *));
+EXTERN vl_fork_join_stmt* vl_copy_fork_join_stmt ARGS((vl_fork_join_stmt *));
+EXTERN vl_task_enable_stmt* vl_copy_task_enable_stmt ARGS((vl_task_enable_stmt *));
+EXTERN vl_disable_stmt* vl_copy_disable_stmt ARGS((vl_disable_stmt *));
+EXTERN vl_deassign_stmt* vl_copy_deassign_stmt ARGS((vl_deassign_stmt *));
+EXTERN vl_case_item* vl_copy_case_item ARGS((vl_case_item *));
+EXTERN vl_event_expr* vl_copy_event_expr ARGS((vl_event_expr *));
+EXTERN vl_lval* vl_copy_lval ARGS((vl_lval *));
+EXTERN vl_expr* vl_copy_expr ARGS((vl_expr *));
+EXTERN lsList vl_copy_expr_list ARGS((lsList));
+EXTERN vl_range* vl_copy_range ARGS((vl_range *));
+EXTERN vl_delay* vl_copy_delay ARGS((vl_delay *));
+EXTERN lsList vl_copy_id_list ARGS((lsList));
+EXTERN lsList vl_copy_id_range_list ARGS((lsList));
+EXTERN lsList vl_copy_net_list ARGS((lsList));
+EXTERN void* vl_copy_net ARGS((void *));
+
+EXTERN lsList vl_copy_ports ARGS((lsList));
+EXTERN lsList vl_copy_mod_item_list ARGS((lsList));
+EXTERN void* vl_copy_mod_item ARGS((void *));
+EXTERN lsList vl_copy_decl_list ARGS((void *));
+EXTERN lsList vl_copy_stmt_list ARGS((void *));
+EXTERN int vl_copy_strength ARGS((int));
+EXTERN vl_mod_prim_inst* vl_copy_prim ARGS((vl_mod_prim_inst *));
+EXTERN vl_gate_inst* vl_copy_gate ARGS((vl_gate_inst *));
+EXTERN lsList vl_copy_param_vals ARGS((lsList));
+EXTERN vl_mod_prim_inst* vl_copy_modinst ARGS((vl_mod_prim_inst *));    
+EXTERN void* vl_copy_stmt ARGS((void *));
+EXTERN void* vl_copy_decl ARGS((void *));
+EXTERN vl_cont_assign* vl_copy_cont_assign ARGS((vl_cont_assign *));
+
+EXTERN vl_port* vl_copy_port ARGS((vl_port *));
+EXTERN lsList vl_copy_connects ARGS((lsList));
+EXTERN vl_port_connect* vl_copy_port_connect ARGS((vl_port_connectPtr));
+EXTERN vl_id_range *vl_copy_id_range_rec ARGS((vl_id_range *));
+#endif 
Index: vis_dev/vl2mv-2.3/src/parser/vl_create.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_create.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_create.c	(revision 18)
@@ -0,0 +1,1396 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_create.c,v 1.3 2009/03/09 20:25:57 fabio Exp $
+
+
+*/
+
+
+#include "util.h"
+#include "list.h"
+#include "st.h"
+#include "set.h"
+#include "array.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "verilog.h"
+
+extern int yylineno;
+extern int task_mode;
+extern int aliasSP;
+extern st_table *aliasStack[];
+extern int use_libraryGate;
+
+vl_descPtr mod_list;
+static int CreTrace = 0;
+
+static int bstr_to_i ARGS((char *str));
+
+vl_desc *vl_create_desc(char *filename)
+{
+    vl_descPtr desc;
+
+    CreTRACE("Creating Description\n");
+    desc = (vl_descPtr)chk_malloc(sizeof(vl_desc));
+    desc->filename = filename;
+    desc->type_st = st_init_table(strcmp, st_strhash);
+    desc->modules = lsCreate();
+    desc->mp_st = st_init_table(strcmp, st_strhash);
+    desc->decl_st = st_init_table(ptrcmp, ptrhash);
+    desc->lib_st = st_init_table(strcmp, st_strhash);
+    desc->mp_undefined = set_empty();
+    desc->fg_vars_st = st_init_table(ptrcmp, ptrhash);
+    desc->handle = (lsHandle)0;
+    desc->mod_holes = st_init_table(strcmp, st_strhash);
+    desc->synclock_st = st_init_table(strcmp, st_strhash);
+    return desc;
+}
+
+vl_type *vl_create_typedecl(char *type_name, struct vl_type_specifier *type_specifier)
+{
+    vl_type *retval;
+
+    retval = (vl_type*)chk_malloc(sizeof(vl_type));
+    retval->name = type_name;
+    retval->specifier = type_specifier;
+    st_insert(mod_list->type_st, type_name, (char*)retval);
+
+    return retval;
+}
+
+vl_type_specifier *vl_create_type_specifier(short typeform, vl_enum_type *type_spc)
+{
+    vl_type_specifier *retval;
+
+    retval = (vl_type_specifier*)chk_malloc(sizeof(vl_type_specifier));
+    retval->typeform = typeform;
+    switch(typeform) {
+    case EnumType: retval->u.enum_type = type_spc; break;
+    default: break;
+    }
+
+    return retval;
+}
+
+vl_enum_type *vl_create_enum_type(char *name, lsList elts_list)
+{
+    vl_enum_type *retval;
+    vl_enumerator *enum_elt;
+    lsGen gen;
+
+    retval = (vl_enum_type*)chk_malloc(sizeof(vl_enum_type));
+    retval->name = name;
+    retval->domain_list = elts_list;
+    retval->domain_st = st_init_table(strcmp, st_strhash);
+    for (gen=lsStart(elts_list);
+	 lsNext(gen, (lsGeneric*)&enum_elt, LS_NH)!=LS_NOMORE;) {
+	st_insert(retval->domain_st, enum_elt->name, (char*)enum_elt);
+    }
+    lsFinish(gen);
+
+    return retval;
+}
+
+vl_enumerator *vl_create_enumerator(char *enum_name, int enum_val)
+{
+    vl_enumerator *retval;
+
+    retval = (vl_enumerator*)chk_malloc(sizeof(vl_enumerator));
+    retval->name = enum_name;
+    retval->val = enum_val;
+
+    return retval;
+}
+
+vl_module *vl_create_module(vl_id_range *mod_name, lsList ports, lsList mod_items)
+{
+    vl_module *mod;
+    vl_module *clash_module;
+
+    CreTRACE("Creating module\n");
+    if (st_lookup(mod_list->mp_st, mod_name->name, (char**)&clash_module)) {
+	clash_module->type = ModDecl;
+	clash_module->flags = 0;
+	clash_module->ports = ports;
+	clash_module->mod_items = mod_items;
+	if (clash_module->inst_st) {
+	    clash_module->inst_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->param_st) {
+	    clash_module->param_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->sig_st) {
+	    clash_module->sig_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->latch_st) {
+	    clash_module->latch_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->quasi_st) {
+	    clash_module->quasi_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->func_st) {
+	    clash_module->func_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->uninit_set) {
+	    clash_module->uninit_set = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->combVar_st) {
+	    clash_module->combVar_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->seqVar_st) {
+	    clash_module->seqVar_st = st_init_table(strcmp, st_strhash);
+	}
+	if (clash_module->task_st) {
+	    clash_module->task_st = st_init_table(strcmp, st_strhash);
+	}
+	return clash_module;
+    }
+    mod = (vl_module *)chk_malloc(MAX(sizeof(vl_module),sizeof(vl_primitive)));
+    st_insert(mod_list->mp_st, mod_name->name, (char *)mod);
+    lsNewEnd(mod_list->modules, (char *)mod, LS_NH);
+    mod->type = ModDecl;
+    mod->flags = 0;
+    mod->name = mod_name;
+    mod->ports = ports;
+    mod->sig_st = st_init_table(strcmp, st_strhash);
+    mod->param_st = st_init_table(strcmp, st_strhash);
+    mod->param_list = lsCreate();
+    mod->inst_st = st_init_table(strcmp, st_strhash);
+    mod->latch_st = st_init_table(strcmp, st_strhash);
+    mod->quasi_st = st_init_table(strcmp, st_strhash);
+    mod->func_st = st_init_table(strcmp, st_strhash);
+    mod->uninit_set = st_init_table(strcmp, st_strhash);
+    mod->combVar_st = st_init_table(strcmp, st_strhash);
+    mod->seqVar_st = st_init_table(strcmp, st_strhash);
+    mod->mod_items = mod_items;
+    mod->clk = NIL(vl_event_expr);
+    mod->syndrome_width = 0;
+    mod->rst_syndrome_width = 0;
+    mod->flow_graphs = lsCreate();
+    mod->task_st = st_init_table(strcmp, st_strhash);
+    mod->dup_count = 0;
+    mod->visited = 0;
+    return(mod);
+}
+
+
+vl_primitive *vl_create_primitive(vl_id_range *prim_name, lsList ports,lsList  prim_decls, lsList prim_entries)
+{
+    vl_primitive *prim;
+    vl_primitive *clash_prim;
+
+    CreTRACE("Creating primitive\n");
+    if (st_lookup(mod_list->mp_st, prim_name->name, (char**)&clash_prim)) {
+	clash_prim->type = CombPrimDecl;
+	clash_prim->flags = 0;
+	clash_prim->ports = ports;
+	clash_prim->sig_st = st_init_table(strcmp, st_strhash);
+	clash_prim->uninit_set = st_init_table(strcmp, st_strhash);
+	clash_prim->decls = prim_decls;
+	clash_prim->entries = prim_entries;
+	clash_prim->handle = (lsHandle)0;
+	return clash_prim;
+    }
+    prim = (vl_primitive *)chk_malloc(sizeof(vl_primitive));
+	st_insert(mod_list->mp_st, prim_name->name, (char *)prim);
+    prim->type = CombPrimDecl;
+    prim->flags = 0;
+    prim->name = prim_name;
+    prim->ports = ports;
+    prim->sig_st = st_init_table(strcmp, st_strhash);
+    prim->uninit_set = st_init_table(strcmp, st_strhash);
+    prim->decls = prim_decls;
+    prim->entries = prim_entries;
+    prim->handle = (lsHandle)0;
+    return(prim);
+}
+
+vl_port *vl_create_port(short type, vl_id_range *id, lsList exprs)
+{
+    vl_port *port;
+
+    CreTRACE("Creating Port\n");
+    port = (vl_port *)chk_malloc(sizeof(vl_port));
+    port->type = type;
+    port->id = id;
+    port->port_exp = exprs;
+    return port;
+}
+
+vl_port_connect *vl_create_port_connect(short type, vl_id_range *id, vl_expr *expr)
+{
+    vl_port_connect *port_connect;
+
+    CreTRACE("Creating Port Connect\n");
+    port_connect = (vl_port_connect *)chk_malloc(sizeof(vl_port_connect));
+    port_connect->type = type;
+    port_connect->id = id;
+    port_connect->expr = expr;
+    return port_connect;
+}
+
+vl_prim_entry *vl_create_prim_entry(lsList inputs, unsigned char state,
+				    unsigned char output)
+{
+    vl_prim_entry *entry;
+    lsGen gen;
+    unsigned int insym;
+    int i = 0;
+
+    CreTRACE("Creating primitive entry");
+    entry = (vl_prim_entry *)chk_malloc(sizeof(vl_prim_entry));
+    entry->state = state;
+    entry->next_state = output;
+    for (gen = lsStart(inputs);
+	 i<MAXINLEN && lsNext(gen, &insym, LS_NH)!=LS_NOMORE; ) {
+	    entry->inputs[i++] = insym;
+    }
+    return entry;
+}
+
+
+vl_decl *vl_create_basicdecl(short type, lsList ids)
+{
+    vl_decl *decl;
+
+    CreTRACE("Creating Basic decl\n");
+    decl = (vl_decl *)chk_malloc(sizeof(vl_decl));
+    decl->type = type;
+    decl->flags = 0;
+    decl->ids = ids;
+    decl->handle = (lsHandle)0;
+    if (type == EventDecl) vl_create_rangedecl(NIL(vl_type), type,
+					       NIL(vl_range), ids, 0);
+
+    return(decl);
+}
+
+vl_rangedecl *vl_create_rangedecl(vl_type *var_type, short type, vl_range
+				  *range, lsList ids, int mv)
+{
+    vl_rangedecl *decl;
+    lsGen gen;
+    char *id, *dummy;
+    char *idname;
+
+    CreTRACE("Creating Range decl\n");
+    decl = (vl_rangedecl *)chk_malloc(sizeof(vl_rangedecl));
+    decl->type = type;
+    decl->flags = (type==InputDecl)?InPort:(type==OutputDecl)?OutPort:
+		  (type==InoutDecl)?(InPort|OutPort):RegVar;
+    decl->flags |= mv;
+    decl->range = range;
+    decl->ids = ids;
+    decl->handle = (lsHandle)0;
+
+    if (var_type) {
+	switch(var_type->specifier->typeform) {
+	case EnumType: decl->flags |= MVar; break;
+	default: semantic_error("can not handle types other than enum");
+	}
+    }
+
+
+    if (task_mode &&
+	(type==InputDecl || type==OutputDecl || type==InoutDecl))
+	return decl;
+
+
+    gen = lsStart(ids);
+    while (lsNext(gen, &id, LS_NH) != LS_NOMORE) {
+	if (var_type) ((vl_id_range *)id)->id_type = var_type;
+	((vl_id_range *)id)->mpg_master_exp = decl;
+	((vl_id_range *)id)->flags |= (mv | decl->flags);
+	idname = ((vl_id_range *)id)->name;
+
+	if (type==EventDecl) ((vl_id_range*)id)->flags |= EventVar;
+
+	if (vl_currentModule != NIL(vl_module)) {
+	    if (!st_lookup(SIG_ST(vl_currentModule), idname, &dummy)) {
+		st_insert(SIG_ST(vl_currentModule), idname, id);
+		dummy = id;
+	    } else {
+		((vl_id_range*)dummy)->flags |= mv;
+		((vl_id_range*)dummy)->flags |= decl->flags;
+		if (!(((vl_id_range*)dummy)->range))
+		    ((vl_id_range*)dummy)->range = ((vl_id_range*)id)->range;
+		if (!((vl_id_range*)dummy)->id_type)
+		    ((vl_id_range*)dummy)->id_type =
+			((vl_id_range*)id)->id_type;
+		if (!get_decl_range(((vl_id_range*)dummy)->mpg_master_exp)) {
+		    void *new_decl;
+		    new_decl = chng_decl_range(((vl_id_range*)dummy)->mpg_master_exp,
+					       range);
+		    if (new_decl && range) {
+			lsNewEnd(((vl_netdecl*)new_decl)->ids, dummy, 0);
+			((vl_id_range*)dummy)->mpg_master_exp = new_decl;
+		    }
+		}
+	    }
+	} else if (vl_currentPrimitive != NIL(vl_primitive)) {
+	    if (!st_lookup(vl_currentPrimitive->sig_st, idname, &dummy)) {
+		st_insert(vl_currentPrimitive->sig_st, idname, id);
+		dummy = id;
+	    } else {
+		((vl_id_range*)dummy)->flags |= mv;
+		((vl_id_range*)dummy)->flags |= decl->flags;
+		if (!(((vl_id_range*)dummy)->range))
+		    ((vl_id_range*)dummy)->range = ((vl_id_range*)id)->range;
+		if (!((vl_id_range*)dummy)->id_type)
+		    ((vl_id_range*)dummy)->id_type =
+			((vl_id_range*)id)->id_type;
+	    }
+	} else
+	    compile_error("declaring signal not within module/primitive");
+
+
+
+	if (vl_currentFunction) {
+	    if (type==OutputDecl) {
+		char buf[MAXSTRLEN];
+		sprintf(buf, "function %s can not have output port %s",
+			vl_currentFunction->name->name, idname);
+		yylineno = -1;
+		compile_error(buf);
+	    }
+
+	    if (type==InputDecl) {
+		lsNewEnd(vl_currentFunction->ports, (lsGeneric)dummy, 0);
+	    }
+	}
+    }
+    lsFinish(gen);
+
+    return(decl);
+}
+
+vl_paramdecl *vl_create_paramdecl(short type, lsList assigns)
+{
+    vl_paramdecl *decl;
+    lsGen gen;
+    vl_bassign_stmt *assign;
+    char *dummy;
+    int val;
+
+    CreTRACE("Creating Parameter decl\n");
+    decl = (vl_paramdecl *)chk_malloc(sizeof(vl_paramdecl));
+    decl->type = type;
+    decl->flags = 0;
+    decl->assigns = assigns;
+    decl->handle = (lsHandle)0;
+
+    for (gen=lsStart(assigns); lsNext(gen, &assign, LS_NH) != LS_NOMORE; ) {
+	val = vl_eval_expr(assign->rhs);
+	assign->lhs->name->mpg_master_exp = (void*) val;
+	if (st_lookup(vl_currentModule->param_st,
+		      assign->lhs->name->name, &dummy)) {
+	    char buf[MAXSTRLEN];
+	    sprintf(buf, "%s:duplicated parameter declaration - %s",
+		    vl_currentModule->name->name, assign->lhs->name->name);
+	    yylineno = -1;
+	    compile_error(buf);
+	}
+	lsNewEnd(vl_currentModule->param_list, assign->lhs->name->name, 0);
+	st_insert(vl_currentModule->param_st,
+		  assign->lhs->name->name, assign->lhs->name);
+    }
+    lsFinish(gen);
+
+    return(decl);
+}
+
+vl_netdecl *vl_create_netdecl(vl_type *var_type, short type, int strength, vl_range *range, vl_delay *delay, lsList ids)
+{
+    vl_netdecl *decl;
+    lsGen gen;
+    vl_id_range *id;
+    vl_id_range *id_sym;
+
+    CreTRACE("Creating Net decl\n");
+    decl = (vl_netdecl *)chk_malloc(sizeof(vl_netdecl));
+    decl->type = type;
+    decl->flags = 0;
+    decl->strength = strength;
+    decl->range = range;
+    decl->delay = delay;
+    decl->ids = ids;
+    decl->handle = (lsHandle)0;
+
+    if (var_type) {
+	switch(var_type->specifier->typeform) {
+	case EnumType: decl->flags |= MVar; break;
+	default: semantic_error("can not handle types other than enum");
+	}
+    }
+
+
+    gen = lsStart(ids);
+    while (lsNext(gen, &id, LS_NH) != LS_NOMORE) {
+	id->mpg_master_exp = decl;
+	id->flags |= decl->flags;
+	if (var_type) id->id_type = var_type;
+
+	if (vl_currentModule != NIL(vl_module)) {
+	    if (!st_lookup(SIG_ST(vl_currentModule), id->name, &id_sym))
+		st_insert(SIG_ST(vl_currentModule), id->name, id);
+	    else {
+		id_sym->flags |= decl->flags;
+		if (!id_sym->range)
+		    id_sym->range = id->range;
+		if (!id_sym->id_type)
+		    id_sym->id_type = id->id_type;
+		if (!get_decl_range(id_sym->mpg_master_exp)) {
+		    void *new_decl;
+		    new_decl = chng_decl_range(id_sym->mpg_master_exp, range);
+		    if (new_decl && range) {
+			lsNewEnd(((vl_netdecl*)new_decl)->ids, id_sym, 0);
+			id_sym->mpg_master_exp = new_decl;
+		    }
+		}
+	    }
+	} else if (vl_currentPrimitive != NIL(vl_primitive)) {
+	    if (!st_lookup(vl_currentPrimitive->sig_st, id->name, &id_sym))
+		st_insert(vl_currentPrimitive->sig_st, id->name, id);
+	    else {
+		id_sym->flags |= decl->flags;
+		if (!id_sym->range)
+		    id_sym->range = id->range;
+		if (!id_sym->id_type)
+		    id_sym->id_type = id->id_type;
+	    }
+	} else
+	    compile_error("declaring signal not within module/primitive");
+    }
+    lsFinish(gen);
+
+    return(decl);
+}
+
+vl_netdecl *vl_create_netdecl_assigned(vl_type *var_type, short type, int strength, vl_range *range, vl_delay *delay, lsList assignments)
+{
+    vl_netdecl *decl;
+    lsGen gen;
+    vl_id_range *id;
+    vl_id_range *id_sym;
+    lsList ids;
+
+    CreTRACE("Creating Net decl\n");
+    decl = (vl_netdecl *)chk_malloc(sizeof(vl_netdecl));
+    decl->type = type;
+    decl->flags = 0;
+    decl->strength = strength;
+    decl->range = range;
+    decl->delay = delay;
+    decl->ids = assignments;
+    decl->handle = (lsHandle)0;
+    ids = get_lhs_ids(assignments);
+    if (var_type) {
+	switch(var_type->specifier->typeform) {
+	case EnumType: decl->flags |= MVar; break;
+	default: semantic_error("can not handle types other than enum");
+	}
+    }
+
+
+    gen = lsStart(ids);
+    while (lsNext(gen, (lsGeneric*)&id, LS_NH) != LS_NOMORE) {
+	id->mpg_master_exp = decl;
+	id->flags |= decl->flags;
+	if (var_type) id->id_type = var_type;
+
+	if (vl_currentModule != NIL(vl_module)) {
+	    if (!st_lookup(SIG_ST(vl_currentModule), id->name, &id_sym))
+		st_insert(SIG_ST(vl_currentModule), id->name, id);
+	    else {
+		id_sym->flags |= decl->flags;
+		if (!id_sym->range)
+		    id_sym->range = id->range;
+		if (!id_sym->id_type)
+		    id_sym->id_type = id->id_type;
+	    }
+	} else if (vl_currentPrimitive != NIL(vl_primitive)) {
+	    if (!st_lookup(vl_currentPrimitive->sig_st, id->name, &id_sym))
+		st_insert(vl_currentPrimitive->sig_st, id->name, id);
+	    else {
+		id_sym->flags |= decl->flags;
+		if (!id_sym->range)
+		    id_sym->range = id->range;
+		if (!id_sym->id_type)
+		    id_sym->id_type = id->id_type;
+	    }
+	} else
+	    compile_error("declaring signal not within module/primitive");
+    }
+    lsFinish(gen);
+
+    return(decl);
+}
+
+
+vl_task *vl_create_task(vl_id_range *name, lsList decls, lsList stmts)
+{
+    vl_task *task;
+    lsGen gen, id_gen;
+    vl_rangedecl *decl;
+    vl_id_range *id;
+
+    CreTRACE("Creating Task\n");
+    task = (vl_task *)chk_malloc(sizeof(vl_task));
+    task->type = TaskDecl;
+    task->flags = 0;
+    task->name = name;
+    task->decls = decls;
+    task->stmts = stmts;
+    task->handle = (lsHandle)0;
+    task->io_lst = lsCreate();
+    task->sig_st = st_init_table(strcmp, st_strhash);
+    for (gen=lsStart(decls);
+	 lsNext(gen, &decl, LS_NH) != LS_NOMORE; ) {
+	if (decl->ids) {
+	    for (id_gen=lsStart(decl->ids);
+		 lsNext(id_gen, &id, LS_NH) != LS_NOMORE; ) {
+
+		st_insert(task->sig_st, id->name, id->name);
+		if (decl->type == InputDecl || decl->type == OutputDecl)
+		    lsNewEnd(task->io_lst, id->name, 0);
+	    }
+	    lsFinish(id_gen);
+	}
+    }
+    lsFinish(gen);
+    st_insert(vl_currentModule->task_st, name->name, task);
+    return(task);
+}
+
+vl_function *vl_create_function(short type, vl_range *range, vl_id_range *name, lsList decls, lsList stmts)
+{
+    vl_function *func;
+
+    CreTRACE("Creating Function\n");
+    func = (vl_function *)chk_malloc(sizeof(vl_function));
+    func->type = type;
+    func->flags = 0;
+    func->range = range;
+    func->name = name;
+    func->decls = decls;
+    func->stmts = stmts;
+    func->ports = lsCreate();
+    func->sig_st = st_init_table(strcmp, st_strhash);
+    func->uninit_set = st_init_table(strcmp, st_strhash);
+    func->handle = (lsHandle)0;
+    func->param_st = st_init_table(strcmp, st_strhash);
+    return(func);
+}
+
+vl_gate_inst_list *vl_create_gate_inst_list(short type, int strength, vl_delay *delays, lsList gates)
+{
+    vl_gate_inst_list *gatelist;
+
+    CreTRACE("Creating Gate Instance List\n");
+    gatelist = (vl_gate_inst_list *)chk_malloc(sizeof(vl_gate_inst_list));
+    gatelist->type = type;
+    gatelist->flags = 0;
+    gatelist->strength = strength;
+    gatelist->delays = delays;
+    gatelist->gates = gates;
+    gatelist->handle = (lsHandle)0;
+    return(gatelist);
+}
+
+vl_gate_inst *vl_create_gate_inst(vl_id_range *name, lsList terms)
+{
+    vl_gate_inst *gate;
+
+    use_libraryGate = 1;
+
+    CreTRACE("Creating Gate Instance\n");
+    gate = (vl_gate_inst *)chk_malloc(sizeof(vl_gate_inst));
+    gate->name = name;
+    gate->terms = terms;
+    gate->handle = (lsHandle)0;
+    return(gate);
+}
+
+typestruct *vl_add_find_mod_prim_instances(vl_id_range *mp_name, vl_delay *delay, int strength, lsList instances)
+{
+    char *mod_pri;
+    typestructPtr retval=NULL;
+    int still_unknown=0;
+
+    if (!st_lookup(vl_description->mp_st, mp_name->name, &mod_pri)) {
+	still_unknown = 1;
+    } else if (mod_pri == NIL(char)) {
+	still_unknown = 1;
+    }
+
+    if (still_unknown) {
+
+
+
+	mod_pri = (char*)vl_create_module(mp_name, LS_NIL, LS_NIL);
+	st_insert(mod_list->mp_st, mp_name->name, mod_pri);
+	retval = (typestructPtr)vl_create_mod_prim_inst_list(mp_name,
+				    strength, delay, instances);
+	set_add(mp_name->name, mod_list->mp_undefined);
+	return retval;
+    } else {
+	if (((typestructPtr)mod_pri)->type == ModDecl) {
+	    if (strength!=0)
+		compile_error("redundant strength for module instance");
+	    retval = (typestructPtr)vl_create_mod_prim_inst_list(mp_name,
+					strength, delay, instances);
+	    ((vl_mod_prim_inst_listPtr)retval)->type = ModInst;
+	} else if (((typestructPtr)mod_pri)->type == CombPrimDecl ||
+		   ((typestructPtr)mod_pri)->type == SeqPrimDecl) {
+	    retval = (typestructPtr)vl_create_mod_prim_inst_list(mp_name,
+					strength, delay, instances);
+	    ((vl_mod_prim_inst_listPtr)retval)->type = PrimInst;
+	} else {
+	    compile_error("unknown module/primitive");
+	}
+    }
+
+    return retval;
+}
+
+
+vl_mod_prim_inst_list *vl_create_mod_prim_inst_list(vl_id_range *name, int strength, vl_delay *delays, lsList mps)
+{
+    vl_mod_prim_inst_list *mplist;
+
+    CreTRACE("Creating Module/Primitive Instance List\n");
+    mplist = (vl_mod_prim_inst_list *)chk_malloc(sizeof(vl_mod_prim_inst_list));
+    mplist->type = ModInst;
+    mplist->flags = 0;
+    mplist->name = name;
+    mplist->strength = strength;
+    mplist->delays = delays;
+    mplist->mps = mps;
+    mplist->handle = (lsHandle)0;
+    return(mplist);
+}
+
+vl_mod_prim_inst *vl_create_mod_prim_inst(vl_id_range *name,
+					  lsList ports)
+{
+    vl_mod_prim_inst *mp;
+
+    CreTRACE("Creating Primitive Instance\n");
+    mp = (vl_mod_prim_inst *)chk_malloc(sizeof(vl_mod_prim_inst));
+    mp->name = name;
+    mp->ports = ports;
+    mp->handle = (lsHandle)0;
+    return(mp);
+}
+
+
+vl_procstmt *vl_create_procstmt(short type, void *stmt)
+{
+    vl_procstmt *pstmt;
+
+    CreTRACE("Creating Process stmt\n");
+    pstmt = (vl_procstmt *)chk_malloc(sizeof(vl_procstmt));
+    pstmt->type = type;
+    pstmt->flags = 0;
+    pstmt->stmt = stmt;
+    pstmt->pc = vl_create_symbolic_var(vlStrdup(new_pc()));
+    pstmt->fg_info = NIL(char);
+    return(pstmt);
+}
+
+vl_begin_end_stmt *vl_create_begin_end_stmt(vl_id_range *name, void *decls, void *stmts)
+{
+    vl_begin_end_stmt *bestmt;
+
+    CreTRACE("Creating beginend\n");
+    bestmt = (vl_begin_end_stmt *)chk_malloc(sizeof(vl_begin_end_stmt));
+    bestmt->type = BeginEndStmt;
+    bestmt->flags = 0;
+    bestmt->name = name;
+    bestmt->decls = decls;
+    bestmt->stmts = stmts;
+    bestmt->handle = (lsHandle)0;
+    return(bestmt);
+}
+
+vl_if_else_stmt *vl_create_if_else_stmt(vl_expr *cond, void *if_stmt, void *else_stmt)
+{
+    vl_if_else_stmt *stmt;
+
+    CreTRACE("Creating if_else_stmt\n");
+    stmt = (vl_if_else_stmt *)chk_malloc(sizeof(vl_if_else_stmt));
+    stmt->type = IfElseStmt;
+    stmt->flags = 0;
+    stmt->cond = cond;
+    stmt->if_stmt = if_stmt;
+    stmt->else_stmt = else_stmt;
+    stmt->handle = (lsHandle)0;
+    return(stmt);
+}
+
+vl_case_stmt *vl_create_case_stmt(short type, vl_expr *cond, lsList case_items)
+{
+    vl_case_stmt *stmt;
+
+    CreTRACE("Creating case_stmt\n");
+    stmt = (vl_case_stmt *)chk_malloc(sizeof(vl_case_stmt));
+    stmt->type = type;
+    stmt->flags = 0;
+    stmt->cond = cond;
+    stmt->case_items = case_items;
+    stmt->handle = (lsHandle)0;
+    return(stmt);
+}
+
+vl_forever_stmt *vl_create_forever_stmt(void *stmt)
+{
+    vl_forever_stmt *fstmt;
+
+    CreTRACE("Creating forever_stmt\n");
+    fstmt = (vl_forever_stmt *)chk_malloc(sizeof(vl_forever_stmt));
+    fstmt->type = ForeverStmt;
+    fstmt->flags = 0;
+    fstmt->stmt = stmt;
+    fstmt->handle = (lsHandle)0;
+    return(fstmt);
+}
+
+vl_repeat_stmt *vl_create_repeat_stmt( vl_expr *count, void *stmt)
+{
+    vl_repeat_stmt *rstmt;
+
+    CreTRACE("Creating repeat_stmt\n");
+    rstmt = (vl_repeat_stmt *)chk_malloc(sizeof(vl_repeat_stmt));
+    rstmt->type = RepeatStmt;
+    rstmt->flags = 0;
+    rstmt->count = count;
+    rstmt->stmt = stmt;
+    rstmt->handle = (lsHandle)0;
+    return(rstmt);
+}
+
+vl_while_stmt *vl_create_while_stmt(vl_expr *cond, void *stmt)
+{
+    vl_while_stmt *wstmt;
+
+    CreTRACE("Creating while_stmt\n");
+    wstmt = (vl_while_stmt *)chk_malloc(sizeof(vl_while_stmt));
+    wstmt->type = WhileStmt;
+    wstmt->flags = 0;
+    wstmt->cond = cond;
+    wstmt->stmt = stmt;
+    wstmt->handle = (lsHandle)0;
+    return(wstmt);
+}
+
+vl_for_stmt *vl_create_for_stmt(vl_bassign_stmt *init, vl_expr *cond, vl_bassign_stmt *end, void *stmt)
+{
+    vl_for_stmt *fstmt;
+
+    CreTRACE("Creating for_stmt\n");
+    fstmt = (vl_for_stmt *)chk_malloc(sizeof(vl_for_stmt));
+    fstmt->type = ForStmt;
+    fstmt->flags = 0;
+    fstmt->init = init;
+    fstmt->cond = cond;
+    fstmt->end = end;
+    fstmt->stmt = stmt;
+    fstmt->handle = (lsHandle)0;
+    return(fstmt);
+}
+
+vl_delay_control_stmt *vl_create_delay_control_stmt(vl_delay *delay, void *stmt)
+{
+    vl_delay_control_stmt *dcstmt;
+
+    CreTRACE("Creating delay_control_stmt\n");
+    dcstmt = (vl_delay_control_stmt *)chk_malloc(sizeof(vl_delay_control_stmt));
+    dcstmt->type = DelayControlStmt;
+    dcstmt->flags = 0;
+    dcstmt->delay = delay;
+    dcstmt->stmt = stmt;
+    dcstmt->fg_info = NIL(char);
+    return(dcstmt);
+}
+
+vl_event_control_stmt *vl_create_event_control_stmt(vl_event_expr *event, void *stmt)
+{
+    vl_event_control_stmt *ecstmt;
+
+    CreTRACE("Creating event_control_stmt\n");
+    ecstmt = (vl_event_control_stmt *)chk_malloc(sizeof(vl_event_control_stmt));
+    ecstmt->type = EventControlStmt;
+    ecstmt->flags = 0;
+    ecstmt->event = event;
+    ecstmt->stmt = stmt;
+    ecstmt->fg_info = NIL(char);
+    return(ecstmt);
+}
+
+
+vl_bassign_stmt *vl_create_bassign_stmt(short type, vl_lval *lhs, void *control, vl_expr *rhs)
+{
+    vl_bassign_stmt *bassign;
+
+    CreTRACE("Creating bassign_stmt\n");
+    bassign = (vl_bassign_stmt *)chk_malloc(sizeof(vl_bassign_stmt));
+    bassign->type = type;
+    bassign->flags = 0;
+    bassign->lhs = lhs;
+    bassign->control = control;
+    bassign->rhs = rhs;
+    bassign->lineno = yylineno;
+    bassign->fg_info = NIL(char);
+    return(bassign);
+}
+
+vl_cont_assign *vl_create_cont_assign_stmt(int strength, vl_delay *delay, lsList assigns)
+{
+    vl_cont_assign *cassign;
+
+    CreTRACE("Creating cont_assign");
+    cassign = (vl_cont_assign *)chk_malloc(sizeof(vl_cont_assign));
+    cassign->type = ContAssign;
+    cassign->flags = 0;
+    cassign->strength = strength;
+    cassign->delay = delay;
+    cassign->assigns = assigns;
+    return cassign;
+}
+
+vl_wait_stmt *vl_create_wait_stmt(vl_expr *cond, void *stmt)
+{
+    vl_wait_stmt *wstmt;
+
+    CreTRACE("Creating wait_stmt\n");
+    wstmt = (vl_wait_stmt *)chk_malloc(sizeof(vl_wait_stmt));
+    wstmt->type = WaitStmt;
+    wstmt->flags = 0;
+    wstmt->cond = cond;
+    wstmt->stmt = stmt;
+    wstmt->handle = (lsHandle)0;
+    return(wstmt);
+}
+
+vl_send_event_stmt *vl_create_send_event_stmt(vl_id_range *name)
+{
+    vl_send_event_stmt *send_event;
+
+    CreTRACE("creating send_event_stmt\n");
+    send_event = (vl_send_event_stmt*)chk_malloc(sizeof(vl_send_event_stmt));
+    send_event->type = SendEventStmt;
+    send_event->name = name;
+    send_event->fg_info = NIL(char);
+    return send_event;
+}
+
+vl_fork_join_stmt *vl_create_fork_join_stmt(vl_id_range *name, void *decls, void *stmts)
+{
+    vl_fork_join_stmt *fjstmt;
+
+    CreTRACE("Creating fork_join_stmt\n");
+    fjstmt = (vl_fork_join_stmt *)chk_malloc(sizeof(vl_fork_join_stmt));
+    fjstmt->type = ForkJoinStmt;
+    fjstmt->flags = 0;
+    fjstmt->name = name;
+    fjstmt->decls = decls;
+    fjstmt->stmts = stmts;
+    fjstmt->handle = (lsHandle)0;
+    return(fjstmt);
+}
+
+
+vl_task_enable_stmt *vl_create_task_enable_stmt(short type, vl_id_range *name, lsList args)
+{
+    vl_task_enable_stmt *testmt;
+
+    CreTRACE("Creating task_enable_stmt\n");
+    testmt = (vl_task_enable_stmt *)chk_malloc(sizeof(vl_task_enable_stmt));
+    testmt->type = type;
+    testmt->flags = 0;
+    testmt->name = name;
+    testmt->args = args;
+    testmt->handle = (lsHandle)0;
+    return(testmt);
+}
+
+vl_disable_stmt *vl_create_disable_stmt(vl_id_range *name)
+{
+    vl_disable_stmt *dstmt;
+
+    CreTRACE("Creating disable_stmt\n");
+    dstmt = (vl_disable_stmt *)chk_malloc(sizeof(vl_disable_stmt));
+    dstmt->type = DisableStmt;
+    dstmt->flags = 0;
+    dstmt->name = name;
+    dstmt->handle = (lsHandle)0;
+    return(dstmt);
+}
+
+vl_deassign_stmt *vl_create_deassign_stmt(vl_lval *lhs)
+{
+    vl_deassign_stmt *dstmt;
+
+    CreTRACE("Creating deassign_stmt\n");
+    dstmt = (vl_deassign_stmt *)chk_malloc(sizeof(vl_deassign_stmt));
+    dstmt->type = DeassignStmt;
+    dstmt->flags = 0;
+    dstmt->lhs = lhs;
+    dstmt->handle = (lsHandle)0;
+    return(dstmt);
+}
+
+vl_case_item *vl_create_case_item(short type, lsList expr, void *stmt)
+{
+    vl_case_item *item;
+
+    CreTRACE("Creating case_item\n");
+    item = (vl_case_item *)chk_malloc(sizeof(vl_case_item));
+    item->type = type;
+    item->flags = 0;
+    item->exprs = expr;
+    item->stmt = stmt;
+    item->handle = (lsHandle)0;
+    item->fg_info = NIL(char);
+    return(item);
+}
+
+vl_event_expr *vl_create_event_expr(short type, struct vl_expr *expr)
+{
+    vl_event_expr *event;
+
+    CreTRACE("Creating event_expr\n");
+    event = (vl_event_expr *)chk_malloc(sizeof(vl_event_expr));
+    event->type = type;
+    event->flags = 0;
+    event->expr = expr;
+    event->list = (lsList)0;
+    return(event);
+}
+
+vl_lval *vl_create_lval(short type, vl_id_range *name, vl_range *range,
+			lsList concat)
+{
+    vl_lval *lval;
+
+    CreTRACE("Creating lval\n");
+    lval = (vl_lval *)chk_malloc(sizeof(vl_lval));
+    lval->type = type;
+    lval->flags = 0;
+    lval->name = name;
+    lval->range = range;
+    lval->concat = concat;
+    return(lval);
+}
+
+vl_expr *vl_create_expr(short type, int intval, double realval, void *p1, void
+			*p2, void *p3)
+{
+    vl_expr *expr;
+
+    CreTRACE("Creating expr\n");
+    expr = (vl_expr *)chk_malloc(sizeof(vl_expr));
+    expr->type = type;
+    expr->flags = 0;
+    expr->fg_info1 = expr->fg_info2 = NIL(char);
+    expr->fg_aux1 = expr->fg_aux2 = NIL(char);
+    switch (type) {
+    case BitExpr:
+	expr->u.bexpr.part1 = (int)p1;
+	expr->u.bexpr.part0 = (int)p2;
+	expr->u.exprs.e3 = (vl_expr*)p3;
+	expr->u.intval = bstr_to_i(p3);
+	break;
+    case IntExpr:
+	expr->u.intval = intval;
+	break;
+    case RealExpr:
+	expr->u.realval = realval;
+	break;
+    case IDExpr:
+	expr->u.name = (vl_id_range *)p1;
+	break;
+    case BitSelExpr:    case PartSelExpr:
+	expr->u.idrng = (vl_id_range *)p1;
+	break;
+    case ConcatExpr:
+	expr->u.exprs.e1 = (vl_expr*)p1;
+	expr->u.exprs.e2 = (vl_expr*)p2;
+	expr->u.exprs.e3 = NIL(vl_expr);
+	break;
+    case MinTypMaxExpr:
+	expr->u.exprs.e1 = (vl_expr*)p1;
+	expr->u.exprs.e2 = (vl_expr*)p2;
+	expr->u.exprs.e3 = (vl_expr*)p3;
+	break;
+    case StringExpr:
+	expr->u.string = (char *)p1;
+	break;
+    case FuncExpr:
+	expr->u.func_call.name = (vl_id_range *)p1;
+	expr->u.func_call.args = (lsList)p2;
+	break;
+    case UplusExpr:    case UminusExpr:
+    case UnotExpr:    case UcomplExpr:
+
+    case UandExpr:    case UnandExpr:
+    case UorExpr:    case UnorExpr:
+    case UxorExpr:    case UxnorExpr:
+	expr->u.exprs.e1 = (vl_expr *)p1;
+	expr->u.exprs.e2 = NIL(vl_expr);
+	expr->u.exprs.e3 = NIL(vl_expr);
+	break;
+
+    case BplusExpr:    case BminusExpr:
+    case BtimesExpr:    case BdivExpr:
+    case BremExpr:    case Beq2Expr:
+    case Bneq2Expr:    case Beq3Expr:
+    case Bneq3Expr:    case BlandExpr:
+    case BlorExpr:    case BltExpr:
+    case BleExpr:   case BgtExpr:
+    case BgeExpr:    case BandExpr:
+    case BorExpr:    case BxorExpr:
+    case BxnorExpr:    case BlshiftExpr:
+    case BrshiftExpr:
+	expr->u.exprs.e1 = (vl_expr *)p1;
+	expr->u.exprs.e2 = (vl_expr *)p2;
+	expr->u.exprs.e3 = NIL(vl_expr);
+	break;
+
+    case TcondExpr:
+	expr->u.exprs.e1 = (vl_expr *)p1;
+	expr->u.exprs.e2 = (vl_expr *)p2;
+	expr->u.exprs.e3 = (vl_expr *)p3;
+	break;
+    case NondExpr: {
+	int i;
+	lsGen gen;
+	vl_expr *sexp;
+
+	for (gen=lsStart(p1), i=0;
+	     lsNext(gen, &sexp, LS_NH) != LS_NOMORE; i++) {
+	}
+	(void)lsFinish(gen);
+
+	expr->type = type;
+	expr->u.expr_list = (lsList)p1;
+
+	break;
+    }
+    }
+    return(expr);
+}
+
+
+vl_range *vl_create_range(vl_expr *left, vl_expr *right)
+{
+    vl_range *range;
+
+    CreTRACE("Creating range\n");
+    range = (vl_range *)chk_malloc(sizeof(vl_range));
+    range->left = left;
+    range->right = right;
+    return(range);
+}
+
+vl_delay *vl_create_delay(vl_expr *delay1, vl_expr *delay2, vl_expr *delay3)
+{
+    vl_delay *delay;
+
+    CreTRACE("Creating delay\n");
+    delay = (vl_delay *)chk_malloc(sizeof(vl_delay));
+    delay->delay1 = delay1;
+    delay->delay2 = delay2;
+    delay->delay3 = delay3;
+    return(delay);
+}
+
+
+
+vl_range_or_typePtr vl_create_range_or_type(short type, vl_rangePtr range)
+{
+    vl_range_or_typePtr rng_typ;
+
+    rng_typ = (vl_range_or_typePtr)chk_malloc(sizeof(vl_range_or_type));
+    rng_typ->type = type;
+    rng_typ->range = range;
+    return rng_typ;
+}
+
+
+vl_id_range *vl_create_id_range(char *name, vl_range *range)
+{
+    vl_id_range *id_range;
+
+    CreTRACE("Creating id_range\n");
+    id_range = (vl_id_range *)chk_malloc(sizeof(vl_id_range));
+    id_range->dummy_type = None;
+    id_range->name = name;
+    id_range->range = range;
+    id_range->flags = 0;
+    id_range->initial = lsCreate();
+    id_range->syndrome_expr_list = lsCreate();
+    id_range->rst_syndrome_expr_list = lsCreate();
+    id_range->symbolic_values = st_init_table(strcmp, st_strhash);
+    id_range->mpg_master_exp = NIL(void);
+    id_range->id_type = NIL(vl_type);
+    id_range->edge_trigger = NIL(vl_term);
+    id_range->sensitiveList = NIL(st_table);
+    id_range->unintType = NIL(char);
+    return(id_range);
+}
+
+vl_term *vl_create_term(vl_id_range *name, int lo, int hi)
+{
+    vl_term *term;
+
+    CreTRACE("Creating term\n");
+    term = (vl_term *)chk_malloc(sizeof(vl_term));
+    term->name = name;
+    term->flag = 0;
+    term->lo = lo;
+    term->hi = hi;
+    term->term_type = name->id_type;
+    return term;
+}
+
+
+vl_id_range *vl_copy_id_range(vl_id_range *id_range)
+{
+    vl_id_range *retval;
+    int i;
+    char *alias, *dummy;
+
+    CreTRACE("Copying id_range\n");
+    retval = (vl_id_range *)chk_malloc(sizeof(vl_id_range));
+
+    alias=id_range->name;
+    for (i=aliasSP-1; i>=0; i--) {
+	if (st_lookup(aliasStack[i], id_range->name, &dummy)) {
+	    alias = dummy;
+	    break;
+	}
+    }
+    retval->name = vlStrdup(alias);
+    retval->flags = id_range->flags;
+    retval->range = id_range->range;
+    retval->initial = lsCreate();
+    retval->syndrome_expr_list = id_range->syndrome_expr_list;
+    retval->rst_syndrome_expr_list = id_range->rst_syndrome_expr_list;
+    retval->mpg_master_exp = id_range->mpg_master_exp;
+    retval->id_type = id_range->id_type;
+    retval->unintType = id_range->unintType;
+    return(retval);
+}
+
+vl_term *vl_copy_term(vl_term *term)
+{
+    vl_term *retval;
+
+    CreTRACE("Copying term\n");
+    retval = (vl_term*)chk_malloc(sizeof(vl_term));
+    retval->name = vl_copy_id_range(term->name);
+    retval->flag = term->flag;
+    retval->lo = term->lo;
+    retval->hi = term->hi;
+    retval->term_type = term->term_type;
+    return retval;
+}
+
+var_info *copy_var_info(var_info *var)
+{
+    var_info *retval;
+
+    retval = (var_info*)chk_malloc(sizeof(var_info));
+    retval->id = vl_copy_id_range(var->id);
+    retval->current_terminal = vl_copy_term(var->current_terminal);
+    retval->cond_list = lsCopy(var->cond_list,0);
+    retval->extra = NIL(void);
+    return retval;
+}
+
+
+vl_term *create_rename_term(vl_id_range *id_range, char *newname, int lo, int hi)
+
+{
+    vl_id_range *new_id;
+    vl_term *new_term;
+
+    new_id = vl_copy_id_range(id_range);
+
+    new_id->name = vlStrdup(newname);
+    new_term = vl_create_term(new_id, lo, hi);
+    new_term->flag = get_decl_flags(id_range->mpg_master_exp);
+    return new_term;
+}
+
+var_info *create_var_info(vl_id_range *id, vl_term *term)
+{
+    var_info *retval;
+
+    retval = (var_info*)chk_malloc(sizeof(var_info));
+    retval->id = id;
+    retval->current_terminal = term;
+    retval->cond_list = lsCreate();
+    return retval;
+}
+
+
+
+void vl_free_id(vl_id_range * id)
+{
+/* #ifndef __linux__ */
+    if (id->name) vl_chk_free(id->name);
+/* #endif */
+    vl_chk_free((char*)id);
+}
+
+void vl_free_term(vl_term * term)
+{
+    if (term->name) vl_free_id(term->name);
+    vl_chk_free((char*)term);
+}
+
+void free_var_info(var_info *vinfo)
+{
+    if (vinfo->id) vl_free_id(vinfo->id);
+    if (vinfo->current_terminal) vl_free_term(vinfo->current_terminal);
+    vl_chk_free((char*)vinfo);
+}
+
+blif_latch *create_latch(vl_id_range *name, vl_term *input, vl_term *output)
+{
+    blif_latch *retval;
+
+    retval = (blif_latch*)chk_malloc(sizeof(blif_latch));
+    retval->name = name;
+    retval->inport = input;
+    retval->outport = output;
+    return retval;
+}
+
+syndrome_expr *create_syndrome_expr(char *synd, vl_term *expr, st_table *pre_cond, int fg_id)
+{
+    syndrome_expr *retval;
+
+    retval = (syndrome_expr*)chk_malloc(sizeof(syndrome_expr));
+    retval->syndrome = synd;
+    retval->expr = expr;
+    retval->pre_cond = pre_cond;
+    retval->fg_id = fg_id;
+    return retval;
+}
+
+const_term *create_const_term(vl_expr *const_expr, vl_term *term)
+{
+    const_term *retval;
+
+    retval = (const_term*)chk_malloc(sizeof(const_term));
+    retval->const_expr = const_expr;
+    retval->term = term;
+    return retval;
+}
+
+vl_term *typed_new_term(vl_type *type, vl_range *range, int lo, int hi)
+{
+    vl_term *retval;
+
+    retval = (vl_term*)chk_malloc(sizeof(vl_term));
+    retval = vl_create_term(vl_create_id_range(vlStrdup(new_termname()),range),
+			    lo, hi);
+    retval->name->id_type = type;
+    retval->term_type = type;
+    return retval;
+}
+
+vl_term *new_term(vl_range *range, int lo, int hi)
+{
+    vl_term *retval;
+
+    retval = (vl_term*)chk_malloc(sizeof(vl_term));
+    retval = vl_create_term(vl_create_id_range(vlStrdup(new_termname()),range),
+			    lo, hi);
+    return retval;
+}
+
+symbolic_var *vl_create_symbolic_var(char *var_name)
+{
+    symbolic_var *retval;
+
+    retval = (symbolic_var*)chk_malloc(sizeof(symbolic_var));
+    retval->name = var_name;
+    retval->values = set_empty();
+
+    return retval;
+}
+
+char *new_pc()
+{
+    static int pc_number = 0;
+    static char buf[MAXSTRLEN];
+
+    sprintf(buf, "%s%d", PC, pc_number++);
+    return buf;
+}
+
+lsList get_lhs_ids(lsList assignments)
+{
+    lsGen gen;
+    lsList retval;
+    vl_bassign_stmt *assignment;
+
+    retval = lsCreate();
+
+    gen = lsStart(assignments);
+    while (lsNext(gen, &assignment, LS_NH) != LS_NOMORE) {
+	lsNewEnd(retval, assignment->lhs->name, 0);
+    }
+    lsFinish(gen);
+
+    return retval;
+}
+
+static int bstr_to_i(char *str)
+{
+    int i, l;
+    int retval = 0;
+
+    l = strlen(str)-1;
+    for (i=0; i<=MIN(l,31); i++)
+	retval = (retval << 1) | ((str[i]=='1') || (str[i]=='?'));
+
+    return retval;
+}
+
+multi_concat *vl_create_mconcat(vl_expr *rep, lsList concat)
+{
+    multi_concat *retval;
+
+    retval = (multi_concat*)chk_malloc(sizeof(multi_concat));
+    retval->rep = rep;
+    retval->concat = concat;
+
+    return retval;
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_create.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_create.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_create.h	(revision 18)
@@ -0,0 +1,117 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_create.h,v 1.3 2009/03/09 20:25:57 fabio Exp $
+
+
+*/
+
+
+
+
+#ifndef VL_CREATE_H
+#define VL_CREATE_H
+
+#include "util.h"
+
+EXTERN vl_desc *vl_create_desc ARGS((char *));
+EXTERN vl_type *vl_create_typedecl ARGS((char *, vl_type_specifier *));
+EXTERN vl_type_specifier *vl_create_type_specifier ARGS((short, vl_enum_type*));
+EXTERN vl_enum_type *vl_create_enum_type ARGS((char *, lsList));
+EXTERN vl_enumerator *vl_create_enumerator ARGS((char *, int));
+EXTERN vl_module *vl_create_module ARGS((vl_id_range *,  lsList, lsList));
+EXTERN vl_module *vl_copy_rename_module ARGS((vl_module*, char*));
+EXTERN vl_primitive *vl_create_primitive ARGS((vl_id_range*, lsList, lsList, lsList));
+EXTERN vl_prim_entry *vl_create_prim_entry ARGS((lsList, unsigned char,
+						 unsigned char));
+EXTERN vl_decl *vl_create_basicdecl ARGS((short, lsList));
+EXTERN vl_rangedecl *vl_create_rangedecl ARGS((vl_type *, short, vl_range*, lsList, int));
+EXTERN vl_paramdecl *vl_create_paramdecl ARGS((short, lsList));
+EXTERN vl_netdecl *vl_create_netdecl ARGS((vl_type *, short, int, vl_range *, vl_delay *, lsList));
+EXTERN vl_netdecl *vl_create_netdecl_assigned ARGS((vl_type *, short, int, vl_range *, vl_delay *, lsList));
+EXTERN vl_task *vl_create_task ARGS((vl_id_range*, lsList, lsList));
+EXTERN vl_function *vl_create_function ARGS((short, vl_range *, vl_id_range*, lsList, lsList));
+EXTERN vl_gate_inst_list *vl_create_gate_inst_list ARGS((short, int, vl_delay *, lsList));
+EXTERN vl_gate_inst *vl_create_gate_inst ARGS((vl_id_range*, lsList));
+EXTERN vl_mod_prim_inst *vl_create_prim_inst ARGS((vl_id_range*, vl_expr*));
+EXTERN vl_procstmt *vl_create_procstmt ARGS((short, void*));
+EXTERN vl_begin_end_stmt *vl_create_begin_end_stmt ARGS((vl_id_range*, void*, void*));
+EXTERN vl_if_else_stmt *vl_create_if_else_stmt ARGS((vl_expr *, void *, void *else_));
+EXTERN vl_case_stmt *vl_create_case_stmt ARGS((short, vl_expr*, lsList));
+EXTERN vl_forever_stmt *vl_create_forever_stmt ARGS((void *));
+EXTERN vl_repeat_stmt *vl_create_repeat_stmt ARGS((vl_expr *, void *));
+EXTERN vl_while_stmt *vl_create_while_stmt ARGS((vl_expr *, void *));
+EXTERN vl_for_stmt *vl_create_for_stmt ARGS((vl_bassign_stmt *, vl_expr *, vl_bassign_stmt *, void *));
+EXTERN vl_delay_control_stmt *vl_create_delay_control_stmt ARGS((vl_delay *, void *));
+EXTERN vl_event_control_stmt *vl_create_event_control_stmt ARGS((vl_event_expr *, void *));
+EXTERN vl_cont_assign *vl_create_cont_assign_stmt ARGS((int, vl_delay *, lsList));
+EXTERN vl_bassign_stmt *vl_create_bassign_stmt ARGS((short, vl_lval *, void *, vl_expr *));
+EXTERN vl_wait_stmt *vl_create_wait_stmt ARGS((vl_expr *, void *));
+EXTERN vl_fork_join_stmt *vl_create_fork_join_stmt ARGS((vl_id_range*, void *, void *));
+EXTERN vl_task_enable_stmt *vl_create_task_enable_stmt ARGS((short, vl_id_range*, lsList));
+EXTERN vl_disable_stmt *vl_create_disable_stmt ARGS((vl_id_range*));
+EXTERN vl_deassign_stmt *vl_create_deassign_stmt ARGS((vl_lval *));
+EXTERN vl_case_item *vl_create_case_item ARGS((short, lsList, void *));
+EXTERN vl_event_expr *vl_create_event_expr ARGS((short, vl_expr *));
+EXTERN vl_lval *vl_create_lval ARGS((short, vl_id_range*, vl_range *, lsList));
+EXTERN vl_expr *vl_create_expr ARGS((short, int, double, void *, void *, void *));
+EXTERN vl_delay *vl_create_delay ARGS((vl_expr *, vl_expr *, vl_expr *));
+EXTERN vl_id_range*vl_create_id ARGS((char *));
+
+
+EXTERN vl_range_or_typePtr vl_create_range_or_type ARGS((short, vl_rangePtr));
+EXTERN vl_id_rangePtr vl_create_id_range ARGS((char*, vl_range*));
+EXTERN vl_rangePtr vl_create_range ARGS((vl_expr *, vl_expr *));
+EXTERN vl_port *vl_create_port ARGS((short, vl_id_range*, lsList));
+EXTERN vl_port_connect *vl_create_port_connect ARGS((short, vl_id_range*, vl_expr *));
+EXTERN vl_send_event_stmt *vl_create_send_event_stmt ARGS((vl_id_range*));
+EXTERN typestruct *vl_add_find_mod_prim_instances ARGS((vl_id_range*, vl_delay *, int, lsList));
+EXTERN vl_mod_prim_inst_list *vl_create_mod_prim_inst_list ARGS((vl_id_range*, int, vl_delay *, lsList));
+
+
+EXTERN vl_term *vl_create_term ARGS((vl_id_range*, int, int));
+EXTERN symbolic_var *vl_create_symbolic_var ARGS((char*));
+EXTERN char *new_pc ARGS(());
+EXTERN lsList get_lhs_ids ARGS((lsList));
+
+
+EXTERN blif_latch *create_latch ARGS((vl_id_range*, vl_term*, vl_term*));
+EXTERN vl_term *create_rename_term ARGS((vl_id_range*, char*, int, int));
+EXTERN syndrome_expr *create_syndrome_expr ARGS((char*, vl_term*, st_table*, int));
+EXTERN const_term *create_const_term ARGS((vl_expr*, vl_term*));
+EXTERN vl_term *new_term ARGS((vl_range*, int, int));
+EXTERN vl_term *typed_new_term ARGS((vl_type*, vl_range*, int, int));
+EXTERN multi_concat *vl_create_mconcat ARGS((vl_expr*, lsList));
+
+
+EXTERN vl_id_range *vl_copy_id_range ARGS((vl_id_range *));
+EXTERN vl_term *vl_copy_term ARGS((vl_term *));
+EXTERN var_info *copy_var_info ARGS((var_info*));
+EXTERN var_info *create_var_info ARGS((vl_id_range*, vl_term*));
+
+
+
+EXTERN void vl_free_id ARGS((vl_id_range*));
+EXTERN void vl_free_term ARGS((vl_term *));
+EXTERN void free_var_info ARGS((var_info*));
+EXTERN vl_mod_prim_inst *vl_create_mod_prim_inst ARGS((vl_id_range *name,
+						       lsList ports));
+
+#endif
Index: vis_dev/vl2mv-2.3/src/parser/vl_defs.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_defs.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_defs.h	(revision 18)
@@ -0,0 +1,505 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_defs.h,v 1.1.1.1 2001/07/09 23:22:42 fabio Exp $
+
+
+*/
+
+
+
+#define EnumType        1
+
+
+
+
+
+
+#define LastCellNum   	142
+
+#define None		0
+#define CombPrimDecl	1
+#define SeqPrimDecl	2
+#define ModDecl		3
+
+
+#define RealDecl	4
+#define IntDecl		5
+#define TimeDecl	6
+#define EventDecl	7
+
+
+#define InputDecl	8
+#define OutputDecl	9
+#define InoutDecl	10
+#define RegDecl		11
+
+
+#define ParamDecl	12
+#define DefparamDecl	13
+
+
+#define WireDecl	14
+#define TriDecl		15
+#define Tri0Decl	16
+#define Tri1Decl	17
+#define Supply0Decl	18
+#define Supply1Decl	19
+#define WandDecl	20
+#define TriandDecl	21
+#define WorDecl		22
+#define TriorDecl	23
+#define TriregDecl	24
+
+
+#define ContAssign	25
+
+
+#define TaskDecl	26
+#define IntFuncDecl	27
+#define RealFuncDecl	28
+#define RangeFuncDecl	29
+
+
+#define AndGate		30
+#define NandGate	31
+#define OrGate		32
+#define NorGate		33
+#define XorGate		34
+#define XnorGate	35
+#define BufGate		36
+#define Bufif0Gate	37
+#define Bufif1Gate	38
+#define NotGate		39
+#define Notif0Gate	40
+#define Notif1Gate	41
+#define PulldownGate	42
+#define PullupGate	43
+#define NmosGate	44
+#define RnmosGate	45
+#define PmosGate	46
+#define RpmosGate	47
+#define CmosGate	48
+#define RcmosGate	49
+#define TranGate	50
+#define RtranGate	51
+#define Tranif0Gate	52
+#define Rtranif0Gate	53
+#define Tranif1Gate	54
+#define Rtranif1Gate	55
+
+#define PrimInst	56
+#define ModInst		57
+
+#define AlwaysStmt	58
+#define InitialStmt	59
+
+
+#define BeginEndStmt	60
+#define IfElseStmt	61
+#define CaseStmt	62
+#define CasexStmt	63
+#define CasezStmt	64
+#define ForeverStmt	65
+#define RepeatStmt	66
+#define WhileStmt	67
+#define ForStmt		68
+#define DelayControlStmt	69
+#define EventControlStmt	70
+#define BassignStmt	71
+#define NbassignStmt	72
+#define DelayBassignStmt	73
+#define DelayNbassignStmt	74
+#define EventBassignStmt	75
+#define EventNbassignStmt	76
+#define WaitStmt	77
+#define ForkJoinStmt	78
+#define TaskEnableStmt	79
+#define SysTaskEnableStmt	80
+#define DisableStmt	81
+#define AssignStmt	82
+#define DeassignStmt	83
+
+#define CaseItem	84
+#define DefaultItem	85
+
+
+#define OrEventExpr	86
+#define NegedgeEventExpr	87
+#define PosedgeEventExpr	88
+#define EdgeEventExpr           141
+#define EventExpr	89
+
+
+#define IDExpr		90
+#define BitSelExpr	91
+#define PartSelExpr	92
+#define ConcatExpr	93
+#define MinTypMaxExpr	94
+
+#define BitExpr         138
+#define IntExpr		95
+#define RealExpr	96
+#define StringExpr	97
+#define FuncExpr	98
+#define UplusExpr	99	
+#define UminusExpr	100	
+#define UnotExpr	101	
+#define UcomplExpr	102	
+
+#define UandExpr	103	
+#define UnandExpr	104	
+#define UorExpr		105	
+#define UnorExpr	106	
+#define UxorExpr	107	
+#define UxnorExpr	108	
+
+#define BplusExpr	109	
+#define BminusExpr	110	
+#define BtimesExpr	111	
+#define BdivExpr	112	
+#define BremExpr	113	
+#define Beq2Expr	114	
+#define Bneq2Expr	115	
+#define Beq3Expr	116	
+#define Bneq3Expr	117	
+#define BlandExpr	118	
+#define BlorExpr	119	
+#define BltExpr		120	
+#define BleExpr		121	
+#define BgtExpr		122	
+#define BgeExpr		123	
+#define BandExpr	124	
+#define BorExpr		125	
+#define BxorExpr	126	
+#define BxnorExpr	127	
+#define BlshiftExpr	128	
+#define BrshiftExpr	129	
+
+#define TcondExpr	130	
+
+#define NondExpr        142
+
+
+#define LastPrimNum 21
+
+#define PrimNone     0
+#define Prim0        1
+#define Prim1        2
+#define PrimX        3
+#define PrimQ        4   
+#define PrimR        5
+#define PrimF        6
+#define PrimP        7
+#define PrimN        8
+#define PrimS        9   
+#define PrimM       10   
+#define PrimB       18
+#define Prim0X      11
+#define Prim1X      12
+#define PrimX0      13
+#define PrimX1      14
+#define PrimXB      15   
+#define PrimBX      16   
+#define PrimBB      17   
+#define PrimQ0      19 
+#define PrimQ1      20
+#define PrimQB      21
+
+
+
+
+#define Supply0Supply1  3
+#define Supply0Strong1  4
+#define Supply0Pull1    5
+#define Supply0Weak1    6
+#define Supply0HighZ1   7
+#define Strong0Supply1  8
+#define Strong0Strong1  9
+#define Strong0Pull1   10
+#define Strong0Weak1   11
+#define Strong0HighZ1  12
+#define Pull0Supply1   13
+#define Pull0Strong1   14
+#define Pull0Pull1     15
+#define Pull0Weak1     16
+#define Pull0HighZ1    17
+#define Weak0Supply1   18
+#define Weak0Strong1   19
+#define Weak0Pull1     20
+#define Weak0Weak1     21
+#define Weak0HighZ1    22
+#define HighZ0Supply1  23
+#define HighZ0Strong1  24
+#define HighZ0Pull1    25
+#define HighZ0Weak1    26
+#define HighZ0HighZ1   27
+#define Supply1Supply0 28
+#define Supply1Strong0 29
+#define Supply1Pull0   30
+#define Supply1Weak0   31
+#define Supply1HighZ0  32
+#define Strong1Supply0 33
+#define Strong1Strong0 34
+#define Strong1Pull0   35
+#define Strong1Weak0   36
+#define Strong1HighZ0  37
+#define Pull1Supply0   38
+#define Pull1Strong0   39
+#define Pull1Pull0     40
+#define Pull1Weak0     41
+#define Pull1HighZ0    42
+#define Weak1Supply0   43
+#define Weak1Strong0   44
+#define Weak1Pull0     45
+#define Weak1Weak0     46
+#define Weak1HighZ0    47
+#define HighZ1Supply0  48
+#define HighZ1Strong0  49
+#define HighZ1Pull0    50
+#define HighZ1Weak0    51
+#define HighZ1HighZ0   52
+
+#define Small          53
+#define Medium         54
+#define Large          55
+
+
+
+#define Range_Dcl     131
+#define Integer_Dcl   132
+#define Real_Dcl      133
+#define MOST_SB       (1>>31)
+#define LEAST_SB      1
+
+#define ModulePort    134
+#define NamedPort     135
+#define ModuleConnect 136
+#define NamedConnect  137
+
+
+#define SendEventStmt 139
+
+
+#define SWireDecl     140
+
+
+
+
+#define MVar            (1)       
+#define InPort          (1<<1)    
+#define OutPort         (1<<2)    
+#define RegVar          (1<<3)    
+#define WireVar         (1<<4)    
+#define HiddenLatch     (1<<5)    
+#define UninitializeVar (1<<10)   
+                                  
+                                  
+#define AccessedVar     (1<<11)   
+#define EdgeDetector    (1<<12)   
+#define AutoDeclared    (1<<13)   
+                                  
+                                  
+#define EventVar        (1<<8)    
+#define TautologyTrue   (1<<14)   
+#define ConflictFalse   (1<<15)   
+#define EdgeSignal      (1<<6)    
+
+
+#define AlwaysTouched   (1<<6)
+#define WithInitial     (1<<7)        
+
+
+#define WithSyncho      (1)       
+#define PseudoAlways    (1<<1)    
+                                  
+#define TimedInitStmt   (1<<2)    
+                                  
+                                  
+                                  
+
+
+#define NBASSIGN_IN_INITIAL (1)
+#define NBASSIGN_IN_ALWAYS  (1<<1)
+
+
+#define DF_UninitVar    (1)
+
+
+#define DFLOW_Always    (1)
+#define DFLOW_Initial   (1<<1)
+
+
+#define LIBuand         UandExpr
+#define LIBunand        UnandExpr
+#define LIBuor          UorExpr
+#define LIBunor         UnorExpr
+#define LIBuxor         UxorExpr
+#define LIBuxnor        UxnorExpr
+
+#define LIBplus         BplusExpr 
+#define LIBminus        BminusExpr
+#define LIBtimes        BtimesExpr
+#define LIBdiv          BdivExpr
+#define LIBrem          BremExpr
+#define LIBeq2          Beq2Expr
+#define LIBneq2         Bneq2Expr
+#define LIBeq3          Beq3Expr
+#define LIBneq3         Bneq3Expr
+#define LIBland         BlandExpr
+#define LIBlor          BlorExpr
+#define LIBlt           BltExpr
+#define LIBle           BlorExpr
+#define LIBgt           BgtExpr
+#define LIBge           BgeExpr
+#define LIBand          BandExpr
+#define LIBor           BorExpr
+#define LIBxor          BxorExpr
+#define LIBxnor         BxnorExpr
+#define LIBlshift       BlshiftExpr
+#define LIBrshift       BrshiftExpr
+
+
+#define LIBmux          (LastCellNum+1)
+#define LIBopen         (LastCellNum+2)
+#define LIBconst        (LastCellNum+3)
+#define LIBconnect      (LastCellNum+4)
+#define LIBint          (LastCellNum+5)
+#define LIBconflict     (LastCellNum+6)
+#define LIBnblock       (LastCellNum+7)
+#define LIBiconnect     (LastCellNum+8)
+#define LIBexpand       (LastCellNum+9)
+#define LIBshrink       (LastCellNum+10)
+#define LIBsubrange     (LastCellNum+11)
+#define LIBindex        (LastCellNum+12)
+#define TeslaTimerGate  (LastCellNum+13)
+
+
+#define LIB_NAME(type)  (type==LIBmux)?    "__mux" : \
+                        (type==LIBopen)?   "__open" : \
+                        (type==LIBconst)?  "__const" : \
+                        (type==LIBconnect)?"__connect" : \
+                        (type==LIBiconnect)?"__iconnect" : \
+                        (type==LIBexpand)? "__expand" : \
+                        (type==LIBshrink)? "__shrink" : \
+                        (type==LIBint)?    "__int" : \
+                        (type==LIBconflict)?"__conflict" : \
+                        (type==LIBnblock)? "__nblock" : \
+                        (type==LIBuand)?   "__uand" : \
+                        (type==LIBunand)?  "__unand" : \
+                        (type==LIBuor)?    "__uor" : \
+                        (type==LIBunor)?   "__unor" : \
+                        (type==LIBuxor)?   "__uxor" : \
+                        (type==LIBuxnor)?  "__uxnor" : \
+                        (type==LIBplus)?   "__plus" : \
+                        (type==LIBminus)?  "__minus" : \
+                        (type==LIBtimes)?  "__times" : \
+                        (type==LIBdiv)?    "__div" : \
+                        (type==LIBrem)?    "__rem" : \
+                        (type==LIBeq2)?    "__eq2" : \
+                        (type==LIBneq2)?   "__neq2" : \
+                        (type==LIBeq3)?    "__eq3" : \
+                        (type==LIBneq3)?   "__neq3" : \
+                        (type==LIBland)?   "__land" : \
+                        (type==LIBlor)?    "__lor" : \
+                        (type==LIBlt)?     "__lt" : \
+                        (type==LIBle)?     "__le" : \
+                        (type==LIBgt)?     "__gt" : \
+                        (type==LIBge)?     "__ge" : \
+                        (type==LIBand)?    "__and" : \
+                        (type==LIBor)?     "__or" : \
+                        (type==LIBxor)?    "__xor" : \
+                        (type==LIBxnor)?   "__xnor" : \
+                        (type==LIBlshift)? "__lshift" : \
+                        (type==LIBsubrange)?"__subrange" : \
+                        (type==LIBindex)?  "__index" : \
+                        (type==LIBrshift)? "__rshift" : "__????"
+
+
+#define HSIS_LIB_HEADER "_hsis_"
+#define SYS_LIB_NAME(type)  \
+                        (type==LIBmux)?    "mux" : \
+                        (type==LIBopen)?   "open" : \
+                        (type==LIBconst)?  "const" : \
+                        (type==LIBconnect)?"connect" : \
+                        (type==LIBiconnect)?"iconnect" : \
+                        (type==LIBexpand)? "expand" : \
+                        (type==LIBshrink)? "shrink" : \
+                        (type==LIBint)?    "int" : \
+                        (type==LIBconflict)?"conflict" : \
+                        (type==LIBnblock)? "nblock" : \
+                        (type==LIBuand)?   "uand" : \
+                        (type==LIBunand)?  "unand" : \
+                        (type==LIBuor)?    "uor" : \
+                        (type==LIBunor)?   "unor" : \
+                        (type==LIBuxor)?   "uxor" : \
+                        (type==LIBuxnor)?  "uxnor" : \
+                        (type==LIBplus)?   "add" : \
+                        (type==LIBminus)?  "minus" : \
+                        (type==LIBtimes)?  "times" : \
+                        (type==LIBdiv)?    "div" : \
+                        (type==LIBrem)?    "rem" : \
+                        (type==LIBeq2)?    "eq2" : \
+                        (type==LIBneq2)?   "neq2" : \
+                        (type==LIBeq3)?    "eq3" : \
+                        (type==LIBneq3)?   "neq3" : \
+                        (type==LIBland)?   "and" : \
+                        (type==LIBlor)?    "or" : \
+                        (type==LIBlt)?     "lt" : \
+                        (type==LIBle)?     "le" : \
+                        (type==LIBgt)?     "gt" : \
+                        (type==LIBge)?     "ge" : \
+                        (type==LIBand)?    "and" : \
+                        (type==LIBor)?     "or" : \
+                        (type==LIBxor)?    "xor" : \
+                        (type==LIBxnor)?   "xnor" : \
+                        (type==LIBlshift)? "lshift" : \
+                        (type==LIBsubrange)?"subrange" : \
+                        (type==LIBindex)?  "index" : \
+                        (type==LIBrshift)? "rshift" : "????"
+
+
+
+#define GATE_NAME(type) (type==AndGate)?   "and" : \
+                        (type==NandGate)?  "nand" : \
+                        (type==OrGate)?    "or" : \
+                        (type==NorGate)?   "nor" : \
+                        (type==XorGate)?   "xor" : \
+                        (type==XnorGate)?  "xnor" : \
+                        (type==BufGate)?   "buf" : \
+                        (type==Bufif0Gate)?"bufif0" : \
+                        (type==Bufif1Gate)?"bufif1" : \
+                        (type==NotGate)?   "not" : \
+                        (type==Notif0Gate)?"notif0" : \
+                        (type==Notif1Gate)?"notif1" : \
+                        (type==PulldownGate)?"pulldown" : \
+                        (type==PullupGate)?"pullup" : \
+                        (type==NmosGate)?  "nmos" : \
+                        (type==RnmosGate)? "rnmos" : \
+                        (type==PmosGate)?  "pmos" : \
+                        (type==RpmosGate)? "rpmos" : \
+                        (type==CmosGate)?  "cmos" : \
+                        (type==RcmosGate)? "rcmos" : \
+                        (type==TranGate)?  "tran" : \
+                        (type==RtranGate)? "rtran" : \
+                        (type==Tranif0Gate)?"tranif0" : \
+                        (type==Tranif1Gate)?"tranif1" : \
+                        (type==Rtranif0Gate)?"rtranif0" : \
+                        (type==Rtranif1Gate)?"rtranif1" : "????"
Index: vis_dev/vl2mv-2.3/src/parser/vl_edgedetector.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_edgedetector.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_edgedetector.c	(revision 18)
@@ -0,0 +1,279 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_edgedetector.c,v 1.2 2009/03/09 20:25:57 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "st.h"
+#include "array.h"
+#include "list.h"
+#include "set.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_vardecl.h"
+#include "vl_edgedetector.h"
+#include "verilog.h"
+
+extern int smartEvent;
+extern int set_notation;
+extern int implicitClocking;
+extern int vlTimedSystem;
+extern int vl_noTimers;
+
+
+vl_term *write_ored_edge_detector(file, event)
+FILE *file;
+vl_event_expr *event;
+{
+    vl_term *retval;
+    int i;
+    lsGen gen;
+    lsHandle handle;
+    vl_event_expr *expr;
+    array_t *edge_terms;
+
+    assert(event->type == OrEventExpr);
+
+    retval = new_term(NIL(vl_range), 0, -1);
+    
+    edge_terms = array_alloc(vl_term*, 0);
+    for (gen=lsStart(event->list); 
+	 lsNext(gen,(lsGeneric*)&expr,&handle)!=LS_NOMORE;) {
+        vl_term *eterm;
+	eterm = write_edge_detector(file, expr->expr, 
+				    (expr->type==PosedgeEventExpr)?1:
+				    (expr->type==NegedgeEventExpr)?-1:0);
+        array_insert_last(vl_term*, edge_terms, eterm);
+    }
+    (void)lsFinish(gen);
+
+    fprintf(file, ".names ");
+    for (i=0; i<array_n(edge_terms); i++) {
+        vl_term *eterm;
+	eterm = array_fetch(vl_term*,edge_terms,i);
+	fprintf(file, "%s ", eterm->name->name);
+    }
+
+    fprintf(file, "%s\n", retval->name->name);
+
+    fprintf(file, "%s 1\n", HSIS_DEFAULT);
+    for (i=0; i<lsLength(event->list); i++)
+      fprintf(file, "0 ");
+    fprintf(file, "0\n");
+
+    array_free(edge_terms);
+
+    return retval;
+}
+
+
+
+
+vl_term *write_edge_detector(file, expr, sign)
+FILE *file;
+vl_expr *expr;
+int sign;
+{
+    static int edge_detector_count=0;
+    vl_term *retval=NIL(vl_term);
+    vl_term *sig, *sig_prev;
+    vl_id_range *id_sym;
+    char buf[MAXSTRLEN];
+    int event_flag = 0;
+    int hi, lo;
+    int i;
+    vl_id_range *event_id_sym;
+    int nbits;
+    char sigbuf[MAXSTRLEN], sigprebuf[MAXSTRLEN], eventbuf[MAXSTRLEN];
+    char *delta_counter = NIL(char);
+
+
+
+    if (expr->type == IDExpr) {
+        event_id_sym = expr->u.name;
+	if (st_lookup(vl_currentModule->sig_st, event_id_sym->name,
+		      (char**)&id_sym)) 
+	    get_hilo(id_sym, &hi, &lo);
+    } else {
+        
+        
+        vl_write_expr(file, expr, NIL(st_table));
+	event_id_sym = expr->term->name;
+	hi = expr->term->hi;
+	lo = expr->term->lo;
+    }
+
+    
+    
+    if (!st_lookup(vl_currentModule->sig_st, event_id_sym->name,
+		   (char**)&id_sym)) {
+        if (expr->type == IDExpr) {
+	    sprintf(buf, "'%s': sensitive to undeclared variable %s",
+		    vl_currentModule->name->name, expr->u.name->name);
+	    yylineno = -1;
+	    compile_error(buf);
+	}
+    } else if (id_sym->flags & EventVar) {
+	event_flag = 1;
+    }
+
+    if (implicitClocking && !vlTimedSystem) return retval;
+
+    sig = vl_create_term(vl_copy_id_range(event_id_sym), 0, -1);
+    sprintf(buf, "%s%s%s%x", sig->name->name, SEP_GATEPIN, PIN_DELAY, 
+	    edge_detector_count++);
+    sig_prev = create_rename_term(event_id_sym, buf, 0, -1);
+    retval = new_term(NIL(vl_range), 0,  -1);
+
+    if (event_flag) {
+	fprintf(file, ".names %s %s\n- %s%s\n", 
+		sig->name->name, retval->name->name,
+		HSIS_EQUAL, sig->name->name);
+	return retval;
+    } 
+
+    nbits = (hi<lo)?1:(hi-lo+1);
+    
+    
+    for (i=0; i<nbits; i++) {
+        if (hi<lo) {
+	    sprintf(sigbuf, "%s", sig->name->name);
+	    sprintf(sigprebuf, "%s", sig_prev->name->name);
+	    sprintf(eventbuf, "%s", retval->name->name);
+	} else {
+	    sprintf(sigbuf, "%s%s%d%s",
+		    sig->name->name, SEP_LBITSELECT, i+lo, SEP_RBITSELECT);
+	    sprintf(sigprebuf, "%s%s%d%s",
+		    sig_prev->name->name, SEP_LBITSELECT, i+lo, SEP_RBITSELECT);
+	    sprintf(eventbuf, "%s%s%d%s",
+		    retval->name->name, SEP_LBITSELECT, i+lo, SEP_RBITSELECT);
+	}
+
+	fprintf(file, ".latch %s %s\n", sigbuf, sigprebuf);
+	
+	fprintf(file, ".r %s\n0\n", sigprebuf);
+	if (sign > 0) {
+	    
+	    if ((vlTimedSystem || !implicitClocking) && !vl_noTimers) {
+		delta_counter=new_deltaTimer();
+		fprintf(file, ".timers %s\n", delta_counter);
+	    }
+	    fprintf(file, ".names %s %s %s\n", sigprebuf, sigbuf, eventbuf);
+	    if (set_notation) {
+		if ((vlTimedSystem || !implicitClocking) && !vl_noTimers){
+		    fprintf(file, "%s 0\n", HSIS_DEFAULT);
+		    fprintf(file, "0 0 0 %s %s=0\n",
+			    HSIS_TIMER_SEP, delta_counter);
+		    fprintf(file, "0 1 1 %s %s==0\n",
+			    HSIS_TIMER_SEP, delta_counter);
+		} else {
+		    fprintf(file, "%s 0\n", HSIS_DEFAULT);
+		    fprintf(file, "0 1 1\n");
+		}
+	    } else {
+		fprintf(file, "0 0 0\n0 1 1\n1 0 0\n1 1 0\n");
+	    }
+	} else if (sign < 0) {
+	    
+	    if ((vlTimedSystem || !implicitClocking) && !vl_noTimers) {
+		delta_counter=new_deltaTimer();
+		fprintf(file, ".timers %s\n", delta_counter);
+	    }
+	    fprintf(file, ".names %s %s %s\n", sigprebuf, sigbuf, eventbuf);
+	    if (set_notation) {
+		if ((vlTimedSystem || !implicitClocking) && !vl_noTimers) {
+		    fprintf(file, "%s 0\n", HSIS_DEFAULT);
+		    fprintf(file, "1 1 0 %s %s=0\n",
+			    HSIS_TIMER_SEP, delta_counter);
+		    fprintf(file, "1 0 1 %s %s==0\n",
+			    HSIS_TIMER_SEP, delta_counter);
+		} else {
+		    fprintf(file, "%s 0\n", HSIS_DEFAULT);
+		    fprintf(file, "1 0 1\n");
+		}
+	    } else {
+		fprintf(file, "0 0 0\n0 1 0\n1 0 1\n1 1 0\n");
+	    }
+	} else if (sign==0) {
+	    
+	    if ((vlTimedSystem || !implicitClocking) && !vl_noTimers) {
+		delta_counter=new_deltaTimer();
+		fprintf(file, ".timers %s\n", delta_counter);
+	    }
+	    fprintf(file, ".names %s %s %s\n", sigprebuf, sigbuf, eventbuf);
+	    if (event_flag && smartEvent) {
+		if (set_notation) {
+		    fprintf(file, "%s 0\n", HSIS_DEFAULT);
+		    fprintf(file, "0 1 1\n");
+		} else {
+		    fprintf(file, "0 0 0\n0 1 1\n1 0 0\n1 1 0\n");
+		}
+	    } else {
+		if (set_notation) {
+		    if ((vlTimedSystem || !implicitClocking) && !vl_noTimers) {
+			fprintf(file, "0 0 0 %s %s=0\n",
+				HSIS_TIMER_SEP, delta_counter);
+			fprintf(file, "0 1 1 %s %s==0\n",
+				HSIS_TIMER_SEP, delta_counter);
+			fprintf(file, "1 1 0 %s %s=0\n",
+				HSIS_TIMER_SEP, delta_counter);
+			fprintf(file, "1 0 1 %s %s==0\n",
+				HSIS_TIMER_SEP, delta_counter);
+		    } else {
+			fprintf(file, "%s 0\n", HSIS_DEFAULT);
+			fprintf(file, "1 0 1\n0 1 1\n");
+		    }
+		} else {
+		    fprintf(file, "0 0 0\n0 1 1\n1 0 1\n1 1 0\n");
+		}
+	    }
+	}
+    }
+
+    if (hi >= lo) {
+        vl_term *redresult;
+	redresult = new_term(NIL(vl_range), 0, -1);
+        retval->hi = hi;
+	retval->lo = lo;
+	vl_write_vector_bop(file, UorExpr, retval, NIL(vl_term), redresult);
+	retval = redresult;
+    }
+
+    return retval;
+}
+
+char *new_deltaTimer()
+{
+    static int delta_timer_counter=0;
+    static char buf[MAXSTRLEN];
+
+    sprintf(buf, "%s%d", HSIS_DELTA_TIMER, delta_timer_counter++);
+    return buf;
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_edgedetector.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_edgedetector.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_edgedetector.h	(revision 18)
@@ -0,0 +1,27 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_edgedetector.h,v 1.1.1.1 2001/07/09 23:22:42 fabio Exp $
+
+
+*/
+EXTERN vl_term *write_ored_edge_detector ARGS((FILE *, vl_event_expr *));
+EXTERN vl_term *write_edge_detector ARGS((FILE *, vl_expr *, int));
+EXTERN char *new_deltaTimer ARGS(());
Index: vis_dev/vl2mv-2.3/src/parser/vl_fg_defs.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_fg_defs.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_fg_defs.h	(revision 18)
@@ -0,0 +1,55 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_fg_defs.h,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+
+
+
+#define FG_ND_IFBRANCH     1
+#define FG_ND_IFTAG        2 
+#define FG_ND_CASEBRANCH   3
+#define FG_ND_FORBRANCH    4
+#define FG_ND_CASETAG      5
+#define FG_ND_PAUSE        6
+#define FG_ND_DUMMY        7
+#define FG_ND_ASSIGN       8
+
+
+
+#define FG_ARC_CASETAG     5
+#define FG_ARC_IFTRUE      9
+#define FG_ARC_IFFALSE     10
+
+
+
+#define FG_TIMER_PS        "<T>"
+#define FG_TIMER_NS        "<_>"
+#define FG_LC_PS           "<$lc_ps$>"
+#define FG_LC_NS           "<$lc_ns$>"
+#define FG_LLOC            "<"
+#define FG_RLOC            ">"
+#define FG_TIMER_PRIME     "<PT>"
+
+
+#define FG_MAGIC_UB_EDGE 65536
Index: vis_dev/vl2mv-2.3/src/parser/vl_fg_types.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_fg_types.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_fg_types.h	(revision 18)
@@ -0,0 +1,54 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_fg_types.h,v 1.1.1.1 2001/07/09 23:22:42 fabio Exp $
+
+
+*/
+
+
+typedef struct fg_node_info {
+    short type;              
+    char *data;              
+                             
+    char *loc;               
+    ctrlNetNode *SRFSMnode; 
+} fg_node_info;
+
+typedef struct fg_arc_info {
+    short type; 
+    char *data;              
+                             
+} fg_arc_info;
+
+typedef struct fg_graph_info {
+    short type;
+    int fg_id;               
+    vertex_t *init_node;
+    int pause_lo, pause_hi;  
+    lsList pause_list;       
+                             
+                             
+                             
+                             
+                             
+                               
+                             
+} fg_graph_info;
Index: vis_dev/vl2mv-2.3/src/parser/vl_flowgraph.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_flowgraph.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_flowgraph.c	(revision 18)
@@ -0,0 +1,1994 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_flowgraph.c,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#include "util.h"
+#include "st.h"
+#include "list.h"
+#include "array.h"
+#include "set.h"
+#include "stack.h"
+#include "graph.h"
+#include "vl_defs.h"
+#include "vl_types.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_fg_types.h"
+#include "vl_flowgraph.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_edgedetector.h"
+#include "verilog.h"
+
+#define IABS(x) (((x)>=0)?(x):(-(x)))
+
+extern double vl_expr_aux1_val, vl_expr_aux2_val, vl_expr_aux3_val;
+extern int vl_expr_aux1_flag, vl_expr_aux2_flag, vl_expr_aux3_flag;
+extern graph_t *vl_writeFlowGraph;
+extern int encodeTimer;
+extern int vl_preDeclare;
+extern int vl_noTimers;
+
+int RQautomata=1;
+
+static graph_t *vl_currentFlowGraph=NIL(graph_t);
+static graph_t *vl_currentCMPFlowGraph=NIL(graph_t);
+static graph_t *workingFlowGraph=NIL(graph_t);
+static vertex_t *fg_Srce, *fg_Sink;
+static vertex_t *fg_CMPSrce, *fg_CMPSink;
+static int pause_counter=1;
+static FILE *fg_out_file = NIL(FILE);
+
+
+static char *new_pausename()
+{
+    static char retval[MAXSTRLEN];
+
+    sprintf(retval, "%s%d%s", FG_LLOC, pause_counter++, FG_RLOC);
+    return retval;
+}
+
+
+
+graph_t *fg_new_graph()
+{
+
+    vl_currentFlowGraph = g_alloc();
+    vl_currentCMPFlowGraph = g_alloc();
+
+    vl_currentFlowGraph->user_data = (char*)fg_new_graph_info();
+
+    return vl_currentFlowGraph;
+}
+
+
+
+void fg_clean_fg()
+{
+    if (vl_currentFlowGraph->user_data) {
+	((fg_graph_info*)vl_currentFlowGraph->user_data)->pause_hi =
+	    pause_counter;
+    }
+    vl_currentCMPFlowGraph = vl_currentFlowGraph = NIL(graph_t);
+}
+
+
+
+int fg_not_empty()
+{
+    return (vl_currentFlowGraph != NIL(graph_t));
+}
+
+
+
+void fg_set_fg(graph_t *graph)
+{
+      workingFlowGraph = graph;
+}
+
+
+
+void fg_record_SrcSink(vertex_t **src, vertex_t **sink,
+		       vertex_t **cmp_src, vertex_t **cmp_sink)
+{
+    *src = fg_Srce;
+    *sink = fg_Sink;
+    *cmp_src = fg_CMPSrce;
+    *cmp_sink = fg_CMPSink;
+}
+
+
+
+void fg_restore_SrcSink(vertex_t *src, vertex_t *sink,
+			vertex_t *cmp_src, vertex_t *cmp_sink)
+{
+    fg_Srce = src;
+    fg_Sink = sink;
+    fg_CMPSrce = cmp_src;
+    fg_CMPSink = cmp_sink;
+}
+
+
+
+edge_t *fg_new_always_block()
+{
+    edge_t *retval;
+
+    fg_Srce = g_add_vertex(vl_currentFlowGraph);
+    fg_Sink = g_add_vertex(vl_currentFlowGraph);
+    fg_Srce->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    fg_Sink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    retval = g_add_edge(fg_Sink, fg_Srce);
+    ((fg_graph_info*)vl_currentFlowGraph->user_data)->init_node = fg_Srce;
+
+    fg_CMPSrce = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSink = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSrce->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    fg_CMPSink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    g_add_edge(fg_CMPSink, fg_CMPSrce);
+
+    return retval;
+}
+
+
+
+void fg_new_seq_block()
+{
+    fg_Srce = g_add_vertex(vl_currentFlowGraph);
+    fg_Sink = g_add_vertex(vl_currentFlowGraph);
+    fg_Srce->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    fg_Sink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+
+    fg_CMPSrce = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSink = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSrce->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    fg_CMPSink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+}
+
+
+
+vertex_t *fg_new_loop_block(vertex_t **old_srce,
+			    vertex_t **old_sink,
+			    vertex_t **new_src,
+			    vertex_t **new_sink,
+			    vertex_t **old_cmpsrc,
+			    vertex_t **old_cmpsink,
+			    vertex_t **new_cmpsrc,
+			    vertex_t **new_cmpsink)
+{
+    vertex_t *retval;
+
+    *old_srce = fg_Srce;
+    *old_sink = fg_Sink;
+    fg_Srce = g_add_vertex(vl_currentFlowGraph);
+    fg_Sink = g_add_vertex(vl_currentFlowGraph);
+    fg_Srce->user_data = (char*)fg_new_node_info(FG_ND_FORBRANCH);
+    fg_Sink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    g_add_edge(*old_srce, fg_Srce);
+
+    retval = fg_Srce;
+    *new_src = fg_Srce;
+    *new_sink = fg_Sink;
+
+    *old_cmpsrc  = fg_CMPSrce;
+    *old_cmpsink = fg_CMPSink;
+    fg_CMPSrce = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSink = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSrce->user_data = (char*)fg_new_node_info(FG_ND_FORBRANCH);
+    fg_CMPSink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    g_add_edge(*old_cmpsrc, fg_CMPSrce);
+
+    *new_cmpsrc = fg_CMPSrce;
+    *new_cmpsink = fg_CMPSink;
+
+    return retval;
+}
+
+
+
+vertex_t *fg_new_ifelse_block(old_srce, old_sink, new_src, new_sink,
+			      old_cmpsrc, old_cmpsink, new_cmpsrc, new_cmpsink)
+vertex_t **old_srce;
+vertex_t **old_sink;
+vertex_t **new_src;
+vertex_t **new_sink;
+vertex_t **old_cmpsrc;
+vertex_t **old_cmpsink;
+vertex_t **new_cmpsrc;
+vertex_t **new_cmpsink;
+{
+    vertex_t *retval;
+
+    *old_srce = fg_Srce;
+    *old_sink = fg_Sink;
+    fg_Srce = g_add_vertex(vl_currentFlowGraph);
+    fg_Sink = g_add_vertex(vl_currentFlowGraph);
+    fg_Srce->user_data = (char*)fg_new_node_info(FG_ND_IFBRANCH);
+    fg_Sink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    g_add_edge(*old_srce, fg_Srce);
+
+    retval = fg_Srce;
+    *new_src = fg_Srce;
+    *new_sink = fg_Sink;
+
+    *old_cmpsrc  = fg_CMPSrce;
+    *old_cmpsink = fg_CMPSink;
+    fg_CMPSrce = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSink = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSrce->user_data = (char*)fg_new_node_info(FG_ND_IFBRANCH);
+    fg_CMPSink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    g_add_edge(*old_cmpsrc, fg_CMPSrce);
+
+    *new_cmpsrc = fg_CMPSrce;
+    *new_cmpsink = fg_CMPSink;
+
+    return retval;
+}
+
+
+
+vertex_t *fg_new_case_block(old_srce, old_sink, new_src, new_sink,
+			    old_CMPsrce, old_CMPsink, new_CMPsrc, new_CMPsink)
+vertex_t **old_srce;
+vertex_t **old_sink;
+vertex_t **new_src;
+vertex_t **new_sink;
+vertex_t **old_CMPsrce;
+vertex_t **old_CMPsink;
+vertex_t **new_CMPsrc;
+vertex_t **new_CMPsink;
+{
+    vertex_t *retval;
+
+    *old_srce = fg_Srce;
+    *old_sink = fg_Sink;
+    fg_Srce = g_add_vertex(vl_currentFlowGraph);
+    fg_Sink = g_add_vertex(vl_currentFlowGraph);
+    fg_Srce->user_data = (char*)fg_new_node_info(FG_ND_CASEBRANCH);
+    fg_Sink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    g_add_edge(*old_srce, fg_Srce);
+
+    retval = fg_Srce;
+    *new_src = fg_Srce;
+    *new_sink = fg_Sink;
+
+    *old_CMPsrce = fg_CMPSrce;
+    *old_CMPsink = fg_CMPSink;
+    fg_CMPSrce = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSink = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSrce->user_data = (char*)fg_new_node_info(FG_ND_CASEBRANCH);
+    fg_CMPSink->user_data = (char*)fg_new_node_info(FG_ND_DUMMY);
+    g_add_edge(*old_CMPsrce, fg_CMPSrce);
+
+    *new_CMPsrc = fg_CMPSrce;
+    *new_CMPsink = fg_CMPSink;
+
+    return retval;
+}
+
+
+
+edge_t *fg_new_case_tag_block(cur_srce, cur_sink, cur_CMPsrce, cur_CMPsink)
+vertex_t *cur_srce;
+vertex_t *cur_sink;
+vertex_t *cur_CMPsrce;
+vertex_t *cur_CMPsink;
+{
+    edge_t *new_edge;
+
+    fg_Srce = g_add_vertex(vl_currentFlowGraph);
+    fg_Srce->user_data = (char*)fg_new_node_info(FG_ND_CASETAG);
+    new_edge = g_add_edge(cur_srce, fg_Srce);
+    new_edge->user_data = (char*)fg_new_arc_info(FG_ARC_CASETAG);
+
+    fg_CMPSrce = g_add_vertex(vl_currentCMPFlowGraph);
+    fg_CMPSrce->user_data = (char*)fg_new_node_info(FG_ND_CASETAG);
+    g_add_edge(cur_CMPsrce, fg_CMPSrce);
+
+    return new_edge;
+}
+
+
+
+vertex_t *fg_new_pause_node()
+{
+    vertex_t *retval, *new_vtx;
+
+    retval = g_add_vertex(vl_currentFlowGraph);
+    retval->user_data = (char*)fg_new_node_info(FG_ND_PAUSE);
+    ((fg_node_info*)retval->user_data)->loc = vlStrdup(new_pausename());
+    g_add_edge(fg_Srce, retval);
+    fg_Srce = retval;
+    lsNewEnd(((fg_graph_info*)vl_currentFlowGraph->user_data)->pause_list,
+	     (lsGeneric)retval, 0);
+
+    new_vtx = g_add_vertex(vl_currentCMPFlowGraph);
+    new_vtx->user_data = retval->user_data;
+    g_add_edge(fg_CMPSrce, new_vtx);
+    fg_CMPSrce = new_vtx;
+
+    return retval;
+}
+
+
+
+vertex_t *fg_new_assign_node()
+{
+    vertex_t *retval;
+
+    retval = g_add_vertex(vl_currentCMPFlowGraph);
+    retval->user_data = (char*)fg_new_node_info(FG_ND_ASSIGN);
+    g_add_edge(fg_CMPSrce, retval);
+    fg_CMPSrce = retval;
+
+    return retval;
+}
+
+
+
+int fg_reduce_simple_branches_back_block(
+  vertex_t *old_src,
+  vertex_t *old_sink,
+  vertex_t *old_CMPsrc,
+  vertex_t *old_CMPsink
+)
+{
+    lsList out_edges;
+    lsGen gen;
+    lsHandle handle;
+    edge_t *edge;
+    int contain_pause;
+
+    out_edges = g_get_out_edges(fg_Srce);
+    for (gen=lsStart(out_edges), contain_pause=0;
+	 lsNext(gen, (lsGeneric*)&edge, &handle) != LS_NOMORE; ) {
+	if (((fg_node_info*)(fg_Srce->user_data))->type != FG_ND_CASEBRANCH) {
+
+	    if (g_e_dest(edge) != fg_Sink)
+		contain_pause = 1;
+	} else {
+
+	    vertex_t *dest;
+	    lsList inner_edges;
+	    lsGen inner_gen;
+	    lsHandle inner_handle;
+	    edge_t *inner_edge;
+
+	    dest = g_e_dest(edge);
+	    inner_edges = g_get_out_edges(dest);
+	    for (inner_gen=lsStart(inner_edges);
+		 lsNext(inner_gen, (lsGeneric*)&inner_edge, &inner_handle) !=
+		     LS_NOMORE; ) {
+		if (g_e_dest(inner_edge) != fg_Sink) contain_pause = 1;
+	    }
+	    lsFinish(inner_gen);
+	}
+    }
+    lsFinish(gen);
+
+    if (contain_pause) {
+	fg_Srce = fg_Sink;
+	fg_Sink = old_sink;
+    } else {
+
+	if (((fg_node_info*)(fg_Srce->user_data))->type == FG_ND_CASEBRANCH) {
+	    out_edges = g_get_out_edges(fg_Srce);
+	    for (gen=lsStart(out_edges);
+		 lsNext(gen, (lsGeneric*)&edge, &handle) != LS_NOMORE; ) {
+		vertex_t *dest;
+		dest = g_e_dest(edge);
+		g_delete_vertex(dest,
+				fg_clean_vertex_data,
+				fg_clean_edge_data);
+	    }
+	    lsFinish(gen);
+	}
+
+	g_delete_vertex(fg_Srce, fg_clean_vertex_data, fg_clean_edge_data);
+	g_delete_vertex(fg_Sink, fg_clean_vertex_data, fg_clean_edge_data);
+	fg_Srce = old_src;
+	fg_Sink = old_sink;
+    }
+
+    fg_CMPSrce = fg_CMPSink;
+    fg_CMPSink = old_CMPsink;
+
+    return contain_pause;
+}
+
+
+
+fg_graph_info *fg_new_graph_info()
+{
+    fg_graph_info *retval;
+
+    retval = (fg_graph_info*)chk_malloc(sizeof(fg_graph_info));
+    retval->type = 0;
+    retval->fg_id = -1;
+    retval->init_node = NIL(vertex_t);
+    retval->pause_lo = retval->pause_hi = pause_counter;
+    retval->pause_list = lsCreate();
+
+    return retval;
+}
+
+
+
+fg_node_info *fg_new_node_info(type)
+int type;
+{
+    fg_node_info *retval;
+
+    retval = (fg_node_info*)chk_malloc(sizeof(fg_node_info));
+    retval->type = type;
+    retval->data = NIL(char);
+    retval->loc  = NIL(char);
+    retval->SRFSMnode = NIL(ctrlNetNode);
+
+    return retval;
+}
+
+
+
+fg_arc_info *fg_new_arc_info(type)
+int type;
+{
+    fg_arc_info *retval;
+
+    retval = (fg_arc_info*)chk_malloc(sizeof(fg_arc_info));
+    retval->type = type;
+    retval->data = NIL(char);
+
+    return retval;
+}
+
+
+
+edge_t *fg_force_edge(src, sink, CMPsrc, CMPsink)
+vertex_t *src;
+vertex_t *sink;
+vertex_t *CMPsrc;
+vertex_t *CMPsink;
+{
+    edge_t *retval;
+
+    retval = g_add_edge(src, sink);
+    g_add_edge(CMPsrc, CMPsink);
+
+    return retval;
+}
+
+
+
+edge_t *fg_closeloop()
+{
+    edge_t *retval;
+
+    if (fg_Srce == NIL(vertex_t) && fg_Sink == NIL(vertex_t))
+	return NIL(edge_t);
+
+    retval = g_add_edge(fg_Srce, fg_Sink);
+
+    g_add_edge(fg_CMPSrce, fg_CMPSink);
+
+    return retval;
+}
+
+
+
+vertex_t *fg_pseudo_sink()
+{
+    vertex_t *retval;
+    vertex_t *pseudo_sink, *pseudo_CMPsink;
+
+    if (fg_Srce == NIL(vertex_t) && fg_Sink == NIL(vertex_t))
+	return NIL(vertex_t);
+
+    pseudo_sink =    g_add_vertex(vl_currentFlowGraph);
+    pseudo_CMPsink = g_add_vertex(vl_currentCMPFlowGraph);
+    pseudo_sink->user_data =    (char*)fg_new_node_info(FG_ND_PAUSE);
+    pseudo_CMPsink->user_data = (char*)fg_new_node_info(FG_ND_PAUSE);
+    ((fg_node_info*)pseudo_sink->user_data)->loc = vlStrdup(new_pausename());
+    lsNewEnd(((fg_graph_info*)vl_currentFlowGraph->user_data)->pause_list,
+	     (lsGeneric)pseudo_sink, 0);
+    g_add_edge(fg_Srce, pseudo_sink);
+    g_add_edge(fg_CMPSrce, pseudo_CMPsink);
+    retval = pseudo_sink;
+    return retval;
+}
+
+
+
+int fg_check_cyclic()
+{
+    if (fg_Srce == NIL(vertex_t) && fg_Sink == NIL(vertex_t))
+	return 1;
+
+    return !g_is_acyclic(vl_currentFlowGraph);
+}
+
+
+
+void fg_clean_vertex_data(user_data)
+gGeneric user_data;
+{
+    if (!user_data) return;
+    if (!((fg_node_info*)user_data)->data) return;
+    ((vl_expr*)(((fg_node_info*)user_data)->data))->fg_info1 = NIL(char);
+    ((vl_expr*)(((fg_node_info*)user_data)->data))->fg_info2 = NIL(char);
+    ((vl_expr*)(((fg_node_info*)user_data)->data))->fg_aux1 = NIL(char);
+    ((vl_expr*)(((fg_node_info*)user_data)->data))->fg_aux2 = NIL(char);
+    free((fg_node_info*)user_data);
+}
+
+
+
+void fg_clean_edge_data(user_data)
+gGeneric user_data;
+{
+    if (!user_data) return;
+    if (!((fg_arc_info*)user_data)->data) return;
+    ((vl_case_item*)(((fg_arc_info*)user_data)->data))->fg_info = NIL(char);
+    free((fg_node_info*)user_data);
+}
+
+
+
+void fg_update_node_info(vertex_t *vtx, char *data)
+{
+    ((fg_node_info*)vtx->user_data)->data = data;
+}
+
+
+
+void fg_update_arc_info(edge_t *arc, char *data)
+{
+    ((fg_arc_info*)arc->user_data)->data = data;
+}
+
+
+static
+void fg_dfs_int(src, sink, vtx_massager, arc_massager, visit_st)
+vertex_t *src;
+vertex_t *sink;
+void (*vtx_massager)();
+void (*arc_massager)();
+st_table *visit_st;
+{
+    edge_t *e;
+    vertex_t *v;
+    int val;
+    lsList visit_list;
+    lsGen gen;
+    lsHandle handle;
+
+    if (src==sink) {
+	if (!st_lookup(visit_st, (char*)sink, (char**)&val)) {
+	    if (vtx_massager) (*vtx_massager)(sink->user_data);
+	    st_insert(visit_st, (char*)sink, (char*)0);
+	}
+	return;
+    }
+
+    if (vtx_massager) (*vtx_massager)(src->user_data);
+    st_insert(visit_st, (char*)src, (char*)0);
+    visit_list = g_get_out_edges(src);
+    for (gen=lsStart(visit_list);
+	 lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	if (arc_massager) (*arc_massager)(e->user_data);
+	v = g_e_dest(e);
+	if (!st_lookup(visit_st, (char*)v, (char**)&val)) {
+	    fg_dfs_int(v, sink, vtx_massager, arc_massager, visit_st);
+	}
+    }
+    lsFinish(gen);
+}
+
+
+
+int fg_dfs(src, sink, vtx_massager, arc_massager)
+vertex_t *src;
+vertex_t *sink;
+void (*vtx_massager)();
+void (*arc_massager)();
+{
+    st_table *visit_st;
+
+    if (sink) if (g_vertex_graph(src) != g_vertex_graph(sink)) return 0;
+
+    visit_st = st_init_table(st_ptrcmp, st_ptrhash);
+    fg_dfs_int(src, sink, vtx_massager, arc_massager, visit_st);
+    st_free_table(visit_st);
+
+    return 1;
+}
+
+
+static
+void fg_back_dfs_int(src, leaf_criterion, vtx_massager, arc_massager, visit_st)
+vertex_t *src;
+int (*leaf_criterion)();
+void (*vtx_massager)();
+void (*arc_massager)();
+st_table *visit_st;
+{
+    edge_t *e;
+    vertex_t *v;
+    int val;
+    lsList visit_list;
+    lsGen gen;
+    lsHandle handle;
+
+    if ((*leaf_criterion)(src->user_data)) {
+	if (!st_lookup(visit_st, (char*)src, (char**)&val)) {
+	    if (vtx_massager)
+		(*vtx_massager)(src->user_data);
+	    st_insert(visit_st, (char*)src, (char*)0);
+	}
+	return;
+    }
+
+    if (vtx_massager) (*vtx_massager)(src->user_data);
+    st_insert(visit_st, (char*)src, (char*)0);
+    visit_list = g_get_in_edges(src);
+    for (gen=lsStart(visit_list);
+	 lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	if (arc_massager) (*arc_massager)(e->user_data);
+	v = g_e_source(e);
+	if (!st_lookup(visit_st, (char*)v, (char**)&val)) {
+	    fg_back_dfs_int(v, leaf_criterion, vtx_massager, arc_massager,
+			    visit_st);
+	}
+    }
+    lsFinish(gen);
+}
+
+
+
+int fg_back_dfs(src, leaf_criterion, vtx_massager, arc_massager)
+vertex_t *src;
+int (*leaf_criterion)();
+void (*vtx_massager)();
+void (*arc_massager)();
+{
+    st_table *visit_st;
+
+    if (!src) return 0;
+
+    visit_st = st_init_table(st_ptrcmp, st_ptrhash);
+    fg_back_dfs_int(src, leaf_criterion, vtx_massager, arc_massager, visit_st);
+    st_free_table(visit_st);
+
+    return 1;
+}
+
+
+static
+void fg_fore_dfs_int(src, leaf_criterion, vtx_massager, arc_massager, visit_st)
+vertex_t *src;
+int (*leaf_criterion)();
+void (*vtx_massager)();
+void (*arc_massager)();
+st_table *visit_st;
+{
+    edge_t *e;
+    vertex_t *v;
+    int val;
+    lsList visit_list;
+    lsGen gen;
+    lsHandle handle;
+
+    if ((*leaf_criterion)(src->user_data)) {
+	if (!st_lookup(visit_st, (char*)src, (char**)&val)) {
+	    if (vtx_massager)
+		(*vtx_massager)(src->user_data);
+	    st_insert(visit_st, (char*)src, (char*)0);
+	}
+	return;
+    }
+
+    if (vtx_massager) (*vtx_massager)(src->user_data);
+    st_insert(visit_st, (char*)src, (char*)0);
+    visit_list = g_get_out_edges(src);
+    for (gen=lsStart(visit_list);
+	 lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	if (arc_massager) (*arc_massager)(e->user_data);
+	v = g_e_dest(e);
+	if (!st_lookup(visit_st, (char*)v, (char**)&val)) {
+	    fg_fore_dfs_int(v, leaf_criterion, vtx_massager, arc_massager,
+			    visit_st);
+	}
+    }
+    lsFinish(gen);
+}
+
+
+
+int fg_fore_dfs(src, leaf_criterion, vtx_massager, arc_massager)
+vertex_t *src;
+int (*leaf_criterion)();
+void (*vtx_massager)();
+void (*arc_massager)();
+{
+    st_table *visit_st;
+
+    if (!src) return 0;
+
+    visit_st = st_init_table(st_ptrcmp, st_ptrhash);
+    fg_fore_dfs_int(src, leaf_criterion, vtx_massager, arc_massager, visit_st);
+    st_free_table(visit_st);
+
+    return 1;
+}
+
+
+static
+void fg_gen_fore_dfs_int(src, leaf_criterion, leaf_massager,
+		    vtx_pre_massager, vtx_in_massager, vtx_post_massager,
+		    arc_pre_massager, arc_post_massager,
+		    visit_st, all_paths)
+vertex_t *src;
+int (*leaf_criterion)();
+void (*leaf_massager)();
+void (*vtx_pre_massager)();
+void (*vtx_in_massager)();
+void (*vtx_post_massager)();
+void (*arc_pre_massager)();
+void (*arc_post_massager)();
+st_table *visit_st;
+int all_paths;
+{
+    int i;
+    edge_t *e;
+    vertex_t *v;
+    int val;
+    lsList visit_list;
+    lsGen gen;
+    lsHandle handle;
+
+    if ((*leaf_criterion)(src->user_data)) {
+	if (!st_lookup(visit_st, (char*)src, (char**)&val) || all_paths) {
+	    if (vtx_pre_massager) (*vtx_pre_massager)(src->user_data);
+	    if (leaf_massager) (*leaf_massager)(src->user_data);
+	    if (vtx_post_massager) (*vtx_post_massager)(src->user_data);
+	    st_insert(visit_st, (char*)src, (char*)0);
+	}
+	return;
+    }
+
+    if (vtx_pre_massager) (*vtx_pre_massager)(src->user_data);
+    st_insert(visit_st, (char*)src, (char*)0);
+    visit_list = g_get_out_edges(src);
+    for (gen=lsStart(visit_list), i=0;
+	 lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; i++) {
+	if (arc_pre_massager) (*arc_pre_massager)(e->user_data);
+	v = g_e_dest(e);
+	if (!st_lookup(visit_st, (char*)v, (char**)&val) || all_paths) {
+	    fg_gen_fore_dfs_int(v, leaf_criterion, leaf_massager,
+			    vtx_pre_massager,
+			    vtx_in_massager,
+			    vtx_post_massager,
+			    arc_pre_massager, arc_post_massager,
+			    visit_st, all_paths);
+	}
+	if (vtx_in_massager) (*vtx_in_massager)(src->user_data, e->user_data);
+	if (arc_post_massager) (*arc_post_massager)(e->user_data);
+    }
+    lsFinish(gen);
+    if (vtx_post_massager) (*vtx_post_massager)(src->user_data, src);
+}
+
+
+
+int fg_gen_fore_dfs(src, leaf_criterion, leaf_massager,
+	    vtx_pre_massager, vtx_in_massager, vtx_post_massager,
+	    arc_pre_massager, arc_post_massager, all_paths)
+vertex_t *src;
+int (*leaf_criterion)();
+void (*leaf_massager)();
+void (*vtx_pre_massager)();
+void (*vtx_in_massager)();
+void (*vtx_post_massager)();
+void (*arc_pre_massager)();
+void (*arc_post_massager)();
+int all_paths;
+{
+    st_table *visit_st;
+
+    if (!src) return 0;
+
+    visit_st = st_init_table(st_ptrcmp, st_ptrhash);
+    fg_gen_fore_dfs_int(src, leaf_criterion, leaf_massager,
+			vtx_pre_massager, vtx_in_massager, vtx_post_massager,
+			arc_pre_massager, arc_post_massager, visit_st,
+			all_paths);
+    st_free_table(visit_st);
+
+    return 1;
+}
+
+
+static st_table *pause_set=NIL(st_table);
+
+static void remember_pause(user_data)
+gGeneric user_data;
+{
+    char *loc;
+
+    if (((fg_node_info*)user_data)->type == FG_ND_PAUSE) {
+	if (((fg_node_info*)user_data)->loc)
+	    loc = ((fg_node_info*)user_data)->loc;
+	else
+	    loc = ((fg_node_info*)user_data)->loc = vlStrdup(new_pausename());
+
+	st_insert(pause_set, loc, (char*)0);
+    }
+}
+
+
+static st_table *terminal_set=NIL(st_table);
+static st_table *full_terminal_set=NIL(st_table);
+static int terminal_set_count=1;
+
+static void remember_node_terminal(user_data)
+gGeneric user_data;
+{
+    vl_term *key;
+    int val;
+    vl_event_control_stmt *pause_stmt;
+
+    if (!user_data) return;
+    key = (vl_term*)((fg_node_info*)user_data)->data;
+    if (((fg_node_info*)user_data)->type == FG_ND_IFBRANCH ||
+	((fg_node_info*)user_data)->type == FG_ND_FORBRANCH) {
+	if (!st_lookup(terminal_set, (char*)key, (char**)&val)) {
+	    if (full_terminal_set) {
+		int retval = st_lookup(full_terminal_set, (char*)key,
+				       (char**)&val);
+		assert(retval);
+		st_insert(terminal_set, (char*)key, (char*)val);
+	    } else {
+		st_insert(terminal_set, (char*)key, (char*)terminal_set_count);
+		terminal_set_count++;
+	    }
+	}
+    } else if (((fg_node_info*)user_data)->type == FG_ND_PAUSE) {
+	vl_term *edge_ctrl = NIL(vl_term);
+
+	pause_stmt = (vl_event_control_stmt*)((fg_node_info*)user_data)->data;
+	if (pause_stmt->type == EventControlStmt) {
+	    if (!full_terminal_set) {
+		if (!st_lookup(terminal_set,
+			       pause_stmt->fg_info, (char**)&val)) {
+		    if (!vl_preDeclare) {
+			if (pause_stmt->event->type == OrEventExpr) {
+			    edge_ctrl =
+				write_ored_edge_detector(fg_out_file,
+							 pause_stmt->event);
+			} else {
+			    edge_ctrl =
+				write_edge_detector(fg_out_file,
+						    pause_stmt->event->expr,
+				(pause_stmt->event->type==PosedgeEventExpr)?1:
+				(pause_stmt->event->type==NegedgeEventExpr)?-1:
+									    0);
+			    edge_ctrl->flag |= EdgeSignal;
+			}
+		    }
+		    pause_stmt->fg_info = (char*)edge_ctrl;
+		    st_insert(terminal_set, (char*)edge_ctrl,
+			      (char*)(FG_MAGIC_UB_EDGE+terminal_set_count));
+		    terminal_set_count++;
+		}
+	    } else {
+		int retval = st_lookup(full_terminal_set, pause_stmt->fg_info,
+				       (char**)&val);
+		assert(retval);
+		st_insert(terminal_set, pause_stmt->fg_info, (char*)val);
+	    }
+	}
+    }
+}
+
+static void switch_node_branch(user_data, edge_data)
+gGeneric user_data;
+gGeneric edge_data;
+{
+    vl_term *key;
+    int val;
+
+    if (!user_data) return;
+    key = (vl_term*)((fg_node_info*)user_data)->data;
+    if (((fg_node_info*)user_data)->type == FG_ND_IFBRANCH ||
+	((fg_node_info*)user_data)->type == FG_ND_FORBRANCH) {
+	int retval = st_lookup(terminal_set, (char*)key, (char**)&val);
+	assert(retval);
+	st_delete(terminal_set, (char**)&key, (char**)&val);
+	st_insert(terminal_set, (char*)key, (char*)-val);
+    } else if (((fg_node_info*)user_data)->type == FG_ND_CASEBRANCH) {
+	int retval;
+	key = (vl_term*)((fg_arc_info*)edge_data)->data;
+	retval = st_lookup(terminal_set, (char*)key, (char**)&val);
+	assert(retval);
+	st_delete(terminal_set, (char**)&key, (char**)&val);
+	st_insert(terminal_set, (char*)key, (char*)-val);
+    }
+}
+
+static void forget_node_terminal(user_data, v)
+gGeneric user_data;
+vertex_t *v;
+{
+    vl_term *key;
+    int val;
+
+    if (!user_data) return;
+    key = (vl_term*)((fg_node_info*)user_data)->data;
+    if (((fg_node_info*)user_data)->type == FG_ND_IFBRANCH ||
+	((fg_node_info*)user_data)->type == FG_ND_FORBRANCH) {
+	key = (vl_term*)((fg_node_info*)user_data)->data;
+	if (st_lookup(terminal_set, (char*)key, (char**)&val))
+	    st_delete(terminal_set, (char**)&key, (char**)&val);
+    } else if (((fg_node_info*)user_data)->type == FG_ND_CASEBRANCH) {
+	lsList e_list;
+	lsGen gen;
+	lsHandle handle;
+	edge_t *e;
+
+
+	e_list = g_get_out_edges(v);
+	for (gen=lsStart(e_list);
+	     lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	    if (!e->user_data) continue;
+	    if (((fg_arc_info*)e->user_data)->type == FG_ND_CASETAG) {
+		key = (vl_term*)((fg_arc_info*)e->user_data)->data;
+		if (st_lookup(terminal_set, (char*)key, (char**)&val))
+		    st_delete(terminal_set, (char**)&key, (char**)&val);
+	    }
+	}
+	lsFinish(gen);
+    } else if (((fg_node_info*)user_data)->type ==FG_ND_PAUSE) {
+	vl_event_control_stmt *pause_stmt;
+	pause_stmt = (vl_event_control_stmt*)((fg_node_info*)user_data)->data;
+	if (pause_stmt->type == EventControlStmt) {
+	    key = (vl_term*)pause_stmt->fg_info;
+	    if (st_lookup(terminal_set, (char*)key, (char**)&val))
+		st_delete(terminal_set, (char**)&key, (char**)&val);
+	}
+    }
+}
+
+static void remember_arc_terminal(user_data)
+gGeneric user_data;
+{
+    vl_term *key;
+    int val;
+
+    if (!user_data) return;
+    key = (vl_term*)((fg_arc_info*)user_data)->data;
+    if (((fg_arc_info*)user_data)->type == FG_ND_CASETAG) {
+	if (!st_lookup(terminal_set, (char*)key, (char**)&val)) {
+	    if (full_terminal_set) {
+		int retval = st_lookup(full_terminal_set, (char*)key,
+				       (char**)&val);
+		assert(retval);
+		st_insert(terminal_set, (char*)key, (char*)val);
+	    } else {
+		st_insert(terminal_set, (char*)key, (char*)terminal_set_count);
+		terminal_set_count++;
+	    }
+	}
+    }
+}
+
+static void forget_arc_terminal(user_data)
+gGeneric user_data;
+{
+
+    if (!user_data) return;
+    if (((fg_arc_info*)user_data)->type == FG_ND_CASETAG) {
+	/* nothing */
+    }
+}
+
+
+
+void fg_if_collect_pause_rewrite_ctrl(file, src, sink, spacial_ctrl)
+FILE *file;
+vertex_t *src;
+vertex_t *sink;
+vl_term **spacial_ctrl;
+{
+    vl_term *t_lc_control=NIL(vl_term), *f_lc_control=NIL(vl_term);
+    vl_term *new_lc_ctrl;
+    vertex_t *branch_src;
+    edge_t *branch_edge;
+    int i;
+    lsList out_edges;
+    lsGen gen;
+    lsHandle handle;
+
+    out_edges = g_get_out_edges(src);
+
+    for (gen=lsStart(out_edges), i=0;
+	 lsNext(gen, (lsGeneric*)&branch_edge, &handle)!=LS_NOMORE; i++) {
+	int retval;
+	pause_set = st_init_table(strcmp, st_strhash);
+	branch_src = g_e_dest(branch_edge);
+	retval = fg_dfs(branch_src, sink, remember_pause, 0);
+	assert(retval);
+
+	if (i==0)
+	    t_lc_control = fg_write_lc_in_LabelSet(file, pause_set, 0);
+	else
+	    f_lc_control = fg_write_lc_in_LabelSet(file, pause_set, 0);
+
+	st_free_table(pause_set);
+	pause_set = NIL(st_table);
+    }
+    lsFinish(gen);
+
+    new_lc_ctrl = fg_write_if_priority_decoder(file,
+		      t_lc_control, f_lc_control, *spacial_ctrl);
+
+    *spacial_ctrl = new_lc_ctrl;
+}
+
+
+
+void fg_case_collect_pause_rewrite_ctrl(FILE *file, vertex_t *src,
+					vertex_t *sink,
+					vl_term **spacial_ctrl,
+					vl_term **temporal_ctrl)
+{
+    vl_term *ripple_in;
+    vl_term *lc_control;
+    vl_term *new_lc_ctrl;
+
+    pause_set = st_init_table(strcmp, st_strhash);
+    fg_dfs(src, sink, remember_pause, 0);
+
+    ripple_in = new_term(NIL(vl_range), 0, -1);
+    lc_control = fg_write_lc_in_LabelSet(file, pause_set, 0);
+    new_lc_ctrl = fg_write_case_priority_decoder(file,
+		      ripple_in, *temporal_ctrl, lc_control, *spacial_ctrl);
+
+    *spacial_ctrl = new_lc_ctrl;
+    *temporal_ctrl = ripple_in;
+
+    st_free_table(pause_set);
+    pause_set = NIL(st_table);
+}
+
+
+
+void fg_loop_collect_pause(FILE *file, vertex_t *src,
+			   vertex_t *sink,
+			   vl_term **dom_sel)
+{
+    vl_term *t_lc_control=NIL(vl_term);
+    vertex_t *branch_src;
+    edge_t *branch_edge;
+    int i;
+    lsList out_edges;
+    lsGen gen;
+    lsHandle handle;
+
+    out_edges = g_get_out_edges(src);
+
+    for (gen=lsStart(out_edges), i=0;
+	 lsNext(gen, (lsGeneric*)&branch_edge, &handle)!=LS_NOMORE; i++) {
+	int retval;
+	pause_set = st_init_table(strcmp, st_strhash);
+	branch_src = g_e_dest(branch_edge);
+	retval = fg_dfs(branch_src, sink, remember_pause, 0);
+	assert(retval);
+
+	if (i==0)
+
+	    t_lc_control = fg_write_lc_in_LabelSet(file, pause_set, -1);
+
+	st_free_table(pause_set);
+	pause_set = NIL(st_table);
+    }
+    lsFinish(gen);
+
+    *dom_sel = t_lc_control;
+}
+
+
+
+vl_term *fg_write_lc_in_LabelSet(file, pause_set, ns)
+FILE *file;
+st_table* pause_set;
+int ns;
+{
+    vl_term *retval;
+    st_generator *gen;
+    int *val;
+    char *key;
+    char *timer_st;
+
+    retval = new_term(NIL(vl_range), 0, -1);
+    timer_st = (ns==-1) ? FG_TIMER_PS :
+			  ((ns) ? FG_LC_NS : FG_LC_PS);
+
+    if (st_count(pause_set)==0) {
+	fprintf(file, ".names %s\n0\n", retval->name->name);
+    } else {
+	fprintf(file, ".names %s%06x %s\n", timer_st,
+		((fg_graph_info*)vl_writeFlowGraph->user_data)->fg_id,
+		retval->name->name);
+	fprintf(file, "%s 0\n", HSIS_DEFAULT);
+	gen = st_init_gen(pause_set);
+	while (st_gen(gen, &key, (char**)&val)) {
+	    if (RQautomata)
+		fprintf(file, "%s 1\n%s%s 1\n", key, key, FG_TIMER_PRIME);
+	    else
+		fprintf(file, "%s 1\n", key);
+	}
+	st_free_gen(gen);
+    }
+
+    return retval;
+}
+
+
+
+vl_term *
+fg_write_if_priority_decoder(file, t_local_lc, f_local_lc, spacial_ctrl)
+FILE *file;
+vl_term *t_local_lc;
+vl_term *f_local_lc;
+vl_term *spacial_ctrl;
+{
+    vl_term *retval;
+
+    retval = new_term(NIL(vl_range), 0, -1);
+
+
+    if (f_local_lc) {
+	fprintf(file, ".names %s %s %s %s\n",
+		t_local_lc->name->name, f_local_lc->name->name,
+		spacial_ctrl->name->name, retval->name->name);
+	fprintf(file, "1 - - 1\n");
+	fprintf(file, "0 1 - 0\n");
+	fprintf(file, "0 0 - %s%s\n",
+		HSIS_EQUAL,spacial_ctrl->name->name);
+    } else {
+	fprintf(file, ".names %s %s %s\n",
+		t_local_lc->name->name, spacial_ctrl->name->name,
+		retval->name->name);
+	fprintf(file, "1 - 1\n");
+	fprintf(file, "0 - %s%s\n",
+		HSIS_EQUAL, spacial_ctrl->name->name);
+    }
+
+    return retval;
+}
+
+
+
+vl_term *
+fg_write_case_priority_decoder(file, ripple_in, ripple_out,
+			       local_lc, spacial_ctrl)
+FILE *file;
+vl_term *ripple_in;
+vl_term *ripple_out;
+vl_term *local_lc;
+vl_term *spacial_ctrl;
+{
+    vl_term *retval;
+
+    retval = new_term(NIL(vl_range), 0, -1);
+
+
+    if (spacial_ctrl) {
+	fprintf(file, ".names %s %s %s %s\n",
+		local_lc->name->name, ripple_in->name->name,
+		spacial_ctrl->name->name, retval->name->name);
+	fprintf(file, "1 - - 1\n");
+	fprintf(file, "0 1 - 0\n");
+	fprintf(file, "0 0 - %s%s\n",
+		HSIS_EQUAL, spacial_ctrl->name->name);
+    } else {
+	fprintf(file, ".names %s %s %s\n",
+		local_lc->name->name, ripple_in->name->name,
+		retval->name->name);
+	fprintf(file, "1 - 1\n");
+	fprintf(file, "0 1 0\n");
+	fprintf(file, "0 0 1\n");
+    }
+
+    if (ripple_out) {
+	fprintf(file, ".names %s %s %s\n", ripple_in->name->name,
+		local_lc->name->name, ripple_out->name->name);
+	fprintf(file, "%s 1\n", HSIS_DEFAULT);
+	fprintf(file, "0 0 0\n");
+    }
+
+    return retval;
+}
+
+
+static int fg_node_is_pause(void *user_data)
+{
+    return (((fg_node_info*)user_data)->type == FG_ND_PAUSE);
+}
+
+
+
+st_table *fg_assign_temporal_context(src)
+vertex_t *src;
+{
+    st_table *retval;
+
+    retval = pause_set = st_init_table(st_ptrcmp, st_ptrhash);
+
+    fg_back_dfs(src, fg_node_is_pause, remember_pause, 0);
+
+    pause_set = NIL(st_table);
+
+    return retval;
+}
+
+
+
+void fg_put_loc_context(FILE *file, st_table *pre_cond, char *lc_name)
+{
+    st_generator *gen;
+    char *loc, *val;
+    int i;
+    char buf[MAXSTRLEN];
+    fg_graph_info *graph_info;
+
+    if (st_count(pre_cond)==0) {
+	fprintf(file, "%d", 1);
+	return;
+    }
+
+    fprintf(file, "%s", HSIS_SET_BEGIN);
+    i = 1;
+    gen = st_init_gen(pre_cond);
+    while (st_gen(gen, &loc, &val)) {
+	graph_info = (fg_graph_info*)get_assoc_lc_name(loc, buf);
+	if (i==st_count(pre_cond))
+	    if (RQautomata)
+		fprintf(file, "%s%s%s%s",
+			loc, HSIS_SET_SEP, loc, FG_TIMER_PRIME);
+	    else
+		fprintf(file, "%s", loc);
+	else
+	    if (RQautomata)
+		fprintf(file, "%s%s%s%s%s",
+			loc, HSIS_SET_SEP, loc, FG_TIMER_PRIME, HSIS_SET_SEP);
+	    else
+		fprintf(file, "%s%s", loc, HSIS_SET_SEP);
+	i++;
+    }
+    st_free_gen(gen);
+    fprintf(file, "%s", HSIS_SET_END);
+}
+
+
+void fg_declare_timer(file, terminal_set, graph)
+FILE *file;
+st_table *terminal_set;
+graph_t *graph;
+{
+    fg_graph_info *gdata;
+    int i;
+
+    gdata = ((fg_graph_info*)graph->user_data);
+
+    if (vl_preDeclare) {
+	fprintf(file, ".mv %s%06x, %s%06x %d %s%d%s ",
+		FG_LC_PS, gdata->fg_id, FG_LC_NS, gdata->fg_id,
+		(gdata->pause_hi-gdata->pause_lo)*2+2,
+		FG_LLOC, 0, FG_RLOC);
+	for (i=gdata->pause_lo; i<gdata->pause_hi; i++)
+	    fprintf(file, "%s%d%s %s%d%s%s ",
+		    FG_LLOC, i, FG_RLOC, FG_LLOC, i, FG_RLOC,
+		    FG_TIMER_PRIME);
+	fprintf(file, "%s%s\n", FG_LLOC, FG_RLOC);
+    }
+
+    fprintf(file, ".mv %s%06x %d %s%d%s ", FG_TIMER_PS, gdata->fg_id,
+	    (gdata->pause_hi-gdata->pause_lo)*2+1, FG_LLOC, 0, FG_RLOC);
+    for (i=gdata->pause_lo; i<gdata->pause_hi; i++)
+	fprintf(file, "%s%d%s %s%d%s%s ",
+		FG_LLOC, i, FG_RLOC, FG_LLOC, i, FG_RLOC, FG_TIMER_PRIME);
+    fprintf(file, "\n");
+
+    fprintf(file, ".mv %s%06x %d %s%d%s ", FG_TIMER_NS, gdata->fg_id,
+	    (gdata->pause_hi-gdata->pause_lo)*2+1, FG_LLOC, 0, FG_RLOC);
+    for (i=gdata->pause_lo; i<gdata->pause_hi; i++)
+	fprintf(file, "%s%d%s %s%d%s%s ",
+		FG_LLOC, i, FG_RLOC, FG_LLOC, i, FG_RLOC, FG_TIMER_PRIME);
+    fprintf(file, "\n");
+
+
+    if (!vl_noTimers) {
+	fprintf(file, ".timers ");
+	for (i=((fg_graph_info*)graph->user_data)->pause_lo;
+	     i<((fg_graph_info*)graph->user_data)->pause_hi; i++)
+	    if (i<((fg_graph_info*)graph->user_data)->pause_hi-1)
+		fprintf(file, "T%d,", i);
+	    else
+		fprintf(file, "T%d ", i);
+	fprintf(file, "\n");
+    }
+    fprintf(file, ".latch %s%06x %s%06x\n",
+	    FG_TIMER_NS, gdata->fg_id, FG_TIMER_PS, gdata->fg_id);
+    fprintf(file, ".r %s%06x\n%s%d%s\n", FG_TIMER_PS, gdata->fg_id,
+	    FG_LLOC, (vl_noTimers)?gdata->pause_lo:0, FG_RLOC);
+}
+
+
+
+void fg_put_timer_header(file, terminal_set, graph)
+FILE *file;
+st_table *terminal_set;
+graph_t *graph;
+{
+    st_generator *gen;
+    vl_term *key;
+    int val;
+    int i;
+
+    fprintf(file, ".names ");
+    for (i=1; i<=st_count(terminal_set); i++) {
+	gen = st_init_gen(terminal_set);
+	while (st_gen(gen, (char**)&key, (char**)&val)) {
+	    if (val == i) {
+		fprintf(file, "%s ", key->name->name);
+		break;
+	    } else if ((val-FG_MAGIC_UB_EDGE) == i) {
+		fprintf(file, "%s ", key->name->name);
+		break;
+	    }
+	}
+	st_free_gen(gen);
+    }
+    fprintf(file, "%s%06x %s %s%06x %s%06x %s%06x\n",
+	    FG_TIMER_PS, ((fg_graph_info*)graph->user_data)->fg_id,
+	    HSIS_ARROW,
+	    FG_LC_PS, ((fg_graph_info*)graph->user_data)->fg_id,
+	    FG_LC_NS, ((fg_graph_info*)graph->user_data)->fg_id,
+	    FG_TIMER_NS, ((fg_graph_info*)graph->user_data)->fg_id);
+    fprintf(file, "%s %s%s %s%s %s%s%06x\n",
+	    HSIS_DEFAULT, FG_LLOC, FG_RLOC, FG_LLOC, FG_RLOC,
+	    HSIS_EQUAL,
+	    FG_TIMER_PS, ((fg_graph_info*)graph->user_data)->fg_id);
+}
+
+
+static vertex_t *current_source_vtx=NIL(vertex_t);
+
+
+static void fg_put_timer_transition(int user_data)
+{
+    int i;
+    st_generator *gen;
+    vl_term *key;
+    int val, ival;
+    int control_entry=0;
+    int src_timer, dest_timer, delay1;
+    vl_delay_control_stmt *pausing_stmt;
+    int primed_transition = 0;
+    char buf[MAXSTRLEN];
+    char str[MAXSTRLEN];
+
+    if (((fg_node_info*)user_data)->type != FG_ND_PAUSE) return;
+    pausing_stmt = (vl_delay_control_stmt*)
+	((fg_node_info*)current_source_vtx->user_data)->data;
+    if (pausing_stmt->type != DelayControlStmt &&
+	pausing_stmt->type != EventControlStmt) return;
+
+    buf[0]='\0';
+    if (pausing_stmt->type == EventControlStmt) {
+	if (!st_lookup(full_terminal_set,
+		       ((vl_event_control_stmt*)pausing_stmt)->fg_info,
+		       (char**)&ival))
+	    ival = 0;
+	else
+	    ival -= FG_MAGIC_UB_EDGE;
+    }
+
+
+    if (!strcmp(((fg_node_info*)current_source_vtx->user_data)->loc,
+		((fg_node_info*)user_data)->loc) &&
+	RQautomata)
+	primed_transition = 1;
+
+    for (i=1; i<=st_count(full_terminal_set); i++) {
+	control_entry = 0;
+	gen = st_init_gen(terminal_set);
+	while (st_gen(gen, (char**)&key, (char**)&val)) {
+	    if (IABS(val) == i) {
+		sprintf(str, "%c ", (val>0)?'1':'0'); control_entry=1;
+		strcat(buf, str);
+		break;
+	    }  else if (pausing_stmt->type == EventControlStmt) {
+		if (i==ival) {
+		    sprintf(str, "1 "); strcat(buf, str); control_entry=1;
+		    break;
+		}
+	    }
+	}
+	if (i==ival && !control_entry &&
+	    pausing_stmt->type == EventControlStmt) {
+	    sprintf(str, "1 "); strcat(buf, str);
+	    control_entry=1;
+	}
+	st_free_gen(gen);
+	if (!control_entry) { sprintf(str, "- "); strcat(buf, str); }
+    }
+
+    if (pausing_stmt->type != DelayControlStmt) {
+
+	if (!primed_transition) {
+	    if (!vl_noTimers) {
+		fprintf(fg_out_file, "%s %s %s %s %s %s %s%d=0\n", buf,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)user_data)->loc,
+			((fg_node_info*)user_data)->loc,
+			HSIS_TIMER_SEP,
+			HSIS_BLIF_MVT_TIMER,
+			atoi(((fg_node_info*)user_data)->loc+1));
+	    } else {
+		fprintf(fg_out_file, "%s %s %s %s %s\n", buf,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)user_data)->loc,
+			((fg_node_info*)user_data)->loc);
+	    }
+
+	    if (RQautomata) {
+		if (!vl_noTimers) {
+		    fprintf(fg_out_file, "%s %s%s %s%s %s %s %s %s%d=0\n", buf,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    FG_TIMER_PRIME,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    FG_TIMER_PRIME,
+			    ((fg_node_info*)user_data)->loc,
+			    ((fg_node_info*)user_data)->loc,
+			    HSIS_TIMER_SEP,
+			    HSIS_BLIF_MVT_TIMER,
+			    atoi(((fg_node_info*)user_data)->loc+1));
+		} else {
+		    fprintf(fg_out_file, "%s %s%s %s%s %s %s\n", buf,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    FG_TIMER_PRIME,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    FG_TIMER_PRIME,
+			    ((fg_node_info*)user_data)->loc,
+			    ((fg_node_info*)user_data)->loc);
+		}
+	    }
+	} else {
+
+	    if (!vl_noTimers) {
+		fprintf(fg_out_file, "%s %s %s %s%s %s%s %s %s%d=0\n", buf,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)user_data)->loc, FG_TIMER_PRIME,
+			((fg_node_info*)user_data)->loc, FG_TIMER_PRIME,
+			HSIS_TIMER_SEP,
+			HSIS_BLIF_MVT_TIMER,
+			atoi(((fg_node_info*)user_data)->loc+1));
+
+		fprintf(fg_out_file, "%s %s%s %s%s %s %s %s %s%d=0\n", buf,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			FG_TIMER_PRIME,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			FG_TIMER_PRIME,
+			((fg_node_info*)user_data)->loc,
+			((fg_node_info*)user_data)->loc,
+			HSIS_TIMER_SEP,
+			HSIS_BLIF_MVT_TIMER,
+			atoi(((fg_node_info*)user_data)->loc+1));
+	    } else {
+		fprintf(fg_out_file, "%s %s %s %s%s %s%s\n", buf,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			((fg_node_info*)user_data)->loc, FG_TIMER_PRIME,
+			((fg_node_info*)user_data)->loc, FG_TIMER_PRIME);
+
+		fprintf(fg_out_file, "%s %s%s %s%s %s %s\n", buf,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			FG_TIMER_PRIME,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			FG_TIMER_PRIME,
+			((fg_node_info*)user_data)->loc,
+			((fg_node_info*)user_data)->loc);
+	    }
+	}
+    } else {
+
+	int idx;
+
+	src_timer =
+	    atoi(((fg_node_info*)current_source_vtx->user_data)->loc+1);
+	dest_timer = atoi(((fg_node_info*)user_data)->loc+1);
+	vl_expr_aux1_flag = vl_expr_aux2_flag = vl_expr_aux3_flag = 0;
+	vl_expr_aux1_val = vl_expr_aux2_val = vl_expr_aux3_val = (double)0;
+	if (!(pausing_stmt->delay->delay3 && !pausing_stmt->delay->delay2))
+	    delay1 = vl_eval_expr(pausing_stmt->delay->delay1);
+	else {
+	    vl_expr *expr;
+	    lsFirstItem((lsList)pausing_stmt->delay->delay1,
+			(lsGeneric*)&expr, 0);
+	    delay1 = vl_eval_expr(expr);
+	}
+
+
+
+	for (idx=0; idx<2; idx++) {
+	    if (idx==0) {
+
+		if (!primed_transition) {
+		    fprintf(fg_out_file, "%s %s %s %s %s ", buf,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    ((fg_node_info*)user_data)->loc,
+			    ((fg_node_info*)user_data)->loc);
+		} else {
+
+
+		    fprintf(fg_out_file, "%s %s %s %s%s %s%s ", buf,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    ((fg_node_info*)current_source_vtx->user_data)->loc,
+			    ((fg_node_info*)user_data)->loc, FG_TIMER_PRIME,
+			    ((fg_node_info*)user_data)->loc, FG_TIMER_PRIME);
+		}
+	    } else if (idx==1 && RQautomata) {
+
+
+		fprintf(fg_out_file, "%s %s%s %s%s %s %s ", buf,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			FG_TIMER_PRIME,
+			((fg_node_info*)current_source_vtx->user_data)->loc,
+			FG_TIMER_PRIME,
+			((fg_node_info*)user_data)->loc,
+			((fg_node_info*)user_data)->loc);
+	    }
+	    if (idx == 0 || RQautomata) {
+
+		if (!vl_noTimers) {
+		    if (!vl_expr_aux3_flag) {
+			if (vl_expr_aux1_flag)
+			    fprintf(fg_out_file, "%s %s%d==%.3f %s %s%d=0\n",
+				    HSIS_TIMER_SEP,
+				    HSIS_BLIF_MVT_TIMER,src_timer,vl_expr_aux1_val,
+				    HSIS_TIMER_SEP,HSIS_BLIF_MVT_TIMER,dest_timer);
+			else
+			    fprintf(fg_out_file, "%s %s%d==%d %s %s%d=0\n",
+				    HSIS_TIMER_SEP,
+				    HSIS_BLIF_MVT_TIMER, src_timer, delay1,
+				    HSIS_TIMER_SEP,HSIS_BLIF_MVT_TIMER,dest_timer);
+		    } else {
+			fprintf(fg_out_file,
+				"%s %s%d>=%.3f %s %s%d<=%.3f %s %s%d=0\n",
+				HSIS_TIMER_SEP,
+				HSIS_BLIF_MVT_TIMER, src_timer, vl_expr_aux1_val,
+				HSIS_TIMER_SEP,
+				HSIS_BLIF_MVT_TIMER, src_timer, vl_expr_aux3_val,
+				HSIS_TIMER_SEP,
+				HSIS_BLIF_MVT_TIMER, dest_timer);
+		    }
+		} else {
+		    fprintf(fg_out_file, "\n");
+		}
+	    }
+	}
+    }
+}
+
+
+
+static void fg_put_init_timer_trans_int(void *user_data)
+{
+    int i;
+    st_generator *gen;
+    vl_term *key;
+    int val;
+    int control_entry=0;
+    int dest_timer;
+
+    if (((fg_node_info*)user_data)->type != FG_ND_PAUSE) return;
+
+    for (i=1; i<=st_count(full_terminal_set); i++) {
+	control_entry = 0;
+	gen = st_init_gen(terminal_set);
+	while (st_gen(gen, (char**)&key, (char**)&val)) {
+	    if (IABS(val) == i) {
+		fprintf(fg_out_file, "%c ", (val>0)?'1':'0');
+		control_entry=1;
+		break;
+	    }
+	}
+	st_free_gen(gen);
+	if (!control_entry) {
+	    fprintf(fg_out_file, "- ");
+	}
+    }
+    dest_timer = atoi(((fg_node_info*)user_data)->loc+1);
+
+    fprintf(fg_out_file, "%s%d%s ", FG_LLOC, 0, FG_RLOC);
+    fprintf(fg_out_file, "%s%d%s ", FG_LLOC, 0, FG_RLOC);
+    fprintf(fg_out_file, "%s ", ((fg_node_info*)user_data)->loc);
+    fprintf(fg_out_file, "%s ", ((fg_node_info*)user_data)->loc);
+    if (!vl_noTimers) {
+	fprintf(fg_out_file, "%s %s%d=0\n", HSIS_TIMER_SEP,
+		HSIS_BLIF_MVT_TIMER, dest_timer);
+    } else {
+	fprintf(fg_out_file, "\n");
+    }
+}
+
+
+
+void fg_put_init_transition(file, graph)
+FILE *file;
+graph_t *graph;
+{
+    terminal_set = st_init_table(st_ptrcmp, st_ptrhash);
+    fg_gen_fore_dfs(((fg_graph_info*)graph->user_data)->init_node,
+		    fg_node_is_pause, fg_put_init_timer_trans_int,
+		    remember_node_terminal,
+		    switch_node_branch,
+		    forget_node_terminal,
+		    remember_arc_terminal, forget_arc_terminal, 1);
+    st_free_table(terminal_set);
+    terminal_set = NIL(st_table);
+}
+
+
+
+void fg_put_stay_pause(file, pause)
+FILE *file;
+vertex_t *pause;
+{
+    int i, val;
+    int src_timer;
+    int delay1;
+    double delay;
+    vl_delay_control_stmt *pausing_stmt;
+    char buf[MAXSTRLEN];
+    char str[MAXSTRLEN];
+
+    if (((fg_node_info*)pause->user_data)->type != FG_ND_PAUSE) return;
+    pausing_stmt = (vl_delay_control_stmt*)
+	((fg_node_info*)current_source_vtx->user_data)->data;
+    if (pausing_stmt->type != DelayControlStmt &&
+	pausing_stmt->type != EventControlStmt) return;
+
+    if (pausing_stmt->type == EventControlStmt) {
+	if (!st_lookup(full_terminal_set,
+		       ((vl_event_control_stmt*)pausing_stmt)->fg_info,
+		       (char**)&val))
+	    val = 0;
+	else
+	    val -= FG_MAGIC_UB_EDGE;
+    }
+
+    buf[0]='\0';
+    for (i=1; i<=st_count(full_terminal_set); i++)
+	if (i == val) {
+	    sprintf(str, "0 "); strcat(buf, str);
+	} else {
+	    sprintf(str, "- "); strcat(buf, str);
+	}
+
+
+    if (pausing_stmt->type != DelayControlStmt) {
+
+	fprintf(file, "%s %s %s%s %s%s %s%s%06x\n", buf,
+		((fg_node_info*)pause->user_data)->loc,
+		FG_LLOC, FG_RLOC, FG_LLOC, FG_RLOC,
+		HSIS_EQUAL, FG_TIMER_PS,
+		((fg_graph_info*)g_vertex_graph(pause)->user_data)->fg_id);
+	if (RQautomata) {
+
+	    fprintf(file, "%s %s%s %s%s %s%s %s%s%06x\n", buf,
+		    ((fg_node_info*)pause->user_data)->loc, FG_TIMER_PRIME,
+		    FG_LLOC, FG_RLOC, FG_LLOC, FG_RLOC,
+		    HSIS_EQUAL, FG_TIMER_PS,
+		    ((fg_graph_info*)g_vertex_graph(pause)->user_data)->fg_id);
+	}
+	return;
+    }
+
+
+    src_timer = atoi(((fg_node_info*)pause->user_data)->loc+1);
+    vl_expr_aux1_flag = vl_expr_aux2_flag = vl_expr_aux3_flag = 0;
+    vl_expr_aux1_val = vl_expr_aux2_val = vl_expr_aux3_val = (double)0;
+    if (!(pausing_stmt->delay->delay3 && !pausing_stmt->delay->delay2))
+	delay1 = vl_eval_expr(pausing_stmt->delay->delay1);
+    else {
+	vl_expr *expr;
+	lsFirstItem((lsList)pausing_stmt->delay->delay1, (lsGeneric*)&expr, 0);
+	delay1 = vl_eval_expr(expr);
+    }
+    if (!vl_expr_aux3_flag)
+	if (vl_expr_aux1_flag) delay = vl_expr_aux1_val;
+	else delay = delay1;
+    else
+	delay = vl_expr_aux3_val;
+
+    if (!vl_noTimers) {
+	fprintf(file, "%s %s %s%s %s%s %s%s%06x %s %s%d<%.3f\n", buf,
+		((fg_node_info*)pause->user_data)->loc,
+		FG_LLOC, FG_RLOC, FG_LLOC,FG_RLOC, HSIS_EQUAL, FG_TIMER_PS,
+		((fg_graph_info*)g_vertex_graph(pause)->user_data)->fg_id,
+		HSIS_TIMER_SEP, HSIS_BLIF_MVT_TIMER, src_timer, delay);
+     }
+
+    if (RQautomata) {
+	if (!vl_noTimers) {
+	    fprintf(file, "%s %s%s %s%s %s%s %s%s%06x %s %s%d<%.3f\n", buf,
+		    ((fg_node_info*)pause->user_data)->loc, FG_TIMER_PRIME,
+		    FG_LLOC, FG_RLOC, FG_LLOC, FG_RLOC,
+		    HSIS_EQUAL, FG_TIMER_PS,
+		    ((fg_graph_info*)g_vertex_graph(pause)->user_data)
+		    ->fg_id,
+		    HSIS_TIMER_SEP, HSIS_BLIF_MVT_TIMER, src_timer, delay);
+	}
+    }
+}
+
+
+static vertex_t *next_node_in_string(u)
+vertex_t *u;
+{
+    vertex_t *v;
+    lsList out_edges;
+    edge_t *edge;
+
+    out_edges = g_get_out_edges(u);
+    if (lsLength(out_edges) == 0) return NIL(vertex_t);
+
+    lsFirstItem(out_edges, (lsGeneric*)&edge, 0);
+    v = g_e_dest(edge);
+
+    return v;
+}
+
+
+
+void fg_write_timer(FILE *file, graph_t *graph)
+{
+    vertex_t *pause;
+    vertex_t *v;
+    lsGen gen;
+    lsHandle handle;
+    int pass;
+
+    fg_out_file = file;
+    fprintf(file, "%s timing automatan: time flies\n", HSIS_COMMENT);
+
+    for (pass=1; pass<=2; pass++) {
+
+
+
+	if (pass == 1) {
+	    terminal_set = st_init_table(st_ptrcmp, st_ptrhash);
+	}
+
+	for (gen=lsStart(((fg_graph_info*)graph->user_data)->pause_list);
+	     lsNext(gen, (lsGeneric*)&pause, &handle) != LS_NOMORE; ) {
+	    current_source_vtx = pause;
+	    if (!(v = next_node_in_string(pause)))
+		continue;
+
+	    if (pass == 1) {
+		fg_fore_dfs(v, fg_node_is_pause,
+			    remember_node_terminal, remember_arc_terminal);
+	    } else if (pass == 2) {
+		fg_put_stay_pause(file, pause);
+		terminal_set = st_init_table(st_ptrcmp, st_ptrhash);
+		fg_gen_fore_dfs(v,
+				fg_node_is_pause, fg_put_timer_transition,
+				remember_node_terminal,
+				switch_node_branch,
+				forget_node_terminal,
+				remember_arc_terminal, forget_arc_terminal, 1);
+
+		st_free_table(terminal_set);
+		terminal_set = NIL(st_table);
+		terminal_set_count = 1;
+	    }
+	    current_source_vtx = NIL(vertex_t);
+	}
+	lsFinish(gen);
+
+	if (pass == 1) {
+	    fg_declare_timer(file, terminal_set, graph);
+	    fg_put_timer_header(file, terminal_set, graph);
+
+	    full_terminal_set = terminal_set;
+	    terminal_set = NIL(st_table);
+	    terminal_set_count = 1;
+	}
+     }
+
+    fg_put_init_transition(file, graph);
+
+    st_free_table(full_terminal_set);
+    full_terminal_set = NIL(st_table);
+    fg_out_file = NIL(FILE);
+}
+
+
+static st_table *fg_node_set=NIL(st_table);
+static int fg_consistency = 1;
+
+static void fg_check_duplicate(vertex_t *src)
+{
+    int val;
+    vertex_t *v;
+    edge_t *e;
+    lsList visit_list;
+    lsGen gen;
+    lsHandle handle;
+
+    if (!fg_consistency) return;
+    if (!src) return;
+    if (((fg_node_info*)src->user_data)->type == FG_ND_PAUSE) return;
+
+    if (st_lookup(fg_node_set, (char*)src, (char**)&val)) {
+	fg_consistency = 0;
+    } else {
+	st_insert(fg_node_set, (char*)src, 0);
+	visit_list = g_get_out_edges(src);
+	for (gen=lsStart(visit_list);
+	     lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	    v = g_e_dest(e);
+	    fg_check_duplicate(v);
+	}
+	lsFinish(gen);
+    }
+}
+
+
+
+int fg_check_timer_consistency(FILE *file, graph_t *graph)
+{
+    fg_consistency = 1;
+    fg_node_set = st_init_table(st_ptrcmp, st_ptrhash);
+
+    fg_check_duplicate(((fg_graph_info*)graph->user_data)->init_node);
+
+    st_free_table(fg_node_set);
+    fg_node_set = NIL(st_table);
+    return fg_consistency;
+}
+
+
+
+static int fg_id = 0;
+static int fg_current_id = 0;
+
+
+int fg_new_fg_id()
+{
+    fg_current_id = ++fg_id;
+    return fg_current_id;
+}
+
+
+void fg_set_fg_id(int id)
+{
+    fg_current_id = id;
+}
+
+
+
+int fg_fg_id()
+{
+    return fg_current_id;
+}
+
+
+
+void fg_associate_id_vars(int id, st_table *vars)
+{
+    st_insert(vl_description->fg_vars_st, (char*)id, (char*)vars);
+}
+
+
+static int data_pause_count=0;
+
+st_table *fg_graph_has_one_data_detector(graph)
+graph_t *graph;
+{
+    vl_event_control_stmt *pstmt;
+    vl_event_expr *e;
+    lsGen gen, ggen;
+    vertex_t *v;
+    lsHandle handle;
+    int non_data_pause;
+    int check_failed;
+    st_table *new_sensitiveList;
+
+    if (!graph) return NIL(st_table);
+
+    non_data_pause = 0;
+    check_failed = 0;
+    data_pause_count=0;
+    new_sensitiveList = st_init_table(strcmp, st_strhash);
+    foreach_vertex(graph, ggen, v) {
+	if (((fg_node_info*)v->user_data)->type == FG_ND_PAUSE &&
+	    !check_failed) {
+	    pstmt =
+	      (vl_event_control_stmt*)((fg_node_info*)v->user_data)->data;
+	    if (pstmt->type == EventControlStmt) {
+
+		if (pstmt->event->type == OrEventExpr) {
+		    for (gen=lsStart(pstmt->event->list);
+			 lsNext(gen,(lsGeneric*)&e,&handle)!=LS_NOMORE; ) {
+			if (e->type == NegedgeEventExpr ||
+			    e->type == PosedgeEventExpr) {
+			    non_data_pause = 1;
+			    break;
+			}
+			if (e->expr->type == IDExpr)
+			    st_insert(new_sensitiveList,
+				      e->expr->u.name->name,0);
+			else if (e->expr->type == MinTypMaxExpr) {
+			    if (e->expr->u.exprs.e1->type == IDExpr)
+				st_insert(new_sensitiveList,
+					  e->expr->u.exprs.e1->u.name->name,0);
+			}
+		    }
+		    lsFinish(gen);
+		} else {
+		    if (pstmt->event->type == NegedgeEventExpr ||
+			pstmt->event->type == PosedgeEventExpr) {
+			non_data_pause = 1;
+		    }
+		    if (pstmt->event->expr->type == IDExpr)
+			st_insert(new_sensitiveList,
+				  pstmt->event->expr->u.name->name,0);
+		}
+
+		if (!non_data_pause)
+		    data_pause_count++;
+		else
+		    check_failed = 1;
+	    }
+	}
+    }
+
+    if (data_pause_count==1 && !check_failed) {
+    } else {
+	st_free_table(new_sensitiveList);
+	new_sensitiveList = NIL(st_table);
+    }
+
+    return new_sensitiveList;
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_flowgraph.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_flowgraph.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_flowgraph.h	(revision 18)
@@ -0,0 +1,97 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_flowgraph.h,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+EXTERN graph_t *fg_new_graph ARGS(());
+
+
+EXTERN edge_t *fg_new_always_block ARGS(());
+EXTERN void fg_new_seq_block ARGS(());
+EXTERN vertex_t *fg_new_ifelse_block ARGS((vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**));
+EXTERN vertex_t *fg_new_case_block ARGS((vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**, vertex_t**));
+EXTERN edge_t *fg_new_case_tag_block ARGS((vertex_t*, vertex_t*, vertex_t*, vertex_t*));
+
+
+EXTERN vertex_t *fg_new_pause_node ARGS(());
+EXTERN vertex_t *fg_new_assign_node ARGS(());
+
+
+EXTERN int fg_reduce_simple_branches_back_block ARGS((vertex_t*, vertex_t*, vertex_t*, vertex_t*));
+EXTERN edge_t *fg_closeloop ARGS(());
+EXTERN edge_t *fg_force_edge ARGS((vertex_t*, vertex_t*, vertex_t*, vertex_t*));
+
+
+EXTERN fg_graph_info *fg_new_graph_info ARGS(());
+EXTERN fg_graph_info *get_assoc_lc_name ARGS((char *loc, char *lc_name));
+EXTERN fg_node_info *fg_new_node_info ARGS((int));
+EXTERN fg_arc_info *fg_new_arc_info ARGS((int));
+EXTERN void fg_update_node_info ARGS((vertex_t*, char*));
+EXTERN void fg_update_arc_info ARGS((edge_t*, char*));
+
+
+EXTERN void fg_clean_vertex_data ARGS((gGeneric));
+EXTERN void fg_clean_edge_data ARGS((gGeneric));
+
+
+EXTERN vl_term *fg_write_lc_in_LabelSet ARGS((FILE*, st_table*, int));
+EXTERN vl_term *fg_write_if_priority_decoder ARGS((FILE*, vl_term*, vl_term*, vl_term*));
+EXTERN vl_term *fg_write_case_priority_decoder ARGS((FILE*, vl_term*, vl_term*, vl_term*, vl_term*));
+EXTERN void fg_if_collect_pause_rewrite_ctrl ARGS((FILE*, vertex_t*, vertex_t*, vl_term**));
+EXTERN void fg_put_loc_context ARGS((FILE *file, st_table *pre_cond, char *lc_name));
+EXTERN int fg_check_timer_consistency ARGS((FILE *file, graph_t *graph));
+EXTERN void fg_set_fg ARGS((graph_t *graph));
+
+EXTERN st_table* fg_assign_temporal_context ARGS((vertex_t*));
+
+
+EXTERN st_table* fg_graph_has_one_data_detector ARGS((graph_t*));
+EXTERN int fg_new_fg_id ARGS(());
+EXTERN void fg_set_fg_id ARGS((int id));
+EXTERN int fg_fg_id ARGS(());
+EXTERN void fg_associate_id_vars ARGS((int id, st_table *vars));
+EXTERN void fg_loop_collect_pause ARGS((FILE *file, vertex_t *src,
+					vertex_t *sink,
+					vl_term **dom_sel));
+EXTERN void fg_case_collect_pause_rewrite_ctrl ARGS((FILE *file,
+						     vertex_t *src,
+						     vertex_t *sink, 
+						     vl_term **spacial_ctrl,
+						     vl_term **temporal_ctrl));
+EXTERN void fg_write_timer ARGS((FILE *file, graph_t *graph));
+EXTERN vertex_t *fg_pseudo_sink ARGS(());
+EXTERN int fg_check_cyclic ARGS(());
+EXTERN void fg_clean_fg ARGS(());
+EXTERN int fg_not_empty ARGS(());
+EXTERN void fg_record_SrcSink ARGS((vertex_t **src, vertex_t **sink,
+				    vertex_t **cmp_src, vertex_t **cmp_sink));
+EXTERN void fg_restore_SrcSink ARGS((vertex_t *src, vertex_t *sink,
+				     vertex_t *cmp_src, vertex_t *cmp_sink));
+EXTERN vertex_t *fg_new_loop_block ARGS((vertex_t **old_srce,
+					 vertex_t **old_sink,
+					 vertex_t **new_src,
+					 vertex_t **new_sink,
+					 vertex_t **old_cmpsrc,
+					 vertex_t **old_cmpsink,
+					 vertex_t **new_cmpsrc,
+					 vertex_t **new_cmpsink));
Index: vis_dev/vl2mv-2.3/src/parser/vl_latch.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_latch.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_latch.c	(revision 18)
@@ -0,0 +1,671 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_latch.c,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "st.h"
+#include "array.h"
+#include "list.h"
+#include "set.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_vardecl.h"
+#include "vl_mux.h"
+#include "verilog.h"
+
+extern int dumpSyncCkt;
+extern int set_notation;
+extern int smartEvent;
+extern int implicitClocking;
+extern vl_desc *mod_list;
+
+extern char *sync_assign();
+
+static void check_comb_reduction ARGS((vl_id_range *id_sym));
+
+
+void instantiate_mvar_latch(FILE *file,
+			    int non_block_var,
+			    int mark_sel_var, int lo, int hi,
+			    vl_id_range *id_sym,
+			    vl_id_range *orig_id_sym,
+			    var_info *lhsvar,
+			    char *lname)
+{
+    int idx, idx_lo, idx_hi;
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+    vl_id_range *temp_id_sym;
+    vl_term *feed_back_array;
+    int old_id_type;
+    st_table *sensitiveList;
+    int dummy;
+
+    old_id_type = orig_id_sym->flags;
+    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+    if (vl_currentModule->combVar_st) {
+	if (st_lookup(vl_currentModule->combVar_st, orig_id_sym->name,
+		      (char**)&temp_id_sym) &&
+	    !st_lookup(vl_currentModule->seqVar_st, orig_id_sym->name,
+		       (char**)&temp_id_sym)) {
+
+	    orig_id_sym->flags &= ~RegVar;
+	} else {
+	    check_comb_reduction(orig_id_sym);
+	}
+    }
+
+
+
+    sensitiveList = NIL(st_table);
+    if(!id_sym->range) {
+	if (sensitiveList && (orig_id_sym->flags & RegVar)) {
+
+	    vl_term *feed_back;
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "%s%s", id_sym->name, PIN_FEEDBACK);
+	    feed_back = create_rename_term(id_sym, buf, 0, -1);
+	    feed_back->term_type = id_sym->id_type;
+	    instantiate_mux(file,
+			    lhsvar->current_terminal, feed_back,
+			    sensitive_control(file, sensitiveList),
+			    create_rename_term(feed_back->name, lname, 0, -1));
+	    fprintf(file, "%s %s %s\n",
+		    ".latch",
+		    non_block_var?
+			sel_var(strip_char(lname,SEP_LATCH)):
+			strip_char(lname,SEP_LATCH),
+		    feed_back->name->name);
+	    vl_free_term(feed_back);
+	} else {
+
+
+
+	    if (!implicitClocking && orig_id_sym->edge_trigger) {
+		vl_term *feed_back, *new_terminal;
+		feed_back = vl_create_term(orig_id_sym, 0, -1);
+		new_terminal = typed_new_term(orig_id_sym->id_type,
+					      orig_id_sym->range, 0, -1);
+		feed_back->flag    |= lhsvar->current_terminal->flag;
+		new_terminal->flag |= lhsvar->current_terminal->flag;
+		write_mvar_decl(file, new_terminal);
+		instantiate_mux(file, lhsvar->current_terminal, feed_back,
+				orig_id_sym->edge_trigger, new_terminal);
+		lhsvar->current_terminal = new_terminal;
+	    }
+
+	    fprintf(file, "%s %s %s",
+		    (orig_id_sym->flags&RegVar)?
+		    ".latch":".names",
+		    lhsvar->current_terminal->name->name,
+		    non_block_var?
+		    sel_var(strip_char(lname,SEP_LATCH)):
+		    strip_char(lname,SEP_LATCH));
+	    if (st_lookup(vl_currentModule->quasi_st,lname,(char**)&dummy))
+		fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+	    fprintf(file, "\n");
+
+	    if (!(orig_id_sym->flags&RegVar)) {
+		if (set_notation) {
+		    fprintf(file, "- %s%s\n",
+			    HSIS_EQUAL,
+			    lhsvar->current_terminal->name->name);
+		} else {
+		    for (enum_gen=lsStart(domain);
+			 lsNext(enum_gen,
+				(lsGeneric*)&enum_elt,&enum_handle)!=
+			     LS_NOMORE;) {
+			fprintf(file, "%s %s\n",
+				enum_elt->name,enum_elt->name);
+		    }
+		    lsFinish(enum_gen);
+		}
+	    } else if (non_block_var && mark_sel_var) {
+		fprintf(file, ".names %s \n", lname);
+		fprintf(file, "%s\n", strip_char(lname,SEP_SEL_VAR));
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,
+			    (lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;) {
+		    fprintf(file, "%s %s\n",
+			    enum_elt->name, enum_elt->name);
+		}
+		lsFinish(enum_gen);
+	    }
+	}
+    } else {
+	char buf[MAXSTRLEN];
+
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	sprintf(buf, "%s%s", id_sym->name, PIN_FEEDBACK);
+	feed_back_array = create_rename_term(id_sym, buf, 0, -1);
+	for (idx=idx_lo; idx<=idx_hi; idx++) {
+	    if (sensitiveList && (orig_id_sym->flags & RegVar)) {
+
+		vl_term *feed_back;
+
+		sprintf(buf, "%s%s%d%s",
+			feed_back_array->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY);
+		feed_back = create_rename_term(feed_back_array->name,
+					       buf, 0, -1);
+		sprintf(buf, "%s%s%d%s", lname, SEP_LARRAY, idx, SEP_RARRAY);
+		instantiate_mux(file,
+				lhsvar->current_terminal, feed_back,
+				sensitive_control(file, sensitiveList),
+				create_rename_term(feed_back_array->name, buf,
+						   0, -1));
+		fprintf(file, "%s %s%s%d%s %s\n",
+			".latch",
+			non_block_var?
+			    sel_var(strip_char(lname,SEP_LATCH)):
+			    strip_char(lname,SEP_LATCH),
+			SEP_LARRAY, idx, SEP_RARRAY,
+			feed_back->name->name);
+		vl_free_term(feed_back);
+	    } else {
+
+
+
+		if (!implicitClocking && orig_id_sym->edge_trigger) {
+		    vl_term *feed_back, *new_terminal;
+		    feed_back = vl_create_term(orig_id_sym, 0, -1);
+		    new_terminal = typed_new_term(orig_id_sym->id_type,
+						  orig_id_sym->range, 0, -1);
+		    instantiate_mux(file, lhsvar->current_terminal, feed_back,
+				    orig_id_sym->edge_trigger, new_terminal);
+		    lhsvar->current_terminal = new_terminal;
+		}
+
+		fprintf(file, "%s %s%s%d%s %s%s%d%s",
+			(orig_id_sym->flags&RegVar)?
+			".latch":".names",
+			lhsvar->current_terminal->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			non_block_var?
+			sel_var(strip_char(lname,SEP_LATCH)):
+			strip_char(lname,SEP_LATCH),
+			SEP_LARRAY, idx, SEP_RARRAY);
+		if (st_lookup(vl_currentModule->quasi_st,
+			      lname,(char**)&dummy))
+		    fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+		fprintf(file, "\n");
+		if (!(orig_id_sym->flags&RegVar)) {
+		    if (set_notation) {
+			fprintf(file, "- %s%s%s%d%s\n",
+				HSIS_EQUAL,
+				lhsvar->current_terminal->name->name,
+				SEP_LARRAY, idx, SEP_RARRAY);
+		    } else {
+			for (enum_gen=lsStart(domain);
+			     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+				 LS_NOMORE;) {
+			    fprintf(file, "%s %s\n",
+				    enum_elt->name, enum_elt->name);
+			}
+			lsFinish(enum_gen);
+		    }
+		} else if (non_block_var && mark_sel_var) {
+		    fprintf(file, ".names %s%s%d%s ",
+			    lname,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		    fprintf(file, "%s%s%d%s\n",
+			    strip_char(lname,SEP_SEL_VAR),
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		    for (enum_gen=lsStart(domain);
+			 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			     LS_NOMORE;) {
+			fprintf(file, "%s %s\n",
+				enum_elt->name, enum_elt->name);
+		    }
+		    lsFinish(enum_gen);
+		}
+	    }
+	}
+    }
+
+    orig_id_sym->flags = old_id_type;
+
+
+    lo = lo;
+    hi = hi;
+}
+
+
+void instantiate_bin_scalar_latch(FILE *file, int non_block_var,
+				  int mark_sel_var,
+				  vl_id_range *id_sym,
+				  vl_id_range *orig_id_sym,
+				  var_info *lhsvar, char *lname)
+{
+    int i;
+    int modify_id_flag = 0;
+    int idx, idx_lo, idx_hi;
+    vl_id_range *temp_id_sym;
+    int old_id_type=0;
+    vl_term *feed_back_array;
+    st_table *sensitiveList;
+    int dummy;
+
+    if (vl_currentModule->combVar_st) {
+	if (st_lookup(vl_currentModule->combVar_st, orig_id_sym->name,
+		      (char**)&temp_id_sym) &&
+	    !st_lookup(vl_currentModule->seqVar_st, orig_id_sym->name,
+		       (char**)&temp_id_sym)) {
+	    modify_id_flag = 1;
+	    old_id_type = orig_id_sym->flags;
+	    orig_id_sym->flags &= ~RegVar;
+	} else {
+	    check_comb_reduction(orig_id_sym);
+	}
+    }
+
+
+
+    sensitiveList = NIL(st_table);
+    if (!id_sym->range) {
+	if (sensitiveList && (orig_id_sym->flags & RegVar)) {
+
+	    vl_term *feed_back;
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "%s", id_sym->name);
+	    feed_back = create_rename_term(id_sym, buf, 0, -1);
+	    instantiate_mux(file,
+			    lhsvar->current_terminal, feed_back,
+			    sensitive_control(file, sensitiveList),
+			    create_rename_term(feed_back->name, lname, 0, -1));
+	    fprintf(file, "%s %s %s\n",
+		    ".latch",
+		    non_block_var?
+			sel_var(strip_char(lname,SEP_LATCH)):
+			strip_char(lname,SEP_LATCH),
+		    feed_back->name->name);
+	    vl_free_term(feed_back);
+	} else {
+
+
+
+	    if (!implicitClocking && orig_id_sym->edge_trigger) {
+		vl_term *feed_back, *new_terminal;
+		feed_back = vl_create_term(orig_id_sym, 0, -1);
+		new_terminal = typed_new_term(orig_id_sym->id_type,
+					      orig_id_sym->range, 0, -1);
+		instantiate_mux(file, lhsvar->current_terminal, feed_back,
+				orig_id_sym->edge_trigger, new_terminal);
+		lhsvar->current_terminal = new_terminal;
+	    }
+
+	    if (id_sym->flags & EventVar) {
+		vl_write_bit_connect(file,
+				     lhsvar->current_terminal->name->name,
+				     lname, 0);
+		if (!smartEvent)
+		    fprintf(file, ".latch %s %s%s%s\n",
+			    lname, lname, SEP_GATEPIN, PIN_EVENT);
+	    } else {
+		fprintf(file, "%s %s %s",
+			(orig_id_sym->flags&RegVar)?
+			".latch":".names",
+			lhsvar->current_terminal->name->name,
+			non_block_var?
+			sel_var(strip_char(lname,SEP_LATCH)):
+			strip_char(lname,SEP_LATCH));
+		if (st_lookup(vl_currentModule->quasi_st,
+			      lname, (char**)&dummy))
+		    fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+		fprintf(file, "\n");
+	    }
+
+	    if (!(orig_id_sym->flags&RegVar)) {
+		fprintf(file, "1 1\n0 0\n");
+	    } else if (non_block_var && mark_sel_var) {
+		fprintf(file, ".names %s ", lname);
+		fprintf(file, "%s\n", strip_char(lname,SEP_SEL_VAR));
+		for (i=0; i<=1; i++) {
+		    fprintf(file, "%d %d\n", i, i);
+		}
+	    }
+	}
+    } else {
+	char buf[MAXSTRLEN];
+
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	sprintf(buf, "%s%s", id_sym->name, PIN_FEEDBACK);
+	feed_back_array = create_rename_term(id_sym, buf, 0, -1);
+	for (idx=idx_lo; idx<=idx_hi; idx++) {
+	    if (sensitiveList && (orig_id_sym->flags & RegVar)) {
+
+		vl_term *feed_back;
+
+		sprintf(buf, "%s%s%s%d%s",
+			feed_back_array->name->name, PIN_FEEDBACK,
+			SEP_LARRAY, idx, SEP_RARRAY);
+		feed_back = create_rename_term(feed_back_array->name,
+					       buf, 0, -1);
+		sprintf(buf, "%s%s%d%s", lname, SEP_LARRAY, idx, SEP_RARRAY);
+		instantiate_mux(file,
+				lhsvar->current_terminal, feed_back,
+				sensitive_control(file, sensitiveList),
+				create_rename_term(feed_back_array->name, buf,
+						   0, -1));
+		fprintf(file, "%s %s%s%d%s %s\n",
+			".latch",
+			non_block_var?
+			    sel_var(strip_char(lname,SEP_LATCH)):
+			    strip_char(lname,SEP_LATCH),
+			SEP_LARRAY, idx, SEP_RARRAY,
+			feed_back->name->name);
+		vl_free_term(feed_back);
+	    } else {
+
+
+
+		if (!implicitClocking && orig_id_sym->edge_trigger) {
+		    vl_term *feed_back, *new_terminal;
+		    feed_back = vl_create_term(orig_id_sym, 0, -1);
+		    new_terminal = typed_new_term(orig_id_sym->id_type,
+						  orig_id_sym->range, 0, -1);
+		    instantiate_mux(file, lhsvar->current_terminal, feed_back,
+				    orig_id_sym->edge_trigger, new_terminal);
+		    lhsvar->current_terminal = new_terminal;
+		}
+
+		fprintf(file, "%s %s%s%d%s %s%s%d%s",
+			(orig_id_sym->flags&RegVar)?
+			".latch":".names",
+			lhsvar->current_terminal->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			non_block_var?
+			sel_var(strip_char(lname,SEP_LATCH)):
+			strip_char(lname,SEP_LATCH),
+			SEP_LARRAY, idx, SEP_RARRAY);
+		if (st_lookup(vl_currentModule->quasi_st,
+			      lname,(char**)&dummy))
+		    fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+		fprintf(file, "\n");
+		if (!(orig_id_sym->flags&RegVar)) {
+		    fprintf(file, "1 1\n0 0\n");
+		} else if (non_block_var && mark_sel_var) {
+		    fprintf(file, ".names %s%s%d%s ",
+			    lname,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		    fprintf(file, "%s%s%d%s\n",
+			    strip_char(lname,SEP_SEL_VAR),
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		    for (i=0; i<=1; i++) {
+			fprintf(file, "%d %d\n", i, i);
+		    }
+		}
+	    }
+	}
+    }
+
+    if (modify_id_flag)
+	orig_id_sym->flags = old_id_type;
+}
+
+
+void instantiate_bin_vector_latch(FILE *file,
+				  int non_block_var,
+				  int mark_sel_var,
+				  int lo, int hi,
+				  vl_id_range *id_sym,
+				  vl_id_range *orig_id_sym,
+				  var_info *lhsvar,
+				  char *lname)
+{
+    int i;
+    int idx, idx_lo, idx_hi;
+    int old_id_type=0;
+    vl_id_range *temp_id_sym;
+    vl_term *feed_back_array;
+    st_table *sensitiveList;
+    int need_recover_id_sym=0;
+    int dummy;
+    extern int combinationalReduction;
+
+    if (vl_currentModule->combVar_st) {
+	if (st_lookup(vl_currentModule->combVar_st, orig_id_sym->name,
+		      (char**)&temp_id_sym) &&
+	    !st_lookup(vl_currentModule->seqVar_st, orig_id_sym->name,
+		       (char**)&temp_id_sym)) {
+	    old_id_type = orig_id_sym->flags;
+	    need_recover_id_sym = 1;
+	    orig_id_sym->flags &= ~RegVar;
+	} else {
+	    check_comb_reduction(orig_id_sym);
+	}
+    }
+
+    if (id_sym->syndrome_expr_list)
+	if (lsLength(id_sym->syndrome_expr_list) == 0)
+	    if (id_sym->rst_syndrome_expr_list)
+		if (lsLength(id_sym->rst_syndrome_expr_list) == 0)
+		    if (combinationalReduction)
+			return;
+
+    sensitiveList = NIL(st_table);
+
+    if (orig_id_sym->flags & RegVar) {
+	if (!sensitiveList) {
+
+	    if (!implicitClocking && orig_id_sym->edge_trigger) {
+		vl_term *feed_back, *new_terminal;
+		feed_back = vl_create_term(orig_id_sym, lo, hi);
+		new_terminal = typed_new_term(orig_id_sym->id_type,
+					      orig_id_sym->range, lo, hi);
+		instantiate_mux(file, lhsvar->current_terminal,
+				feed_back,
+				orig_id_sym->edge_trigger,
+				new_terminal);
+		lhsvar->current_terminal = new_terminal;
+	    }
+	}
+    }
+    for (i=lo; i<=hi; i++) {
+	if (!id_sym->range) {
+	    if (sensitiveList && (orig_id_sym->flags & RegVar)) {
+
+		vl_term *feed_back;
+		char buf[MAXSTRLEN];
+
+		sprintf(buf, "%s%s", id_sym->name, PIN_FEEDBACK);
+		feed_back = create_rename_term(id_sym, buf, lo, hi);
+		instantiate_mux(file,
+				lhsvar->current_terminal, feed_back,
+				sensitive_control(file, sensitiveList),
+				create_rename_term(feed_back->name,lname,
+						   0,-1));
+		fprintf(file, "%s %s %s\n",
+			".latch",
+			non_block_var?
+			sel_var(strip_char(lname,SEP_LATCH)):
+			strip_char(lname,SEP_LATCH),
+			feed_back->name->name);
+		vl_free_term(feed_back);
+	    } else {
+
+		fprintf(file, "%s %s%s%d%s %s%s%d%s",
+			(orig_id_sym->flags&RegVar)?
+			".latch":".names",
+			lhsvar->current_terminal->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			non_block_var?
+			sel_var(strip_char(lname,SEP_LATCH)):
+			strip_char(lname,SEP_LATCH),
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		if (st_lookup(vl_currentModule->quasi_st,
+			      lname,(char**)&dummy))
+		    fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+		fprintf(file, "\n");
+		if (!(orig_id_sym->flags&RegVar)) {
+		    fprintf(file, "1 1\n0 0\n");
+		} else if (non_block_var && mark_sel_var) {
+		    fprintf(file, ".names %s%s%d%s %s%s%d%s",
+			    lname,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT,
+			    strip_char(lname, SEP_SEL_VAR),
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    fprintf(file, "1 1\n0 0\n");
+		}
+	    }
+	} else {
+	    char buf[MAXSTRLEN];
+
+	    idx_lo = vl_eval_expr(id_sym->range->left);
+	    if (id_sym->range->right)
+		idx_hi = vl_eval_expr(id_sym->range->right);
+	    else
+		idx_hi = idx_lo;
+
+	    sprintf(buf, "%s%s", id_sym->name, PIN_FEEDBACK);
+	    feed_back_array = create_rename_term(id_sym, buf, lo, hi);
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		if (sensitiveList && (orig_id_sym->flags & RegVar)) {
+
+		    vl_term *feed_back;
+		    char buf[MAXSTRLEN];
+
+		    sprintf(buf, "%s%s%d%s", feed_back_array->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		    feed_back = create_rename_term(feed_back_array->name,
+						   buf, lo, hi);
+		    sprintf(buf, "%s%s%d%s", lname,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		    instantiate_mux(file,
+				    lhsvar->current_terminal, feed_back,
+				    sensitive_control(file, sensitiveList),
+				    create_rename_term(feed_back_array->name,buf,
+						       lo, hi));
+		    fprintf(file, "%s %s%s%d%s %s\n",
+			    ".latch",
+			    non_block_var?
+			    sel_var(strip_char(lname,SEP_LATCH)):
+			    strip_char(lname,SEP_LATCH),
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    feed_back->name->name);
+		    vl_free_term(feed_back);
+		} else {
+
+		    fprintf(file,
+			    "%s %s%s%d%s%s%d%s %s%s%d%s%s%d%s",
+			    (orig_id_sym->flags&RegVar)?
+			    ".latch":".names",
+			    lhsvar->current_terminal->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT,
+			    non_block_var?
+			    sel_var(strip_char(lname,SEP_LATCH)):
+			    strip_char(lname,SEP_LATCH),
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    if (st_lookup(vl_currentModule->quasi_st,
+				  lname,(char**)&dummy))
+			fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+		    fprintf(file, "\n");
+		    if (!(orig_id_sym->flags&RegVar)) {
+			fprintf(file, "1 1\n0 0\n");
+		    } else if(non_block_var && mark_sel_var) {
+			fprintf(file,
+				".names %s%s%d%s%s%d%s %s%s%d%s%s%d%s\n",
+				lname,
+				SEP_LARRAY, idx, SEP_RARRAY,
+				SEP_LBITSELECT, i, SEP_RBITSELECT,
+				strip_char(lname,SEP_SEL_VAR),
+				SEP_LARRAY, idx, SEP_RARRAY,
+				SEP_LBITSELECT, i, SEP_RBITSELECT);
+			fprintf(file, "1 1\n0 0\n");
+		    }
+		}
+	    }
+	}
+    }
+
+    if (need_recover_id_sym)
+	orig_id_sym->flags = old_id_type;
+}
+
+
+static void check_comb_reduction(vl_id_range *id_sym)
+{
+    char *dummy;
+    char buf[MAXSTRLEN];
+
+    if (vl_currentModule->combVar_st) {
+	if (st_lookup(vl_currentModule->combVar_st, id_sym->name, &dummy) &&
+	    st_lookup(vl_currentModule->seqVar_st, id_sym->name, &dummy)) {
+	    sprintf(buf, "%s%s", id_sym->name, SEP_QUASI);
+	    if (!st_lookup(vl_currentModule->sig_st, buf, &dummy)) {
+		sprintf(buf,
+			"%s:'%s' is touched by both sequential/combinational ",
+			vl_currentModule->name->name,
+			id_sym->name);
+		strcat(buf, "procedurarl blocks,\nhowever, combinational ");
+		strcat(buf, "block is not assigning to that variable\n");
+		strcat(buf, "through quasi-assignment.  Compilation abort");
+		yylineno = -1;
+		compile_error(buf);
+	    }
+	}
+    }
+}
+
+
+char *sync_assign()
+{
+    static char retval[MAXSTRLEN];
+
+    if (implicitClocking && vl_currentModule->clk && dumpSyncCkt) {
+	if (vl_currentModule->clk->type == NegedgeEventExpr)
+	    sprintf(retval, "%s ( %s )", SMV_IF,
+		    vl_currentModule->clk->expr->u.name->name);
+	else
+	    sprintf(retval, "%s ( %s%s )", SMV_IF, SMV_NOT,
+		    vl_currentModule->clk->expr->u.name->name);
+    } else {
+	sprintf(retval, "%s", SMV_ASSIGN);
+    }
+    return retval;
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_mux.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_mux.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_mux.c	(revision 18)
@@ -0,0 +1,317 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_mux.c,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "st.h"
+#include "array.h"
+#include "list.h"
+#include "set.h"
+#include "graph.h"
+#include "stack.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_create.h"
+#include "vl_traverse.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_fg_defs.h"
+#include "vl_fg_types.h"
+#include "vl_flowgraph.h"
+#include "vl_mux.h"
+#include "vl_vardecl.h"
+#include "verilog.h"
+
+extern int set_notation;
+extern vl_desc *mod_list;
+
+static int need_mux = 0;
+
+
+
+void vl_dump_libs(file, decl_st)
+FILE *file;
+st_table *decl_st;
+{
+    st_generator *gen;
+    char *key;
+    void *decl;
+    int i;
+    char buf[MAXSTRLEN], tmp[MAXSTRLEN], *cp;
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+
+    if (need_mux & B_MUX) {
+	fprintf(file, "%s vlr_mux%s0%s1%s\n", HSIS_MODEL,
+		SEP_LTRANGE, SEP_GATEPIN, SEP_RTRANGE);
+	fprintf(file, ".inputs a b s\n");
+	fprintf(file, ".outputs o\n");
+	fprintf(file, ".names a b s o\n");
+	fprintf(file, "0 - 1 0\n");
+	fprintf(file, "1 - 1 1\n");
+	fprintf(file, "- 0 0 0\n");
+	fprintf(file, "- 1 0 1\n");
+	fprintf(file, ".end\n\n");
+    }
+
+
+    gen = st_init_gen(decl_st);
+    while (st_gen(gen, &key, (char**)&decl)) {
+	cp = buf;  *cp = '\0';
+	domain = ((vl_type*)decl)->specifier->u.enum_type->domain_list;
+	for (enum_gen=lsStart(domain), i=1;
+	     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;
+	     i++) {
+	    if (i!=lsLength(domain))
+		sprintf(tmp, "%s%s", enum_elt->name, SEP_GATEPIN);
+	    else
+		sprintf(tmp, "%s", enum_elt->name);
+	    cp = strappend(cp, tmp);
+	}
+	lsFinish(enum_gen);
+
+	fprintf(file, "%s vlr_mux%s%s%s\n", HSIS_MODEL,
+		SEP_LTRANGE, buf, SEP_RTRANGE);
+
+	fprintf(file, ".inputs a b s\n");
+	fprintf(file, ".outputs o\n");
+
+	cp = buf;  *cp = '\0';
+	domain = ((vl_type*)decl)->specifier->u.enum_type->domain_list;
+	for (enum_gen=lsStart(domain), i=1;
+	     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;
+	     i++) {
+	    if (i!=lsLength(domain))
+		sprintf(tmp, "%s ", enum_elt->name);
+	    else
+		sprintf(tmp, "%s", enum_elt->name);
+	    cp = strappend(cp, tmp);
+	}
+	lsFinish(enum_gen);
+
+	fprintf(file, ".mv a %d %s\n", lsLength(domain), buf);
+	fprintf(file, ".mv b %d %s\n", lsLength(domain), buf);
+	fprintf(file, ".mv o %d %s\n", lsLength(domain), buf);
+	fprintf(file, ".names a b s o\n");
+
+	for (enum_gen=lsStart(domain);
+	     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+	    fprintf(file, "%s - 1 %s\n", enum_elt->name, enum_elt->name);
+	    fprintf(file, "- %s 0 %s\n", enum_elt->name, enum_elt->name);
+	}
+	lsFinish(enum_gen);
+
+	fprintf(file, ".end\n\n");
+    }
+    st_free_gen(gen);
+}
+
+
+void instantiate_mux(file, t, f, sel, out)
+FILE *file;
+vl_term *t;
+vl_term *f;
+vl_term *sel;
+vl_term *out;
+{
+    vl_term *term_control;
+    char t_buf[MAXSTRLEN], f_buf[MAXSTRLEN], out_buf[MAXSTRLEN];
+    vl_term *t_elt, *f_elt, *out_elt;
+    int idx;
+    int hi, lo, bit_lo, bit_hi;
+
+    term_control = sel;
+
+    if (sel->lo <= sel->hi) {
+	term_control = new_term(NIL(vl_range), 0, -1);
+	vl_write_vector_bop(file, UorExpr,
+			    sel, NIL(vl_term), term_control);
+    }
+
+    if (!out->name->range) {
+      if (out->flag & MVar)
+	instantiate_smux(file, t, f, term_control, out);
+      else
+	instantiate_bmux(file, t, f, term_control, out);
+    } else {
+	bit_lo = out->lo; bit_hi = out->hi;
+
+	lo = vl_eval_expr(out->name->range->left);
+	if (out->name->range->right)
+	    hi = vl_eval_expr(out->name->range->right);
+	else
+	    hi = lo;
+
+	for (idx=lo; idx<=hi; idx++) {
+	    sprintf(t_buf, "%s%s%d%s",
+		    t->name->name, SEP_LARRAY, idx, SEP_RARRAY);
+	    sprintf(f_buf, "%s%s%d%s",
+		    f->name->name, SEP_LARRAY, idx, SEP_RARRAY);
+	    sprintf(out_buf, "%s%s%d%s",
+		    out->name->name, SEP_LARRAY, idx, SEP_RARRAY);
+
+	    t_elt = create_rename_term(t->name, t_buf, bit_lo, bit_hi);
+	    f_elt = create_rename_term(f->name, f_buf, bit_lo, bit_hi);
+	    out_elt = create_rename_term(out->name, out_buf, bit_lo, bit_hi);
+	    if (out->flag & MVar)
+		instantiate_smux(file, t_elt, f_elt, term_control, out_elt);
+	    else
+		instantiate_bmux(file, t_elt, f_elt, term_control, out_elt);
+	}
+    }
+}
+
+void instantiate_smux(file, t, f, sel, out)
+FILE *file;
+vl_term *t;
+vl_term *f;
+vl_term *sel;
+vl_term *out;
+{
+    need_mux |= S_MUX;
+
+    vl_bin_to_mv(t);
+    vl_bin_to_mv(f);
+
+    if (t->lo!=f->lo || t->lo!=out->lo ||
+	t->hi!=t->hi || t->hi!=out->hi ||
+	f->lo!=out->lo || f->hi!=out->hi)
+	Translate_Warning("inconsistent MVar range");
+
+    if (set_notation) {
+	fprintf(file, ".names %s %s %s %s\n", sel->name->name, t->name->name,
+		f->name->name, out->name->name);
+	fprintf(file, "0 - - %s%s\n", HSIS_EQUAL, f->name->name);
+	fprintf(file, "1 - - %s%s\n", HSIS_EQUAL, t->name->name);
+    } else {
+	vl_put_lib(file, LIB_MUX, out, new_termname(),
+		   t->name->name, f->name->name,
+		   descape(sel->name->name,'\\','_'),
+		   out->name->name);
+    }
+}
+
+
+void instantiate_bmux(file, t, f, sel, out)
+FILE *file;
+vl_term *t;
+vl_term *f;
+vl_term *sel;
+vl_term *out;
+{
+    char fbuf[MAXSTRLEN], tbuf[MAXSTRLEN], obuf[MAXSTRLEN];
+    int i;
+
+    vl_mv_to_bin(t);
+    vl_mv_to_bin(f);
+
+    if (t->hi-t->lo != f->hi-f->lo) {
+
+
+	vl_term *new_term;
+	int bpos;
+	char inbuf[MAXSTRLEN], outbuf[MAXSTRLEN];
+
+	if (t->hi-t->lo > f->hi-f->lo) {
+	    assert(t->hi >= f->hi && t->lo <= f->lo);
+	    new_term = typed_new_term(f->term_type, NIL(vl_range),
+				      t->lo, t->hi);
+	    for(bpos=f->lo; bpos<=f->hi; bpos++) {
+		sprintf(inbuf, "%s%s%d%s", f->name->name,
+			 SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		sprintf(outbuf, "%s%s%d%s", new_term->name->name,
+			SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		vl_write_bit_connect(file, inbuf, outbuf, 0);
+	    }
+	    for(bpos=t->lo; bpos<=t->hi; bpos++) {
+		if (bpos < f->lo || bpos > f->hi) {
+		    sprintf(inbuf, "%s%s%d%s", t->name->name,
+			    SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		    sprintf(outbuf, "%s%s%d%s", new_term->name->name,
+			    SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		    vl_write_bit_connect(file, inbuf, outbuf, 0);
+		}
+	    }
+	    f = new_term;
+	} else {
+	    assert(f->hi >= t->hi && f->lo <= t->lo);
+	    new_term = typed_new_term(t->term_type, NIL(vl_range),
+				      f->lo, f->hi);
+	    for(bpos=t->lo; bpos<=t->hi; bpos++) {
+		sprintf(inbuf, "%s%s%d%s", t->name->name,
+			 SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		sprintf(outbuf, "%s%s%d%s", new_term->name->name,
+			SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		vl_write_bit_connect(file, inbuf, outbuf, 0);
+	    }
+	    for(bpos=f->lo; bpos<=f->hi; bpos++) {
+		if (bpos < t->lo || bpos > t->hi) {
+		    sprintf(inbuf, "%s%s%d%s", f->name->name,
+			    SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		    sprintf(outbuf, "%s%s%d%s", new_term->name->name,
+			    SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		    vl_write_bit_connect(file, inbuf, outbuf, 0);
+		}
+	    }
+	    t = new_term;
+	}
+    }
+
+    out->lo = f->lo; out->hi = f->hi;
+
+    if (out->lo > out->hi) {
+
+	sprintf(tbuf, "%s", t->name->name);
+	sprintf(fbuf, "%s", f->name->name);
+	sprintf(obuf, "%s", out->name->name);
+	vl_put_lib(file, LIB_MUX, out, new_termname(), tbuf,
+		   fbuf, descape(sel->name->name,'\\','_'), obuf);
+    } else {
+
+	for (i=f->lo; i<=f->hi; i++) {
+	    if ((i-f->lo) <= (t->hi-t->lo)) {
+		int idx;
+		idx = i + t->lo - f->lo;
+		sprintf(tbuf, "%s%s%d%s", t->name->name,
+			SEP_LBITSELECT, idx, SEP_RBITSELECT);
+	    } else {
+		sprintf(tbuf, "%s%s%d%s", f->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    }
+	    sprintf(fbuf, "%s%s%d%s", f->name->name,
+		    SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    sprintf(obuf, "%s%s%d%s", out->name->name,
+		    SEP_LBITSELECT, i+out->lo-f->lo, SEP_RBITSELECT);
+	    vl_put_lib(file, LIB_MUX, out, new_termname(), tbuf,
+		       fbuf, descape(sel->name->name,'\\','_'), obuf);
+	}
+    }
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_mux.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_mux.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_mux.h	(revision 18)
@@ -0,0 +1,28 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_mux.h,v 1.1.1.1 2001/07/09 23:22:42 fabio Exp $
+
+
+*/
+EXTERN void vl_dump_libs ARGS((FILE *, st_table *));
+EXTERN void instantiate_mux ARGS((FILE *, vl_term *, vl_term *, vl_term *, vl_term *));
+EXTERN void instantiate_bmux ARGS((FILE *, vl_term*, vl_term*, vl_term*, vl_term*));
+EXTERN void instantiate_smux ARGS((FILE *, vl_term*, vl_term*, vl_term*, vl_term*));
Index: vis_dev/vl2mv-2.3/src/parser/vl_nonblock.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_nonblock.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_nonblock.c	(revision 18)
@@ -0,0 +1,1893 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_nonblock.c,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "array.h"
+#include "list.h"
+#include "st.h"
+#include "set.h"
+#include "graph.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_vardecl.h"
+#include "vl_edgedetector.h"
+#include "vl_nonblock.h"
+#include "vl_fg_defs.h"
+#include "vl_fg_types.h"
+#include "vl_flowgraph.h"
+
+extern int vlTimedSystem;
+extern int set_notation;
+extern int decomposeTable;
+extern int deadlock_semantic;
+extern int rst_ckt;
+extern lsList ctrl_list, rst_ctrl_list;
+
+static void write_nblock_set_connect ARGS((FILE *file,
+					   vl_id_range *id_sym,
+					   char *latch_name,
+					   vl_term *ripple_ctrl,
+					   vl_term *ripple_set,
+					   vl_term *procedural_ctrl,
+					   vl_term *procedural_term,
+					   vl_term *result));
+
+void put_nblock_scalar_simple_table(FILE *file, char *dc,
+				    vl_id_range *id_sym,
+				    int non_block_wire,
+				    char *latch_name,
+				    vl_term *out_term,
+				    int n_entries,
+				    int lo, int hi,
+				    lsList ripple,
+				    vl_term *procedural_ctrl,
+				    vl_term *procedural_term)
+{
+    int ith_var;
+    vl_term *ctrl_term;
+    lsGen lgen;
+    lsHandle handle;
+    syndrome_expr *se;
+    int table_width;
+
+    table_width = lsLength((!rst_ckt)?ctrl_list:rst_ctrl_list) +
+	lsLength((!rst_ckt)?id_sym->syndrome_expr_list:
+		 id_sym->rst_syndrome_expr_list);
+    if (table_width < decomposeTable) {
+
+
+	if (vlTimedSystem && !rst_ckt) {
+	    fprintf(file, ".names %s ", FG_LC_PS);
+	} else
+	    fprintf(file, ".names ");
+	for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), ith_var=0;
+	     lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!=LS_NOMORE;
+	     ith_var++) {
+	    if (!dc[ith_var])
+		fprintf(file, "%s ", ctrl_term->name->name);
+	}
+	(void)lsFinish(lgen);
+	for (lgen=lsStart((!rst_ckt)?
+			  id_sym->syndrome_expr_list:
+			  id_sym->rst_syndrome_expr_list);
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+	    fprintf(file, "%s ", se->expr->name->name);
+	}
+	(void)lsFinish(lgen);
+	if (!non_block_wire && !rst_ckt) fprintf(file, "%s ", latch_name);
+	fprintf(file, "%s\n", out_term->name->name);
+
+
+	if (set_notation && !(deadlock_semantic && non_block_wire)) {
+	    if (non_block_wire || rst_ckt)
+		fprintf(file,"%s -\n",HSIS_DEFAULT);
+	    else
+		fprintf(file, "%s %s%s\n",
+			HSIS_DEFAULT, HSIS_EQUAL, latch_name);
+	}
+	if ((id_sym->flags & MVar) && set_notation) {
+	    put_nblock_mout_transition(file, non_block_wire, n_entries,
+				       id_sym, lo, hi, lo, dc,
+				       latch_name);
+	} else {
+	    put_nblock_transition(file, non_block_wire, n_entries,
+				  id_sym, lo, hi, lo, dc, ripple);
+	}
+    } else {
+
+	vl_term *ripple_ctrl, *ripple_set, *ectrl;
+	vl_term *new_set;
+	lsList syndromeExprList, worklist, local_accumulator;
+	syndrome_expr *se_next;
+	int duplicate_item;
+
+	ripple_ctrl = NIL(vl_term);
+	ripple_set = NIL(vl_term);
+	syndromeExprList = (!rst_ckt)?
+	    id_sym->syndrome_expr_list:
+	    id_sym->rst_syndrome_expr_list;
+	worklist = lsCopy(syndromeExprList, 0);
+
+	for (lgen=lsStart(worklist);
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+	    ectrl = write_entry_control(file,
+					(!rst_ckt)?ctrl_list:rst_ctrl_list,
+					se->syndrome, se->pre_cond, se->fg_id);
+
+	    local_accumulator = lsCreate();
+	    lsNewEnd(local_accumulator, (lsGeneric)se, 0);
+	    if (lsLength(worklist) > 1) {
+		duplicate_item = 1;
+		while (lsNext(lgen, (lsGeneric*)&se_next, &handle)!=
+		       LS_NOMORE
+		       && duplicate_item) {
+		    if (strcmp(se->syndrome, se_next->syndrome)) {
+			duplicate_item = 0;
+			lsPrev(lgen, (lsGeneric*)&se_next, &handle);
+			lsPrev(lgen, (lsGeneric*)&se_next, &handle);
+		    } else {
+			lsNewEnd(local_accumulator, (lsGeneric)se_next, 0);
+		    }
+		}
+	    }
+	    new_set = write_nond_set(file, id_sym, local_accumulator);
+	    ripple_ctrl = write_set_accumulate(file, id_sym,
+					       ectrl, ripple_ctrl,
+					       new_set, &ripple_set);
+
+	    lsDestroy(local_accumulator, 0);
+
+	}
+
+	write_nblock_set_connect(file, id_sym, latch_name,
+				 ripple_ctrl, ripple_set,
+				 procedural_ctrl, procedural_term,
+				 out_term);
+	lsFinish(lgen);
+	lsDestroy(worklist, 0);
+    }
+}
+
+
+void put_nblock_scalar_array_table(FILE *file,
+				   char *dc,
+				   vl_id_range *id_sym,
+				   int non_block_wire,
+				   char *latch_name,
+				   vl_term *out_term,
+				   int n_entries,
+				   int lo, int hi,
+				   lsList ripple)
+{
+    int ith_var;
+    vl_term *ctrl_term;
+    lsGen lgen;
+    lsHandle handle;
+    syndrome_expr *se;
+    int idx_lo, idx_hi, idx;
+
+    idx_lo = vl_eval_expr(id_sym->range->left);
+    if (id_sym->range->right)
+	idx_hi = vl_eval_expr(id_sym->range->right);
+    else
+	idx_hi = idx_lo;
+
+    for (idx=idx_lo; idx<=idx_hi; idx++) {
+
+	if (vlTimedSystem && !rst_ckt) {
+	    fprintf(file, ".names %s ", FG_LC_PS);
+	} else
+	    fprintf(file, ".names ");
+	for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), ith_var=0;
+	     lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!=
+	     LS_NOMORE;
+	     ith_var++) {
+	    if (!dc[ith_var])
+		fprintf(file, "%s ", ctrl_term->name->name);
+	}
+	(void)lsFinish(lgen);
+	for (lgen=lsStart((!rst_ckt)?
+			  id_sym->syndrome_expr_list:
+			  id_sym->rst_syndrome_expr_list);
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+	    fprintf(file, "%s%s%d%s ", se->expr->name->name,
+		    SEP_LARRAY, idx, SEP_RARRAY);
+	}
+	(void)lsFinish(lgen);
+	if (!non_block_wire && !rst_ckt)
+	    fprintf(file,"%s%s%d%s ", latch_name, SEP_LARRAY, idx, SEP_RARRAY);
+	fprintf(file, "%s%s%d%s\n", out_term->name->name,
+		SEP_LARRAY, idx, SEP_RARRAY);
+
+
+	if (set_notation && !(deadlock_semantic && non_block_wire)) {
+	    if (non_block_wire || rst_ckt)
+		fprintf (file, "%s -\n", HSIS_DEFAULT);
+	    else
+		fprintf(file, "%s %s %s%s%d%s\n", HSIS_DEFAULT,
+			HSIS_EQUAL, latch_name, SEP_LARRAY, idx, SEP_RARRAY);
+	}
+	if ((id_sym->flags & MVar) && set_notation)
+	    put_nblock_mout_transition(file,
+				       non_block_wire, n_entries,
+				       id_sym, lo, hi, lo, dc,
+				       latch_name);
+	else
+	    put_nblock_transition(file, non_block_wire, n_entries,
+				  id_sym, lo, hi, lo, dc, ripple);
+    }
+}
+
+
+void put_nblock_vector_table(FILE *file,
+			     char *dc,
+			     vl_id_range *id_sym,
+			     int non_block_wire,
+			     char *latch_name,
+			     vl_term *out_term,
+			     int n_entries,
+			     int lo, int hi,
+			     lsList *ripple,
+			     vl_term *procedural_ctrl,
+			     vl_term *procedural_term)
+{
+    int ith_var;
+    vl_term *ctrl_term;
+    lsGen lgen;
+    lsHandle handle;
+    syndrome_expr *se;
+    lsGen rgen;
+    lsHandle rhandle;
+    int l;
+    char *equ;
+    lsList old_ripple;
+    int table_width;
+
+    if (set_notation) {
+
+	table_width =
+	    lsLength((!rst_ckt)?ctrl_list:rst_ctrl_list) +
+	    lsLength((!rst_ckt)?id_sym->syndrome_expr_list:
+				id_sym->rst_syndrome_expr_list);
+	if (table_width < decomposeTable) {
+
+
+	    if (vlTimedSystem && !rst_ckt) {
+		fprintf(file, ".names %s ", FG_LC_PS);
+	    } else
+		fprintf(file, ".names ");
+	    for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list),
+		 ith_var=0;
+		 lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!=LS_NOMORE;
+		 ith_var++) {
+		if (!dc[ith_var])
+		    fprintf(file, "%s ", ctrl_term->name->name);
+	    }
+	    (void)lsFinish(lgen);
+
+	    for (l=lo; l<=hi; l++) {
+		for (lgen=lsStart((!rst_ckt)?
+				  id_sym->syndrome_expr_list:
+				  id_sym->rst_syndrome_expr_list);
+		     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+		    fprintf(file, "%s%s%d%s ",
+			    se->expr->name->name,
+			    SEP_LBITSELECT, l, SEP_RBITSELECT);
+		}
+		(void)lsFinish(lgen);
+	    }
+
+	    for (l=lo; l<=hi; l++) {
+		if (!non_block_wire && !rst_ckt)
+		    fprintf(file, "%s%s%d%s ",
+			    latch_name,
+			    SEP_LBITSELECT, l, SEP_RBITSELECT);
+	    }
+	    fprintf(file, "%s ", HSIS_ARROW);
+	    for (l=lo; l<=hi; l++) {
+		fprintf(file, "%s%s%d%s ",
+			out_term->name->name,
+			SEP_LBITSELECT, l, SEP_RBITSELECT);
+	    }
+	    fprintf(file, "\n");
+
+
+	    if (set_notation && !(deadlock_semantic && non_block_wire)) {
+		if (non_block_wire || rst_ckt) {
+		    fprintf(file, "%s ", HSIS_DEFAULT);
+		    for (l=lo; l<=hi; l++) fprintf(file, "- ");
+		    fprintf(file, "\n");
+		} else {
+		    fprintf(file, "%s ", HSIS_DEFAULT);
+		    for (l=lo; l<=hi;l++)
+			fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL, latch_name,
+				SEP_LBITSELECT, l, SEP_RBITSELECT);
+		    fprintf(file, "\n");
+		}
+	    }
+	    put_nblock_mout_transition(file, non_block_wire, n_entries,
+				       id_sym, lo, hi, l, dc, latch_name);
+	} else {
+
+	    vl_term *ripple_ctrl, *ripple_set, *ectrl;
+	    vl_term *new_set;
+	    lsList syndromeExprList, worklist, local_accumulator;
+	    syndrome_expr *se_next;
+	    int duplicate_item;
+
+	    ripple_ctrl = NIL(vl_term);
+	    ripple_set = NIL(vl_term);
+	    syndromeExprList = (!rst_ckt)?
+				   id_sym->syndrome_expr_list:
+				   id_sym->rst_syndrome_expr_list;
+	    worklist = lsCopy(syndromeExprList, 0);
+
+	    for (lgen=lsStart(worklist);
+		 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+		ectrl = write_entry_control(file,
+					    (!rst_ckt)?ctrl_list:rst_ctrl_list,
+					    se->syndrome, se->pre_cond,
+					    se->fg_id);
+
+		local_accumulator = lsCreate();
+		lsNewEnd(local_accumulator, (lsGeneric)se, 0);
+		if (lsLength(worklist) > 1) {
+		    duplicate_item = 1;
+		    while (lsNext(lgen, (lsGeneric*)&se_next, &handle)!=
+			       LS_NOMORE
+			   && duplicate_item) {
+			if (strcmp(se->syndrome, se_next->syndrome)) {
+			    duplicate_item = 0;
+			    lsPrev(lgen, (lsGeneric*)&se_next, &handle);
+			    lsPrev(lgen, (lsGeneric*)&se_next, &handle);
+			} else {
+			    lsNewEnd(local_accumulator, (lsGeneric)se_next, 0);
+			}
+		    }
+		}
+		new_set = write_nond_set(file, id_sym, local_accumulator);
+		ripple_ctrl = write_set_accumulate(file, id_sym,
+						   ectrl, ripple_ctrl,
+						   new_set, &ripple_set);
+
+		lsDestroy(local_accumulator, 0);
+
+	    }
+
+	    write_nblock_set_connect(file, id_sym, latch_name,
+				     ripple_ctrl, ripple_set,
+				     procedural_ctrl, procedural_term,
+				     out_term);
+	    lsFinish(lgen);
+	    lsDestroy(worklist, 0);
+	}
+    } else {
+
+	table_width =
+	    lsLength((!rst_ckt)?ctrl_list:rst_ctrl_list) +
+	    lsLength((!rst_ckt)?id_sym->syndrome_expr_list:
+				id_sym->rst_syndrome_expr_list);
+	if (table_width < decomposeTable) {
+	    for (l=lo; l<=hi; l++) {
+
+
+		fprintf(file, ".names ");
+		for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list),
+		     ith_var=0;
+		     lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!=
+		     LS_NOMORE;
+		     ith_var++) {
+		    if (!dc[ith_var])
+			fprintf(file, "%s ", ctrl_term->name->name);
+		}
+		(void)lsFinish(lgen);
+
+		if (*ripple) {
+		  for (rgen=lsStart(*ripple);
+			 lsNext(rgen,(lsGeneric*)&equ,&rhandle)!=
+			 LS_NOMORE;) {
+			fprintf(file, "%s ", equ);
+		    }
+		    lsFinish(rgen);
+		}
+
+		for (lgen=lsStart((!rst_ckt)?
+				  id_sym->syndrome_expr_list:
+				  id_sym->rst_syndrome_expr_list);
+		     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+		    fprintf(file, "%s%s%d%s ",
+			    se->expr->name->name,
+			    SEP_LBITSELECT, l, SEP_RBITSELECT);
+		}
+		(void)lsFinish(lgen);
+		if (!non_block_wire && !rst_ckt)
+		    fprintf(file, "%s%s%d%s ",
+			    latch_name,
+			    SEP_LBITSELECT, l, SEP_RBITSELECT);
+		fprintf(file, "%s%s%d%s\n",
+			out_term->name->name,
+			SEP_LBITSELECT, l, SEP_RBITSELECT);
+
+
+		if (set_notation && !(deadlock_semantic && non_block_wire)) {
+		    if (non_block_wire || rst_ckt)
+			fprintf(file, "%s -\n", HSIS_DEFAULT);
+		    else
+			fprintf(file, "%s %s%s%s%d%s\n", HSIS_DEFAULT,
+				HSIS_EQUAL, latch_name,
+				SEP_LBITSELECT, l, SEP_RBITSELECT);
+		}
+		put_nblock_transition(file, non_block_wire, n_entries,
+				      id_sym, lo, hi, l, dc, *ripple);
+
+
+		old_ripple = *ripple;
+		if (l<hi) {
+		    *ripple = lsCreate();
+		    for (lgen=lsStart((!rst_ckt)?
+				      id_sym->syndrome_expr_list:
+				      id_sym->rst_syndrome_expr_list),
+			 rgen = (old_ripple)?lsStart(old_ripple):(lsGen)0;
+			 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;){
+			char focus_out[MAXSTRLEN], focus_tmp[MAXSTRLEN];
+			char tmp[MAXSTRLEN], intermediate[MAXSTRLEN];
+
+			sprintf(focus_out, "%s%s%d%s",
+				se->expr->name->name,
+				SEP_LBITSELECT, l, SEP_RBITSELECT);
+			sprintf(focus_tmp, "%s%s%d%s",
+				out_term->name->name,
+				SEP_LBITSELECT, l, SEP_RBITSELECT);
+			sprintf(tmp, "%s", new_termname());
+			vl_write_bop(file, BxnorExpr,
+				     focus_out, focus_tmp, NIL(char),
+				     tmp, 1);
+			if (rgen) {
+			    lsNext(rgen,(lsGeneric*)&equ,&rhandle);
+			    sprintf(intermediate, "%s", new_termname());
+			    vl_write_bop(file, BandExpr,
+					 tmp, equ, NIL(char),
+					 intermediate, 1);
+			} else {
+			    sprintf(intermediate, "%s", tmp);
+			}
+			lsNewEnd(*ripple,(lsGeneric)vlStrdup(intermediate),0);
+		    }
+		    lsFinish(lgen);
+		}
+
+
+		if (old_ripple) {
+		    lsGen rgen;
+		    lsHandle rhandle;
+
+		    for (rgen=lsStart(old_ripple);
+			 lsNext(rgen,(lsGeneric*)&equ,&rhandle)!=
+			 LS_NOMORE;)
+			free(equ);
+		    lsFinish(rgen);
+		    lsDestroy(old_ripple,0);
+		}
+	    }
+	} else {
+
+	    vl_term *ripple_ctrl, *ripple_set, *ectrl;
+	    vl_term *new_set;
+	    lsList syndromeExprList, worklist, local_accumulator;
+	    syndrome_expr *se_next;
+	    int duplicate_item;
+
+	    ripple_ctrl = NIL(vl_term);
+	    ripple_set = NIL(vl_term);
+	    syndromeExprList = (!rst_ckt)?
+		id_sym->syndrome_expr_list:
+		id_sym->rst_syndrome_expr_list;
+	    worklist = lsCopy(syndromeExprList, 0);
+
+	    for (lgen=lsStart(worklist);
+		 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+		ectrl = write_entry_control(file,
+					    (!rst_ckt)?ctrl_list:rst_ctrl_list,
+					    se->syndrome, se->pre_cond,
+					    se->fg_id);
+
+		local_accumulator = lsCreate();
+		lsNewEnd(local_accumulator, (lsGeneric)se, 0);
+		if (lsLength(worklist) > 1) {
+		    duplicate_item = 1;
+		    while (lsNext(lgen, (lsGeneric*)&se_next, &handle)!=
+			   LS_NOMORE
+			   && duplicate_item) {
+			if (strcmp(se->syndrome, se_next->syndrome)) {
+			    duplicate_item = 0;
+			    lsPrev(lgen, (lsGeneric*)&se_next, &handle);
+			    lsPrev(lgen, (lsGeneric*)&se_next, &handle);
+			} else {
+			    lsNewEnd(local_accumulator, (lsGeneric)se_next, 0);
+			}
+		    }
+		}
+		new_set = write_nond_set(file, id_sym, local_accumulator);
+		ripple_ctrl = write_set_accumulate(file, id_sym,
+						   ectrl, ripple_ctrl,
+						   new_set, &ripple_set);
+
+		lsDestroy(local_accumulator, 0);
+
+	    }
+
+	    write_nblock_set_connect(file, id_sym, latch_name,
+				     ripple_ctrl, ripple_set,
+				     procedural_ctrl, procedural_term,
+				     out_term);
+	    lsFinish(lgen);
+	    lsDestroy(worklist, 0);
+	}
+    }
+}
+
+
+
+void decompose_nblock_transition(file, non_block_wire, n_entries,
+				 id_sym, idx_lo, idx_hi, cur, dc, ripple)
+FILE *file;
+int non_block_wire;
+int n_entries;
+vl_id_range *id_sym;
+int idx_lo, idx_hi, cur;
+char *dc;
+lsList ripple;
+{
+    lsGen lgen;
+    lsList comp;
+    lsHandle handle;
+    int lo, hi;
+    int i, j, k;
+    char *syndrome;
+    syndrome_expr *se;
+    lsList domain=(lsList)0;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+    for (lgen=lsStart((!rst_ckt)?
+		      id_sym->syndrome_expr_list:
+		      id_sym->rst_syndrome_expr_list),
+	 i=0;
+	 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE; i++) {
+	if (!(id_sym->flags & MVar)) {
+	    lo=0; hi=1;
+	} else {
+	    get_hilo(id_sym, &hi, &lo);
+	}
+
+	if (id_sym->id_type)
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+
+	if (!(id_sym->flags & MVar)) {
+
+	    for (k=lo; k<=hi; k++) {
+		put_entry(file, se->syndrome, dc, 1);
+
+		if (ripple) {
+		    for (j=0; j<i; j++) fprintf(file, "- ");
+		    fprintf(file, "%d ", 1); j++;
+		    for (; j<n_entries; j++) fprintf(file, "- ");
+		}
+
+		for (j=0; j<i; j++) fprintf(file, "- ");
+		fprintf(file, "%d ", k); j++;
+		for (; j<n_entries; j++) fprintf(file, "- ");
+		fprintf(file, "%s%d\n", (non_block_wire||rst_ckt)?"":"- ", k);
+	    }
+	} else {
+	    for (enum_gen=lsStart(domain);
+		 lsNext(enum_gen,
+			(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+		put_entry(file, se->syndrome, dc, 1);
+
+		if (ripple) {
+		    for (j=0; j<i; j++) fprintf(file, "- ");
+		    fprintf(file, "%d ", 1); j++;
+		    for (; j<n_entries; j++) fprintf(file, "- ");
+		}
+
+		for (j=0; j<i; j++) fprintf(file, "- ");
+		fprintf(file, "%s ", enum_elt->name); j++;
+		for (; j<n_entries; j++) fprintf(file, "- ");
+		fprintf(file, "%s%s\n",
+			(non_block_wire||rst_ckt)?"":"- ", enum_elt->name);
+	    }
+	    lsFinish(enum_gen);
+	}
+    }
+    lsFinish(lgen);
+
+
+    if (!set_notation && !(deadlock_semantic && non_block_wire)) {
+	comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list:
+			      id_sym->rst_syndrome_expr_list);
+	if (!(id_sym->flags & MVar)) {
+	    for (lgen=lsStart(comp);
+		 lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) {
+		if (!(id_sym->flags & MVar)) {
+		    lo=0; hi=1;
+		}
+		for (k=lo; k<=hi; k++) {
+		    put_entry(file, syndrome, dc, 1);
+		    for (j=0; j<n_entries*((ripple)?2:1); j++)
+			fprintf(file, "- ");
+		    if (non_block_wire || rst_ckt)
+			fprintf(file, "%d\n", k);
+		    else
+			fprintf(file, "%d %d\n", k, k);
+		}
+	    }
+	    lsFinish(lgen);
+	} else {
+	    for (lgen=lsStart(comp);
+		 lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) {
+		if (!(id_sym->flags & MVar)) {
+		    lo=0; hi=1;
+		}
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,
+			    (lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+		    put_entry(file, syndrome, dc, 1);
+		    for (j=0; j<n_entries*((ripple)?2:1); j++)
+			fprintf(file, "- ");
+		    if (non_block_wire || rst_ckt)
+			fprintf(file, "%s\n", enum_elt->name);
+		    else
+			fprintf(file, "%s %s\n",
+				enum_elt->name, enum_elt->name);
+		}
+		lsFinish(enum_gen);
+	    }
+	    lsFinish(lgen);
+	}
+    }
+
+    idx_lo = idx_lo;
+    idx_hi = idx_hi;
+    cur = cur;
+}
+
+
+void decompose_nblock_mout_transition(file, non_block_wire, n_entries, id_sym,
+				      idx_lo, idx_hi, cur, dc, latch_name)
+FILE *file;
+int non_block_wire;
+int n_entries;
+vl_id_range *id_sym;
+int idx_lo, idx_hi, cur;
+char *dc;
+char *latch_name;
+{
+    lsGen lgen;
+    lsList comp;
+    lsHandle handle;
+    int lo, hi;
+    int i, j, k;
+    char *syndrome;
+    syndrome_expr *se;
+
+    for (lgen=lsStart((!rst_ckt)?
+		      id_sym->syndrome_expr_list:
+		      id_sym->rst_syndrome_expr_list),
+	 i=0;
+	 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE; i++) {
+	if (!(id_sym->flags & MVar)) {
+	    lo=0; hi=1;
+	} else {
+	    get_hilo(id_sym, &hi, &lo);
+	}
+
+	put_entry(file, se->syndrome, dc, 1);
+
+	for (j=0; j<n_entries; j++)
+	    if (idx_lo == 0 && idx_hi == -1)
+		fprintf(file, "- ");
+	    else
+		for (k=idx_lo; k<=idx_hi; k++) fprintf(file, "- ");
+	if (!(non_block_wire||rst_ckt)) {
+	    if (idx_lo == 0 && idx_hi == -1)
+		fprintf(file, "- ");
+	    else
+		for (k=idx_lo; k<=idx_hi; k++)
+		    fprintf(file, "- ");
+	}
+	if (id_sym->flags & MVar || (idx_lo==0 && idx_hi==-1)) {
+	    fprintf(file, "%s%s\n", HSIS_EQUAL, se->expr->name->name);
+	} else {
+	    for (k=idx_lo; k<=idx_hi; k++) {
+		fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+			se->expr->name->name,
+			SEP_LBITSELECT, k, SEP_RBITSELECT);
+	    }
+	    fprintf(file, "\n");
+	}
+    }
+    lsFinish(lgen);
+
+
+    if (!set_notation && !(deadlock_semantic && non_block_wire)) {
+	comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list:
+			      id_sym->rst_syndrome_expr_list);
+	for (lgen=lsStart(comp);
+	     lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) {
+
+	    put_entry(file, syndrome, dc, 1);
+	    for (j=0; j<n_entries; j++)
+		if (idx_lo == 0 && idx_hi == -1)
+		    fprintf(file, "- ");
+		else
+		    for (k=idx_lo; k<=idx_hi; k++) fprintf(file, "- ");
+	    if (!(non_block_wire || rst_ckt)) {
+		if (idx_lo == 0 && idx_hi == -1)
+		    fprintf(file, "- ");
+		else
+		    for (k=idx_lo; k<=idx_hi; k++)
+			fprintf(file, "- ");
+	    }
+	    if (id_sym->flags & MVar || (idx_lo==0 && idx_hi==-1)) {
+		if (!(non_block_wire || rst_ckt))
+		    fprintf(file, "%s%s\n", HSIS_EQUAL, latch_name);
+		else
+		    fprintf(file, "-\n");
+	    } else {
+		if (!(non_block_wire || rst_ckt))
+		    for (k=idx_lo; k<=idx_hi; k++) {
+			fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+				latch_name, SEP_LBITSELECT, k, SEP_RBITSELECT);
+		    }
+		else
+		    fprintf(file,"-");
+		fprintf(file, "\n");
+	    }
+	}
+
+	lsFinish(lgen);
+    }
+
+
+    cur = cur;
+}
+
+
+vl_term *write_entry_control(file, ctrl_list, syndrome, pre_cond, fg_id)
+FILE *file;
+lsList ctrl_list;
+char *syndrome;
+st_table *pre_cond;
+int fg_id;
+{
+    lsGen gen;
+    lsHandle handle;
+    vl_term *ctrl_i;
+    vl_term *retval;
+    unsigned int i;
+    int care_length, j, k;
+
+    retval = new_term(NIL(vl_range), 0, -1);
+
+    if (vlTimedSystem && !rst_ckt)
+	fprintf(file, ".names %s%06x ", FG_LC_PS, fg_id);
+    else
+	fprintf(file, ".names ");
+    care_length = 0;
+    for (gen=lsStart(ctrl_list), i=0;
+	 lsNext(gen,(lsGeneric*)&ctrl_i,&handle)!=LS_NOMORE;
+	 i++) {
+	if (syndrome[i] != '-') {
+	    fprintf(file, "%s ", ctrl_i->name->name);
+	    care_length++;
+	}
+    }
+    lsFinish(gen);
+    fprintf(file, "%s\n", retval->name->name);
+
+    if (set_notation) {
+	fprintf(file, "%s 0\n", HSIS_DEFAULT);
+	if (vlTimedSystem && !rst_ckt)
+	    fg_put_loc_context(file, pre_cond, NIL(char));
+	fprintf(file, " ");
+	for (i=0; i<strlen(syndrome); i++) {
+	    if (syndrome[i] != '-') {
+		fprintf(file, "%c ", syndrome[i]);
+	    }
+	}
+	fprintf(file, "1\n");
+    } else {
+	for (i=0, k=0; i<strlen(syndrome); i++) {
+	    if (syndrome[i] != '-') {
+		for (j=0; j<care_length; j++) {
+		    if (k==j) {
+			fprintf(file, "%c ", (syndrome[i]=='1')?'0':'1');
+		    } else {
+			fprintf(file, "- ");
+		    }
+		}
+		k++;
+		fprintf(file, "0\n");
+	    }
+	}
+
+	for (i=0; i<strlen(syndrome); i++) {
+	    if (syndrome[i] != '-') {
+		fprintf(file, "%c ", syndrome[i]);
+	    }
+	}
+	fprintf(file, "1\n");
+    }
+
+    return retval;
+}
+
+
+vl_term *write_nond_set(file, id_sym, list_syndrome)
+FILE *file;
+vl_id_range *id_sym;
+lsList list_syndrome;
+{
+    syndrome_expr *se;
+    lsGen gen;
+    lsHandle handle;
+    vl_term *retval;
+    int hi, lo;
+    int i, j, k;
+    int bit_idx;
+    lsGen ctrl_gen;
+    lsHandle ctrl_handle;
+    lsList ripple=(lsList)0, old_ripple=(lsList)0;
+    lsGen old_gen;
+    lsHandle old_handle;
+    char *equ;
+
+    get_hilo(id_sym, &hi, &lo);
+    retval = typed_new_term(id_sym->id_type, id_sym->range, lo, hi);
+    retval->flag |= (id_sym->flags & MVar)?MVar:0;
+    retval->name->unintType = id_sym->unintType;
+    write_var_decl(file, retval);
+
+    if (id_sym->flags & MVar) {
+	fprintf(file, ".names ");
+	for (gen=lsStart(list_syndrome);
+	     lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; ) {
+	    fprintf(file, "%s ", se->expr->name->name);
+	}
+	lsFinish(gen);
+	fprintf(file, "%s\n", retval->name->name);
+
+	if (set_notation) {
+	    for (gen=lsStart(list_syndrome);
+		 lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; ) {
+		for (i=0; i<lsLength(list_syndrome); i++) {
+		    fprintf(file, "- ");
+		}
+		fprintf(file, "%s%s\n", HSIS_EQUAL, se->expr->name->name);
+	    }
+	} else {
+	    lsList domain;
+	    lsGen enum_gen;
+	    lsHandle enum_handle;
+	    vl_enumerator *enum_elt;
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+	    for (gen=lsStart(list_syndrome), i=0;
+		 lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; i++) {
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;) {
+		    for (k=0; k<lsLength(list_syndrome); k++) {
+			if (i==k)
+			    fprintf(file, "%s ", enum_elt->name);
+			else
+			    fprintf(file, "- ");
+		    }
+		    fprintf(file, "%s\n", enum_elt->name);
+		}
+		lsFinish(enum_gen);
+	    }
+	    lsFinish(gen);
+	}
+    } else {
+	if (lo > hi) {
+
+	    fprintf(file, ".names ");
+	    for (gen=lsStart(list_syndrome);
+		 lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; ) {
+		fprintf(file, "%s ", se->expr->name->name);
+	    }
+	    lsFinish(gen);
+	    fprintf(file, "%s\n", retval->name->name);
+
+	    if (set_notation) {
+		for (gen=lsStart(list_syndrome);
+		     lsNext(gen, (lsGeneric*)&se, &handle) !=
+			 LS_NOMORE; ) {
+		    for (i=0; i<lsLength(list_syndrome); i++) {
+			fprintf(file, "- ");
+		    }
+		    fprintf(file, "%s%s\n",
+			    HSIS_EQUAL, se->expr->name->name);
+		}
+	    } else {
+		for (gen=lsStart(list_syndrome), i=0;
+		     lsNext(gen, (lsGeneric*)&se, &handle) !=
+			 LS_NOMORE; i++) {
+		    for (j=0; j<=1; j++) {
+			for (k=0; k<lsLength(list_syndrome); k++) {
+			    if (i==k)
+				fprintf(file, "%d ", j);
+			    else
+				fprintf(file, "- ");
+			}
+			fprintf(file, "%d\n", j);
+		    }
+		}
+		lsFinish(gen);
+	    }
+	} else {
+
+	    if (set_notation) {
+
+		fprintf(file, ".names ");
+		for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+		    for (gen=lsStart(list_syndrome);
+			 lsNext(gen, (lsGeneric*)&se, &handle) !=
+			     LS_NOMORE;) {
+			fprintf(file, "%s%s%d%s ", se->expr->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+
+
+		    }
+		    lsFinish(gen);
+		}
+		fprintf(file, "%s ", HSIS_ARROW);
+		for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+		    fprintf(file, "%s%s%d%s ", retval->name->name,
+			    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		}
+		fprintf(file, "\n");
+
+
+		for (gen=lsStart(list_syndrome);
+		     lsNext(gen, (lsGeneric*)&se, &handle)!=LS_NOMORE; ) {
+		    for (i=0; i<lsLength(list_syndrome); i++) {
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			    fprintf(file, "- ");
+		    }
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+				se->expr->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "\n");
+		}
+	    } else {
+		for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+		    if (bit_idx==lo) {
+			fprintf(file, ".names ");
+			for (gen=lsStart(list_syndrome);
+			     lsNext(gen, (lsGeneric*)&se, &handle) !=
+				 LS_NOMORE;) {
+			    fprintf(file, "%s%s%d%s ",
+				    se->expr->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			}
+			lsFinish(gen);
+			fprintf(file, "%s%s%d%s\n", retval->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+
+			for (gen=lsStart(list_syndrome), i=0;
+			     lsNext(gen,(lsGeneric*)&se,&handle) !=
+				 LS_NOMORE;
+			     i++) {
+			    for (j=0; j<=1; j++) {
+				for (k=0; k<lsLength(list_syndrome); k++) {
+				    if (i==k)
+					fprintf(file, "%d ", j);
+				    else
+					fprintf(file, "- ");
+				}
+				fprintf(file, "%d\n", j);
+			    }
+			}
+			lsFinish(gen);
+		    } else {
+			fprintf(file, ".names ");
+			for (gen=lsStart(list_syndrome),
+				 ctrl_gen=lsStart(ripple);
+			     lsNext(gen, (lsGeneric*)&se, &handle) !=
+				 LS_NOMORE;) {
+			    lsNext(ctrl_gen,(lsGeneric*)&equ,&ctrl_handle);
+			    fprintf(file, "%s %s%s%d%s ", equ,
+				    se->expr->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			}
+			lsFinish(gen);
+			fprintf(file, "%s%s%d%s\n", retval->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+
+			for (gen=lsStart(list_syndrome), i=0;
+			     lsNext(gen,(lsGeneric*)&se,&handle) !=
+				 LS_NOMORE;
+			     i++) {
+			    for (j=0; j<=1; j++) {
+				for (k=0; k<lsLength(list_syndrome); k++) {
+				    if (i==k)
+					fprintf(file, "1 %d ", j);
+				    else
+					fprintf(file, "- - ");
+				}
+				fprintf(file, "%d\n", j);
+			    }
+			}
+			lsFinish(gen);
+		    }
+
+		    old_ripple = ripple;
+		    if (bit_idx < hi) {
+			ripple = lsCreate();
+			for (gen=lsStart(list_syndrome),
+				 old_gen=(old_ripple)?
+				 lsStart(old_ripple):(lsGen)0;
+			     lsNext(gen,(lsGeneric*)&se, &handle)!=
+				 LS_NOMORE;){
+			    char focus_out[MAXSTRLEN],focus_tmp[MAXSTRLEN];
+			    char tmp[MAXSTRLEN], intermediate[MAXSTRLEN];
+			    sprintf(focus_out, "%s%s%d%s",
+				    se->expr->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    sprintf(focus_tmp, "%s%s%d%s",
+				    retval->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    sprintf(tmp, "%s", new_termname());
+			    vl_write_bop(file, BxnorExpr,
+					 focus_out, focus_tmp, NIL(char),
+					 tmp, 1);
+			    if (old_gen) {
+				lsNext(old_gen,(lsGeneric*)&equ,
+				       &old_handle);
+				sprintf(intermediate,"%s",new_termname());
+				vl_write_bop(file, BandExpr, tmp, equ,
+					     NIL(char), intermediate, 1);
+			    } else {
+				sprintf(intermediate,"%s",tmp);
+			    }
+			    lsNewEnd(ripple,
+				     (lsGeneric)vlStrdup(intermediate),0);
+			}
+			lsFinish(gen);
+			lsFinish(old_gen);
+		    }
+
+		    if (old_ripple) {
+			for (gen=lsStart(old_ripple);
+			     lsNext(gen,(lsGeneric*)&equ,&handle)!=
+				 LS_NOMORE;)
+			    free(equ);
+			lsFinish(gen);
+			lsDestroy(old_ripple,0);
+		    }
+		}
+	    }
+	}
+    }
+
+    return retval;
+}
+
+
+vl_term *write_set_accumulate(file, id_sym, local_ctrl, ripple_ctrl,
+			      local_set, ripple_set)
+FILE *file;
+vl_id_range *id_sym;
+vl_term *local_ctrl;
+vl_term *ripple_ctrl;
+vl_term *local_set;
+vl_term **ripple_set;
+{
+    vl_term *retval, *ripple_out_set;
+    int lo, hi;
+    int bit_idx;
+    int i;
+
+    get_hilo(id_sym, &hi, &lo);
+    retval = new_term(NIL(vl_range), 0, -1);
+    ripple_out_set = typed_new_term(id_sym->id_type, id_sym->range, lo, hi);
+    ripple_out_set->flag |= (id_sym->flags & MVar)?MVar:0;
+    ripple_out_set->name->unintType = id_sym->unintType;
+    write_var_decl(file, ripple_out_set);
+
+    if (id_sym->flags & MVar) {
+	if (set_notation) {
+	    if (ripple_ctrl) {
+
+
+		fprintf(file, ".names %s %s %s %s %s\n",
+			local_ctrl->name->name, ripple_ctrl->name->name,
+			local_set->name->name, (*ripple_set)->name->name,
+			ripple_out_set->name->name);
+		fprintf(file, ".def -\n");
+		fprintf(file, "1 - - - %s%s\n",
+			HSIS_EQUAL,local_set->name->name);
+		fprintf(file, "- 1 - - %s%s\n",
+			HSIS_EQUAL, (*ripple_set)->name->name);
+
+
+		vl_write_bop(file, BorExpr,
+			     local_ctrl->name->name,
+			     ripple_ctrl->name->name,
+			     NIL(char), retval->name->name, 1);
+	    } else {
+
+
+		fprintf(file, ".names %s %s %s\n",
+			local_ctrl->name->name, local_set->name->name,
+			ripple_out_set->name->name);
+		fprintf(file, ".def -\n");
+		fprintf(file, "1 - %s%s\n",
+			HSIS_EQUAL,local_set->name->name);
+
+
+		vl_write_bin_connect(file, local_ctrl, retval, 0);
+	    }
+	} else {
+	    lsList domain;
+	    lsGen enum_gen;
+	    lsHandle enum_handle;
+	    vl_enumerator *enum_elt;
+
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+	    if (ripple_ctrl) {
+
+
+		fprintf(file, ".names %s %s %s %s %s\n",
+			local_ctrl->name->name, ripple_ctrl->name->name,
+			local_set->name->name, (*ripple_set)->name->name,
+			ripple_out_set->name->name);
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;)
+		    fprintf(file, "1 - %s - %s\n",
+			    enum_elt->name, enum_elt->name);
+		lsFinish(enum_gen);
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;)
+		    fprintf(file, "- 1 - %s %s\n",
+			    enum_elt->name, enum_elt->name);
+		lsFinish(enum_gen);
+		fprintf(file, "0 0 - - -\n");
+
+
+		vl_write_bop(file, BorExpr,
+			     local_ctrl->name->name,
+			     ripple_ctrl->name->name,
+			     NIL(char), retval->name->name, 1);
+	    } else {
+
+
+		fprintf(file, ".names %s %s %s\n",
+			local_ctrl->name->name,	local_set->name->name,
+			ripple_out_set->name->name);
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;)
+		    fprintf(file, "1 %s %s\n",
+			    enum_elt->name, enum_elt->name);
+		lsFinish(enum_gen);
+		fprintf(file, "0 - -\n");
+
+
+		vl_write_bin_connect(file, local_ctrl, retval, 0);
+	    }
+	}
+    } else {
+	if (lo > hi) {
+
+	    if (set_notation) {
+		if (ripple_ctrl) {
+
+
+		    fprintf(file, ".names %s %s %s %s %s\n",
+			    local_ctrl->name->name,
+			    ripple_ctrl->name->name,
+			    local_set->name->name,
+			    (*ripple_set)->name->name,
+			    ripple_out_set->name->name);
+		    fprintf(file, ".def -\n");
+		    fprintf(file, "1 - - - %s%s\n",
+			    HSIS_EQUAL,local_set->name->name);
+		    fprintf(file, "- 1 - - %s%s\n",
+			    HSIS_EQUAL, (*ripple_set)->name->name);
+
+
+		    vl_write_bop(file, BorExpr,
+				 local_ctrl->name->name,
+				 ripple_ctrl->name->name,
+				 NIL(char), retval->name->name, 1);
+		} else {
+
+
+		    fprintf(file, ".names %s %s %s\n",
+			    local_ctrl->name->name, local_set->name->name,
+			    ripple_out_set->name->name);
+		    fprintf(file, ".def -\n");
+		    fprintf(file, "1 - %s%s\n",
+			    HSIS_EQUAL,local_set->name->name);
+
+
+		    vl_write_bin_connect(file, local_ctrl, retval, 0);
+		}
+	    } else {
+		if (ripple_ctrl) {
+
+
+		    fprintf(file, ".names %s %s %s %s %s\n",
+			    local_ctrl->name->name,
+			    ripple_ctrl->name->name,
+			    local_set->name->name,
+			    (*ripple_set)->name->name,
+			    ripple_out_set->name->name);
+		    for (i=0; i<=1; i++)
+			fprintf(file, "1 - %d - %d\n", i, i);
+		    for (i=0; i<=1; i++)
+			fprintf(file, "- 1 - %d %d\n", i, i);
+		    fprintf(file, "0 0 - - -\n");
+
+
+		    vl_write_bop(file, BorExpr,
+				 local_ctrl->name->name,
+				 ripple_ctrl->name->name,
+				 NIL(char), retval->name->name, 1);
+		} else {
+
+
+		    fprintf(file, ".names %s %s %s\n",
+			    local_ctrl->name->name,	local_set->name->name,
+			    ripple_out_set->name->name);
+		    for (i=0; i<=1; i++) fprintf(file, "1 %d %d\n", i, i);
+		    fprintf(file, "0 - -\n");
+
+
+		    vl_write_bin_connect(file, local_ctrl, retval, 0);
+		}
+	    }
+	} else {
+
+	    if (set_notation) {
+		if (ripple_ctrl) {
+
+
+		    fprintf(file, ".names %s %s ",
+			    local_ctrl->name->name,
+			    ripple_ctrl->name->name);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file, "%s%s%d%s %s%s%d%s ",
+				local_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				(*ripple_set)->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "%s ", HSIS_ARROW);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file, "%s%s%d%s ",
+				ripple_out_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "\n");
+		    fprintf(file, ".def ");
+		    for (bit_idx=lo;bit_idx<=hi;bit_idx++)
+			fprintf(file, "- ");
+		    fprintf(file, "\n");
+		    fprintf(file, "1 - ");
+		    for (bit_idx=lo;bit_idx<=hi;bit_idx++)
+			fprintf(file, "- - ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file, "%s%s%s%d%s ",HSIS_EQUAL,
+				local_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "\n");
+		    fprintf(file, "- 1 ");
+		    for (bit_idx=lo;bit_idx<=hi;bit_idx++)
+			fprintf(file, "- - ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file,"%s%s%s%d%s ",HSIS_EQUAL,
+				(*ripple_set)->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "\n");
+
+
+		    vl_write_bop(file, BorExpr,
+				 local_ctrl->name->name,
+				 ripple_ctrl->name->name,
+				 NIL(char), retval->name->name, 1);
+		} else {
+
+
+		    fprintf(file, ".names %s ", local_ctrl->name->name);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file, "%s%s%d%s ",
+				local_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "%s ", HSIS_ARROW);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file, "%s%s%d%s ",
+				ripple_out_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "\n");
+		    fprintf(file, ".def ");
+		    for (bit_idx=lo;bit_idx<=hi;bit_idx++)
+			fprintf(file, "- ");
+		    fprintf(file, "\n");
+		    fprintf(file, "1 ");
+		    for (bit_idx=lo;bit_idx<=hi;bit_idx++)
+			fprintf(file, "- ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			fprintf(file, "%s%s%s%d%s ",HSIS_EQUAL,
+				local_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    fprintf(file, "\n");
+
+
+		    vl_write_bit_connect(file, local_ctrl->name->name,
+					 retval->name->name, 0);
+		}
+	    } else {
+
+		if (ripple_ctrl) {
+		    char *(equ[2]);
+		    equ[0] = NIL(char);
+		    equ[1] = NIL(char);
+
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			if (bit_idx==lo) {
+			    fprintf(file,".names %s %s %s%s%d%s %s%s%d%s %s%s%d%s\n",
+				    local_ctrl->name->name,
+				    ripple_ctrl->name->name,
+				    local_set->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT,
+				    (*ripple_set)->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT,
+				    ripple_out_set->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "1 - %d - %d\n", i, i);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "- 1 - %d %d\n", i, i);
+			    fprintf(file, "0 0 - - -\n");
+			} else {
+			    fprintf(file,".names %s %s %s %s%s%d%s %s %s%s%d%s %s%s%d%s\n",
+				    local_ctrl->name->name,
+				    ripple_ctrl->name->name,
+				    equ[0], local_set->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT,
+				    equ[1], (*ripple_set)->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT,
+				    ripple_out_set->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "1 - 1 %d - - %d\n", i, i);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "- 1 - - 1 %d %d\n", i, i);
+			    fprintf(file, "0 0 - - - - -\n");
+			}
+
+			if (bit_idx < hi) {
+			    char focus_out[MAXSTRLEN],focus_tmp[MAXSTRLEN];
+			    char tmp[MAXSTRLEN], intermediate[MAXSTRLEN];
+			    sprintf(focus_out, "%s%s%d%s",
+				    local_set->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    sprintf(focus_tmp, "%s%s%d%s",
+				    ripple_out_set->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    sprintf(tmp, "%s", new_termname());
+			    vl_write_bop(file, BxnorExpr,
+					 focus_out, focus_tmp,
+					 NIL(char), tmp, 1);
+
+			    if (equ[0]) {
+				sprintf(intermediate, "%s",new_termname());
+				vl_write_bop(file, BandExpr, tmp, equ[0],
+					     NIL(char), intermediate, 1);
+				vl_chk_free(equ[0]);
+			    } else {
+				sprintf(intermediate, "%s", tmp);
+			    }
+			    equ[0] = vlStrdup(intermediate);
+
+			    sprintf(focus_out, "%s%s%d%s",
+				    (*ripple_set)->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    sprintf(focus_tmp, "%s%s%d%s",
+				    ripple_out_set->name->name,
+				    SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    sprintf(tmp, "%s", new_termname());
+			    vl_write_bop(file, BxnorExpr,
+					 focus_out, focus_tmp,
+					 NIL(char), tmp, 1);
+
+			    if (equ[1]) {
+				sprintf(intermediate, "%s",new_termname());
+				vl_write_bop(file, BandExpr, tmp, equ[1],
+					     NIL(char), intermediate, 1);
+				vl_chk_free(equ[1]);
+			    } else {
+				sprintf(intermediate, "%s", tmp);
+			    }
+			    equ[1] = vlStrdup(intermediate);
+			}
+		    }
+
+		    vl_write_bop(file, BorExpr,
+				 local_ctrl->name->name,
+				 ripple_ctrl->name->name,
+				 NIL(char), retval->name->name, 1);
+		} else {
+
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, ".names %s %s%s%d%s %s%s%d%s\n",
+				local_ctrl->name->name,
+				local_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				ripple_out_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+			for (i=0; i<=1; i++)
+			    fprintf(file, "1 %d %d\n", i, i);
+			fprintf(file, "0 - -\n");
+		    }
+
+		    vl_write_bin_connect(file, local_ctrl, retval, 0);
+		}
+	    }
+	}
+    }
+
+    if (*ripple_set) vl_free_term(*ripple_set);
+    *ripple_set = ripple_out_set;
+    return retval;
+}
+
+
+static void write_nblock_set_connect(FILE *file,
+				     vl_id_range *id_sym,
+				     char *latch_name,
+				     vl_term *ripple_ctrl,
+				     vl_term *ripple_set,
+				     vl_term *procedural_ctrl,
+				     vl_term *procedural_term,
+				     vl_term *result)
+{
+    int hi, lo;
+    int bit_idx;
+    int i;
+
+    get_hilo(id_sym, &hi, &lo);
+
+    if (id_sym->flags & MVar) {
+	if (set_notation) {
+	    if (procedural_ctrl) {
+
+		fprintf(file, ".names %s %s %s %s %s %s\n",
+			ripple_ctrl->name->name, ripple_set->name->name,
+			procedural_ctrl->name->name,
+			procedural_term->name->name,
+			(id_sym->flags & RegVar) ? latch_name : "",
+			result->name->name);
+		fprintf(file, "1 - - - %s %s%s\n",
+			(id_sym->flags & RegVar) ? "-" : "",
+			HSIS_EQUAL, ripple_set->name->name);
+		fprintf(file, "0 - 1 - %s %s%s\n",
+			(id_sym->flags & RegVar) ? "-" : "",
+			HSIS_EQUAL, procedural_term->name->name);
+		if (id_sym->flags & RegVar)
+		    fprintf(file,"0 - 0 - - %s%s\n",HSIS_EQUAL,latch_name);
+		else if (!deadlock_semantic)
+		    fprintf(file,"0 - 0 - -\n");
+	    } else {
+		fprintf(file, ".names %s %s %s %s\n",
+			ripple_ctrl->name->name, ripple_set->name->name,
+			(id_sym->flags & RegVar) ? latch_name : "",
+			result->name->name);
+		fprintf(file, "1 - %s %s%s\n",
+			(id_sym->flags & RegVar) ? "-" : "",
+			HSIS_EQUAL, ripple_set->name->name);
+		if (id_sym->flags & RegVar)
+		    fprintf(file, "0 - - %s%s\n", HSIS_EQUAL, latch_name);
+		else if (!deadlock_semantic)
+		    fprintf(file, "0 - -\n");
+	    }
+	} else {
+	    lsList domain;
+	    lsGen enum_gen;
+	    lsHandle enum_handle;
+	    vl_enumerator *enum_elt;
+
+	    if (procedural_ctrl) {
+
+		domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+		fprintf(file, ".names %s %s %s %s %s %s\n",
+		    ripple_ctrl->name->name, ripple_set->name->name,
+		    procedural_ctrl->name->name, procedural_term->name->name,
+		    (id_sym->flags & RegVar) ? latch_name : "",
+		    result->name->name);
+
+
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		     LS_NOMORE;)
+		    fprintf(file, "1 %s - - %s %s\n", enum_elt->name,
+			    (id_sym->flags & RegVar) ? "-":"",
+			    enum_elt->name);
+		lsFinish(enum_gen);
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		     LS_NOMORE;)
+		    fprintf(file, "0 - 1 %s %s %s\n", enum_elt->name,
+			    (id_sym->flags & RegVar) ? "-":"",
+			    enum_elt->name);
+		lsFinish(enum_gen);
+		if (id_sym->flags & RegVar) {
+		    for (enum_gen=lsStart(domain);
+			 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;)
+			fprintf(file, "0 - 0 - %s %s\n",
+				enum_elt->name, enum_elt->name);
+		    lsFinish(enum_gen);
+		} else if (!deadlock_semantic)
+		    fprintf(file, "0 - 0 - -\n");
+	    } else {
+
+		domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+		fprintf(file, ".names %s %s %s %s\n",
+			ripple_ctrl->name->name, ripple_set->name->name,
+			(id_sym->flags & RegVar) ? latch_name : "",
+			result->name->name);
+
+
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		     LS_NOMORE;)
+		    fprintf(file, "1 %s %s %s\n", enum_elt->name,
+			    (id_sym->flags & RegVar) ? "-":"",
+			    enum_elt->name);
+		lsFinish(enum_gen);
+		if (id_sym->flags & RegVar) {
+		    for (enum_gen=lsStart(domain);
+			 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;)
+			fprintf(file, "0 - %s %s\n",
+				enum_elt->name, enum_elt->name);
+		    lsFinish(enum_gen);
+		} else if (!deadlock_semantic)
+		    fprintf(file, "0 - -\n");
+	    }
+	}
+    } else {
+	if (lo > hi) {
+
+	    if (set_notation) {
+		if (procedural_ctrl) {
+		    fprintf(file, ".names %s %s %s %s %s %s\n",
+			    ripple_ctrl->name->name, ripple_set->name->name,
+			    procedural_ctrl->name->name,
+			    procedural_term->name->name,
+			    (id_sym->flags & RegVar) ? latch_name:"",
+			    result->name->name);
+		    fprintf(file, "1 - - - %s %s%s\n",
+			    (id_sym->flags & RegVar) ? "-":"",
+			    HSIS_EQUAL, ripple_set->name->name);
+		    fprintf(file, "0 - 1 - %s %s%s\n",
+			    (id_sym->flags & RegVar) ? "-":"",
+			    HSIS_EQUAL, procedural_term->name->name);
+		    if (id_sym->flags & RegVar)
+			fprintf(file, "0 - 0 - - %s%s\n",
+				HSIS_EQUAL, latch_name);
+		    else if (!deadlock_semantic)
+			fprintf(file, "0 - 0 - -\n");
+		} else {
+		    fprintf(file, ".names %s %s %s %s\n",
+			    ripple_ctrl->name->name, ripple_set->name->name,
+			    (id_sym->flags & RegVar) ? latch_name:"",
+			    result->name->name);
+		    fprintf(file, "1 - %s %s%s\n",
+			    (id_sym->flags & RegVar) ? "-":"",
+			    HSIS_EQUAL, ripple_set->name->name);
+		    if (id_sym->flags & RegVar)
+			fprintf(file, "0 - - %s%s\n", HSIS_EQUAL, latch_name);
+		    else if (!deadlock_semantic)
+			fprintf(file, "0 - -\n");
+		}
+	    } else {
+		if (procedural_ctrl) {
+		    fprintf(file, ".names %s %s %s %s %s %s\n",
+			    ripple_ctrl->name->name, ripple_set->name->name,
+			    procedural_ctrl->name->name,
+			    procedural_term->name->name,
+			    (id_sym->flags & RegVar) ? latch_name:"",
+			    result->name->name);
+		    for (i=0; i<=1; i++)
+			fprintf(file, "1 %d - - %s %d\n",
+				i, (id_sym->flags & RegVar) ? "-":"", i);
+		    for (i=0; i<=1; i++)
+			fprintf(file, "0 - 1 %d %s %d\n",
+				i, (id_sym->flags & RegVar) ? "-":"", i);
+		    if (id_sym->flags & RegVar)
+			for (i=0; i<=1; i++)
+			    fprintf(file, "0 - 0 - %d %d\n", i, i);
+		    else if (!deadlock_semantic) fprintf(file, "0 - 0 - -\n");
+		} else {
+		    fprintf(file, ".names %s %s %s %s\n",
+			    ripple_ctrl->name->name, ripple_set->name->name,
+			    (id_sym->flags & RegVar) ? latch_name:"",
+			    result->name->name);
+		    for (i=0; i<=1; i++)
+			fprintf(file, "1 %d %s %d\n",
+				i, (id_sym->flags & RegVar) ? "-":"", i);
+		    if (id_sym->flags & RegVar)
+			for (i=0; i<=1; i++) fprintf(file, "0 - %d %d\n", i,i);
+		    else if (!deadlock_semantic) fprintf(file, "0 - -\n");
+		}
+	    }
+	} else {
+
+	    if (set_notation) {
+		if (procedural_ctrl) {
+
+		    fprintf(file, ".names %s ", ripple_ctrl->name->name);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%d%s ", ripple_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "%s ", procedural_ctrl->name->name);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%d%s ", procedural_term->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    if (id_sym->flags & RegVar) {
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			    fprintf(file, "%s%s%d%s ", latch_name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "%s ", HSIS_ARROW);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%d%s ", result->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "\n");
+
+		    if (!(id_sym->flags & RegVar) && !deadlock_semantic) {
+			fprintf(file, "%s ", HSIS_DEFAULT);
+			for (bit_idx=lo;bit_idx<=hi;bit_idx++)
+			    fprintf(file, "- ");
+			fprintf(file, "\n");
+		    }
+
+		    fprintf(file, "1 ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "- ");
+		    }
+		    fprintf(file, "- ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "- ");
+		    }
+		    if (id_sym->flags & RegVar)
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			    fprintf(file, "- ");
+			}
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+				ripple_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "\n");
+
+		    fprintf(file, "0 ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "- ");
+		    }
+		    fprintf(file, "1 ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "- ");
+		    }
+		    if (id_sym->flags & RegVar)
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			    fprintf(file, "- ");
+			}
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+				procedural_term->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "\n");
+
+		    if (!deadlock_semantic) {
+			if (id_sym->flags & RegVar) {
+			    fprintf(file, "0 ");
+			    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+				fprintf(file, "- ");
+			    }
+			    fprintf(file, "0 ");
+			    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+				fprintf(file, "- ");
+			    }
+			    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+				fprintf(file, "- ");
+			    }
+			    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+				fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+					latch_name,
+					SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    }
+			    fprintf(file, "\n");
+			}
+		    }
+		} else {
+
+		    fprintf(file, ".names %s ", ripple_ctrl->name->name);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%d%s ", ripple_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    if (id_sym->flags & RegVar) {
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++)
+			    fprintf(file, "%s%s%d%s ",
+				    latch_name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "%s ", HSIS_ARROW);
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%d%s ", result->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "\n");
+
+		    if (!(id_sym->flags & RegVar) && !deadlock_semantic) {
+			fprintf(file, "%s ", HSIS_DEFAULT);
+			for (bit_idx=lo;bit_idx<=hi;bit_idx++)
+			    fprintf(file, "- ");
+			fprintf(file, "\n");
+		    }
+
+		    fprintf(file, "1 ");
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "- ");
+		    }
+		    if (id_sym->flags & RegVar)
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			    fprintf(file, "- ");
+			}
+		    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+				ripple_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "\n");
+
+		    if (!deadlock_semantic) {
+			if (id_sym->flags & RegVar) {
+			    fprintf(file, "0 ");
+			    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+				fprintf(file, "- ");
+			    }
+			    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+				fprintf(file, "- ");
+			    }
+			    for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+				fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+					latch_name,
+					SEP_LBITSELECT,bit_idx,SEP_RBITSELECT);
+			    }
+			    fprintf(file, "\n");
+			}
+		    }
+		}
+	    } else {
+		if (procedural_ctrl) {
+		    if (id_sym->flags & RegVar) {
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			    fprintf(file, ".names %s %s%s%d%s %s %s%s%d%s %s%s%d%s %s%s%d%s\n",
+				    ripple_ctrl->name->name,
+				    ripple_set->name->name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				    procedural_ctrl->name->name,
+				    procedural_term->name->name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				    latch_name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				    result->name->name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "1 %d - - - %d\n", i, i);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "0 - 1 %d - %d\n", i, i);
+			    if (!deadlock_semantic)
+				for (i=0; i<=1; i++)
+				    fprintf(file, "0 - 0 - %d %d\n", i, i);
+			}
+		    } else {
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			    fprintf(file,
+				".names %s %s%s%d%s %s %s%s%d%s %s%s%d%s\n",
+				ripple_ctrl->name->name,
+				ripple_set->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				procedural_ctrl->name->name,
+				procedural_term->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				result->name->name,
+				SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "1 %d - - %d\n", i, i);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "0 - 1 %d %d\n", i, i);
+			    if (!deadlock_semantic)
+				fprintf(file, "0 - - - -\n");
+			}
+		    }
+		} else {
+		    if (id_sym->flags & RegVar) {
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			    fprintf(file,
+				    ".names %s %s%s%d%s %s%s%d%s %s%s%d%s\n",
+				    ripple_ctrl->name->name,
+				    ripple_set->name->name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				    latch_name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				    result->name->name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "1 %d - %d\n", i, i);
+			    if (!deadlock_semantic)
+				for (i=0; i<=1; i++)
+				    fprintf(file, "0 - %d %d\n", i, i);
+			}
+		    } else {
+			for (bit_idx=lo; bit_idx<=hi; bit_idx++) {
+			    fprintf(file,
+				    ".names %s %s%s%d%s %s%s%d%s\n",
+				    ripple_ctrl->name->name,
+				    ripple_set->name->name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT,
+				    result->name->name,
+				    SEP_LBITSELECT, bit_idx, SEP_RBITSELECT);
+			    for (i=0; i<=1; i++)
+				fprintf(file, "1 %d %d\n", i, i);
+			    if (!deadlock_semantic) fprintf(file, "0 - -\n");
+			}
+		    }
+		}
+	    }
+	}
+    }
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_nonblock.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_nonblock.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_nonblock.h	(revision 18)
@@ -0,0 +1,58 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_nonblock.h,v 1.1.1.1 2001/07/09 23:22:42 fabio Exp $
+
+
+*/
+EXTERN vl_term *write_entry_control ARGS((FILE*, lsList, char*, st_table*, int));
+EXTERN vl_term *write_nond_set ARGS((FILE*, vl_id_range*, lsList));
+EXTERN vl_term *write_set_accumulate ARGS((FILE*, vl_id_range*, vl_term*, vl_term*, vl_term*, vl_term**));
+
+EXTERN void put_nblock_scalar_simple_table ARGS((FILE *file, char *dc,
+						 vl_id_range *id_sym,
+						 int non_block_wire, 
+						 char *latch_name,
+						 vl_term *out_term,
+						 int n_entries,
+						 int lo, int hi,
+						 lsList ripple,
+						 vl_term *procedural_ctrl,
+						 vl_term *procedural_term));
+EXTERN void put_nblock_scalar_array_table ARGS((FILE *file,
+						char *dc,
+						vl_id_range *id_sym,
+						int non_block_wire, 
+						char *latch_name,
+						vl_term *out_term,
+						int n_entries,
+						int lo, int hi,
+						lsList ripple));
+EXTERN void put_nblock_vector_table ARGS((FILE *file,
+					  char *dc,
+					  vl_id_range *id_sym,
+					  int non_block_wire, 
+					  char *latch_name,
+					  vl_term *out_term,
+					  int n_entries,
+					  int lo, int hi,
+					  lsList *ripple,
+					  vl_term *procedural_ctrl,
+					  vl_term *procedural_term));
Index: vis_dev/vl2mv-2.3/src/parser/vl_reset.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_reset.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_reset.c	(revision 18)
@@ -0,0 +1,458 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_reset.c,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "array.h"
+#include "list.h"
+#include "st.h"
+#include "set.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_vardecl.h"
+
+extern int set_notation;
+extern int smartEvent;
+extern int vis_nond;
+
+static void warn_uninit_vars ARGS((char *latch_name));
+
+void reset_mvar_latch(FILE *file, int non_block_var, vl_id_range *id_sym,
+		      int lo, int hi, char *lname)
+{
+    int dummy;
+    int idx, idx_lo, idx_hi;
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+    vl_id_range *comb_id_sym;
+    char latch_name[MAXSTRLEN];
+
+    if (st_lookup(vl_currentModule->combVar_st, lname, (char**)&comb_id_sym))
+	return;
+
+    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+    if (!(id_sym->range)) {
+	if (non_block_var) sel_var(lname);
+	strip_char(lname, SEP_SEL_VAR);
+	sprintf(latch_name, lname);
+	if (st_lookup(vl_currentModule->quasi_st,lname,(char**)&dummy)) {
+	    strcat(latch_name, SEP_GATEPIN);
+	    strcat(latch_name, PIN_PS);
+	}
+
+
+	if (lsLength(id_sym->initial) > 0) {
+	    int i;
+	    vl_term *init_term;
+	    lsGen gen;
+	    lsHandle handle;
+
+	    fprintf(file, ".r ");
+	    for (gen=lsStart(id_sym->initial), i=0;
+		 lsNext(gen, (lsGeneric*)&init_term, &handle)!=LS_NOMORE;
+		 i++)
+		fprintf(file, "%s ", init_term->name->name);
+	    lsFinish(gen);
+	    fprintf(file, "%s", latch_name);
+	} else
+	    fprintf(file, ".r %s", latch_name);
+	fprintf(file, "\n");
+	if (lsLength(id_sym->initial) == 0)
+	    if (vis_nond)
+		warn_uninit_vars(lname);
+	if (set_notation) {
+	    if (lsLength(id_sym->initial) > 0) {
+		int i;
+		vl_term *init_term;
+		for (i=0; i<lsLength(id_sym->initial); i++)
+		    fprintf(file, "- ");
+		lsLastItem(id_sym->initial, (lsGeneric*)&init_term, 0);
+		fprintf(file, "%s%s\n",
+			HSIS_EQUAL, init_term->name->name);
+	    } else {
+		fprintf(file, "-\n");
+	    }
+	} else {
+	    for (enum_gen=lsStart(domain);
+		 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		     LS_NOMORE;)
+		if (lsLength(id_sym->initial) > 0)
+		    fprintf(file,"%s %s\n",enum_elt->name,enum_elt->name);
+		else
+		    fprintf(file, "%s\n", enum_elt->name);
+	    lsFinish(enum_gen);
+	}
+    } else {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi =
+		vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	for (idx=idx_lo; idx<=idx_hi; idx++) {
+
+	    if (lsLength(id_sym->initial) > 0) {
+		int i;
+		vl_term *init_term;
+		lsGen gen;
+		lsHandle handle;
+		fprintf(file, ".r ");
+		for (gen=lsStart(id_sym->initial), i=0;
+		     lsNext(gen, (lsGeneric*)&init_term, &handle) !=
+			 LS_NOMORE;
+		     i++)
+		    fprintf(file, "%s%s%d%s ",
+			    init_term->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		lsFinish(gen);
+		fprintf(file, "%s%s%d%s",
+			non_block_var?sel_var(lname):lname,
+			SEP_LARRAY, idx, SEP_RARRAY);
+	    } else {
+		fprintf(file, ".r %s%s%d%s",
+			non_block_var?
+			sel_var(lname):lname,
+			SEP_LARRAY, idx, SEP_RARRAY);
+	    }
+	    strip_char(lname,SEP_SEL_VAR);
+	    if (st_lookup(vl_currentModule->quasi_st,lname,(char**)&dummy))
+		fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+	    fprintf(file, "\n");
+	    if (lsLength(id_sym->initial) == 0)
+		if (vis_nond)
+		    warn_uninit_vars(lname);
+	    if (set_notation) {
+		if (lsLength(id_sym->initial)>0) {
+		    int i, j, k;
+		    vl_term *init_term;
+		    vl_enumerator *first_enum;
+		    lsGen gen;
+		    lsHandle handle;
+		    lsFirstItem(domain, (lsGeneric*)&first_enum, 0);
+		    fprintf(file, "%s %s\n", HSIS_DEFAULT,
+			    first_enum->name);
+		    for (gen=lsStart(id_sym->initial), j=0;
+			 lsNext(gen, (lsGeneric*)&init_term, &handle) !=
+			     LS_NOMORE; j++) {
+			for (enum_gen=lsEnd(domain), i=0;
+			     lsPrev(enum_gen, (lsGeneric*)&enum_elt,
+				    &enum_handle) != LS_NOMORE &&
+				 i < lsLength(domain)-1; i++) {
+			    for (k=0; k<j; k++)
+				fprintf(file, "%s ", first_enum->name);
+			    fprintf(file, "%s ", enum_elt->name);
+			    k++;
+			    for (; k<lsLength(id_sym->initial); k++)
+				fprintf(file, "- ");
+			    fprintf(file, "%s%s%s%d%s\n",
+				    HSIS_EQUAL, init_term->name->name,
+				    SEP_LARRAY, idx, SEP_RARRAY);
+			}
+			lsFinish(enum_gen);
+		    }
+		    lsFinish(gen);
+		} else {
+		    fprintf(file, "-\n");
+		}
+	    } else {
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,
+			    (lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE;)
+		    if (lsLength(id_sym->initial) > 0) {
+			int i;
+			for (i=0; i<lsLength(id_sym->initial)-1; i++)
+			    fprintf(file, "- ");
+			fprintf(file, "%s %s\n",
+				enum_elt->name, enum_elt->name);
+		    } else
+			fprintf(file, "%s\n", enum_elt->name);
+		lsFinish(enum_gen);
+	    }
+	}
+    }
+
+
+    lo = lo;
+    hi = hi;
+}
+
+
+void reset_bin_scalar_latch(FILE *file, int non_block_var,
+			    vl_id_range *id_sym, char *lname)
+{
+    int dummy;
+    int idx, idx_lo, idx_hi;
+    vl_id_range *comb_id_sym;
+    char latch_name[MAXSTRLEN];
+
+    if (st_lookup(vl_currentModule->combVar_st, lname, (char**)&comb_id_sym))
+	return;
+
+    if (lsLength(id_sym->initial) == 0)
+	if (vis_nond)
+	    warn_uninit_vars(lname);
+    if (!id_sym->range) {
+	if (non_block_var) sel_var(lname);
+	strip_char(lname,SEP_SEL_VAR);
+	sprintf(latch_name, "%s", lname);
+	if (st_lookup(vl_currentModule->quasi_st,lname,(char**)&dummy)) {
+	    strcat(latch_name,SEP_GATEPIN);
+	    strcat(latch_name,PIN_PS);
+	}
+
+	if (lsLength(id_sym->initial)>0) {
+	    vl_term *init_term;
+	    lsLastItem(id_sym->initial, (lsGeneric*)&init_term, 0);
+	    fprintf(file, ".r %s %s\n0 0\n1 1\n",
+		    init_term->name->name, latch_name);
+	} else if ((id_sym->flags & EventVar) && !smartEvent) {
+	    fprintf(file, ".r %s%s%s\n0\n",
+		    latch_name,SEP_GATEPIN,PIN_EVENT);
+	} else if ((id_sym->flags & EventVar) && smartEvent) {
+	} else {
+
+	    fprintf(file, ".r %s\n0\n1\n", latch_name);
+	}
+    } else {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi =
+		vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	for (idx=idx_lo; idx<=idx_hi; idx++) {
+
+	    if (lsLength(id_sym->initial) > 0) {
+		vl_term *init_term;
+		lsGen gen;
+		lsHandle handle;
+		fprintf(file, ".r ");
+		for (gen=lsStart(id_sym->initial);
+		     lsNext(gen, (lsGeneric*)&init_term, &handle)
+			 != LS_NOMORE; )
+		    fprintf(file, "%s%s%d%s ",
+			    init_term->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		lsFinish(gen);
+		fprintf(file, "%s%s%d%s",
+			non_block_var?sel_var(lname):lname,
+			SEP_LARRAY, idx, SEP_RARRAY);
+	    } else
+		fprintf(file, ".r %s%s%d%s",
+			non_block_var?
+			sel_var(lname):lname,
+			SEP_LARRAY, idx, SEP_RARRAY);
+	    strip_char(lname,SEP_SEL_VAR);
+	    if (st_lookup(vl_currentModule->quasi_st,lname,(char**)&dummy))
+		fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+	    fprintf(file, "\n");
+	    if (lsLength(id_sym->initial) > 0) {
+		int i, j;
+		fprintf(file, "%s 0\n", HSIS_DEFAULT);
+		for (i=0; i<lsLength(id_sym->initial); i++) {
+		    for (j=0; j<lsLength(id_sym->initial); j++)
+			fprintf(file, "%c ", (i==j)?'1':'0');
+		    fprintf(file, "1\n");
+		}
+	    } else
+		fprintf(file, "0\n1\n");
+	}
+    }
+}
+
+
+void reset_bin_vector_latch(FILE *file, int non_block_var,
+			    vl_id_range *id_sym,
+			    int lo, int hi, char *lname)
+{
+    int i=0;
+    int idx, idx_lo, idx_hi;
+    vl_id_range *comb_id_sym;
+    int dummy;
+    extern int combinationalReduction;
+
+    if (st_lookup(vl_currentModule->combVar_st, lname, (char**)&comb_id_sym))
+	return;
+
+    if (lsLength(id_sym->initial) == 0)
+	if (vis_nond)
+	    warn_uninit_vars(lname);
+
+    if (id_sym->syndrome_expr_list)
+	if (lsLength(id_sym->syndrome_expr_list) == 0)
+	    if (id_sym->rst_syndrome_expr_list)
+		if (lsLength(id_sym->rst_syndrome_expr_list) == 0)
+		    if (combinationalReduction)
+			return;
+
+    for (i=lo; i<=hi; i++) {
+	if (!id_sym->range) {
+
+	    if (lsLength(id_sym->initial) > 0) {
+		int k;
+		vl_term *init_term;
+		lsGen gen;
+		lsHandle handle;
+		fprintf(file, ".r ");
+		for (gen=lsStart(id_sym->initial), k=0;
+		     lsNext(gen, (lsGeneric*)&init_term, &handle)
+			 != LS_NOMORE; k++) {
+		    fprintf(file, "%s%s%d%s ", init_term->name->name,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		}
+		lsFinish(gen);
+		fprintf(file, "%s%s%d%s",
+			non_block_var?sel_var(lname):lname,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+
+	    } else {
+		fprintf(file, ".r %s%s%d%s",
+			non_block_var?
+			sel_var(lname):lname,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    }
+	    strip_char(lname,SEP_SEL_VAR);
+	    if (st_lookup(vl_currentModule->quasi_st,
+			  lname,(char**)&dummy))
+		fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+	    fprintf(file, "\n");
+	    if (set_notation) {
+		if (lsLength(id_sym->initial) > 0) {
+		    int i, j;
+		    fprintf(file, "%s 0\n", HSIS_DEFAULT);
+		    for (i=0; i<lsLength(id_sym->initial); i++) {
+			for (j=0; j<lsLength(id_sym->initial); j++)
+			    fprintf(file, "%c ", (i==j)?'1':'-');
+			fprintf(file, "1\n");
+		    }
+		} else {
+		    fprintf(file, "-\n");
+		}
+	    } else {
+		if (lsLength(id_sym->initial) > 0) {
+		    int i, j;
+		    for (i=0; i<lsLength(id_sym->initial); i++) {
+			for (j=0; j<lsLength(id_sym->initial); j++)
+			    fprintf(file, "%c ", (i==j)?'1':'-');
+			fprintf(file, "1\n");
+		    }
+		    for (i=0; i<lsLength(id_sym->initial); i++)
+			fprintf(file, "0 ");
+		    fprintf(file, "0\n");
+		} else {
+		    fprintf(file, "0\n1\n");
+		}
+	    }
+	} else {
+	    idx_lo = vl_eval_expr(id_sym->range->left);
+	    if (id_sym->range->right)
+		idx_hi = vl_eval_expr(id_sym->range->right);
+	    else
+		idx_hi = idx_lo;
+
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+
+		if (lsLength(id_sym->initial) > 0) {
+		    int k;
+		    vl_term *init_term;
+		    lsGen gen;
+		    lsHandle handle;
+		    fprintf(file, ".r ");
+		    for (gen=lsStart(id_sym->initial), k=0;
+			 lsNext(gen,(lsGeneric*)&init_term,&handle)
+			     != LS_NOMORE; k++) {
+			fprintf(file, "%s%s%d%s%s%d%s ",
+				init_term->name->name,
+				SEP_LARRAY, idx, SEP_RARRAY,
+				SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    }
+		    lsFinish(gen);
+		    fprintf(file, "%s%s%d%s%s%d%s",
+			    non_block_var?sel_var(lname):lname,
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		} else
+		    fprintf(file, ".r %s%s%d%s%s%d%s",
+			    non_block_var?
+			    sel_var(lname):lname,
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		strip_char(lname,SEP_SEL_VAR);
+		if (st_lookup(vl_currentModule->quasi_st,
+			      lname,(char**)&dummy))
+		    fprintf(file, "%s%s", SEP_GATEPIN, PIN_PS);
+		fprintf(file, "\n");
+		if (set_notation) {
+		    if (lsLength(id_sym->initial) > 0) {
+			int i, j;
+			fprintf(file, "%s 0\n", HSIS_DEFAULT);
+			for (i=0; i<lsLength(id_sym->initial); i++) {
+			    for (j=0; j<lsLength(id_sym->initial); j++)
+				fprintf(file, "%c ", (i==j)?'1':'-');
+			    fprintf(file, "1\n");
+			}
+		    } else {
+			fprintf(file, "-\n");
+		    }
+		} else {
+		    if (lsLength(id_sym->initial) > 0) {
+			int i, j;
+			for (i=0; i<lsLength(id_sym->initial); i++) {
+			    for (j=0; j<lsLength(id_sym->initial); j++)
+				fprintf(file, "%c ", (i==j)?'1':'-');
+			    fprintf(file, "1\n");
+			}
+			for (i=0; i<lsLength(id_sym->initial); i++)
+			    fprintf(file, "0 ");
+			fprintf(file, "0\n");
+		    } else
+			fprintf(file,"0\n1\n");
+		}
+	    }
+	}
+    }
+}
+
+
+static void warn_uninit_vars(char *latch_name)
+{
+    char buf[MAXSTRLEN];
+
+    sprintf(buf, "'%s': variable '%s' is uninitialized",
+	    vl_currentModule->name->name, latch_name);
+    yylineno = -1;
+    fprintf(stderr, "%s, be careful\n", buf);
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_resolution.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_resolution.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_resolution.c	(revision 18)
@@ -0,0 +1,694 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_resolution.c,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "array.h"
+#include "list.h"
+#include "st.h"
+#include "set.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_vardecl.h"
+
+extern int set_notation;
+extern int smartEvent;
+extern vl_desc *mod_list;
+extern int noBus;
+
+FILE *null_file;
+
+
+void create_mvar_nondeterminism(FILE *file,
+				st_table *resultant_vars,
+				char *var_name,
+				vl_id_range *id_sym,
+				int lo, int hi,
+				array_t *controls,
+				array_t *vars_array)
+{
+    vl_term *nond_out, *ctrl_i;
+    char buf[MAXSTRLEN], buf_new[MAXSTRLEN], buf_old[MAXSTRLEN], *cp, *t;
+    var_info *cur_var;
+    st_table *vars;
+    int i, j, k;
+    int idx, idx_lo, idx_hi;
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+    array_t *val_array;
+
+    nond_out = new_term(id_sym->range, lo, hi);
+    nond_out->flag |= MVar;
+    nond_out->term_type = id_sym->id_type;
+    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+    write_var_decl(file, nond_out);
+
+
+    st_insert(resultant_vars, var_name,
+	      (char*)create_var_info(vl_copy_id_range(id_sym), nond_out));
+    st_lookup(resultant_vars, var_name, (char**)&cur_var);
+    cur_var->extra = (void*)controls;
+
+    if (id_sym->range) {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+    } else {
+	idx_lo = idx_hi = 0;
+    }
+
+    for (idx=idx_lo; idx<=idx_hi; idx++) {
+	int control_is_tautology;
+
+	control_is_tautology = 0;
+
+	val_array = array_alloc(char*, 0);
+
+	cp = buf; *cp = '\0';
+	cp = strappend(cp, ".names ");
+	for (i=0; i<array_n(controls); i++) {
+	    char tmp_buf[MAXSTRLEN];
+	    ctrl_i = array_fetch(vl_term*, controls, i);
+	    if (ctrl_i) {
+		if (ctrl_i->flag & TautologyTrue)
+		    control_is_tautology = 1;
+
+		vars = array_fetch(st_table*, vars_array, i);
+		st_lookup(vars, var_name, (char**)&cur_var);
+		cp = strappendS(cp, ctrl_i->name->name);
+		if (id_sym->range) {
+		    sprintf(tmp_buf, "%s%s%d%s",
+			    cur_var->current_terminal->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		} else {
+		    sprintf(tmp_buf, "%s",
+			    cur_var->current_terminal->name->name);
+		}
+		cp = strappendS(cp, tmp_buf);
+		array_insert_last(char*, val_array, vlStrdup(tmp_buf));
+	    } else {
+
+		t = WRT_BLIF_MV_DC(null_file,
+				   id_sym->id_type->specifier->
+				       u.enum_type->domain_list);
+		array_insert_last(char*, val_array, vlStrdup(t));
+	    }
+	}
+
+	if (!control_is_tautology) {
+
+	    strcpy(buf_old, id_sym->name);
+	    strip_char(buf_old, SEP_LATCH);
+	    if (id_sym->range) {
+		sprintf(buf_new, "%s%s%d%s",
+			buf_old, SEP_LARRAY, idx, SEP_RARRAY);
+	    } else {
+		strcpy(buf_new, buf_old);
+	    }
+	    cp = strappendS(cp, buf_new);
+	}
+
+	if (id_sym->range) {
+	    sprintf(buf_new, "%s%s%d%s",
+		    nond_out->name->name, SEP_LARRAY, idx, SEP_RARRAY);
+	    cp = strappendS(cp, buf_new);
+	} else {
+	    strcpy(buf_new, nond_out->name->name);
+	    cp = strappendS(cp, buf_new);
+	}
+
+	fprintf(file, "%s\n", buf);
+
+	if (control_is_tautology ||
+	    ((id_sym->flags & EventVar) && smartEvent)) {
+	    vl_enumerator *enum_elt;
+
+	    lsFirstItem(id_sym->id_type->specifier->u.enum_type->domain_list,
+			(lsGeneric*)&enum_elt, 0);
+	    fprintf(file, "%s %s\n", HSIS_DEFAULT, enum_elt->name);
+	}
+
+	if (set_notation) {
+
+	    for (i=0; i<array_n(controls); i++) {
+		ctrl_i = array_fetch(vl_term*, controls, i);
+		if (ctrl_i) {
+		    for (k=0; k<i; k++) {
+			ctrl_i = array_fetch(vl_term*, controls, k);
+			if (ctrl_i) fprintf(file,"- - ");
+		    }
+		    fprintf(file, "1 - ");
+		    for (k=i+1; k<array_n(controls); k++) {
+			ctrl_i = array_fetch(vl_term*, controls, k);
+			if (ctrl_i) fprintf(file, "- - ");
+		    }
+		    if (!control_is_tautology)
+			fprintf(file, "- %s%s\n",
+				HSIS_EQUAL,
+				array_fetch(char*, val_array, i));
+		    else
+			fprintf(file, "%s%s\n",
+				HSIS_EQUAL,
+				array_fetch(char*, val_array, i));
+		}
+	    }
+
+
+	    if (!control_is_tautology) {
+		for (j=0; j<array_n(controls); j++) {
+		    ctrl_i = array_fetch(vl_term*, controls, j);
+		    if (ctrl_i) fprintf(file, "0 - ");
+		}
+		if (id_sym->range) {
+		    char id_buf[MAXSTRLEN];
+		    sprintf(id_buf, "%s%s%d%s",
+			    id_sym->name, SEP_LARRAY, idx, SEP_RARRAY);
+		    fprintf(file, "- %s%s\n", HSIS_EQUAL, id_buf);
+		} else {
+		    fprintf(file, "- %s%s\n", HSIS_EQUAL, id_sym->name);
+		}
+	    }
+
+	    for (i=0; i<array_n(val_array); i++)
+		vl_chk_free(array_fetch(char*, val_array, i));
+	} else {
+
+	    for (i=0; i<array_n(controls); i++) {
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,
+			    (lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+		    ctrl_i = array_fetch(vl_term*, controls, i);
+		    if (ctrl_i) {
+			for (k=0; k<i; k++) {
+			    ctrl_i = array_fetch(vl_term*, controls, k);
+			    if (ctrl_i) fprintf(file,"- - ");
+			}
+			fprintf(file, "1 %s ", enum_elt->name);
+			for (k=i+1; k<array_n(controls); k++) {
+			    ctrl_i = array_fetch(vl_term*, controls, k);
+			    if (ctrl_i) fprintf(file, "- - ");
+			}
+			fprintf(file, "- %s\n", enum_elt->name);
+		    }
+		}
+		lsFinish(enum_gen);
+	    }
+
+	    for (enum_gen=lsStart(domain);
+		 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		     LS_NOMORE;) {
+		for (j=0; j<array_n(controls); j++) {
+		    ctrl_i = array_fetch(vl_term*, controls, j);
+		    if (ctrl_i) fprintf(file, "0 - ");
+		}
+		fprintf(file, "%s %s\n", enum_elt->name, enum_elt->name);
+	    }
+	    lsFinish(enum_gen);
+	}
+	array_free(val_array);
+    }
+}
+
+
+void create_bin_scalar_nondeterminism(FILE *file,
+				      st_table *resultant_vars,
+				      char *var_name,
+				      vl_id_range *id_sym,
+				      array_t *controls,
+				      array_t *vars_array)
+{
+    vl_term *nond_out, *ctrl_i;
+    char buf[MAXSTRLEN], buf_new[MAXSTRLEN], buf_old[MAXSTRLEN], *cp;
+    var_info *cur_var;
+    st_table *vars;
+    int i, j, k;
+    int idx, idx_lo, idx_hi;
+
+    nond_out = new_term(NIL(vl_range), 0, -1);
+
+    st_insert(resultant_vars, var_name,
+	      (char*)create_var_info(vl_copy_id_range(id_sym), nond_out));
+    st_lookup(resultant_vars, var_name, (char**)&cur_var);
+    nond_out->name->range = id_sym->range;
+    nond_out->name->unintType = id_sym->unintType;
+    cur_var->extra = (void*)controls;
+
+    if (id_sym->range) {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+    } else {
+	idx_lo = idx_hi = 0;
+    }
+
+    write_var_decl(file, nond_out);
+
+    for (idx=idx_lo; idx<=idx_hi; idx++) {
+	int control_is_tautology;
+
+	control_is_tautology = 0;
+
+	cp = buf; *cp = '\0';
+	cp = strappend(cp, ".names ");
+	for (i=0; i<array_n(controls); i++) {
+	    char tmp_buf[MAXSTRLEN];
+	    ctrl_i = array_fetch(vl_term*, controls, i);
+	    if (ctrl_i) {
+		if (!(ctrl_i->flag & ConflictFalse)) {
+		    if (ctrl_i->flag & TautologyTrue)
+			control_is_tautology = 1;
+
+		    vars = array_fetch(st_table*, vars_array, i);
+		    st_lookup(vars, var_name, (char**)&cur_var);
+		    cp = strappendS(cp, ctrl_i->name->name);
+		    if (id_sym->range) {
+			sprintf(tmp_buf, "%s%s%d%s",
+				cur_var->current_terminal->name->name,
+				SEP_LARRAY, idx, SEP_RARRAY);
+			cp = strappendS(cp, tmp_buf);
+		    } else {
+			sprintf(tmp_buf, "%s",
+				cur_var->current_terminal->name->name);
+			cp = strappendS(cp, tmp_buf);
+		    }
+		}
+	    } else {
+
+		cp = cp;
+
+	    }
+	}
+
+	if (!control_is_tautology &&
+	    (!(id_sym->flags & EventVar) || !smartEvent)) {
+	    strcpy(buf_old, id_sym->name);
+	    strip_char(buf_old, SEP_LATCH);
+	    if (id_sym->range) {
+		sprintf(buf_new, "%s%s%d%s",
+			buf_old, SEP_LARRAY, idx, SEP_RARRAY);
+		cp = strappendS(cp, buf_new);
+	    } else {
+		strcpy(buf_new, buf_old);
+		cp = strappendS(cp, buf_new);
+	    }
+	}
+
+	if (id_sym->range) {
+	    sprintf(buf_new, "%s%s%d%s",
+		    nond_out->name->name,
+		    SEP_LARRAY, idx, SEP_RARRAY);
+	    cp = strappendS(cp, buf_new);
+	} else {
+	    strcpy(buf_new, nond_out->name->name);
+	    cp = strappendS(cp, buf_new);
+	}
+
+	fprintf(file, "%s\n", buf);
+
+	if (control_is_tautology ||
+	    ((id_sym->flags & EventVar) && smartEvent)) {
+	    fprintf(file, "%s %d\n", HSIS_DEFAULT, 0);
+	}
+
+
+	for (i=0; i<array_n(controls); i++) {
+	    ctrl_i = array_fetch(vl_term*, controls, i);
+	    if (ctrl_i) {
+		if (!(ctrl_i->flag & ConflictFalse)) {
+
+		    for (j=0; j<= 1; j++) {
+			for (k=0; k<i; k++) {
+			    ctrl_i = array_fetch(vl_term*, controls, k);
+			    if (ctrl_i)
+				fprintf(file,"- - ");
+			}
+			fprintf(file, "1 %d ", j);
+			for (k=i+1; k<array_n(controls); k++) {
+			    ctrl_i = array_fetch(vl_term*, controls, k);
+			    if (ctrl_i)
+				fprintf(file, "- - ");
+			}
+			if (!control_is_tautology &&
+			    (!(id_sym->flags & EventVar) ||
+			     !smartEvent))
+			    fprintf(file, "- %d\n", j);
+			else
+			    fprintf(file, "%d\n", j);
+		    }
+		}
+	    }
+	}
+
+	if (!control_is_tautology) {
+	    if (!(id_sym->flags & EventVar) || !smartEvent) {
+
+		for (i=0; i<=1; i++) {
+		    for (j=0; j<array_n(controls); j++) {
+			ctrl_i = array_fetch(vl_term*, controls, j);
+			if (ctrl_i)
+			    fprintf(file, "0 - ");
+		    }
+		    fprintf(file, "%d %d\n", i, i);
+		}
+	    } else {
+
+		for (j=0; j<array_n(controls); j++) {
+		    ctrl_i = array_fetch(vl_term*, controls, j);
+		    if (ctrl_i) fprintf(file, "0 - ");
+		}
+		fprintf(file, "%d\n", 0);
+	    }
+	}
+    }
+}
+
+
+void create_bin_vector_nondeterminism(FILE *file,
+				      st_table *resultant_vars,
+				      char *var_name,
+				      vl_id_range *id_sym,
+				      int lo, int hi,
+				      array_t *controls,
+				      array_t *vars_array)
+{
+    vl_term *nond_out, *ctrl_i;
+    char buf[MAXSTRLEN];
+    char buf_tmp[MAXSTRLEN];
+    char *cp;
+    var_info *cur_var;
+    st_table *vars;
+    int h, i, j, k;
+    int idx, idx_lo, idx_hi;
+    char ctrl_terms_buf[MAXSTRLEN], *ctrl_terms_cp;
+    char val_terms_buf[MAXSTRLEN], *val_terms_cp;
+
+    nond_out = new_term(id_sym->range, lo, hi);
+    write_var_decl(file, nond_out);
+
+    st_insert(resultant_vars, vlStrdup(var_name),
+	      (char*)create_var_info(vl_copy_id_range(id_sym), nond_out));
+    st_lookup(resultant_vars, var_name, (char**)&cur_var);
+    cur_var->extra = (void*)controls;
+
+    if (id_sym->range) {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+    } else {
+	idx_lo = idx_hi = 0;
+    }
+
+    for (idx=idx_lo; idx<=idx_hi; idx++) {
+	if (set_notation && !(array_n(controls) <= 1 && noBus)) {
+	    char buf_ctrl[MAXSTRLEN], buf_var[MAXSTRLEN];
+	    int control_is_tautology;
+
+	    control_is_tautology = 0;
+
+	    cp = buf; *cp = '\0';
+	    ctrl_terms_cp = ctrl_terms_buf;  *ctrl_terms_cp = '\0';
+	    val_terms_cp = val_terms_buf;  *val_terms_cp = '\0';
+	    cp = strappend(cp, ".names ");
+	    for (i=0; i<array_n(controls); i++) {
+		ctrl_i = array_fetch(vl_term*, controls, i);
+		if (ctrl_i) {
+		    if (!(ctrl_i->flag & ConflictFalse)) {
+			if (ctrl_i->flag & TautologyTrue)
+			    control_is_tautology = 1;
+
+			vars = array_fetch(st_table*, vars_array, i);
+			st_lookup(vars, var_name, (char**)&cur_var);
+			sprintf(buf_ctrl, "%s", ctrl_i->name->name);
+
+			cp = strappendS(cp, buf_ctrl);
+			ctrl_terms_cp =
+			    strappendS(ctrl_terms_cp, buf_ctrl);
+			for (h=lo; h<=hi; h++) {
+			    if (!id_sym->range) {
+				sprintf(buf_var, "%s%s%d%s",
+					cur_var->current_terminal->
+					name->name,
+					SEP_LBITSELECT, h, SEP_RBITSELECT);
+			    } else {
+				sprintf(buf_var, "%s%s%d%s%s%d%s",
+					cur_var->current_terminal->
+					name->name,
+					SEP_LARRAY, idx, SEP_RARRAY,
+					SEP_LBITSELECT, h, SEP_RBITSELECT);
+			    }
+			    cp = strappendS(cp, buf_var);
+			}
+		    }
+		} else {
+
+		    cp = cp;
+
+		}
+	    }
+
+	    if (!control_is_tautology) {
+		for (h=lo; h<=hi; h++) {
+		    if (id_sym->range) {
+			sprintf(buf_tmp, "%s%s%d%s%s%d%s",
+				strip_char(vlStrdup(id_sym->name),SEP_LATCH),
+				SEP_LARRAY, idx, SEP_RARRAY,
+				SEP_LBITSELECT, h, SEP_RBITSELECT);
+		    } else {
+			sprintf(buf_tmp, "%s%s%d%s",
+				strip_char(vlStrdup(id_sym->name),SEP_LATCH),
+				SEP_LBITSELECT, h, SEP_RBITSELECT);
+		    }
+		    cp = strappendS(cp, buf_tmp);
+		}
+	    }
+
+	    cp = strappendS(cp, HSIS_ARROW);
+	    for (h=lo; h<=hi; h++) {
+		if (id_sym->range) {
+		    sprintf(buf_tmp, "%s%s%d%s%s%d%s",
+			    nond_out->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, h, SEP_RBITSELECT);
+		} else {
+		    sprintf(buf_tmp, "%s%s%d%s",
+			    nond_out->name->name,
+			    SEP_LBITSELECT, h, SEP_RBITSELECT);
+		}
+		cp = strappendS(cp, buf_tmp);
+	    }
+	    fprintf(file, "%s\n", buf);
+
+	    if (control_is_tautology ||
+		((id_sym->flags & EventVar) && smartEvent)) {
+		fprintf(file, "%s", HSIS_DEFAULT);
+		for (h=lo; h<=hi; h++)
+		    fprintf(file, " %d", 0);
+		fprintf(file, "\n");
+	    }
+
+	    for (i=0; i<array_n(controls); i++) {
+		ctrl_i = array_fetch(vl_term*, controls, i);
+		if (ctrl_i) {
+		    if (!(ctrl_i->flag & ConflictFalse)) {
+			for (k=0; k<i; k++) {
+			    ctrl_i = array_fetch(vl_term*,controls,k);
+			    if (ctrl_i) {
+				fprintf(file,"- ");
+				for (h=lo; h<=hi; h++) fprintf(file,"- ");
+			    }
+			}
+			fprintf(file, "1 ");
+			for (h=lo; h<=hi; h++) fprintf(file, "- ");
+			for (k=i+1; k<array_n(controls); k++) {
+			    ctrl_i = array_fetch(vl_term*,controls,k);
+			    if (ctrl_i) {
+				if (!(ctrl_i->flag & ConflictFalse)) {
+				    fprintf(file,"- ");
+				    for (h=lo; h<=hi; h++)
+					fprintf(file,"- ");
+				}
+			    }
+			}
+
+			if (!control_is_tautology) {
+			    for (h=lo; h<=hi; h++) fprintf(file, "- ");
+			}
+
+			for (h=lo; h<=hi; h++) {
+			    vars = array_fetch(st_table*, vars_array, i);
+			    st_lookup(vars, var_name, (char**)&cur_var);
+			    if (!id_sym->range) {
+				sprintf(buf_var, "%s%s%d%s",
+					cur_var->current_terminal->
+					name->name,
+					SEP_LBITSELECT, h, SEP_RBITSELECT);
+			    } else {
+				sprintf(buf_var, "%s%s%d%s%s%d%s",
+					cur_var->current_terminal->
+					name->name,
+					SEP_LARRAY, idx, SEP_RARRAY,
+					SEP_LBITSELECT, h, SEP_RBITSELECT);
+			    }
+			    fprintf(file, "%s%s ", HSIS_EQUAL, buf_var);
+			}
+			fprintf(file, "\n");
+		    }
+		}
+	    }
+
+	    if (!control_is_tautology) {
+		for (j=0; j<array_n(controls); j++) {
+		    ctrl_i = array_fetch(vl_term*, controls, j);
+		    if (ctrl_i) {
+			if (!(ctrl_i->flag & ConflictFalse)) {
+			    fprintf(file, "0 ");
+			    for (h=lo; h<=hi; h++) fprintf(file, "- ");
+			}
+		    }
+		}
+
+		for (h=lo; h<=hi; h++) fprintf(file, "- ");
+		for (h=lo; h<=hi; h++) {
+		    if (!id_sym->range) {
+			sprintf(buf_var, "%s%s%d%s",
+				strip_char(vlStrdup(id_sym->name),SEP_LATCH),
+				SEP_LBITSELECT, h, SEP_RBITSELECT);
+		    } else {
+			sprintf(buf_var, "%s%s%d%s%s%d%s",
+				strip_char(vlStrdup(id_sym->name),SEP_LATCH),
+				SEP_LARRAY, idx, SEP_RARRAY,
+				SEP_LBITSELECT, h, SEP_RBITSELECT);
+		    }
+		    fprintf(file, "%s%s ", HSIS_EQUAL, buf_var);
+		}
+		fprintf(file, "\n");
+	    }
+	} else {
+	    for (h=lo; h<=hi; h++) {
+
+		cp = buf; *cp = '\0';
+		cp = strappend(cp, ".names ");
+		for (i=0; i<array_n(controls); i++) {
+		    ctrl_i = array_fetch(vl_term*, controls, i);
+		    if (ctrl_i) {
+			if (!(ctrl_i->flag & ConflictFalse)) {
+			    char buf_ctrl[MAXSTRLEN], buf_var[MAXSTRLEN];
+
+			    vars = array_fetch(st_table*, vars_array, i);
+			    st_lookup(vars, var_name, (char**)&cur_var);
+			    sprintf(buf_ctrl, "%s", ctrl_i->name->name);
+
+			    if (!id_sym->range) {
+				sprintf(buf_var, "%s%s%d%s",
+					cur_var->current_terminal->
+					name->name,
+					SEP_LBITSELECT, h, SEP_RBITSELECT);
+			    } else {
+				sprintf(buf_var, "%s%s%d%s%s%d%s",
+					cur_var->current_terminal->
+					name->name,
+					SEP_LARRAY, idx, SEP_RARRAY,
+					SEP_LBITSELECT, h, SEP_RBITSELECT);
+			    }
+			    cp = strappendS(cp, buf_ctrl);
+			    cp = strappendS(cp, buf_var);
+			}
+		    } else {
+
+			cp = cp;
+
+		    }
+		}
+		if (id_sym->range) {
+		    sprintf(buf_tmp, "%s%s%d%s%s%d%s %s%s%d%s%s%d%s",
+			    strip_char(vlStrdup(id_sym->name),SEP_LATCH),
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, h, SEP_RBITSELECT,
+			    nond_out->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, h, SEP_RBITSELECT);
+		} else {
+		    sprintf(buf_tmp, "%s%s%d%s %s%s%d%s",
+			    strip_char(vlStrdup(id_sym->name),SEP_LATCH),
+			    SEP_LBITSELECT, h, SEP_RBITSELECT,
+			    nond_out->name->name,
+			    SEP_LBITSELECT, h, SEP_RBITSELECT);
+		}
+		cp = strappendS(cp, buf_tmp);
+		fprintf(file, "%s\n", buf);
+
+		for (i=0; i<array_n(controls); i++) {
+		    ctrl_i = array_fetch(vl_term*, controls, i);
+		    if (ctrl_i) {
+			if (!(ctrl_i->flag & ConflictFalse)) {
+			    for (j=0; j<= 1; j++) {
+				for (k=0; k<i; k++) {
+				    ctrl_i =
+					array_fetch(vl_term*,controls,k);
+				    if (ctrl_i)
+					if (!(ctrl_i->flag&ConflictFalse))
+					    fprintf(file,"- - ");
+				}
+				fprintf(file, "1 %d ", j);
+				for (k=i+1; k<array_n(controls); k++) {
+				    ctrl_i =
+					array_fetch(vl_term*,controls,k);
+				    if (ctrl_i)
+					if (!(ctrl_i->flag&ConflictFalse))
+					    fprintf(file, "- - ");
+				}
+				fprintf(file, "- %d\n", j);
+			    }
+			}
+		    }
+		}
+
+		for (i=0; i<=1; i++) {
+		    for (j=0; j<array_n(controls); j++) {
+			ctrl_i = array_fetch(vl_term*, controls, j);
+			if (ctrl_i)
+			    if (!(ctrl_i->flag & ConflictFalse))
+				fprintf(file, "0 - ");
+		    }
+		    fprintf(file, "%d %d\n", i, i);
+		}
+	    }
+	}
+    }
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_traverse.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_traverse.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_traverse.c	(revision 18)
@@ -0,0 +1,2524 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Id: vl_traverse.c,v 1.4 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+
+#include "util.h"
+#include "st.h"
+#include "list.h"
+#include "array.h"
+#include "set.h"
+#include "stack.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "graph.h"
+#include "vl_fg_defs.h"
+#include "vl_fg_types.h"
+#include "vl_flowgraph.h"
+#include "vl_traverse.h"
+#include "vl_copy.h"
+#include "vl_create.h"
+#include "vl_write_util.h"
+#include "dataflow.h"
+#include "vl_write.h"
+#include "verilog.h"
+#include <stdarg.h>
+
+int vlTimedSystem = 0;
+
+extern vl_desc *mod_list;
+
+extern int dflow_analysis;
+
+extern int dflow_context;
+
+extern int vlPhase;
+
+extern int implicitClocking;
+
+extern int WarningLevel;
+
+extern vl_module *vl_encloseModule;
+
+int use_libraryGate;
+
+int Loop_Unrolling=1;
+
+int Repeat_Unrolling=1;
+
+int    PrtEnable=0;
+
+
+int indexAssignment=0;
+
+
+int aliasSP=0;
+st_table *aliasStack[20];
+
+vl_procstmt *vl_currentProcStmt;
+int in_reset_stmt=0;
+static int lhs_id=0;
+static int StpTrace=0;
+
+static void assoc_formal_actual ARGS((vl_task *task_dfn,
+				      lsList formal, lsList actual));
+static void vl_expand_Q ARGS((FILE *file, lsList tags));
+static void record_program_location ARGS((vl_procstmt *procstmt));
+static void register_clock ARGS((FILE *file, vl_event_expr *event));
+static void check_task_arg ARGS((int ok, vl_task *task_dfn));
+static void rec_expand_Q ARGS((int num_Q, array_t *q_array,
+			       char *bit_str, lsList tags,
+			       lsGen gen, lsHandle *phandle));
+
+
+void vl_fprintf_stmt(FILE* file, ...)
+{
+    char *fmt;
+    va_list args;
+
+    va_start(args, file);
+    fmt = va_arg(args, char*);
+    if (PrtEnable) (void)vfprintf(file, fmt, args);
+    va_end(args);
+}
+
+enum st_retval vl_step_desc(char *name, char *value, char *arg)
+
+{
+    if (((typestructPtr)value)->type == ModDecl) {
+	vl_step_module(stdout, (vl_module*)value);
+    } else if (((typestructPtr)value)->type == CombPrimDecl ||
+	       ((typestructPtr)value)->type == SeqPrimDecl) {
+	vl_step_primitive(stdout, (vl_primitive*)value);
+    }
+
+    name = name;
+    arg = arg;
+    return ST_CONTINUE;
+}
+
+void vl_step_module(FILE *file, vl_module *mod)
+{
+    if (mod == NULL) return;
+
+    ASSERT(mod->type==ModDecl, "Expecting ModDecl");
+
+    if (mod->visited) return;
+
+    vl_currentModule = mod;
+    StpTRACE("printing module\n");
+    vl_fprintf_stmt(file, "module ");
+    vl_step_id_range(file, mod->name);
+    vl_step_ports(file, mod->ports);
+    vl_fprintf_stmt(file, ";\n");
+    vl_step_mod_item_list(file, mod->mod_items);
+    vl_fprintf_stmt(file, "endmodule\n\n");
+    vl_currentModule = NIL(vl_module);
+    mod->visited = 1;
+}
+
+
+void vl_step_primitive(FILE *file, vl_primitive *prim)
+{
+    if (prim == NULL) return;
+
+    ASSERT((prim->type==CombPrimDecl || prim->type==SeqPrimDecl),
+	   "Expecting PrimDecl");
+    StpTRACE("Printing primitive\n");
+    vl_fprintf_stmt(file, "primitive ");
+    vl_step_id_range(file, prim->name);
+    vl_step_ports(file, prim->ports);
+    vl_fprintf_stmt(file, ";\n");
+    vl_step_mod_item_list(file, prim->decls);
+    vl_step_prim_table(file, prim->type, prim->entries);
+    vl_fprintf_stmt(file, "endprimitive\n\n");
+}
+
+
+void vl_step_prim_table(FILE *file, short type, lsList entries)
+{
+    vl_prim_entry *e;
+    int i;
+    lsHandle handle;
+    lsGen gen;
+
+    if (entries == NULL) return;
+
+    StpTRACE("Printing primitive table\n");
+    vl_fprintf_stmt(file, "table\n");
+    for(gen = lsStart(entries); lsNext(gen, (lsGeneric*)&e, &handle)
+				    != LS_NOMORE; ) {
+	for (i=0; i<10; i++) {
+	    if (e->inputs[i] == PrimNone)
+		break;
+	    else
+		vl_fprintf_stmt(file, "%s ", vl_get_prim_symbol(e->inputs[i]));
+	}
+	if (type == SeqPrimDecl)
+	    vl_fprintf_stmt(file, ": %s", vl_get_prim_symbol(e->state));
+
+	vl_fprintf_stmt(file, ": %s\n", vl_get_prim_symbol(e->next_state));
+    }
+    (void) lsFinish(gen);
+    vl_fprintf_stmt(file, "endtable\n");
+}
+
+
+void vl_step_basicdecl(FILE *file, vl_decl *decl)
+{
+
+    StpTRACE("Printing Basic decl\n");
+    switch(decl->type) {
+    case RealDecl:
+	vl_fprintf_stmt(file, "real ");
+	vl_step_id_list(file, decl->ids);
+	break;
+    case EventDecl:
+	vl_fprintf_stmt(file, "event ");
+	vl_step_id_list(file, decl->ids);
+	break;
+    case IntDecl:
+	vl_fprintf_stmt(file, "integer ");
+	vl_step_id_range_list(file, decl->ids);
+	break;
+    case TimeDecl:
+	vl_fprintf_stmt(file, "time ");
+	vl_step_id_range_list(file, decl->ids);
+	break;
+    default:
+	internal_error("Unexpected Basic Decl type");	break;
+    }
+    vl_fprintf_stmt(file, ";\n");
+}
+
+
+void vl_step_rangedecl(FILE *file, vl_rangedecl *decl)
+{
+    StpTRACE("Printing Range decl\n");
+    switch(decl->type) {
+    case InputDecl:
+	vl_fprintf_stmt(file, "input ");	break;
+    case OutputDecl:
+	vl_fprintf_stmt(file, "output ");	break;
+    case InoutDecl:
+	vl_fprintf_stmt(file, "inout ");	break;
+    case RegDecl:
+	vl_fprintf_stmt(file, "reg ");	break;
+    default:
+	internal_error("Unexpected Range Decl");	break;
+    }
+    vl_step_range(file, decl->range);
+    if (decl->type == RegDecl)
+	vl_step_id_range_list(file, decl->ids);
+    else
+	vl_step_id_list(file, decl->ids);
+    vl_fprintf_stmt(file, ";\n");
+}
+
+void vl_step_paramdecl(FILE *file, vl_paramdecl *decl)
+{
+
+    StpTRACE("Printing Parameter decl\n");
+    switch(decl->type) {
+    case ParamDecl:
+	vl_fprintf_stmt(file, "parameter ");	break;
+    case DefparamDecl:
+	vl_fprintf_stmt(file, "defparam ");	break;
+    default:
+	internal_error("Unexpected Param Decl");	break;
+    }
+
+    {
+	vl_bassign_stmt *assign;
+	lsHandle handle;
+	lsGen gen;
+
+	gen = lsStart(decl->assigns);
+	if (lsNext(gen, (lsGeneric*)&assign, &handle) == LS_OK) {
+	    vl_step_bassign_stmt(file, assign);
+	    while(lsNext(gen, (lsGeneric*)&assign, &handle) != LS_NOMORE) {
+		vl_fprintf_stmt(file, ", ");
+		vl_step_bassign_stmt(file, assign);
+	    }
+	}
+    }
+    vl_fprintf_stmt(file, ";\n");
+}
+
+void vl_step_netdecl(FILE *file, vl_netdecl *decl)
+{
+
+    StpTRACE("Printing Net decl\n");
+    switch(decl->type) {
+    case WireDecl:
+	vl_fprintf_stmt(file, "wire");	break;
+    case TriDecl:
+	vl_fprintf_stmt(file, "tri");	break;
+    case Tri0Decl:
+	vl_fprintf_stmt(file, "tri0");	break;
+    case Tri1Decl:
+	vl_fprintf_stmt(file, "tri1");	break;
+    case Supply0Decl:
+	vl_fprintf_stmt(file, "supply0");	break;
+    case Supply1Decl:
+	vl_fprintf_stmt(file, "supply1");	break;
+    case WandDecl:
+	vl_fprintf_stmt(file, "wand");	break;
+    case TriandDecl:
+	vl_fprintf_stmt(file, "triand");	break;
+    case WorDecl:
+	vl_fprintf_stmt(file, "wor");	break;
+    case TriorDecl:
+	vl_fprintf_stmt(file, "trior");	break;
+    case TriregDecl:
+	vl_fprintf_stmt(file, "trireg");	break;
+    default:
+	internal_error("Unexpected Net Decl");	break;
+    }
+    vl_step_strength(file, decl->strength);
+    vl_step_range(file, decl->range);
+    vl_step_delay(file, decl->delay);
+    vl_step_net_list(file, decl->ids);
+    vl_fprintf_stmt(file, ";\n");
+
+}
+
+void vl_step_task(FILE *file, vl_task *task)
+{
+
+    StpTRACE("Printing Task\n");
+    ASSERT(task->type == TaskDecl, "Unexpected Task Type");
+
+    vl_fprintf_stmt(file, "\ntask ");
+    vl_step_id_range(file, task->name);
+    vl_fprintf_stmt(file, ";\n");
+    vl_step_decl_list(file, task->decls);
+    vl_step_stmt_list(file, task->stmts);
+    vl_fprintf_stmt(file, "endtask\n");
+}
+
+void vl_step_function(FILE *file, vl_function *func)
+{
+    int old_dflow_analysis;
+    vl_function *old_function;
+    vl_module *old_module;
+    vl_module *old_enclosemodule;
+
+    StpTRACE("Printing Function\n");
+
+
+    old_dflow_analysis = dflow_analysis;
+    dflow_analysis = 0;
+    dataflow_init();
+
+    vl_fprintf_stmt(file, "\nfunc ");
+    switch(func->type) {
+    case IntFuncDecl:
+	st_insert(vl_currentModule->func_st, func->name->name, (char*)func);
+	vl_fprintf_stmt(file, "integer ");
+	break;
+    case RealFuncDecl:
+	st_insert(vl_currentModule->func_st, func->name->name, (char*)func);
+	vl_fprintf_stmt(file, "real ");
+	break;
+    case RangeFuncDecl:
+	st_insert(vl_currentModule->func_st, func->name->name, (char*)func);
+	vl_step_range(file, func->range);
+	break;
+    default:
+	internal_error("Unexpected Function Type");
+    }
+    vl_step_id_range(file, func->name);
+    vl_fprintf_stmt(file, ";\n");
+    old_module = vl_currentModule;
+    old_function = vl_currentFunction;
+    old_enclosemodule = vl_encloseModule;
+    vl_encloseModule = vl_currentModule;
+    vl_currentModule = (vl_module*)func;
+    vl_currentFunction = func;
+    vl_step_decl_list(file, func->decls);
+    vl_step_stmt_list(file, func->stmts);
+    vl_currentModule = old_module;
+    vl_currentFunction = old_function;
+    vl_encloseModule = old_enclosemodule;
+    vl_fprintf_stmt(file, "endfunction\n");
+
+    dflow_analysis = old_dflow_analysis;
+    dataflow_end();
+}
+
+void vl_step_gate_inst_list(FILE *file, vl_gate_inst_list *gatelist)
+{
+
+    StpTRACE("Printing Gate Instance List\n");
+    switch(gatelist->type) {
+    case AndGate:
+	vl_fprintf_stmt(file, "and");	break;
+    case NandGate:
+	vl_fprintf_stmt(file, "nand");	break;
+    case OrGate:
+	vl_fprintf_stmt(file, "or");	break;
+    case NorGate:
+	vl_fprintf_stmt(file, "nor");	break;
+    case XorGate:
+	vl_fprintf_stmt(file, "xor");	break;
+    case XnorGate:
+	vl_fprintf_stmt(file, "xnor");	break;
+    case BufGate:
+	vl_fprintf_stmt(file, "buf");	break;
+    case Bufif0Gate:
+	vl_fprintf_stmt(file, "bufif0");	break;
+    case Bufif1Gate:
+	vl_fprintf_stmt(file, "bufif1");	break;
+    case NotGate:
+	vl_fprintf_stmt(file, "not");	break;
+    case Notif0Gate:
+	vl_fprintf_stmt(file, "notif0");	break;
+    case Notif1Gate:
+	vl_fprintf_stmt(file, "notif1");	break;
+    case PulldownGate:
+	vl_fprintf_stmt(file, "pulldown");	break;
+    case PullupGate:
+	vl_fprintf_stmt(file, "pullup");	break;
+    case NmosGate:
+	vl_fprintf_stmt(file, "nmos");	break;
+    case RnmosGate:
+	vl_fprintf_stmt(file, "rnmos");	break;
+    case PmosGate:
+	vl_fprintf_stmt(file, "pmos");	break;
+    case RpmosGate:
+	vl_fprintf_stmt(file, "rpmos");	break;
+    case CmosGate:
+	vl_fprintf_stmt(file, "cmos");	break;
+    case RcmosGate:
+	vl_fprintf_stmt(file, "rcmos");	break;
+    case TranGate:
+	vl_fprintf_stmt(file, "tran");	break;
+    case RtranGate:
+	vl_fprintf_stmt(file, "rtran");	break;
+    case Tranif0Gate:
+	vl_fprintf_stmt(file, "tranif0");	break;
+    case Rtranif0Gate:
+	vl_fprintf_stmt(file, "rtranif0");	break;
+    case Tranif1Gate:
+	vl_fprintf_stmt(file, "tranif1");	break;
+    case Rtranif1Gate:
+	vl_fprintf_stmt(file, "rtranif1");	break;
+    default:
+	internal_error("Unexpected Gate Type");	break;
+    }
+    vl_fprintf_stmt(file, " ");
+    vl_step_strength(file, gatelist->strength);
+    vl_step_delay(file, gatelist->delays);
+    vl_step_gates(file, gatelist->gates);
+    vl_fprintf_stmt(file, ";\n");
+}
+
+void vl_step_gates(FILE *file, lsList gates)
+{
+    vl_gate_inst *gate;
+    lsHandle handle;
+    lsGen gen;
+
+    StpTRACE("Printing Gate Instances\n");
+    gen = lsStart(gates);
+    if (lsNext(gen, (lsGeneric*)&gate, &handle) == LS_OK) {
+	vl_step_gate(file, gate);
+	while(lsNext(gen, (lsGeneric*)&gate, &handle) != LS_NOMORE) {
+	    vl_fprintf_stmt(file, ", ");
+	    vl_step_gate(file, gate);
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+void vl_step_prim_inst_list(FILE *file, vl_mod_prim_inst_list *primlist)
+{
+
+    StpTRACE("Printing Primitive Instance List\n");
+
+    vl_step_id_range(file, primlist->name);
+    vl_step_strength(file, primlist->strength);
+    vl_step_delay(file, primlist->delays);
+    vl_step_prims(file, primlist->mps);
+    vl_fprintf_stmt(file, ";\n");
+}
+
+void vl_step_prims(FILE *file, lsList prims)
+{
+    vl_mod_prim_inst *prim;
+    lsHandle handle;
+    lsGen gen;
+
+    StpTRACE("Printing Primitive Instances\n");
+    gen = lsStart(prims);
+    if (lsNext(gen, (lsGeneric*)&prim, &handle) == LS_OK) {
+	vl_step_prim(file, prim);
+	while(lsNext(gen, (lsGeneric*)&prim, &handle) != LS_NOMORE) {
+	    vl_fprintf_stmt(file, ", ");
+	    vl_step_prim(file, prim);
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+void vl_step_mod_inst_list(FILE *file, vl_mod_prim_inst_list *modinstlist)
+{
+    vl_module *result;
+
+    StpTRACE("Printing Module Instance List\n");
+
+    result = vl_chk_param_dup_master(modinstlist);
+    if (result) modinstlist->name = result->name;
+
+    vl_step_id_range(file, modinstlist->name);
+    vl_fprintf_stmt(file, " ");
+    vl_step_param_vals(file, (lsList)modinstlist->delays);
+    vl_step_mod_insts(file, modinstlist->mps);
+    vl_fprintf_stmt(file, ";\n");
+}
+
+void vl_step_mod_insts(FILE *file, lsList modinsts)
+{
+    vl_mod_prim_inst *modinst;
+    lsHandle handle;
+    lsGen gen;
+
+    StpTRACE("Printing Module Instances\n");
+    gen = lsStart(modinsts);
+    if (lsNext(gen, (lsGeneric*)&modinst, &handle) == LS_OK) {
+	vl_step_modinst(file, modinst);
+	while(lsNext(gen, (lsGeneric*)&modinst, &handle) != LS_NOMORE) {
+	    vl_fprintf_stmt(file, ", ");
+	    vl_step_modinst(file, modinst);
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+
+void vl_step_procstmt(FILE *file, vl_procstmt *pstmt)
+{
+    int old_dflow_context;
+    graph_t *fg_FlowGraph;
+    edge_t *back_edge;
+
+    StpTRACE("Printing Process stmt\n");
+    old_dflow_context = dflow_context;
+    dataflow_init();
+
+    fg_FlowGraph = fg_new_graph();
+
+    vl_currentProcStmt = pstmt;
+
+    switch(pstmt->type) {
+    case AlwaysStmt: {
+	lsNewEnd(vl_currentModule->flow_graphs, (lsGeneric)fg_FlowGraph, 0);
+
+
+	back_edge = fg_new_always_block();
+
+
+	dflow_context |= DFLOW_Always;
+	vl_fprintf_stmt(file, "always\n");
+	break;
+    }
+    case InitialStmt:
+	dflow_context |= DFLOW_Initial;
+	if (pstmt->flags & TimedInitStmt) {
+	    lsNewEnd(vl_currentModule->flow_graphs,(lsGeneric)fg_FlowGraph,0);
+
+	    fg_new_always_block();
+
+	    pstmt->type = AlwaysStmt;
+	    pstmt->flags |= PseudoAlways;
+	} else {
+	    in_reset_stmt = 1;
+	    vl_currentModule->flags |= WithInitial;
+	}
+	vl_fprintf_stmt(file, "initial\n");
+	break;
+    default:
+	internal_error("Unexpected Process Statement Type");	break;
+    }
+
+
+    vl_step_stmt(file, pstmt->stmt);
+    in_reset_stmt = 0;
+    vl_currentProcStmt = NIL(vl_procstmt);
+
+    dflow_context = old_dflow_context;
+    dataflow_end();
+
+
+    if (pstmt->flags & PseudoAlways) {
+	pstmt->fg_info = (char*)fg_pseudo_sink();
+	((fg_node_info*)((vertex_t*)pstmt->fg_info)->user_data)->data =
+	    (char*)pstmt;
+    } else {
+	fg_closeloop();
+    }
+
+    if (pstmt->type == AlwaysStmt && !(pstmt->flags & PseudoAlways)) {
+	assert(fg_check_cyclic());
+    }
+
+    fg_clean_fg();
+}
+
+int vl_step_begin_end_stmt(FILE *file, vl_begin_end_stmt *bestmt)
+{
+    int step_flag;
+
+    StpTRACE("Printing beginend\n");
+    ASSERT(bestmt->type == BeginEndStmt, "Unexpected BeginEndStmt Type");
+
+    vl_fprintf_stmt(file, "begin\n");
+    vl_step_decl_list(file, bestmt->decls);
+    step_flag = vl_step_stmt_list(file, bestmt->stmts);
+    vl_fprintf_stmt(file, "end\n");
+
+    return step_flag;
+}
+
+int vl_step_if_else_stmt(FILE *file, vl_if_else_stmt *stmt)
+{
+    set_t *if_set = NIL(set_t), *else_set = NIL(set_t);
+    set_t *new_set = NIL(set_t);
+    int step_flag_if = 0, step_flag_else = 0;
+    vertex_t *old_Srce, *old_Sink;
+    vertex_t *old_CMPSrce, *old_CMPSink;
+    vertex_t *ctrl_vtx, *sink_vtx;
+    vertex_t *cmp_ctrl_vtx, *cmp_sink_vtx;
+    vertex_t *src, *sink;
+    vertex_t *cmp_src, *cmp_sink;
+
+    StpTRACE("Printing if_else_stmt\n");
+    ASSERT(stmt->type == IfElseStmt, "Unexpected IfElseStmt Type");
+
+    if (vl_currentFunction)
+
+	vl_encloseModule->syndrome_width++;
+    else {
+
+	if (!in_reset_stmt)
+	    vl_currentModule->syndrome_width++;
+	else
+	    vl_currentModule->rst_syndrome_width++;
+    }
+
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+	fg_new_ifelse_block(&old_Srce, &old_Sink, &ctrl_vtx, &sink_vtx,
+			    &old_CMPSrce,&old_CMPSink,
+			    &cmp_ctrl_vtx,&cmp_sink_vtx);
+	((fg_node_info*)ctrl_vtx->user_data)->data = (char*)stmt->cond;
+	stmt->cond->fg_info1 = (char*)ctrl_vtx;
+	stmt->cond->fg_info2 = (char*)sink_vtx;
+	fg_record_SrcSink(&src, &sink, &cmp_src, &cmp_sink);
+    }
+
+    vl_fprintf_stmt(file, "if (");
+    vl_step_expr(file, stmt->cond);
+    vl_fprintf_stmt(file, ")\n");
+
+
+    dataflow_dup_set();
+    step_flag_if = vl_step_stmt(file, stmt->if_stmt);
+    if_set = dataflow_pop_set();
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty())
+	stmt->cond->fg_aux1 = (char*)fg_closeloop();
+
+
+    if (stmt->else_stmt) {
+	vl_fprintf_stmt(file, "else\n");
+
+
+	if (!in_reset_stmt && vlPhase==1 && fg_not_empty())
+	    fg_restore_SrcSink(src, sink, cmp_src, cmp_sink);
+
+	dataflow_dup_set();
+	step_flag_else = vl_step_stmt(file, stmt->else_stmt);
+	else_set = dataflow_pop_set();
+
+	new_set = dataflow_merge_set(if_set, else_set);
+	dataflow_replace_set(new_set);
+
+
+	if (!in_reset_stmt && vlPhase==1 && fg_not_empty())
+	    stmt->cond->fg_aux2 = (char*)fg_closeloop();
+    } else {
+	if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+
+	    fg_restore_SrcSink(src, sink, cmp_src, cmp_sink);
+
+	    stmt->cond->fg_aux2 = (char*)fg_closeloop();
+	}
+    }
+
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+	fg_restore_SrcSink(src, sink, cmp_src, cmp_sink);
+	fg_reduce_simple_branches_back_block(old_Srce, old_Sink,
+					     old_CMPSrce, old_CMPSink);
+    }
+
+    return step_flag_if | step_flag_else;
+}
+
+int vl_step_case_stmt(FILE *file, vl_case_stmt *stmt)
+{
+    int step_flag = 0;
+    vertex_t *old_Srce, *old_Sink;
+    vertex_t *ctrl_vtx, *sink_vtx;
+    vertex_t *old_CMPSrce, *old_CMPSink;
+    vertex_t *ctrl_CMPvtx, *sink_CMPvtx;
+
+    StpTRACE("Printing case_stmt\n");
+
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+	fg_new_case_block(&old_Srce, &old_Sink, &ctrl_vtx, &sink_vtx,
+			  &old_CMPSrce, &old_CMPSink,
+			  &ctrl_CMPvtx, &sink_CMPvtx);
+	((fg_node_info*)ctrl_vtx->user_data)->data = (char*)stmt->cond;
+	stmt->cond->fg_info1 = (char*)ctrl_vtx;
+	stmt->cond->fg_info2 = (char*)sink_vtx;
+    }
+
+    switch(stmt->type) {
+    case CaseStmt:
+	vl_fprintf_stmt(file, "case (");	break;
+    case CasexStmt:
+	vl_fprintf_stmt(file, "casex (");	break;
+    case CasezStmt:
+	vl_fprintf_stmt(file, "casez (");	break;
+    default:
+	internal_error("Unexpected Case Type");	break;
+    }
+    vl_step_expr(file, stmt->cond);
+    vl_fprintf_stmt(file, ")\n");
+
+    {
+	vl_case_item *item;
+	lsHandle handle;
+	lsGen gen;
+	vertex_t *cur_src, *cur_sink;
+	vertex_t *cur_cmp_src, *cur_cmp_sink;
+	edge_t *ctrl_edge;
+
+	if (!in_reset_stmt && vlPhase==1 && fg_not_empty())
+	    fg_record_SrcSink(&cur_src, &cur_sink,
+			      &cur_cmp_src, &cur_cmp_sink);
+	gen = lsStart(stmt->case_items);
+	while(lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+
+	    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+		ctrl_edge = fg_new_case_tag_block(cur_src, cur_sink,
+						  cur_cmp_src, cur_cmp_sink);
+		((fg_arc_info*)ctrl_edge->user_data)->data = (char*)item;
+		item->fg_info = (char*)ctrl_edge;
+	    }
+
+	    dataflow_dup_set();
+	    step_flag |= vl_step_case_item(file, item);
+	    if (item->type != DefaultItem)
+		dataflow_free_set(dataflow_pop_set());
+	    else
+		dataflow_replace_set(dataflow_pop_set());
+
+
+	    fg_closeloop();
+	}
+	if (!in_reset_stmt && vlPhase==1 && fg_not_empty())
+	    fg_restore_SrcSink(cur_src, cur_sink, cur_cmp_src, cur_cmp_sink);
+    }
+    vl_fprintf_stmt(file, "endcase\n");
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty())
+	fg_reduce_simple_branches_back_block(old_Srce, old_Sink,
+					     old_CMPSrce, old_CMPSink);
+
+    return step_flag;
+}
+
+void vl_step_forever_stmt(FILE *file, vl_forever_stmt *stmt)
+{
+    StpTRACE("Printing forever_stmt\n");
+    ASSERT(stmt->type == ForeverStmt, "Unexpected ForeverStmt Type");
+
+    vl_fprintf_stmt(file, "forever\n");
+    vl_step_stmt(file, stmt->stmt);
+}
+
+void vl_step_repeat_stmt(FILE *file, vl_repeat_stmt *stmt)
+{
+    StpTRACE("Printing repeat_stmt\n");
+    ASSERT(stmt->type == RepeatStmt, "Unexpected RepeatStmt Type");
+
+    vl_fprintf_stmt(file, "repeat (");
+    vl_step_expr(file, stmt->count);
+    vl_fprintf_stmt(file, ")\n");
+    vl_step_stmt(file, stmt->stmt);
+}
+
+void vl_step_while_stmt(FILE *file, vl_while_stmt *stmt)
+{
+    vertex_t *old_src, *old_sink, *ctrl_vtx, *sink_vtx,
+	     *old_CMPsrc, *old_CMPsink, *cmp_ctrl_vtx, *cmp_sink_vtx;
+    vertex_t *src, *sink, *cmp_src, *cmp_sink;
+    int contain_pause;
+
+    StpTRACE("Printing while_stmt\n");
+    ASSERT(stmt->type == WhileStmt, "Unexpected WhileStmt Type");
+
+    if (!in_reset_stmt) vl_currentModule->syndrome_width++;
+
+
+    if (!in_reset_stmt &&vlPhase==1 && fg_not_empty()) {
+	fg_new_loop_block(&old_src, &old_sink, &ctrl_vtx, &sink_vtx,
+			 &old_CMPsrc, &old_CMPsink,
+			 &cmp_ctrl_vtx, &cmp_sink_vtx);
+	((fg_node_info*)ctrl_vtx->user_data)->data = (char*)stmt->cond;
+	stmt->cond->fg_info1 = (char*)ctrl_vtx;
+	stmt->cond->fg_info2 = (char*)sink_vtx;
+	fg_record_SrcSink(&src, &sink, &cmp_src, &cmp_sink);
+    }
+
+    vl_fprintf_stmt(file, "while (");
+    vl_step_expr(file, stmt->cond);
+    vl_fprintf_stmt(file, ")\n");
+    vl_step_stmt(file, stmt->stmt);
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+	fg_closeloop();
+	fg_restore_SrcSink(src, sink, cmp_src, cmp_sink);
+	contain_pause =
+	    fg_reduce_simple_branches_back_block(old_src, old_sink,
+						 old_CMPsrc, old_CMPsink);
+	if (!contain_pause) {
+	    char buf[MAXSTRLEN];
+	    yylineno = -1;
+	    sprintf(buf, "%s: there exist delay free for loop(s)",
+		    vl_currentModule->name->name);
+	    compile_error(buf);
+	}
+	fg_force_edge(sink_vtx, ctrl_vtx, cmp_sink_vtx, cmp_ctrl_vtx);
+	fg_restore_SrcSink(ctrl_vtx, old_sink, cmp_ctrl_vtx, old_CMPsink);
+    }
+}
+
+void vl_step_for_stmt(FILE *file, vl_for_stmt *stmt)
+{
+    vertex_t *old_src, *old_sink, *ctrl_vtx, *sink_vtx,
+	     *old_CMPsrc, *old_CMPsink, *cmp_ctrl_vtx, *cmp_sink_vtx;
+    vertex_t *src, *sink, *cmp_src, *cmp_sink;
+    int contain_pause;
+
+    StpTRACE("Printing for_stmt\n");
+    ASSERT(stmt->type == ForStmt, "Unexpected ForStmt Type");
+
+    if (!in_reset_stmt) vl_currentModule->syndrome_width++;
+
+    vl_fprintf_stmt(file, "for (");
+    vl_step_bassign_stmt(file, stmt->init);
+    vl_fprintf_stmt(file, "; ");
+
+
+    if (!in_reset_stmt &&vlPhase==1 && fg_not_empty()) {
+	fg_new_loop_block(&old_src, &old_sink, &ctrl_vtx, &sink_vtx,
+			 &old_CMPsrc, &old_CMPsink,
+			 &cmp_ctrl_vtx, &cmp_sink_vtx);
+	((fg_node_info*)ctrl_vtx->user_data)->data = (char*)stmt->cond;
+	stmt->cond->fg_info1 = (char*)ctrl_vtx;
+	stmt->cond->fg_info2 = (char*)sink_vtx;
+	fg_record_SrcSink(&src, &sink, &cmp_src, &cmp_sink);
+    }
+    vl_step_expr(file, stmt->cond);
+    vl_fprintf_stmt(file, "; ");
+
+    vl_step_bassign_stmt(file, stmt->end);
+    vl_fprintf_stmt(file, ")\n");
+    vl_step_stmt(file, stmt->stmt);
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+	fg_closeloop();
+	fg_restore_SrcSink(src, sink, cmp_src, cmp_sink);
+	contain_pause =
+	    fg_reduce_simple_branches_back_block(old_src, old_sink,
+						 old_CMPsrc, old_CMPsink);
+	if (!contain_pause) {
+	    char buf[MAXSTRLEN];
+	    yylineno = -1;
+	    sprintf(buf, "%s: there exist delay free for loop(s)",
+		    vl_currentModule->name->name);
+	    compile_error(buf);
+	}
+	fg_force_edge(sink_vtx, ctrl_vtx, cmp_sink_vtx, cmp_ctrl_vtx);
+	fg_restore_SrcSink(ctrl_vtx, old_sink, cmp_ctrl_vtx, old_CMPsink);
+    }
+}
+
+void vl_step_delay_control_stmt(FILE *file, vl_delay_control_stmt *stmt)
+{
+    vertex_t *pause_node;
+
+    StpTRACE("Printing delay_control_stmt\n");
+    ASSERT(stmt->type == DelayControlStmt, "Unexpected DelayControlStmt Type");
+
+    if (implicitClocking && !vlTimedSystem) {
+
+	char buf[MAXSTRLEN];
+	yylineno = -1;
+	if (vl_currentModule)
+	    sprintf(buf, "%s: 'always'-statement contains delay which contradicts with implicit clocking",
+		    vl_currentModule->name->name);
+	else
+	    sprintf(buf, "delay(s) in implicit clocking");
+	compile_error(buf);
+    }
+
+    vl_step_delay(file, stmt->delay);
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+	pause_node = fg_new_pause_node();
+	((fg_node_info*)pause_node->user_data)->data = (char*)stmt;
+	stmt->fg_info = (char*)pause_node;
+    }
+
+    vl_step_stmt(file, stmt->stmt);
+}
+
+int vl_step_event_control_stmt(FILE *file, vl_event_control_stmt *stmt)
+{
+    int step_flag = 0;
+    vertex_t *pause_node;
+
+    StpTRACE("Printing event_control_stmt\n");
+    ASSERT(stmt->type == EventControlStmt, "Unexpected EventControlStmt Type");
+
+    vl_fprintf_stmt(file, "@(");
+    step_flag = vl_step_event_expr(file, stmt->event);
+    vl_fprintf_stmt(file, ")");
+
+
+    if (!in_reset_stmt && vlPhase==1 && fg_not_empty()) {
+	pause_node = fg_new_pause_node();
+	((fg_node_info*)pause_node->user_data)->data = (char*)stmt;
+	stmt->fg_info = (char*)pause_node;
+    }
+
+    vl_step_stmt(file, stmt->stmt);
+
+    return step_flag;
+}
+
+
+int vl_step_bassign_stmt(FILE *file, vl_bassign_stmt *bassign)
+{
+    int step_flag = 0;
+    vertex_t *assign_vtx;
+
+    StpTRACE("Printing bassign_stmt\n");
+
+
+    if (!in_reset_stmt && vlPhase == 1 && fg_not_empty()) {
+	assign_vtx = fg_new_assign_node();
+	bassign->fg_info = (char*)assign_vtx;
+    }
+
+    if (bassign->type == AssignStmt) {
+	vl_fprintf_stmt(file, "assign ");
+    }
+
+    lhs_id = 1;
+    vl_step_lval(file, bassign->lhs);
+    lhs_id = 0;
+
+    switch(bassign->type) {
+    case AssignStmt:
+    case BassignStmt:
+	vl_fprintf_stmt(file, " = ");
+	break;
+    case NbassignStmt:
+	vl_fprintf_stmt(file, " <= ");
+	collect_latch(bassign->lhs->name->name);
+	break;
+    case DelayBassignStmt:
+	vl_fprintf_stmt(file, " = ");
+	vl_step_delay(file, (vl_delay *)bassign->control);
+	break;
+    case DelayNbassignStmt:
+	vl_fprintf_stmt(file, " <= ");
+	vl_step_delay(file, (vl_delay *)bassign->control);
+	collect_latch(bassign->lhs->name->name);
+	break;
+    case EventBassignStmt:
+	vl_fprintf_stmt(file, " = @(");
+	step_flag =
+	    vl_step_event_expr(file, (vl_event_expr *)bassign->control);
+	vl_fprintf_stmt(file, ")");
+	break;
+    case EventNbassignStmt:
+	vl_fprintf_stmt(file, " <= @(");
+	step_flag =
+	    vl_step_event_expr(file, (vl_event_expr *)bassign->control);
+	vl_fprintf_stmt(file, ")");
+	collect_latch(bassign->lhs->name->name);
+	break;
+    default:
+	internal_error("Unexpected Assign Type");	break;
+    }
+    vl_step_expr(file, bassign->rhs);
+
+    return step_flag;
+}
+
+void vl_step_wait_stmt(FILE *file, vl_wait_stmt *stmt)
+{
+   vl_begin_end_stmt *faked_stmt;
+
+    StpTRACE("Printing wait_stmt\n");
+    ASSERT(stmt->type == WaitStmt, "Unexpected WaitStmt Type");
+
+    faked_stmt = vl_fake_wait_stmt(file, stmt);
+    vl_fprintf_stmt(file, "wait (");
+    vl_step_expr(file, stmt->cond);
+    vl_fprintf_stmt(file, ")\n");
+    vl_step_stmt(file, stmt->stmt);
+    stmt->stmt = faked_stmt;
+    stmt->cond = NIL(vl_expr);
+}
+
+void vl_step_fork_join_stmt(FILE *file, vl_fork_join_stmt *stmt)
+{
+
+    StpTRACE("Printing fork_join_stmt\n");
+    ASSERT(stmt->type == ForkJoinStmt, "Unexpected ForkJoinStmt Type");
+
+    vl_fprintf_stmt(file, "fork\n");
+    vl_step_decl_list(file, stmt->decls);
+    vl_step_stmt_list(file, stmt->stmts);
+    vl_fprintf_stmt(file, "join\n");
+}
+
+
+void vl_step_task_enable_stmt(FILE *file, vl_task_enable_stmt *stmt)
+{
+    vl_task *task_dfn;
+    lsGen stmtgen;
+    lsHandle stmthandle;
+    lsList unrolled_stmt;
+    void *task_stmt;
+    void *new_stmt;
+
+    StpTRACE("Printing task_enable_stmt\n");
+    ASSERT(((stmt->type == TaskEnableStmt) ||
+	    (stmt->type == SysTaskEnableStmt)),
+	   "Unexpected TaskEnableStmt Type");
+
+    vl_step_id_range(file, stmt->name);
+    if (!st_lookup(vl_currentModule->task_st, stmt->name->name,
+		   (char**)&task_dfn)) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "Undefined task/function '%s'", stmt->name->name);
+	yylineno = -1;
+	compile_error(buf);
+    }
+    if (stmt->args) {
+	vl_fprintf_stmt(file, " (");
+	vl_step_expr_list(file, stmt->args);
+	vl_fprintf_stmt(file, " )");
+
+
+	assoc_formal_actual(task_dfn, task_dfn->io_lst, stmt->args);
+    }
+
+
+    aliasStack[aliasSP++] = task_dfn->sig_st;
+    unrolled_stmt = lsCreate();
+    for (stmtgen = lsStart(task_dfn->stmts);
+	 lsNext(stmtgen, (lsGeneric*)&task_stmt, &stmthandle) != LS_NOMORE; ) {
+	new_stmt = vl_copy_stmt(task_stmt);
+	lsNewEnd(unrolled_stmt, (lsGeneric)new_stmt, 0);
+	vl_step_stmt(file, new_stmt);
+    }
+    lsFinish(stmtgen);
+    aliasSP--;
+    ((vl_begin_end_stmt*)stmt)->type  = BeginEndStmt;
+    ((vl_begin_end_stmt*)stmt)->flags = 0;
+    ((vl_begin_end_stmt*)stmt)->name  = NIL(vl_id_range);
+    ((vl_begin_end_stmt*)stmt)->decls = NIL(void);
+    ((vl_begin_end_stmt*)stmt)->sig_st= NIL(st_table);
+    ((vl_begin_end_stmt*)stmt)->stmts = unrolled_stmt;
+
+    vl_fprintf_stmt(file, ";\n");
+}
+
+void vl_step_disable_stmt(FILE *file, vl_disable_stmt *stmt)
+{
+    StpTRACE("Printing disable_stmt\n");
+    ASSERT(stmt->type == DisableStmt, "Unexpected DisableStmt Type");
+
+    vl_fprintf_stmt(file, "disable ");
+    vl_step_id_range(file, stmt->name);
+    vl_fprintf_stmt(file, ";\n");
+}
+
+void vl_step_deassign_stmt(FILE *file, vl_deassign_stmt *stmt)
+{
+    StpTRACE("Printing deassign_stmt\n");
+    ASSERT(stmt->type == DeassignStmt, "Unexpected DeassignStmt Type");
+
+    if (!in_reset_stmt && vlPhase == 1 && fg_not_empty()) {
+	vertex_t *assign_vtx;
+	assign_vtx = fg_new_assign_node();
+	stmt->fg_info = (char*)assign_vtx;
+    }
+
+    vl_fprintf_stmt(file, "deassign ");
+    vl_step_lval(file, stmt->lhs);
+    vl_fprintf_stmt(file, ";\n");
+}
+
+int vl_step_case_item(FILE *file, vl_case_item *item)
+{
+    int step_flag = 0;
+
+    StpTRACE("Printing case_item\n");
+    switch(item->type) {
+    case CaseItem:
+	if (vl_currentFunction)
+
+	    vl_encloseModule->syndrome_width++;
+	else {
+
+	    if (!in_reset_stmt)
+		vl_currentModule->syndrome_width++;
+	    else
+		vl_currentModule->rst_syndrome_width++;
+	}
+	vl_expand_Q(file, item->exprs);
+	vl_step_expr_list(file, item->exprs);
+	vl_fprintf_stmt(file, ": ");
+	break;
+    case DefaultItem:
+	vl_fprintf_stmt(file, "default: ");
+	break;
+    default:
+	internal_error("Unexpected CaseItem Type");
+	break;
+    }
+    step_flag = vl_step_stmt(file, item->stmt);
+
+    return step_flag;
+}
+
+int vl_step_event_expr(FILE *file, vl_event_expr *event)
+{
+    int step_flag = 0;
+
+    StpTRACE("Printing event_expr\n");
+    if (event == NIL(vl_event_expr)) return 0;
+    switch(event->type) {
+    case OrEventExpr:  {
+	vl_event_expr *e;
+	lsHandle handle;
+	lsGen gen;
+
+	gen = lsStart(event->list);
+	if (lsNext(gen, (lsGeneric*)&e, &handle) == LS_OK) {
+	    vl_step_event_expr(file, e);
+	    while(lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE) {
+		vl_fprintf_stmt(file, " or ");
+		vl_step_event_expr(file, e);
+	    }
+	}
+	(void) lsFinish(gen);
+
+	return step_flag;
+    }
+    case NegedgeEventExpr:
+	vl_fprintf_stmt(file, "negedge ");
+	record_program_location(vl_currentProcStmt);
+	step_flag = SYNCHRONIZED;
+	vl_step_expr(file, event->expr);
+	register_clock(file, event);
+	break;
+    case PosedgeEventExpr:
+	vl_fprintf_stmt(file, "posedge ");
+	if (vl_currentProcStmt)	record_program_location(vl_currentProcStmt);
+	step_flag = SYNCHRONIZED;
+	vl_step_expr(file, event->expr);
+	if (vl_currentProcStmt) register_clock(file, event);
+	break;
+    case EdgeEventExpr:
+	vl_fprintf_stmt(file, "edge ");
+	record_program_location(vl_currentProcStmt);
+	step_flag = SYNCHRONIZED;
+	vl_step_expr(file, event->expr);
+	register_clock(file, event);
+	break;
+    case EventExpr:
+	vl_step_expr(file, event->expr);
+	break;
+    default:
+	internal_error("Unexpected EventExpr Type");
+	break;
+    }
+
+    return step_flag;
+}
+
+void vl_step_lval(FILE *file, vl_lval *lval)
+{
+    StpTRACE("Printing lval\n");
+
+    switch(lval->type) {
+    case IDExpr:
+	vl_step_id_range(file, lval->name);
+	break;
+    case BitSelExpr:
+    case PartSelExpr:
+	vl_step_id_range(file, lval->name);
+	vl_step_range(file, lval->range);
+	break;
+    case ConcatExpr: {
+	vl_expr *e;
+	lsHandle handle;
+	lsGen gen;
+
+	vl_fprintf_stmt(file, "{");
+	gen = lsStart(lval->concat);
+	if (lsNext(gen, (lsGeneric*)&e, &handle) == LS_OK) {
+	    vl_step_expr(file, e);
+	    while(lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE) {
+		vl_fprintf_stmt(file, ", ");
+		vl_step_expr(file, e);
+	    }
+	}
+	vl_fprintf_stmt(file, "}");
+	(void) lsFinish(gen);
+
+	break;
+    }
+    default:
+	internal_error("Unexpected Lval Type");
+	break;
+    }
+}
+
+void vl_step_expr(FILE *file, vl_expr *expr)
+{
+    vl_id_range *id_sym;
+
+    if (!expr) return;
+    StpTRACE("Printing expr\n");
+    switch (expr->type) {
+    case BitExpr:
+	vl_fprintf_stmt(file, "'b%s", expr->u.exprs.e3);
+	break;
+    case IntExpr:
+	vl_fprintf_stmt(file, "%d", expr->u.intval);
+	break;
+    case RealExpr:
+	vl_fprintf_stmt(file, "%f", expr->u.realval);
+	break;
+    case IDExpr:
+
+	if (!vl_currentPrimitive && !vl_currentFunction)
+	    if (vl_currentModule->param_st)
+		if (st_lookup(vl_currentModule->param_st, expr->u.name->name,
+			      (char**)&id_sym)) {
+		    vl_free_id(expr->u.name);
+
+		    expr->type = IntExpr;
+		    expr->u.intval = (int)(id_sym->mpg_master_exp);
+		    vl_fprintf_stmt(file, "%d", expr->u.intval);
+
+		    break;
+		}
+
+	vl_step_id_range(file, expr->u.name);
+	break;
+    case BitSelExpr:    case PartSelExpr:
+	vl_step_id_range(file, expr->u.idrng);
+	break;
+    case ConcatExpr: {
+
+	vl_expr *e;
+	lsHandle handle;
+	lsGen gen;
+
+	vl_fprintf_stmt(file, "{");
+	gen = lsStart((lsList)(expr->u.exprs.e1));
+	if (lsNext(gen, (lsGeneric*)&e, &handle) == LS_OK) {
+	    vl_step_expr(file, e);
+	    while(lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE) {
+		vl_fprintf_stmt(file, ", ");
+		vl_step_expr(file, e);
+	    }
+	}
+	vl_fprintf_stmt(file, "}");
+	(void) lsFinish(gen);
+	break;
+    }
+    case MinTypMaxExpr: {
+
+	vl_fprintf_stmt(file, "(");
+	vl_step_expr(file, expr->u.exprs.e1);
+	if (expr->u.exprs.e2) {
+	    vl_fprintf_stmt(file, ":");
+	    vl_step_expr(file, expr->u.exprs.e2);
+	}
+	if (expr->u.exprs.e3) {
+	    vl_fprintf_stmt(file, ":");
+	    vl_step_expr(file, expr->u.exprs.e3);
+	}
+	vl_fprintf_stmt(file, ")");
+	break;
+    }
+    case StringExpr:
+	vl_fprintf_stmt(file, "%s", expr->u.string);
+	break;
+    case FuncExpr:
+	vl_step_id_range(file, expr->u.func_call.name);
+	if (expr->u.func_call.args) {
+	    vl_fprintf_stmt(file, " (");
+	    vl_step_expr_list(file, expr->u.func_call.args);
+	    vl_fprintf_stmt(file, ") ");
+	}
+	break;
+    case UplusExpr:    case UminusExpr:
+    case UnotExpr:    case UcomplExpr:
+
+    case UandExpr:    case UnandExpr:
+    case UorExpr:    case UnorExpr:
+    case UxorExpr:    case UxnorExpr:
+	vl_fprintf_stmt(file, "%s", vl_get_expr_op(expr->type));
+	vl_step_expr(file, expr->u.exprs.e1);
+	break;
+
+    case BplusExpr:    case BminusExpr:
+    case BtimesExpr:    case BdivExpr:
+    case BremExpr:    case Beq2Expr:
+    case Bneq2Expr:    case Beq3Expr:
+    case Bneq3Expr:    case BlandExpr:
+    case BlorExpr:    case BltExpr:
+    case BleExpr:   case BgtExpr:
+    case BgeExpr:    case BandExpr:
+    case BorExpr:    case BxorExpr:
+    case BxnorExpr:    case BlshiftExpr:
+    case BrshiftExpr:
+	vl_step_expr(file, expr->u.exprs.e1);
+	vl_fprintf_stmt(file, " %s ", vl_get_expr_op(expr->type));
+	vl_step_expr(file, expr->u.exprs.e2);
+	break;
+
+    case TcondExpr:
+	vl_step_expr(file, expr->u.exprs.e1);
+	vl_fprintf_stmt(file, " ? ");
+	vl_step_expr(file, expr->u.exprs.e2);
+	vl_fprintf_stmt(file, " : ");
+	vl_step_expr(file, expr->u.exprs.e3);
+	break;
+    case NondExpr:
+	vl_fprintf_stmt(file, "$ND ( ");
+	vl_step_expr_list(file, expr->u.expr_list);
+	vl_fprintf_stmt(file, " ) ");
+	break;
+    }
+}
+
+
+void vl_step_expr_list(FILE *file, lsList exprs)
+{
+    void *expr;
+    lsHandle handle;
+    lsGen gen;
+
+    StpTRACE("Printing Expression List\n");
+    if (lsLength(exprs) <= 0) return;
+    gen = lsStart(exprs);
+    if (lsNext(gen, (lsGeneric*)&expr, &handle) == LS_OK) {
+	vl_step_expr(file, expr);
+	while(lsNext(gen, (lsGeneric*)&expr, &handle) != LS_NOMORE) {
+	    vl_fprintf_stmt(file, ",");
+	    vl_step_expr(file, expr);
+	}
+    }
+    (void) lsFinish(gen);
+
+}
+
+void vl_step_range(FILE *file, vl_range *range)
+{
+    StpTRACE("Printing range\n");
+
+    if (range == NIL(vl_range) ||
+	(range->left == NIL(vl_expr) && range->right == NIL(vl_expr))) return;
+    vl_fprintf_stmt(file, "[");
+    vl_step_expr(file, range->left);
+    if (range->right) {
+	vl_fprintf_stmt(file, " : ");
+	vl_step_expr(file, range->right);
+    }
+    vl_fprintf_stmt(file, "]");
+}
+
+
+void vl_step_delay(FILE *file, vl_delay *delay)
+{
+    StpTRACE("Printing delay\n");
+    if (delay == NIL(vl_delay)) return;
+    vl_fprintf_stmt(file, " #(");
+    vl_step_expr(file, delay->delay1);
+    if (delay->delay2) {
+	vl_fprintf_stmt(file, ", ");
+	vl_step_expr(file, delay->delay2);
+	if (delay->delay3) {
+	    vl_fprintf_stmt(file, ", ");
+	    vl_step_expr(file, delay->delay3);
+	}
+    }
+    vl_fprintf_stmt(file, ") ");
+}
+
+
+void vl_step_id_range(FILE *file, vl_id_range *id_range)
+{
+    StpTRACE("Printing id[range]\n");
+
+    if (id_range == NIL(vl_id_range)) return;
+
+    vl_fprintf_stmt(file, "%s ", id_range->name);
+    if (id_range->range != NIL(vl_range))
+	vl_step_range(file, id_range->range);
+
+
+
+    if (dflow_analysis) {
+	dataflow_analysis(dflow_analysis, id_range, !lhs_id, lhs_id);
+    }
+}
+
+
+void vl_step_id_list(FILE *file, lsList ids)
+{
+    vl_id_range *id;
+    lsHandle handle;
+    lsGen gen;
+
+    gen = lsStart(ids);
+    if (lsNext(gen, (lsGeneric*)&id, &handle) == LS_OK) {
+	vl_step_id_range(file, id);
+	while(lsNext(gen, (lsGeneric*)&id, &handle) != LS_NOMORE) {
+	    vl_fprintf_stmt(file, ", ");
+	    vl_step_id_range(file, id);
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+
+void vl_step_id_range_list(FILE *file, lsList ids)
+{
+    vl_id_range *id;
+    lsHandle handle;
+    lsGen gen;
+
+    if (ids == (lsList)0) return;
+    gen = lsStart(ids);
+    if (lsNext(gen, (lsGeneric*)&id, &handle) == LS_OK) {
+	vl_step_id_range(file, id);
+	while(lsNext(gen, (lsGeneric*)&id, &handle) != LS_NOMORE) {
+	    vl_fprintf_stmt(file, ", ");
+	    vl_step_id_range(file, id);
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+
+void vl_step_net_list(FILE *file, lsList nets)
+{
+    void *net;
+    lsHandle handle;
+    lsGen gen;
+
+    gen = lsStart(nets);
+    if (lsNext(gen, (lsGeneric*)&net, &handle) == LS_OK) {
+	vl_step_net(file, net);
+	while(lsNext(gen, (lsGeneric*)&net, &handle) != LS_NOMORE) {
+	    vl_fprintf_stmt(file, ", ");
+	    vl_step_net(file, net);
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+
+void vl_step_net(FILE *file, void *net)
+{
+    switch(((vl_expr *)net)->type) {
+    case BassignStmt:
+	vl_step_bassign_stmt(file, net);	   break;
+    case NbassignStmt: {
+	char buf[MAXSTRLEN];
+	yylineno = ((vl_bassign_stmt*)net)->lineno;
+	sprintf(buf, ":%s: invalid continuous assignment",
+		vl_currentModule->name->name);
+	compile_error(buf);
+	break;
+    }
+    case IDExpr:
+	vl_step_expr(file, net);	           break;
+    default:
+	vl_step_id_range(file, (vl_id_range*)net); break;
+    }
+}
+
+
+void vl_step_ports (FILE *file, lsList ports)
+{
+    void *item;
+    lsHandle handle;
+    lsGen gen;
+
+    vl_fprintf_stmt(file, "(");
+
+    if (ports != (lsList)0) {
+	gen = lsStart(ports);
+	if (lsNext(gen, (lsGeneric*)&item, &handle) == LS_OK) {
+	    vl_step_port(file, item);
+	    while (lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+		vl_fprintf_stmt(file, ",");
+		vl_step_port(file, item);
+	    }
+	}
+	(void) lsFinish(gen);
+    }
+    vl_fprintf_stmt(file, ")");
+}
+
+void vl_step_port(FILE *file, vl_portPtr port)
+{
+    if (port->type == NamedPort) {
+	vl_fprintf_stmt(file, ".");
+	vl_step_id_range(file, port->id);
+	vl_fprintf_stmt(file, "(");
+    }
+
+    vl_step_id_range_list(file, port->port_exp);
+
+    if (port->type == NamedPort) {
+	vl_fprintf_stmt(file, ")");
+    }
+}
+
+
+void vl_step_connects (FILE *file, lsList connects)
+{
+    void *item;
+    lsHandle handle;
+    lsGen gen;
+
+
+    if (connects != (lsList)0) {
+	gen = lsStart(connects);
+	if (lsNext(gen, (lsGeneric*)&item, &handle) == LS_OK) {
+	    vl_step_port_connect(file, (vl_port_connectPtr)item);
+	    while (lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+		vl_fprintf_stmt(file, ",");
+		vl_step_port_connect(file, (vl_port_connectPtr)item);
+	    }
+	}
+	(void) lsFinish(gen);
+    }
+}
+
+void vl_step_port_connect(FILE *file, vl_port_connectPtr connect)
+{
+    if (connect->type == NamedConnect) {
+	vl_fprintf_stmt(file, ".");
+	vl_step_id_range(file, connect->id);
+	vl_fprintf_stmt(file, "(");
+    }
+
+    vl_step_expr(file, connect->expr);
+
+    if (connect->type == NamedConnect) {
+	vl_fprintf_stmt(file, ")");
+    }
+}
+
+
+void vl_step_mod_item_list (FILE *file, lsList mitems)
+{
+    void *item;
+    lsHandle handle;
+    lsGen gen;
+
+    StpTRACE("Printing Module Items\n");
+    if (mitems != (lsList)0) {
+	gen = lsStart(mitems);
+	if (lsNext(gen, (lsGeneric*)&item, &handle) == LS_OK) {
+	    vl_step_mod_item(file, item);
+	    while(lsNext(gen, (lsGeneric*)&item, &handle) != LS_NOMORE) {
+		vl_step_mod_item(file, item);
+	    }
+	}
+	(void) lsFinish(gen);
+    }
+}
+
+
+void vl_step_mod_item(FILE *file, void *item)
+{
+    switch(((vl_decl *)item)->type) {
+
+    case RealDecl:	case EventDecl:
+	vl_step_basicdecl(file, (vl_decl *)item);
+	break;
+
+    case IntDecl:	case TimeDecl:
+	vl_step_basicdecl(file, (vl_decl *)item);
+	break;
+
+    case InputDecl:	case OutputDecl:
+    case InoutDecl:	case RegDecl:
+	vl_step_rangedecl(file, (vl_rangedecl *)item);
+	break;
+
+    case ParamDecl:	case DefparamDecl:
+	vl_step_paramdecl(file, (vl_paramdecl *)item);
+	break;
+
+    case WireDecl:	case TriDecl:
+    case Tri0Decl:	case Tri1Decl:
+    case Supply0Decl:	case Supply1Decl:
+    case WandDecl:	case TriandDecl:
+    case WorDecl:	case TriorDecl:
+    case TriregDecl:
+	vl_step_netdecl(file, (vl_netdecl *)item);
+	break;
+
+    case ContAssign:
+	vl_step_cont_assign(file, (vl_cont_assign *)item);
+	break;
+
+    case TaskDecl:
+	vl_step_task(file, (vl_task *)item);
+	break;
+
+    case IntFuncDecl:	case RealFuncDecl:
+    case RangeFuncDecl:
+	vl_step_function(file, (vl_function *)item);
+	break;
+
+    case AndGate:	case NandGate:
+    case OrGate:	case NorGate:
+    case XorGate:	case XnorGate:
+    case BufGate:	case Bufif0Gate:
+    case Bufif1Gate:	case NotGate:
+    case Notif0Gate:	case Notif1Gate:
+    case PulldownGate:	case PullupGate:
+    case NmosGate:	case RnmosGate:
+    case PmosGate:	case RpmosGate:
+    case CmosGate:	case RcmosGate:
+    case TranGate:	case RtranGate:
+    case Tranif0Gate:	case Rtranif0Gate:
+    case Tranif1Gate:	case Rtranif1Gate:
+	vl_step_gate_inst_list(file, (vl_gate_inst_list *)item);
+	break;
+
+    case TeslaTimerGate:
+
+	break;
+
+    case ModInst: {
+	char *mp;
+
+	if (st_lookup(vl_description->mp_st,
+		       ((vl_mod_prim_inst_list *)item)->name->name,
+		       &mp)) {
+	    if (((typestructPtr)mp)->type == CombPrimDecl ||
+		((typestructPtr)mp)->type == SeqPrimDecl)
+		goto step_prim_inst;
+	}
+	}
+
+	vl_step_mod_inst_list(file, (vl_mod_prim_inst_list *)item);
+	break;
+
+step_prim_inst:
+
+    case PrimInst:
+	vl_step_prim_inst_list(file, (vl_mod_prim_inst_list *)item);
+	break;
+
+    case AlwaysStmt:
+    case InitialStmt:
+	vl_step_procstmt(file, (vl_procstmt *)item);
+	break;
+
+    default:
+	internal_error("Unexpected Module Item");
+	break;
+    }
+}
+
+
+void vl_step_decl_list (FILE *file, void *decls)
+{
+    void *decl;
+    lsHandle handle;
+    lsGen gen;
+
+    StpTRACE("Printing Decls\n");
+    if (decls == NIL(void)) return;
+    gen = lsStart(decls);
+    if (lsNext(gen, (lsGeneric*)&decl, &handle) == LS_OK) {
+	vl_step_decl(file, decl);
+	while(lsNext(gen, (lsGeneric*)&decl, &handle) != LS_NOMORE) {
+	    vl_step_decl(file, decl);
+	}
+    }
+    (void) lsFinish(gen);
+
+}
+
+int vl_step_stmt_list (FILE *file, void *stmts)
+{
+    void *stmt;
+    lsHandle handle;
+    lsGen gen;
+    int step_flag=0;
+
+    StpTRACE("Printing Statements\n");
+    gen = lsStart(stmts);
+    if (lsNext(gen, (lsGeneric*)&stmt, &handle) == LS_OK) {
+	step_flag = vl_step_stmt(file, stmt);
+	while(lsNext(gen, (lsGeneric*)&stmt, &handle) != LS_NOMORE) {
+	    step_flag |= vl_step_stmt(file, stmt);
+	}
+    }
+    (void) lsFinish(gen);
+
+    return step_flag;
+}
+
+void vl_step_strength (FILE *file, int s)
+{
+    vl_fprintf_stmt(file, "%s", vl_get_strength(s));
+}
+
+
+void vl_step_gate (FILE *file, vl_gate_inst *gate)
+{
+    vl_step_id_range(file, gate->name);
+    vl_fprintf_stmt(file, "(");
+    vl_step_expr_list(file, gate->terms);
+    vl_fprintf_stmt(file, ")");
+}
+
+void vl_step_prim (FILE *file, vl_mod_prim_inst *prim)
+{
+    vl_step_id_range(file, prim->name);
+    vl_fprintf_stmt(file, "(");
+    vl_step_expr_list(file, prim->ports);
+    vl_fprintf_stmt(file, ")");
+}
+
+void vl_step_param_vals (FILE *file, lsList param_vals)
+{
+    if (param_vals == (lsList)0) return;
+
+    vl_fprintf_stmt(file, "#(");
+    if (!((vl_delay*)param_vals)->delay1 &&
+	!((vl_delay*)param_vals)->delay2 &&
+	 ((vl_delay*)param_vals)->delay3)
+	vl_step_expr_list(file, (lsList)((vl_delay*)param_vals)->delay3);
+    else if ( ((vl_delay*)param_vals)->delay1 &&
+	     !((vl_delay*)param_vals)->delay2)
+	vl_step_expr(file, ((vl_delay*)param_vals)->delay1);
+    vl_fprintf_stmt(file, ")");
+}
+
+void vl_step_modinst (FILE *file, vl_mod_prim_inst *mod)
+{
+    vl_step_id_range(file, mod->name);
+
+    vl_fprintf_stmt(file, " (");
+    vl_step_connects(file, mod->ports);
+    vl_fprintf_stmt(file, ") ");
+}
+
+int vl_step_stmt (FILE *file, void *stmt)
+{
+    int step_flag=0;
+
+
+    if (stmt == NIL(void)) {
+	vl_fprintf_stmt(file, ";\n");
+	return step_flag;
+    }
+
+    switch(((vl_bassign_stmt *)stmt)->type) {
+    case BeginEndStmt:
+	step_flag = vl_step_begin_end_stmt(file, (vl_begin_end_stmt *)stmt);
+	break;
+    case IfElseStmt:
+	step_flag = vl_step_if_else_stmt(file, (vl_if_else_stmt *)stmt);
+	break;
+    case CaseStmt:
+    case CasexStmt:
+    case CasezStmt:
+	step_flag = vl_step_case_stmt(file, (vl_case_stmt *)stmt);
+	break;
+    case CaseItem:
+	step_flag = vl_step_stmt(file, ((vl_case_item *)stmt)->stmt);
+	break;
+    case DefaultItem:
+	step_flag = vl_step_stmt(file, ((vl_case_item *)stmt)->stmt);
+	break;
+    case ForeverStmt:
+	vl_step_forever_stmt(file, (vl_forever_stmt *)stmt);
+	break;
+    case RepeatStmt:
+	if (!Repeat_Unrolling) {
+	    vl_step_repeat_stmt(file, (vl_repeat_stmt *)stmt);
+	} else {
+	    int i, up_bnd;
+	    lsList unrolled_stmt;
+	    void *new_stmt;
+
+	    unrolled_stmt = lsCreate();
+	    up_bnd = vl_eval_expr(((vl_repeat_stmt*)stmt)->count);
+	    for (i=0; i<up_bnd; i++) {
+		new_stmt = (void*)vl_copy_stmt(((vl_repeat_stmt*)stmt)->stmt);
+		lsNewEnd(unrolled_stmt, (lsGeneric)new_stmt, 0);
+		vl_step_stmt(file, new_stmt);
+	    }
+	    ((vl_begin_end_stmt*)stmt)->type  = BeginEndStmt;
+	    ((vl_begin_end_stmt*)stmt)->flags = 0;
+	    ((vl_begin_end_stmt*)stmt)->name  = NIL(vl_id_range);
+	    ((vl_begin_end_stmt*)stmt)->decls = NIL(void);
+	    ((vl_begin_end_stmt*)stmt)->sig_st= NIL(st_table);
+	    ((vl_begin_end_stmt*)stmt)->stmts = unrolled_stmt;
+	}
+	break;
+    case WhileStmt:
+	vl_step_while_stmt(file, (vl_while_stmt *)stmt);
+	break;
+    case ForStmt:
+	if (!Loop_Unrolling) {
+	    vl_step_for_stmt(file, (vl_for_stmt *)stmt);
+	} else {
+	    vl_id_range *idx;
+	    char *name, *val;
+	    lsList unrolled_stmt;
+	    void *new_stmt;
+	    vl_expr *ival;
+	    vl_lval *idx_lhs;
+	    vl_bassign_stmt *assign_idx=NULL;
+
+	    idx = ((vl_for_stmt*)stmt)->init->lhs->name;
+	    st_insert(vl_currentModule->param_st, idx->name, (char*)idx);
+	    unrolled_stmt = lsCreate();
+
+	    for (idx->mpg_master_exp =
+		     (void*)vl_eval_expr(((vl_for_stmt*)stmt)->init->rhs);
+		 vl_eval_expr(((vl_for_stmt*)stmt)->cond);
+		 idx->mpg_master_exp =
+		     (void*)vl_eval_expr(((vl_for_stmt*)stmt)->end->rhs)) {
+		idx_lhs = vl_create_lval(IDExpr, vl_copy_id_range(idx),
+					 NIL(vl_range),(lsList)0);
+		ival = vl_create_expr(IntExpr, (int)idx->mpg_master_exp,
+				      (double)0.0,
+				      NIL(vl_expr),NIL(vl_expr),NIL(vl_expr));
+
+		new_stmt = (void*)vl_copy_stmt(((vl_for_stmt*)stmt)->stmt);
+		if (indexAssignment) {
+		    assign_idx = vl_create_bassign_stmt(BassignStmt, idx_lhs,
+							NIL(void), ival);
+		    lsNewEnd(unrolled_stmt, (lsGeneric)assign_idx, 0);
+		}
+		lsNewEnd(unrolled_stmt, (lsGeneric)new_stmt, 0);
+		if (indexAssignment)
+		    vl_step_stmt(file, assign_idx);
+		vl_step_stmt(file, new_stmt);
+	    }
+
+	    ((vl_begin_end_stmt*)stmt)->type  = BeginEndStmt;
+	    ((vl_begin_end_stmt*)stmt)->flags = 0;
+	    ((vl_begin_end_stmt*)stmt)->name  = NIL(vl_id_range);
+	    ((vl_begin_end_stmt*)stmt)->decls = NIL(void);
+	    ((vl_begin_end_stmt*)stmt)->sig_st= NIL(st_table);
+	    ((vl_begin_end_stmt*)stmt)->stmts = unrolled_stmt;
+
+	    name = idx->name;
+	    st_delete(vl_currentModule->param_st, &name, &val);
+	}
+	break;
+    case DelayControlStmt:
+	vl_step_delay_control_stmt(file, (vl_delay_control_stmt *)stmt);
+	break;
+    case EventControlStmt:
+	step_flag = vl_step_event_control_stmt(file,
+					       (vl_event_control_stmt *)stmt);
+	break;
+    case AssignStmt:
+    case BassignStmt:
+    case NbassignStmt:
+    case DelayBassignStmt:
+    case DelayNbassignStmt:
+    case EventBassignStmt:
+    case EventNbassignStmt:
+	step_flag = vl_step_bassign_stmt(file, (vl_bassign_stmt *)stmt);
+	vl_fprintf_stmt(file, ";\n");
+	break;
+    case WaitStmt:
+	vl_step_wait_stmt(file, (vl_wait_stmt *)stmt);
+	break;
+    case ForkJoinStmt:
+	vl_step_fork_join_stmt(file, (vl_fork_join_stmt *)stmt);
+	break;
+    case TaskEnableStmt:
+    case SysTaskEnableStmt:
+	vl_step_task_enable_stmt(file, (vl_task_enable_stmt *)stmt);
+	break;
+    case DisableStmt:
+	vl_step_disable_stmt(file, (vl_disable_stmt *)stmt);
+	break;
+    case DeassignStmt:
+	vl_step_deassign_stmt(file, (vl_deassign_stmt *)stmt);
+	break;
+    case SendEventStmt:
+	vl_fprintf_stmt(file, "-> ");
+	vl_step_id_range(file, ((vl_send_event_stmt *)stmt)->name);
+	if (vlPhase == 1 && fg_not_empty())
+	    ((vl_send_event_stmt*)stmt)->fg_info = (char*)fg_new_assign_node();
+	vl_fprintf_stmt(file, ";\n");
+	break;
+    default: {
+	char msg[MAXSTRLEN];
+	sprintf(msg, "vl_step_stmt:Unexpected Statement Type %d",
+		((vl_bassign_stmt *)stmt)->type);
+	internal_error(msg);
+    }
+    }
+
+    return step_flag;
+}
+
+void vl_step_decl (FILE *file, void *decl)
+{
+    switch(((vl_decl *)decl)->type) {
+    case RealDecl:    case EventDecl:
+    case IntDecl:     case TimeDecl:
+	vl_step_basicdecl(file, (vl_decl *)decl);
+	break;
+
+    case InputDecl:    case OutputDecl:
+    case InoutDecl:    case RegDecl:
+	vl_step_rangedecl(file, (vl_rangedecl *)decl);
+	break;
+    case ParamDecl:    case DefparamDecl:
+	vl_step_paramdecl(file, (vl_paramdecl *)decl);
+	break;
+    case WireDecl:	case TriDecl:
+    case Tri0Decl:	case Tri1Decl:
+    case Supply0Decl:   case Supply1Decl:
+    case WandDecl:	case TriandDecl:
+    case WorDecl:	case TriorDecl:
+    case TriregDecl:
+	vl_step_netdecl(file, (vl_netdecl *)decl);
+	break;
+    default:
+	internal_error("Unexprected Declaration Type");
+	break;
+    }
+}
+
+void vl_step_cont_assign (FILE *file, vl_cont_assign *assign)
+{
+    vl_fprintf_stmt(file, "assign ");
+    vl_step_strength(file, assign->strength);
+    vl_step_delay(file, assign->delay);
+    vl_step_net_list(file, assign->assigns);
+    vl_fprintf_stmt(file, ";\n");
+}
+
+
+
+char *vl_get_prim_symbol(unsigned char sym)
+{
+    switch(sym) {
+    case PrimNone: return("");
+    case Prim0: return("0");
+    case Prim1: return("1");
+    case PrimX: return("X");
+    case PrimQ: return("?");
+    case PrimR: return("R");
+    case PrimF: return("F");
+    case PrimP: return("P");
+    case PrimN: return("N");
+    case PrimS: return("*");
+    case PrimM: return("-");
+    case PrimB: return("B");
+    case Prim0X: return("(0X)");
+    case Prim1X: return("(1X)");
+    case PrimX0: return("(X0)");
+    case PrimX1: return("(X1)");
+    case PrimXB: return("(XB)");
+    case PrimBX: return("(BX)");
+    case PrimBB: return("(BB)");
+    case PrimQ0: return("(?0)");
+    case PrimQ1: return("(?1)");
+    case PrimQB: return("(?B)");
+    default: {
+	char msg[MAXSTRLEN];
+	sprintf(msg, "Unexpected primitive symbol type %d", sym);
+	internal_error(msg); return(NULL);
+    }
+    }
+}
+
+
+char *vl_get_strength(int type)
+{
+    switch(type) {
+    case 0:
+	return("\0");
+    case Supply0Supply1:
+	return("(supply0, supply1)");
+    case Supply0Strong1:
+	return("(supply0, strong1)");
+    case Supply0Pull1:
+	return("(supply0, pull1)");
+    case Supply0Weak1:
+	return("(supply0, weak1)");
+    case Supply0HighZ1:
+	return("(supply0, highz1)");
+    case Strong0Supply1:
+	return("(strong0, supply1)");
+    case Strong0Strong1:
+	return("(strong0, strong1)");
+    case Strong0Pull1:
+	return("(strong0, pull1)");
+    case Strong0Weak1:
+	return("(strong0, weak1)");
+    case Strong0HighZ1:
+	return("(strong0, highz1)");
+    case Pull0Supply1:
+	return("(pull0, supply1)");
+    case Pull0Strong1:
+	return("(pull0, strong1)");
+    case Pull0Pull1:
+	return("(pull0, pull1)");
+    case Pull0Weak1:
+	return("(pull0, weak1)");
+    case Pull0HighZ1:
+	return("(pull0, highz1)");
+    case Weak0Supply1:
+	return("(weak0, supply1)");
+    case Weak0Strong1:
+	return("(weak0, strong1)");
+    case Weak0Pull1:
+	return("(weak0, pull1)");
+    case Weak0Weak1:
+	return("(weak0, weak1)");
+    case Weak0HighZ1:
+	return("(weak0, highz1)");
+    case HighZ0Supply1:
+	return("(highz0, supply1)");
+    case HighZ0Strong1:
+	return("(highz0, strong1)");
+    case HighZ0Pull1:
+	return("(highz0, pull1)");
+    case HighZ0Weak1:
+	return("(highz0, weak1)");
+    case HighZ0HighZ1:
+	return("(highz0, highz1)");
+    case Supply1Supply0:
+	return("(supply1, supply0)");
+    case Supply1Strong0:
+	return("(supply1, strong0)");
+    case Supply1Pull0:
+	return("(supply1, pull0)");
+    case Supply1Weak0:
+	return("(supply1, weak0)");
+    case Supply1HighZ0:
+	return("(supply1, highz0)");
+    case Strong1Supply0:
+	return("(strong1, supply0)");
+    case Strong1Strong0:
+	return("(strong1, strong0)");
+    case Strong1Pull0:
+	return("(strong1, pull0)");
+    case Strong1Weak0:
+	return("(strong1, weak0)");
+    case Strong1HighZ0:
+	return("(strong1, highz0)");
+    case Pull1Supply0:
+	return("(pull1, supply0)");
+    case Pull1Strong0:
+	return("(pull1, strong0)");
+    case Pull1Pull0:
+	return("(pull1, pull0)");
+    case Pull1Weak0:
+	return("(pull1, weak0)");
+    case Pull1HighZ0:
+	return("(pull1, highz0)");
+    case Weak1Supply0:
+	return("(weak1, supply0)");
+    case Weak1Strong0:
+	return("(weak1, strong0)");
+    case Weak1Pull0:
+	return("(weak1, pull0)");
+    case Weak1Weak0:
+	return("(weak1, weak0)");
+    case Weak1HighZ0:
+	return("(weak1, highz0)");
+    case HighZ1Supply0:
+	return("(highz1, supply0)");
+    case HighZ1Strong0:
+	return("(highz1, strong0)");
+    case HighZ1Pull0:
+	return("(highz1, pull0)");
+    case HighZ1Weak0:
+	return("(highz1, weak0)");
+    case HighZ1HighZ0:
+	return("(highz1, highz0)");
+    case Small:
+	return("(small)");
+    case Medium:
+	return("(medium)");
+    case Large:
+	return("(large)");
+    default:
+	{
+	char err_msg[MAXSTRLEN];
+
+	sprintf(err_msg, "Unexpected strength type %d", type);
+	internal_error(err_msg); return(NULL);
+    }
+    }
+}
+
+
+char *vl_get_expr_op(int type)
+{
+    switch(type) {
+
+    case IDExpr:         case BitSelExpr:
+    case PartSelExpr:    case ConcatExpr:
+    case MinTypMaxExpr:  case IntExpr:
+    case RealExpr:       case StringExpr:
+    case FuncExpr:
+	return("");
+    case UplusExpr:
+	return("+");
+    case UminusExpr:
+	return("-");
+    case UnotExpr:
+	return("!");
+    case UcomplExpr:
+	return("~");
+    case UandExpr:
+	return("&");
+    case UnandExpr:
+	return("~&");
+    case UorExpr:
+	return("|");
+    case UnorExpr:
+	return("~|");
+    case UxorExpr:
+	return("^");
+    case UxnorExpr:
+	return("~^");
+    case BplusExpr:
+	return("+");
+    case BminusExpr:
+	return("-");
+    case BtimesExpr:
+	return("*");
+    case BdivExpr:
+	return("/");
+    case BremExpr:
+	return("%");
+    case Beq2Expr:
+	return("==");
+    case Bneq2Expr:
+	return("!=");
+    case Beq3Expr:
+	return("===");
+    case Bneq3Expr:
+	return("!==");
+    case BlandExpr:
+	return("&&");
+    case BlorExpr:
+	return("||");
+    case BltExpr:
+	return("<");
+    case BleExpr:
+	return("<=");
+    case BgtExpr:
+	return(">");
+    case BgeExpr:
+	return(">=");
+    case BandExpr:
+	return("&");
+    case BorExpr:
+	return("|");
+    case BxorExpr:
+	return("^");
+    case BxnorExpr:
+	return("~^");
+    case BlshiftExpr:
+	return("<<");
+    case BrshiftExpr:
+	return(">>");
+
+    case TcondExpr:
+	return("?");
+    default:
+	internal_error("Unexpected expression type");	return(NULL);
+    }
+}
+
+static void record_program_location(vl_procstmt *procstmt)
+{
+    set_add(new_label(), procstmt->pc->values);
+}
+
+char *new_label()
+{
+    static int label_count = 0;
+    static char buf[MAXSTRLEN];
+
+    sprintf(buf, "%s%d", LABEL, label_count++);
+    return buf;
+}
+
+
+static void register_clock(FILE *file, vl_event_expr *event)
+{
+    if (event->expr->type != IDExpr) return;
+
+
+
+    if (!vl_currentModule->clk)
+	vl_currentModule->clk = event;
+    else if (strcmp(vl_currentModule->clk->expr->u.name->name,
+		    event->expr->u.name->name) &&
+	     implicitClocking && !vlTimedSystem) {
+	char msg[MAXSTRLEN];
+
+	sprintf(msg, "'%s':%s is assumed to be clock, %s is reused as clock",
+		vl_currentModule->name->name,
+		vl_currentModule->clk->expr->u.name->name,
+		event->expr->u.name->name);
+	Translate_Warning(msg);
+    }
+
+
+    file = file;
+}
+
+
+vl_begin_end_stmt *vl_fake_wait_stmt(FILE *file, vl_wait_stmt *wait_stmt)
+{
+    lsList assign_list;
+    vl_bassign_stmt *assignment;
+    vl_expr *cond_expr;
+    void *wait_ctrl_stmt;
+    vl_expr *id_expr;
+    vl_event_expr *event_expr;
+    vl_event_control_stmt *edge_stmt;
+    vl_expr *ncond_expr;
+    lsList stmt_list;
+    vl_if_else_stmt *if_else_stmt;
+    vl_begin_end_stmt *retval;
+
+    cond_expr = wait_stmt->cond;
+    wait_ctrl_stmt = wait_stmt->stmt;
+
+
+    assignment =
+	vl_create_bassign_stmt(AssignStmt,
+	    vl_create_lval(IDExpr,
+			   vl_create_id_range(vlStrdup(new_termname()),
+					      NIL(vl_range)),
+			   NIL(vl_range), (lsList)0),
+			       NIL(void),
+			       cond_expr);
+    assign_list = lsCreate();
+    lsNewEnd(assign_list, (lsGeneric)assignment, 0);
+
+
+    lsNewBegin(vl_currentModule->mod_items,
+	       (lsGeneric)vl_create_cont_assign_stmt(0, NIL(vl_delay),
+						     assign_list),
+	       0);
+
+
+    id_expr = vl_create_expr(IDExpr, 0, (double)0.0,
+			     assignment->lhs->name, NIL(vl_expr),NIL(vl_expr));
+    event_expr = vl_create_event_expr(PosedgeEventExpr, id_expr);
+    edge_stmt = vl_create_event_control_stmt(event_expr, NIL(typestruct));
+    ncond_expr = vl_create_expr(UnotExpr, 0, (double)0.0,
+			       id_expr, NIL(vl_expr), NIL(vl_expr));
+    if_else_stmt =
+	vl_create_if_else_stmt(ncond_expr, edge_stmt, NIL(typestruct));
+    vl_step_if_else_stmt(file, if_else_stmt);
+    stmt_list = lsCreate();
+    lsNewEnd(stmt_list, (lsGeneric)if_else_stmt, 0);
+    lsNewEnd(stmt_list, (lsGeneric)wait_ctrl_stmt, 0);
+
+    retval = vl_create_begin_end_stmt(NIL(vl_id_range), LS_NH,
+					       stmt_list);
+
+    return retval;
+}
+
+
+static void assoc_formal_actual(vl_task *task_dfn,
+				lsList formal, lsList actual)
+{
+    lsGen agen, fgen;
+    lsHandle ahandle, fhandle;
+    char *formal_arg;
+    vl_expr *actual_arg;
+
+
+    if (lsLength(formal) != lsLength(actual)) {
+	compile_error("Initialize task with improper argument(s)");
+    }
+
+    for (fgen=lsStart(formal), agen=lsStart(actual);
+	 lsNext(fgen, (lsGeneric*)&formal_arg, &fhandle) != LS_NOMORE &&
+	 lsNext(agen, (lsGeneric*)&actual_arg, &ahandle) != LS_NOMORE; ) {
+	char *dummy_formal, *dummy_actual;
+
+	check_task_arg(actual_arg->type == IDExpr ||
+		       actual_arg->type == PartSelExpr ||
+		       actual_arg->type == BitSelExpr,
+		       task_dfn);
+	dummy_formal = formal_arg;
+	st_delete(task_dfn->sig_st, &dummy_formal, &dummy_actual);
+	st_insert(task_dfn->sig_st, formal_arg, actual_arg->u.name->name);
+    }
+    lsFinish(fgen);
+    lsFinish(agen);
+}
+
+
+vl_module *vl_chk_param_dup_master(vl_mod_prim_inst_list *modinstlist)
+{
+    vl_module *retval;
+    vl_delay *param_vals;
+    vl_id_range *pval;
+    lsList delay_list=(lsList)0;
+    lsGen delay_gen=(lsGen)0;
+    lsHandle delay_handle;
+    int num_params=0;
+    int i;
+    vl_module *master, *new_module;
+    char *pname;
+    lsGen pgen;
+    lsHandle phandle;
+    vl_expr *de;
+    int need_new_master;
+    int rtvl;
+
+    if (modinstlist->delays == NIL(vl_delay)) return NIL(vl_module);
+
+    param_vals = modinstlist->delays;
+    if (!param_vals->delay1 && !param_vals->delay2 && param_vals->delay3) {
+	delay_list = (lsList)param_vals->delay3;
+	delay_gen = lsStart(delay_list);
+	num_params = lsLength(delay_list);
+    } else if (param_vals->delay1 && !param_vals->delay2) {
+	delay_list = (lsList)0;
+	num_params = 1;
+    }
+
+    rtvl = st_lookup(vl_description->mp_st,
+		       modinstlist->name->name, (char**)&master);
+    assert(rtvl);
+    if (lsLength(master->param_list)==0) {
+	if (WarningLevel >= 1) {
+	    char buf[MAXSTRLEN];
+	    yylineno = -1;
+	    sprintf(buf,
+		    "%s:Giving parameter to a module(%s) without parameter",
+		    vl_currentModule->name->name, master->name->name);
+	    compile_error(buf);
+	} else return NIL(vl_module);
+    }
+
+
+    for (pgen=lsStart(master->param_list), need_new_master=0, i=0;
+	 lsNext(pgen, (lsGeneric*)&pname, &phandle)!=LS_NOMORE &&
+	     i<num_params; ) {
+	int retval = st_lookup(master->param_st, pname, (char**)&pval);
+	assert(retval);
+	if (delay_list) {
+	    int rtvl2 = lsNext(delay_gen,(lsGeneric*)&de,&delay_handle);
+	    assert(rtvl2 != LS_NOMORE);
+	    i++;
+	} else {
+	    de = param_vals->delay1;
+	}
+	if ((int)(pval->mpg_master_exp) != vl_eval_expr(de)) need_new_master=1;
+    }
+    lsFinish(pgen);
+    if (delay_list) lsFinish(delay_gen);
+
+    retval = master;
+
+
+    if (need_new_master) {
+	char buf[MAXSTRLEN];
+	vl_module *orig_module;
+
+
+	sprintf(buf, "%s%04x", master->name->name, ++master->dup_count);
+	new_module = vl_copy_rename_module(master, buf);
+
+
+	if (delay_list) delay_gen = lsStart(delay_list);
+	for (pgen=lsStart(new_module->param_list), need_new_master=0, i=0;
+	     lsNext(pgen, (lsGeneric*)&pname, &phandle)!=LS_NOMORE &&
+		 i<num_params; ) {
+	    int retval = st_lookup(new_module->param_st, pname, (char**)&pval);
+	    assert(retval);
+	    if (delay_list) {
+		int rtvl2 = lsNext(delay_gen,(lsGeneric*)&de,&delay_handle);
+		assert(rtvl2 != LS_NOMORE);
+		i++;
+	    } else {
+		de = param_vals->delay1;
+	    }
+	    *(int*)&(pval->mpg_master_exp) = vl_eval_expr(de);
+	}
+	lsFinish(pgen);
+	if (delay_list) lsFinish(delay_gen);
+
+	orig_module = vl_currentModule;
+	vl_currentModule = new_module;
+	vl_step_module(stdout, new_module);
+	vl_currentModule = orig_module;
+
+	retval = new_module;
+    }
+
+    return retval;
+}
+
+
+
+static void vl_expand_Q(FILE *file, lsList tags)
+{
+    lsHandle handle;
+    lsGen gen;
+    vl_expr *expr;
+    unsigned int i;
+    int num_Q;
+    char *bit_str;
+    array_t *q_array;
+
+    for (gen=lsStart(tags);
+	 lsNext(gen,(lsGeneric*)&expr,&handle)!=LS_NOMORE; ) {
+	if (expr->type != BitExpr) continue;
+	if (strstr((char*)expr->u.exprs.e3,"?")) {
+	    for (i=0, num_Q=0; i<strlen((char*)expr->u.exprs.e3); i++)
+		if (((char*)expr->u.exprs.e3)[i] == '?') num_Q++;
+
+	    bit_str = vlStrdup((char*)expr->u.exprs.e3);
+	    q_array = array_alloc(int, 0);
+	    for (i=0; i<strlen((char*)expr->u.exprs.e3); i++)
+		if (((char*)expr->u.exprs.e3)[i] == '?')
+		    array_insert_last(int, q_array, i);
+
+	    rec_expand_Q(num_Q-1, q_array, bit_str, tags, gen, &handle);
+
+	    array_free(q_array);
+	    vl_chk_free(bit_str);
+	}
+    }
+    lsFinish(gen);
+}
+
+
+
+static void rec_expand_Q(int num_Q,
+			 array_t *q_array,
+			 char *bit_str,
+			 lsList tags,
+			 lsGen gen,
+			 lsHandle *phandle)
+{
+    int b0, b1;
+    vl_expr *new_expr;
+    int ith;
+
+    if (num_Q == -1) {
+	encodebit(bit_str, &b1, &b0);
+	new_expr = vl_create_expr(BitExpr, 0, (double)0.0,
+				  (void*)b1, (void*)b0,
+				  (void*)vlStrdup(bit_str));
+	lsInBefore(gen, (lsGeneric)new_expr, phandle);
+    } else {
+	ith = array_fetch(int, q_array, num_Q);
+	bit_str[ith] = '1';
+	rec_expand_Q(num_Q-1, q_array, bit_str, tags, gen, phandle);
+	bit_str[ith] = '0';
+	rec_expand_Q(num_Q-1, q_array, bit_str, tags, gen, phandle);
+    }
+}
+
+
+static void check_task_arg(int ok, vl_task *task_dfn)
+{
+    char buf[MAXSTRLEN];
+
+    if (ok) return;
+
+    sprintf(buf, "%s: invoking task '%s' with non-simple id argiment(s); cannot be handled by vl2mv",
+	    vl_currentModule->name->name, task_dfn->name->name);
+    yylineno = -1;
+    compile_error(buf);
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_traverse.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_traverse.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_traverse.h	(revision 18)
@@ -0,0 +1,105 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_traverse.h,v 1.1.1.1 2001/07/09 23:22:42 fabio Exp $
+
+
+*/
+
+
+#ifndef VL_PRINT_H
+#define VL_PRINT_H
+
+
+#define SYNCHRONIZED 1
+
+
+
+EXTERN void vl_step_module ARGS((FILE *, vl_module *));
+EXTERN void vl_step_primitive ARGS((FILE *, vl_primitive *));
+EXTERN void vl_step_prim_table ARGS((FILE *, short, lsList));
+EXTERN void vl_step_basicdecl ARGS((FILE *, vl_decl *));
+EXTERN void vl_step_arr_decl ARGS((FILE *, vl_decl *));
+EXTERN void vl_step_rangedecl ARGS((FILE *, vl_rangedecl *));
+EXTERN void vl_step_paramdecl ARGS((FILE *, vl_paramdecl *));
+EXTERN void vl_step_netdecl ARGS((FILE *, vl_netdecl *));
+EXTERN void vl_step_task ARGS((FILE *, vl_task *));
+EXTERN void vl_step_function ARGS((FILE *, vl_function *));
+EXTERN void vl_step_gate_inst_list ARGS((FILE *, vl_gate_inst_list *));
+EXTERN void vl_step_gates ARGS((FILE *, lsList));
+EXTERN void vl_step_prim_inst_list ARGS((FILE *, vl_mod_prim_inst_list *));
+EXTERN void vl_step_prims ARGS((FILE *, lsList));
+EXTERN void vl_step_mod_inst_list ARGS((FILE *, vl_mod_prim_inst_list *));
+EXTERN void vl_step_mod_insts ARGS((FILE *, lsList));
+EXTERN void vl_step_procstmt ARGS((FILE *, vl_procstmt *));
+EXTERN int  vl_step_begin_end_stmt ARGS((FILE *, vl_begin_end_stmt *));
+EXTERN int  vl_step_if_else_stmt ARGS((FILE *, vl_if_else_stmt *));
+EXTERN int  vl_step_case_stmt ARGS((FILE *, vl_case_stmt *));
+EXTERN void vl_step_forever_stmt ARGS((FILE *, vl_forever_stmt *));
+EXTERN void vl_step_repeat_stmt ARGS((FILE *, vl_repeat_stmt *));
+EXTERN void vl_step_while_stmt ARGS((FILE *, vl_while_stmt *));
+EXTERN void vl_step_for_stmt ARGS((FILE *, vl_for_stmt *));
+EXTERN void vl_step_delay_control_stmt ARGS((FILE *, vl_delay_control_stmt *));
+EXTERN int  vl_step_event_control_stmt ARGS((FILE *, vl_event_control_stmt *));
+EXTERN int  vl_step_bassign_stmt ARGS((FILE *, vl_bassign_stmt *));
+EXTERN void vl_step_wait_stmt ARGS((FILE *, vl_wait_stmt *));
+EXTERN void vl_step_fork_join_stmt ARGS((FILE *, vl_fork_join_stmt *));
+EXTERN void vl_step_task_enable_stmt ARGS((FILE *, vl_task_enable_stmt *));
+EXTERN void vl_step_disable_stmt ARGS((FILE *, vl_disable_stmt *));
+EXTERN void vl_step_deassign_stmt ARGS((FILE *, vl_deassign_stmt *));
+EXTERN int  vl_step_case_item ARGS((FILE *, vl_case_item *));
+EXTERN int  vl_step_event_expr ARGS((FILE *, vl_event_expr *));
+EXTERN void vl_step_lval ARGS((FILE *, vl_lval *));
+EXTERN void vl_step_expr ARGS((FILE *, vl_expr *));
+EXTERN void vl_step_expr_list ARGS((FILE *, lsList));
+EXTERN void vl_step_range ARGS((FILE *, vl_range *));
+EXTERN void vl_step_delay ARGS((FILE *, vl_delay *));
+EXTERN void vl_step_id_list ARGS((FILE *, lsList));
+EXTERN void vl_step_id_range_list ARGS((FILE *, lsList));
+EXTERN void vl_step_net_list ARGS((FILE *, lsList));
+EXTERN void vl_step_net ARGS((FILE *, void *));
+EXTERN char *vl_get_prim_symbol ARGS((unsigned char));
+EXTERN char *vl_get_strength ARGS((int));
+EXTERN char *vl_get_expr_op ARGS((int));
+
+EXTERN void vl_step_ports ARGS((FILE *, lsList));
+EXTERN void vl_step_mod_item_list ARGS((FILE *, lsList));
+EXTERN void vl_step_mod_item ARGS((FILE *, void *));
+EXTERN void vl_step_decl_list ARGS((FILE *, void *));
+EXTERN int  vl_step_stmt_list ARGS((FILE *, void *));
+EXTERN void vl_step_strength ARGS((FILE *, int));
+EXTERN void vl_step_prim ARGS((FILE *, vl_mod_prim_inst *));
+EXTERN void vl_step_gate ARGS((FILE *, vl_gate_inst *));
+EXTERN void vl_step_param_vals ARGS((FILE *, lsList));
+EXTERN void vl_step_modinst ARGS((FILE *, vl_mod_prim_inst *));    
+EXTERN int  vl_step_stmt ARGS((FILE *, void *));
+EXTERN void vl_step_decl ARGS((FILE *, void *));
+EXTERN void vl_step_cont_assign ARGS((FILE *, vl_cont_assign *));
+
+EXTERN enum st_retval vl_step_desc ARGS((char *, char *, char *));
+EXTERN void vl_step_port ARGS((FILE *, vl_port *));
+EXTERN void vl_step_connects ARGS((FILE *, lsList));
+EXTERN void vl_step_port_connect ARGS((FILE *, vl_port_connectPtr));
+EXTERN void vl_step_id_range ARGS((FILE *, vl_id_range *));
+
+EXTERN char *new_label ARGS(());
+EXTERN vl_begin_end_stmt *vl_fake_wait_stmt ARGS((FILE *, vl_wait_stmt *));
+EXTERN vl_module *vl_chk_param_dup_master ARGS((vl_mod_prim_inst_list *));
+#endif 
Index: vis_dev/vl2mv-2.3/src/parser/vl_types.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_types.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_types.h	(revision 18)
@@ -0,0 +1,593 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_types.h,v 1.4 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#ifndef _VL_TYPES
+#define _VL_TYPES
+
+#define MAXINLEN 10
+
+
+typedef struct vl_id_range {
+    short dummy_type;
+    char * name;
+    short flags;
+    struct vl_range *range;
+    lsList initial;
+    lsList syndrome_expr_list;
+    lsList rst_syndrome_expr_list;
+    st_table *symbolic_values;
+    void * mpg_master_exp;
+    struct vl_type *id_type;
+    struct vl_term *edge_trigger;
+    st_table *sensitiveList;
+    char *unintType;
+} vl_id_range, *vl_id_rangePtr;
+
+
+typedef struct vl_type {
+    char *name;
+    struct vl_type_specifier *specifier;
+} vl_type, *vl_typePtr;
+
+
+typedef struct vl_type_specifier {
+    short typeform;
+    union {
+	struct vl_enum_type *enum_type;
+    } u;
+} vl_type_specifier, *vl_type_specifierPtr;
+
+
+typedef struct vl_enum_type {
+    char *name;
+    st_table *domain_st;
+    lsList domain_list;
+} vl_enum_type, *vl_enum_typePtr;
+
+
+typedef struct vl_enumerator {
+    char *name;
+    int val;
+} vl_enumerator, *vl_enumeratorPtr;
+
+
+typedef struct vl_desc {
+    char *filename;
+    st_table *type_st;
+    lsList modules;
+    st_table *mp_st;
+    lsHandle handle;
+    st_table *decl_st;
+    st_table *lib_st;
+    set_t *mp_undefined;
+    st_table *fg_vars_st;
+    st_table *mod_holes;
+    st_table *synclock_st;
+} vl_desc, *vl_descPtr;
+
+
+typedef struct vl_module {
+    short type;
+    short unsigned flags;
+    vl_id_range *name;
+    lsList ports;
+    st_table *sig_st;
+    st_table *uninit_set;
+    st_table *param_st;
+    lsList param_list;
+    st_table *inst_st;
+    st_table *latch_st;
+    st_table *quasi_st;
+    st_table *func_st;
+    st_table *combVar_st;
+    st_table *seqVar_st;
+    lsList mod_items;
+    struct vl_event_expr *clk;
+    int syndrome_width;
+    int rst_syndrome_width;
+    lsList flow_graphs;
+    st_table *task_st;
+    int dup_count;
+    int visited;
+} vl_module, *vl_modulePtr;
+
+
+typedef struct vl_primitive {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    lsList ports;
+    st_table *sig_st;
+    st_table *uninit_set;
+    lsList decls;
+    lsList entries;
+    lsHandle handle;
+} vl_primitive, *vl_primitivePtr;
+
+
+typedef struct vl_port {
+    short type;
+    lsList port_exp;
+    struct vl_id_range *id;
+} vl_port, *vl_portPtr;
+
+
+typedef struct vl_port_connect {
+    short type;
+    struct vl_expr *expr;
+    struct vl_id_range *id;
+} vl_port_connect, *vl_port_connectPtr;
+
+
+typedef struct vl_prim_entry {
+    unsigned char inputs[MAXINLEN];
+    unsigned char state;
+    unsigned char next_state;
+    struct vl_prim_entry *next;
+} vl_prim_entry, *vl_prim_entryPtr;
+
+
+typedef struct vl_decl {
+    short type;
+    short unsigned flags;
+    struct vl_range *range;
+    lsList ids;
+    lsHandle handle;
+} vl_decl, *vl_declPtr;
+
+
+typedef struct vl_rangedecl {
+    short type;
+    short unsigned flags;
+    int strength_pad;
+    struct vl_range *range;
+    struct vl_delay *delay_pad;
+    lsList ids;
+    lsHandle handle;
+} vl_rangedecl, *vl_rangedeclPtr;
+
+
+typedef struct vl_paramdecl {
+    short type;
+    short unsigned flags;
+    lsList assigns;
+    lsHandle handle;
+} vl_paramdecl, *vl_paramdeclPtr;
+
+
+typedef struct vl_netdecl {
+    short type;
+    short unsigned flags;
+    int strength;
+    struct vl_range *range;
+    struct vl_delay *delay;
+    lsList ids;
+    lsHandle handle;
+} vl_netdecl, *vl_netdeclPtr;
+
+
+typedef struct vl_cont_assign {
+    short type;
+    short unsigned flags;
+    int strength;
+    struct vl_delay *delay;
+    void *assigns;
+} vl_cont_assign, *vl_cont_assignPtr;
+
+
+typedef struct vl_task {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    lsList decls;
+    lsList io_lst;
+    st_table *sig_st;
+    lsList stmts;
+    lsHandle handle;
+} vl_task, *vl_taskPtr;
+
+
+typedef struct vl_function {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    lsList ports;
+    st_table *sig_st;
+    st_table *uninit_set;
+    st_table *param_st;
+    lsList decls;
+    struct vl_range *range;
+    lsList stmts;
+    lsHandle handle;
+    lsList param_list;
+    st_table *inst_st;
+    st_table *latch_st;
+    st_table *quasi_st;
+    st_table *func_st;
+    st_table *combVar_st;
+    st_table *seqVar_st;
+    lsList mod_items;
+    struct vl_event_expr *clk;
+    int syndrome_width;
+    int rst_syndrome_width;
+    lsList flow_graphs;
+    st_table *task_st;
+    int dup_count;
+    int visited;
+} vl_function, *vl_functionPtr;
+
+
+typedef struct vl_gate_inst_list {
+    short type;
+    short unsigned flags;
+    int strength;
+    struct vl_delay *delays;
+    lsList gates;
+    lsHandle handle;
+} vl_gate_inst_list, *vl_gate_inst_listPtr;
+
+
+typedef struct vl_gate_inst {
+    struct vl_id_range *name;
+    lsList terms;
+    lsHandle handle;
+} vl_gate_inst, *vl_gate_instPtr;
+
+
+typedef struct vl_mod_prim_inst_list {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    lsList mps;
+    lsHandle handle;
+    int strength;
+    struct vl_delay *delays;
+} vl_mod_prim_inst_list, *vl_mod_prim_inst_listPtr;
+
+
+typedef struct vl_mod_prim_inst {
+    struct vl_id_range *name;
+    lsList ports;
+    void *master;
+    lsHandle handle;
+} vl_mod_prim_inst, vl_mod_prim_instPtr;
+
+
+typedef struct vl_procstmt {
+    short type;
+    short flags;
+    void *stmt;
+    struct symbolic_var *pc;
+    char *fg_info;
+} vl_procstmt, *vl_procstmtPtr;
+
+
+typedef struct vl_begin_end_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    void *decls;
+    st_table *sig_st;
+    void *stmts;
+    lsHandle handle;
+} vl_begin_end_stmt, *vl_begin_end_stmtPtr;
+
+
+typedef struct vl_if_else_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_expr *cond;
+    void *if_stmt;
+    void *else_stmt;
+    lsHandle handle;
+} vl_if_else_stmt;
+
+
+typedef struct vl_case_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_expr *cond;
+    lsList case_items;
+    lsHandle handle;
+} vl_case_stmt;
+
+
+typedef struct vl_forever_stmt {
+    short type;
+    short unsigned flags;
+    void *stmt;
+    lsHandle handle;
+} vl_forever_stmt;
+
+
+typedef struct vl_repeat_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_expr *count;
+    void *stmt;
+    void *pad1, *pad2;
+    lsHandle handle;
+} vl_repeat_stmt;
+
+
+typedef struct vl_while_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_expr *cond;
+    void *stmt;
+    lsHandle handle;
+} vl_while_stmt;
+
+
+typedef struct vl_for_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_bassign_stmt *init;
+    struct vl_expr *cond;
+    struct vl_bassign_stmt *end;
+    void *stmt;
+    lsHandle handle;
+} vl_for_stmt;
+
+
+typedef struct vl_delay_control_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_delay *delay;
+    void *stmt;
+    lsHandle handle;
+    char *fg_info;
+} vl_delay_control_stmt;
+
+
+typedef struct vl_event_control_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_event_expr *event;
+    void *stmt;
+    lsHandle handle;
+    char *fg_info;
+} vl_event_control_stmt;
+
+
+typedef struct vl_bassign_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_lval *lhs;
+    void *control;
+    struct vl_expr *rhs;
+    int lineno;
+    char *fg_info;
+} vl_bassign_stmt, *vl_bassign_stmtPtr;
+
+
+typedef struct vl_wait_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_expr *cond;
+    void *stmt;
+    lsHandle handle;
+} vl_wait_stmt;
+
+
+typedef struct vl_send_event_stmt {
+    short type;
+    struct vl_id_range *name;
+    char *fg_info;
+} vl_send_event_stmt, vl_send_event_stmtPtr;
+
+
+typedef struct vl_fork_join_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    lsList decls;
+    st_table *sig_st;
+    lsList stmts;
+    lsHandle handle;
+} vl_fork_join_stmt, *vl_fork_join_stmtPtr;
+
+
+typedef struct vl_task_enable_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    lsList args;
+    lsHandle handle;
+} vl_task_enable_stmt, *vl_task_enable_stmtPtr;
+
+
+typedef struct vl_disable_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    lsHandle handle;
+} vl_disable_stmt;
+
+
+typedef struct vl_deassign_stmt {
+    short type;
+    short unsigned flags;
+    struct vl_lval *lhs;
+    lsHandle handle;
+    char *fg_info;
+} vl_deassign_stmt;
+
+
+typedef struct vl_case_item {
+    short type;
+    short unsigned flags;
+    lsList exprs;
+    void *stmt;
+    lsHandle handle;
+    char *fg_info;
+} vl_case_item, *vl_case_itemPtr;
+
+
+typedef struct vl_event_expr {
+    short type;
+    short unsigned flags;
+    struct vl_expr *expr;
+    lsList list;
+} vl_event_expr, *vl_event_exprPtr;
+
+
+typedef struct vl_lval {
+    short type;
+    short unsigned flags;
+    struct vl_id_range *name;
+    struct vl_range *range;
+    lsList concat;
+} vl_lval, *vl_lvalPtr;
+
+
+typedef struct vl_expr {
+    short type;
+    short unsigned flags;
+    union {
+	int intval;
+	double realval;
+	struct vl_id_range *name;
+	char *string;
+	struct vl_id_range *idrng;
+	struct func_call {
+	    struct vl_id_range *name;
+	    lsList args;
+	} func_call;
+	struct bexpr {
+	    unsigned int part1;
+	    unsigned int part0;
+	} bexpr;
+	struct exprs {
+	    struct vl_expr *e1;
+	    struct vl_expr *e2;
+	    struct vl_expr *e3;
+	} exprs;
+	lsList expr_list;
+    } u;
+    struct vl_term *term;
+    char *fg_info1, *fg_info2;
+    char *fg_aux1, *fg_aux2;
+} vl_expr, *vl_exprPtr;
+
+
+typedef struct vl_range {
+    struct vl_expr *left;
+    struct vl_expr *right;
+} vl_range, *vl_rangePtr;
+
+
+typedef struct vl_delay {
+    vl_expr *delay1;
+    vl_expr *delay2;
+    vl_expr *delay3;
+} vl_delay, *vl_delayPtr;
+
+
+typedef struct typestruct {
+    short type;
+} typestruct, *typestructPtr;
+
+
+typedef struct vl_range_or_type {
+    short  type;
+    vl_range *range;
+} vl_range_or_type, *vl_range_or_typePtr;
+
+
+typedef struct vl_term {
+    vl_id_range *name;
+    unsigned short flag;
+    int hi, lo;
+    vl_type *term_type;
+} vl_term, *vl_termPtr;
+
+
+typedef struct blif_latch {
+    vl_id_range *name;
+    short flags;
+    vl_term *inport, *outport;
+} blif_latch, *blif_latchPtr;
+
+
+typedef struct var_info {
+    vl_id_range *id;
+    vl_term *current_terminal;
+    lsList cond_list;
+    void *extra;
+} var_info, *var_infoPtr;
+
+
+typedef struct syndrome_expr {
+    char *syndrome;
+    vl_term *expr;
+    st_table *pre_cond;
+    int fg_id;
+} syndrome_expr, *syndrome_exprPtr;
+
+
+typedef struct const_term {
+    vl_expr *const_expr;
+    vl_term *term;
+} const_term, *const_termPtr;
+
+
+typedef struct symbolic_var {
+    char *name;
+    set_t *values;
+} symbolic_var, *symbolic_varPtr;
+
+
+typedef struct lib_gate {
+    short type;
+    int op1Width, op2Width, op3width, resWidth;
+} lib_gate, *lib_gatePtr;
+
+
+typedef struct multi_concat {
+    vl_expr *rep;
+    lsList concat;
+} multi_concat, *multi_concatPtr;
+
+
+typedef struct vl_synClock {
+    char *name;
+    int edge;
+    int pi;
+    float rho;
+} vl_synClock, *vl_synClockPtr;
+
+
+typedef struct ctrlNetNode {
+    char   *N;
+    lsList B;
+    lsList Rcv;
+    lsList Snd;
+} ctrlNetNode, *ctrlNetNodePtr;
+
+
+EXTERN int data_width ARGS((vl_expr *expr));
+
+#endif /* _VL_TYPES */
Index: vis_dev/vl2mv-2.3/src/parser/vl_vardecl.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_vardecl.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_vardecl.c	(revision 18)
@@ -0,0 +1,93 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_vardecl.c,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "array.h"
+#include "list.h"
+#include "st.h"
+#include "set.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_vardecl.h"
+
+
+void write_var_decl(file, term)
+FILE *file;
+vl_term *term;
+{
+    if (term->flag & MVar)
+	write_mvar_decl(file, term);
+}
+
+
+void write_mvar_decl(file, term)
+FILE *file;
+vl_term *term;
+{
+    lsList domain;
+    lsGen enum_gen;
+    vl_enumerator *enum_elt;
+
+    if (!(term->flag & MVar)) return;
+
+    domain = term->term_type->specifier->u.enum_type->domain_list;
+    if (!term->name->range) {
+	int i;
+
+	fprintf(file, ".mv %s %d ", term->name->name, lsLength(domain));
+	for (enum_gen=lsStart(domain), i=0;
+	     lsNext(enum_gen, &enum_elt, LS_NH)!=LS_NOMORE; i++) {
+	    fprintf(file, "%s ", enum_elt->name);
+	}
+	lsFinish(enum_gen);
+	fprintf(file, "\n");
+    } else {
+	int array_lo, array_hi, array_idx;
+	array_lo = vl_eval_expr(term->name->range->left);
+	if (term->name->range->right)
+	    array_hi = vl_eval_expr(term->name->range->right);
+	else
+	    array_hi = array_lo;
+
+	for (array_idx=array_lo; array_idx<=array_hi; array_idx++) {
+	    fprintf(file, ".mv %s%s%d%s %d ",
+		    term->name->name, SEP_LARRAY, array_idx, SEP_RARRAY,
+		    lsLength(domain));
+	    for (enum_gen=lsStart(domain);
+		 lsNext(enum_gen, &enum_elt, LS_NH)!= LS_NOMORE;) {
+		fprintf(file, "%s ", enum_elt->name);
+	    }
+	    lsFinish(enum_gen);
+	    fprintf(file, "\n");
+	}
+    }
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_vardecl.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_vardecl.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_vardecl.h	(revision 18)
@@ -0,0 +1,26 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_vardecl.h,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+EXTERN void write_var_decl ARGS((FILE *, vl_term *));
+EXTERN void write_mvar_decl ARGS((FILE *, vl_term *));
Index: vis_dev/vl2mv-2.3/src/parser/vl_write.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_write.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_write.c	(revision 18)
@@ -0,0 +1,6082 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Id: vl_write.c,v 1.6 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "st.h"
+#include "array.h"
+#include "list.h"
+#include "set.h"
+#include "graph.h"
+#include "stack.h"
+#include "set.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_create.h"
+#include "vl_traverse.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_fg_defs.h"
+#include "vl_fg_types.h"
+#include "vl_flowgraph.h"
+#include "vl_mux.h"
+#include "vl_vardecl.h"
+#include "vl_edgedetector.h"
+#include "vl_nonblock.h"
+#include "verilog.h"
+#include <stdarg.h>
+
+
+extern vl_desc *mod_list;
+extern int ith_module;
+extern int dflow_analysis;
+extern int vlTimedSystem;
+extern int vis_nond_var;
+extern int vis_nond;
+
+extern int Warn_Uninitialized;
+extern int encodeTimer;
+
+static int WrtTrace = 0;
+static int Being_Conditioned=0;
+static int recordCombAlways=0;
+static array_t *assign_array=NIL(array_t);
+static st_table *auxSigST=NIL(st_table);
+int dumpSyncCkt = 0;
+int implicitClockWire = 0;
+int vl_noTimers = 0;
+int vl_preDeclare = 0;
+int debug_mode = 0;
+int Use_MV_Lib = 0;
+int set_notation = 1;
+int do_encoding = 0;
+int implicitDeclare = 1;
+int implicitClocking = 1;
+int instantiateAll = 1;
+int combinationalReduction = 0;
+int chk_IncompleteBranch = 1;
+int smartEvent = 1;
+int wireRegister = 0;
+int nd_check_ok = 0;
+int compatibleChecking = 0;
+int check_rhs_sensitivity = 1;
+int decomposeTable = DEFAULT_MAX_TABLE_SIZE;
+int Zconnection = 0;
+int NoDetailedComment = 0;
+int portPerLine = 20;
+double vl_expr_aux1_val=(double)0;
+double vl_expr_aux2_val=(double)0;
+double vl_expr_aux3_val=(double)0;
+int vl_expr_aux1_flag = 0;
+int vl_expr_aux2_flag = 0;
+int vl_expr_aux3_flag = 0;
+int silent_err = 0;
+int Vlerrno = 0;
+
+vl_module *vl_encloseModule;
+
+int lhs_hi, lhs_lo;
+vl_term *lhs_term=NIL(vl_term);
+int insideConcat=0;
+vl_term *Initial_Signal = NIL(vl_term);
+set_t *sensitiveList = NIL(set_t);
+vl_term *edge_triggering = NIL(vl_term);
+FILE *mv_file;
+int lhs_must_be_wire = 0;
+graph_t *vl_writeFlowGraph=NIL(graph_t);
+stack_t vl_pauseStack = (stack_t)0;
+lsList vl_current_pause_list = (lsList)0;
+lsList vl_current_vars_list = (lsList)0;
+vl_id_range *masterIdDfn = NIL(vl_id_range);
+char *cntxt_event;
+
+lsGen curModGen;
+lsHandle curModHandle;
+lsHandle *PcurModHandle;
+
+int rst_ckt = 0;
+int use_rst_ckt = 0;
+int mark_sel_var = 0;
+char *ctrl_syndrome = NIL(char);
+lsList ctrl_list;
+int ith_ctrl;
+char *rst_ctrl_syndrome = NIL(char);
+lsList rst_ctrl_list;
+int rst_ith_ctrl;
+st_table *vl_currentModule_combVar_st;
+
+static int in_procedure = 0;
+static st_table *vl_current_init_vars=NIL(st_table);
+static st_table *final_vars=NIL(st_table);
+array_t *cur_vars_array = NIL(array_t);
+
+static void vl_write_function_list ARGS((FILE *file));
+static void vl_write_formal_argument ARGS((FILE *file));
+static void vl_write_initial_generator ARGS((FILE *file));
+static void vl_write_timer ARGS((FILE *file, lsList graph_list));
+static void vl_write_encoding ARGS((FILE *file));
+static void vl_write_prim_table ARGS((FILE *file, vl_primitive *prim, char *edge_detectors));
+static void instantiate_prim_latch ARGS((FILE *file, st_table *sig_st));
+static void instantiate_edge_detector ARGS((FILE *file, vl_primitive *prim));
+static void non_block_assignment ARGS((FILE *file, st_table *vars));
+static void quasi_cont_assignment ARGS((FILE *file));
+static void vl_write_gate_inst_list ARGS((FILE *file, vl_gate_inst_list *gate_list));
+static void vl_write_tesla_timer_inst_list ARGS((FILE *file, vl_gate_inst_list *gate_list));
+static void vl_write_prim_inst_list ARGS((FILE *file, vl_mod_prim_inst_list *priminstlist));
+static void vl_predefine_vars ARGS((FILE *file, st_table *vars));
+static void vl_timed_init_mux ARGS((FILE *file, vl_term *ctrl_term,
+				    st_table *orig_vars, st_table *init_vars,
+				    st_table *feedback_vars));
+static void vl_write_prim_inst ARGS((FILE *file, vl_primitive *master,
+				     vl_mod_prim_inst *inst));
+static void vl_write_gate_inst ARGS((FILE *file, short type, vl_gate_inst *gate));
+static void vl_write_tesla_timer_inst ARGS((FILE *file, vl_gate_inst *gate,
+					    int lb, int ub));
+static void vl_register_pause ARGS((vertex_t *pause_node, st_table *old_vars));
+static void vl_prioritize_sequence ARGS((FILE *file, lsList vars_list,
+					 lsList pause_list,
+					 st_table *result_st));
+static void vl_write_vector_red_op ARGS((FILE *file, short type,
+					 vl_term *in, int inverted,
+					 vl_term *out));
+
+enum st_retval vl_write_desc(char *name, char *value, char *arg)
+{
+
+    if (!Initial_Signal)
+	Initial_Signal = vl_create_term(vl_create_id_range(vlStrdup("_initial_"),NIL(vl_range)), 0, -1);
+
+    if (((typestructPtr)value)->type == ModDecl) {
+	vl_write_module(mv_file, (vl_module*)value);
+    } else if (((typestructPtr)value)->type == CombPrimDecl ||
+	       ((typestructPtr)value)->type == SeqPrimDecl) {
+	vl_write_primitive(mv_file, (vl_primitive*)value);
+    }
+
+
+    name = name;
+    arg = arg;
+    return ST_CONTINUE;
+}
+
+void vl_write_module(FILE *file, vl_module *mod)
+{
+    char *dummy;
+
+    if (mod == NULL) return;
+    if (st_lookup(mod_list->mod_holes, mod->name->name, &dummy)) return;
+
+    ASSERT(mod->type==ModDecl, "Expecting ModDecl");
+    vl_currentModule = mod;
+    WrtTRACE("writing module\n");
+
+    ctrl_syndrome = (char*)chk_malloc(mod->syndrome_width+1);
+    memset(ctrl_syndrome, (int)'-', mod->syndrome_width);
+    ctrl_syndrome[mod->syndrome_width] = '\0';
+    rst_ctrl_syndrome = (char*)chk_malloc(mod->rst_syndrome_width+1);
+    memset(rst_ctrl_syndrome, (int)'-', mod->rst_syndrome_width);
+    rst_ctrl_syndrome[mod->rst_syndrome_width] = '\0';
+    ctrl_list = lsCreate();
+    rst_ctrl_list = lsCreate();
+    ith_ctrl = 0;
+    rst_ith_ctrl = 0;
+
+    fprintf(file, "%s %s ", HSIS_MODEL, mod->name->name);
+    vl_write_formal_argument(file);
+    fprintf(file, "\n");
+    vl_write_io_list(file);
+    vl_write_svar(file);
+    vl_write_consts(file);
+    if (vlTimedSystem || !implicitClocking) {
+	vl_preDeclare = 1;
+	vl_write_timer(file, mod->flow_graphs);
+    }
+    vl_write_mod_item_list(file, mod->mod_items);
+    if (vlTimedSystem || !implicitClocking) {
+	vl_preDeclare = 0;
+	vl_write_timer(file, mod->flow_graphs);
+    }
+    vl_write_initial_generator(file);
+    fprintf(file, ".end\n");
+
+    vl_write_function_list(file);
+    vl_write_encoding(file);
+    vl_currentModule = NIL(vl_module);
+
+    lsDestroy(ctrl_list, 0);
+    lsDestroy(rst_ctrl_list, 0);
+    vl_chk_free(ctrl_syndrome);
+    vl_chk_free(rst_ctrl_syndrome);
+    ctrl_syndrome = NIL(char);
+    rst_ctrl_syndrome = NIL(char);
+}
+
+
+void vl_write_primitive(FILE *file, vl_primitive *prim)
+{
+    char *edge_detectors;
+
+    if (prim == NULL) return;
+
+    assert(prim->type==CombPrimDecl || prim->type==SeqPrimDecl);
+    vl_currentPrimitive = prim;
+    vl_currentModule = (vl_module*)prim;
+    WrtTRACE("writing primitive\n");
+
+    fprintf(file, "%s %s\n", HSIS_MODEL, prim->name->name);
+    vl_write_io_list(file);
+    instantiate_prim_latch(file, prim->sig_st);
+    vl_write_svar(file);
+    edge_detectors = vl_write_prim_table_header(file, prim);
+    vl_write_prim_table(file, prim, edge_detectors);
+    instantiate_edge_detector(file, prim);
+    fprintf(file, ".end\n\n\n");
+
+    vl_currentModule = NIL(vl_module);
+    vl_currentPrimitive = NIL(vl_primitive);
+    vl_chk_free(edge_detectors);
+}
+
+
+static void vl_write_function_list(FILE *file)
+{
+    st_generator *gen;
+    char *fname;
+    vl_function *func_def;
+
+    gen = st_init_gen(vl_currentModule->func_st);
+    while (st_gen(gen, (char**)&fname, (char**)&func_def)) {
+	vl_write_function(file, func_def);
+    }
+    st_free_gen(gen);
+}
+
+
+void vl_write_function(FILE *file, vl_function *func)
+{
+    st_table *vars_touched;
+    array_t *vars_array;
+    vl_module *old_module;
+
+    if (func == NIL(vl_function)) return;
+
+    old_module = vl_currentModule;
+    vl_encloseModule = vl_currentModule;
+    vl_currentModule = (vl_module*)func;
+    vl_currentFunction = func;
+    vl_pauseStack = create_stack();
+    WrtTRACE("writing function\n");
+
+    vars_array = array_alloc(st_table*, 0);
+    vars_touched = st_init_table(strcmp, st_strhash);
+
+    fprintf(file, "%s %s ", HSIS_MODEL, func->name->name);
+    vl_write_formal_argument(file);
+    fprintf(file, "\n");
+
+    vl_write_io_list(file);
+    vl_write_svar(file);
+    vl_write_stmt_list(file, func->stmts, NO_MUX, NIL(vl_term), vars_touched);
+    array_insert_last(st_table*, vars_array, vars_touched);
+    func_conflict_arbitrator(file, vl_currentFunction->name,
+			     vars_array);
+    fprintf(file, ".end\n\n\n");
+    vl_currentModule = old_module;
+    vl_currentFunction = NIL(vl_function);
+    vl_encloseModule = NIL(vl_module);
+    destroy_stack(vl_pauseStack, 0);
+    vl_pauseStack = (lsList)0;
+}
+
+
+static void vl_write_formal_argument(FILE *file)
+{
+}
+
+
+void vl_write_io_list(FILE *file)
+{
+    st_generator *gen;
+    char *key;
+    vl_id_range *id_sym;
+    int lo, hi;
+    char *dir;
+    lsGen ports_gen;
+    lsHandle port_handle, port_id_handle;
+    vl_port *port;
+    vl_id_range *port_id, *port_id_sym;
+    int ithItem;
+
+    fprintf(file, "%s I/O ports\n", HSIS_COMMENT);
+
+    if (vl_currentModule->flags & WithInitial)
+	if (ith_module!=0)
+	    if (use_rst_ckt)
+		fprintf(file,".inputs %s\n", Initial_Signal->name->name);
+
+
+    if (vl_currentModule->ports) {
+	ports_gen = lsStart(vl_currentModule->ports);
+	while (lsNext(ports_gen,(lsGeneric*)&port,&port_handle) != LS_NOMORE) {
+	    if (!vl_currentFunction) {
+		if (!port->port_exp) continue;
+		lsFirstItem(port->port_exp, (lsGeneric*)&port_id,
+			    &port_id_handle);
+	    } else
+		port_id = (vl_id_range*)port;
+	    if (!st_lookup(vl_currentModule->sig_st,
+			   port_id->name, (char**)&port_id_sym)) {
+		char buf[MAXSTRLEN];
+		yylineno = -1;
+		sprintf(buf, "port %s is not defined in module %s",
+			port_id->name, vl_currentModule->name->name);
+		compile_error(buf);
+	    }
+
+	    if (!(port_id_sym->flags & InPort) &&
+		!(port_id_sym->flags & OutPort)) {
+		char buf[MAXSTRLEN];
+		yylineno = -1;
+		sprintf(buf, "port %s has no direction in module %s",
+			port_id->name, vl_currentModule->name->name);
+		compile_error(buf);
+	    }
+	}
+	lsFinish(ports_gen);
+    }
+
+    ithItem = 0;
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, (char**)&key, (char**)&id_sym)) {
+	if (!(id_sym->flags & InPort) && !(id_sym->flags & OutPort))
+	    continue;
+
+	if (strstr(id_sym->name, SEP_LATCH)) continue;
+	if (strstr(id_sym->name, SEP_QUASI)) continue;
+
+
+	if (!vl_currentFunction && implicitClocking && !vlTimedSystem) {
+	    if (vl_currentModule->clk) {
+		if (!strcmp(vl_currentModule->clk->expr->u.name->name,
+			    key) &&
+		    !vl_currentPrimitive) {
+		    if (!implicitClockWire)
+			continue;
+		}
+	    } else {
+		if (!strcmp(key, CLOCK)) {
+		    if (!implicitClockWire)
+			continue;
+		}
+	    }
+	}
+
+	dir = (id_sym->flags & InPort) ? ".inputs":".outputs";
+	if (id_sym->flags & MVar) {
+	    declare_mvar_io(file, dir, id_sym);
+	} else {
+	    get_hilo(id_sym, &hi, &lo);
+	    if (lo > hi) {
+		declare_bin_scalar_io(file, dir, id_sym);
+	    } else {
+		declare_bin_vector_io(file, dir, id_sym);
+	    }
+	}
+    }
+    st_free_gen(gen);
+
+}
+
+void vl_write_svar(FILE *file)
+{
+    st_generator *gen;
+    char *key;
+    vl_id_range *id_sym;
+    lsList domain;
+    int lo, hi;
+
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, &key, (char**)&id_sym)) {
+	vl_enumerator *enum_elt;
+	lsGen enum_gen;
+	lsHandle enum_handle;
+	int j;
+
+	if (str_matchtail(id_sym->name,SEP_LATCH)) continue;
+
+
+	if (!vl_currentFunction && implicitClocking && !vlTimedSystem) {
+	    if (vl_currentModule->clk) {
+		if (!strcmp(vl_currentModule->clk->expr->u.name->name, key) &&
+		    !vl_currentPrimitive) {
+		    if (!implicitClockWire)
+			continue;
+		    else
+			fprintf(file, "%s %s ;\n", SMV_CLOCK,
+				vl_currentModule->clk->expr->u.name->name);
+		}
+	    }
+	}
+
+	if (!(id_sym->flags & MVar)) {
+	    continue;
+	}
+
+	if (!id_sym->range) {
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+	    get_hilo(id_sym, &hi, &lo);
+	    fprintf(file, ".mv %s %d ", id_sym->name, lsLength(domain));
+	    for (enum_gen=lsStart(domain), j=0;
+		 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		     LS_NOMORE;
+		 j++) {
+		fprintf(file, "%s ", enum_elt->name);
+	    }
+	    lsFinish(enum_gen);
+	    fprintf(file, "\n");
+	} else {
+	    int idx_hi, idx_lo, idx;
+	    idx_lo = vl_eval_expr(id_sym->range->left);
+	    if (id_sym->range->right)
+		idx_hi = vl_eval_expr(id_sym->range->right);
+	    else
+		idx_hi = idx_lo;
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+		get_hilo(id_sym, &hi, &lo);
+		fprintf(file, ".mv %s%s%d%s %d ",
+			id_sym->name, SEP_LARRAY, idx, SEP_RARRAY,
+			lsLength(domain));
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		     LS_NOMORE;) {
+		    fprintf(file, "%s ", enum_elt->name);
+		}
+		lsFinish(enum_gen);
+		fprintf(file, "\n");
+	    }
+	}
+    }
+    st_free_gen(gen);
+}
+
+void vl_write_mod_item_list (FILE *file, lsList mitems)
+{
+    vl_decl *item;
+    lsHandle fg_handle;
+    lsGen fg_gen;
+    array_t *vars_array;
+    st_table *var_touched, *final_vars;
+    st_table *comb_st, *tmp_st;
+    st_table *old_sensitiveList;
+
+    WrtTRACE("writing Module Items\n");
+
+    vars_array = array_alloc(st_table*, 0);
+    cur_vars_array = vars_array;
+    vl_currentModule_combVar_st = comb_st = st_init_table(strcmp, st_strhash);
+    if (mitems != (lsList)0) {
+	for (curModGen = lsStart(mitems),
+	     fg_gen = lsStart(vl_currentModule->flow_graphs);
+	     lsNext(curModGen, (lsGeneric*)&item, &curModHandle) !=
+		 LS_NOMORE; ) {
+	    PcurModHandle = &curModHandle;
+	    if (((vl_decl*)item)->type == AlwaysStmt)
+		lsNext(fg_gen, (lsGeneric*)&vl_writeFlowGraph, &fg_handle);
+	    else
+		vl_writeFlowGraph = NIL(graph_t);
+
+
+	    old_sensitiveList = sensitiveList;
+	    recordCombAlways = 0;
+
+	    if ((sensitiveList=
+		fg_graph_has_one_data_detector(vl_writeFlowGraph))  &&
+		combinationalReduction && implicitClocking) {
+		vl_currentModule->combVar_st = tmp_st =
+		    st_init_table(strcmp, st_strhash);
+		recordCombAlways = 1;
+	    } else {
+		vl_currentModule->combVar_st = tmp_st = NIL(st_table);
+	    }
+
+	    var_touched = vl_write_mod_item(file, item, NIL(st_table));
+	    vl_writeFlowGraph = NIL(graph_t);
+	    if (var_touched) {
+		array_insert_last(st_table*, vars_array, var_touched);
+	    }
+
+
+	    if (!vl_currentModule->combVar_st) {
+		st_generator *gen;
+		char *key;
+		char *dummy;
+		if (var_touched) {
+		    gen = st_init_gen(var_touched);
+		    while (st_gen(gen, &key, (char**)&dummy))
+			if (!st_lookup(vl_currentModule->seqVar_st,
+				       key, &dummy))
+			    st_insert(vl_currentModule->seqVar_st,
+				      key, (char*)0);
+		    st_free_gen(gen);
+		}
+	    }
+
+
+	    if (tmp_st) {
+		if (vl_currentModule->combVar_st) {
+
+		    st_generator *gen;
+		    vl_id_range *id_sym;
+		    char *key;
+		    gen = st_init_gen(vl_currentModule->combVar_st);
+		    while (st_gen(gen, &key, (char**)&id_sym)) {
+			st_insert(comb_st, key, (char*)id_sym);
+
+		    }
+		    st_free_gen(gen);
+		}
+		st_free_table(tmp_st);
+	    }
+
+	    sensitiveList = old_sensitiveList;
+	}
+	(void) lsFinish(fg_gen);
+    }
+
+    vl_currentModule->combVar_st = comb_st;
+    vl_currentModule_combVar_st = NIL(st_table);
+    final_vars = conflict_arbitrator(file, vars_array);
+    non_block_assignment(file, final_vars);
+    instantiate_latch(file, final_vars);
+    quasi_cont_assignment(file);
+    cur_vars_array = NIL(array_t);
+}
+
+
+char *vl_write_prim_table_header(FILE *file, vl_primitive *prim)
+{
+    lsGen port_gen;
+    vl_port *port;
+    lsHandle port_handle, port_id_handle;
+    vl_id_range *port_id, *port_id_sym;
+    int ith_port=0;
+    char *retval;
+
+    fprintf(file, ".names ");
+
+    retval = (char*)chk_malloc(lsLength(prim->ports)+1);
+
+    port_gen = lsStart(prim->ports);
+    while (lsNext(port_gen, (lsGeneric*)&port, &port_handle) != LS_NOMORE) {
+	lsFirstItem(port->port_exp, (lsGeneric*)&port_id, &port_id_handle);
+	if (!st_lookup(prim->sig_st, port_id->name, (char**)&port_id_sym)) {
+	    char buf[MAXSTRLEN];
+	    yylineno = -1;
+	    sprintf(buf, "port %s is not defined in primitive %s",
+		    port_id->name, vl_currentModule->name->name);
+	    compile_error(buf);
+	}
+
+	retval[ith_port] = 0;
+	if (prim->type ==SeqPrimDecl) {
+	    if (port_id_sym->flags & InPort) {
+		if (need_edge_detector(prim->entries, ith_port)) {
+		    port_id_sym->flags |= EdgeDetector;
+		    fprintf(file, "%s%s %s ",
+			    port_id_sym->name, PIN_DELAYED, port_id_sym->name);
+		    retval[ith_port] = 1;
+		} else {
+		    fprintf(file, "%s ", port_id_sym->name);
+		}
+		ith_port++;
+	    }
+	} else {
+	    if (port_id_sym->flags & InPort) {
+		fprintf(file, "%s ", port_id_sym->name);
+		ith_port++;
+	    }
+	}
+    }
+    lsFinish(port_gen);
+
+    port_gen = lsStart(prim->ports);
+    while (lsNext(port_gen, (lsGeneric*)&port, &port_handle) != LS_NOMORE) {
+	lsFirstItem(port->port_exp, (lsGeneric*)&port_id, &port_id_handle);
+	st_lookup(prim->sig_st, port_id->name, (char**)&port_id_sym);
+
+	if (port_id_sym->flags & OutPort) {
+	    if (prim->type == SeqPrimDecl)
+		fprintf(file, "%s %s%s\n", port_id_sym->name,
+			port_id_sym->name, SEP_LATCH);
+	    else
+		fprintf(file, "%s\n", port_id_sym->name);
+	}
+    }
+    lsFinish(port_gen);
+
+    return retval;
+}
+
+
+static void vl_write_prim_table(FILE *file, vl_primitive *prim, char *edge_detectors)
+{
+    vl_prim_entry *e;
+    int i, bin, c, num_combination, ith_dup;
+    lsHandle handle;
+    lsGen gen;
+
+    if (prim->entries == NULL) return;
+
+    WrtTRACE("Writing primitive table\n");
+    for(gen = lsStart(prim->entries);
+	lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	for (i=0, num_combination=1; i<10; i++) {
+	    if (e->inputs[i] == PrimNone)
+		break;
+	    else {
+		if (!(IS_TRANSITION(e->inputs[i]) || !edge_detectors[i]))
+		    if (!strcmp(vl_translate_prim_symbol(e->inputs[i]),"-"))
+			num_combination <<= 1;
+	    }
+	}
+
+	for (c=0; c<num_combination; c++) {
+	    bin=0;
+dump_entry:
+	    ith_dup=0;
+	    for (i=0; i<10; i++) {
+		if (e->inputs[i] == PrimNone)
+		    break;
+		else {
+		    if (IS_TRANSITION(e->inputs[i]) || !edge_detectors[i])
+			fprintf(file,"%s ",
+				vl_translate_prim_symbol(e->inputs[i]));
+		    else if (!strcmp(vl_translate_prim_symbol(e->inputs[i]),
+				    "-")) {
+			fprintf(file, "%d %d ", (c>>ith_dup)&1,(c>>ith_dup)&1);
+			ith_dup++;
+		    } else
+			fprintf(file,"%s %s ",
+				vl_translate_prim_symbol(e->inputs[i]),
+				vl_translate_prim_symbol(e->inputs[i]));
+		}
+	    }
+
+	    if (prim->type == SeqPrimDecl && e->next_state == PrimM) {
+		if (!strcmp(vl_translate_prim_symbol(e->next_state), "-")) {
+		    fprintf(file, "%d %d\n", bin, bin);
+		    if (bin++ < 1) goto dump_entry;
+		} else {
+		    fprintf(file, "%s %s\n",
+			    vl_translate_prim_symbol(e->state),
+			    vl_translate_prim_symbol(e->state));
+		}
+		continue;
+	    }
+
+	    if (prim->type == SeqPrimDecl)
+		fprintf(file, "%s ", vl_translate_prim_symbol(e->state));
+
+	    fprintf(file, "%s ", vl_translate_prim_symbol(e->next_state));
+	    fprintf(file, "%s\n", vl_translate_prim_symbol(e->state));
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+
+st_table *vl_write_mod_item(FILE *file, vl_decl *item, st_table *other_vars)
+{
+    st_table *var_touched=NIL(st_table);
+    vl_term *ctrl_term;
+
+    switch(item->type) {
+
+    case RealDecl:	case EventDecl:
+	break;
+
+    case IntDecl:	case TimeDecl:
+	break;
+
+    case InputDecl:	case OutputDecl:
+    case InoutDecl:	case RegDecl:
+	break;
+
+    case ParamDecl:	case DefparamDecl:
+	break;
+
+
+    case WireDecl:
+	var_touched = st_init_table(strcmp, st_strhash);
+	vl_write_wiring_assign(file, (vl_netdecl*)item, var_touched);
+	break;
+
+
+    case TriDecl:
+    case Tri0Decl:	case Tri1Decl:
+    case Supply0Decl:	case Supply1Decl:
+    case WandDecl:	case TriandDecl:
+    case WorDecl:	case TriorDecl:
+    case TriregDecl:
+	break;
+
+    case ContAssign:
+	var_touched = st_init_table(strcmp, st_strhash);
+	vl_write_cont_assign(file, (vl_cont_assign*)item, var_touched);
+	break;
+
+    case TaskDecl:
+	break;
+
+    case IntFuncDecl: {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "'%s': can handle int function %s yet",
+		vl_currentModule->name->name,
+		((vl_function*)item)->name->name);
+	Translate_Warning(buf);
+	break;
+    }
+    case RealFuncDecl: {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "'%s': can handle real function %s yet",
+		vl_currentModule->name->name,
+		((vl_function*)item)->name->name);
+	Translate_Warning(buf);
+	break;
+    }
+
+    case RangeFuncDecl:
+	break;
+
+    case AndGate:	case NandGate:
+    case OrGate:	case NorGate:
+    case XorGate:	case XnorGate:
+    case BufGate:	case Bufif0Gate:
+    case Bufif1Gate:	case NotGate:
+    case Notif0Gate:	case Notif1Gate:
+    case PulldownGate:	case PullupGate:
+    case NmosGate:	case RnmosGate:
+    case PmosGate:	case RpmosGate:
+    case CmosGate:	case RcmosGate:
+    case TranGate:	case RtranGate:
+    case Tranif0Gate:	case Rtranif0Gate:
+    case Tranif1Gate:	case Rtranif1Gate:
+	vl_write_gate_inst_list(file, (vl_gate_inst_list*)item);
+	break;
+
+    case TeslaTimerGate:
+	vl_write_tesla_timer_inst_list(file, (vl_gate_inst_list*)item);
+	break;
+
+    case ModInst: {
+	char *mp;
+
+	if (st_lookup(vl_description->mp_st,
+		       ((vl_mod_prim_inst_list *)item)->name->name,
+		       &mp)) {
+	    if (((typestructPtr)mp)->type == CombPrimDecl ||
+		((typestructPtr)mp)->type == SeqPrimDecl)
+		goto write_prim_inst;
+	}
+	}
+
+	vl_write_mod_inst_list(file, (vl_mod_prim_inst_list*)item);
+	break;
+
+write_prim_inst:
+
+    case PrimInst:
+	vl_write_prim_inst_list(file, (vl_mod_prim_inst_list*)item);
+	break;
+
+    case InitialStmt:
+	vl_write_reset(file, (vl_procstmt*)item);
+	break;
+    case AlwaysStmt:
+	if (((fg_graph_info*)vl_writeFlowGraph->user_data)->fg_id == -1) {
+	    fg_new_fg_id();
+	    ((fg_graph_info*)vl_writeFlowGraph->user_data)->fg_id = fg_fg_id();
+	} else {
+	    fg_set_fg_id(((fg_graph_info*)vl_writeFlowGraph->user_data)
+			 ->fg_id);
+	}
+	var_touched = st_init_table(strcmp, st_strhash);
+	if (vlTimedSystem) {
+	    vl_current_init_vars = st_init_table(strcmp, st_strhash);
+	    vl_predefine_vars(file, var_touched);
+	}
+	var_touched = vl_write_procstmt(file, (vl_procstmt*)item, var_touched);
+	if (vlTimedSystem) {
+
+	    ctrl_term = test_against_lc_init(file);
+	    if (final_vars && vlTimedSystem)
+		vl_timed_init_mux(file, ctrl_term, NIL(st_table),
+				  vl_current_init_vars, final_vars);
+	    else
+		vl_timed_init_mux(file, ctrl_term, NIL(st_table),
+				  vl_current_init_vars, var_touched);
+	    final_vars = NIL(st_table);
+	    st_free_table(vl_current_init_vars);
+	    vl_current_init_vars = NIL(st_table);
+	}
+	fg_associate_id_vars(fg_fg_id(), var_touched);
+	break;
+
+    default:
+	internal_error("Unexpected Module Item");
+	break;
+    }
+
+
+    other_vars = other_vars;
+
+    return var_touched;
+}
+
+void vl_write_mod_inst_list(FILE *file, vl_mod_prim_inst_list *modinstlist)
+
+{
+    vl_module *mod;
+    vl_mod_prim_inst *modinst;
+
+    if (st_lookup(mod_list->mp_st,
+		  modinstlist->name->name, (char**)&mod)) {
+	lsGen gen;
+	lsHandle handle;
+
+	gen = lsStart(modinstlist->mps);
+	if (lsNext(gen, (lsGeneric*)&modinst, &handle) == LS_OK) {
+	    vl_write_mod_inst(file, mod, modinst);
+	    while (lsNext(gen, (lsGeneric*)&modinst, &handle) != LS_NOMORE) {
+		vl_write_mod_inst(file, mod, modinst);
+	    }
+	}
+	lsFinish(gen);
+    } else {
+	char msg[MAXSTRLEN];
+
+	sprintf(msg,
+		"module %s used without definition", modinstlist->name->name);
+	Translate_Warning(msg);
+    }
+}
+
+
+static void vl_write_prim_inst_list(FILE *file, vl_mod_prim_inst_list *priminstlist)
+{
+    vl_primitive *prim;
+    vl_mod_prim_inst *priminst;
+
+    if (st_lookup(mod_list->mp_st,
+		  priminstlist->name->name, (char**)&prim)) {
+	lsGen gen;
+	lsHandle handle;
+
+	gen = lsStart(priminstlist->mps);
+	if (lsNext(gen, (lsGeneric*)&priminst, &handle) == LS_OK) {
+	    vl_write_prim_inst(file, prim, priminst);
+	    while (lsNext(gen, (lsGeneric*)&priminst, &handle) != LS_NOMORE) {
+		vl_write_prim_inst(file, prim, priminst);
+	    }
+	}
+	lsFinish(gen);
+    } else {
+	char msg[MAXSTRLEN];
+
+	sprintf(msg, "primitive %s is used without definition",
+		priminstlist->name->name);
+	Translate_Warning(msg);
+    }
+}
+
+
+static void vl_write_gate_inst_list(FILE *file, vl_gate_inst_list *gate_list)
+{
+    vl_gate_inst *gate;
+    lsGen gen;
+    lsHandle handle;
+
+    gen = lsStart(gate_list->gates);
+    if (lsNext(gen, (lsGeneric*)&gate, &handle) == LS_OK) {
+	vl_write_gate_inst(file, gate_list->type, gate);
+	while(lsNext(gen, (lsGeneric*)&gate, &handle) != LS_NOMORE) {
+	    vl_write_gate_inst(file, gate_list->type, gate);
+	}
+    }
+    (void) lsFinish(gen);
+}
+
+
+static void vl_write_tesla_timer_inst_list(FILE *file,
+					   vl_gate_inst_list *gate_list)
+{
+    vl_gate_inst *gate;
+    lsGen gen;
+    lsHandle handle;
+    int lb=0, ub=0;
+
+    if (!gate_list->delays) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "%s:teslaTimer needs #(LB:UB) delay specified",
+		vl_currentModule->name->name);
+	Translate_Warning(buf);
+    }
+    if (gate_list->delays->delay1->type == IntExpr) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "%s:teslaTimer needs #(LB:UB) delay specified",
+		vl_currentModule->name->name);
+	Translate_Warning(buf);
+    }
+
+    lb = vl_eval_expr(gate_list->delays->delay1->u.exprs.e1);
+    ub = vl_eval_expr(gate_list->delays->delay1->u.exprs.e2);
+    for (gen=lsStart(gate_list->gates);
+	 lsNext(gen, (lsGeneric*)&gate, &handle)!=LS_NOMORE; ) {
+	vl_write_tesla_timer_inst(file, gate, lb, ub);
+    }
+    (void) lsFinish(gen);
+}
+
+
+void vl_write_mod_inst(FILE *file, vl_module *master, vl_mod_prim_inst *inst)
+{
+    int lo, hi;
+    int constConnection;
+    lsHandle inst_handle, mast_handle;
+    lsGen inst_gen, mast_gen;
+    vl_port_connect *inst_item;
+    vl_port *mast_item;
+    vl_expr *old_item_expr;
+    lsList input_consts;
+    const_term *ct;
+    vl_enumerator *enum_elt;
+    int ith_port;
+    st_generator *stgen;
+    char *key;
+    int dummy;
+    lsList back_patch_list;
+    lsGen backgen;
+    lsHandle backhandle;
+    vl_expr *backexpr;
+    char modbuf[MAXSTRLEN*8];
+    char workbuf[MAXSTRLEN];
+
+    if (inst->name)
+	sprintf(modbuf, ".subckt %s %s ",
+		master->name->name, inst->name->name);
+    else
+	sprintf(modbuf, ".subckt %s %s ",
+		master->name->name, new_termname());
+
+    if (master->flags & WithInitial) {
+	if (use_rst_ckt) {
+	    sprintf(workbuf, "%s=%s ",
+		    Initial_Signal->name->name, Initial_Signal->name->name);
+	    strcat(modbuf, workbuf);
+	}
+    }
+
+    if (inst->ports && master->ports) {
+	lsHandle handle;
+	lsGen gen;
+	vl_id_range *id, *cur_sig;
+	int named_connection;
+
+
+
+	input_consts = lsCreate();
+	back_patch_list = lsCreate();
+	auxSigST = st_init_table(strcmp, st_strhash);
+
+
+	ith_port=0;
+	named_connection = 0;
+	inst_gen = lsStart(inst->ports);
+	mast_gen = lsStart(master->ports);
+	while (lsNext(mast_gen,
+		      (lsGeneric*)&mast_item, &mast_handle) != LS_NOMORE) {
+	    if (lsNext(inst_gen,
+		   (lsGeneric*)&inst_item, &inst_handle) != LS_NOMORE) {
+
+		if (!mast_item->port_exp && !inst_item->expr) continue;
+		else if ((!mast_item->port_exp && inst_item->expr) ||
+			 (!inst_item->expr && mast_item->port_exp)) {
+		    char buf[MAXSTRLEN];
+		    sprintf(buf, "'%s': try to instantiate module %s with incompatible arguments",
+			    vl_currentModule->name->name, master->name->name);
+		    yylineno = -1;
+		    compile_error(buf);
+		}
+	    } else if (!named_connection)
+
+		break;
+
+
+	    lsFirstItem(mast_item->port_exp, (lsGeneric*)&id, &handle);
+
+	    if (!st_lookup(master->sig_st, id->name, (char**)&id)) {
+		char buf[MAXSTRLEN];
+
+		sprintf(buf, "port '%s' is not defined in module '%s'",
+			id->name, master->name->name);
+		semantic_error(buf);
+	    }
+
+	    old_item_expr = NIL(vl_expr);
+
+	    if (!named_connection)
+		named_connection = (inst_item->type == NamedConnect);
+	    if (named_connection) {
+
+		mast_item = search_match_port(inst_item->id->name,
+					      master->ports);
+
+		lsFirstItem(mast_item->port_exp, (lsGeneric*)&id, &handle);
+		if (!st_lookup(master->sig_st, id->name, (char**)&id)) {
+		    char buf[MAXSTRLEN];
+
+		    sprintf(buf, "port '%s' is not defined in module '%s'",
+			    id->name, master->name->name);
+		    semantic_error(buf);
+		}
+	    }
+
+
+	    if ((id->flags&OutPort) && Zconnection) {
+		lsList assign_list;
+		vl_id_range *tmp_id;
+		vl_lval *tmp_lhs;
+		vl_expr *tmp_rhs;
+		vl_cont_assign *assign_stmt;
+		tmp_id = vl_create_id_range(vlStrdup(new_termname()),
+					    NIL(vl_range));
+		if (inst_item->expr->type == ConcatExpr)
+		    tmp_lhs = vl_create_lval(ConcatExpr,
+					     NIL(vl_id_range),NIL(vl_range),
+					     (lsList)inst_item->expr->u.name);
+		else
+		    tmp_lhs = vl_create_lval(inst_item->expr->type,
+					     inst_item->expr->u.idrng,
+					     inst_item->expr->u.idrng->range,
+					     (lsList)0);
+		tmp_rhs = vl_create_expr(IDExpr, 0, (double)0.0,
+					 tmp_id, NIL(void), NIL(void));
+		assign_list = lsCreate();
+		lsNewEnd(assign_list,
+			 (lsGeneric)vl_create_bassign_stmt(AssignStmt,
+							   tmp_lhs,
+							   NIL(void),
+							   tmp_rhs),
+			 0);
+		assign_stmt = vl_create_cont_assign_stmt(0, NIL(vl_delay),
+							 assign_list);
+		if (inst_item->expr->type == IDExpr ||
+		    inst_item->expr->type == BitSelExpr ||
+		    inst_item->expr->type == PartSelExpr) {
+		    int inVar=0;
+		    if (st_lookup(vl_currentModule->sig_st,
+				  inst_item->expr->u.name->name,
+				  (char**)&cur_sig))
+			inVar = ((cur_sig->flags & InPort) &&
+				!(cur_sig->flags & OutPort));
+		    if (!inVar)
+			lsInAfter(curModGen,
+				  (lsGeneric)assign_stmt, PcurModHandle);
+		}
+		chkUndefPorts(inst_item->expr, auxSigST);
+		old_item_expr = inst_item->expr;
+		inst_item->expr = vl_create_expr(IDExpr, 0, (double)0.0,
+						 tmp_id, NIL(void), NIL(void));
+	    }
+
+
+	    if ((id->flags&OutPort) && (inst_item->expr->type==ConcatExpr)) {
+		int m_lo, m_hi;
+		get_hilo(id, &m_hi, &m_lo);
+		write_out_port(file, id, m_hi,m_lo, inst_item->expr, auxSigST);
+		write_var_decl(file, inst_item->expr->term);
+		lsNewEnd(back_patch_list, (lsGeneric)inst_item->expr, 0);
+	    } else {
+		masterIdDfn = id;
+		if (old_item_expr)
+		    if (old_item_expr->type == ConcatExpr)
+			vl_write_expr(file, old_item_expr, NIL(st_table));
+		vl_write_expr(file, inst_item->expr, NIL(st_table));
+		masterIdDfn = NIL(vl_id_range);
+	    }
+
+	    constConnection = 0;
+	    if (!inst_item->expr) {
+		constConnection = 1;
+	    } else if (!inst_item->expr->term) {
+		constConnection = 1;
+	    } else {
+		if (id->id_type) {
+		    if (inst_item->expr->type == IDExpr &&
+			st_lookup(id->id_type->specifier->
+				  u.enum_type->domain_st,
+				  inst_item->expr->u.name->name,
+				  (char**)&enum_elt))
+			constConnection = 1;
+		}
+	    }
+
+	    if (constConnection) {
+
+		int hi, lo;
+		vl_term *term_out;
+		char conn[MAXSTRLEN];
+
+
+		get_hilo(id, &hi, &lo);
+		term_out = typed_new_term(id->id_type,NIL(vl_range),lo,hi);
+		term_out->flag |= id->flags;
+		lsNewEnd(input_consts,
+		    (lsGeneric)create_const_term(inst_item->expr,term_out),0);
+
+		put_const_port_connect(NIL(FILE), conn,
+				       id, inst_item, input_consts, term_out);
+		strcat(modbuf, conn);
+		continue;
+	    }
+
+	    if (inst_item->expr->type == IDExpr ||
+		inst_item->expr->type == BitSelExpr ||
+		inst_item->expr->type == PartSelExpr) {
+		int retval = st_lookup(vl_currentModule->sig_st,
+				       inst_item->expr->u.name->name,
+				       (char**)&cur_sig);
+		assert(retval);
+	    }
+
+
+	    if (implicitClocking && !vlTimedSystem && !implicitClockWire) {
+		if (master->clk)
+		    if (!strcmp(master->clk->expr->u.name->name, id->name))
+			continue;
+		if (!strcmp(id->name,CLOCK))
+		    continue;
+	    }
+
+	    {
+		char conn[MAXSTRLEN];
+
+		if (id->flags & MVar) {
+
+		    put_mvar_port_connect(NIL(FILE), conn, id, inst_item);
+		} else {
+		    get_hilo(id, &hi, &lo);
+		    if (lo > hi) {
+
+			put_bin_scalar_port_connect(NIL(FILE), conn,
+						    id, inst_item);
+		    } else {
+
+			put_bin_vector_port_connect(NIL(FILE), conn,
+						    id, inst_item);
+		    }
+		}
+
+		strcat(modbuf, conn);
+		strcat(modbuf, " ");
+	    }
+
+	    ith_port++;
+	}
+	lsFinish(inst_gen);
+	lsFinish(mast_gen);
+
+	backgen = lsStart(back_patch_list);
+	while (lsNext(backgen,(lsGeneric*)&backexpr,&backhandle)!=LS_NOMORE) {
+	    vl_write_outport_connect(file, backexpr);
+	}
+	lsFinish(backgen);
+
+	gen = lsStart(input_consts);
+	while(lsNext(gen, (lsGeneric*)&ct, &handle) != LS_NOMORE) {
+	    if (!isOutPort(ct->term->flag))
+		write_var_decl(file, ct->term);
+		vl_write_const(file, ct->const_expr, ct->term);
+	}
+	lsFinish(gen);
+
+	stgen = st_init_gen(auxSigST);
+	while (st_gen(stgen, &key, (char**)&dummy)) {
+	    if (!dummy)
+		fprintf(file, "%s %s %s %s;\n",
+			SMV_VAR, key, SMV_COLON, SMV_BOOLEAN);
+	    else {
+		int mhi, mlo;
+		get_hilo((vl_id_range*)dummy, &mhi, &mlo);
+		if (mhi < mlo)
+		    fprintf(file, "%s %s %s %s;\n",
+			    SMV_VAR, key, SMV_COLON, SMV_BOOLEAN);
+		else
+		    fprintf(file, "%s %s %s %s %d%s%d %s %s;\n", SMV_VAR,
+			    key, SMV_COLON, SMV_ARRAY, mhi, SMV_RANGE, mlo,
+			    SMV_OF, SMV_BOOLEAN);
+	    }
+	}
+	st_free_gen(stgen);
+	auxSigST = NIL(st_table);
+
+	fprintf(file, "%s\n", modbuf);
+
+	lsDestroy(input_consts, 0);
+    }
+}
+
+
+static void vl_write_prim_inst(FILE *file, vl_primitive *master,
+			       vl_mod_prim_inst *inst)
+{
+    vl_write_mod_inst(file, (vl_module*)master, inst);
+}
+
+
+static void vl_write_gate_inst(FILE *file, short type, vl_gate_inst *gate)
+{
+    lsGen inst_gen;
+    lsHandle inst_handle;
+    vl_expr *inst_expr;
+    vl_term *conn_term;
+    vl_expr *old_item_expr = NIL(vl_expr);
+    int constConnection;
+    int ith_port;
+    char buf[MAXSTRLEN];
+    char outbuf[MAXSTRLEN];
+    char *cp;
+
+    cp = outbuf;
+    *cp = '\0';
+    cp = strappendS(cp, ".subckt");
+    cp = strappend(cp, "__sis_");
+    cp = strappend(cp, GATE_NAME(type));
+
+    if (lsLength(gate->terms)>3) sprintf(buf,"%d",lsLength(gate->terms)-1);
+    else buf[0]='\0';
+    cp = strappendS(cp, buf);
+    if (gate->name)
+	cp = strappendS(cp, gate->name->name);
+    else
+	cp = strappendS(cp, new_termname());
+
+    inst_gen = lsStart(gate->terms);
+    ith_port = 1;
+    while (lsNext(inst_gen,
+		  (lsGeneric*)&inst_expr, &inst_handle) != LS_NOMORE) {
+
+	if ((ith_port==1 || type == TranGate) && Zconnection) {
+	    lsList assign_list;
+	    vl_id_range *tmp_id;
+	    vl_term *tmp_term;
+	    vl_lval *tmp_lhs;
+	    vl_expr *tmp_rhs;
+	    vl_cont_assign *assign_stmt;
+	    char *dummy;
+	    int no_resolve;
+
+	    no_resolve = 0;
+	    tmp_id = vl_create_id_range(vlStrdup(new_termname()),
+					NIL(vl_range));
+	    tmp_term = vl_create_term(tmp_id, 0, -1);
+	    write_var_decl(file, tmp_term);
+	    if (inst_expr->type == ConcatExpr)
+		tmp_lhs = vl_create_lval(ConcatExpr,
+					 NIL(vl_id_range),NIL(vl_range),
+					 (lsList)inst_expr->u.name);
+	    else {
+
+
+		if (implicitDeclare && inst_expr->type == IDExpr) {
+		    if (!st_lookup(vl_currentModule->sig_st,
+				   inst_expr->u.idrng->name, &dummy)) {
+			st_insert(vl_currentModule->sig_st,
+				  inst_expr->u.idrng->name,
+				  (char*)vl_create_id_range(inst_expr->u.idrng->name, NIL(vl_range)));
+		    } else {
+			no_resolve = !((((vl_id_range*)dummy)->flags & InPort) &&
+				       (((vl_id_range*)dummy)->flags & OutPort)) &&
+				     type == TranGate;
+		    }
+		}
+		tmp_lhs = vl_create_lval(inst_expr->type,
+					 inst_expr->u.idrng,
+					 inst_expr->u.idrng->range,
+					 (lsList)0);
+	    }
+
+	    if (!no_resolve) {
+		tmp_rhs = vl_create_expr(IDExpr, 0, (double)0.0,
+					 tmp_id, NIL(void), NIL(void));
+		assign_list = lsCreate();
+		lsNewEnd(assign_list,
+			 (lsGeneric)vl_create_bassign_stmt(AssignStmt,
+							   tmp_lhs,
+							   NIL(void),
+							   tmp_rhs),
+			 0);
+		assign_stmt = vl_create_cont_assign_stmt(0, NIL(vl_delay),
+							 assign_list);
+		lsInAfter(curModGen, (lsGeneric)assign_stmt, PcurModHandle);
+	    }
+
+	    old_item_expr = inst_expr;
+	    inst_expr = vl_create_expr(IDExpr, 0, (double)0.0,
+				       tmp_id, NIL(void), NIL(void));
+	}
+
+	vl_write_expr(file, inst_expr, NIL(st_table));
+
+	constConnection = 0;
+	if (!inst_expr) {
+	    constConnection = 1;
+	} else if (!inst_expr->term) {
+	    constConnection = 1;
+	}
+
+	if (constConnection) {
+	    conn_term = new_term(NIL(vl_range),0,-1);
+	    vl_write_const(file, inst_expr, conn_term);
+	} else {
+	    conn_term = inst_expr->term;
+	}
+
+
+	if (inst_expr->term->lo > inst_expr->term->hi) {
+	    sprintf(buf, "%c=%s", (ith_port==1)?'o':'a'+ith_port-2,
+		    conn_term->name->name);
+	} else {
+	    sprintf(buf, "%c=%s%s%d%s", (ith_port==1)?'o':'a'+ith_port-2,
+		    conn_term->name->name,
+		    SEP_LBITSELECT, inst_expr->term->lo, SEP_RBITSELECT);
+	}
+
+	cp = strappendS(cp, buf);
+	ith_port++;
+    }
+    lsFinish(inst_gen);
+
+    fprintf(file, "%s\n", outbuf);
+}
+
+
+static void vl_write_tesla_timer_inst(FILE *file, vl_gate_inst *gate,
+				      int lb, int ub)
+{
+    static int teslaTimerCounter = 0;
+    char ps[MAXSTRLEN], ns[MAXSTRLEN];
+    char timer[MAXSTRLEN];
+    vl_term *(w[5]);
+    int constConnection;
+    int i;
+    lsGen inst_gen;
+    lsHandle inst_handle;
+    vl_expr *inst_expr;
+
+    if (lsLength(gate->terms) != 5) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "%s:teslaTimer needs exactly 3 inputs + 2 outputs\n",
+		vl_currentModule->name->name);
+	Translate_Warning(buf);
+    }
+
+    for (inst_gen=lsStart(gate->terms), i=0;
+	 lsNext(inst_gen, (lsGeneric*)&inst_expr, &inst_handle) != LS_NOMORE;
+	 i++) {
+	vl_write_expr(file, inst_expr, NIL(st_table));
+
+	constConnection = 0;
+	if (!inst_expr) {
+	  constConnection = 1;
+	} else if (!inst_expr->term) {
+	  constConnection = 1;
+	}
+
+	if (constConnection) {
+	  w[i] = new_term(NIL(vl_range),0,-1);
+	  vl_write_const(file, inst_expr, w[i]);
+	} else
+	  w[i] = inst_expr->term;
+    }
+    lsFinish(inst_gen);
+
+    sprintf(ps, "%s", new_termname());
+    sprintf(ns, "%s", new_termname());
+    sprintf(timer, "TESLATM%d", teslaTimerCounter++);
+    fprintf(file, ".mv %s, %s 4 s w t1 t2\n", ps, ns);
+    fprintf(file, ".latch %s %s\n.r %s\ns\n", ns, ps, ps);
+    fprintf(file, ".timers %s\n", timer);
+    fprintf(file, ".names %s %s %s %s %s %s %s %s\n",
+	    ps, w[0]->name->name, w[1]->name->name, w[4]->name->name,
+	    HSIS_ARROW,
+	    w[2]->name->name, w[3]->name->name, ns);
+    fprintf(file, "s 0 - - 0 0 s\n");
+    fprintf(file, "s - 1 - 0 0 s\n");
+    if (lb==0)
+	fprintf(file, "s 1 0 1 1 0 s\n");
+    else
+	fprintf(file, "s 1 0 1 0 1 t1\n");
+    fprintf(file, "s 1 0 0 0 0 w && %s=0\n", timer);
+    fprintf(file, "w - 1 - 0 0 s\n");
+    fprintf(file, "w - 0 0 0 0 w && %s<=%d\n", timer, ub);
+    fprintf(file, "w - 0 1 1 0 s && %s>=%d && %s<=%d\n", timer, lb, timer, ub);
+    fprintf(file, "w - 0 1 0 1 t1 && %s<%d\n", timer, lb);
+    fprintf(file, "w - 0 - 0 1 t2 && %s>%d\n", timer, ub);
+    fprintf(file, "t1 - 0 - 0 1 t1\n");
+    fprintf(file, "t1 - 1 - 0 1 s\n");
+    fprintf(file, "t2 - 0 - 0 1 t2\n");
+    fprintf(file, "t2 - 1 - 0 1 s\n");
+}
+
+
+
+void vl_write_reset(FILE *file, vl_procstmt *init_stmt)
+{
+    st_table *reset_vars=NIL(st_table);
+    st_generator *gen;
+    char *key;
+    var_info *id_var;
+    vl_id_range *id_sym;
+
+    reset_vars = st_init_table(strcmp, st_strhash);
+    rst_ckt = 1;
+    vl_write_reset_stmt(file, init_stmt->stmt, reset_vars);
+    non_block_assignment(file, reset_vars);
+    gen = st_init_gen(reset_vars);
+    while (st_gen(gen, &key, (char**)&id_var)) {
+	if (st_lookup(vl_currentModule->sig_st, key, (char**)&id_sym)) {
+	    lsNewEnd(id_sym->initial, (lsGeneric)id_var->current_terminal, 0);
+	    if (strstr(id_sym->name, SEP_LATCH)) {
+		char buf[MAXSTRLEN];
+		strcpy(buf, id_sym->name);
+		strip_char(buf, SEP_LATCH);
+		if (st_lookup(vl_currentModule->sig_st, buf, (char**)&id_sym))
+		    lsNewEnd(id_sym->initial,
+			     (lsGeneric)id_var->current_terminal, 0);
+	    }
+	}
+    }
+    st_free_gen(gen);
+    rst_ckt = 0;
+}
+
+
+st_table *vl_write_procstmt(FILE *file, vl_procstmt *procstmt, st_table *vars)
+{
+    int old_lhs_must_be_wire;
+
+    WrtTRACE("Writing always/initial statement");
+
+
+
+    vl_pauseStack = create_stack();
+    vl_current_pause_list = lsCreate();
+    vl_current_vars_list = lsCreate();
+
+    in_procedure = 1;
+    if (procstmt->type == AlwaysStmt) {
+	old_lhs_must_be_wire = lhs_must_be_wire;
+	if (((vl_bassign_stmt*)procstmt->stmt)->type != EventControlStmt) {
+	    lhs_must_be_wire = 1;
+
+	}
+
+
+	vars = vl_write_stmt(file, procstmt->stmt,NO_MUX,NIL(vl_term),vars);
+
+	if (vlTimedSystem) final_vars = vars;
+	lhs_must_be_wire = old_lhs_must_be_wire;
+
+	if (procstmt->flags & PseudoAlways) {
+
+	    vl_register_pause((vertex_t *) procstmt->fg_info, vars);
+	}
+
+
+	if (lsLength(vl_current_pause_list) > 1 && vlTimedSystem) {
+	    st_table *new_table;
+	    new_table = st_init_table(strcmp, st_strhash);
+	    vl_prioritize_sequence(file,
+				   vl_current_vars_list, vl_current_pause_list,
+				   new_table);
+	    vars = new_table;
+	}
+    }
+    in_procedure = 0;
+
+    destroy_stack(vl_pauseStack, 0);
+    vl_pauseStack = (lsList)0;
+    lsDestroy(vl_current_pause_list, 0);
+    lsDestroy(vl_current_vars_list, 0);
+    vl_current_pause_list = (lsList)0;
+    vl_current_vars_list = (lsList)0;
+
+    return vars;
+}
+
+
+st_table *vl_write_stmt(FILE *file, void *stmt, int muxed, vl_term *muxsel, st_table *vars)
+{
+    vl_id_range *id_sym;
+    vl_term *out_term;
+    vl_term *new_out;
+    vl_term *tmp_term;
+    vl_term *sel;
+    st_table *pre_cond=NIL(st_table);
+    st_table *old_init_vars=NIL(st_table);
+    int using_ith_ctrl;
+    int fg_id;
+    int cur_bit_pos;
+    int num_lhs_vars;
+    lsList lhs_list;
+    lsGen lhs_gen=(lsGen)0;
+    lsHandle lhs_handle;
+    vl_expr *lhs_expr;
+    vl_id_range *lhs_var;
+    vl_range *lhs_range;
+    int old_check_rhs_sen;
+    int i;
+
+    if (stmt == NIL(void)) {
+	return vars;
+    }
+
+    WrtTRACE("Writing statement");
+
+    switch(((vl_bassign_stmt *)stmt)->type) {
+    case BeginEndStmt:
+	vars = vl_write_begin_end_stmt(file, stmt, muxed, muxsel, vars);
+	break;
+    case IfElseStmt:
+	Being_Conditioned++;
+	vars = vl_write_if_else_stmt(file, stmt, vars);
+	Being_Conditioned--;
+	break;
+    case CaseStmt:
+    case CasexStmt:
+    case CasezStmt:
+	Being_Conditioned++;
+	vars = vl_write_case_stmt(file, stmt, vars);
+	Being_Conditioned--;
+	break;
+    case CaseItem:
+	break;
+    case DefaultItem:
+	break;
+    case ForeverStmt:
+	break;
+    case RepeatStmt:
+	break;
+    case WhileStmt: {
+	if (!rst_ckt) {
+	    st_table *fork_in_vars;
+	    vl_term *dom_sel;
+
+	    using_ith_ctrl = rst_ith_ctrl;
+	    rst_ith_ctrl++;
+	    vl_write_expr(file, ((vl_while_stmt*)stmt)->cond, vars);
+
+
+
+	    tmp_term = new_term(NIL(vl_range), 0, -1);
+	    if (!((vl_while_stmt*)stmt)->cond->term) {
+		sel = new_term(NIL(vl_range), 0, -1);
+		vl_write_const(file, ((vl_while_stmt*)stmt)->cond, sel);
+		((vl_while_stmt*)stmt)->cond->term = sel;
+	    } else if (((vl_while_stmt*)stmt)->cond->term->lo <=
+		       ((vl_while_stmt*)stmt)->cond->term->hi) {
+		sel = new_term(NIL(vl_range), 0, -1);
+		vl_write_vector_bop(file, UorExpr,
+				    ((vl_while_stmt*)stmt)->cond->term,
+				    NIL(vl_term), sel);
+	    } else {
+		sel = ((vl_while_stmt*)stmt)->cond->term;
+	    }
+
+	    assert ((((vl_while_stmt*)stmt)->cond->fg_info1 && ((vl_while_stmt*)stmt)->cond->fg_info2) || (!((vl_while_stmt*)stmt)->cond->fg_info1 && !((vl_while_stmt*)stmt)->cond->fg_info2));
+
+
+	    if (((vl_while_stmt*)stmt)->cond->fg_info1) {
+
+		fg_loop_collect_pause(file,
+		    (vertex_t*)((vl_while_stmt*)stmt)->cond->fg_info1,
+		    (vertex_t*)((vl_while_stmt*)stmt)->cond->fg_info2,
+		    &dom_sel);
+
+	    }
+
+
+	    if (((vl_while_stmt*)stmt)->cond->fg_info1)
+		fg_update_node_info((vertex_t*)
+				    (((vl_while_stmt*)stmt)->cond->fg_info1),
+				    (char*)sel);
+
+	    vl_write_bin_connect(file, sel, tmp_term, 0);
+	    lsNewEnd(rst_ctrl_list, (lsGeneric)tmp_term, 0);
+	    rst_ctrl_syndrome[using_ith_ctrl] = '1';
+
+	    old_init_vars = vl_current_init_vars;
+	    vl_current_init_vars = st_init_table(strcmp, st_strhash);
+	    fork_in_vars = st_copy(vars);
+	    vl_predefine_vars(file, vars);
+
+	    vars = vl_write_stmt(file,
+				 ((vl_while_stmt*)stmt)->stmt,
+				 muxed,muxsel,vars);
+
+	    rst_ctrl_syndrome[using_ith_ctrl] = '-';
+	    vl_timed_init_mux(file, dom_sel, vars,
+			      vl_current_init_vars, fork_in_vars);
+	    vl_current_init_vars = old_init_vars;
+	}
+	break;
+    }
+    case ForStmt: {
+	if (!rst_ckt) {
+	    st_table *fork_in_vars;
+	    vl_term *dom_sel;
+
+	    vl_write_stmt(file, ((vl_for_stmt*)stmt)->init,muxed,muxsel,vars);
+
+	    old_init_vars = vl_current_init_vars;
+	    vl_current_init_vars = st_init_table(strcmp, st_strhash);
+	    fork_in_vars = st_copy(vars);
+	    vl_predefine_vars(file, vars);
+
+	    using_ith_ctrl = rst_ith_ctrl;
+	    rst_ith_ctrl++;
+	    vl_write_expr(file, ((vl_for_stmt*)stmt)->cond, vars);
+
+	    tmp_term = new_term(NIL(vl_range), 0, -1);
+	    if (!((vl_for_stmt*)stmt)->cond->term) {
+		sel = new_term(NIL(vl_range), 0, -1);
+		vl_write_const(file, ((vl_for_stmt*)stmt)->cond, sel);
+		((vl_for_stmt*)stmt)->cond->term = sel;
+	    } else if (((vl_for_stmt*)stmt)->cond->term->lo <=
+		       ((vl_for_stmt*)stmt)->cond->term->hi) {
+		sel = new_term(NIL(vl_range), 0, -1);
+		vl_write_vector_bop(file, UorExpr,
+				    ((vl_for_stmt*)stmt)->cond->term,
+				    NIL(vl_term), sel);
+	    } else {
+		sel = ((vl_for_stmt*)stmt)->cond->term;
+	    }
+
+	    assert ((((vl_for_stmt*)stmt)->cond->fg_info1 && ((vl_for_stmt*)stmt)->cond->fg_info2) || (!((vl_for_stmt*)stmt)->cond->fg_info1 && !((vl_for_stmt*)stmt)->cond->fg_info2));
+
+	    if (((vl_for_stmt*)stmt)->cond->fg_info1) {
+
+		fg_loop_collect_pause(file,
+		    (vertex_t*)((vl_for_stmt*)stmt)->cond->fg_info1,
+		    (vertex_t*)((vl_for_stmt*)stmt)->cond->fg_info2,
+		    &dom_sel);
+	    }
+
+	    if (((vl_for_stmt*)stmt)->cond->fg_info1)
+		fg_update_node_info((vertex_t*)
+					(((vl_for_stmt*)stmt)->cond->fg_info1),
+				    (char*)sel);
+
+	    vl_write_bin_connect(file, sel, tmp_term, 0);
+	    lsNewEnd(rst_ctrl_list, (lsGeneric)tmp_term, 0);
+	    rst_ctrl_syndrome[using_ith_ctrl] = '1';
+
+	    vars = vl_write_stmt(file,
+				 ((vl_for_stmt*)stmt)->stmt,muxed,muxsel,vars);
+
+	    vars = vl_write_stmt(file,
+				 ((vl_for_stmt*)stmt)->end,muxed,muxsel,vars);
+
+	    rst_ctrl_syndrome[using_ith_ctrl] = '-';
+	    vl_timed_init_mux(file, dom_sel, vars,
+			      vl_current_init_vars, fork_in_vars);
+	    vl_current_init_vars = old_init_vars;
+	}
+	break;
+    }
+
+    case DelayControlStmt: {
+
+	vl_register_pause((vertex_t *)((vl_delay_control_stmt*)stmt)->fg_info,
+			  vars);
+	vars = st_init_table(strcmp, st_strhash);
+	vl_write_stmt(file, ((vl_delay_control_stmt*)stmt)->stmt,
+		      muxed, muxsel, vars);
+	break;
+    }
+
+    case EventControlStmt: {
+
+	vl_register_pause((vertex_t *)((vl_event_control_stmt*)stmt)->fg_info,
+			  vars);
+	vars = st_init_table(strcmp, st_strhash);
+	vars = vl_write_stmt(file, ((vl_event_control_stmt*)stmt)->stmt,
+			     muxed, muxsel, vars);
+	break;
+    }
+
+    case DelayBassignStmt:
+    case DelayNbassignStmt: {
+	char buf[MAXSTRLEN];
+
+	yylineno = ((vl_bassign_stmt*)stmt)->lineno;
+
+	sprintf(buf, "'%s' contains delay, do not know how to synthesize it",
+		vl_currentModule->name->name);
+	Translate_Warning(buf);
+	break;
+    }
+
+    case AssignStmt:
+    case BassignStmt:
+    case NbassignStmt:
+    case EventBassignStmt:
+    case EventNbassignStmt: {
+
+	yylineno = ((vl_bassign_stmt*)stmt)->lineno;
+
+
+	if (((vl_bassign_stmt*)stmt)->lhs->type == ConcatExpr) {
+
+	    num_lhs_vars = lsLength(((vl_bassign_stmt*)stmt)->lhs->concat);
+	    lhs_list = ((vl_bassign_stmt*)stmt)->lhs->concat;
+	    lhs_gen = lsStart(lhs_list);
+	} else {
+	    num_lhs_vars = 1;
+	    lhs_list = (lsList)0;
+	}
+
+
+	for (i=0; i<num_lhs_vars; i++) {
+	    if (lhs_list) {
+		int retval = lsNext(lhs_gen,(lsGeneric*)&lhs_expr,&lhs_handle);
+		assert(retval != LS_NOMORE);
+		lhs_var = lhs_expr->u.name;
+		lhs_range = lhs_var->range;
+	    } else {
+		lhs_var = ((vl_bassign_stmt*)stmt)->lhs->name;
+		lhs_range = ((vl_bassign_stmt*)stmt)->lhs->range;
+	    }
+
+	    if (!st_lookup(vl_currentModule->sig_st, lhs_var->name,
+			   (char**)&id_sym)) {
+		char buf[MAXSTRLEN];
+
+		sprintf(buf, "variable %s not declared while used as lhs",
+			lhs_var->name);
+		compile_error(buf);
+		id_sym = lhs_var;
+		st_insert(vl_currentModule->sig_st,
+			  id_sym->name, (char*)id_sym);
+	    }
+
+	    if (lhs_range)
+		if (((vl_bassign_stmt *)stmt)->type == NbassignStmt ||
+		    ((vl_bassign_stmt *)stmt)->type == EventNbassignStmt) {
+		    char buf[MAXSTRLEN];
+		    sprintf(buf,
+			    "'%s':non-blocking to partial vector, array element",
+			    id_sym->name);
+		    compile_error(buf);
+		}
+
+	    if (id_sym->flags & InPort) {
+		char buf[MAXSTRLEN];
+
+		sprintf(buf, "trying to assign to input variable %s",
+			id_sym->name);
+		yylineno = ((vl_bassign_stmt*)stmt)->lineno;
+		compile_error(buf);
+	    }
+
+	    id_sym->edge_trigger = edge_triggering;
+
+	    if (recordCombAlways && !edge_triggering) {
+
+		vl_id_range *temp_id_sym;
+
+		if (!st_lookup(vl_currentModule->combVar_st, id_sym->name,
+			       (char**)&temp_id_sym)) {
+		    st_insert(vl_currentModule->combVar_st, id_sym->name,
+			      (char*)id_sym);
+		}
+	    } else {
+		id_sym->sensitiveList = sensitiveList;
+	    }
+	}
+
+	if (lhs_list) lsFinish(lhs_gen);
+
+	old_check_rhs_sen = check_rhs_sensitivity;
+	check_rhs_sensitivity =
+	    !(((vl_bassign_stmt*)stmt)->type == AssignStmt && vars);
+	out_term = vl_write_assign(file,(vl_bassign_stmt*)stmt,
+				   muxed,muxsel,vars);
+	check_rhs_sensitivity = old_check_rhs_sen;
+
+	if (lhs_list) {
+	    lhs_gen = lsStart(((vl_bassign_stmt*)stmt)->lhs->concat);
+	    assert(array_n(assign_array) == num_lhs_vars);
+	}
+
+	for (i=0, cur_bit_pos=0; i<num_lhs_vars; i++) {
+	    if (lhs_list) {
+		int retval = lsNext(lhs_gen,(lsGeneric*)&lhs_expr,&lhs_handle);
+		assert(retval != LS_NOMORE);
+		lhs_var = lhs_expr->u.name;
+		retval = st_lookup(vl_currentModule->sig_st,
+				   lhs_expr->u.name->name, (char**)&id_sym);
+		assert(retval);
+	    }
+
+	    if (((vl_bassign_stmt*)stmt)->type == NbassignStmt ||
+		((vl_bassign_stmt*)stmt)->type == DelayNbassignStmt ||
+		((vl_bassign_stmt*)stmt)->type == EventNbassignStmt) {
+
+		char buf[MAXSTRLEN];
+		sprintf(buf, "%s%s", id_sym->name, SEP_LATCH);
+		st_lookup(vl_currentModule->sig_st, buf, (char**)&id_sym);
+	    } else if (((vl_bassign_stmt*)stmt)->type == AssignStmt && vars) {
+
+		char buf[MAXSTRLEN];
+		sprintf(buf, "%s%s", id_sym->name, SEP_QUASI);
+		st_lookup(vl_currentModule->sig_st, buf, (char**)&id_sym);
+	    }
+
+	    if (!out_term) break;
+	    if (lhs_list) out_term = array_fetch(vl_term*, assign_array, i);
+	    new_out = vl_copy_term(out_term);
+	    if (lhs_list) {
+
+		int hi, lo;
+		get_hilo(id_sym, &hi, &lo);
+		if (hi < lo) hi=lo=0;
+		new_out->lo = cur_bit_pos;
+		new_out->hi = new_out->lo + (hi-lo+1) -1;
+		cur_bit_pos = new_out->hi + 1;
+	    }
+
+	    pre_cond =
+		fg_assign_temporal_context((vertex_t*)
+					   (((vl_bassign_stmt*)stmt)->fg_info));
+	    fg_id = fg_fg_id();
+
+
+	    if (cntxt_event)
+		record_pseudo_cntxt(file, fg_id, pre_cond,
+				    ctrl_syndrome, rst_ctrl_syndrome, vars);
+
+	    if (!rst_ckt) {
+		syndrome_expr *newCtrlExpr;
+
+		if (((vl_bassign_stmt *)stmt)->type == NbassignStmt ||
+		    ((vl_bassign_stmt *)stmt)->type == DelayNbassignStmt ||
+		    ((vl_bassign_stmt *)stmt)->type == EventNbassignStmt) {
+		}
+		newCtrlExpr = create_syndrome_expr(vlStrdup(ctrl_syndrome),
+						   new_out, pre_cond, fg_id);
+		lsNewEnd(id_sym->syndrome_expr_list, (lsGeneric)newCtrlExpr, 0);
+
+		st_insert(vars, id_sym->name,
+			  (char*)create_var_info(vl_copy_id_range(id_sym),
+						 out_term));
+	    } else {
+		syndrome_expr *newCtrlExpr;
+
+		if (((vl_bassign_stmt *)stmt)->type == NbassignStmt ||
+		    ((vl_bassign_stmt *)stmt)->type == DelayNbassignStmt ||
+		    ((vl_bassign_stmt *)stmt)->type == EventNbassignStmt) {
+		}
+
+		newCtrlExpr = create_syndrome_expr(vlStrdup(rst_ctrl_syndrome),
+						   new_out, pre_cond, fg_id);
+		lsNewEnd(id_sym->rst_syndrome_expr_list,
+			 (lsGeneric)newCtrlExpr, 0);
+
+		st_insert(vars, id_sym->name,
+			  (char*)create_var_info(vl_copy_id_range(id_sym),
+						 out_term));
+	    }
+	}
+	break;
+    }
+    case WaitStmt: {
+
+	if (((vl_wait_stmt*)stmt)->cond == NIL(vl_expr)) {
+	    vl_write_begin_end_stmt(file, ((vl_wait_stmt*)stmt)->stmt,
+				    muxed, muxsel, vars);
+	}
+	break;
+    }
+    case ForkJoinStmt:
+	break;
+    case TaskEnableStmt:
+    case SysTaskEnableStmt:
+	break;
+    case DisableStmt:
+	break;
+    case DeassignStmt: {
+	syndrome_expr *newCtrlExpr;
+	vl_term *operand_term;
+	char quasi[MAXSTRLEN];
+
+	if (!st_lookup(vl_currentModule->sig_st,
+		       ((vl_deassign_stmt*)stmt)->lhs->name->name,
+		       (char**)&id_sym)) {
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "%s:deassign '%s', which is undefined variable",
+		    vl_currentModule->name->name,
+		    ((vl_deassign_stmt*)stmt)->lhs->name->name);
+	    yylineno = -1;
+	    compile_error(buf);
+	}
+
+	sprintf(quasi, "%s%s", id_sym->name, SEP_QUASI);
+	if (!st_lookup(vl_currentModule->sig_st, quasi, (char**)&id_sym)) {
+	    int retval;
+	    collect_quasi(quasi);
+	    retval = st_lookup(vl_currentModule->sig_st,quasi,(char**)&id_sym);
+	    assert(retval);
+	}
+
+	operand_term =
+	    vl_create_term(((vl_deassign_stmt*)stmt)->lhs->name, 0,-1);
+	fg_id = fg_fg_id();
+	pre_cond =
+	    fg_assign_temporal_context((vertex_t*)
+				       (((vl_deassign_stmt*)stmt)->fg_info));
+	newCtrlExpr = create_syndrome_expr(vlStrdup(ctrl_syndrome),
+					   operand_term, pre_cond, fg_id);
+	lsNewEnd((!rst_ckt)?id_sym->syndrome_expr_list:
+		 id_sym->rst_syndrome_expr_list,
+		 (lsGeneric)newCtrlExpr, 0);
+	break;
+    }
+    case SendEventStmt: {
+	char vnt_buf[MAXSTRLEN];
+
+	if (!st_lookup(vl_currentModule->sig_st,
+		       ((vl_send_event_stmt*)stmt)->name->name,
+		       (char**)&id_sym)) {
+	    char buf[MAXSTRLEN];
+	    sprintf(buf, "variable %s not declared while used as event",
+		    ((vl_send_event_stmt*)stmt)->name->name);
+	    yylineno = -1;
+	    compile_error(buf);
+	}
+
+	out_term = new_term(NIL(vl_range), 0, -1);
+	sprintf(vnt_buf, "%s%s%s", id_sym->name, SEP_GATEPIN, PIN_EVENT);
+	if (smartEvent)
+	    write_int_connect(file, 1, out_term);
+	else
+	    vl_write_bit_connect(file, vnt_buf, out_term->name->name, 1);
+	new_out = vl_copy_term(out_term);
+
+	pre_cond =
+	    fg_assign_temporal_context((vertex_t*)
+				       (((vl_send_event_stmt*)stmt)->fg_info));
+	fg_id = fg_fg_id();
+
+	lsNewEnd(id_sym->syndrome_expr_list,
+		 (lsGeneric)create_syndrome_expr(vlStrdup(ctrl_syndrome),
+						 new_out, pre_cond, fg_id),
+		 0);
+
+
+
+	st_insert(vars, id_sym->name,
+		  (char*)create_var_info(vl_copy_id_range(id_sym), out_term));
+	break;
+    }
+    default: {
+	char msg[MAXSTRLEN];
+	sprintf(msg, "vl_write_stmt:Unexpected Statement Type %d",
+		((vl_bassign_stmt *)stmt)->type);
+	internal_error(msg);
+    }
+    }
+    return vars;
+}
+
+
+void vl_write_reset_stmt(FILE *file, void *stmt, st_table *vars)
+{
+    if (stmt == NIL(void)) return;
+
+    WrtTRACE("Writing reset statement");
+
+    vl_write_stmt(file, stmt, NO_MUX, NIL(vl_term), vars);
+}
+
+st_table *vl_write_begin_end_stmt(FILE *file, vl_begin_end_stmt *bestmt, int muxed, vl_term *control, st_table *vars)
+{
+    WrtTRACE("Writing begin/end\n");
+
+    vl_write_decl_list(file, bestmt->decls, muxed, control, vars);
+    vars = vl_write_stmt_list(file, bestmt->stmts, muxed, control, vars);
+    return vars;
+}
+
+st_table *vl_write_if_else_stmt(FILE *file, vl_if_else_stmt *stmt, st_table *vars)
+{
+    st_table *t_vars, *f_vars;
+    st_generator *gen;
+    char *key;
+    var_info *t_in, *f_in, *cur_var;
+    int using_ith_ctrl;
+    vl_term *sel, *tmp_term;
+
+    WrtTRACE("Writing if/then/else statement");
+
+    if (!rst_ckt) {
+	using_ith_ctrl = ith_ctrl;
+	ith_ctrl++;
+    } else {
+	using_ith_ctrl = rst_ith_ctrl;
+	rst_ith_ctrl++;
+    }
+
+
+    if (!stmt->else_stmt) {
+	if (sensitiveList && vl_currentModule->combVar_st) {
+	    if (chk_IncompleteBranch) {
+		char buf[MAXSTRLEN];
+		recordCombAlways = 0;
+		vl_currentModule->combVar_st = NIL(set_t);
+		vl_step_stmt(stderr, stmt);
+		sprintf(buf,
+			"%s:incomplete if/ese, combinational reduction failed",
+			vl_currentModule->name->name);
+		yylineno = -1;
+		compile_error(buf);
+	    }
+	}
+    }
+
+    vl_write_expr(file, stmt->cond, vars);
+
+
+
+    tmp_term = new_term(NIL(vl_range), 0, -1);
+    if (!stmt->cond->term) {
+	sel = new_term(NIL(vl_range), 0, -1);
+	vl_write_const(file, stmt->cond, sel);
+	stmt->cond->term = sel;
+    } else if (stmt->cond->term->lo <= stmt->cond->term->hi) {
+	sel = new_term(NIL(vl_range), 0, -1);
+	vl_write_vector_bop(file, UorExpr,
+			    stmt->cond->term, NIL(vl_term), sel);
+    } else {
+	sel = stmt->cond->term;
+    }
+
+    assert ((stmt->cond->fg_info1 && stmt->cond->fg_info2) || (!stmt->cond->fg_info1 && !stmt->cond->fg_info2));
+
+
+    if (stmt->cond->fg_info1)
+	fg_update_node_info((vertex_t*)(stmt->cond->fg_info1), (char*)sel);
+
+
+    if (stmt->cond->fg_info1) {
+
+	fg_if_collect_pause_rewrite_ctrl(file,
+	    (vertex_t*)stmt->cond->fg_info1, (vertex_t*)stmt->cond->fg_info2,
+	    &sel);
+	stmt->cond->term = sel;
+    }
+
+    vl_write_bin_connect(file, sel, tmp_term, 0);
+    if (!rst_ckt)
+	lsNewEnd(ctrl_list, (lsGeneric)tmp_term, 0);
+    else
+	lsNewEnd(rst_ctrl_list, (lsGeneric)tmp_term, 0);
+
+    t_vars = st_copy(vars);
+    f_vars = st_copy(vars);
+    dup_info_var_in_st(t_vars);
+    dup_info_var_in_st(f_vars);
+    reset_cond_list_in_st(t_vars);
+    reset_cond_list_in_st(f_vars);
+
+    if (!rst_ckt)
+	ctrl_syndrome[using_ith_ctrl] = '1';
+    else
+	rst_ctrl_syndrome[using_ith_ctrl] = '1';
+    t_vars = vl_write_stmt(file,stmt->if_stmt,MUX_T, stmt->cond->term,t_vars);
+    if (!rst_ckt)
+	ctrl_syndrome[using_ith_ctrl] = '0';
+    else
+	rst_ctrl_syndrome[using_ith_ctrl] = '0';
+    f_vars = vl_write_stmt(file,stmt->else_stmt,MUX_F,stmt->cond->term,f_vars);
+    if (!rst_ckt)
+	ctrl_syndrome[using_ith_ctrl] = '-';
+    else
+	rst_ctrl_syndrome[using_ith_ctrl] = '-';
+
+    fprintf(file, "%s if/else (", HSIS_COMMENT);
+    (void)vl_step_expr(file, stmt->cond);
+    fprintf(file, ")\n");
+
+    vars = create_var_muxes(file, stmt->cond->term, t_vars, f_vars, vars);
+
+    gen = st_init_gen(t_vars);
+    while (st_gen(gen, &key, (char**)&t_in)) {
+	st_delete(t_vars, &key, (char**)&t_in);
+	if (st_lookup(vars, key, (char**)&cur_var))
+	    if (cur_var == t_in)
+		continue;
+	free_var_info(t_in);
+    }
+    st_free_gen(gen);
+    gen = st_init_gen(f_vars);
+    while (st_gen(gen, &key, (char**)&f_in)) {
+	st_delete(t_vars, &key, (char**)&f_in);
+	if (st_lookup(vars, key, (char**)&cur_var))
+	    if (cur_var == f_in)
+		continue;
+	free_var_info(f_in);
+    }
+    st_free_gen(gen);
+
+
+
+    return vars;
+}
+
+
+st_table *vl_write_case_stmt(FILE *file, vl_case_stmt *stmt, st_table *vars)
+{
+    st_table **case_vars;
+    int i;
+    vl_case_item *item;
+    lsHandle handle;
+    lsGen gen;
+    vl_term **controls, *prev_ctrl = NIL(vl_term);
+    vl_term *pause_ripple=NIL(vl_term);
+    int using_ith_ctrl = -1;
+    char old_ctrl_syndrome[MAXSTRLEN];
+
+    WrtTRACE("Writing case\n");
+
+    if (!rst_ckt)
+	strcpy(old_ctrl_syndrome, ctrl_syndrome);
+    else
+	strcpy(old_ctrl_syndrome, rst_ctrl_syndrome);
+
+    assert((stmt->cond->fg_info1 && stmt->cond->fg_info2) || (!stmt->cond->fg_info1 && !stmt->cond->fg_info2));
+
+    switch (stmt->type) {
+    case CaseStmt:
+    case CasexStmt:
+    case CasezStmt: break;
+    default:
+	internal_error("Unexpected Case Type"); break;
+    }
+
+
+
+    {
+	vl_write_expr(file, stmt->cond, vars);
+
+	case_vars = (st_table**)chk_malloc(lsLength(stmt->case_items) *
+					   sizeof(st_table*));
+	controls = (vl_term**)chk_malloc(lsLength(stmt->case_items) *
+					 sizeof(vl_term*));
+	for (i=0; i<lsLength(stmt->case_items); i++) {
+	    case_vars[i] = NIL(st_table);
+	    controls[i] = NIL(vl_term);
+	}
+
+	for (gen = lsStart(stmt->case_items),  i = 0;
+	     (lsNext(gen,(lsGeneric*)&item,&handle) != LS_NOMORE);
+	     i++) {
+
+	    controls[i] =
+		write_case_comparator(file,
+				      stmt->cond->term, item->exprs, vars);
+
+
+	    if (item->fg_info) {
+		vertex_t *src_tag;
+		src_tag = g_e_dest((edge_t*)item->fg_info);
+		if (!controls[i]) {
+		    controls[i] = true_term(file);
+		}
+		fg_update_node_info((vertex_t*)(item->fg_info),
+				    (char*)controls[i]);
+		fg_case_collect_pause_rewrite_ctrl(file,
+		    src_tag, (vertex_t*)stmt->cond->fg_info2,
+		    &controls[i], &pause_ripple);
+	    }
+
+	    if (item->type == CaseItem) {
+		if (!rst_ckt) {
+		    lsNewEnd(ctrl_list, (lsGeneric)controls[i], 0);
+		    using_ith_ctrl = ith_ctrl;
+		    ith_ctrl++;
+		    ctrl_syndrome[using_ith_ctrl] = '1';
+		} else {
+		    lsNewEnd(rst_ctrl_list, (lsGeneric)controls[i], 0);
+		    using_ith_ctrl = rst_ith_ctrl;
+		    rst_ith_ctrl++;
+		    rst_ctrl_syndrome[using_ith_ctrl] = '1';
+		}
+	    }
+
+
+
+	    case_vars[i] = st_copy(vars);
+	    dup_info_var_in_st(case_vars[i]);
+	    reset_cond_list_in_st(case_vars[i]);
+	    case_vars[i] =
+		vl_write_stmt(file, item->stmt,
+			      (controls[i])?MUX_T:NO_MUX,
+			      (controls[i])?controls[i]:NIL(vl_term),
+			      case_vars[i]);
+	    if (item->type == CaseItem) {
+		if (!rst_ckt)
+		    ctrl_syndrome[using_ith_ctrl] = '0';
+		else
+		    rst_ctrl_syndrome[using_ith_ctrl] = '0';
+	    }
+
+	    prev_ctrl = controls[i];
+	}
+	(void)lsFinish(gen);
+
+	if (pause_ripple) {
+	    fprintf(file, ".names %s\n0\n", pause_ripple->name->name);
+	}
+    }
+
+    if (!rst_ckt)
+	strcpy(ctrl_syndrome, old_ctrl_syndrome);
+    else
+	strcpy(rst_ctrl_syndrome, old_ctrl_syndrome);
+
+    fprintf(file, "%s case (", HSIS_COMMENT);
+    vl_step_expr(file, stmt->cond);
+    fprintf(file, ")\n");
+
+    if (!prev_ctrl || vl_currentFunction) {
+
+
+	st_table *vars_tmp, *vars_else;
+	i=lsLength(stmt->case_items)-1;
+	vars_else = case_vars[i];
+	for (i -= 2; i>=0; i--) {
+	    vars_tmp = st_copy(vars);
+	    dup_info_var_in_st(vars_tmp);
+	    reset_cond_list_in_st(vars_tmp);
+	    create_var_muxes(file, controls[i+1],
+			     case_vars[i+1], vars_else, vars_tmp);
+	    vars_else = vars_tmp;
+	}
+	create_var_muxes(file, controls[0],
+			 case_vars[0], vars_else, vars);
+    } else {
+
+	for (i=lsLength(stmt->case_items)-1; i>=0; i--) {
+	    case_vars[i] = create_var_muxes(file, controls[i],
+					    case_vars[i], st_copy(vars), vars);
+	}
+    }
+
+    return vars;
+}
+
+
+void vl_write_cont_assign(FILE *file, vl_cont_assign *assign, st_table *vars)
+{
+    vl_id_range *lhs_id;
+    lsGen gen;
+    lsHandle handle;
+    vl_bassign_stmt *a;
+    vl_term *lhs_term;
+    int true_hi=0, true_lo=0;
+    int num_lhs_vars;
+    int cur_bit_pos;
+    lsList lhs_list;
+    lsGen lhs_gen=(lsGen)0;
+    lsHandle lhs_handle;
+    vl_expr *lhs_expr;
+    vl_id_range *lhs_var;
+    vl_range *lhs_range;
+    int i;
+
+    WrtTRACE("Writing cont_assign\n");
+
+    for (gen = lsStart(assign->assigns);
+	 lsNext(gen, (lsGeneric*)&a, &handle) != LS_NOMORE; ) {
+	a->type = AssignStmt;
+	if (a->lhs->type == MinTypMaxExpr)
+	    a->lhs->name = (vl_id_range*)((vl_expr*)a->lhs->name)->u.exprs.e1;
+
+	if (a->lhs->type == ConcatExpr) {
+	    num_lhs_vars = lsLength(a->lhs->concat);
+	    lhs_list = a->lhs->concat;
+	    lhs_gen = lsStart(lhs_list);
+	} else {
+	    num_lhs_vars = 1;
+	    lhs_list = (lsList)0;
+	}
+
+	for (i=0; i<num_lhs_vars; i++) {
+	    if (lhs_list) {
+		int retval = lsNext(lhs_gen,(lsGeneric*)&lhs_expr,&lhs_handle);
+		assert(retval != LS_NOMORE);
+		lhs_var = lhs_expr->u.name;
+		lhs_range = lhs_var->range;
+	    } else {
+		lhs_var = a->lhs->name;
+		lhs_range = a->lhs->range;
+	    }
+	    if (!st_lookup(vl_currentModule->sig_st,
+			   lhs_var->name, (char**)&lhs_id)) {
+		int retval;
+		st_insert(vl_currentModule->sig_st, lhs_var->name,
+			  (char*)vl_create_id_range(lhs_var->name,
+						    NIL(vl_range)));
+		retval = st_lookup(vl_currentModule->sig_st, lhs_var->name,
+				   (char**)&lhs_id);
+		assert(retval);
+	    }
+	}
+	if (lhs_list) lsFinish(lhs_gen);
+	nd_check_ok = 1;
+
+	lhs_term = vl_write_assign(file, a, 0, NIL(vl_term), NIL(st_table));
+
+	nd_check_ok = 0;
+	if (vis_nond_var) {
+	    vis_nond_var = 0;
+	    return;
+	}
+
+
+	if (lhs_list) {
+	    assert(array_n(assign_array) == num_lhs_vars);
+	    lhs_gen = lsStart(lhs_list);
+	    true_lo = lhs_term->lo;
+	    true_hi = lhs_term->hi;
+	}
+	for (i=0, cur_bit_pos=0; i<num_lhs_vars; i++) {
+	    if (lhs_list) {
+		int retval = lsNext(lhs_gen,(lsGeneric*)&lhs_expr,&lhs_handle);
+		assert(retval != LS_NOMORE);
+		retval = st_lookup(vl_currentModule->sig_st,
+				   lhs_expr->u.name->name, (char**)&lhs_id);
+		assert(retval);
+	    }
+	    if (lhs_list) lhs_term = array_fetch(vl_term*, assign_array, i);
+	    if (!(lhs_id->flags & InPort && !(lhs_id->flags & OutPort)))
+		st_insert(vars, lhs_id->name,
+			  (char*)create_var_info(vl_copy_id_range(lhs_id),
+						 lhs_term));
+	    else {
+		vl_id_range *id_sym;
+		int retval = st_lookup(vl_currentModule->sig_st,
+				       lhs_id->name, (char**)&id_sym);
+		assert(retval);
+		id_sym->name = lhs_term->name->name;
+	    }
+	}
+	if (lhs_list) {
+	    lsFinish(lhs_gen);
+	    lhs_term->lo = true_lo;
+	    lhs_term->hi = true_hi;
+	    array_free(assign_array);
+	}
+    }
+    (void)lsFinish(gen);
+}
+
+
+void vl_write_wiring_assign(FILE *file, vl_netdecl *assignments, st_table *vars)
+{
+    vl_id_range *lhs_id;
+    lsGen gen;
+    lsHandle handle;
+    vl_bassign_stmt *a;
+    vl_term *lhs_term;
+    int hi, lo;
+
+    WrtTRACE("Writing wire_assign\n");
+
+
+
+    gen = lsStart(assignments->ids);
+    if (lsNext(gen, (lsGeneric*)&a, &handle) == LS_OK) {
+	if (a->type == BassignStmt) {
+	    a->type = AssignStmt;
+	    st_lookup(vl_currentModule->sig_st,
+		      a->lhs->name->name, (char**)&lhs_id);
+	    get_hilo(lhs_id, &hi, &lo);
+	    lhs_term = vl_write_assign(file,a,0,NIL(vl_term),NIL(st_table));
+	    st_insert(vars, lhs_id->name,
+		      (char*)create_var_info(vl_copy_id_range(lhs_id),
+					     lhs_term));
+	}
+	while (lsNext(gen, (lsGeneric*)&a, &handle) != LS_NOMORE) {
+	    if (a->type == BassignStmt) {
+		st_lookup(vl_currentModule->sig_st,
+			  a->lhs->name->name, (char**)&lhs_id);
+		get_hilo(lhs_id, &hi, &lo);
+		a->type = AssignStmt;
+		lhs_term = vl_write_assign(file,
+					   a, 0, NIL(vl_term), NIL(st_table));
+		st_insert(vars, lhs_id->name,
+			  (char*)create_var_info(vl_copy_id_range(lhs_id),
+						 lhs_term));
+	    }
+	}
+    }
+    (void)lsFinish(gen);
+}
+
+st_table *vl_write_event_control_stmt(FILE *file, vl_event_control_stmt *stmt, st_table *vars)
+{
+    int old_recordCombAlways;
+    set_t *old_sensitiveList;
+    vl_term *old_edge_triggering;
+
+    WrtTRACE("Writing event_control_stmt\n");
+
+
+
+
+
+    old_recordCombAlways = recordCombAlways;
+    if (stmt->event->type == OrEventExpr || stmt->event->type == EventExpr)
+	recordCombAlways = 1;
+
+
+
+    old_edge_triggering = edge_triggering;
+    old_sensitiveList = sensitiveList;
+    sensitiveList = vl_write_event_expr(file, stmt->event);
+
+
+
+
+    vars = vl_write_stmt(file, stmt->stmt, 0, NIL(vl_term), vars);
+
+    edge_triggering = old_edge_triggering;
+    recordCombAlways = old_recordCombAlways;
+    sensitiveList = old_sensitiveList;
+
+    return vars;
+}
+
+
+vl_term *vl_write_assign(FILE *file, vl_bassign_stmt *assign, int muxed, vl_term *muxsel, st_table *vars)
+{
+    char latch_name[MAXSTRLEN];
+    vl_id_range *lhs_id=NIL(vl_id_range);
+    vl_term *term_out=NIL(vl_term), *assign_term=NIL(vl_term),
+	    *retval=NIL(vl_term);
+    int lo, hi;
+    int old_lhs_hi, old_lhs_lo;
+    vl_term *old_lhs_term;
+    char buf[MAXSTRLEN];
+    lsList lhs_list;
+    lsGen lhs_gen=(lsGen)0;
+    lsHandle lhs_handle;
+    vl_expr *lhs_expr;
+    int num_lhs_vars;
+    vl_id_range *lhs_var;
+    vl_range *lhs_range;
+    int i;
+
+    WrtTRACE("Writing assign_stmt\n");
+
+    fprintf(file, "%s ", HSIS_COMMENT);
+    if (!NoDetailedComment) vl_step_bassign_stmt(file, assign);
+    fprintf(file, "\n");
+
+    assert(assign->type!=DelayBassignStmt &&
+	   assign->type != DelayNbassignStmt &&
+	   assign->type != EventBassignStmt &&
+	   assign->type != EventNbassignStmt);
+
+    if (assign->lhs->type == ConcatExpr) {
+	num_lhs_vars = lsLength(assign->lhs->concat);
+	lhs_list = assign->lhs->concat;
+	lhs_gen = lsStart(lhs_list);
+	assign_array = array_alloc(vl_term*, 0);
+    } else {
+	num_lhs_vars = 1;
+	lhs_list = (lsList)0;
+    }
+
+    for (i=0; i<num_lhs_vars; i++) {
+	if (lhs_list) {
+	    int retval = lsNext(lhs_gen,(lsGeneric*)&lhs_expr,&lhs_handle);
+	    assert(retval != LS_NOMORE);
+	    lhs_var = lhs_expr->u.name;
+	    lhs_range = lhs_var->range;
+	} else {
+	    lhs_var = assign->lhs->name;
+	    lhs_range = assign->lhs->range;
+	}
+
+	if (!st_lookup(vl_currentModule->sig_st,
+		       lhs_var->name, (char**)&lhs_id)) {
+	    char buf[MAXSTRLEN];
+	    yylineno = assign->lineno;
+	    sprintf(buf, "'%s':'%s' is an undeclared variable",
+		    vl_currentModule->name->name, lhs_var->name);
+	    compile_error(buf);
+	}
+	if (assign->type == NbassignStmt ||
+	    assign->type == DelayNbassignStmt ||
+	    assign->type == EventNbassignStmt) {
+
+	    vl_id_range *id_sym;
+	    sprintf(latch_name, "%s%s", lhs_var->name, SEP_LATCH);
+	    st_lookup(vl_currentModule->sig_st, latch_name, (char**)&id_sym);
+	    id_sym->flags = lhs_id->flags;
+	    lhs_id = id_sym;
+	} else if (assign->type == AssignStmt && vars) {
+
+	    vl_id_range *id_sym;
+	    sprintf(latch_name, "%s%s", lhs_var->name, SEP_QUASI);
+	    if (!st_lookup(vl_currentModule->sig_st,
+			   latch_name,(char**)&id_sym)) {
+		int retval;
+		collect_quasi(lhs_var->name);
+		retval = st_lookup(vl_currentModule->sig_st,
+				   latch_name,(char**)&id_sym);
+		assert(retval);
+	    }
+	    id_sym->flags = lhs_id->flags;
+	    lhs_id = id_sym;
+	} else {
+
+	}
+
+	if (lhs_id->flags & InPort && !(lhs_id->flags & OutPort)) {
+	    char msg[MAXSTRLEN];
+	    sprintf(msg, "%s:%s is input variable while used as lhs",
+		    vl_currentModule->name->name, lhs_id->name);
+
+	}
+
+	if (!lhs_list) {
+	    if (vars)
+		check_assign(assign, 1);
+	    else
+		check_assign(assign, 0);
+	}
+	get_hilo(lhs_id, &hi, &lo);
+
+
+	if (!muxed) {
+	    if (vars) {
+
+		sprintf(buf, "%s%s%s%s", lhs_id->name,
+			SEP_GATEPIN, PIN_RAWOUT, new_termname());
+	    } else {
+
+		sprintf(buf, "%s%s%s%s", lhs_id->name,
+			SEP_GATEPIN, PIN_RAWOUT, new_termname());
+	    }
+	} else {
+	    if (muxed & 1) {
+		sprintf(buf, "%s%s%s%s%s%s", lhs_id->name,
+			SEP_GATEPIN, muxsel->name->name, new_termname(),
+			SEP_GATEPIN, PIN_TRUE);
+	    } else {
+		sprintf(buf, "%s%s%s%s%s%s", lhs_id->name,
+			SEP_GATEPIN, muxsel->name->name, new_termname(),
+			SEP_GATEPIN, PIN_FALSE);
+	    }
+	}
+	assign_term = term_out = create_rename_term(lhs_id, buf, lo, hi);
+	assign_term->flag = lhs_id->flags;
+	assign_term->term_type = lhs_id->id_type;
+
+	if (!(vis_nond && assign->rhs->type == NondExpr) || rst_ckt)
+	    write_var_decl(file, assign_term);
+
+	if (lhs_range) {
+	    if (lhs_id->range) {
+
+		var_info *cur_var;
+		vl_term *orig_term;
+
+		vl_write_expr(file, lhs_range->left, vars);
+		if (vars) {
+		    if (st_lookup(vars, lhs_id->name, (char**)&cur_var)) {
+			orig_term = cur_var->current_terminal;
+		    } else {
+			orig_term = vl_create_term(lhs_var, lo, hi);
+			orig_term->flag = lhs_id->flags;
+			orig_term->term_type = lhs_id->id_type;
+		    }
+		} else {
+		    orig_term = vl_create_term(lhs_var, lo, hi);
+		}
+		assign_term = new_term(NIL(vl_range), lo, hi);
+		assign_term->flag = lhs_id->flags;
+		assign_term->term_type = lhs_id->id_type;
+		write_var_decl(file, assign_term);
+		write_switch(file, lhs_id, lhs_range->left->term,
+			     lhs_range->left, orig_term, assign_term, term_out);
+	    } else {
+
+		int left, right;
+
+		left = vl_eval_expr(lhs_range->left);
+		if (lhs_range->right)
+		    right = vl_eval_expr(lhs_range->right);
+		else
+		    right = left;
+		assign_term->term_type = lhs_id->id_type;
+		assign_term->lo = left;
+		assign_term->hi = right;
+	    }
+	}
+
+	if (assign_term->lo > assign_term->hi) {
+	    if (assign_term->lo != 0 && assign_term->hi != -1) {
+		int temp;
+
+		temp = assign_term->lo;
+		assign_term->lo = assign_term->hi;
+		assign_term->hi = temp;
+	    }
+	}
+
+	if (lhs_list) {
+
+
+	    array_insert_last(vl_term*, assign_array, assign_term);
+	}
+    }
+
+    if (lhs_list) {
+	lsFinish(lhs_gen);
+	assign_term = concate_assigns(assign_array);
+	write_var_decl(file, assign_term);
+    }
+
+    switch(assign->type) {
+
+    case BassignStmt:
+    case NbassignStmt:
+    case AssignStmt: {
+
+	old_lhs_hi = lhs_hi;
+	old_lhs_lo = lhs_lo;
+	old_lhs_term = lhs_term;
+	lhs_hi = assign_term->hi;
+	lhs_lo = assign_term->lo;
+	lhs_term = assign_term;
+
+	vl_write_expr(file, assign->rhs, vars);
+
+	lhs_hi = old_lhs_hi;
+	lhs_lo = old_lhs_lo;
+	lhs_term = old_lhs_term;
+
+	break;
+    }
+
+    case DelayBassignStmt:  break;
+    case DelayNbassignStmt: break;
+
+    case EventBassignStmt:  break;
+    case EventNbassignStmt: break;
+    default: break;
+    }
+
+
+    if (!rst_ckt) {
+	if (!lhs_list)
+	    dump_debug_information(file, assign->lhs->name, assign_term,
+				   assign->lineno, ctrl_list, ctrl_syndrome);
+    }
+
+    if (vis_nond_var && !vars) {
+	return retval;
+    }
+
+
+    if (ISVLCONST(assign->rhs->type) && assign->rhs->type != BitExpr) {
+	vl_write_const(file, assign->rhs, assign_term);
+	if (!(assign_term->flag & MVar)) {
+
+	    var_info *cur_var;
+	    vl_term *orig_term;
+	    if (vars && !lhs_list) {
+
+		if (st_lookup(vars, lhs_id->name, (char**)&cur_var)) {
+		    orig_term = cur_var->current_terminal;
+		} else {
+		    orig_term = vl_create_term(assign->lhs->name, lo, hi);
+		}
+		patch_unaffected_term(file, lhs_id, orig_term, assign_term);
+	    } else if (lhs_list) {
+		connect_concat(file, assign_term, assign_array);
+	    }
+	}
+    } else {
+	if ((term_out->flag & MVar) == (assign->rhs->term->flag & MVar)) {
+	    if (assign->rhs->term->flag & MVar) {
+		vl_write_mv_connect(file, assign->rhs->term, assign_term);
+	    } else {
+		var_info *cur_var;
+		vl_term *orig_term;
+
+		vl_write_bin_connect(file, assign->rhs->term, assign_term,  0);
+
+		if (vars && !lhs_list) {
+		    if (st_lookup(vars, lhs_id->name, (char**)&cur_var)) {
+			orig_term = cur_var->current_terminal;
+		    } else {
+			orig_term = vl_create_term(assign->lhs->name, lo, hi);
+		    }
+		    patch_unaffected_term(file, lhs_id, orig_term, assign_term);
+		} else if (lhs_list) {
+		    connect_concat(file, assign_term, assign_array);
+		}
+	    }
+	} else {
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "connecting incompatible wires '%s' and '%s'",
+		    assign_term->name->name,assign->rhs->term->name->name);
+	    compile_error(buf);
+	}
+	vl_free_term(assign->rhs->term);
+    }
+
+    retval = term_out;
+
+    return retval;
+}
+
+
+st_table *vl_write_decl_list(FILE *file, void *decls, int muxed, vl_term *control, st_table *vars)
+{
+
+    file = file;
+    decls = decls;
+    muxed = muxed;
+    control = control;
+
+    return vars;
+}
+
+st_table *vl_write_stmt_list(FILE *file, lsList stmts, int muxed, vl_term *control, st_table *vars)
+{
+    void *stmt;
+    lsHandle handle;
+    lsGen gen;
+    st_table *new_vars;
+    lsList vars_list, pause_list;
+    set_t *pauseSet;
+
+    WrtTRACE("Writing stmt_list\n");
+
+    pauseSet = set_empty();
+    if (vl_pauseStack) push_stack(vl_pauseStack, (void*)pauseSet);
+    pause_list = lsCreate();
+    vars_list = lsCreate();
+
+    for (gen = lsStart(stmts);
+	 lsNext(gen, (lsGeneric*)&stmt, &handle) != LS_NOMORE; ) {
+	new_vars = vl_write_stmt(file, stmt, muxed, control, vars);
+
+
+	vars = new_vars;
+    }
+    (void) lsFinish(gen);
+    if (vl_pauseStack) pop_stack(vl_pauseStack, (void**)&pauseSet);
+    set_destroy(pauseSet);
+
+
+
+    lsDestroy(vars_list, 0);
+    lsDestroy(pause_list, (void (*)(lsGeneric))set_destroy);
+
+    return vars;
+}
+
+
+void vl_write_expr_list(FILE *file, lsList exprs, st_table *vars)
+{
+    vl_expr *expr;
+    lsHandle handle;
+    lsGen gen;
+
+    WrtTRACE("Writing expr_list\n");
+
+    if (!exprs) return;
+    gen = lsStart(exprs);
+    if (lsNext(gen, (lsGeneric*)&expr, &handle) == LS_OK) {
+	vl_write_expr(file, expr, vars);
+	while (lsNext(gen, (lsGeneric*)&expr, &handle) != LS_NOMORE) {
+	    vl_write_expr(file, expr, vars);
+	}
+    }
+    (void)lsFinish(gen);
+}
+
+
+
+void vl_write_expr(FILE *file, vl_expr *expr, st_table *vars)
+{
+    int lo, hi, sub_hi, sub_lo, inverted;
+    vl_term *term_in1, *term_in2, *term_out, *idx_term;
+    vl_id_range *id_sym;
+    var_info *id_var_info;
+    char term1[MAXSTRLEN/8];
+    char *ripple=NIL(char);
+    int auto_declared = 0;
+    int hibit;
+    FILE *bufStream;
+
+    if (!expr) return;
+
+    WrtTRACE("write expr");
+
+    switch (expr->type) {
+    case BitExpr:
+
+	hibit = strlen((char*)expr->u.exprs.e3)-1;
+	term_out = new_term(NIL(vl_range), 0, (hibit==0)?-1:hibit);
+	write_var_decl(file, term_out);
+	if (lhs_term)
+	    term_out->flag = lhs_term->flag;
+	vl_write_const(file, expr, term_out);
+	expr->term = term_out;
+	break;
+    case IntExpr: break;
+    case RealExpr: break;
+    case IDExpr:
+	if (vars) {
+
+	    if (st_lookup(vars, expr->u.name->name, (char**)&id_var_info)) {
+
+
+		expr->term = term_out =
+		    vl_copy_term(id_var_info->current_terminal);
+		break;
+	    }
+	}
+
+	{
+	    int const_expr;
+	    vl_id_range *ival;
+	    const_expr = 0;
+	    if (vl_currentModule->param_st) {
+		if (st_lookup(vl_currentModule->param_st,
+			      expr->u.name->name, (char**)&ival))
+		    const_expr = 1;
+	    }
+	    if (!const_expr && vl_encloseModule) {
+		if (vl_encloseModule->param_st)
+		    if (st_lookup(vl_encloseModule->param_st,
+				  expr->u.name->name, (char**)&ival))
+			const_expr = 1;
+	    }
+	    if (const_expr) {
+		write_const_param(file, expr, ival);
+		break;
+	    }
+	}
+
+
+
+	if (!st_lookup(vl_currentModule->sig_st,
+		       expr->u.name->name, (char**)&id_sym)){
+	    if (implicitDeclare) {
+		int retval;
+		st_insert(vl_currentModule->sig_st, expr->u.name->name,
+			  (char*)vl_create_id_range(expr->u.name->name,
+						    NIL(vl_range)));
+		retval = st_lookup(vl_currentModule->sig_st,expr->u.name->name,
+				   (char**)&id_sym);
+		assert(retval);
+		auto_declared = 1;
+	    } else {
+		char msg[MAXSTRLEN/8];
+		yylineno = -1;
+		sprintf(msg, "'%s':%s not defined",
+			vl_currentModule->name->name, expr->u.name->name);
+		compile_error(msg);
+	    }
+	} else {
+	    id_sym->flags |= AccessedVar;
+	}
+
+
+
+	if (sensitiveList) {
+
+	    if (check_rhs_sensitivity) {
+		if (!set_find(id_sym->name, sensitiveList)) {
+		    recordCombAlways = 0;
+		    if (vl_currentModule->combVar_st) {
+			vl_currentModule->combVar_st = NIL(set_t);
+			{
+			    char buf[MAXSTRLEN/8];
+			    sprintf(buf,
+				    "%s:combinational reduction failed on %s",
+				    vl_currentModule->name->name,
+				    id_sym->name);
+			    yylineno = -1;
+			    compile_error(buf);
+			}
+		    }
+		}
+	    }
+	}
+
+	get_hilo(id_sym, &hi, &lo);
+	if (!(id_sym->flags & RegVar) && !(id_sym->flags & InPort) &&
+	    !(id_sym->flags & WireVar) && in_procedure && wireRegister) {
+
+	    char buf[MAXSTRLEN/8];
+	    sprintf(buf, "%s%s", expr->u.name->name, PIN_HIDDEN);
+	    id_sym->flags |= HiddenLatch;
+	    expr->term = term_out =
+		create_rename_term(expr->u.name, vlStrdup(buf), lo, hi);
+	} else if (!((id_sym->flags & InPort) && (id_sym->flags & RegVar))) {
+	    expr->term = term_out =
+		vl_create_term(vl_copy_id_range(id_sym), lo, hi);
+	} else {
+
+	    char buf[MAXSTRLEN/8];
+	    expr->term = term_out =
+		vl_create_term(vl_copy_id_range(expr->u.name), lo, hi);
+	    sprintf(buf, "%s%s%s", expr->term->name->name, SEP_DIR, PIN_IN);
+	    vl_chk_free(expr->term->name->name);
+	    expr->term->name->name = vlStrdup(buf);
+	}
+	if (auto_declared) id_sym->flags |= AutoDeclared;
+	term_out->flag = id_sym->flags;
+	term_out->term_type = id_sym->id_type;
+	break;
+
+
+
+
+
+
+    case BitSelExpr:   case PartSelExpr:
+
+	if (vars) {
+
+	    int const_expr;
+	    vl_id_range *ival;
+	    const_expr = 0;
+	    if (vl_currentModule->param_st) {
+		if (st_lookup(vl_currentModule->param_st,
+			      expr->u.name->name, (char**)&ival))
+		    const_expr = 1;
+	    }
+	    if (!const_expr && vl_encloseModule) {
+		if (vl_encloseModule->param_st)
+		    if (st_lookup(vl_encloseModule->param_st,
+				  expr->u.name->name, (char**)&ival))
+			const_expr = 1;
+	    }
+	    if (const_expr) {
+		write_const_param(file, expr, ival);
+		break;
+	    }
+
+	    if (st_lookup(vars, expr->u.name->name, (char**)&id_var_info)) {
+
+		if (id_var_info->current_terminal->name->range) {
+
+		    vl_write_expr(file, expr->u.idrng->range->left, vars);
+		    idx_term = expr->u.idrng->range->left->term;
+		    expr->term = write_array_access(file,
+				     id_var_info->current_terminal->name,
+				     idx_term,
+				     expr->u.idrng->range->left);
+		    break;
+		}
+	    } else {
+
+		if (!st_lookup(vl_currentModule->sig_st,
+			       expr->u.name->name, (char**)&id_sym)) {
+		    char buf[MAXSTRLEN/8];
+		    sprintf(buf, "'%s': indexing into an undeclared var %s",
+			    vl_currentModule->name->name,
+			    expr->u.name->name);
+		    yylineno = -1;
+		    compile_error(buf);
+		}
+		if (id_sym->range) {
+		    vl_write_expr(file, expr->u.idrng->range->left, vars);
+		    idx_term = expr->u.idrng->range->left->term;
+		    expr->term = write_array_access(file, id_sym, idx_term,
+				     expr->u.idrng->range->left);
+		    break;
+		} else {
+
+		    expr = expr;
+
+		}
+	    }
+	} else {
+
+	    if (!st_lookup(vl_currentModule->sig_st,
+		      expr->u.name->name, (char**)&id_sym)) {
+		char buf[MAXSTRLEN/8];
+
+		sprintf(buf, "%s:'%s' is an undeclared indexing variable",
+			vl_currentModule->name->name, expr->u.name->name);
+		yylineno = -1;
+		compile_error(buf);
+	    }
+
+	    if (id_sym->range) {
+
+		vl_write_expr(file, expr->u.idrng->range->left, vars);
+		idx_term = expr->u.idrng->range->left->term;
+		expr->term = write_array_access(file, id_sym, idx_term,
+						expr->u.idrng->range->left);
+		break;
+	    }  else {
+
+		expr = expr;
+
+	    }
+	}
+
+
+
+	if (vars) {
+	    if (st_lookup(vars, expr->u.name->name, (char**)&id_var_info)) {
+
+		expr->term = vl_copy_term(id_var_info->current_terminal);
+		get_hilo(id_var_info->id, &hi, &lo);
+	    } else {
+
+		st_lookup(vl_currentModule->sig_st,
+			  expr->u.name->name, (char**)&id_sym);
+		get_hilo(id_sym, &hi, &lo);
+		expr->term = vl_create_term(vl_copy_id_range(expr->u.name),
+					    lo, hi);
+	    }
+	} else {
+
+	    st_lookup(vl_currentModule->sig_st,
+		      expr->u.name->name, (char**)&id_sym);
+	    get_hilo(id_sym, &hi, &lo);
+	    expr->term = vl_create_term(vl_copy_id_range(expr->u.name),
+					lo, hi);
+	}
+
+	if ((lo > hi) && (expr->term->flag & MVar)) {
+	    char buf[MAXSTRLEN/8];
+	    sprintf(buf,"idnexing into a scalar variable %s",
+		    expr->term->name->name);
+	    semantic_error(buf);
+	}
+
+
+	sub_lo = MAX(lo, vl_eval_expr(expr->u.idrng->range->left));
+	if (expr->u.idrng->range->right)
+	    sub_hi = MIN(hi, vl_eval_expr(expr->u.idrng->range->right));
+	else
+	    sub_hi = sub_lo;
+
+	if (sub_hi < sub_lo)
+	    if (sub_hi != -1 && sub_lo != 0) {
+		int temp;
+
+		temp = sub_lo;
+		sub_lo = sub_hi;
+		sub_hi = temp;
+	    }
+
+
+	expr->term->lo = sub_lo;
+	expr->term->hi = sub_hi;
+	break;
+
+
+    case MinTypMaxExpr:
+	vl_write_expr(file, expr->u.exprs.e1, vars);
+	expr->term = expr->u.exprs.e1->term;
+	break;
+    case ConcatExpr: {
+	vl_expr *e;
+	lsHandle handle;
+	lsGen gen=(lsGen)0;
+	int bitWidth=0;
+	int i, j, rep=1;
+	FILE *new_file;
+
+	expr->term = term_out = new_term(NIL(vl_range), 0, -1);
+	if (expr->u.exprs.e2) {
+	    rep = vl_eval_expr(expr->u.exprs.e2);
+	}
+
+	insideConcat = 1;
+	term_out->lo = -1;
+	term_out->hi = -1;
+	new_file = vl_begin_buffer();
+	j = 0;
+	for (i=0; i<rep; i++) {
+	    for (gen = lsEnd((lsList)(expr->u.exprs.e1));
+		 lsPrev(gen, (lsGeneric*)&e, &handle) != LS_NOMORE;) {
+		vl_write_expr(new_file, e, vars);
+		if (e->term) {
+		    bitWidth = (e->term->hi-e->term->lo+1);
+		    bitWidth = (bitWidth>0) ? bitWidth : 1;
+		    term_out->lo = term_out->hi + 1;
+		    term_out->hi = term_out->lo + bitWidth - 1;
+		    vl_write_bin_connect(new_file, e->term, term_out, 0);
+		} else {
+		  if (e->type == IntExpr) {
+		    bitWidth = min_bit_width(e->u.intval);
+		    bitWidth = (bitWidth>0) ? bitWidth : 1;
+		    e->term = new_term(NIL(vl_range), 0, bitWidth-1);
+		    write_int_connect(new_file, e->u.intval, e->term);
+		    term_out->lo = term_out->hi + 1;
+		    term_out->hi = term_out->lo + bitWidth - 1;
+		    vl_write_bin_connect(new_file, e->term, term_out, 0);
+		  } else {
+		    Translate_Warning("unknown width const in concatenation");
+		    bitWidth = 0;
+		  }
+		}
+		j++;
+	    }
+	}
+	term_out->lo = 0;
+	write_var_decl(file, term_out);
+	vl_append_buffer(file, new_file);
+	vl_close_buffer(new_file);
+	bitWidth--;
+	(void) lsFinish(gen);
+	insideConcat = 0;
+
+	break;
+    }
+
+    case StringExpr: break;
+    case FuncExpr:  {
+	vl_function *func_def;
+	if (vl_currentFunction) {
+	    vl_currentModule = vl_encloseModule;
+	}
+	if (!st_lookup(vl_currentModule->func_st,expr->u.func_call.name->name,
+		       (char**)&func_def)) {
+	    char buf[MAXSTRLEN/8];
+	    sprintf(buf, "'%s':function %s is used before declaration",
+		    vl_currentModule->name->name,
+		    expr->u.func_call.name->name);
+	    yylineno = -1;
+	    compile_error(buf);
+	} else {
+	    expr->term = instantiate_function(file, func_def,
+					      expr->u.func_call.args, vars);
+	}
+	if (vl_currentFunction) {
+	    vl_currentModule = (vl_module*)vl_currentFunction;
+	}
+	break;
+    }
+    case UplusExpr:    case UminusExpr: {
+	if (expr->type == UminusExpr) {
+	    vl_expr *fake_expr;
+	    fake_expr = vl_create_expr(BminusExpr, 0, (double)0.0,
+				       vl_create_expr(IntExpr, 0, (double)0.0,
+						      NIL(void), NIL(void),
+						      NIL(void)),
+				       expr->u.exprs.e1, NIL(void));
+	    vl_write_expr(file, fake_expr, vars);
+	    vl_chk_free((char*)fake_expr);
+	    expr->term = fake_expr->term;
+	} else {
+	    vl_write_expr(file, expr->u.exprs.e1, vars);
+	    expr->term = expr->u.exprs.e1->term;
+	}
+	break;
+    }
+
+    case UnotExpr:
+    case UcomplExpr:inverted=1; goto write_expr;
+
+    case UnandExpr: expr->type = UandExpr; inverted=1; goto write_expr;
+    case UnorExpr:  expr->type = UorExpr;  inverted=1; goto write_expr;
+    case UxnorExpr: expr->type = UxorExpr; inverted=1; goto write_expr;
+    case UandExpr:  inverted=0; goto write_expr;
+    case UorExpr:   inverted=0; goto write_expr;
+    case UxorExpr:  inverted=0;
+
+write_expr:
+
+	vl_write_expr(file, expr->u.exprs.e1, vars);
+	if (!expr->u.exprs.e1->term) {
+
+	    int val;
+	    val = vl_eval_expr(expr);
+	    expr->term = term_out = new_term(NIL(vl_range), 0, -1);
+	    vl_write_const(file, expr, expr->term);
+	    break;
+	}
+	vl_mv_to_bin(expr->u.exprs.e1->term);
+	term_in1=expr->u.exprs.e1->term;
+
+	expr->term = term_out = new_term(NIL(vl_range), 0, -1);
+
+	ripple = BLIF_GND;
+	if (term_in1->lo <= term_in1->hi) {
+	    if (expr->type != UcomplExpr) {
+		write_var_decl(file, term_out);
+		vl_write_vector_red_op(file, expr->type, term_in1, inverted,
+				       term_out);
+	    } else {
+		term_out->lo = term_in1->lo;
+		term_out->hi = term_in1->hi;
+		write_var_decl(file, term_out);
+		vl_write_bin_connect(file, term_in1, term_out, 1);
+	    }
+	} else {
+
+	    write_var_decl(file, term_out);
+	    vl_write_bit_connect(file,
+				 term_in1->name->name, term_out->name->name,
+				 inverted);
+	}
+	if (inverted) {
+	    switch (expr->type) {
+	    case UandExpr: expr->type = UnandExpr; break;
+	    case UorExpr:  expr->type = UnorExpr;  break;
+	    case UxorExpr: expr->type = UxnorExpr; break;
+	    }
+	}
+	vl_free_term(term_in1);
+	break;
+
+
+    case Beq3Expr:  case Bneq3Expr:
+    case Beq2Expr:  case Bneq2Expr:
+	expr->term = term_out = new_term(NIL(vl_range), 0, -1);
+
+	vl_write_expr(file, expr->u.exprs.e1, vars);
+	vl_write_expr(file, expr->u.exprs.e2, vars);
+
+	if (expr->u.exprs.e1->term && expr->u.exprs.e2->term) {
+	    if (expr->u.exprs.e1->term->flag & AutoDeclared &&
+		expr->u.exprs.e2->term->flag & AutoDeclared) {
+		char buf[MAXSTRLEN/8];
+		vl_step_expr(stderr, expr);
+		fprintf(stderr, "\n");
+		sprintf(buf,
+			"'%s': too many undefined variables for the binary operator\n",
+			vl_currentModule->name->name);
+		yylineno = -1;
+		compile_error(buf);
+	    }
+	}
+
+	if (!(expr->u.exprs.e1->term)) {
+	    lo = (expr->u.exprs.e2->term) ? expr->u.exprs.e2->term->lo : 0;
+	    hi = (expr->u.exprs.e2->term) ? expr->u.exprs.e2->term->hi :
+					    MAX(data_width(expr->u.exprs.e1),
+						data_width(expr->u.exprs.e2));
+	    expr->u.exprs.e1->term = new_term(NIL(vl_range), lo, hi);
+	    if (expr->u.exprs.e2->term) {
+		expr->u.exprs.e1->term->flag |= expr->u.exprs.e2->term->flag;
+		expr->u.exprs.e1->term->term_type =
+		    expr->u.exprs.e2->term->term_type;
+	    }
+	    write_var_decl(file, expr->u.exprs.e1->term);
+	    vl_write_const(file, expr->u.exprs.e1, expr->u.exprs.e1->term);
+	}
+	if (!(expr->u.exprs.e2->term)) {
+	    lo = (expr->u.exprs.e1->term) ? expr->u.exprs.e1->term->lo : 0;
+	    hi = (expr->u.exprs.e1->term) ? expr->u.exprs.e1->term->hi :
+					    MAX(data_width(expr->u.exprs.e2),
+						data_width(expr->u.exprs.e1));
+	    expr->u.exprs.e2->term = new_term(NIL(vl_range), lo, hi);
+	    if (expr->u.exprs.e1->term) {
+		expr->u.exprs.e2->term->flag |= expr->u.exprs.e1->term->flag;
+		expr->u.exprs.e2->term->term_type =
+		    expr->u.exprs.e1->term->term_type;
+	    }
+	    write_var_decl(file, expr->u.exprs.e2->term);
+	    vl_write_const(file, expr->u.exprs.e2, expr->u.exprs.e2->term);
+	}
+
+	if ((expr->u.exprs.e1->term->term_type &&
+	     !expr->u.exprs.e2->term->term_type) ||
+	    (expr->u.exprs.e2->term->term_type &&
+	     !expr->u.exprs.e1->term->term_type)) {
+	    vl_expr *e1, *e2;
+	    vl_enumerator *enum_elt;
+
+	    if (!expr->u.exprs.e1->term->term_type) {
+		e1 = expr->u.exprs.e2;
+		e2 = expr->u.exprs.e1;
+	    } else {
+		e1 = expr->u.exprs.e1;
+		e2 = expr->u.exprs.e2;
+	    }
+
+	    if (e2->type != IDExpr) {
+		char buf[MAXSTRLEN/8];
+		sprintf(buf, "'%s':comparing symbolic var '%s' with incompatible expr '%s'",
+			vl_currentModule->name->name,
+			e1->term->name->name, e2->term->name->name);
+		semantic_error(buf);
+	    }
+
+	    if (st_lookup(e1->term->term_type->specifier->
+			  u.enum_type->domain_st,
+			  e2->u.name->name,
+			  (char**)&enum_elt)) {
+		e2->term = typed_new_term(e1->term->term_type,
+					  e1->term->name->range,
+					  e1->term->lo, e1->term->hi);
+		e2->term->flag = e1->term->flag;
+		write_var_decl(file, e2->term);
+		e2->type = IntExpr;
+		e2->u.intval = enum_elt->val;
+		vl_write_const(file, e2, e2->term);
+	    } else {
+		char buf[MAXSTRLEN/8];
+
+		sprintf(buf, "'%s':comparing '%s' and '%s' of different domains",
+			vl_currentModule->name->name,
+			e1->term->name->name, e2->term->name->name);
+		semantic_error(buf);
+	    }
+	}
+
+	fprintf(file, "%s ", HSIS_COMMENT);
+	if (!NoDetailedComment)	vl_step_expr(file, expr);
+	fprintf(file, "\n");
+
+	term_in1=expr->u.exprs.e1->term;
+	term_in2=expr->u.exprs.e2->term;
+
+	term_in2->flag |= (term_in1->flag & MVar);
+
+	if ((term_in1->flag&MVar) == (term_in2->flag&MVar)) {
+	    if (term_in1->flag & MVar) {
+		vl_write_mv_comp(file, expr->type,
+				 term_in1, term_in2, term_out);
+	    } else {
+		vl_write_bin_comp(file, expr->type,
+				  term_in1, term_in2, term_out);
+	    }
+	} else if (term_in1->flag & MVar) {
+	    vl_mv_to_bin(term_in1);
+	    vl_write_bin_comp(file, expr->type,
+			      term_in1, term_in2, term_out);
+	} else if (term_in2->flag & MVar) {
+	    vl_mv_to_bin(term_in2);
+	    vl_write_bin_comp(file, expr->type,
+			      term_in1, term_in2, term_out);
+	}
+
+	vl_free_term(term_in1);
+	vl_free_term(term_in2);
+	break;
+
+    case BtimesExpr:  case BdivExpr:  case BremExpr:
+	sprintf(term1, "'%s':operator '*', '/', '%%' are not supported",
+		vl_currentModule->name->name);
+	yylineno = -1;
+	compile_error(term1);
+	break;
+    case BlshiftExpr: case BrshiftExpr:
+	sprintf(term1, "'%s':operator '<<', '>>' are not supported",
+		vl_currentModule->name->name);
+	yylineno = -1;
+	compile_error(term1);
+	break;
+
+    case BlandExpr: case BlorExpr:
+    case BltExpr:  case BleExpr:  case BgtExpr:  case BgeExpr:
+
+    case BplusExpr:  case BminusExpr:
+    case BandExpr:  case BorExpr:  case BxorExpr:  case BxnorExpr:
+	vl_write_expr(file, expr->u.exprs.e1, vars);
+	vl_write_expr(file, expr->u.exprs.e2, vars);
+	if (!(expr->u.exprs.e1->term)) {
+	    lo = (expr->u.exprs.e2->term) ? expr->u.exprs.e2->term->lo : 0;
+	    hi = (expr->u.exprs.e2->term) ? expr->u.exprs.e2->term->hi :
+		MAX(data_width(expr->u.exprs.e1)-1,
+		    data_width(expr->u.exprs.e2)-1);
+	    if (lo==0 && hi==0) hi = -1;
+	    expr->u.exprs.e1->term = new_term(NIL(vl_range), lo, hi);
+	    write_var_decl(file, expr->u.exprs.e1->term);
+	    vl_write_const(file, expr->u.exprs.e1, expr->u.exprs.e1->term);
+	}
+	if (!(expr->u.exprs.e2->term)) {
+	    lo = (expr->u.exprs.e1->term) ? expr->u.exprs.e1->term->lo : 0;
+	    hi = (expr->u.exprs.e1->term) ? expr->u.exprs.e1->term->hi :
+		MAX(data_width(expr->u.exprs.e2)-1,
+		    data_width(expr->u.exprs.e1)-1);
+	    if (lo==0 && hi==0) hi = -1;
+	    expr->u.exprs.e2->term = new_term(NIL(vl_range), lo, hi);
+	    write_var_decl(file, expr->u.exprs.e2->term);
+	    vl_write_const(file, expr->u.exprs.e2, expr->u.exprs.e2->term);
+	}
+	vl_mv_to_bin(expr->u.exprs.e1->term);
+	vl_mv_to_bin(expr->u.exprs.e2->term);
+
+	if (IS_VLR_LOG_OP(expr->type)) {
+	    if (vector_width(expr->u.exprs.e1->term->lo,
+			     expr->u.exprs.e1->term->hi) != 1) {
+		vl_term *red_term;
+		red_term = new_term(NIL(vl_range), 0, -1);
+		write_red_op(file, UorExpr,
+			     expr->u.exprs.e1->term, NIL(vl_term), red_term);
+		expr->u.exprs.e1->term = red_term;
+	    }
+	    if (vector_width(expr->u.exprs.e2->term->lo,
+			     expr->u.exprs.e2->term->hi) != 1) {
+		vl_term *red_term;
+		red_term = new_term(NIL(vl_range), 0, -1);
+		write_red_op(file, UorExpr,
+			     expr->u.exprs.e2->term, NIL(vl_term), red_term);
+		expr->u.exprs.e2->term = red_term;
+	    }
+	}
+	term_in1=expr->u.exprs.e1->term;
+	term_in2=expr->u.exprs.e2->term;
+
+	fprintf(file, "%s ", HSIS_COMMENT);
+	if (!NoDetailedComment)	vl_step_expr(file, expr);
+	fprintf(file, "\n");
+
+	expr->term = term_out = new_term(NIL(vl_range), 0, -1);
+	if (term_in1)
+	    if (term_in1->name->unintType)
+		expr->term->name->unintType = term_in1->name->unintType;
+	if (term_in2)
+	    if (term_in2->name->unintType)
+		expr->term->name->unintType = term_in2->name->unintType;
+
+	if (term_in1->lo > term_in1->hi) {
+	    term_out->lo = term_in2->lo;
+	    term_out->hi = term_in2->hi;
+	} else if (term_in2->lo > term_in2->hi) {
+	    term_out->lo = term_in1->lo;
+	    term_out->hi = term_in1->hi;
+	} else {
+	    term_out->lo = 0;
+
+	    term_out->hi = MAX(term_in1->hi-term_in1->lo,
+			       term_in2->hi-term_in2->lo);
+	}
+
+	if (expr->type == BplusExpr || expr->type ==BminusExpr) {
+	    if (vector_width(lhs_lo,lhs_hi) >
+		vector_width(term_out->lo,term_out->hi)) {
+		if (term_out->lo > term_out->hi)
+		    term_out->hi = 1;
+		else
+		    term_out->hi++;
+	    }
+	} else if (expr->type == BlshiftExpr || expr->type == BrshiftExpr) {
+	    if (vector_width(lhs_lo,lhs_hi) >
+		vector_width(term_out->lo, term_out->hi)) {
+	       term_out->lo = lhs_lo;
+	       term_out->hi = lhs_hi;
+	     }
+	}
+
+	bufStream = openStream();
+	if (Use_MV_Lib)
+	    vl_write_mv_lib(bufStream,
+			    expr->type, term_in1, term_in2, term_out);
+	else
+	    ripple = vl_write_vector_bop(bufStream, expr->type,
+					 term_in1, term_in2, term_out);
+	write_var_decl(file, term_out);
+	dumpStream(file, bufStream);
+	closeStream(bufStream);
+
+	if (Use_MV_Lib) {
+	    if (expr->type == BplusExpr || expr->type == BminusExpr) {
+		char buf[MAXSTRLEN/8];
+
+		sprintf(buf, "%s%s%d%s",
+			term_out->name->name,
+			SEP_LBITSELECT, ++term_out->hi, SEP_RBITSELECT);
+		vl_write_bit_connect(file, ripple, buf, 0);
+	    }
+	}
+
+	vl_free_term(term_in1);
+	vl_free_term(term_in2);
+	break;
+
+    case TcondExpr:
+	vl_write_expr(file, expr->u.exprs.e1, vars);
+	vl_write_expr(file, expr->u.exprs.e2, vars);
+	vl_write_expr(file, expr->u.exprs.e3, vars);
+	if (!(expr->u.exprs.e1->term)) {
+
+	    expr->u.exprs.e1->term = new_term(NIL(vl_range), 0, -1);
+	    vl_write_const(file, expr->u.exprs.e1, expr->u.exprs.e1->term);
+	}
+	if (!expr->u.exprs.e2->term && !expr->u.exprs.e3->term &&
+	    lhs_term) {
+	    lo = lhs_lo;  hi = lhs_hi;
+
+	    expr->u.exprs.e2->term = new_term(NIL(vl_range), lo, hi);
+	    expr->u.exprs.e2->term->flag = lhs_term->flag;
+	    expr->u.exprs.e2->term->term_type = lhs_term->term_type;
+	    write_var_decl(file, expr->u.exprs.e2->term);
+	    vl_write_const(file, expr->u.exprs.e2, expr->u.exprs.e2->term);
+
+	    expr->u.exprs.e3->term = new_term(NIL(vl_range), lo, hi);
+	    expr->u.exprs.e3->term->flag = lhs_term->flag;
+	    expr->u.exprs.e3->term->term_type = lhs_term->term_type;
+	    write_var_decl(file, expr->u.exprs.e3->term);
+	    vl_write_const(file, expr->u.exprs.e3, expr->u.exprs.e3->term);
+	}
+	if (!(expr->u.exprs.e2->term)) {
+	    lo = (expr->u.exprs.e3->term) ? expr->u.exprs.e3->term->lo : 0;
+	    hi = (expr->u.exprs.e3->term) ? expr->u.exprs.e3->term->hi :
+					    MAX(data_width(expr->u.exprs.e2),
+						data_width(expr->u.exprs.e3));
+	    expr->u.exprs.e2->term = new_term(NIL(vl_range), lo, hi);
+	    expr->u.exprs.e2->term->flag = expr->u.exprs.e3->term->flag;
+	    expr->u.exprs.e2->term->term_type =
+		expr->u.exprs.e3->term->term_type;
+	    write_var_decl(file, expr->u.exprs.e2->term);
+	    vl_write_const(file, expr->u.exprs.e2, expr->u.exprs.e2->term);
+	}
+	if (!(expr->u.exprs.e3->term)) {
+	    lo = (expr->u.exprs.e2->term) ? expr->u.exprs.e2->term->lo : 0;
+	    hi = (expr->u.exprs.e2->term) ? expr->u.exprs.e2->term->hi :
+					    MAX(data_width(expr->u.exprs.e3),
+						data_width(expr->u.exprs.e2));
+	    expr->u.exprs.e3->term = new_term(NIL(vl_range), lo, hi);
+	    expr->u.exprs.e3->term->flag = expr->u.exprs.e2->term->flag;
+	    expr->u.exprs.e3->term->term_type =
+		expr->u.exprs.e2->term->term_type;
+	    write_var_decl(file, expr->u.exprs.e3->term);
+	    vl_write_const(file, expr->u.exprs.e3, expr->u.exprs.e3->term);
+	}
+
+	if ((expr->u.exprs.e2->term->term_type &&
+	     !expr->u.exprs.e3->term->term_type) ||
+	    (expr->u.exprs.e3->term->term_type &&
+	     !expr->u.exprs.e2->term->term_type)) {
+	    vl_expr *e1, *e2;
+	    vl_enumerator *enum_elt;
+
+	    if (!expr->u.exprs.e2->term->term_type) {
+		e1 = expr->u.exprs.e3;
+		e2 = expr->u.exprs.e2;
+	    } else {
+		e1 = expr->u.exprs.e2;
+		e2 = expr->u.exprs.e3;
+	    }
+
+	    if (st_lookup(e1->term->term_type->specifier->
+			  u.enum_type->domain_st,
+			  e2->u.name->name,
+			  (char**)&enum_elt)) {
+		e2->term = typed_new_term(e1->term->term_type,
+					  e1->term->name->range,
+					  e1->term->lo, e1->term->hi);
+		e2->term->flag = e1->term->flag;
+		write_var_decl(file, e2->term);
+		e2->type = IntExpr;
+		e2->u.intval = enum_elt->val;
+		vl_write_const(file, e2, e2->term);
+	    } else {
+		char buf[MAXSTRLEN/8];
+
+		sprintf(buf, "'%s':comparing '%s' and '%s' of different domains",
+			vl_currentModule->name->name,
+			e1->term->name->name, e2->term->name->name);
+		semantic_error(buf);
+	    }
+	}
+
+	if (!expr->u.exprs.e2 && !expr->u.exprs.e3) {
+	    vl_expr *e;
+	    vl_enumerator *enum_elt;
+
+	    e = expr->u.exprs.e2;
+	    if (st_lookup(lhs_term->term_type->specifier->
+			  u.enum_type->domain_st,
+			  e->u.name->name, (char**)&enum_elt)) {
+		e->term = typed_new_term(lhs_term->term_type,
+					 lhs_term->name->range,
+					 lhs_term->lo, lhs_term->hi);
+		e->term->flag = lhs_term->flag;
+		write_var_decl(file, e->term);
+		e->type = IntExpr;
+		e->u.intval = enum_elt->val;
+		vl_write_const(file, e, e->term);
+	    } else {
+		char buf[MAXSTRLEN/8];
+
+		sprintf(buf, "'%s':assign '%s' to '%s' of different domains",
+			vl_currentModule->name->name,
+			e->term->name->name, lhs_term->name->name);
+		semantic_error(buf);
+	    }
+
+	    e = expr->u.exprs.e3;
+	    if (st_lookup(lhs_term->term_type->specifier->
+			  u.enum_type->domain_st,
+			  e->u.name->name, (char**)&enum_elt)) {
+		e->term = typed_new_term(lhs_term->term_type,
+					 lhs_term->name->range,
+					 lhs_term->lo, lhs_term->hi);
+		e->term->flag = lhs_term->flag;
+		write_var_decl(file, e->term);
+		e->type = IntExpr;
+		e->u.intval = enum_elt->val;
+		vl_write_const(file, e, e->term);
+	    } else {
+		char buf[MAXSTRLEN/8];
+
+		sprintf(buf, "'%s':assign '%s' to '%s' of different domains",
+			vl_currentModule->name->name,
+			e->term->name->name, lhs_term->name->name);
+		semantic_error(buf);
+	    }
+	}
+
+	term_in1=expr->u.exprs.e2->term;
+	term_in2=expr->u.exprs.e3->term;
+
+	fprintf(file, "%s ", HSIS_COMMENT);
+	if (!NoDetailedComment) vl_step_expr(file, expr);
+	fprintf(file, "\n");
+
+	expr->term = term_out = new_term(NIL(vl_range), 0, -1);
+	term_out->flag = term_in1->flag;
+	term_out->term_type = term_in1->term_type;
+
+	if (lhs_term) {
+	    if (insideConcat) {
+		if (vector_width(term_in1->lo, term_in1->hi) ==
+		    vector_width(term_in2->lo, term_in2->hi)) {
+
+
+		    term_out->lo = 0;
+		    term_out->hi = vector_width(term_in1->lo,term_in1->hi)-1;
+		} else {
+
+		    term_out->lo = lhs_term->lo;
+		    term_out->hi = lhs_term->hi;
+		}
+	    } else {
+		term_out->lo = lhs_term->lo;
+		term_out->hi = lhs_term->hi;
+	    }
+
+
+	    if (vector_width(term_in1->lo, term_in1->hi) <
+		vector_width(term_out->lo, term_out->hi)) {
+		vl_term *tmp_term;
+		tmp_term = new_term(NIL(vl_range), term_out->lo, term_out->hi);
+		write_var_decl(file, tmp_term);
+		expand_term(file, term_in1, tmp_term);
+		vl_free_term(term_in1);
+		term_in1 = tmp_term;
+	    } else if (vector_width(term_in1->lo, term_in1->hi) >
+		       vector_width(term_out->lo, term_out->hi)) {
+		vl_term *tmp_term;
+		tmp_term = new_term(NIL(vl_range), term_out->lo, term_out->hi);
+		write_var_decl(file, tmp_term);
+		shrink_term(file, term_in1, tmp_term);
+		vl_free_term(term_in1);
+		term_in1 = tmp_term;
+	    }
+	    if (vector_width(term_in2->lo, term_in2->hi) <
+		vector_width(term_out->lo, term_out->hi)) {
+		vl_term *tmp_term;
+		tmp_term = new_term(NIL(vl_range), term_out->lo, term_out->hi);
+		write_var_decl(file, tmp_term);
+		expand_term(file, term_in2, tmp_term);
+		vl_free_term(term_in2);
+		term_in2 = tmp_term;
+	    } else if (vector_width(term_in2->lo, term_in2->hi) >
+		       vector_width(term_out->lo, term_out->hi)) {
+		vl_term *tmp_term;
+		tmp_term = new_term(NIL(vl_range), term_out->lo, term_out->hi);
+		write_var_decl(file, tmp_term);
+		shrink_term(file, term_in2, tmp_term);
+		vl_free_term(term_in2);
+		term_in2 = tmp_term;
+	    }
+	} else {
+	    if (term_in1->lo > term_in1->hi) {
+
+		term_out->lo = term_in2->lo;
+		term_out->hi = term_in2->hi;
+	    } else if (term_in2->lo > term_in2->hi) {
+		term_out->lo = term_in1->lo;
+		term_out->hi = term_in1->hi;
+	    } else {
+		term_out->lo = 0;
+		if (term_in1->hi-term_in1->lo != term_in2->hi-term_in2->lo) {
+		    char buf[MAXSTRLEN/8];
+
+		    sprintf(buf, "'%s':different vector sizes %s %s",
+			    vl_currentModule->name->name,
+			    term_in1->name->name, term_in2->name->name);
+		    Translate_Warning(buf);
+		}
+		term_out->hi = MIN(term_in1->hi-term_in1->lo,
+				   term_in2->hi-term_in2->lo);
+	    }
+	}
+	write_var_decl(file, term_out);
+
+	instantiate_mux(file, term_in1, term_in2, expr->u.exprs.e1->term,
+			term_out);
+
+	vl_free_term(term_in1);
+	vl_free_term(term_in2);
+	break;
+
+    case NondExpr: {
+	vl_term *nond_term=NIL(vl_term), *ctrl_term=NIL(vl_term);
+	lsList nond_list;
+	lsGen gen;
+	lsHandle handle;
+	vl_expr *nexp;
+	int i;
+
+	if (vars && !rst_ckt)
+	    semantic_error("don't use $ND in procedural block");
+
+	nond_list = lsCreate();
+	if ((nd_check_ok == 0 && vis_nond) && !rst_ckt) {
+	    char buf[MAXSTRLEN/8];
+	    yylineno = -1;
+	    sprintf(buf, "'%s': The legal usage of $ND is continuous assignment:\n\tassign <var> = $ND(...);",
+		    vl_currentModule->name->name);
+	    compile_error(buf);
+	}
+	for (gen=lsStart(expr->u.expr_list), i=0;
+	     lsNext(gen, (lsGeneric*)&nexp, &handle) != LS_NOMORE; i++) {
+	    vl_write_expr(file, nexp, vars);
+	    if (nexp->type == EventExpr || nexp->type == PosedgeEventExpr ||
+		nexp->type == NegedgeEventExpr || nexp->type == OrEventExpr) {
+
+		ctrl_term = NIL(vl_term);
+	    } else {
+		lsNewEnd(nond_list, (lsGeneric)nexp, 0);
+	    }
+	}
+	lsFinish(gen);
+	nond_term = vl_write_nond_wire(file, ctrl_term, nond_list,
+				       lhs_term);
+	lsDestroy(nond_list, 0);
+	expr->term = nond_term;
+	if (!rst_ckt)
+	    nd_check_ok = -1;
+	break;
+    }
+    }
+
+    if (nd_check_ok == -1 && expr->type != NondExpr && vis_nond) {
+	char buf[MAXSTRLEN/8];
+	yylineno = -1;
+	sprintf(buf, "'%s': The legal usage of $ND is continuous assignment:\n\tassign <var> = $ND(...);",
+		vl_currentModule->name->name);
+	compile_error(buf);
+    }
+    if (nd_check_ok != -1)
+	nd_check_ok = 0;
+}
+
+
+
+set_t *vl_write_event_expr(FILE *file, vl_event_expr *event)
+{
+    set_t *retval=NIL(set_t);
+    vl_event_expr *e;
+    lsGen gen;
+    lsHandle handle;
+    st_generator *stgen;
+    vl_term *et;
+    char *dummy;
+    int i, j;
+
+    WrtTRACE("writing event_expr\n");
+    if (event == NIL(vl_event_expr)) return retval;
+
+    switch(event->type) {
+    case OrEventExpr:
+	retval = st_init_table(ptrcmp, ptrhash);
+	gen = lsStart(event->list);
+	while (lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE) {
+	    vl_write_event_expr(file, e);
+	    st_insert(retval, (char*)edge_triggering, 0);
+	}
+	lsFinish(gen);
+
+	assert(st_count(retval) == lsLength(event->list));
+	edge_triggering = new_term(NIL(vl_range), 0, -1);
+	fprintf(file, ".names ");
+	stgen = st_init_gen(retval);
+	while (st_gen(stgen, (char**)&et, &dummy)) {
+	    fprintf(file, "%s ", et->name->name);
+	}
+	st_free_gen(stgen);
+	fprintf(file, "%s\n%s 0\n",
+		edge_triggering->name->name, HSIS_DEFAULT);
+	for (i=0; i<st_count(retval); i++) {
+	    for (j=0; j<i; j++) fprintf(file, "- ");
+	    j++; fprintf(file, "1 ");
+	    for (; j<st_count(retval); j++) fprintf(file, "- ");
+	    fprintf(file, "1\n");
+	}
+	retval = NIL(set_t);
+
+
+	break;
+    case NegedgeEventExpr:
+	edge_triggering = write_edge_detector(file, event->expr, -1);
+	break;
+    case PosedgeEventExpr:
+	edge_triggering = write_edge_detector(file, event->expr, 1);
+	break;
+    case EdgeEventExpr:
+	break;
+    case EventExpr:
+
+	edge_triggering = write_edge_detector(file, event->expr, 0);
+	break;
+    default:
+	internal_error("Unexpected EventExpr Type");
+	break;
+    }
+
+    return retval;
+}
+
+
+
+int vl_eval_expr(vl_expr *expr)
+{
+    int i, val;
+    int min, typ, max;
+    double minf=0, typf=0, maxf=0;
+    int aux1_flag, aux2_flag, aux3_flag;
+
+    if (!expr) return 0;
+    switch (expr->type) {
+    case BitExpr: return expr->u.bexpr.part1;
+    case IntExpr: return expr->u.intval;
+    case RealExpr:
+      vl_expr_aux1_val = expr->u.realval;
+      vl_expr_aux1_flag = 1;
+      return (int)expr->u.realval;
+    case IDExpr:  {
+	vl_id_range *id_sym;
+	int cant_evaluate=0;
+	int cant_find=0;
+
+	if (vl_currentPrimitive)
+	    cant_evaluate = 1;
+	if (!vl_currentModule->param_st)
+	    cant_evaluate = 1;
+	if (!cant_evaluate)
+	    if (!st_lookup(vl_currentModule->param_st, expr->u.name->name,
+			   (char**)&id_sym))
+		cant_find = 1;
+	if (vl_encloseModule && !cant_evaluate)
+	    if (cant_find)
+		if (st_lookup(vl_encloseModule->param_st, expr->u.name->name,
+			       (char**)&id_sym))
+		    cant_find=0;
+	if (cant_evaluate || cant_find) {
+	    char buf[MAXSTRLEN];
+	    sprintf(buf, "%s:eval_expr:need constant instead of variable %s",
+		    vl_currentModule->name->name,
+		    expr->u.name->name);
+	    yylineno = -1;
+	    if (silent_err) {
+		Vlerrno = 1;
+		return 0;
+	    } else
+		compile_error(buf);
+	}
+
+	return (int)(id_sym->mpg_master_exp);
+    }
+    case BitSelExpr:   case PartSelExpr:
+      if (!silent_err) {
+	  vl_step_expr(stderr, expr);
+	  yylineno = -1;
+	  compile_error("need constant instead of variable");
+      } else {
+	  Vlerrno = 1;
+	  return 0;
+      }
+    case ConcatExpr: {
+	int i, rep=1;
+	int acc=0, val, width;
+	lsGen gen;
+	lsHandle handle;
+	vl_expr *e;
+	if (expr->u.exprs.e2) {
+	    rep = vl_eval_expr(expr->u.exprs.e2);
+	}
+	for (i=0; i<rep; i++) {
+	    for (gen=lsStart((lsList)(expr->u.exprs.e1));
+		 lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE;) {
+		if (e->type != BitExpr) width_unknown();
+		val = vl_eval_expr(e);
+		width = strlen((char*)e->u.exprs.e3);
+		acc = (acc << width) | val;
+	    }
+	    lsFinish(gen);
+	}
+
+	return acc;
+    }
+
+    case MinTypMaxExpr:
+      aux1_flag = aux2_flag = aux3_flag = 0;
+      min = vl_eval_expr(expr->u.exprs.e1);
+      aux1_flag=1;
+      if (vl_expr_aux1_val) minf=vl_expr_aux1_val;
+      else minf = min;
+      if (expr->u.exprs.e2) {
+	  typ = vl_eval_expr(expr->u.exprs.e2);
+	  aux2_flag=1;
+	  if (vl_expr_aux1_val) typf=vl_expr_aux1_val;
+	  else typf = typ;
+      }
+      if (expr->u.exprs.e3) {
+	  max = vl_eval_expr(expr->u.exprs.e2);
+	  aux3_flag=1;
+	  if (vl_expr_aux1_val) maxf=vl_expr_aux1_val;
+	  else maxf = max;
+      }
+      if (!vl_expr_aux3_flag) {
+	  aux3_flag = aux2_flag;
+	  aux2_flag = 0;
+	  max = typ;  maxf = typf;
+	  typ = 0;    typf = (double)0;
+      }
+      vl_expr_aux1_flag = aux1_flag;
+      vl_expr_aux2_flag = aux2_flag;
+      vl_expr_aux3_flag = aux3_flag;
+      vl_expr_aux1_val = minf;
+      vl_expr_aux2_val = typf;
+      vl_expr_aux3_val = maxf;
+      return min;
+    case StringExpr: break;
+    case FuncExpr:
+    case UplusExpr:  return vl_eval_expr(expr->u.exprs.e1);
+    case UminusExpr: return -vl_eval_expr(expr->u.exprs.e1);
+    case UnotExpr:   return !vl_eval_expr(expr->u.exprs.e1);
+    case UcomplExpr: return ~vl_eval_expr(expr->u.exprs.e1);
+
+    case UnandExpr: case UandExpr:
+    case UnorExpr:  case UorExpr:
+    case UxnorExpr: case UxorExpr:
+	Translate_Warning("reduction on constant");
+	for (i=0, val = vl_eval_expr(expr->u.exprs.e1); i<MAXBITNUM-2; i++) {
+	    switch (expr->type) {
+	    case UnandExpr: case UandExpr:
+		val = (val & 1) & (val >> 1); break;
+	    case UnorExpr:  case UorExpr:
+		val = (val & 1) | (val >> 1); break;
+	    case UxnorExpr: case UxorExpr:
+		val = (val & 1) ^ (val >> 1); break;
+	    }
+	    val >>= 1;
+	}
+	if (expr->type == UnandExpr ||
+	    expr->type == UnorExpr ||
+	    expr->type == UxnorExpr)
+	    val = !val;
+
+    case BtimesExpr:
+	return vl_eval_expr(expr->u.exprs.e1) * vl_eval_expr(expr->u.exprs.e2);
+    case BdivExpr:
+	return vl_eval_expr(expr->u.exprs.e1) / vl_eval_expr(expr->u.exprs.e2);
+    case BremExpr:
+	return vl_eval_expr(expr->u.exprs.e1) % vl_eval_expr(expr->u.exprs.e2);
+    case BlshiftExpr:
+	return vl_eval_expr(expr->u.exprs.e1) << vl_eval_expr(expr->u.exprs.e2);
+    case BrshiftExpr:
+	return vl_eval_expr(expr->u.exprs.e1) >> vl_eval_expr(expr->u.exprs.e2);
+
+
+
+    case Beq3Expr:
+	return vl_eval_expr(expr->u.exprs.e1) == vl_eval_expr(expr->u.exprs.e2);
+    case Bneq3Expr:
+	return vl_eval_expr(expr->u.exprs.e1) != vl_eval_expr(expr->u.exprs.e2);
+    case Beq2Expr:
+	return vl_eval_expr(expr->u.exprs.e1) == vl_eval_expr(expr->u.exprs.e2);
+    case Bneq2Expr:
+	return vl_eval_expr(expr->u.exprs.e1) != vl_eval_expr(expr->u.exprs.e2);
+
+    case BlandExpr:
+	return vl_eval_expr(expr->u.exprs.e1) && vl_eval_expr(expr->u.exprs.e2);
+    case BlorExpr:
+	return vl_eval_expr(expr->u.exprs.e1) || vl_eval_expr(expr->u.exprs.e2);
+    case BltExpr:
+	return vl_eval_expr(expr->u.exprs.e1) < vl_eval_expr(expr->u.exprs.e2);
+    case BleExpr:
+	return vl_eval_expr(expr->u.exprs.e1) <= vl_eval_expr(expr->u.exprs.e2);
+    case BgtExpr:
+	return vl_eval_expr(expr->u.exprs.e1) > vl_eval_expr(expr->u.exprs.e2);
+    case BgeExpr:
+	return vl_eval_expr(expr->u.exprs.e1) >= vl_eval_expr(expr->u.exprs.e2);
+    case BplusExpr:
+	return vl_eval_expr(expr->u.exprs.e1) + vl_eval_expr(expr->u.exprs.e2);
+    case BminusExpr:
+	return vl_eval_expr(expr->u.exprs.e1) - vl_eval_expr(expr->u.exprs.e2);
+    case BandExpr:
+	return vl_eval_expr(expr->u.exprs.e1) & vl_eval_expr(expr->u.exprs.e2);
+    case BorExpr:
+	return vl_eval_expr(expr->u.exprs.e1) | vl_eval_expr(expr->u.exprs.e2);
+    case BxorExpr:
+	return vl_eval_expr(expr->u.exprs.e1) ^ vl_eval_expr(expr->u.exprs.e2);
+    case BxnorExpr:
+	return ~(vl_eval_expr(expr->u.exprs.e1) ^vl_eval_expr(expr->u.exprs.e2));
+
+    case TcondExpr:
+	return (vl_eval_expr(expr->u.exprs.e1)) ?
+	    vl_eval_expr(expr->u.exprs.e2) : vl_eval_expr(expr->u.exprs.e3);
+    }
+
+    return 0;
+}
+
+
+st_table *create_var_muxes(FILE *file, vl_term *sel, st_table *t_vars, st_table *f_vars, st_table *vars)
+{
+    int lo=0, hi=0;
+    var_info *cur_var;
+    st_generator *gen;
+    var_info *t_in, *f_in;
+    char *key, buf[MAXSTRLEN];
+    vl_term *term_out;
+
+
+    gen = st_init_gen(t_vars);
+    while (st_gen(gen, &key, (char**)&t_in)) {
+
+	if (strstr(key,SEP_LATCH)) continue;
+	if (strstr(key,SEP_QUASI)) continue;
+
+	sprintf(buf, "%s%s%s%s%s%s",
+		t_in->id->name, SEP_GATEPIN, descape(sel->name->name,'\\','_'),
+		SEP_GATEPIN, PIN_RAWOUT, new_termname());
+	if (st_lookup(f_vars, key, (char**)&f_in)) {
+	    if (st_lookup(vars, key, (char**)&cur_var)) {
+		int t_in_cur_var, f_in_cur_var;
+
+		t_in_cur_var = !strcmp(t_in->current_terminal->name->name,
+				       cur_var->current_terminal->name->name);
+		f_in_cur_var = !strcmp(f_in->current_terminal->name->name,
+				       cur_var->current_terminal->name->name);
+
+
+		if ( t_in_cur_var && f_in_cur_var)
+		    continue;
+
+
+		if ((strstr(t_in->current_terminal->name->name, SEP_GATEPIN) ||
+		    strstr(f_in->current_terminal->name->name, SEP_GATEPIN)) &&
+		    !(t_in->current_terminal->hi == -1 ||
+		      f_in->current_terminal->hi == -1) &&
+		    (t_in->current_terminal->hi!=f_in->current_terminal->hi ||
+		     t_in->current_terminal->lo!=f_in->current_terminal->lo)) {
+		    if (t_in->current_terminal->hi !=
+			f_in->current_terminal->hi ||
+			t_in->current_terminal->lo !=
+			f_in->current_terminal->lo) {
+			int i, t_need_extend, f_need_extend;
+			char in_buf[MAXSTRLEN], out_buf[MAXSTRLEN];
+			vl_term *t_new_term=NIL(vl_term),
+				*f_new_term=NIL(vl_term);
+
+			hi = MAX(t_in->current_terminal->hi,f_in->current_terminal->hi);
+			lo = MIN(t_in->current_terminal->lo,f_in->current_terminal->lo);
+			t_need_extend = (hi > t_in->current_terminal->hi ||
+					 lo < t_in->current_terminal->lo);
+			f_need_extend = (hi > f_in->current_terminal->hi ||
+					 lo < f_in->current_terminal->lo);
+			if (t_need_extend) {
+			    t_new_term =
+			    typed_new_term(t_in->current_terminal->term_type,
+					   t_in->id->range, lo, hi);
+			    write_var_decl(file, t_new_term);
+			}
+			if (f_need_extend) {
+			    f_new_term =
+			    typed_new_term(f_in->current_terminal->term_type,
+					   f_in->id->range, lo, hi);
+			    write_var_decl(file, f_new_term);
+			}
+			for (i=lo; i<=hi; i++) {
+			    if (t_need_extend) {
+				if (i < t_in->current_terminal->lo ||
+				    i > t_in->current_terminal->hi) {
+				    var_info *curr_var_info;
+
+				    st_lookup(vars, t_in->id->name,
+					      (char**)&curr_var_info);
+				    if (i >=
+					curr_var_info->current_terminal->lo &&
+					i <=
+					curr_var_info->current_terminal->hi) {
+					sprintf(in_buf, "%s%s%d%s",
+					    curr_var_info->
+						current_terminal->name->name,
+						SEP_LBITSELECT,
+						i,
+						SEP_RBITSELECT);
+
+				    } else {
+					sprintf(in_buf, "%s%s%d%s",
+						t_in->id->name,
+						SEP_LBITSELECT,
+						i,
+						SEP_RBITSELECT);
+				    }
+				} else {
+				    sprintf(in_buf, "%s%s%d%s",
+					    t_in->current_terminal->name->name,
+					    SEP_LBITSELECT, i, SEP_RBITSELECT);
+				}
+				sprintf(out_buf, "%s%s%d%s",
+					t_new_term->name->name,
+					SEP_LBITSELECT, i, SEP_RBITSELECT);
+				vl_write_bit_connect(file, in_buf, out_buf, 0);
+			    }
+			    if (f_need_extend) {
+				if (i < f_in->current_terminal->lo ||
+				    i > f_in->current_terminal->hi) {
+				    var_info *curr_var_info;
+
+				    st_lookup(vars, t_in->id->name,
+					      (char**)&curr_var_info);
+				    if (i >=
+					curr_var_info->current_terminal->lo &&
+					i <=
+					curr_var_info->current_terminal->hi) {
+					sprintf(in_buf, "%s%s%d%s",
+					    curr_var_info->
+						current_terminal->name->name,
+						SEP_LBITSELECT,
+						i,
+						SEP_RBITSELECT);
+				  } else {
+				    sprintf(in_buf, "%s%s%d%s",
+					    f_in->id->name,
+					    SEP_LBITSELECT,
+					    i,
+					    SEP_RBITSELECT);
+				  }
+				} else {
+				    sprintf(in_buf, "%s%s%d%s",
+					    f_in->current_terminal->name->name,
+					    SEP_LBITSELECT, i, SEP_RBITSELECT);
+				}
+				sprintf(out_buf, "%s%s%d%s",
+					f_new_term->name->name,
+					SEP_LBITSELECT, i, SEP_RBITSELECT);
+				vl_write_bit_connect(file, in_buf, out_buf, 0);
+			    }
+			}
+			if (t_need_extend)
+			    t_in->current_terminal = t_new_term;
+			if (f_need_extend)
+			    f_in->current_terminal = f_new_term;
+		    }
+		} else {
+		    if (t_in->current_terminal->hi-t_in->current_terminal->lo>=
+			f_in->current_terminal->hi-f_in->current_terminal->lo){
+			lo = t_in->current_terminal->lo;
+			hi = t_in->current_terminal->hi;
+		    } else {
+			lo = f_in->current_terminal->lo;
+			hi = f_in->current_terminal->hi;
+		    }
+		}
+		term_out = create_rename_term(t_in->id, buf, lo, hi);
+		term_out->flag = t_in->current_terminal->flag;
+
+		write_var_decl(file, term_out);
+		instantiate_mux(file,
+				t_in->current_terminal,
+				f_in->current_terminal,
+				sel, term_out);
+		cur_var->current_terminal = term_out;
+
+
+		if (!t_in_cur_var && !f_in_cur_var) {
+		    continue;
+		}
+
+
+		if (!t_in_cur_var && f_in_cur_var) {
+		    continue;
+		}
+
+
+		if (t_in_cur_var && !f_in_cur_var) {
+		    continue;
+		}
+	    }
+	}
+    }
+    st_free_gen(gen);
+
+    gen = st_init_gen(t_vars);
+    while (st_gen(gen, &key, (char**)&t_in)) {
+
+	if (strstr(key,SEP_LATCH)) continue;
+	if (strstr(key,SEP_QUASI)) continue;
+
+	sprintf(buf, "%s%s%s%s%s%s",
+		t_in->id->name, SEP_GATEPIN, descape(sel->name->name,'\\','_'),
+		SEP_GATEPIN, PIN_RAWOUT, new_termname());
+	if (st_lookup(f_vars, key, (char**)&f_in)) {
+	    if (!st_lookup(vars, key, (char**)&cur_var)) {
+
+		if (t_in->current_terminal->hi-t_in->current_terminal->lo >=
+		    f_in->current_terminal->hi-f_in->current_terminal->lo) {
+		    lo = t_in->current_terminal->lo;
+		    hi = t_in->current_terminal->hi;
+		} else {
+		    lo = f_in->current_terminal->lo;
+		    hi = f_in->current_terminal->hi;
+		}
+		term_out = create_rename_term(t_in->id, buf, lo, hi);
+		term_out->flag |= t_in->current_terminal->flag;
+		write_var_decl(file, term_out);
+		instantiate_mux(file, t_in->current_terminal,
+				f_in->current_terminal,
+				sel, term_out);
+
+
+		assert(!st_lookup(vars,key,(char**)&cur_var));
+		st_insert(vars, key,
+			  (char*)create_var_info(vl_copy_id_range(t_in->id),
+						 term_out));
+
+
+	    }
+	}
+    }
+    st_free_gen(gen);
+
+
+
+    gen = st_init_gen(t_vars);
+    while (st_gen(gen, &key, (char**)&t_in)) {
+
+	if (strstr(key,SEP_LATCH)) continue;
+	if (strstr(key,SEP_QUASI)) continue;
+
+	sprintf(buf, "%s%s%s%s%s%s",
+		t_in->id->name, SEP_GATEPIN, descape(sel->name->name,'\\','_'),
+		SEP_GATEPIN, PIN_RAWOUT, new_termname());
+	if (!st_lookup(f_vars, key, (char**)&f_in)) {
+	    vl_term *orig_id;
+	    char *dummy;
+
+
+	    term_out = create_rename_term(t_in->id, buf,
+					  t_in->current_terminal->lo,
+					  t_in->current_terminal->hi);
+	    term_out->flag |= t_in->current_terminal->flag;
+	    orig_id =
+		vl_create_term(((t_in->id->flags & EventVar) && smartEvent)?
+			       vl_create_id_range(WRT_BLIF_GND(file),
+						  NIL(vl_range))           :
+			       vl_copy_id_range(t_in->id),
+				     t_in->current_terminal->lo,
+				     t_in->current_terminal->hi);
+	    if (vl_currentModule->combVar_st)
+		if (st_lookup(vl_currentModule->combVar_st,
+			      orig_id->name->name, &dummy)) {
+		    vl_free_term(orig_id);
+		    orig_id = true_term(file);
+		}
+	    if (vl_currentFunction) {
+		vl_free_term(orig_id);
+		orig_id = true_term(file);
+	    }
+	    orig_id->flag = t_in->current_terminal->flag;
+	    write_var_decl(file, term_out);
+	    if (rst_ckt) {
+		instantiate_mux(file, t_in->current_terminal,
+				t_in->current_terminal,
+				sel, term_out);
+	    } else {
+		instantiate_mux(file, t_in->current_terminal, orig_id,
+				sel, term_out);
+	    }
+	    vl_free_term(orig_id);
+
+	    st_insert(vars, key,
+		      (char*)create_var_info(vl_copy_id_range(t_in->id),
+					     term_out));
+	}
+    }
+    st_free_gen(gen);
+
+
+
+    gen = st_init_gen(f_vars);
+    while (st_gen(gen, &key, (char**)&f_in)) {
+
+	if (strstr(key,SEP_LATCH)) continue;
+	if (strstr(key,SEP_QUASI)) continue;
+
+	sprintf(buf, "%s%s%s%s%s%s",
+		f_in->id->name, SEP_GATEPIN, descape(sel->name->name,'\\','_'),
+		SEP_GATEPIN, PIN_RAWOUT, new_termname());
+	if (!st_lookup(t_vars, key, (char**)&t_in)) {
+	    vl_term *orig_id;
+
+
+	    term_out = create_rename_term(f_in->id, buf,
+					  f_in->current_terminal->lo,
+					  f_in->current_terminal->hi);
+	    term_out->flag |= f_in->current_terminal->flag;
+	    orig_id =
+		vl_create_term(((f_in->id->flags & EventVar) && smartEvent)?
+				   vl_create_id_range(WRT_BLIF_GND(file),
+						      NIL(vl_range))       :
+				   vl_copy_id_range(f_in->id),
+				     f_in->current_terminal->lo,
+				     f_in->current_terminal->hi);
+	    orig_id->flag = f_in->current_terminal->flag;
+
+	    write_var_decl(file, term_out);
+	    if (rst_ckt) {
+		instantiate_mux(file, f_in->current_terminal,
+				f_in->current_terminal,
+				sel, term_out);
+	    } else {
+		instantiate_mux(file, orig_id, f_in->current_terminal,
+				sel, term_out);
+	    }
+	    vl_free_term(orig_id);
+
+	    st_insert(vars, key,
+		      (char*)create_var_info(vl_copy_id_range(f_in->id),
+					     term_out));
+	}
+    }
+    st_free_gen(gen);
+
+    return vars;
+}
+
+
+vl_term *write_case_comparator(FILE *file, vl_term *selector, lsList tags, st_table *vars)
+{
+    int j;
+    vl_expr *expr;
+    lsHandle handle;
+    lsGen gen;
+    vl_term *term_out;
+    vl_term *comp_result;
+    char buf[MAXSTRLEN];
+
+    if (!tags) return NIL(vl_term);
+
+    buf[0] = '\0';
+    term_out = new_term(NIL(vl_range), 0, -1);
+
+    for (gen = lsStart(tags);
+	 lsNext(gen, (lsGeneric*)&expr, &handle) != LS_NOMORE; ) {
+	comp_result = new_term(NIL(vl_range), 0, -1);
+
+	write_case_tag_const(file, selector, expr, vars);
+
+	write_comparator(file, selector, expr->term, comp_result);
+	strcat(buf, comp_result->name->name);
+	strcat(buf, " ");
+	vl_free_term(comp_result);
+	comp_result = NIL(vl_term);
+	vl_free_term(expr->term);
+	expr->term = NIL(vl_term);
+    }
+    (void)lsFinish(gen);
+
+    fprintf(file, ".names %s %s\n", buf, term_out->name->name);
+
+    fprintf(file, ".def 1\n");
+    for (j=0; j<lsLength(tags); j++) {
+	fprintf(file, "0 ");
+    }
+    fprintf(file, "0\n");
+
+    return term_out;
+}
+
+char *vl_write_vector_bop(FILE *file, short type, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    char *ripple = NIL(char);
+
+    if (ISREDUCTION(type)) {
+	ripple = write_red_op(file, type, in1, in2, out);
+    } else if (IS_VLR_REL_OP(type)) {
+	ripple = write_rel_vector_bop(file, type, in1, in2, out);
+    } else {
+	ripple = write_op_vector_bop(file, type, in1, in2, out);
+    }
+
+    return ripple;
+}
+
+
+#define BLIF_BITCONNECT   0
+#define BLIF_NOT          1
+#define BLIF_AND          2
+#define BLIF_NAND         3
+#define BLIF_OR           4
+#define BLIF_NOR          5
+#define BLIF_XOR          6
+#define BLIF_XNOR         7
+#define BLIF_ADD          8
+#define BLIF_SUB          10
+#define BLIF_MUX          12
+
+#define EXPR_TO_BLIF_FUNC(exprval) \
+    ((exprval)==BlandExpr)? BLIF_AND : \
+    ((exprval)==BlorExpr) ? BLIF_OR  : \
+    ((exprval)==BandExpr) ? BLIF_AND : \
+    ((exprval)==BorExpr)  ? BLIF_OR  : \
+    ((exprval)==BxorExpr) ? BLIF_XOR : \
+    ((exprval)==BxnorExpr)? BLIF_XNOR: \
+    ((exprval)==BplusExpr)? BLIF_ADD : \
+    ((exprval)==BminusExpr)?BLIF_SUB : \
+    ((exprval)==BltExpr)  ? BLIF_SUB : \
+    ((exprval)==BleExpr)  ? BLIF_SUB : \
+    ((exprval)==BgtExpr)  ? BLIF_SUB : \
+    ((exprval)==BgeExpr)  ? BLIF_SUB : \
+    ((exprval)==UandExpr) ? BLIF_AND : \
+    ((exprval)==UnandExpr)? BLIF_NAND: \
+    ((exprval)==UorExpr)  ? BLIF_OR  : \
+    ((exprval)==UnorExpr) ? BLIF_NOR : \
+    ((exprval)==UxorExpr) ? BLIF_XOR : 0
+
+#define EXPR_TO_SMV_FUNC(exprval) \
+    ((exprval)==BlandExpr)? SMV_AND : \
+    ((exprval)==BlorExpr) ? SMV_OR  : \
+    ((exprval)==BandExpr) ? SMV_AND : \
+    ((exprval)==BorExpr)  ? SMV_OR  : \
+    ((exprval)==BxnorExpr)? SMV_EQUIV:\
+    ((exprval)==BxorExpr) ? SMV_EQUIV: "???"
+
+static char *log_function[] = {
+    "0 0  \n1 1  \n",
+    "0 1  \n1 0  \n",
+    "0 0 0\n0 1 0\n1 0 0\n1 1 1\n",
+    "0 0 1\n0 1 1\n1 0 1\n1 1 0\n",
+    "0 0 0\n0 1 1\n1 0 1\n1 1 1\n",
+    "0 0 1\n0 1 0\n1 0 0\n1 1 0\n",
+    "0 0 0\n0 1 1\n1 0 1\n1 1 0\n",
+    "0 0 1\n0 1 0\n1 0 0\n1 1 1\n",
+    "0 0 0 0\n0 0 1 1\n0 1 0 1\n0 1 1 0\n1 0 0 1\n1 0 1 0\n1 1 0 0\n1 1 1 1\n",
+    "0 0 0 0\n0 0 1 0\n0 1 0 0\n0 1 1 1\n1 0 0 0\n1 0 1 1\n1 1 0 1\n1 1 1 1\n",
+    "0 0 0 0\n0 0 1 1\n0 1 0 1\n0 1 1 0\n1 0 0 1\n1 0 1 0\n1 1 0 0\n1 1 1 1\n",
+    "0 0 0 0\n0 0 1 1\n0 1 0 1\n0 1 1 1\n1 0 0 0\n1 0 1 0\n1 1 0 0\n1 1 1 1\n",
+    "0 - 0 0\n1 - 0 1\n- 0 1 0\n- 1 1 1\n"
+    };
+
+static char *set_log_function[] = {
+    "0 0  \n1 1  \n",
+    "0 1  \n1 0  \n",
+    ".def 0\n1 1 1\n",
+    ".def 1\n1 1 0\n",
+    ".def 1\n0 0 0\n",
+    ".def 0\n0 0 1\n",
+    ".def 0\n0 1 1\n1 0 1\n",
+    ".def 1\n0 1 0\n1 0 0\n",
+    ".def 0\n0 0 1 1\n0 1 0 1\n1 0 0 1\n1 1 1 1\n",
+    ".def 0\n- 1 1 1\n1 - 1 1\n1 1 - 1\n",
+    ".def 0\n0 0 1 1\n0 1 0 1\n1 0 0 1\n1 1 1 1\n",
+    ".def 0\n0 - 1 1\n0 1 - 1\n- 1 1 1\n",
+    "0 - 0 0\n1 - 0 1\n- 0 1 0\n- 1 1 1\n"
+    };
+
+
+char *vl_write_bop(FILE *file, short type, char *in1, char *in2, char *auxin, char *out, int forbidden_ripple)
+{
+    int mv_func;
+    char sbuf[MAXSTRLEN];
+    static char ripplenet[MAXSTRLEN];
+    char **func;
+
+    func = (set_notation)?set_log_function:log_function;
+    switch(type) {
+    case BlandExpr: case BlorExpr:
+    case BandExpr:  case BorExpr:  case BxorExpr:  case BxnorExpr:
+	mv_func = EXPR_TO_BLIF_FUNC(type);
+	fprintf(file, ".names %s %s %s\n", in1, in2, out);
+	fprintf(file, "%s", func[mv_func]);
+	sprintf(sbuf, "%s", out);
+	break;
+    case UnotExpr: type = UorExpr;
+
+    case UandExpr:  case UnandExpr:
+    case UorExpr:  case UnorExpr:
+    case UxorExpr:    case UxnorExpr:
+	sprintf(sbuf, "%s", new_termname());
+	mv_func = EXPR_TO_BLIF_FUNC(type);
+	fprintf(file, ".names %s %s %s\n", in1, in2, sbuf);
+	fprintf(file, "%s", func[mv_func]);
+	sprintf(ripplenet, "%s", sbuf);
+	break;
+    case BplusExpr:  case BminusExpr:
+    case BltExpr:  case BleExpr:  case BgtExpr:  case BgeExpr:
+	mv_func = EXPR_TO_BLIF_FUNC(type);
+	fprintf(file, ".names %s %s %s %s\n",
+		in1, in2,
+		(auxin)?auxin:WRT_BLIF_GND(file), (out)?out:new_termname());
+	fprintf(file, "%s", func[mv_func]);
+	if (!forbidden_ripple) {
+	    sprintf(sbuf, "%s", new_termname());
+	    fprintf(file, "%s carry/borrow\n", HSIS_COMMENT);
+	    fprintf(file, ".names %s %s %s %s\n",
+		    in1, in2, (auxin)?auxin:WRT_BLIF_GND(file), sbuf);
+	    fprintf(file, "%s", func[mv_func+1]);
+	    sprintf(ripplenet, "%s", sbuf);
+	}
+	break;
+    }
+
+    return ripplenet;
+}
+
+
+static void vl_write_vector_red_op(FILE *file, short type,
+				   vl_term *in, int inverted,
+				   vl_term *out)
+{
+    int i;
+    char rip_buf[MAXSTRLEN], in1[MAXSTRLEN], in2[MAXSTRLEN];
+
+    if (in->lo == in->hi) {
+	if (out->lo > out->hi) {
+	    sprintf(in1, "%s%s%d%s", in->name->name,
+		    SEP_LBITSELECT, in->lo, SEP_RBITSELECT);
+	    sprintf(in2, "%s", out->name->name);
+	    vl_write_bit_connect(file, in1, in2, inverted);
+	    return;
+	} else {
+	    sprintf(in1, "%s%s%d%s", in->name->name,
+		    SEP_LBITSELECT, in->lo, SEP_RBITSELECT);
+	    sprintf(in2, "%s%s%d%s", out->name->name,
+		    SEP_LBITSELECT, in->lo, SEP_RBITSELECT);
+	    vl_write_bit_connect(file, in1, in2, inverted);
+	    return;
+	}
+    }
+
+    sprintf(rip_buf, "%s", new_termname());
+    sprintf(in1, "%s%s%d%s", in->name->name,
+	    SEP_LBITSELECT, in->lo, SEP_RBITSELECT);
+    sprintf(in2, "%s%s%d%s", in->name->name,
+	    SEP_LBITSELECT, in->lo+1, SEP_RBITSELECT);
+    strcpy(rip_buf,
+	   vl_write_bop(file, type, in1, in2, NIL(char), NIL(char), 1));
+
+    for (i=in->lo+2; i<=in->hi; i++) {
+	strcpy(in1, rip_buf);
+	sprintf(in2, "%s%s%d%s", in->name->name,
+		SEP_LBITSELECT, i, SEP_RBITSELECT);
+	strcpy(rip_buf,
+	       vl_write_bop(file, type, in1, in2, NIL(char), NIL(char), 1));
+    }
+
+    vl_write_bit_connect(file, rip_buf, out->name->name, inverted);
+}
+
+
+
+void vl_write_bit_connect(FILE *file, char *in, char *out, int inverted)
+{
+    char **func;
+
+    func = (set_notation)?set_log_function:log_function;
+    fprintf(file, ".names %s %s\n", in, out);
+
+    if (set_notation) {
+	if (!inverted)
+	    fprintf(file, "- %s%s\n", HSIS_EQUAL, in);
+	else
+	    fprintf(file, "%s", func[BLIF_NOT]);
+    } else {
+	if (!inverted)
+	    fprintf(file, "%s", func[BLIF_BITCONNECT]);
+	else
+	    fprintf(file, "%s", func[BLIF_NOT]);
+    }
+}
+
+void write_comparator(FILE *file, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    if ((in1->flag&MVar) == (in2->flag&MVar)) {
+	if (in1->flag & MVar) {
+	    vl_write_mv_comp(file, (short)Beq2Expr, in1, in2, out);
+	} else {
+	    vl_write_bin_comp(file, (short)Beq2Expr, in1, in2, out);
+	}
+    } else if (in1->flag & MVar) {
+	vl_mv_to_bin(in1);
+	vl_write_bin_comp(file, (short)Beq2Expr, in1, in2, out);
+    } else if (in1->flag & MVar) {
+	vl_mv_to_bin(in2);
+	vl_write_bin_comp(file, (short)Beq2Expr, in1, in2, out);
+   }
+}
+
+
+vl_term *instantiate_function(FILE *file, vl_function *master, lsList args, st_table *vars)
+{
+    vl_port_connect *i_port;
+    vl_term *retval;
+    int hi, lo, temp;
+    int constConnection;
+    lsGen mast_gen, inst_gen, gen;
+    lsHandle mast_handle, inst_handle, handle;
+    vl_id_range *m;
+    vl_expr *i;
+    const_term *ct;
+    vl_enumerator *enum_elt;
+    lsList input_consts;
+
+    i_port = vl_create_port_connect(ModuleConnect,
+				    NIL(vl_id_range), NIL(vl_expr));
+    input_consts = lsCreate();
+
+    if (lsLength(args)!=0 && lsLength(master->ports)!=0) {
+	mast_gen = lsStart(master->ports);
+	inst_gen = lsStart(args);
+	lsNext(mast_gen, (lsGeneric*)&m, &mast_handle);
+
+	while (lsNext(inst_gen, (lsGeneric*)&i, &inst_handle) != LS_NOMORE &&
+	       lsNext(mast_gen, (lsGeneric*)&m, &mast_handle) != LS_NOMORE) {
+	    if (!st_lookup(master->sig_st, m->name, (char**)&m)) {
+		char buf[MAXSTRLEN];
+
+		sprintf(buf, "port '%s' is not defined in module '%s'",
+			m->name, master->name->name);
+		semantic_error(buf);
+	    }
+
+	    vl_write_expr(file, i, vars);
+	}
+	lsFinish(inst_gen);
+	lsFinish(mast_gen);
+    }
+
+
+    if (master->range) {
+	lo = vl_eval_expr(master->range->left);
+	hi = vl_eval_expr(master->range->right);
+	if (hi < lo) {
+	    temp = hi;
+	    hi = lo;
+	    lo = temp;
+	}
+    } else {
+	lo = 0;
+	hi = -1;
+    }
+    retval = new_term(NIL(vl_range), lo, hi);
+    write_var_decl(file, retval);
+
+    fprintf(file, ".subckt %s %s ", master->name->name, new_termname());
+
+    if (lsLength(args)!=0 && lsLength(master->ports)!=0) {
+	mast_gen = lsStart(master->ports);
+	inst_gen = lsStart(args);
+	lsNext(mast_gen, (lsGeneric*)&m, &mast_handle);
+	if (lo > hi) {
+
+	    put_bin_scalar_func_connect(file, m, retval);
+	} else {
+
+	    put_bin_vector_func_connect(file, m, retval);
+	}
+	while (lsNext(inst_gen, (lsGeneric*)&i, &inst_handle) != LS_NOMORE &&
+	       lsNext(mast_gen, (lsGeneric*)&m, &mast_handle) != LS_NOMORE) {
+
+	    constConnection = 0;
+	    if (!i) {
+		constConnection = 1;
+	    } else if (!i->term) {
+		constConnection = 1;
+	    } else {
+		if (m->id_type) {
+		    if (i->type == IDExpr &&
+			st_lookup(m->id_type->specifier->
+				    u.enum_type->domain_st,
+				  i->u.name->name,
+				  (char**)&enum_elt))
+			constConnection = 1;
+		}
+	    }
+
+	    i_port->expr = i;
+
+	    if (constConnection) {
+
+		put_const_port_connect(file, NIL(char),
+				       m, i_port, input_consts, retval);
+		continue;
+	    }
+
+	    if (m->flags & MVar) {
+
+		put_mvar_port_connect(file, NIL(char), m, i_port);
+	    } else {
+		get_hilo(m, &hi, &lo);
+		if (lo > hi) {
+
+		    put_bin_scalar_port_connect(file, NIL(char), m, i_port);
+		} else {
+
+		    put_bin_vector_port_connect(file, NIL(char), m, i_port);
+		}
+	    }
+	}
+	lsFinish(inst_gen);
+	lsFinish(mast_gen);
+
+	fprintf(file, "\n");
+
+	gen = lsStart(input_consts);
+	while(lsNext(gen, (lsGeneric*)&ct, &handle) != LS_NOMORE) {
+	    if (!isOutPort(ct->term->flag))
+		write_var_decl(file, ct->term);
+		vl_write_const(file, ct->const_expr, ct->term);
+	}
+	lsFinish(gen);
+
+	lsDestroy(input_consts, 0);
+    }
+
+    return retval;
+}
+
+
+void connect_func_output(FILE *file, vl_id_range *out_id_sym, st_table *vars)
+{
+    vl_id_range *orig_id_sym;
+    var_info *var;
+    int hi, lo;
+    int old_flags;
+    int retval;
+
+    if (!st_lookup(vars, out_id_sym->name, (char**)&var)) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "function %s has no return value", out_id_sym->name);
+	yylineno = -1;
+	compile_error(buf);
+    }
+
+    retval = st_lookup(vl_currentFunction->sig_st, out_id_sym->name,
+		       (char**)&orig_id_sym);
+    assert(retval);
+    get_hilo(orig_id_sym, &hi, &lo);
+    old_flags = orig_id_sym->flags;
+    orig_id_sym->flags &= ~RegVar;
+
+
+    if (var->current_terminal->flag & MVar) {
+	instantiate_mvar_latch(file, 0, 0, lo, hi,
+			       out_id_sym, orig_id_sym, var,
+			       orig_id_sym->name);
+    } else {
+	if (lo > hi) {
+	    instantiate_bin_scalar_latch(file, 0, 0,
+					 out_id_sym, orig_id_sym, var,
+					 orig_id_sym->name);
+	} else {
+	    instantiate_bin_vector_latch(file, 0, 0, lo, hi,
+					 out_id_sym, orig_id_sym, var,
+					 orig_id_sym->name);
+	}
+    }
+
+    orig_id_sym->flags = old_flags;
+}
+
+
+
+void instantiate_latch(FILE *file, st_table *vars)
+{
+    vl_id_range *id_sym, *orig_id_sym;
+    st_generator *gen;
+    char *key, *ps_buf, *dummy;
+    var_info *var, *lvar;
+    blif_latch *latch;
+    char latch_name[MAXSTRLEN];
+    int lo, hi;
+    int non_block_var;
+
+
+    fprintf(file, "%s latches\n", HSIS_COMMENT);
+    gen = st_init_gen(vars);
+    while (st_gen(gen, &key, (char**)&var)) {
+	sprintf(latch_name, "%s%s", key, SEP_LATCH);
+	if (vl_currentModule->latch_st) {
+	    if (st_lookup(vl_currentModule->sig_st, key, (char**)&id_sym)) {
+		if (!(id_sym->flags & RegVar)  &&
+		    !str_matchtail(id_sym->name,SEP_LATCH))
+		    continue;
+		non_block_var = str_matchtail(id_sym->name,SEP_LATCH);
+
+		if (st_lookup(vl_currentModule->latch_st, key, (char**)&latch))
+		    if (latch->flags & NBASSIGN_IN_ALWAYS)
+			continue;
+
+		if (dflow_analysis &&
+		    !(id_sym->flags & OutPort) && !(id_sym->flags & InPort) &&
+		    !(str_matchtail(id_sym->name,SEP_LATCH)) &&
+		    !set_find(id_sym->name, vl_currentModule->uninit_set))
+		    continue;
+
+		if (!st_lookup(vars, latch_name, (char**)&lvar)) lvar = var;
+
+		get_hilo(var->id, &hi, &lo);
+
+		ps_buf = vlStrdup(var->id->name);
+		if (str_matchtail(id_sym->name,SEP_LATCH)) {
+		    strip_char(ps_buf,SEP_LATCH);
+		    st_lookup(vl_currentModule->sig_st,
+			      ps_buf, (char**)&orig_id_sym);
+		} else {
+		    orig_id_sym = id_sym;
+		}
+
+
+		if (st_lookup(vl_currentModule->quasi_st,
+			      ps_buf, (char**)&dummy)){
+		    char *old_termname;
+		    char *dc;
+		    int n_entries;
+		    char qbuf[MAXSTRLEN];
+		    vl_id_range *qid_sym;
+		    int retval;
+		    sprintf(qbuf, "%s%s", ps_buf, SEP_QUASI);
+		    retval = st_lookup(vl_currentModule->sig_st,
+				       qbuf, (char**)&qid_sym);
+		    assert(retval);
+		    old_termname = lvar->current_terminal->name->name;
+		    dc = check_dc((!rst_ckt)?qid_sym->syndrome_expr_list:
+				  qid_sym->rst_syndrome_expr_list);
+		    n_entries = lsLength((!rst_ckt)?
+					 qid_sym->syndrome_expr_list:
+					 qid_sym->rst_syndrome_expr_list);
+
+		    lvar->current_terminal->name->name =
+			vlStrdup(new_termname());
+		    write_var_decl(file, lvar->current_terminal);
+		    put_quasi_table(file, dc, ps_buf, old_termname,
+				    qid_sym, lvar->current_terminal,
+				    lo, hi, n_entries);
+		    vl_chk_free(old_termname);
+		    vl_chk_free(dc);
+		}
+
+
+		if (!use_rst_ckt && (orig_id_sym->flags  & RegVar)) {
+
+		    if ((lsLength(id_sym->initial)==0) && Warn_Uninitialized) {
+			char buf[MAXSTRLEN];
+			sprintf(buf, "%s:%s: uninitialized",
+				vl_currentModule->name->name, id_sym->name);
+			Translate_Notice(buf);
+		    }
+
+		    if ((orig_id_sym->flags) & MVar) {
+
+			reset_mvar_latch(file, non_block_var,
+					       id_sym, lo, hi, ps_buf);
+		    } else {
+
+			if (lo > hi) {
+
+			    reset_bin_scalar_latch(file, non_block_var,
+						   id_sym, ps_buf);
+			} else {
+
+			    reset_bin_vector_latch(file, non_block_var,
+						   id_sym, lo, hi, ps_buf);
+			}
+		    }
+		} else {
+
+		    if (lsLength(id_sym->initial)>0 &&
+			get_decl_flags(var->id->mpg_master_exp) & RegVar) {
+
+
+
+			instantiate_reset_mux(file, id_sym, lo, hi, var, lvar);
+		    }
+		}
+
+
+		if (var->current_terminal->flag & MVar) {
+		    instantiate_mvar_latch(file, non_block_var, mark_sel_var,
+					   lo, hi,
+					   id_sym, orig_id_sym, lvar, ps_buf);
+		} else {
+		    if (lo > hi) {
+			instantiate_bin_scalar_latch(file,
+			    non_block_var, mark_sel_var,
+			    id_sym, orig_id_sym, lvar, ps_buf);
+		    } else {
+			instantiate_bin_vector_latch(file,
+			    non_block_var, mark_sel_var, lo, hi,
+			    id_sym, orig_id_sym, lvar, ps_buf);
+		    }
+		}
+		vl_chk_free(ps_buf);
+	    }
+	}
+    }
+    st_free_gen(gen);
+
+
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, &key, (char**)&id_sym)) {
+	instantiate_input_latch(file, id_sym);
+	if (wireRegister)
+	    instantiate_hidden_latch(file, id_sym);
+    }
+    st_free_gen(gen);
+}
+
+
+static void instantiate_prim_latch(FILE *file, st_table *sig_st)
+{
+    st_generator *sig_gen;
+    vl_id_range *id_sym;
+    char *key;
+
+    sig_gen = st_init_gen(sig_st);
+    while (st_gen(sig_gen, (char**)&key, (char**)&id_sym)) {
+	if (!(id_sym->flags & RegVar)) continue;
+
+	fprintf(file, ".latch %s%s %s\n",
+		id_sym->name, SEP_LATCH, id_sym->name);
+	fprintf(file, ".r %s\n-\n", id_sym->name);
+    }
+    st_free_gen(sig_gen);
+}
+
+
+static void instantiate_edge_detector(FILE *file, vl_primitive *prim)
+{
+    lsGen port_gen;
+    lsHandle port_handle, port_id_handle;
+    vl_port *port;
+    vl_id_range *port_id, *port_id_sym;
+
+    port_gen = lsStart(prim->ports);
+    while (lsNext(port_gen, (lsGeneric*)&port, &port_handle) != LS_NOMORE) {
+	int retval;
+	lsFirstItem(port->port_exp, (lsGeneric*)&port_id, &port_id_handle);
+	retval = st_lookup(prim->sig_st, port_id->name, (char**)&port_id_sym);
+	assert(retval);
+
+	if (port_id_sym->flags & EdgeDetector) {
+	    fprintf(file, ".latch %s %s%s\n",
+		    port_id_sym->name, port_id_sym->name, PIN_DELAYED);
+	    fprintf(file, ".r %s%s\n-\n", port_id_sym->name, PIN_DELAYED);
+	}
+    }
+    lsFinish(port_gen);
+}
+
+
+static char *lib_fun[][2] = {
+    {"vlr_mux", " %s a=%s b=%s s=%s o=%s\n"}
+    };
+
+
+void vl_put_lib(FILE *file, ...)
+{
+    char buf[MAXSTRLEN];
+    char typ_buf[MAXSTRLEN];
+    char *cp, *tcp;
+    int code;
+    va_list args;
+    vl_term *type_term;
+    void *decl;
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+    va_start(args, file);
+    code = va_arg(args, int);
+    type_term = va_arg(args, vl_term*);
+
+    cp = buf; *cp = '\0';
+    cp = strappendS(cp, ".subckt");
+    cp = strappend(cp, lib_fun[code][0]);
+
+    tcp = typ_buf; *tcp = '\0';
+    tcp = strappend(tcp, SEP_LTRANGE);
+
+    if (type_term->flag & MVar) {
+	(void) va_arg(args, char*);
+	(void)vfprintf(file, ".names %s %s %s %s\n", args);
+	if (!st_lookup(mod_list->decl_st,
+		       (char*)type_term->term_type, (char**)&decl)) {
+	    st_insert(mod_list->decl_st,
+		      (char*)type_term->term_type,
+		      (char*)type_term->term_type);
+	}
+	domain = type_term->term_type->specifier->u.enum_type->domain_list;
+	for (enum_gen=lsStart(domain);
+	     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+		 LS_NOMORE;) {
+	    fprintf(file, "%s - 1 %s\n", enum_elt->name, enum_elt->name);
+	    fprintf(file, "- %s 0 %s\n", enum_elt->name, enum_elt->name);
+	}
+	lsFinish(enum_gen);
+    } else {
+	char *tbuf, *fbuf, *selbuf, *obuf;
+	(void) va_arg(args, char*);
+	tbuf = va_arg(args, char *);
+	fbuf = va_arg(args, char *);
+	selbuf = va_arg(args, char *);
+	obuf = va_arg(args, char *);
+	fprintf(file, ".names %s %s %s %s\n.def 0\n",
+		selbuf, tbuf, fbuf, obuf);
+	fprintf(file, "1 1 - 1\n0 - 1 1\n");
+    }
+    va_end(args);
+}
+
+
+void vl_write_mv_lib(FILE *file, short type, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    int i;
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+    fprintf(file, ".subckt ");
+    switch(type) {
+    case BandExpr: fprintf(file, "%s", BLIF_LIB_AND); break;
+    case BorExpr:  fprintf(file, "%s", BLIF_LIB_OR); break;
+    case BxorExpr: fprintf(file, "%s", BLIF_LIB_XOR); break;
+    case BxnorExpr:fprintf(file, "%s", BLIF_LIB_XNOR); break;
+    case BplusExpr: fprintf(file, "%s", BLIF_LIB_ADD); break;
+    case BminusExpr:fprintf(file, "%s", BLIF_LIB_SUB); break;
+    case UandExpr:  case UnandExpr:
+    case UorExpr:  case UnorExpr:
+    case UxorExpr:    case UxnorExpr: break;
+    }
+    if (in1->term_type != in2->term_type) {
+	char buf[MAXSTRLEN];
+	sprintf(buf,"operation between var %s & %s of different types",
+		in1->name->name, in2->name->name);
+	semantic_error(buf);
+    }
+
+    domain = in1->term_type->specifier->u.enum_type->domain_list;
+
+    fprintf(file, "%s", SEP_LTRANGE);
+    for (enum_gen=lsStart(domain), i=1;
+	 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;
+	 i++)
+	fprintf(file, "%s%c", enum_elt->name, (i==lsLength(domain)?'\0':':'));
+    fprintf(file, "%s", SEP_RTRANGE);
+    fprintf(file, " %s %s %s %s\n", new_termname(),
+	    in1->name->name, in2->name->name, out->name->name);
+}
+
+
+st_table *conflict_arbitrator(FILE *file, array_t *vars_array)
+{
+    st_generator *gen;
+    st_table *vars, *retval;
+    char *key;
+    var_info *cur_var;
+    array_t *controls;
+    vl_term *ctrl_i;
+    int lo, hi;
+    int num_changer;
+    int i;
+    vl_id_range *id_sym, *temp_id_sym;
+
+    fprintf(file,"%s conflict arbitrators\n", HSIS_COMMENT);
+    retval = st_init_table(strcmp, st_strhash);
+
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, &key, (char**)&id_sym)) {
+
+	if ((id_sym->flags & InPort) && !(id_sym->flags & OutPort)) continue;
+
+	if (!vl_currentPrimitive && !vl_currentFunction) {
+	    if (strstr(key,SEP_LATCH))
+		continue;
+	    if (strstr(key,SEP_QUASI))
+		continue;
+	}
+
+	if (!vl_currentPrimitive && !vl_currentFunction)
+	    if (dflow_analysis &&
+		!(id_sym->flags & OutPort) && !(id_sym->flags & InPort) &&
+		!(str_matchtail(id_sym->name,SEP_LATCH)) &&
+		!set_find(id_sym->name, vl_currentModule->uninit_set))
+		continue;
+
+	if (!(id_sym->flags & RegVar) &&
+	    !str_matchtail(id_sym->name,SEP_LATCH)) {
+	    create_wire_nondeterminism(file, key, id_sym, vars_array);
+	    continue;
+	}
+
+	if (!vl_currentPrimitive && !vl_currentFunction)
+	    if (vl_currentModule->combVar_st) {
+		if (st_lookup(vl_currentModule->combVar_st,
+			      id_sym->name, (char**)&temp_id_sym) &&
+		    !st_lookup(vl_currentModule->seqVar_st,
+			       id_sym->name, (char**)&temp_id_sym)){
+		    create_wire_nondeterminism(file, key, id_sym, vars_array);
+		    continue;
+		}
+	    }
+
+	controls = array_alloc(vl_term*, 0);
+
+	num_changer = 0;
+	for (i=0; i<array_n(vars_array); i++) {
+	    vars = array_fetch(st_table*, vars_array, i);
+	    if (vars) {
+		if (st_lookup(vars, key, (char**)&cur_var)) {
+		    ctrl_i = syndrome_to_control(file, key, vars);
+		    array_insert_last(vl_term*, controls, ctrl_i);
+		    num_changer++;
+		    continue;
+		}
+	    }
+	    array_insert_last(vl_term*, controls, NIL(vl_term));
+	}
+
+	assert(array_n(vars_array) == array_n(controls));
+	get_hilo(id_sym, &hi, &lo);
+	if (id_sym->flags &MVar) {
+
+	    create_mvar_nondeterminism(file, retval, key, id_sym, lo, hi,
+				       controls, vars_array);
+	} else {
+
+	    if (lo > hi) {
+
+		create_bin_scalar_nondeterminism(file, retval, key, id_sym,
+						 controls, vars_array);
+	    } else {
+
+		create_bin_vector_nondeterminism(file, retval, key, id_sym,
+						 lo, hi, controls, vars_array);
+	    }
+	}
+
+    }
+    st_free_gen(gen);
+
+    return retval;
+}
+
+
+st_table *func_conflict_arbitrator(FILE *file, vl_id_range *out_id_sym, array_t *vars_array)
+{
+    st_generator *gen;
+    st_table *retval;
+    char *key;
+    int old_flags;
+    vl_id_range *id_sym, *temp_id_sym;
+    blif_latch *latch;
+
+    fprintf(file,"%s conflict arbitrators\n", HSIS_COMMENT);
+    retval = st_init_table(strcmp, st_strhash);
+
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, &key, (char**)&id_sym)) {
+
+	if (id_sym->flags & InPort) continue;
+
+	if (!vl_currentPrimitive && !vl_currentFunction)
+	    if (st_lookup(vl_currentModule->latch_st, key, (char**)&latch) ||
+		strstr(key,SEP_LATCH)) continue;
+
+	if (!vl_currentPrimitive && !vl_currentFunction)
+	    if (dflow_analysis &&
+		!(id_sym->flags & OutPort) && !(id_sym->flags & InPort) &&
+		!(str_matchtail(id_sym->name,SEP_LATCH)) &&
+		!set_find(id_sym->name, vl_currentModule->uninit_set))
+		continue;
+
+	if (!(id_sym->flags & RegVar) &&
+	    !str_matchtail(id_sym->name,SEP_LATCH)) {
+	    create_wire_nondeterminism(file, key, id_sym, vars_array);
+	    continue;
+	}
+
+	if (!vl_currentPrimitive && !vl_currentFunction)
+	    if (vl_currentModule->combVar_st) {
+		if (st_lookup(vl_currentModule->combVar_st,
+			      id_sym->name, (char**)&temp_id_sym)){
+		    create_wire_nondeterminism(file, key, id_sym, vars_array);
+		    continue;
+		}
+	    }
+
+	if (vl_currentFunction && strcmp(out_id_sym->name, key))
+	    continue;
+	else {
+	    old_flags = id_sym->flags;
+	    id_sym->flags &= ~RegVar;
+
+	    create_wire_nondeterminism(file, key, id_sym, vars_array);
+
+	    id_sym->flags = old_flags;
+	}
+    }
+    st_free_gen(gen);
+
+    return retval;
+}
+
+static void vl_write_initial_generator(FILE *file)
+{
+    char buf[MAXSTRLEN];
+
+
+    if (ith_module!=0) return;
+
+
+    if (!use_rst_ckt) return;
+
+    sprintf(buf, "%s%s", Initial_Signal->name->name, "_PS");
+    fprintf(file, ".r %s\n1\n", Initial_Signal->name->name);
+    fprintf(file, ".names %s\n", buf);
+    fprintf(file, "0\n");
+    fprintf(file, ".latch %s %s\n", buf, Initial_Signal->name->name);
+}
+
+
+static void vl_write_encoding(FILE *file)
+{
+    st_generator *id_gen, *symbolic_gen;
+    char *key, *symbolic_value, *code;
+    vl_id_range *id_sym;
+    int hi, lo, v;
+    int idx, idx_lo, idx_hi;
+    int i;
+
+    if (!do_encoding) return;
+
+    id_gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(id_gen, &key, (char**)&id_sym)) {
+	if (id_sym->symbolic_values) {
+	    if (!st_count(id_sym->symbolic_values)) continue;
+	    if (!(id_sym->flags & MVar)) {
+		get_hilo(id_sym, &hi, &lo);
+		if (lo < hi) {
+		    if (!id_sym->range) {
+			fprintf(file, ".encode ");
+			for (i=lo; i<=hi; i++)
+			    fprintf(file, "%s%s%d%s ", id_sym->name,
+				    SEP_LBITSELECT, i, SEP_RBITSELECT);
+			fprintf(file, "%s\n", id_sym->name);
+			symbolic_gen = st_init_gen(id_sym->symbolic_values);
+			while (st_gen(symbolic_gen, &symbolic_value, &code)) {
+			    for (i=lo, v=atoi(code); i<=hi; i++, v >>= 1)
+				fprintf(file, "%d ", v&1);
+			    fprintf(file, "%s\n", symbolic_value);
+			}
+			st_free_gen(symbolic_gen);
+			fprintf(file, ".endcode\n\n");
+		    } else {
+			idx_lo = vl_eval_expr(id_sym->range->left);
+			if (id_sym->range->right)
+			    idx_hi = vl_eval_expr(id_sym->range->right);
+			else
+			    idx_hi = idx_lo;
+
+			for (idx=idx_lo; idx<=idx_hi; idx++) {
+			    fprintf(file, ".encode ");
+			    for (i=lo; i<=hi; i++)
+				fprintf(file, "%s%s%d%s%s%d%s ", id_sym->name,
+					SEP_LARRAY, idx, SEP_RARRAY,
+					SEP_LBITSELECT, i, SEP_RBITSELECT);
+			    fprintf(file, "%s%s%d%s\n",
+				    id_sym->name, SEP_LARRAY, idx, SEP_RARRAY);
+			    symbolic_gen =
+				st_init_gen(id_sym->symbolic_values);
+			    while (st_gen(symbolic_gen,
+					  &symbolic_value, &code)) {
+				for (i=lo, v=atoi(code); i<=hi; i++, v >>= 1)
+				    fprintf(file, "%d ", v&1);
+				fprintf(file, "%s\n", symbolic_value);
+			    }
+			    st_free_gen(symbolic_gen);
+			    fprintf(file, ".endcode\n\n");
+			}
+		    }
+		}
+	    }
+	}
+    }
+    st_free_gen(id_gen);
+}
+
+static void non_block_assignment(FILE *file, st_table *vars)
+{
+    st_generator *gen;
+    lsList ripple=(lsList)0;
+    char *key;
+    char latch_name[MAXSTRLEN];
+    char *dc;
+    vl_id_range *id_sym, *orig_id_sym;
+    var_info *id_var;
+    vl_term *out_term;
+    vl_term *procedural_ctrl, *procedural_term;
+    int n_entries, hi, lo;
+    int non_block_wire = 0;
+
+    fprintf(file, "%s non-blocking assignments %s\n",
+	    HSIS_COMMENT, (rst_ckt)?"for initial":"");
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, &key, (char**)&id_sym)) {
+	non_block_wire = 0;
+	ripple = (lsList)0;
+	procedural_ctrl = NIL(vl_term);
+	procedural_term = NIL(vl_term);
+	if (!strstr(key,SEP_LATCH)) continue;
+
+	if (!rst_ckt && lsLength(id_sym->syndrome_expr_list)==0) continue;
+	if (rst_ckt && lsLength(id_sym->rst_syndrome_expr_list)==0) continue;
+
+
+	strcpy(latch_name, id_sym->name);
+	strip_char(latch_name, SEP_LATCH);
+
+	if (rst_ckt &&
+	    !st_lookup(vars, latch_name, (char**)&id_var) &&
+	    !st_lookup(vars, key, (char**)&id_var)) continue;
+
+
+	if (st_lookup(vars, latch_name, (char**)&id_var)) {
+	    if (id_var->extra) {
+		procedural_ctrl = array_or(file, (array_t*)(id_var->extra));
+		procedural_term = id_var->current_terminal;
+		decomposeTable = 1;
+	    }
+	}
+
+	if (st_lookup(vl_currentModule->sig_st,
+		      latch_name, (char**)&orig_id_sym)) {
+	    vl_id_range *temp_id_sym;
+
+	    if (!(orig_id_sym->flags&RegVar)) non_block_wire = 1;
+
+	    if (vl_currentModule->combVar_st) {
+		if (st_lookup(vl_currentModule->combVar_st,
+			      latch_name, (char**)&temp_id_sym)) {
+
+		    non_block_wire = 1;
+		}
+	    }
+	}
+	n_entries = lsLength((!rst_ckt)?
+			     id_sym->syndrome_expr_list:
+			     id_sym->rst_syndrome_expr_list);
+	get_hilo(id_sym, &hi, &lo);
+	out_term = new_term(id_sym->range, lo, hi);
+	out_term->flag = id_sym->flags;
+	out_term->term_type = id_sym->id_type;
+	out_term->name->unintType = id_sym->unintType;
+	write_var_decl(file, out_term);
+
+
+	dc = check_dc((!rst_ckt)?id_sym->syndrome_expr_list:
+				 id_sym->rst_syndrome_expr_list);
+
+	if ((id_sym->flags & MVar) || (lo > hi)) {
+
+	    if (!id_sym->range) {
+		put_nblock_scalar_simple_table(file, dc, id_sym,
+		    non_block_wire, latch_name, out_term,
+		    n_entries, lo, hi, ripple,
+		    procedural_ctrl, procedural_term);
+	    } else {
+		put_nblock_scalar_array_table(file, dc, id_sym,
+					      non_block_wire,
+					      latch_name, out_term,
+					      n_entries, lo, hi, ripple);
+	    }
+	} else {
+
+	    put_nblock_vector_table(file, dc, id_sym,
+				    non_block_wire,
+				    latch_name, out_term,
+				    n_entries, lo, hi, &ripple,
+				    procedural_ctrl, procedural_term);
+	}
+
+
+	st_insert(vars, key,
+		  (char*)create_var_info(vl_copy_id_range(id_sym), out_term));
+
+	vl_chk_free(dc);
+    }
+    st_free_gen(gen);
+}
+
+
+static void quasi_cont_assignment(FILE *file)
+{
+    st_generator *gen;
+    char *key;
+    vl_id_range *id_sym;
+    char quasi_name[MAXSTRLEN];
+    char sync_name[MAXSTRLEN];
+    char *dc;
+    int n_entries, hi, lo;
+    vl_term *out_term;
+
+    fprintf(file, "%s quasi-continuous assignment\n", HSIS_COMMENT);
+
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, &key, (char**)&id_sym)) {
+	if (!strstr(key,SEP_QUASI)) continue;
+	if (!rst_ckt && lsLength(id_sym->syndrome_expr_list) == 0) continue;
+	if (rst_ckt && lsLength(id_sym->rst_syndrome_expr_list) == 0) continue;
+
+	strcpy(quasi_name, id_sym->name);
+	strip_char(quasi_name, SEP_QUASI);
+
+	get_hilo(id_sym, &hi, &lo);
+	out_term = new_term(id_sym->range, lo, hi);
+	out_term->flag = id_sym->flags;
+	out_term->term_type = id_sym->id_type;
+	vl_chk_free(out_term->name->name);
+	out_term->name->name = strip_char(vlStrdup(id_sym->name),SEP_QUASI);
+
+
+
+	dc = check_dc((!rst_ckt)?id_sym->syndrome_expr_list:
+				 id_sym->rst_syndrome_expr_list);
+
+	n_entries = lsLength((!rst_ckt)?
+			     id_sym->syndrome_expr_list:
+			     id_sym->rst_syndrome_expr_list);
+
+	sprintf(sync_name, "%s%s%s", quasi_name, SEP_GATEPIN, PIN_PS);
+
+	put_quasi_table(file, dc, quasi_name, sync_name, id_sym, out_term,
+			lo, hi, n_entries);
+
+	vl_chk_free(dc);
+    }
+    st_free_gen(gen);
+}
+
+
+static void vl_prioritize_sequence(FILE *file, lsList vars_list,
+				   lsList pause_list,
+				   st_table *result_st)
+{
+    st_generator *vars_gen;
+    lsGen gen, pause_gen, pt_gen;
+    lsHandle handle, pause_handle, pt_handle;
+    lsList pt_list;
+    vl_id_range *id_sym;
+    char *key;
+    st_table *new_vars, *pause_set;
+    st_table *t_set, *i_set;
+    var_info *id_var_info;
+    int touched;
+    vl_term *pause_term, *new_term;
+    int hi, lo, i, j, k;
+    int bit, idx;
+    int table_width=0;
+    int t_dup=0, val;
+    char header_buf[MAXSTRLEN], buf[MAXSTRLEN], var_buf[MAXSTRLEN];
+    char *t_name;
+
+    assert(lsLength(vars_list) == lsLength(pause_list));
+
+    if (lsLength(vars_list) == 0) return;
+
+    fprintf(file, "%s sequence prioritizer\n", HSIS_COMMENT);
+
+    vars_gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(vars_gen, &key, (char**)&id_sym)) {
+	table_width = 0;
+
+	for (gen=lsStart(vars_list), touched = 0;
+	     lsNext(gen,(lsGeneric*)&new_vars,&handle) != LS_NOMORE; ) {
+	    if (st_lookup(new_vars, key, (char**)&id_var_info)) {
+		touched = 1;
+		break;
+	    }
+	}
+	(void)lsFinish(gen);
+	if (!touched) continue;
+
+	get_hilo(id_sym, &hi, &lo);
+	new_term = typed_new_term(id_sym->id_type, id_sym->range, lo, hi);
+	new_term->flag |= (id_sym->flags & MVar) ? MVar : 0;
+	write_var_decl(file, new_term);
+
+	t_set = st_init_table(strcmp, st_strhash);
+	i_set = st_init_table(st_ptrcmp, st_ptrhash);
+
+	sprintf(header_buf, ".names ");
+
+	pt_list = lsCreate();
+	for (gen=lsStart(vars_list), pause_gen=lsStart(pause_list), i=0;
+	     lsNext(gen,(lsGeneric*)&new_vars,&handle) != LS_NOMORE&&
+	     lsNext(pause_gen,(lsGeneric*)&pause_set,&pause_handle) !=
+	     LS_NOMORE; ) {
+	    if (st_lookup(new_vars, key, (char**)&id_var_info)) {
+		table_width++;
+
+		pause_term = fg_write_lc_in_LabelSet(file, pause_set, 1);
+		lsNewEnd(pt_list, (lsGeneric)pause_term, 0);
+
+
+		t_dup=0;
+		if (st_lookup(t_set,
+			      id_var_info->current_terminal->name->name,
+			      &t_name)) {
+		    st_insert(i_set, (char*)i, 0);
+		    t_dup=1;
+		} else {
+		    st_insert(t_set,
+			      id_var_info->current_terminal->name->name,
+			      0);
+		}
+		i++;
+
+		new_term->flag |= id_var_info->current_terminal->flag;
+	    }
+	}
+	(void)lsFinish(gen);
+	(void)lsFinish(pause_gen);
+
+	sprintf(var_buf, "%s", id_sym->name);
+	strip_char(var_buf, SEP_LATCH);
+	if (!id_sym->range) {
+	    if (lo > hi || id_sym->flags &MVar) {
+		sprintf(buf, "%s\n", new_term->name->name);
+		strcat(header_buf, buf);
+		sprintf(buf, "%s -\n", HSIS_DEFAULT);
+		strcat(header_buf, buf);
+	    } else {
+		sprintf(buf, "%s ", HSIS_ARROW);
+		strcat(header_buf, buf);
+		for (bit=lo; bit<=hi; bit++) {
+		    sprintf(buf, "%s%s%d%s ",
+			    new_term->name->name,
+			    SEP_LBITSELECT, bit, SEP_RBITSELECT);
+		    strcat(header_buf, buf);
+		}
+		strcat(header_buf, "\n");
+		sprintf(buf, "%s ", HSIS_DEFAULT);
+		strcat(header_buf, buf);
+		for (bit=lo; bit<=hi; bit++) {
+		    sprintf(buf, "- ");
+		    strcat(header_buf, buf);
+		}
+		strcat(header_buf, "\n");
+	    }
+	} else {
+	    int idx_hi, idx_lo;
+	    idx_lo = vl_eval_expr(id_sym->range->left);
+	    if (id_sym->range->right)
+		idx_hi = vl_eval_expr(id_sym->range->right);
+	    else
+		idx_hi = idx_lo;
+
+	    sprintf(buf, "%s ", HSIS_ARROW);
+	    strcat(header_buf, buf);
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		if (lo > hi || id_sym->flags &MVar) {
+		    sprintf(buf, "%s%s%d%s ",
+			    new_term->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY);
+		    strcat(header_buf, buf);
+		} else {
+		    for (bit=lo; bit<=hi; bit++) {
+			sprintf(buf, "%s%s%d%s%s%d%s ",
+				new_term->name->name,
+				SEP_LARRAY, idx, SEP_RARRAY,
+				SEP_LBITSELECT, bit, SEP_RBITSELECT);
+			strcat(header_buf, buf);
+		    }
+		}
+	    }
+	    strcat(header_buf, "\n");
+	    sprintf(buf, "%s ", HSIS_DEFAULT);
+	    strcat(header_buf, buf);
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		if (lo > hi || id_sym->flags & MVar) {
+		    sprintf(buf, "- ");
+		    strcat(header_buf, buf);
+		} else {
+		    for (bit=lo; bit<=hi; bit++) {
+			sprintf(buf, "- ");
+			strcat(header_buf, buf);
+		    }
+		}
+	    }
+	}
+
+	fprintf(file, "%s", header_buf);
+
+	for (gen=lsStart(vars_list),
+	     pause_gen=lsStart(pause_list),
+	     pt_gen=lsStart(pt_list),
+	     i=0;
+	     lsNext(gen,(lsGeneric*)&new_vars,&handle) != LS_NOMORE&&
+	     lsNext(pause_gen,(lsGeneric*)&pause_set,&pause_handle) !=
+		 LS_NOMORE; ) {
+	    if (st_lookup(new_vars, key, (char**)&id_var_info)) {
+		int retval = lsNext(pt_gen,(lsGeneric*)&pause_term,&pt_handle);
+		assert(retval != LS_NOMORE);
+		if (!id_sym->range) {
+
+		    if (lo > hi || id_sym->flags & MVar) {
+
+			for (j=0; j<i; j++)
+			    if (st_lookup(i_set, (char*)j, (char**)&val))
+				fprintf(file, "- ");
+			    else
+				fprintf(file, "- - ");
+			if (st_lookup(i_set, (char*)j, (char**)&val))
+			    fprintf(file, "1 ");
+			else
+			    fprintf(file, "1 - ");
+			j++;
+			for (; j<table_width; j++)
+			    if (st_lookup(i_set, (char*)j, (char**)&val))
+				fprintf(file, "- ");
+			    else
+				fprintf(file, "- - ");
+			fprintf(file, "%s%s\n", HSIS_EQUAL,
+				id_var_info->current_terminal->name->name);
+			i++;
+		    } else {
+
+			for (j=0; j<i; j++) {
+			    fprintf(file, "- ");
+			    if (!st_lookup(i_set, (char*)j, (char**)&val))
+				for (k=lo; k<=hi; k++) fprintf(file, "- ");
+			}
+			fprintf(file, "1 ");
+			if (!st_lookup(i_set, (char*)j, (char**)&val))
+			    for (k=lo; k<=hi; k++) fprintf(file, "- ");
+			j++;
+			for (; j<table_width; j++) {
+			    fprintf(file, "- ");
+			    if (!st_lookup(i_set, (char*)j, (char**)&val))
+				for (k=lo; k<=hi; k++) fprintf(file, "- ");
+			}
+			for (k=lo; k<=hi; k++)
+			    fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+				    id_var_info->
+				    current_terminal->name->name,
+				    SEP_LBITSELECT, k, SEP_RBITSELECT);
+			fprintf(file, "\n");
+			i++;
+		    }
+		} else {
+
+		    int idx_hi, idx_lo;
+		    idx_lo = vl_eval_expr(id_sym->range->left);
+		    if (id_sym->range->right)
+			idx_hi = vl_eval_expr(id_sym->range->right);
+		    else
+			idx_hi = idx_lo;
+
+		    if (lo > hi || id_sym->flags & MVar) {
+
+			for (j=0; j<i; j++) {
+			    fprintf(file, "- ");
+			    if (!st_lookup(i_set, (char*)j, (char**)&val))
+				for (idx=idx_lo; idx<=idx_hi; idx++)
+				    fprintf(file, "- ");
+			}
+			fprintf(file, "1 ");
+			if (!st_lookup(i_set, (char*)j, (char**)&val))
+			    for (idx=idx_lo; idx<=idx_hi; idx++)
+				fprintf(file, "- ");
+			j++;
+			for (; j<table_width; j++) {
+			    fprintf(file, "- ");
+			    if (!st_lookup(i_set, (char*)j, (char**)&val))
+				for (idx=idx_lo; idx<=idx_hi; idx++)
+				    fprintf(file, "- ");
+			}
+			for (idx=idx_lo; idx<=idx_hi; idx++)
+			    fprintf(file, "%s%s%s%d%s\n", HSIS_EQUAL,
+				    id_var_info->current_terminal->name->name,
+				    SEP_LARRAY, idx, SEP_RARRAY);
+			i++;
+		    } else {
+
+			for (j=0; j<i; j++) {
+			    fprintf(file, "- ");
+			    if (!st_lookup(i_set, (char*)j, (char**)&val))
+				for (idx=idx_lo; idx<=idx_hi; idx++)
+				    for (k=lo; k<=hi; k++)
+					fprintf(file, "- ");
+			}
+			fprintf(file, "1 ");
+			if (!st_lookup(i_set, (char*)j, (char**)&val))
+			    for (idx=idx_lo; idx<=idx_hi; idx++)
+				for (k=lo; k<=hi; k++) fprintf(file, "- ");
+			j++;
+			for (; j<table_width; j++) {
+			    fprintf(file, "- ");
+			    if (!st_lookup(i_set, (char*)j, (char**)&val))
+				for (idx=idx_lo; idx<=idx_hi; idx++)
+				    for (k=lo; k<=hi; k++)
+					fprintf(file, "- ");
+			}
+			for (idx=idx_lo; idx<=idx_hi; idx++)
+			    for (k=lo; k<=hi; k++)
+				fprintf(file, "%s%s%s%d%s%s%d%s\n",
+					HSIS_EQUAL,
+					id_var_info->current_terminal->name->name,
+					SEP_LARRAY, idx, SEP_RARRAY,
+					SEP_LBITSELECT, k, SEP_RBITSELECT);
+			i++;
+		    }
+		}
+	    }
+	}
+	(void)lsFinish(gen);
+	(void)lsFinish(pause_gen);
+	(void)lsFinish(pt_gen);
+
+	st_insert(result_st, id_sym->name,
+		  (char*)create_var_info(vl_copy_id_range(id_sym),
+					 new_term));
+
+    }
+    st_free_gen(vars_gen);
+}
+
+
+static void vl_register_pause(vertex_t *pause_node, st_table *old_vars)
+{
+    set_t *pause_set;
+
+
+    pause_set = set_empty();
+    set_add(((fg_node_info*)pause_node->user_data)->loc, pause_set);
+    lsNewEnd(vl_current_pause_list, (lsGeneric)pause_set, 0);
+    lsNewEnd(vl_current_vars_list, (lsGeneric)old_vars, 0);
+}
+
+
+
+static void vl_predefine_vars(FILE *file, st_table *vars)
+{
+    st_generator *gen;
+    char *key;
+    vl_id_range *id_sym;
+    vl_term *init_term;
+    int hi, lo;
+    var_info *id_var;
+    char *dummy;
+
+    gen = st_init_gen(vl_currentModule->sig_st);
+    while (st_gen(gen, &key, (char**)&id_sym)) {
+
+	if (!(id_sym->flags & RegVar)) continue;
+	if (strstr(id_sym->name, SEP_LATCH)) continue;
+	if (strstr(id_sym->name, SEP_QUASI)) continue;
+	if (vl_currentModule_combVar_st)
+	    if (st_lookup(vl_currentModule_combVar_st, id_sym->name, &dummy))
+		continue;
+
+	get_hilo(id_sym, &hi, &lo);
+	init_term = typed_new_term(id_sym->id_type, id_sym->range, lo, hi);
+	init_term->flag = id_sym->flags;
+	id_var = create_var_info(vl_copy_id_range(id_sym), init_term);
+	st_insert(vars, id_sym->name, (char*)id_var);
+	id_var = create_var_info(vl_copy_id_range(id_sym), init_term);
+	st_insert(vl_current_init_vars, id_sym->name, (char*)id_var);
+    }
+    st_free_gen(gen);
+}
+
+
+
+static void vl_timed_init_mux(FILE *file, vl_term *ctrl_term,
+			      st_table *orig_vars, st_table *init_vars,
+			      st_table *feedback_vars)
+{
+    st_generator *gen;
+    char *key;
+    var_info *init_var, *feedback_var, *orig_var;
+    vl_term *orig_term=NIL(vl_term);
+    int hi, lo;
+    char *buf;
+    int use_defined_term=0;
+
+    fprintf(file, "%s feedback mux\n", HSIS_COMMENT);
+
+    gen = st_init_gen(init_vars);
+    while (st_gen(gen, &key, (char**)&init_var)) {
+	use_defined_term=0;
+	if (orig_vars) {
+	    if (st_lookup(orig_vars, key, (char**)&orig_var)) {
+		orig_term = orig_var->current_terminal;
+		use_defined_term=1;
+	    }
+	}
+	if (!use_defined_term) {
+	    get_hilo(init_var->id, &hi, &lo);
+	    buf = vlStrdup(init_var->id->name);
+	    orig_term = ((init_var->id->flags & EventVar) && smartEvent) ?
+	      vl_create_term(vl_create_id_range(WRT_BLIF_GND(file),
+						NIL(vl_range)), 0, -1) :
+	      create_rename_term(init_var->id, buf, lo, hi);
+	    orig_term->flag = init_var->current_terminal->flag;
+	    write_var_decl(file, init_var->current_terminal);
+	}
+	if (st_lookup(feedback_vars, key, (char**)&feedback_var)) {
+	    instantiate_mux(file, orig_term, feedback_var->current_terminal,
+			    ctrl_term, init_var->current_terminal);
+	} else {
+	    if (orig_term->flag & MVar)
+		vl_write_mv_connect(file,
+				    orig_term, init_var->current_terminal);
+	    else {
+		if ((init_var->id->flags & EventVar) && smartEvent)
+		    write_int_connect(file, 0, init_var->current_terminal);
+		else
+		    vl_write_bin_connect(file,
+					 orig_term, init_var->current_terminal,
+					 0);
+	    }
+
+	}
+    }
+    st_free_gen(gen);
+}
+
+
+vl_term *test_against_lc_init(FILE *file)
+{
+    vl_term *retval;
+
+    retval = new_term(NIL(vl_range), 0, -1);
+
+    fprintf(file, ".names %s%06x %s\n%s 0\n%s%d%s 1\n",
+	    FG_LC_PS,((fg_graph_info*)vl_writeFlowGraph->user_data)->fg_id,
+	    retval->name->name, HSIS_DEFAULT, FG_LLOC, 0, FG_RLOC);
+
+    return retval;
+}
+
+
+static void vl_write_timer(FILE *file, lsList graph_list)
+{
+    lsGen gen;
+    lsHandle handle;
+    graph_t *graph;
+    fg_graph_info *gdata;
+    int i;
+
+    for (gen=lsStart(graph_list);
+	 lsNext(gen, (lsGeneric*)&graph, &handle) != LS_NOMORE; ) {
+	if (vl_preDeclare) {
+	    gdata = ((fg_graph_info*)graph->user_data);
+	    if (gdata->fg_id == -1) {
+		fg_new_fg_id();
+		gdata->fg_id = fg_fg_id();
+	    }
+	    fprintf(file, ".mv %s%06x, %s%06x %d %s%d%s ",
+		    FG_LC_PS, gdata->fg_id, FG_LC_NS, gdata->fg_id,
+		    (gdata->pause_hi-gdata->pause_lo)*2+2,
+		    FG_LLOC, 0, FG_RLOC);
+	    for (i=gdata->pause_lo; i<gdata->pause_hi; i++)
+		fprintf(file, "%s%d%s %s%d%s%s ",
+			FG_LLOC, i, FG_RLOC, FG_LLOC, i,
+			FG_RLOC, FG_TIMER_PRIME);
+	    fprintf(file, "%s%s\n", FG_LLOC, FG_RLOC);
+	    continue;
+	}
+
+	if (graph) {
+	    if (!fg_check_timer_consistency(file, graph)) {
+		char buf[MAXSTRLEN];
+		yylineno = -1;
+		sprintf(buf, "%s: contains delay free cycle(s)",
+			vl_currentModule->name->name);
+		fprintf(stderr, "%s\n", buf);
+	    }
+	    fg_set_fg(graph);
+	    fg_write_timer(file, graph);
+	    fg_set_fg(NIL(graph_t));
+	}
+    }
+    lsFinish(gen);
+}
+
+
+FILE *openStream()
+{
+    return tmpfile();
+}
+
+void closeStream(FILE *stream)
+{
+    fclose(stream);
+}
+
+void dumpStream(FILE *to, FILE *from)
+{
+    char buf[MAXSTRLEN];
+
+    rewind(from);
+    while(fgets(buf, MAXSTRLEN, from)!=NULL)
+	fputs(buf, to);
+}
+
+
+char * cfsm_inputs(char *inputs)
+{
+    int len, i;
+    char arg[MAXSTRLEN];
+    char token[MAXSTRLEN];
+    char *cp;
+    static char buf[MAXSTRLEN];
+
+    buf[0] = '\0';
+    len = strlen(inputs);
+    for (cp=inputs; cp<inputs+len; ) {
+	i = 0;
+	while ((*cp == ' ' || *cp == '\t') && *cp != '\0') cp++;
+	while ((*cp != ' ' && *cp != '\t') && *cp != '\0') {
+	    token[i] = *cp;
+	    cp++;  i++;
+	}
+	if (i > 0) {
+	    token[i] = '\0';
+	    sprintf(arg, " %s=%s", token, token);
+	    strcat(buf, arg);
+	}
+    }
+
+    return buf;
+}
+
+char *cfsm_ports(char *ports)
+{
+    int len, i;
+    char arg[MAXSTRLEN];
+    char token[MAXSTRLEN];
+    char *cp;
+    static char buf[MAXSTRLEN];
+    int ithToken;
+
+    buf[0] = '\0';
+    len = strlen(ports);
+    ithToken=0;
+    for (cp=ports; cp<ports+len; ) {
+	i = 0;
+	while ((*cp == ' ' || *cp == '\t') && *cp != '\0') cp++;
+	while ((*cp != ' ' && *cp != '\t') && *cp != '\0') {
+	    token[i] = *cp;
+	    cp++;  i++;
+	}
+	if (i > 0) {
+	    token[i] = '\0';
+	    if (ithToken > 0)
+		sprintf(arg, " , %s", token);
+	    else
+		sprintf(arg, " %s", token);
+	    strcat(buf, arg);
+	    ithToken++;
+	}
+    }
+
+    return buf;
+}
+
+
+FILE *vl_begin_buffer()
+{
+    return tmpfile();
+}
+
+
+void vl_close_buffer(FILE *buffer)
+{
+    fclose(buffer);
+}
+
+
+void vl_append_buffer(FILE *main_stream, FILE *buffer)
+{
+    char buf[MAXSTRLEN];
+
+    rewind(buffer);
+    while(fgets(buf, MAXSTRLEN, buffer)!=NULL)
+	fputs(buf, main_stream);
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_write.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_write.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_write.h	(revision 18)
@@ -0,0 +1,79 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_write.h,v 1.3 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+
+#define S_MUX (1)
+#define B_MUX (1<<1)
+
+EXTERN enum st_retval vl_write_desc ARGS((char *, char *, char *));
+EXTERN void vl_write_module ARGS((FILE *, vl_module *));
+EXTERN void vl_write_primitive ARGS((FILE *, vl_primitive *));
+EXTERN void vl_write_function ARGS((FILE *, vl_function *));
+EXTERN char *vl_write_prim_table_header ARGS((FILE *, vl_primitive *));
+EXTERN void vl_write_mod_item_list ARGS((FILE *, lsList));
+EXTERN st_table *vl_write_mod_item ARGS((FILE *, vl_decl *, st_table *));
+EXTERN void vl_write_expr ARGS ((FILE *, vl_expr *, st_table *));
+EXTERN void vl_write_expr_list ARGS((FILE *, lsList, st_table *));
+EXTERN st_table *vl_write_procstmt ARGS((FILE*, vl_procstmt*, st_table*));
+EXTERN st_table *vl_write_begin_end_stmt ARGS((FILE*, vl_begin_end_stmt*, int, vl_term*, st_table*));
+EXTERN st_table *vl_write_if_else_stmt ARGS((FILE *, vl_if_else_stmt *, st_table *));
+EXTERN st_table *vl_write_case_stmt ARGS((FILE *, vl_case_stmt *, st_table *));
+EXTERN st_table *vl_write_event_control_stmt ARGS((FILE*, vl_event_control_stmt*, st_table*));
+EXTERN void vl_write_cont_assign ARGS((FILE *, vl_cont_assign *, st_table *));
+EXTERN void vl_write_wiring_assign ARGS((FILE *, vl_netdecl *, st_table *));
+EXTERN vl_term *vl_write_assign ARGS((FILE *, vl_bassign_stmt *, int, vl_term *, st_table *));
+EXTERN st_table *vl_write_stmt ARGS((FILE *, void *, int, vl_term *, st_table *));
+EXTERN st_table *vl_write_decl_list ARGS((FILE*, void*, int, vl_term*, st_table*));
+EXTERN st_table *vl_write_stmt_list ARGS((FILE*, lsList, int, vl_term*, st_table*));
+EXTERN set_t *vl_write_event_expr ARGS((FILE*, vl_event_expr*));
+EXTERN char *vl_write_vector_bop ARGS((FILE *, short, vl_term *, vl_term *, vl_term *));
+EXTERN char *vl_write_bop ARGS((FILE *, short, char *, char *, char *, char *, int));
+EXTERN void vl_write_bit_connect ARGS((FILE *, char *, char *, int));
+EXTERN vl_term *write_case_comparator ARGS((FILE*, vl_term*, lsList, st_table*));
+EXTERN void write_comparator ARGS((FILE*, vl_term*, vl_term*, vl_term*));
+EXTERN int vl_eval_expr ARGS((vl_expr *));
+EXTERN vl_term *instantiate_function ARGS((FILE*, vl_function*, lsList, st_table*));
+EXTERN void vl_put_lib ARGS((FILE*, ...));
+EXTERN st_table *create_var_muxes ARGS((FILE*, vl_term*, st_table*, st_table*, st_table*));
+EXTERN void instantiate_latch ARGS((FILE*, st_table*));
+EXTERN void vl_write_mv_lib ARGS((FILE*, short, vl_term*, vl_term*, vl_term*));
+EXTERN st_table *conflict_arbitrator ARGS((FILE*, array_t*));
+EXTERN st_table *func_conflict_arbitrator ARGS((FILE*, vl_id_range*, array_t*));
+EXTERN void vl_write_reset ARGS((FILE *, vl_procstmt *));
+EXTERN void vl_write_reset_stmt ARGS((FILE *, void *, st_table *));
+EXTERN void vl_write_io_list ARGS((FILE *));
+EXTERN void vl_write_mod_inst_list ARGS((FILE *, vl_mod_prim_inst_list *));
+EXTERN void vl_write_mod_inst ARGS((FILE *, vl_module *, vl_mod_prim_inst *));
+EXTERN void vl_write_svar ARGS((FILE *));
+EXTERN vl_term *sensitive_control ARGS((FILE *, st_table *));
+EXTERN vl_term *test_against_lc_init ARGS((FILE*));
+EXTERN FILE *openStream ARGS(());
+EXTERN void closeStream ARGS(());
+EXTERN void dumpStream ARGS((FILE *to, FILE *from));
+EXTERN char *cfsm_inputs ARGS((char *inputs));
+EXTERN char *cfsm_ports ARGS((char *inputs));
+EXTERN FILE *vl_begin_buffer ARGS(());
+EXTERN void vl_close_buffer ARGS((FILE *buffer));
+EXTERN void vl_append_buffer ARGS((FILE *main_stream, FILE *buffer));
Index: vis_dev/vl2mv-2.3/src/parser/vl_write_util.c
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_write_util.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_write_util.c	(revision 18)
@@ -0,0 +1,3935 @@
+/*
+
+  Copyright (c) 1992, 1993
+	Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+	  10/92
+	  10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_write_util.c,v 1.3 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+
+#include <stdio.h>
+#include <math.h>
+#include "util.h"
+#include "st.h"
+#include "array.h"
+#include "list.h"
+#include "set.h"
+#include "graph.h"
+#include "vl_types.h"
+#include "vl_defs.h"
+#include "vlr_int.h"
+#include "vl_fg_defs.h"
+#include "vl_fg_types.h"
+#include "vl_create.h"
+#include "vl_write.h"
+#include "vl_write_util.h"
+#include "vl_vardecl.h"
+#include "vl_edgedetector.h"
+#include "vl_traverse.h"
+#include "vl_mux.h"
+#include "vl_flowgraph.h"
+#include "verilog.h"
+
+extern vl_desc *mod_list;
+extern int implicitClocking;
+extern int compatibleChecking;
+extern int set_notation;
+extern int debug_mode;
+extern int decomposeTable;
+extern int noBus;
+extern int smartEvent;
+extern int vlTimedSystem;
+extern int Zconnection;
+extern int implicitDeclare;
+
+extern int WarningLevel;
+
+extern int rst_ckt, use_rst_ckt, mark_sel_var;
+extern lsList ctrl_list, rst_ctrl_list;
+extern st_table *sensitiveList;
+extern int lhs_hi, lhs_lo;
+extern int lhs_must_be_wire;
+extern int Vlerrno;
+extern int silent_err;
+extern char *cntxt_event;
+
+int deadlock_semantic = 0;
+int arrayBoundNond=0;
+int vis_nond=1;
+int vis_nond_var=0;
+int instantiateInputLatch = 0;
+
+static char *nond_output();
+static int isTautology ARGS((lsList syndrome_expr_list));
+static void postprocess_vlr_rel ARGS((FILE *file, short type, char *carry,
+				      vl_term *results, vl_term *out));
+static int evaluable_expr ARGS((vl_expr *expr));
+static void vl_write_bin_equal_const(FILE *file, vl_expr *val, vl_term *term, vl_term *out);
+
+void vl_mv_to_bin(vl_term *term)
+{
+    if (term->flag & MVar) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "enforced mv->binary encoding on '%s'", term->name->name);
+	Translate_Warning(buf);
+
+	term->flag &= !MVar;
+	if (term->hi < 0) {
+	    term->hi = MAXBITNUM-1;
+	    term->lo = 0;
+	} else {
+	    int range, blen;
+
+	    for (range = term->hi - term->lo + 1, blen = -1;
+		 range>0; range >>= 1)
+		blen++;
+	    if (blen>0)
+		if ((1<<(blen-1)) < term->hi-term->lo+1)
+		    blen++;
+	    term->lo = 0;
+	    term->hi = blen-1;
+	}
+    }
+}
+
+
+
+void vl_bin_to_mv(vl_term *term)
+{
+    int blen;
+
+    if (!(term->flag & MVar)) {
+	Translate_Warning("enforced binary->mv encoding");
+
+	term->flag |= MVar;
+	blen = term->hi-term->lo+1;
+	term->lo = 1;
+	term->hi = (1 << (blen));
+    }
+}
+
+
+void vl_write_mv_comp(FILE *file, short type, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    lsList domain;
+    lsGen igen, jgen;
+    lsHandle ihandle, jhandle;
+    vl_enumerator *i, *j;
+
+    if (in1->hi-in1->lo != in2->hi-in2->lo)
+	Translate_Warning("comparator have MV's of different domain elts");
+
+    fprintf(file, ".names %s %s %s\n",
+	    in1->name->name, in2->name->name, out->name->name);
+    if (set_notation) {
+      if (in1->term_type != in2->term_type) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "'%s':comparing %s and %s of different domains",
+		vl_currentModule->name->name,
+		in1->name->name, in2->name->name);
+	semantic_error(buf);
+      }
+
+      fprintf(file, "%s %d\n", HSIS_DEFAULT, type==Bneq2Expr);
+      fprintf(file, "- %s%s %d\n",
+	      HSIS_EQUAL, in1->name->name, type!=Bneq2Expr);
+
+    } else {
+	switch (type) {
+	case Beq2Expr:
+
+	    if (in1->term_type != in2->term_type) {
+		char buf[MAXSTRLEN];
+		sprintf(buf, "'%s':comparing %s and %s of different domains",
+			vl_currentModule->name->name,
+			in1->name->name, in2->name->name);
+		semantic_error(buf);
+	    }
+
+	    domain = in1->term_type->specifier->u.enum_type->domain_list;
+	    for (igen=lsStart(domain);
+		 lsNext(igen,(lsGeneric*)&i,&ihandle)!=LS_NOMORE;) {
+		for (jgen=lsStart(domain);
+		     lsNext(jgen,(lsGeneric*)&j,&jhandle)!=LS_NOMORE;) {
+		    fprintf(file, "%s %s %d\n",
+			    i->name, j->name, (strcmp(i->name, j->name)==0));
+		}
+		lsFinish(jgen);
+	    }
+	    lsFinish(igen);
+	    break;
+	case Bneq2Expr:
+
+	    if (in1->term_type != in2->term_type) {
+		char buf[MAXSTRLEN];
+		sprintf(buf, "'%s':comparing %s and %s of different domains",
+			vl_currentModule->name->name,
+			in1->name->name, in2->name->name);
+		semantic_error(buf);
+	    }
+
+	    domain = in1->term_type->specifier->u.enum_type->domain_list;
+	    for (igen=lsStart(domain);
+		 lsNext(igen,(lsGeneric*)&i,&ihandle)!=LS_NOMORE;) {
+		for (jgen=lsStart(domain);
+		     lsNext(jgen,(lsGeneric*)&j,&jhandle)!=LS_NOMORE;) {
+		    fprintf(file, "%s %s %d\n",
+			    i->name, j->name, (strcmp(i->name, j->name)!=0));
+		}
+		lsFinish(jgen);
+	    }
+	    lsFinish(igen);
+	    break;
+	}
+    }
+}
+
+
+void vl_write_bin_comp(FILE *file, short type, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    vl_term *tmp, *ripple_term;
+    char *ripple;
+
+    tmp = new_term(NIL(vl_range), 0, -1);
+
+    if (in1->lo > in1->hi) {
+	tmp->lo = in2->lo;
+	tmp->hi = in2->hi;
+    } else if (in2->lo > in2->hi) {
+	tmp->lo = in1->lo;
+	tmp->hi = in1->hi;
+    } else {
+	tmp->lo = 0;
+	tmp->hi = MIN(in1->hi-in1->lo, in2->hi-in2->lo);
+    }
+    write_var_decl(file, tmp);
+    vl_write_vector_bop(file, BxorExpr, in1, in2, tmp);
+
+    ripple = vlStrdup(new_termname());
+    ripple_term = vl_create_term(vl_create_id_range(ripple,NIL(vl_range)),
+				 tmp->lo, tmp->hi);
+    if (tmp->lo <= tmp->hi) {
+	ripple =
+	    vl_write_vector_bop(file, UorExpr, tmp, NIL(vl_term), ripple_term);
+	vl_write_bit_connect(file, ripple_term->name->name, out->name->name,
+			     (type==Beq2Expr));
+	vl_free_term(ripple_term);
+    } else {
+	vl_write_bit_connect(file, tmp->name->name, out->name->name,
+			     (type==Beq2Expr));
+    }
+    vl_free_term(tmp);
+}
+
+
+static void vl_write_bin_equal_const(
+  FILE *file,
+  vl_expr *val,
+  vl_term *term,
+  vl_term *out
+  )
+{
+    int lo, hi;
+    int i, v;
+
+    if (term->lo > term->hi) {
+	lo = 0;
+	hi = 0;
+    } else {
+	lo = term->lo;
+	hi = term->hi;
+    }
+
+    /* Write table header and default value. */
+    fprintf(file, ".names");
+    for (i=lo; i<=hi; i++) {
+	fprintf(file, " %s%s%d%s", term->name->name,
+		SEP_LBITSELECT, i, SEP_RBITSELECT);
+    }
+    fprintf(file, " %s\n.def 0\n", out->name->name);
+
+    for (i=lo, v=vl_eval_expr(val); i<=hi; i++, v >>= 1) {
+	fprintf(file, "%d ", (v & 1));
+    }
+    fprintf(file, " 1\n");
+}
+
+
+void vl_write_mv_connect(FILE *file, vl_term *in, vl_term *out)
+{
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+    if (in->term_type != out->term_type) {
+	char buf[MAXSTRLEN];
+	sprintf(buf, "connecting %s and %s of different domains",
+		out->name->name, in->name->name);
+	semantic_error(buf);
+    }
+
+    fprintf(file, ".names %s %s\n", in->name->name, out->name->name);
+
+    if (set_notation) {
+	fprintf(file, "- =%s\n", in->name->name);
+    } else {
+	domain = in->term_type->specifier->u.enum_type->domain_list;
+	for (enum_gen=lsStart(domain);
+	     lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+	    fprintf(file, "%s %s\n", enum_elt->name, enum_elt->name);
+	}
+	lsFinish(enum_gen);
+    }
+}
+
+
+void vl_write_bin_connect(FILE *file, vl_term *in, vl_term *out, int inverted)
+{
+    int i;
+    char out_buf[MAXSTRLEN], in_buf[MAXSTRLEN];
+
+    if (out->lo > out->hi) {
+	if (in->lo > in->hi) {
+	    vl_write_bit_connect(file, in->name->name, out->name->name, 0);
+	} else {
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "%s%s%d%s", in->name->name,
+		    SEP_LBITSELECT, in->lo, SEP_RBITSELECT);
+	    vl_write_bit_connect(file, buf, out->name->name, 0);
+	}
+    } else {
+	if (in->lo > in->hi) {
+	    int i;
+	    sprintf(out_buf, "%s%s%d%s", out->name->name,
+		    SEP_LBITSELECT, out->lo, SEP_RBITSELECT);
+	    sprintf(in_buf, "%s", in->name->name);
+	    if (set_notation && !inverted) {
+		fprintf(file, ".names %s %s\n- =%s\n",
+			in_buf, out_buf, in_buf);
+
+	    } else {
+		vl_write_bit_connect(file, in_buf, out_buf, inverted);
+	    }
+
+	    sprintf(in_buf, "%s", WRT_BLIF_GND(file));
+	    for (i=out->lo+1; i<=out->hi; i++) {
+		sprintf(out_buf, "%s%s%d%s", out->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		if (set_notation) {
+		    fprintf(file, ".names %s %s\n- =%s\n",
+			    in_buf, out_buf, in_buf);
+		} else {
+		    vl_write_bit_connect(file, in_buf, out_buf, 0);
+		}
+	    }
+	} else {
+	    for (i=out->lo; i<=out->hi; i++) {
+		sprintf(out_buf, "%s%s%d%s", out->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		sprintf(in_buf, "%s%s%d%s", in->name->name,
+			SEP_LBITSELECT, i+in->lo-out->lo,
+			SEP_RBITSELECT);
+		if (set_notation && !inverted) {
+		    fprintf(file, ".names %s %s\n- =%s\n",
+			    in_buf, out_buf, in_buf);
+		} else {
+		    vl_write_bit_connect(file, in_buf, out_buf,
+					 inverted);
+		}
+	    }
+	}
+    }
+}
+
+
+void vl_write_consts(FILE *file)
+{
+
+
+    file = file;
+}
+
+
+void vl_write_const(FILE *file, vl_expr *val, vl_term *out)
+{
+    int ismvar=0;
+    int i, v;
+    int lo, hi;
+    int find_elt=0;
+    char buf[MAXSTRLEN];
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+    ismvar = out->flag & MVar;
+
+    if (ismvar) {
+	assert (val);
+
+	fprintf(file, ".names %s\n", out->name->name);
+	switch(val->type) {
+	case BitExpr:
+	    Translate_Warning("Using binary constant as value of mv variable");
+	case IntExpr:
+	    domain = out->term_type->specifier->u.enum_type->domain_list;
+	    for (enum_gen=lsStart(domain);
+		 lsNext(enum_gen,
+			(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+		find_elt=1;
+		if (enum_elt->val==val->u.intval) break;
+		find_elt=0;
+	    }
+	    lsFinish(enum_gen);
+
+	    if (find_elt)
+		fprintf(file, "%s\n", enum_elt->name);
+	    else {
+		char buf[MAXSTRLEN];
+		sprintf(buf, "trying to assign to '%s' out of its domain",
+			out->name->name);
+		semantic_error(buf);
+	    }
+	    break;
+	case RealExpr:
+	    semantic_error("assinging real value to enumeration typed var");
+	    break;
+	case IDExpr:
+	    if (st_lookup(out->term_type->specifier->u.enum_type->domain_st,
+			  val->u.name->name, (char**)&enum_elt)) {
+		fprintf(file, "%s\n", enum_elt->name);
+	    } else {
+		char buf[MAXSTRLEN];
+
+		sprintf(buf, "%s should be a constant/symbolic name",
+			val->u.name->name);
+		internal_error(buf);
+	    }
+	    break;
+	}
+    } else {
+
+	if (out->name->mpg_master_exp && out->hi==-1 && out->lo==0)
+
+	    get_hilo(out->name, &hi, &lo);
+	else {
+
+	    hi = out->hi;
+	    lo = out->lo;
+	}
+	if (val) {
+	    if (lo <= hi) {
+		int v0;
+		v0 = val->u.bexpr.part0;
+		for (i=lo, v=vl_eval_expr(val); i<=hi;
+		     i++, v >>= 1, v0 >>= 1) {
+		    sprintf(buf, "%s%s%d%s", out->name->name,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    fprintf(file, ".names %s\n", buf);
+		    if ((v & 1) && (v0 & 1))
+			fprintf(file, "-\n");
+		    else
+			fprintf(file, "%d\n", (v & 1));
+		}
+	    } else {
+		fprintf(file, ".names %s\n", out->name->name);
+		fprintf(file, "%d\n", vl_eval_expr(val) & 1);
+	    }
+	} else {
+	    if (lo <= hi) {
+		for (i=lo; i<=hi; i++) {
+		    sprintf(buf, "%s%s%d%s", out->name->name,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    fprintf(file, ".names %s\n", buf);
+		    fprintf(file, "0\n1\n");
+		}
+	    } else {
+		fprintf(file, ".names %s\n", out->name->name);
+		fprintf(file, "0\n1\n");
+	    }
+	}
+    }
+}
+
+
+
+void write_int_connect(FILE *file, int v, vl_term *out)
+{
+    int lo, hi, i;
+    char buf[MAXSTRLEN];
+    lsList args;
+
+    lo = out->lo; hi = out->hi;
+    if (hi < lo) {
+	fprintf(file, ".names %s\n", out->name->name);
+	fprintf(file, "%d\n", (v&1));
+    } else {
+	args = lsCreate();
+	sprintf(buf, "%d", out->hi-out->lo+1);
+	lsNewEnd(args, (lsGeneric)vlStrdup(buf), 0);
+	sprintf(buf, "%d", v);
+	lsNewEnd(args, (lsGeneric)vlStrdup(buf), 0);
+
+	for (i=lo; i<=hi; i++, v >>= 1) {
+	    sprintf(buf, "%s%s%d%s", out->name->name,
+		    SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    fprintf(file, ".names %s\n", buf);
+	    fprintf(file, "%d\n", (v & 1));
+	}
+
+	lsDestroy(args, vl_chk_free);
+    }
+}
+
+
+
+vl_term *write_local_control(FILE *file, vl_term *ctrl, lsList sub_ctrls, int inverted)
+{
+    int i, j;
+    vl_term *retval;
+    lsGen gen;
+    lsHandle handle;
+    vl_term *sub_ctrl;
+    int unconditional_assign = 0;
+
+
+
+
+    if (!sub_ctrls)
+	unconditional_assign = 1;
+    else if (lsLength(sub_ctrls)==0)
+	unconditional_assign = 1;
+
+    if (unconditional_assign) {
+	retval = new_term(NIL(vl_range), 0, -1);
+	vl_write_bit_connect(file, ctrl->name->name, retval->name->name,
+			     inverted);
+	return retval;
+    }
+
+    retval = new_term(NIL(vl_range), 0, -1);
+
+    fprintf(file, ".names %s ", ctrl->name->name);
+    gen = lsStart(sub_ctrls);
+    if (lsNext(gen, (lsGeneric*)&sub_ctrl, &handle) == LS_OK) {
+	fprintf(file, "%s ", ((vl_term*)(((int)sub_ctrl)&~1))->name->name);
+	while (lsNext(gen, (lsGeneric*)&sub_ctrl, &handle) != LS_NOMORE) {
+	    fprintf(file, "%s ", ((vl_term*)(((int)sub_ctrl)&~1))->name->name);
+	}
+    }
+    lsFinish(gen);
+    fprintf(file, "%s\n", retval->name->name);
+
+    for (i=0; i<lsLength(sub_ctrls); i++) {
+	fprintf(file, "%c ", (inverted)?'0':'1');
+	for (j=0; j<lsLength(sub_ctrls); j++) {
+	    fprintf(file, "%c ", (i==j)?'1':'-');
+	}
+	fprintf(file, "1\n");
+    }
+
+    fprintf(file, "%c ", (inverted)?'0':'1');
+    gen = lsStart(sub_ctrls);
+    if (lsNext(gen, (lsGeneric*)&sub_ctrl, &handle) == LS_OK) {
+	fprintf(file, "%c ", ((int)sub_ctrl&1)?'1':'0');
+	while (lsNext(gen, (lsGeneric*)&sub_ctrl, &handle) != LS_NOMORE) {
+	    fprintf(file, "%c ", ((int)sub_ctrl&1)?'1':'0');
+	}
+    }
+    lsFinish(gen);
+    fprintf(file, "0\n");
+
+    fprintf(file, "%c ", (inverted)?'1':'0');
+    for (i=0; i<lsLength(sub_ctrls); i++) {
+	fprintf(file, "%c ", '-');
+    }
+    fprintf(file, "0\n");
+
+    return retval;
+}
+
+
+
+void write_switch(FILE *file, vl_id_range *id_sym,
+		  vl_term *sel, vl_expr *sel_expr,
+		  vl_term *orig, vl_term *new, vl_term *out_term)
+{
+    int lo, hi;
+    int bit_hi, bit_lo;
+    int idx;
+    vl_expr *hi_expr;
+    char new_buf[MAXSTRLEN], orig_buf[MAXSTRLEN], out_buf[MAXSTRLEN];
+
+    get_hilo(id_sym, &bit_hi, &bit_lo);
+
+    lo = vl_eval_expr(out_term->name->range->left);
+    if (out_term->name->range->right)
+	hi = vl_eval_expr(out_term->name->range->right);
+    else
+	hi = lo;
+
+    if (!sel) {
+	int const_hi, const_lo;
+
+	assert(ISVLCONST(sel_expr->type));
+
+	const_hi = min_bit_width(hi)-1;
+	const_lo = 0;
+	sel = new_term(NIL(vl_range), const_lo, const_hi);
+	write_var_decl(file, sel);
+	vl_write_const(file, sel_expr, sel);
+    }
+
+    hi_expr = vl_create_expr(IntExpr, hi, (double)0.0,
+			     NIL(void), NIL(void), NIL(void));
+    for (idx=lo; idx<=hi; idx++) {
+	vl_term *ctrl;
+	vl_term *new_elt, *orig_elt, *out_elt;
+	vl_expr *const_expr;
+	vl_term *const_trm;
+
+	const_expr = vl_create_expr(IntExpr, idx, (double)0.0,
+				    NIL(void), NIL(void), NIL(void));
+	const_trm = new_term(NIL(vl_range), 0, data_width(hi_expr)-1);
+#if 0
+	write_var_decl(file, const_trm);
+	vl_write_const(file, const_expr, const_trm);
+	vl_chk_free((char*)const_expr);
+
+	ctrl = new_term(NIL(vl_range), 0, -1);
+	vl_write_bin_comp(file, Beq2Expr, const_trm, sel, ctrl);
+#else
+	ctrl = new_term(NIL(vl_range), 0, -1);
+	vl_write_bin_equal_const(file, const_expr, sel, ctrl);
+	vl_chk_free((char*)const_expr);
+#endif
+	sprintf(new_buf, "%s%s%d%s",
+		new->name->name, SEP_LARRAY, idx, SEP_RARRAY);
+	if (rst_ckt && !strstr(orig->name->name, SEP_GATEPIN)) {
+	    int i;
+	    sprintf(orig_buf, "%s", new_termname());
+	    if (bit_lo == 0 && bit_hi == -1) {
+		if (out_term->term_type) {
+		    if (vis_nond) {
+			char *old_name;
+			vl_range *old_range;
+			vl_enumerator *enum_elt;
+			old_name = out_term->name->name;
+			old_range = out_term->name->range;
+			out_term->name->name = orig_buf;
+			out_term->name->range = NIL(vl_range);
+			write_var_decl(file, out_term);
+			out_term->name->name = old_name;
+			out_term->name->range = old_range;
+			lsFirstItem(out_term->term_type->specifier->u.enum_type->domain_list, (lsGeneric*)&enum_elt, 0);
+			fprintf(file, ".names %s\n%s\n", orig_buf,
+				enum_elt->name);
+		    } else {
+			fprintf(file, ".names %s\n-\n", orig_buf);
+		    }
+		} else {
+		    if (vis_nond) {
+			fprintf(file, ".names %s\n0\n", orig_buf);
+		    } else {
+			fprintf(file, ".names %s\n-\n", orig_buf);
+		    }
+		}
+	    } else {
+		for (i=bit_lo; i<=bit_hi; i++)
+		    if (vis_nond) {
+			fprintf(file, ".names %s%s%d%s\n0\n", orig_buf,
+				SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    } else {
+			fprintf(file, ".names %s%s%d%s\n-\n", orig_buf,
+				SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    }
+	    }
+	} else {
+	    sprintf(orig_buf, "%s%s%d%s",
+		    orig->name->name, SEP_LARRAY, idx, SEP_RARRAY);
+	}
+	sprintf(out_buf, "%s%s%d%s",
+		out_term->name->name, SEP_LARRAY, idx, SEP_RARRAY);
+	new_elt = new;
+	orig_elt = create_rename_term(orig->name, orig_buf, bit_lo, bit_hi);
+	orig_elt->name->range = NIL(vl_range);
+	orig_elt->flag = orig->flag;
+	orig_elt->term_type = orig->term_type;
+	out_elt = create_rename_term(out_term->name, out_buf, bit_lo, bit_hi);
+	out_elt->name->range = NIL(vl_range);
+	instantiate_mux(file, new_elt, orig_elt, ctrl, out_elt);
+    }
+    vl_chk_free((char*)hi_expr);
+}
+
+
+char *new_termname()
+{
+    static char sbuf[MAXSTRLEN];
+    static unsigned int TermCount=0;
+
+    sprintf(sbuf, "%s%x", NODE, TermCount++);
+    return sbuf;
+}
+
+char *new_instname()
+{
+    static char sbuf[MAXSTRLEN];
+    static unsigned int InstCount=0;
+
+    sprintf(sbuf, "%s%x%s", NODE, InstCount++, NODE);
+    return sbuf;
+}
+
+
+vl_range *get_decl_range(void *decl)
+{
+    if (!decl) return NIL(vl_range);
+    switch (((typestructPtr)(decl))->type) {
+    case InputDecl:
+    case OutputDecl:
+    case InoutDecl:
+    case RegDecl:
+	return ((vl_rangedeclPtr)(decl))->range;
+    case WireDecl:
+    case SWireDecl:
+    case TriDecl:
+    case Tri0Decl:
+    case Tri1Decl:
+    case TriandDecl:
+    case TriorDecl:
+    case WandDecl:
+    case WorDecl:
+	return ((vl_netdeclPtr)(decl))->range;
+    default:
+	return NIL(vl_range);
+    }
+}
+
+vl_expr *get_decl_range_left(void *decl)
+{
+    switch (((typestructPtr)(decl))->type) {
+    case InputDecl:
+    case OutputDecl:
+    case InoutDecl:
+    case RegDecl:
+	if (!((vl_rangedeclPtr)(decl))->range) return NIL(vl_expr);
+	return ((vl_rangedeclPtr)(decl))->range->left;
+    case WireDecl:
+    case SWireDecl:
+    case TriDecl:
+    case Tri0Decl:
+    case Tri1Decl:
+    case TriandDecl:
+    case TriorDecl:
+    case WandDecl:
+    case WorDecl:
+	if (!((vl_netdeclPtr)(decl))->range) return NIL(vl_expr);
+	return ((vl_netdeclPtr)(decl))->range->left;
+    default:
+	return NIL(vl_expr);
+    }
+}
+
+vl_expr *get_decl_range_right(void *decl)
+{
+    switch (((typestructPtr)(decl))->type) {
+    case InputDecl:
+    case OutputDecl:
+    case InoutDecl:
+    case RegDecl:
+	if (!((vl_rangedeclPtr)(decl))->range) return NIL(vl_expr);
+	return ((vl_rangedeclPtr)(decl))->range->right;
+    case WireDecl:
+    case SWireDecl:
+    case TriDecl:
+    case Tri0Decl:
+    case Tri1Decl:
+    case TriandDecl:
+    case TriorDecl:
+    case WandDecl:
+    case WorDecl:
+	if (!((vl_netdeclPtr)(decl))->range) return NIL(vl_expr);
+	return ((vl_netdeclPtr)(decl))->range->right;
+    default:
+	return NIL(vl_expr);
+    }
+}
+
+void *
+chng_decl_range(void *decl, vl_range *new_range)
+{
+    void *retval = NIL(void);
+    if (!decl) return decl;
+
+    switch (((typestructPtr)(decl))->type) {
+    case InputDecl:
+    case OutputDecl:
+    case InoutDecl:
+    case RegDecl:
+	retval = (void*)chk_malloc(sizeof(vl_rangedecl));
+	((vl_rangedeclPtr)(retval))->type = ((vl_rangedeclPtr)decl)->type;
+	((vl_rangedeclPtr)(retval))->flags = ((vl_rangedeclPtr)decl)->flags;
+	((vl_rangedeclPtr)(retval))->handle = ((vl_rangedeclPtr)decl)->handle;
+	((vl_rangedeclPtr)(retval))->ids = lsCreate();
+	((vl_rangedeclPtr)(retval))->range = new_range;
+	break;
+    case WireDecl:
+    case SWireDecl:
+    case TriDecl:
+    case Tri0Decl:
+    case Tri1Decl:
+    case TriandDecl:
+    case TriorDecl:
+    case WandDecl:
+    case WorDecl:
+	retval = (void*)chk_malloc(sizeof(vl_netdecl));
+	((vl_netdeclPtr)(retval))->type = ((vl_netdeclPtr)decl)->type;
+	((vl_netdeclPtr)(retval))->flags = ((vl_netdeclPtr)decl)->flags;
+	((vl_netdeclPtr)(retval))->strength = ((vl_netdeclPtr)decl)->strength;
+	((vl_netdeclPtr)(retval))->delay = ((vl_netdeclPtr)decl)->delay;
+	((vl_netdeclPtr)(retval))->handle = ((vl_netdeclPtr)decl)->handle;
+	((vl_netdeclPtr)(retval))->ids = lsCreate();
+	((vl_netdeclPtr)(retval))->range = new_range;
+	break;
+    default:
+	break;
+    }
+    return retval;
+}
+
+short get_decl_flags(void *decl)
+{
+    if (!decl) return 0;
+
+    switch (((typestructPtr)(decl))->type) {
+    case InputDecl:
+    case OutputDecl:
+    case InoutDecl:
+    case RegDecl:
+	return ((vl_rangedeclPtr)(decl))->flags;
+    case WireDecl:
+    case SWireDecl:
+    case TriDecl:
+    case Tri0Decl:
+    case Tri1Decl:
+    case TriandDecl:
+    case TriorDecl:
+    case WandDecl:
+    case WorDecl:
+	return ((vl_netdeclPtr)(decl))->flags;
+    default:
+	return 0;
+    }
+}
+
+void get_type(vl_id_range *id, vl_type **var_type)
+{
+
+    id = id;
+    var_type = var_type;
+}
+
+
+void get_hilo(vl_id_range *id, int *hi, int *lo)
+{
+    vl_expr *left, *right;
+    int leftval, rightval;
+
+    if (get_decl_range(id->mpg_master_exp)) {
+	left = get_decl_range_left(id->mpg_master_exp);
+	right = get_decl_range_right(id->mpg_master_exp);
+	leftval = vl_eval_expr(left);
+	rightval = vl_eval_expr(right);
+	if (leftval > rightval) {
+	    int temp;
+
+	    temp=leftval; leftval = rightval; rightval = temp;
+	}
+	*lo = leftval;
+	*hi = rightval;
+    } else {
+	*lo = 0;
+	*hi = -1;
+    }
+}
+
+
+
+void insert_control_list(var_info *cur_var, vl_term *sel)
+{
+    vl_id_range *id_sym;
+
+    if (!sel) return;
+    st_lookup(vl_currentModule->sig_st, cur_var->id->name, (char**)&id_sym);
+    lsNewEnd(cur_var->cond_list, (lsGeneric)sel, LS_NH);
+}
+
+
+void print_control_var_pair(FILE *file, char *ctrl, char *var)
+{
+    fprintf(file, "%s %s ", ctrl, var);
+}
+
+
+
+vl_term *write_multi_in_or(FILE *file, lsList in_list)
+{
+    lsGen gen;
+    lsHandle handle;
+    vl_term *term_out;
+    vl_term *in_term, *true_in_term;
+    int i, j;
+
+    term_out = new_term(NIL(vl_range), 0, -1);
+
+    fprintf(file, ".names ");
+    gen = lsStart(in_list);
+    if (lsNext(gen, (lsGeneric*)&in_term, &handle) == LS_OK) {
+	true_in_term = (vl_term*)((int)in_term & (~1));
+	fprintf(file, "%s ", true_in_term->name->name);
+	while (lsNext(gen, (lsGeneric*)&in_term, &handle) != LS_NOMORE) {
+	    true_in_term = (vl_term*)((int)in_term & (~1));
+	    fprintf(file, "%s ", true_in_term->name->name);
+	}
+    }
+    fprintf(file, "%s\n", term_out->name->name);
+    lsFinish(gen);
+
+    if (set_notation) {
+	fprintf(file, "%s 1\n", HSIS_DEFAULT);
+    } else {
+	gen = lsStart(in_list);
+	for (i=0; i<lsLength(in_list); i++) {
+	    lsNext(gen, (lsGeneric*)&in_term, &handle);
+	    for (j=0; j<lsLength(in_list); j++) {
+		fprintf(file, "%c ", (i==j)?(((int)in_term&1)?'0':'1'):'-');
+	    }
+	    fprintf(file, "1\n");
+	}
+	lsFinish(gen);
+    }
+
+    gen = lsStart(in_list);
+    if (lsNext(gen, (lsGeneric*)&in_term, &handle) == LS_OK) {
+	fprintf(file, "%c ", ((int)in_term&1)?'1':'0');
+	while (lsNext(gen, (lsGeneric*)&in_term, &handle) != LS_NOMORE) {
+	    fprintf(file, "%c ", ((int)in_term&1)?'1':'0');
+	}
+    }
+    lsFinish(gen);
+    fprintf(file, "0\n");
+
+    return term_out;
+}
+
+
+
+vl_term *array_or(FILE *file, array_t *in_array)
+{
+    vl_term *term_out;
+    vl_term *in_term, *true_in_term;
+    int i, j;
+    int ithItem;
+
+    term_out = new_term(NIL(vl_range), 0, -1);
+
+    fprintf(file, ".names ");
+    ithItem = 0;
+    for (i=0; i<array_n(in_array); i++) {
+	true_in_term = array_fetch(vl_term*, in_array, i);
+	if (true_in_term) {
+	    fprintf(file, "%s ", true_in_term->name->name);
+	}
+
+    }
+    fprintf(file, "%s\n", term_out->name->name);
+
+    if (set_notation) {
+	fprintf(file, "%s 1\n", HSIS_DEFAULT);
+    } else {
+	for (i=0; i<array_n(in_array); i++) {
+	    in_term = array_fetch(vl_term*, in_array, i);
+	    if (!in_term) continue;
+	    for (j=0; j<array_n(in_array); j++) {
+		if (array_fetch(vl_term*, in_array, j))
+		    fprintf(file, "%c ", (i==j)?'1':'-');
+	    }
+	    fprintf(file, "1\n");
+	}
+    }
+
+    for (i=0; i<array_n(in_array); i++)
+	if (array_fetch(vl_term*, in_array, i))
+	    fprintf(file, "0 ");
+    fprintf(file, "0\n");
+
+    return term_out;
+}
+
+
+vl_term *syndrome_to_control(FILE *file, char *key, st_table *sig_st)
+{
+    vl_term *retval=NIL(vl_term);
+    vl_id_range *id_sym;
+    syndrome_expr *se;
+    vl_term *ctrl_term;
+    int ith_var = 0;
+    char *syndrome;
+    char *dc;
+    lsList comp;
+    lsGen gen;
+    lsHandle handle;
+    var_info *cur_var;
+    int fg_id = -1;
+    char lc_name[MAXSTRLEN];
+    int need_leading_and = 1;
+    int ithItem;
+
+    if (!st_lookup(sig_st, key, (char**)&cur_var)) return true_term(file);
+    id_sym = cur_var->id;
+
+
+    if (!(dc = check_dc((!rst_ckt)?id_sym->syndrome_expr_list:
+			id_sym->rst_syndrome_expr_list)))
+	return NIL(vl_term);;
+
+
+    retval = new_term(NIL(vl_range), 0, -1);
+    if (!vlTimedSystem)
+	if (isTautology((!rst_ckt)?id_sym->syndrome_expr_list:
+				   id_sym->rst_syndrome_expr_list))
+	    retval->flag |= TautologyTrue;
+    if (vlTimedSystem && !rst_ckt) {
+	for (gen=lsStart((!rst_ckt)?
+			 id_sym->syndrome_expr_list:
+			 id_sym->rst_syndrome_expr_list);
+	     lsNext(gen,(lsGeneric*)&se,&handle)!=LS_NOMORE; ) {
+	    st_table *dummy;
+	    if (st_lookup(vl_description->fg_vars_st, (char*)se->fg_id,
+			  (char**)&dummy))
+		if (dummy == sig_st) {
+		    fg_id = se->fg_id; break;
+		}
+	}
+	lsFinish(gen);
+	sprintf(lc_name, "%s%06x", FG_LC_PS, fg_id);
+	if (fg_id != -1) {
+	    fprintf(file, ".names %s ", lc_name);
+	} else {
+	    fprintf(file, ".names %s\n0\n", retval->name->name);
+	    retval->flag |= ConflictFalse;
+	    return retval;
+	}
+    } else {
+	fprintf(file, ".names ");
+    }
+    ithItem = 0;
+    for (gen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), ith_var=0;
+	 lsNext(gen,(lsGeneric*)&ctrl_term,&handle)!=LS_NOMORE; ith_var++) {
+	if (!dc[ith_var]) {
+	    fprintf(file, "%s ", ctrl_term->name->name);
+	}
+    }
+    lsFinish(gen);
+
+    fprintf(file, "%s\n", retval->name->name);
+
+    if (set_notation)
+	fprintf(file, "%s 0\n", HSIS_DEFAULT);
+
+    for (gen=lsStart((!rst_ckt)?
+		     id_sym->syndrome_expr_list:
+		     id_sym->rst_syndrome_expr_list);
+	 lsNext(gen,(lsGeneric*)&se,&handle)!=LS_NOMORE; ) {
+	st_table *dummy;
+	int printed;
+
+	printed = 0;
+	if (st_lookup(vl_description->fg_vars_st, (char*)se->fg_id,
+		      (char**)&dummy))
+	    if (dummy == sig_st) {
+		if (vlTimedSystem && !rst_ckt)
+		    fg_put_loc_context(file, se->pre_cond, lc_name);
+		fprintf(file, " ");
+		printed = put_entry(file, se->syndrome, dc, need_leading_and);
+		if (!need_leading_and && !printed)
+		    fprintf(file, "%d ", 1);
+		fprintf(file, "1\n");
+	    }
+    }
+    lsFinish(gen);
+
+    if (!set_notation) {
+	comp=put_guard_zero(file, (!rst_ckt)?
+			    id_sym->syndrome_expr_list:
+			    id_sym->rst_syndrome_expr_list);
+	for (gen=lsStart(comp); lsNext(gen,&syndrome,&handle)!=LS_NOMORE; ) {
+	    put_entry(file, syndrome, dc, 1);
+	    fprintf(file, "0\n");
+	}
+	lsFinish(gen);
+    }
+
+    vl_chk_free(dc);
+
+    return retval;
+}
+
+
+lsList put_guard_zero(FILE *file, lsList se_list)
+{
+    lsList retval=(lsList)0;
+
+    return retval;
+}
+
+
+lsList get_transition(FILE *file)
+{
+    lsList retval;
+    char buf[MAXSTRLEN], *cp;
+    char syndrome[MAXSTRLEN];
+    int n_entries, i;
+
+    retval = lsCreate();
+    while (fgets(buf, MAXSTRLEN-1, file)) {
+	if ((cp = strstr(buf, ".p")) != NIL(char)) {
+	    cp += strlen(".p");
+	    n_entries = atoi(cp);
+	    for (i=0; i<n_entries && fgets(buf, MAXSTRLEN-1, file); i++) {
+		sscanf(buf, "%s", syndrome);
+		lsNewEnd(retval, vlStrdup(syndrome), 0);
+	    }
+	    break;
+	}
+    }
+    return retval;
+}
+
+
+int put_entry(FILE *file, char *str, char *dc, int need_leading_and)
+{
+    unsigned int i;
+    lsGen gen;
+    lsHandle handle;
+    vl_term *ctrl_term;
+    int print_something=0;
+
+    for (i=0, gen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list);
+	 i<strlen(str) && lsNext(gen,(lsGeneric*)&ctrl_term,&handle)!=LS_NOMORE;
+	 i++) {
+	if (!dc) {
+	    fprintf(file, "%c ", str[i]);
+	} else if (!dc[i]) {
+	    fprintf(file, "%c ", str[i]);
+	}
+    }
+
+    return print_something;
+}
+
+
+int put_blif_header(FILE *file, lsList se_list)
+{
+    int terminal_count=0;
+    int retval;
+    unsigned int i;
+    syndrome_expr *se;
+
+    fprintf(file, ".model scratch\n");
+    fprintf(file, ".outputs n%d\n", retval = terminal_count++);
+    if (lsLength(se_list)) {
+	fprintf(file, ".inputs");
+	lsFirstItem(se_list, (lsGeneric*)&se, 0);
+	for (i=0; i<strlen(se->syndrome); i++) {
+	    fprintf(file, " n%d", terminal_count++);
+	}
+	fprintf(file, "\n");
+    }
+    return retval;
+}
+
+
+int put_blif_gate_header(FILE *file, lsList se_list)
+{
+    int terminal_count=0;
+    int retval;
+    unsigned int i;
+    syndrome_expr *se;
+
+    fprintf(file, ".names");
+    if (lsLength(se_list)) {
+	lsFirstItem(se_list, (lsGeneric*)&se, 0);
+	for (i=0; i<strlen(se->syndrome); i++) {
+	    fprintf(file, " n%d", ++terminal_count);
+	}
+    }
+    fprintf(file, " n%d\n", retval = ++terminal_count);
+
+    return retval;
+}
+
+void put_blif_tail(FILE *file)
+{
+    fprintf(file, ".end\n\n");
+}
+
+
+vl_term *write_array_access(FILE *file, vl_id_range *id_sym, vl_term *idx_term, vl_expr *idx_expr)
+{
+    int lo, hi, idx;
+    int bit_lo, bit_hi, bit;
+    int i, j;
+    unsigned int k;
+    vl_term *retval;
+    char buf[MAXSTRLEN];
+
+    lo = vl_eval_expr(id_sym->range->left);
+    if (id_sym->range->right)
+	hi = vl_eval_expr(id_sym->range->right);
+    else
+	hi = lo;
+
+
+    if (!idx_term) {
+	int const_hi, const_lo;
+
+	assert(ISVLCONST(idx_expr->type));
+
+	const_hi = min_bit_width(hi)-1;
+	const_lo = 0;
+	idx_term = new_term(NIL(vl_range), const_lo, const_hi);
+	write_var_decl(file, idx_term);
+	vl_write_const(file, idx_expr, idx_term);
+    }
+
+
+    get_hilo(id_sym, &bit_hi, &bit_lo);
+    retval = new_term(NIL(vl_range), bit_lo, bit_hi);
+    retval->flag = id_sym->flags;
+    retval->term_type = id_sym->id_type;
+    write_var_decl(file, retval);
+
+    if (bit_lo > bit_hi) {
+	if (id_sym->flags & MVar) {
+
+	    lsList domain;
+
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+
+	    fprintf(file, ".names ");
+	    for (i=idx_term->hi; i>=idx_term->lo; i--) {
+		fprintf(file, "%s%s%d%s ", idx_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    }
+	    for (idx=lo; idx<=hi; idx++) {
+		fprintf(file, "%s%s%d%s ", id_sym->name,
+			SEP_LARRAY, idx, SEP_RARRAY);
+	    }
+	    fprintf(file, "%s\n", retval->name->name);
+
+
+	    if (set_notation) {
+		for (i=0; i<(1<<(idx_term->hi-idx_term->lo+1)); i++) {
+		    strcpy(buf,
+			   num_to_binstr(i,(idx_term->hi-idx_term->lo+1)));
+		    for (k=0; k<strlen(buf); k++)
+			fprintf(file, "%c ", buf[k]);
+		    for (idx=lo; idx<=hi; idx++) fprintf(file, "- ");
+		    if (i <= hi && i >= lo)
+			fprintf(file, "%s%s%s%d%s\n", HSIS_EQUAL,
+				id_sym->name, SEP_LARRAY, i, SEP_RARRAY);
+		    else {
+			if (arrayBoundNond) {
+			    fprintf(file, "-\n");
+			} else {
+			    vl_enumerator *enum_elt;
+			    lsFirstItem(id_sym->id_type->specifier
+					    ->u.enum_type->domain_list,
+					(lsGeneric*)&enum_elt, 0);
+			    fprintf(file, "%s\n", enum_elt->name);
+			}
+		    }
+		}
+	    } else {
+		lsList domain;
+		lsGen enum_gen;
+		lsHandle enum_handle;
+		vl_enumerator *enum_elt;
+		domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+		for (i=0; i<(1<<(idx_term->hi-idx_term->lo+1)); i++) {
+		    for (enum_gen=lsStart(domain);
+			 lsNext(enum_gen,(lsGeneric*)&enum_elt,&enum_handle)!=
+			 LS_NOMORE; ) {
+			strcpy(buf,
+			       num_to_binstr(i,(idx_term->hi-idx_term->lo+1)));
+			for (k=0; k<strlen(buf); k++)
+			    fprintf(file, "%c ", buf[k]);
+			for (idx=lo; idx<=hi; idx++)
+			    fprintf(file, "%s ",
+				    (idx==i)?enum_elt->name:"-");
+			fprintf(file, "%s\n",
+				(i<=hi && i>=lo)?enum_elt->name:
+				    (arrayBoundNond)?"-":enum_elt->name);
+		    }
+		    lsFinish(enum_gen);
+		}
+	    }
+	} else {
+
+	    fprintf(file, ".names ");
+	    for (i=idx_term->hi; i>=idx_term->lo; i--) {
+		fprintf(file, "%s%s%d%s ", idx_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    }
+	    for (idx=lo; idx<=hi; idx++) {
+		fprintf(file, "%s%s%d%s ", id_sym->name,
+			SEP_LARRAY, idx, SEP_RARRAY);
+	    }
+	    fprintf(file, "%s\n", retval->name->name);
+	    fprintf(file, ".def 0\n");
+
+	    for (i=0; i<(1<<(idx_term->hi-idx_term->lo+1)); i++) {
+		for (j=0; j<=1; j++) {
+		    if (j==0 && i<=hi && i>=lo) continue;
+		    if ((i>hi || i<lo) && !arrayBoundNond) continue;
+		    strcpy(buf,
+			   num_to_binstr(i, (idx_term->hi-idx_term->lo+1)));
+		    for (k=0; k<strlen(buf); k++)
+			fprintf(file, "%c ", buf[k]);
+		    for (idx=lo; idx<=hi; idx++) {
+			fprintf(file, "%c ", (idx==i)?((j==0)?'0':'1'):'-');
+		    }
+		    fprintf(file, "%c\n", (i<=hi && i>=lo)?'1':'-');
+		}
+	    }
+	}
+    } else {
+	for (bit=bit_lo; bit<=bit_hi; bit++) {
+
+	    fprintf(file, ".names ");
+	    for (i=idx_term->hi; i>=idx_term->lo; i--) {
+		fprintf(file, "%s%s%d%s ", idx_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    }
+	    for (idx=lo; idx<=hi; idx++) {
+		fprintf(file, "%s%s%d%s%s%d%s ", id_sym->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			SEP_LBITSELECT, bit, SEP_RBITSELECT);
+	    }
+	    fprintf(file, "%s%s%d%s\n", retval->name->name,
+		    SEP_LBITSELECT,bit,SEP_RBITSELECT);
+	    fprintf(file, ".def 0\n");
+
+	    for (i=0; i<(1<<(idx_term->hi-idx_term->lo+1)); i++) {
+		for (j=0; j<=1; j++) {
+		    if (j==0 && i<=hi && i>=lo) continue;
+		    if ((i>hi || i<lo) && !arrayBoundNond) continue;
+		    strcpy(buf,
+			   num_to_binstr(i,(idx_term->hi-idx_term->lo+1)));
+		    for (k=0; k<strlen(buf); k++)
+			fprintf(file, "%c ", buf[k]);
+		    for (idx=lo; idx<=hi; idx++) {
+			fprintf(file, "%c ", (idx==i)?((j==0)?'0':'1'):'-');
+		    }
+		    fprintf(file, "%c\n", (i<=hi && i>=lo)? '1':'-');
+		}
+	    }
+	}
+    }
+
+    return retval;
+}
+
+
+char *sel_var(char *name)
+{
+    return name;
+}
+
+int isMVar(short unsigned flag)
+{
+    return (flag & MVar);
+}
+
+int isOutPort(short unsigned flag)
+{
+    return (flag & OutPort);
+}
+
+
+void check_assign(vl_bassign_stmt *assign, int procedural)
+{
+    vl_id_range *lhs_id;
+    char buf[MAXSTRLEN];
+
+    st_lookup(vl_currentModule->sig_st,
+	      assign->lhs->name->name, (char**)&lhs_id);
+
+    if (procedural) {
+	if (assign->type != NbassignStmt &&
+	    assign->type != DelayNbassignStmt &&
+	    assign->type != EventNbassignStmt &&
+	    !(lhs_id->flags & RegVar)) {
+	    yylineno = assign->lineno;
+	    sprintf(buf,
+	      "error: wire '%s' is used as lhs of = in procedural statement\n",
+		    lhs_id->name);
+	    compile_error(buf);
+	}
+	if (lhs_must_be_wire && (lhs_id->flags & RegVar)) {
+
+	}
+	if (compatibleChecking && !(lhs_id->flags & RegVar)) {
+	    yylineno = assign->lineno;
+	    sprintf(buf,
+	      "error: wire '%s' is used as lhs of <= in procedural statement\n",
+		    lhs_id->name);
+	    compile_error(buf);
+	}
+    } else {
+	if (lhs_id->flags & RegVar) {
+	    yylineno = assign->lineno;
+	    sprintf(buf,
+	      "error: reg '%s' is used as lhs of continus assignment\n",
+		    lhs_id->name);
+	    compile_error(buf);
+	}
+    }
+}
+
+
+void instantiate_reset_mux(FILE *file, vl_id_range *id_sym, int lo, int hi,
+  var_info *var, var_info *lvar)
+{
+    extern vl_term *Initial_Signal;
+    vl_term *term_out;
+    char buf[MAXSTRLEN];
+    vl_term *init_term;
+
+    sprintf(buf, "%s%s", id_sym->name, new_termname());
+    term_out = create_rename_term(id_sym, buf, lo, hi);
+    term_out->flag =
+	get_decl_flags(var->id->mpg_master_exp);
+    write_var_decl(file,term_out);
+    lsFirstItem(id_sym->initial, (lsGeneric*)&init_term, 0);
+    instantiate_mux(file, init_term,
+		    lvar->current_terminal,
+		    Initial_Signal, term_out);
+    lvar->current_terminal = term_out;
+}
+
+
+void instantiate_input_latch(FILE *file, vl_id_range *id_sym)
+{
+    char buf[MAXSTRLEN];
+
+    sprintf(buf, "%s%s%s", id_sym->name, SEP_DIR, PIN_IN);
+    if (id_sym->flags & InPort && id_sym->flags & RegVar) {
+	if (!instantiateInputLatch) return;
+	if (id_sym->flags & MVar) {
+	    fprintf(file, ".latch %s %s\n", id_sym->name, buf);
+	} else {
+	    int i, lo, hi;
+
+	    get_hilo(id_sym, &hi, &lo);
+	    if (lo > hi) {
+		fprintf(file, ".latch %s %s\n", id_sym->name, buf);
+	    } else {
+		for (i=lo; i<=hi; i++) {
+		    fprintf(file, ".latch %s%s%d%s %s%s%d%s\n",
+			    id_sym->name,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT,
+			    buf, SEP_LBITSELECT, i, SEP_RBITSELECT);
+		}
+	    }
+	}
+    }
+}
+
+
+void instantiate_hidden_latch(FILE *file, vl_id_range *id_sym)
+{
+    char buf[MAXSTRLEN];
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+
+    if (!id_sym->mpg_master_exp) return;
+    if (strstr(id_sym->name, SEP_LATCH)) return;
+
+    sprintf(buf, "%s%s", id_sym->name, PIN_HIDDEN);
+    if (id_sym->flags & HiddenLatch) {
+	if (id_sym->flags & MVar) {
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+	    fprintf(file, ".mv %s %d ", buf, lsLength(domain));
+	    for (enum_gen = lsStart(domain);
+		 lsNext(enum_gen, (lsGeneric*)&enum_elt, &enum_handle) !=
+		     LS_NOMORE;) {
+		fprintf(file, "%s ", enum_elt->name);
+	    }
+	    lsFinish(enum_gen);
+	    fprintf(file, "\n");
+	    fprintf(file, ".latch %s %s\n", id_sym->name, buf);
+	    fprintf(file, ".r %s\n-\n", buf);
+	} else {
+	    int i, lo, hi;
+
+	    get_hilo(id_sym, &hi, &lo);
+	    if (lo > hi) {
+		fprintf(file, ".latch %s %s\n", id_sym->name, buf);
+		fprintf(file, ".r %s\n-\n", buf);
+	    } else {
+		for (i=lo; i<=hi; i++) {
+		    fprintf(file, ".latch %s%s%d%s %s%s%d%s\n",
+			    id_sym->name, SEP_LBITSELECT, i, SEP_RBITSELECT,
+			    buf, SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    fprintf(file, ".r %s%s%d%s\n-\n",
+			    buf, SEP_LBITSELECT, i, SEP_RBITSELECT);
+		}
+	    }
+	}
+    }
+}
+
+
+char *check_dc(lsList syndrome_expr_list)
+{
+    lsGen lgen;
+    lsHandle handle;
+    char *retval;
+    int nsym;
+    syndrome_expr *se;
+    int i;
+    int rtvl;
+
+    if (lsLength(syndrome_expr_list) == 0) return NIL(char);
+
+    rtvl = lsFirstItem(syndrome_expr_list,(lsGeneric*)&se,0);
+    assert(rtvl == LS_OK);
+    nsym = strlen(se->syndrome);
+    retval = (char*)chk_malloc(nsym * sizeof(char));
+    for (i=0; i<nsym; i++) {
+	retval[i] = 1;
+	for (lgen=lsStart(syndrome_expr_list);
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+	    if (se->syndrome[i] != '-')
+		retval[i] = 0;
+	}
+	(void)lsFinish(lgen);
+    }
+
+    return retval;
+}
+
+
+void put_nblock_transition(FILE *file, int non_block_wire, int n_entries,
+		      vl_id_range *id_sym, int idx_lo, int idx_hi, int cur, char *dc, lsList ripple)
+{
+    lsGen lgen;
+    lsList comp;
+    lsHandle handle;
+    int lo, hi;
+    int i, j, k;
+    char *syndrome;
+    syndrome_expr *se;
+    lsList domain=(lsList)0;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+    for (lgen=lsStart((!rst_ckt)?
+		      id_sym->syndrome_expr_list:
+		      id_sym->rst_syndrome_expr_list),
+	 i=0;
+	 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE; i++) {
+	if (!(id_sym->flags & MVar)) {
+	    lo=0; hi=1;
+	} else {
+	    get_hilo(id_sym, &hi, &lo);
+	}
+
+	if (id_sym->id_type)
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+
+	if (!(id_sym->flags & MVar)) {
+	    for (k=lo; k<=hi; k++) {
+		if (vlTimedSystem && !rst_ckt)
+		    fg_put_loc_context(file, se->pre_cond, NIL(char));
+		fprintf(file, " ");
+		put_entry(file, se->syndrome, dc, 1);
+
+		if (ripple) {
+		    for (j=0; j<i; j++) fprintf(file, "- ");
+		    fprintf(file, "%d ", 1); j++;
+		    for (; j<n_entries; j++) fprintf(file, "- ");
+		}
+
+		for (j=0; j<i; j++) fprintf(file, "- ");
+		fprintf(file, "%d ", k); j++;
+		for (; j<n_entries; j++) fprintf(file, "- ");
+		fprintf(file, "%s%d\n", (non_block_wire||rst_ckt)?"":"- ", k);
+	    }
+	} else {
+	    for (enum_gen=lsStart(domain);
+		 lsNext(enum_gen,
+			(lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+		if (vlTimedSystem && !vlTimedSystem)
+		    fg_put_loc_context(file, se->pre_cond, NIL(char));
+		fprintf(file, " ");
+		put_entry(file, se->syndrome, dc, 1);
+
+		if (ripple) {
+		    for (j=0; j<i; j++) fprintf(file, "- ");
+		    fprintf(file, "%d ", 1); j++;
+		    for (; j<n_entries; j++) fprintf(file, "- ");
+		}
+
+		for (j=0; j<i; j++) fprintf(file, "- ");
+		fprintf(file, "%s ", enum_elt->name); j++;
+		for (; j<n_entries; j++) fprintf(file, "- ");
+		fprintf(file, "%s%s\n",
+			(non_block_wire||rst_ckt)?"":"- ", enum_elt->name);
+	    }
+	    lsFinish(enum_gen);
+	}
+
+
+    }
+    lsFinish(lgen);
+
+
+    if (deadlock_semantic) {
+	comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list:
+			      id_sym->rst_syndrome_expr_list);
+	if (comp)
+	    if (lsLength(comp) > 0 && !(id_sym->flags & RegVar)) {
+		char buf[MAXSTRLEN], tmp_buf[MAXSTRLEN];
+		strcpy(tmp_buf, id_sym->name);
+		strip_char(tmp_buf,SEP_LATCH);
+		sprintf(buf, "%s: wire '%s' might be unassigned in certain context(s).\n", vl_currentModule->name->name, tmp_buf);
+		strcat(buf, "\tDeadlock is assumed. To make its value a don't care, turn off -k option");
+		if (WarningLevel > 0)
+		    Translate_Notice(buf);
+	    }
+    }
+
+
+    if (!set_notation && !(deadlock_semantic && non_block_wire)) {
+	comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list:
+			      id_sym->rst_syndrome_expr_list);
+	if (!(id_sym->flags & MVar)) {
+	    for (lgen=lsStart(comp);
+		 lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) {
+		if (!(id_sym->flags & MVar)) {
+		    lo=0; hi=1;
+		}
+		for (k=lo; k<=hi; k++) {
+		    put_entry(file, syndrome, dc, 1);
+		    for (j=0; j<n_entries*((ripple)?2:1); j++)
+			fprintf(file, "- ");
+		    if (non_block_wire || rst_ckt)
+			fprintf(file, "%d\n", k);
+		    else
+			fprintf(file, "%d %d\n", k, k);
+		}
+	    }
+	    lsFinish(lgen);
+	} else {
+	    for (lgen=lsStart(comp);
+		 lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) {
+		if (!(id_sym->flags & MVar)) {
+		    lo=0; hi=1;
+		}
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,
+			    (lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+		    put_entry(file, syndrome, dc, 1);
+		    for (j=0; j<n_entries*((ripple)?2:1); j++)
+			fprintf(file, "- ");
+		    if (non_block_wire || rst_ckt)
+			fprintf(file, "%s\n", enum_elt->name);
+		    else
+			fprintf(file, "%s %s\n",
+				enum_elt->name, enum_elt->name);
+		}
+		lsFinish(enum_gen);
+	    }
+	    lsFinish(lgen);
+	}
+    }
+
+
+    idx_lo = idx_lo;
+    idx_hi = idx_hi;
+    cur = cur;
+}
+
+
+void put_nblock_mout_transition(FILE *file, int non_block_wire,
+				int n_entries,
+				vl_id_range *id_sym,
+				int idx_lo, int idx_hi, int cur,
+				char *dc, char *latch_name)
+{
+    lsGen lgen;
+    lsList comp;
+    lsHandle handle;
+    int lo, hi;
+    int i, j, k;
+    char *syndrome;
+    syndrome_expr *se;
+
+    for (lgen=lsStart((!rst_ckt)?
+		      id_sym->syndrome_expr_list:
+		      id_sym->rst_syndrome_expr_list),
+	 i=0;
+	 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE; i++) {
+	if (!(id_sym->flags & MVar)) {
+	    lo=0; hi=1;
+	} else {
+	    get_hilo(id_sym, &hi, &lo);
+	}
+
+	if (vlTimedSystem && !rst_ckt)
+	    fg_put_loc_context(file, se->pre_cond, NIL(char));
+	fprintf(file, " ");
+	put_entry(file, se->syndrome, dc, 1);
+
+	for (j=0; j<n_entries; j++)
+	    if (idx_lo == 0 && idx_hi == -1)
+		fprintf(file, "- ");
+	    else
+		for (k=idx_lo; k<=idx_hi; k++) fprintf(file, "- ");
+	if (!(non_block_wire||rst_ckt)) {
+	    if (idx_lo == 0 && idx_hi == -1)
+		fprintf(file, "- ");
+	    else
+		for (k=idx_lo; k<=idx_hi; k++)
+		    fprintf(file, "- ");
+	}
+	if (id_sym->flags & MVar || (idx_lo==0 && idx_hi==-1)) {
+	    fprintf(file, "%s%s\n", HSIS_EQUAL, se->expr->name->name);
+	} else {
+	    for (k=idx_lo; k<=idx_hi; k++) {
+		fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+			se->expr->name->name,
+			SEP_LBITSELECT, k, SEP_RBITSELECT);
+	    }
+	    fprintf(file, "\n");
+	}
+    }
+    lsFinish(lgen);
+
+
+    if (deadlock_semantic) {
+	comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list:
+			      id_sym->rst_syndrome_expr_list);
+	if (comp)
+	    if (lsLength(comp) > 0 && !(id_sym->flags & RegVar)) {
+		char buf[MAXSTRLEN], tmp_buf[MAXSTRLEN];
+		strcpy(tmp_buf, id_sym->name);
+		strip_char(tmp_buf,SEP_LATCH);
+		sprintf(buf, "%s: wire '%s' might be unassigned in certain context(s).\n", vl_currentModule->name->name, tmp_buf);
+		strcat(buf, "\tDeadlock is assumed. To make its value a don't care, use -k option");
+		if (WarningLevel > 0)
+		    Translate_Notice(buf);
+	    }
+    }
+
+
+    if (!set_notation && !(deadlock_semantic && non_block_wire)) {
+	comp = put_guard_zero(file, (!rst_ckt)?id_sym->syndrome_expr_list:
+			      id_sym->rst_syndrome_expr_list);
+	for (lgen=lsStart(comp);
+	     lsNext(lgen,&syndrome,&handle)!=LS_NOMORE;) {
+
+	    put_entry(file, syndrome, dc, 1);
+	    for (j=0; j<n_entries; j++)
+		if (idx_lo == 0 && idx_hi == -1)
+		    fprintf(file, "- ");
+		else
+		    for (k=idx_lo; k<=idx_hi; k++) fprintf(file, "- ");
+	    if (!(non_block_wire || rst_ckt)) {
+		if (idx_lo == 0 && idx_hi == -1)
+		    fprintf(file, "- ");
+		else
+		    for (k=idx_lo; k<=idx_hi; k++)
+			fprintf(file, "- ");
+	    }
+	    if (id_sym->flags & MVar || (idx_lo==0 && idx_hi==-1)) {
+		if (!(non_block_wire || rst_ckt)) {
+		    fprintf(file, "%s%s\n", HSIS_EQUAL, latch_name);
+		} else {
+		    fprintf(file, "-\n");
+		}
+	    } else {
+		if (!(non_block_wire || rst_ckt))
+		    for (k=idx_lo; k<=idx_hi; k++) {
+			fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+				latch_name, SEP_LBITSELECT, k, SEP_RBITSELECT);
+		    }
+		else
+		    for (k=idx_lo; k<=idx_hi; k++) {
+			fprintf(file,"-");
+		    }
+		fprintf(file, "\n");
+	    }
+	}
+
+	lsFinish(lgen);
+    }
+
+
+    cur = cur;
+}
+
+
+void create_wire_nondeterminism(FILE *file, char * var_name,
+				vl_id_range *id_sym, array_t *vars_array)
+{
+    char buf[MAXSTRLEN];
+    char input_buf[MAXSTRLEN];
+    char *cp;
+    st_table *vars;
+    var_info *cur_var;
+    int h, i, j, k;
+    int hi, lo;
+    int num_changer=0;
+    lsList domain;
+    lsGen enum_gen;
+    lsHandle enum_handle;
+    vl_enumerator *enum_elt;
+
+
+    get_hilo(id_sym, &hi, &lo);
+
+    cp = buf; *cp = '\0';
+    cp = strappend(cp, ".names ");
+    for (i=0; i<array_n(vars_array); i++) {
+	vars = array_fetch(st_table*, vars_array, i);
+	if (vars) {
+	    if (st_lookup(vars, var_name, (char**)&cur_var)) {
+		num_changer++;
+		cp = strappendS(cp,
+				cur_var->current_terminal->name->name);
+	    }
+	}
+    }
+    strcpy(input_buf, buf);
+    if (!num_changer)
+	if (!((id_sym->flags & OutPort) && Zconnection))
+	    return;
+
+
+    if (id_sym->flags &MVar) {
+	fprintf(file, "%s %s\n", buf, id_sym->name);
+
+	if (set_notation) {
+	    for (i=0; i<array_n(vars_array); i++) {
+		vars = array_fetch(st_table*, vars_array, i);
+		if (vars) {
+		    if (st_lookup(vars, var_name, (char**)&cur_var)) {
+			for (j=0; j<num_changer; j++) {
+			    fprintf(file, "- ");
+			}
+			fprintf(file, "%s%s\n", HSIS_EQUAL,
+				cur_var->current_terminal->name->name);
+		    }
+		}
+	    }
+	} else {
+	    domain = id_sym->id_type->specifier->u.enum_type->domain_list;
+	    for (i=0; i<num_changer; i++) {
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen,
+			    (lsGeneric*)&enum_elt,&enum_handle)!=LS_NOMORE;) {
+		    for (k=0; k<num_changer; k++) {
+			fprintf(file, "%s ", (i==k)?enum_elt->name:"-");
+		    }
+		    fprintf(file, "%s\n", enum_elt->name);
+		}
+		lsFinish(enum_gen);
+	    }
+	}
+
+    } else if (lo > hi) {
+
+	fprintf(file, "%s %s\n", buf, id_sym->name);
+
+	for (i=0; i<num_changer; i++) {
+	    for (j=0; j<=1; j++) {
+		for (k=0; k<num_changer; k++) {
+		    fprintf(file, "%c ", (i==k)?'0'+j:'-');
+		}
+		fprintf(file, "%d\n", j);
+	    }
+	}
+
+    } else {
+	array_t *ctrlv;
+
+	for (h=lo; h<=hi; h++) {
+	    cp = buf; *cp = '\0';
+	    cp = strappend(cp, ".names ");
+	    ctrlv = array_alloc(char*,0);
+	    for (i=0, num_changer=0; i<array_n(vars_array); i++) {
+		vars = array_fetch(st_table*, vars_array, i);
+		if (vars) {
+		    if (st_lookup(vars, var_name, (char**)&cur_var)) {
+			char tmp_buf[MAXSTRLEN];
+			int real_changer = 0;
+			if (h == lo &&
+			    cur_var->current_terminal->lo >
+			    cur_var->current_terminal->hi)
+			    real_changer = 1;
+			if (cur_var->current_terminal->lo <=
+			    cur_var->current_terminal->hi)
+			    if (cur_var->current_terminal->lo <= h &&
+				cur_var->current_terminal->hi >= h)
+				real_changer = 1;
+			if (real_changer) {
+			    num_changer++;
+
+			    sprintf(tmp_buf, "%s%s%d%s",
+				    cur_var->current_terminal->name->name,
+				    SEP_LBITSELECT, h, SEP_RBITSELECT);
+			    cp = strappendS(cp, tmp_buf);
+			    array_insert_last(char*,ctrlv,
+					      vlStrdup(cur_var->current_terminal->name->name));
+			}
+		    }
+		}
+	    }
+	    if (!num_changer) continue;
+	    fprintf(file, "%s %s%s%d%s\n", buf, id_sym->name,
+		    SEP_LBITSELECT, h, SEP_RBITSELECT);
+	    if (set_notation) {
+		for (i=0; i<num_changer; i++) {
+		    for (k=0; k<num_changer; k++) {
+			fprintf(file, "- ");
+		    }
+		    fprintf(file, "%s%s%s%d%s\n", HSIS_EQUAL,
+			    array_fetch(char*, ctrlv, i),
+			    SEP_LBITSELECT, h, SEP_RBITSELECT);
+		}
+	    } else {
+		for (i=0; i<num_changer; i++) {
+		    for (j=0; j<=1; j++) {
+			for (k=0; k<num_changer; k++) {
+			    fprintf(file, "%c ", (i==k)?'0'+j:'-');
+			}
+			fprintf(file, "%d\n", j);
+		    }
+		}
+	    }
+
+	    for (i=0; i<array_n(ctrlv); i++)
+		vl_chk_free(array_fetch(char*, ctrlv, i));
+	    array_free(ctrlv);
+
+	}
+    }
+}
+
+
+vl_term *put_quasi_control(FILE *file, char *dc, char *quasi_name, vl_id_range *id_sym, int n_entries)
+{
+    int ith_var;
+    vl_term *ctrl_term;
+    vl_term *retval;
+    lsGen lgen;
+    lsHandle handle;
+    syndrome_expr *se;
+    int retval_width, retval_range;
+    char buf[MAXSTRLEN];
+
+    retval_range = lsLength((!rst_ckt)?
+			    id_sym->syndrome_expr_list:
+			    id_sym->rst_syndrome_expr_list);
+    retval_width  = min_bit_width(retval_range);
+    retval = new_term(NIL(vl_range), 0, retval_width-1);
+    fprintf(file, ".mv %s,%s%s%s %d\n",
+	    retval->name->name, retval->name->name, SEP_GATEPIN, PIN_NS,
+	    n_entries+1);
+    fprintf(file, ".latch %s%s%s %s\n",
+	    retval->name->name, SEP_GATEPIN, PIN_NS, retval->name->name);
+    fprintf(file, ".r %s\n0\n", retval->name->name);
+
+
+    fprintf(file, ".names ");
+
+    for (lgen=lsStart((!rst_ckt)?ctrl_list:rst_ctrl_list), ith_var=0;
+	 lsNext(lgen,(lsGeneric*)&ctrl_term,&handle)!=LS_NOMORE;
+	 ith_var++) {
+	if (!dc[ith_var]) fprintf(file, "%s ", ctrl_term->name->name);
+    }
+    (void)lsFinish(lgen);
+
+    fprintf(file, "%s %s%s%s\n",
+	    retval->name->name, retval->name->name, SEP_GATEPIN, PIN_NS);
+
+    fprintf(file, "%s %s%s\n",
+	    HSIS_DEFAULT, HSIS_EQUAL, retval->name->name);
+
+    for (lgen=lsStart((!rst_ckt)?
+		      id_sym->syndrome_expr_list:
+		      id_sym->rst_syndrome_expr_list), ith_var=0;
+	 lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;
+	 ith_var++) {
+	if (vlTimedSystem && !rst_ckt)
+	    fg_put_loc_context(file, se->pre_cond, NIL(char));
+	fprintf(file, " ");
+	put_entry(file, se->syndrome, dc, 1);
+	fprintf(file, "- %d\n",
+		(strcmp(se->expr->name->name,quasi_name))?ith_var+1:0);
+    }
+    (void)lsFinish(lgen);
+
+    sprintf(buf, "%s%s%s", retval->name->name, SEP_GATEPIN, PIN_NS);
+    vl_chk_free(retval->name->name);
+    retval->name->name = vlStrdup(buf);
+
+    return retval;
+}
+
+
+void put_quasi_table(FILE *file, char *dc, char *quasi_name, char *sync_name,
+		     vl_id_range *id_sym, vl_term *out_term, int lo, int hi,
+		     int n_entries)
+{
+    int ith_var, j;
+    lsGen lgen;
+    lsHandle handle;
+    syndrome_expr *se;
+    vl_term *ctrl_term;
+
+
+    ctrl_term = put_quasi_control(file, dc, quasi_name, id_sym, n_entries);
+
+    if (hi < lo) {
+
+
+	fprintf(file, ".names %s ", ctrl_term->name->name);
+
+	for (lgen=lsStart((!rst_ckt)?
+			  id_sym->syndrome_expr_list:
+			  id_sym->rst_syndrome_expr_list);
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+	    fprintf(file, "%s ", se->expr->name->name);
+	}
+	(void)lsFinish(lgen);
+	fprintf(file, "%s ", sync_name);
+
+	fprintf(file, "%s\n", out_term->name->name);
+
+
+	for (lgen=lsStart((!rst_ckt)?
+			  id_sym->syndrome_expr_list:
+			  id_sym->rst_syndrome_expr_list), ith_var=0;
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;
+	     ith_var++) {
+	    if (strcmp(se->expr->name->name, quasi_name)) {
+		fprintf(file, "%d ", ith_var+1);
+		for (j=0; j<n_entries; j++) fprintf(file, "- ");
+		fprintf(file, "- %s%s\n", HSIS_EQUAL,se->expr->name->name);
+	    }
+	}
+	(void)lsFinish(lgen);
+	fprintf(file, "0 ");
+	for (j=0; j<n_entries; j++) fprintf(file, "- ");
+	fprintf(file, "- %s%s\n", HSIS_EQUAL, sync_name);
+    } else {
+	int bit;
+
+
+	fprintf(file, ".names %s ", ctrl_term->name->name);
+
+	for (lgen=lsStart((!rst_ckt)?
+			  id_sym->syndrome_expr_list:
+			  id_sym->rst_syndrome_expr_list);
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;) {
+	    for (bit=lo; bit<=hi; bit++)
+		fprintf(file, "%s%s%d%s ", se->expr->name->name,
+			SEP_LBITSELECT, bit, SEP_RBITSELECT);
+	}
+	(void)lsFinish(lgen);
+
+	for (bit=lo; bit<=hi; bit++)
+	    fprintf(file, "%s%s%d%s%s%s ", quasi_name,
+		    SEP_LBITSELECT, bit, SEP_RBITSELECT,
+		    SEP_GATEPIN, PIN_PS);
+
+	fprintf(file, "%s ", HSIS_ARROW);
+	for (bit=lo; bit<=hi; bit++)
+	    fprintf(file, "%s%s%d%s ", out_term->name->name,
+		    SEP_LBITSELECT, bit, SEP_RBITSELECT);
+	fprintf(file, "\n");
+
+
+	for (lgen=lsStart((!rst_ckt)?
+			  id_sym->syndrome_expr_list:
+			  id_sym->rst_syndrome_expr_list), ith_var=0;
+	     lsNext(lgen,(lsGeneric*)&se,&handle)!=LS_NOMORE;
+	     ith_var++) {
+	    if (strcmp(se->expr->name->name, quasi_name)) {
+		fprintf(file, "%d ", ith_var+1);
+		for (j=0; j<n_entries; j++)
+		    for (bit=lo; bit<=hi; bit++) fprintf(file, "- ");
+		for (bit=lo; bit<=hi; bit++) fprintf(file, "- ");
+		for (bit=lo; bit<=hi; bit++)
+		    fprintf(file, "%s%s%s%d%s ",
+			    HSIS_EQUAL,se->expr->name->name,
+			    SEP_LBITSELECT, bit, SEP_RBITSELECT);
+		fprintf(file, "\n");
+	    }
+	}
+	(void)lsFinish(lgen);
+	fprintf(file, "0 ");
+	for (j=0; j<n_entries; j++)
+	    for (bit=lo; bit<=hi; bit++) fprintf(file, "- ");
+	for (bit=lo; bit<=hi; bit++) fprintf(file, "- ");
+
+	for (bit=lo; bit<=hi; bit++)
+	    fprintf(file, "%s%s%s%d%s%s%s ",
+		    HSIS_EQUAL, quasi_name,
+		    SEP_LBITSELECT, bit, SEP_RBITSELECT,
+		    SEP_GATEPIN, PIN_PS);
+	fprintf(file, "\n");
+    }
+}
+
+
+void declare_mvar_io(FILE *file, char *dir, vl_id_range *id_sym)
+{
+    int idx, idx_hi, idx_lo;
+
+    if (!id_sym->range) {
+	fprintf(file, "%s %s", dir, id_sym->name);
+	fprintf(file, "\n");
+    } else {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	for (idx = idx_lo; idx <= idx_hi; idx++) {
+	    fprintf(file, "%s %s%s%d%s", dir,
+		    id_sym->name, SEP_LARRAY, idx, SEP_RARRAY);
+	    fprintf(file, "\n");
+	}
+    }
+}
+
+void declare_bin_scalar_io(FILE *file, char *dir, vl_id_range *id_sym)
+{
+    int idx, idx_lo, idx_hi;
+
+    if (!id_sym->range) {
+	fprintf(file, "%s %s", dir, id_sym->name);
+	fprintf(file, "\n");
+    } else {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	for (idx = idx_lo; idx <= idx_hi; idx++) {
+	    fprintf(file, "%s %s%s%d%s", dir,
+		    id_sym->name, SEP_LARRAY, idx, SEP_RARRAY);
+	    fprintf(file, "\n");
+	}
+    }
+}
+
+void declare_bin_vector_io(FILE *file, char *dir, vl_id_range *id_sym)
+{
+    int idx, idx_lo, idx_hi;
+    int i, lo, hi;
+    int ithItem;
+
+    get_hilo(id_sym, &hi, &lo);
+
+    if (!id_sym->range) {
+	fprintf(file, "%s ", dir);
+	ithItem = 0;
+	for (i=lo; i<=hi; i++) {
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "%s%s%d%s", id_sym->name,
+		    SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    fprintf(file, "%s ", buf);
+	}
+	fprintf(file, "\n");
+    } else {
+	idx_lo = vl_eval_expr(id_sym->range->left);
+	if (id_sym->range->right)
+	    idx_hi = vl_eval_expr(id_sym->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	for (idx = idx_lo; idx <= idx_hi; idx++) {
+	    fprintf(file, "%s ", dir);
+	    for (i=lo; i<=hi; i++) {
+		char buf[MAXSTRLEN];
+
+		sprintf(buf, "%s%s%d%s%s%d%s", id_sym->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		fprintf(file, "%s ", buf);
+	    }
+	    fprintf(file, "\n");
+	}
+    }
+}
+
+
+void put_const_port_connect(FILE *file, char *outstr,
+			    vl_id_range *master,
+			    vl_port_connect *instance,
+			    lsList input_consts,
+			    vl_term *term_out)
+{
+    int i, hi, lo;
+    char buf[MAXSTRLEN];
+
+    get_hilo(master, &hi, &lo);
+    if (isMVar(master->flags)) {
+
+	sprintf(buf, "%s=%s ", master->name, term_out->name->name);
+    } else {
+
+	if (lo > hi) {
+
+	    sprintf(buf, "%s=%s ",
+		    master->name, term_out->name->name);
+	} else {
+
+	    char tmp[MAXSTRLEN];
+
+	    buf[0] = '\0';
+	    for (i=lo; i<=hi; i++) {
+		sprintf(tmp, "%s%s%d%s=%s%s%d%s ",
+			master->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			term_out->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		strcat(buf, tmp);
+	    }
+	}
+    }
+
+    if (file) fprintf(file, "%s", buf);
+    if (outstr) sprintf(outstr, "%s", buf);
+}
+
+
+void put_mvar_port_connect(FILE *file, char *outstr,
+			   vl_id_range *master,
+			   vl_port_connect *instance)
+{
+    int idx, idx_lo, idx_hi;
+    char buf[MAXSTRLEN];
+
+    if (!master->range) {
+	sprintf(buf, "%s=%s ",
+		master->name,
+		instance->expr->term->name->name);
+    } else {
+	char tmp[MAXSTRLEN];
+
+	buf[0] = '\0';
+	idx_lo = vl_eval_expr(master->range->left);
+	if (master->range->right)
+	    idx_hi = vl_eval_expr(master->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	for (idx=idx_lo; idx<=idx_hi; idx++) {
+	    sprintf(tmp, "%s%s%d%s=%s%s%d%s ",
+		    master->name, SEP_LARRAY, idx, SEP_RARRAY,
+		    instance->expr->term->name->name,
+		    SEP_LARRAY, idx, SEP_RARRAY);
+	    strcat(buf, tmp);
+	}
+    }
+
+    if (file) fprintf(file, "%s", buf);
+    if (outstr) sprintf(outstr, "%s", buf);
+}
+
+
+void put_bin_scalar_port_connect(FILE *file, char *outstr,
+				 vl_id_range *master,
+				 vl_port_connect *instance)
+{
+    int idx, idx_lo, idx_hi;
+    char buf[MAXSTRLEN];
+
+    if (instance->expr->term->lo > instance->expr->term->hi){
+	if (!master->range) {
+	    sprintf(buf, "%s=%s ",
+		    master->name,
+		    instance->expr->term->name->name);
+	} else {
+	    char tmp[MAXSTRLEN];
+
+	    buf[0] = '\0';
+	    idx_lo = vl_eval_expr(master->range->left);
+	    if (master->range->right)
+		idx_hi = vl_eval_expr(master->range->right);
+	    else
+		idx_hi = idx_lo;
+
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		sprintf(tmp, "%s%s%d%s=%s%s%d%s ",
+			master->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			instance->expr->term->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY);
+		strcat(buf, tmp);
+	    }
+	}
+    } else {
+	if (!master->range) {
+	    sprintf(buf, "%s=%s%s%d%s ",
+		    master->name,
+		    instance->expr->term->name->name,
+		    SEP_LBITSELECT,
+		    instance->expr->term->lo,
+		    SEP_RBITSELECT);
+	} else {
+	    char tmp[MAXSTRLEN];
+
+	    buf[0] = '\0';
+	    idx_lo = vl_eval_expr(master->range->left);
+	    if (master->range->right)
+		idx_hi = vl_eval_expr(master->range->right);
+	    else
+		idx_hi = idx_lo;
+
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		sprintf(tmp, "%s%s%d%s=%s%s%d%s%s%d%s ",
+			master->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			instance->expr->term->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			SEP_LBITSELECT,
+			instance->expr->term->lo,
+			SEP_RBITSELECT);
+		strcat(buf, tmp);
+	    }
+	}
+    }
+
+    if (file) fprintf(file, "%s", buf);
+    if (outstr) sprintf(outstr, "%s", buf);
+}
+
+
+void put_bin_vector_port_connect(FILE *file, char *outstr,
+				 vl_id_range *master,
+				 vl_port_connect *instance)
+{
+    int sig_lo;
+    int lo, hi;
+    int idx, idx_lo, idx_hi;
+    int i;
+    char buf[MAXSTRLEN];
+
+    get_hilo(master, &hi, &lo);
+    sig_lo = instance->expr->term->lo;
+
+    if (!master->range) {
+	char tmp[MAXSTRLEN];
+
+	buf[0] = '\0';
+	for (i=lo; i<=hi; i++) {
+	    char mast_buf[MAXSTRLEN];
+	    char inst_buf[MAXSTRLEN];
+
+	    sprintf(mast_buf, "%s%s%d%s", master->name,
+		    SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    sprintf(inst_buf, "%s%s%d%s",
+		    instance->expr->term->name->name,
+		    SEP_LBITSELECT,sig_lo-lo+i,SEP_RBITSELECT);
+	    sprintf(tmp, "%s=%s ", mast_buf, inst_buf);
+	    strcat(buf, tmp);
+	}
+    } else {
+	idx_lo = vl_eval_expr(master->range->left);
+	if (master->range->right)
+	    idx_hi = vl_eval_expr(master->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	{
+	    char tmp[MAXSTRLEN];
+
+	    buf[0] = '\0';
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		for (i=lo; i<=hi; i++) {
+		    char mast_buf[MAXSTRLEN];
+		    char inst_buf[MAXSTRLEN];
+
+		    sprintf(mast_buf, "%s%s%d%s%s%d%s", master->name,
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    sprintf(inst_buf, "%s%s%d%s%s%d%s",
+			    instance->expr->term->name->name,
+			    SEP_LARRAY, idx, SEP_RARRAY,
+			    SEP_LBITSELECT,
+			    sig_lo-lo+i,
+			    SEP_RBITSELECT);
+		    sprintf(tmp, "%s=%s ", mast_buf, inst_buf);
+		    strcat(buf, tmp);
+		}
+	    }
+	}
+    }
+
+    if (file) fprintf(file, "%s", buf);
+    if (outstr) sprintf(outstr, "%s", buf);
+}
+
+
+void put_bin_scalar_func_connect(FILE *file, vl_id_range *master,
+				 vl_term *instance)
+{
+    int idx, idx_lo, idx_hi;
+
+    if (instance->lo > instance->hi){
+	if (!master->range) {
+	    fprintf(file, "%s=%s ",
+		    master->name,
+		    instance->name->name);
+	} else {
+	    idx_lo = vl_eval_expr(master->range->left);
+	    if (master->range->right)
+		idx_hi = vl_eval_expr(master->range->right);
+	    else
+		idx_hi = idx_lo;
+
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		fprintf(file, "%s%s%d%s=%s%s%d%s ",
+			master->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			instance->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY);
+	    }
+	}
+    } else {
+	if (!master->range) {
+	    fprintf(file, "%s=%s%s%d%s ",
+		    master->name,
+		    instance->name->name,
+		    SEP_LBITSELECT,
+		    instance->lo,
+		    SEP_RBITSELECT);
+	} else {
+	    idx_lo = vl_eval_expr(master->range->left);
+	    if (master->range->right)
+		idx_hi = vl_eval_expr(master->range->right);
+	    else
+		idx_hi = idx_lo;
+
+	    for (idx=idx_lo; idx<=idx_hi; idx++) {
+		fprintf(file, "%s%s%d%s=%s%s%d%s%s%d%s ",
+			master->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			instance->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			SEP_LBITSELECT,
+			instance->lo,
+			SEP_RBITSELECT);
+	    }
+	}
+    }
+}
+
+
+void put_bin_vector_func_connect(FILE *file, vl_id_range *master,
+				 vl_term *instance)
+{
+    int sig_lo;
+    int lo, hi;
+    int idx, idx_lo, idx_hi;
+    int i;
+
+    get_hilo(master, &hi, &lo);
+    sig_lo = instance->lo;
+
+    if (!master->range) {
+	for (i=lo; i<=hi; i++) {
+	    char mast_buf[MAXSTRLEN];
+	    char inst_buf[MAXSTRLEN];
+
+	    sprintf(mast_buf, "%s%s%d%s", master->name,
+		    SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    sprintf(inst_buf, "%s%s%d%s",
+		    instance->name->name,
+		    SEP_LBITSELECT,sig_lo-lo+i,SEP_RBITSELECT);
+	    fprintf(file, "%s=%s ", mast_buf, inst_buf);
+	}
+    } else {
+	idx_lo = vl_eval_expr(master->range->left);
+	if (master->range->right)
+	    idx_hi = vl_eval_expr(master->range->right);
+	else
+	    idx_hi = idx_lo;
+
+	for (idx=idx_lo; idx<=idx_hi; idx++) {
+	    for (i=lo; i<=hi; i++) {
+		char mast_buf[MAXSTRLEN];
+		char inst_buf[MAXSTRLEN];
+
+		sprintf(mast_buf, "%s%s%d%s%s%d%s", master->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		sprintf(inst_buf, "%s%s%d%s%s%d%s",
+			instance->name->name,
+			SEP_LARRAY, idx, SEP_RARRAY,
+			SEP_LBITSELECT,
+			sig_lo-lo+i,
+			SEP_RBITSELECT);
+		fprintf(file, "%s=%s ", mast_buf, inst_buf);
+	    }
+	}
+    }
+}
+
+
+char *write_red_op(FILE *file, short type, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    int bpos;
+    char *ripple=NIL(char);
+
+    fprintf(file, ".names ");
+    for (bpos=in1->lo; bpos<=in1->hi; bpos++) {
+	fprintf(file, "%s%s%d%s ", in1->name->name,
+		SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+    }
+
+    fprintf(file, "%s\n", out->name->name);
+
+    if (set_notation) {
+	fprintf(file, "%s %c\n", HSIS_DEFAULT,
+		(type==UnorExpr||type==UandExpr)?'0':'1');
+	for (bpos=in1->lo; bpos<=in1->hi; bpos++) {
+	    fprintf(file, "%c ",
+		    (type==UorExpr||type==UnorExpr)?'0':'1');
+	}
+	fprintf(file, "%c\n",
+		(type==UnorExpr||type==UandExpr)?'1':'0');
+    } else {
+	for (bpos=in1->lo; bpos<=in1->hi; bpos++) {
+	    int i;
+	    for (i=in1->lo; i<=in1->hi; i++) {
+		fprintf(file, "%c ",
+			(i==bpos)?
+			((type==UorExpr||type==UnorExpr)?'1':'0'):'-');
+	    }
+	    fprintf(file, "%c\n",
+		    (type==UorExpr||type==UnandExpr)?'1':'0');
+	}
+	for (bpos=in1->lo; bpos<=in1->hi; bpos++) {
+	    fprintf(file, "%c ",
+		    (type==UorExpr||type==UnorExpr)?'0':'1');
+	}
+	fprintf(file, "%c\n",
+		(type==UorExpr||type==UnandExpr)?'0':'1');
+    }
+
+    in2 = in2;
+
+    return ripple;
+}
+
+
+
+char *write_rel_vector_bop(FILE *file, short type, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    int bpos;
+    vl_term *tmpterm;
+    char term1[MAXSTRLEN], term2[MAXSTRLEN], outerm[MAXSTRLEN];
+    char *ripple=NIL(char);
+
+
+    tmpterm = create_rename_term(out->name, new_termname(), out->lo, out->hi);
+    out->lo = 0;
+    out->hi = -1;
+
+    if (in1->lo > in1->hi && in2->lo > in2->hi) {
+
+	ripple = vl_write_bop(file, type,
+			      in1->name->name, in2->name->name, NIL(char),
+			      tmpterm->name->name,
+			      !IS_VLR_REL_OP(type));
+	if (IS_VLR_REL_OP(type))
+	    postprocess_vlr_rel(file, type, ripple, tmpterm, out);
+    } else if (in1->lo > in1->hi && in2->lo <= in2->hi) {
+
+	char tmpterm_buf[MAXSTRLEN];
+	if (tmpterm->lo > tmpterm->hi)
+	    sprintf(tmpterm_buf, "%s", tmpterm->name->name);
+	else
+	    sprintf(tmpterm_buf, "%s%s%d%s", tmpterm->name->name,
+		    SEP_LBITSELECT, tmpterm->lo, SEP_RBITSELECT);
+	sprintf(term2, "%s%s%d%s", in2->name->name,
+		SEP_LBITSELECT, in2->lo, SEP_RBITSELECT);
+	ripple = vl_write_bop(file, type,
+			      in1->name->name, term2, NIL(char),
+			      tmpterm_buf,
+			      !IS_VLR_REL_OP(type));
+
+	for (bpos=in2->lo+1; bpos<=in2->hi; bpos++) {
+	    sprintf(term2, "%s%s%d%s", in2->name->name,
+		    SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+	    sprintf(tmpterm_buf, "%s%s%d%s",
+		    tmpterm->name->name,
+		    SEP_LBITSELECT,
+		    tmpterm->lo+(bpos-in2->lo),
+		    SEP_RBITSELECT);
+	    vl_write_bit_connect(file, term2, tmpterm_buf, 0);
+	}
+	if (IS_VLR_REL_OP(type))
+	    postprocess_vlr_rel(file, type, ripple, tmpterm, out);
+    } else if (in1->lo <= in1->hi && in2->lo > in2->hi) {
+
+	char tmpterm_buf[MAXSTRLEN];
+	if (tmpterm->lo > tmpterm->hi)
+	    sprintf(tmpterm_buf, "%s", tmpterm->name->name);
+	else
+	    sprintf(tmpterm_buf, "%s%s%d%s", tmpterm->name->name,
+		    SEP_LBITSELECT, tmpterm->lo, SEP_RBITSELECT);
+	sprintf(term1, "%s%s%d%s", in1->name->name,
+		SEP_LBITSELECT, in1->lo, SEP_RBITSELECT);
+	ripple = vl_write_bop(file, type,
+			      term1, in2->name->name, NIL(char),
+			      tmpterm_buf,
+			      !IS_VLR_REL_OP(type));
+
+	for (bpos=in1->lo+1; bpos<=in1->hi; bpos++) {
+	    sprintf(term1, "%s%s%d%s", in1->name->name,
+		    SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+	    sprintf(tmpterm_buf, "%s%s%d%s",
+		    tmpterm->name->name,
+		    SEP_LBITSELECT,
+		    tmpterm->lo+(bpos-in1->lo),
+		    SEP_RBITSELECT);
+	    vl_write_bit_connect(file, term1, tmpterm_buf, 0);
+	}
+	if (IS_VLR_REL_OP(type))
+	    postprocess_vlr_rel(file, type, ripple, tmpterm, out);
+    } else {
+
+	for (bpos=tmpterm->lo, ripple=NIL(char); bpos<=tmpterm->hi; bpos++) {
+	    if (bpos > in1->hi-in1->lo)
+		sprintf(term1, "%s", WRT_BLIF_GND(file));
+	    else
+		sprintf(term1, "%s%s%d%s",
+			in1->name->name,
+			SEP_LBITSELECT, in1->lo+bpos, SEP_RBITSELECT);
+	    if (bpos > in2->hi-in2->lo)
+		sprintf(term2, "%s", WRT_BLIF_GND(file));
+	    else
+		sprintf(term2, "%s%s%d%s",
+			in2->name->name,
+			SEP_LBITSELECT, in2->lo+bpos, SEP_RBITSELECT);
+	    sprintf(outerm, "%s%s%d%s",
+		    tmpterm->name->name,
+		    SEP_LBITSELECT, tmpterm->lo+bpos, SEP_RBITSELECT);
+	    ripple = vl_write_bop(file, type, term1, term2, ripple, outerm,
+				  !IS_VLR_REL_OP(type));
+	}
+	if (IS_VLR_REL_OP(type))
+	    postprocess_vlr_rel(file, type, ripple, tmpterm, out);
+    }
+
+    vl_chk_free((char*)tmpterm);
+
+    return ripple;
+}
+
+
+char *write_op_vector_bop(FILE *file, short type, vl_term *in1, vl_term *in2, vl_term *out)
+{
+    int bpos;
+    char term1[MAXSTRLEN], term2[MAXSTRLEN], outerm[MAXSTRLEN];
+    char *ripple = NIL(char);
+
+
+    if (in1->lo > in1->hi && in2->lo > in2->hi) {
+
+	if ((vector_width(in1->lo, in1->hi) <
+	     vector_width(out->lo, out->hi)) &&
+	    (vector_width(in2->lo, in2->hi) <
+	     vector_width(out->lo, out->hi))) {
+	    sprintf(outerm, "%s%s%d%s",
+		    out->name->name,
+		    SEP_LBITSELECT,
+		    out->lo,
+		    SEP_RBITSELECT);
+	    ripple = vl_write_bop(file, type,
+				  in1->name->name, in2->name->name,
+				  NIL(char),
+				  outerm, 0);
+	    sprintf(outerm, "%s%s%d%s",
+		    out->name->name,
+		    SEP_LBITSELECT,
+		    out->lo+1,
+		    SEP_RBITSELECT);
+	    vl_write_bit_connect(file, ripple, outerm, 0);
+	} else {
+	    ripple = vl_write_bop(file, type,
+				  in1->name->name, in2->name->name,
+				  NIL(char),
+				  out->name->name, 0);
+	}
+    } else if (in1->lo > in1->hi && in2->lo <= in2->hi) {
+
+	sprintf(term2, "%s%s%d%s", in2->name->name,
+		SEP_LBITSELECT, in2->lo, SEP_RBITSELECT);
+	sprintf(outerm, "%s%s%d%s", out->name->name,
+		SEP_LBITSELECT, out->lo, SEP_RBITSELECT);
+	ripple = vl_write_bop(file, type,
+			      in1->name->name,term2,NIL(char),outerm, 0);
+
+	if (IS_VLR_LOG_OP(type)) {
+	    sprintf(term2, "%s", WRT_BLIF_GND(file));
+	    for (bpos=in1->lo+1; bpos<=in1->hi; bpos++) {
+		sprintf(outerm, "%s%s%d%s",
+			out->name->name,
+			SEP_LBITSELECT,
+			out->lo+(bpos-in2->lo),
+			SEP_RBITSELECT);
+		vl_write_bit_connect(file, term2, outerm, 0);
+	    }
+	} else {
+	    for (bpos=in2->lo+1; bpos<=in2->hi; bpos++) {
+		sprintf(term2, "%s%s%d%s", in2->name->name,
+			SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		sprintf(outerm, "%s%s%d%s",
+			out->name->name,
+			SEP_LBITSELECT,
+			out->lo+(bpos-in2->lo),
+			SEP_RBITSELECT);
+		if (type == BplusExpr || type == BminusExpr) {
+		    ripple = vl_write_bop(file, type,
+					  term2,ripple,NIL(char),outerm,0);
+		} else {
+		    vl_write_bit_connect(file, term2, outerm, 0);
+		}
+	    }
+	}
+
+	if ((vector_width(in1->lo, in1->hi) <
+	     vector_width(out->lo, out->hi)) &&
+	    (vector_width(in2->lo, in2->hi) <
+	     vector_width(out->lo, out->hi))) {
+	    sprintf(outerm, "%s%s%d%s",
+		    out->name->name,
+		    SEP_LBITSELECT,
+		    bpos,
+		    SEP_RBITSELECT);
+	    vl_write_bit_connect(file, ripple, outerm, 0);
+	}
+    } else if (in1->lo <= in1->hi && in2->lo > in2->hi) {
+
+	sprintf(term1, "%s%s%d%s", in1->name->name,
+		SEP_LBITSELECT, in1->lo, SEP_RBITSELECT);
+	sprintf(outerm, "%s%s%d%s", out->name->name,
+		SEP_LBITSELECT, out->lo, SEP_RBITSELECT);
+	ripple = vl_write_bop(file, type,
+			      term1,in2->name->name,NIL(char),outerm, 0);
+
+	if (IS_VLR_LOG_OP(type)) {
+	    sprintf(term1, "%s", WRT_BLIF_GND(file));
+	    for (bpos=in1->lo+1; bpos<=in1->hi; bpos++) {
+		sprintf(outerm, "%s%s%d%s", out->name->name,
+			SEP_LBITSELECT,
+			out->lo+(bpos-in1->lo),
+			SEP_RBITSELECT);
+		vl_write_bit_connect(file, term1, outerm, 0);
+	    }
+	} else {
+	    for (bpos=in1->lo+1; bpos<=in1->hi; bpos++) {
+		sprintf(term1, "%s%s%d%s", in1->name->name,
+			SEP_LBITSELECT, bpos, SEP_RBITSELECT);
+		sprintf(outerm, "%s%s%d%s",
+			out->name->name,
+			SEP_LBITSELECT,
+			out->lo+(bpos-in1->lo),
+			SEP_RBITSELECT);
+		if (type == BplusExpr || type == BminusExpr) {
+		    ripple = vl_write_bop(file, type,
+					  term1,ripple,NIL(char),outerm,0);
+		} else {
+		    vl_write_bit_connect(file, term1, outerm, 0);
+		}
+	    }
+	}
+
+	if ((vector_width(in1->lo, in1->hi) <
+	     vector_width(out->lo, out->hi)) &&
+	    (vector_width(in2->lo, in2->hi) <
+	     vector_width(out->lo, out->hi))) {
+	    sprintf(outerm, "%s%s%d%s",
+		    out->name->name,
+		    SEP_LBITSELECT,
+		    bpos,
+		    SEP_RBITSELECT);
+	    vl_write_bit_connect(file, ripple, outerm, 0);
+	}
+    } else {
+
+	for (bpos=out->lo, ripple=NIL(char); bpos<=out->hi; bpos++) {
+	    if (RIPPLE_INTERFERE(type)) {
+		if (bpos-out->lo <=
+		    MIN(in1->hi-in1->lo,in2->hi-in2->lo)) {
+		    sprintf(term1, "%s%s%d%s",
+			    in1->name->name,
+			    SEP_LBITSELECT, in1->lo+bpos, SEP_RBITSELECT);
+		    sprintf(term2, "%s%s%d%s",
+			    in2->name->name,
+			    SEP_LBITSELECT, in2->lo+bpos, SEP_RBITSELECT);
+		    sprintf(outerm, "%s%s%d%s",
+			    out->name->name,
+			    SEP_LBITSELECT, out->lo+bpos, SEP_RBITSELECT);
+		    ripple =
+			vl_write_bop(file, type, term1, term2, ripple,
+				     outerm, (bpos==out->hi));
+		} else if (bpos-out->lo ==
+			   MIN(in1->hi-in1->lo,in2->hi-in2->lo)+1) {
+		    sprintf(outerm, "%s%s%d%s",
+			    out->name->name,
+			    SEP_LBITSELECT, out->lo+bpos, SEP_RBITSELECT);
+		    fprintf(file, ".names %s %s\n1 1\n0 0\n",
+			    ripple, outerm);
+		} else {
+		    sprintf(outerm, "%s%s%d%s",
+			    out->name->name,
+			    SEP_LBITSELECT, out->lo+bpos, SEP_RBITSELECT);
+		    fprintf(file, ".names %s\n0\n", outerm);
+		}
+	    } else {
+		if (bpos-out->lo <=
+		    MIN(in1->hi-in1->lo,in2->hi-in2->lo)) {
+		    sprintf(term1, "%s%s%d%s",
+			    in1->name->name,
+			    SEP_LBITSELECT, in1->lo+bpos, SEP_RBITSELECT);
+		    sprintf(term2, "%s%s%d%s",
+			    in2->name->name,
+			    SEP_LBITSELECT, in2->lo+bpos, SEP_RBITSELECT);
+		    sprintf(outerm, "%s%s%d%s",
+			    out->name->name,
+			    SEP_LBITSELECT, out->lo+bpos, SEP_RBITSELECT);
+		    ripple =
+			vl_write_bop(file, type, term1, term2, ripple,
+				     outerm, (bpos==out->hi));
+		} else {
+		    if (bpos-out->lo <= in1->hi-in1->lo) {
+			sprintf(term1, "%s%s%d%s",
+				in1->name->name,
+				SEP_LBITSELECT, in1->lo+bpos,
+				SEP_RBITSELECT);
+			sprintf(outerm, "%s%s%d%s",
+				out->name->name,
+				SEP_LBITSELECT, out->lo+bpos,
+				SEP_RBITSELECT);
+			fprintf(file, ".names %s %s\n0 0\n1 1\n",
+				term1, outerm);
+		    } else if (bpos-out->lo <= in2->hi-in2->lo) {
+			sprintf(term2, "%s%s%d%s",
+				in2->name->name,
+				SEP_LBITSELECT, in2->lo+bpos,
+				SEP_RBITSELECT);
+			sprintf(outerm, "%s%s%d%s",
+				out->name->name,
+				SEP_LBITSELECT, out->lo+bpos,
+				SEP_RBITSELECT);
+			fprintf(file, ".names %s %s\n0 0\n1 1\n",
+				term2, outerm);
+		    } else {
+			sprintf(outerm, "%s%s%d%s",
+				out->name->name,
+				SEP_LBITSELECT, out->lo+bpos,
+				SEP_RBITSELECT);
+			fprintf(file, ".names %s\n0\n", outerm);
+		    }
+		}
+	    }
+	}
+    }
+
+    return ripple;
+}
+
+
+static void postprocess_vlr_rel(FILE *file, short type, char *carry,
+				vl_term *results, vl_term *out)
+{
+    char *tmp_termname;
+    vl_term *zero_term;
+
+    switch(type) {
+    case BltExpr:
+
+	zero_term = new_term(NIL(vl_range), 0, -1);
+	if (results->hi < results->lo)
+	    vl_write_bit_connect(file,
+				results->name->name, zero_term->name->name, 0);
+	else
+	    vl_write_vector_bop(file, UorExpr,
+				results, NIL(vl_term), zero_term);
+	vl_write_bop(file, BandExpr, carry, zero_term->name->name, NIL(char),
+		     out->name->name, 1);
+	break;
+    case BgtExpr:
+
+	zero_term = new_term(NIL(vl_range), 0, -1);
+	if (results->hi < results->lo)
+	    vl_write_bit_connect(file,
+				results->name->name, zero_term->name->name, 1);
+	else
+	    vl_write_vector_bop(file, UnorExpr,
+				results, NIL(vl_term), zero_term);
+	tmp_termname = new_termname();
+	vl_write_bop(file, BorExpr, carry, zero_term->name->name, NIL(char),
+		     tmp_termname, 1);
+	vl_write_bit_connect(file, tmp_termname, out->name->name, 1);
+	break;
+    case BleExpr:
+
+	zero_term = new_term(NIL(vl_range), 0, -1);
+	if (results->hi < results->lo)
+	    vl_write_bit_connect(file,
+				results->name->name, zero_term->name->name, 1);
+	else
+	    vl_write_vector_bop(file, UnorExpr,
+				results, NIL(vl_term), zero_term);
+	vl_write_bop(file, BorExpr, carry, zero_term->name->name, NIL(char),
+		     out->name->name, 1);
+	break;
+    case BgeExpr:
+
+	zero_term = new_term(NIL(vl_range), 0, -1);
+	if (results->hi < results->lo)
+	    vl_write_bit_connect(file,
+				results->name->name, zero_term->name->name, 0);
+	else
+	    vl_write_vector_bop(file, UorExpr,
+				results, NIL(vl_term), zero_term);
+	tmp_termname = new_termname();
+	vl_write_bop(file, BandExpr, carry, zero_term->name->name, NIL(char),
+		     tmp_termname, 1);
+	vl_write_bit_connect(file, tmp_termname, out->name->name, 1);
+	break;
+    }
+}
+
+
+vl_port *search_match_port(char *name, lsList ports)
+{
+    lsGen gen;
+    lsHandle handle;
+    vl_port *retval=NIL(vl_port), *port;
+    lsHandle port_handle;
+    vl_id_range *id;
+
+    gen = lsStart(ports);
+    while (lsNext(gen, (lsGeneric*)&port, &handle)!=LS_NOMORE) {
+	lsFirstItem(port->port_exp, (lsGeneric*)&id, &port_handle);
+	if (!strcmp(name, id->name)) {
+	    retval = port;
+	    break;
+	}
+    }
+    lsFinish(gen);
+
+    return retval;
+}
+
+
+vl_port_connect *search_inst_port(char *name, lsList ports)
+{
+    lsGen gen;
+    lsHandle handle;
+    vl_port_connect *retval=NIL(vl_port_connect), *port;
+
+    gen = lsStart(ports);
+    while (lsNext(gen, (lsGeneric*)&port, &handle)!=LS_NOMORE) {
+	if (!strcmp(name, port->id->name)) {
+	    retval = port;
+	    break;
+	}
+    }
+    lsFinish(gen);
+
+    return retval;
+}
+
+
+
+char *vl_translate_prim_symbol(unsigned char sym)
+{
+    char buf[MAXSTRLEN];
+
+    switch(sym) {
+    case PrimNone: return("");
+    case Prim0: return("0");
+    case Prim1: return("1");
+    case PrimX: return("-");
+    case PrimQ: return("-");
+    case PrimB: return("-");
+    case PrimM: return("-");
+    case PrimR: return("0 1");
+    case PrimF: return("1 0");
+    case PrimS: return("- -");
+    case PrimBB: return("- -");
+    case PrimQ0: return("- 0");
+    case PrimQ1: return("- 1");
+    case PrimQB: return("- -");
+    case Prim0X: return("0 -");
+    case Prim1X: return("1 -");
+    case PrimX0: return("- 0");
+    case PrimX1: return("- 1");
+    case PrimXB: return("- -");
+    case PrimBX: return("- -");
+    case PrimP: sprintf(buf, "P");
+    case PrimN: sprintf(buf, "N");
+	strcat(buf, " :: can not be handled yet");
+	Translate_Warning(buf);
+	return("");
+    default: {
+	char msg[MAXSTRLEN];
+	sprintf(msg, "Unexpected primitive symbol type %d", sym);
+	internal_error(msg); return(NULL);
+    }
+    }
+}
+
+vl_term *sensitive_control(FILE *file, st_table *sensitive_list)
+{
+    vl_term *retval;
+    st_generator *gen;
+    char *key, *dummy;
+    vl_id_range *id_sym;
+    int i, j;
+    int lo, hi;
+    int ithItem;
+
+    retval = new_term(NIL(vl_range), 0, -1);
+    fprintf(file, ".names ");
+    ithItem = 0;
+    gen = st_init_gen(sensitive_list);
+    while (st_gen(gen, &key, &dummy)) {
+	if (!st_lookup(vl_currentModule->sig_st, key, (char**)&id_sym)) {
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "sensitive var:%s is not defined in module %s",
+		    key, vl_currentModule->name->name);
+	    semantic_error(buf);
+	}
+
+	get_hilo(id_sym, &hi, &lo);
+	if (lo < hi || id_sym->range) {
+	    char buf[MAXSTRLEN];
+
+	    sprintf(buf, "%s is vector/array while as sensitive var in %s",
+		    key, vl_currentModule->name->name);
+	    semantic_error(buf);
+	}
+
+	fprintf(file, "%s ", key);
+    }
+    st_free_gen(gen);
+    fprintf(file, "%s\n", retval->name->name);
+
+    for (i=0; i<st_count(sensitive_list); i++) {
+	for (j=0; j<st_count(sensitive_list); j++)
+	    fprintf(file, "%c ", (i==j)?'1':'-');
+	fprintf(file, "1\n");
+    }
+    for (i=0; i<st_count(sensitive_list); i++)
+	fprintf(file, "0 ");
+    fprintf(file, "0\n");
+
+    return retval;
+}
+
+
+void patch_unaffected_term(FILE *file, vl_id_range *id_sym,
+			   vl_term *orig_term,
+			   vl_term *out_term)
+{
+    int i;
+    int set_floating = 0;
+
+    if (orig_term->lo == out_term->lo && orig_term->hi == out_term->hi)
+	return;
+    if (orig_term->lo >= orig_term->hi && out_term->lo >= out_term->hi)
+	return;
+
+    if (vl_currentFunction)
+	if (!strcmp(id_sym->name, orig_term->name->name))
+	    set_floating = 1;
+
+    if (set_floating) {
+	for (i=orig_term->lo; i<out_term->lo; i++) {
+	    fprintf(file, ".names %s%s%d%s\n-\n",
+		    out_term->name->name,
+		    SEP_LBITSELECT, i, SEP_RBITSELECT);
+	}
+
+	for (i=out_term->hi+1; i<=orig_term->hi; i++) {
+	    fprintf(file, ".names %s%s%d%s\n-\n",
+		    out_term->name->name,
+		    SEP_LBITSELECT, i, SEP_RBITSELECT);
+	}
+    } else {
+
+	for (i=orig_term->lo; i<out_term->lo; i++) {
+	    if (set_notation) {
+		fprintf(file,".names %s%s%d%s %s%s%d%s\n- %s%s%s%d%s\n",
+			orig_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			out_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			HSIS_EQUAL,
+			orig_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    } else {
+		fprintf(file, ".names %s%s%d%s %s%s%d%s\n1 1\n0 0\n",
+			orig_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			out_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    }
+	}
+
+	for (i=out_term->hi+1; i<=orig_term->hi; i++) {
+	    if (set_notation) {
+		fprintf(file,".names %s%s%d%s %s%s%d%s\n- %s%s%s%d%s\n",
+			orig_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			out_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			HSIS_EQUAL,
+			orig_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    } else {
+		fprintf(file, ".names %s%s%d%s %s%s%d%s\n1 1\n0 0\n",
+			orig_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT,
+			out_term->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+	    }
+	}
+    }
+
+    out_term->lo = orig_term->lo;
+    out_term->hi = orig_term->hi;
+}
+
+int need_edge_detector(lsList table_entries, int ith_port)
+{
+    int retval=0;
+    lsGen gen;
+    lsHandle handle;
+    vl_prim_entry *e;
+
+    for (gen=lsStart(table_entries);
+	 lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	register unsigned char sym;
+	sym = e->inputs[ith_port];
+	if (IS_TRANSITION(sym)) {
+	    retval = 1;
+	    break;
+	}
+    }
+    (void)lsFinish(gen);
+
+    return retval;
+}
+
+
+void dump_debug_information(FILE *file, vl_id_range *id_var,
+			    vl_term *current_term, int lineno,
+			    lsList ctrl_list, char *ctrl_syndrome)
+{
+    lsGen gen;
+    lsHandle handle;
+    vl_term *ctrl;
+    int i;
+    char *Comment;
+
+    Comment = HSIS_COMMENT;
+    if (debug_mode) {
+	if (lineno >= 0) {
+	    fprintf(file, "%s%sl %d%s%s\n",
+		    Comment, Comment,
+		    lineno,
+		    Comment, Comment);
+	}
+	fprintf(file, "%s%sv %s.%s%s%s\n",
+		Comment, Comment,
+		vl_currentModule->name->name, id_var->name,
+		Comment, Comment);
+	for (i=0, gen=lsStart(ctrl_list);
+	     lsNext(gen, (lsGeneric*)&ctrl, &handle)!=LS_NOMORE; i++) {
+	    if (ctrl_syndrome[i] == '-') continue;
+	    if (ctrl_syndrome[i] == '1')
+		fprintf(file, "%s%sg %s%s%s\n",
+			Comment, Comment,
+			ctrl->name->name,
+			Comment, Comment);
+	    if (ctrl_syndrome[i] == '0')
+		fprintf(file, "%s%sG %s%s%s\n",
+			Comment, Comment,
+			ctrl->name->name,
+			Comment, Comment);
+	}
+	lsFinish(gen);
+    }
+
+    current_term = current_term;
+}
+
+
+int vector_width(int lo, int hi)
+{
+    if (lo > hi) return 1;
+    return hi - lo + 1;
+}
+
+
+void expand_term(FILE *file, vl_term *in, vl_term *out)
+{
+    int i;
+    char in_buf[MAXSTRLEN], out_buf[MAXSTRLEN];
+    lsList args;
+
+    assert(vector_width(in->lo, in->hi) <= vector_width(out->lo, out->hi));
+
+    if (vector_width(in->lo, in->hi) == vector_width(out->lo, out->hi)) {
+	vl_write_bin_connect(file, in, out, 0);
+    } else {
+	char buf[MAXSTRLEN];
+	args = lsCreate();
+	sprintf(buf, "%d", in->hi-in->lo+1);
+	lsNewEnd(args, (lsGeneric)vlStrdup(buf), 0);
+	sprintf(buf, "%d", out->hi-out->lo+1);
+	lsNewEnd(args, (lsGeneric)vlStrdup(buf), 0);
+
+	for (i=out->lo; i<=out->hi; i++) {
+	    if (in->lo > in->hi) {
+		sprintf(out_buf, "%s%s%d%s", out->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		sprintf(in_buf, "%s",
+			(i==out->lo)?in->name->name:WRT_BLIF_GND(file));
+		if (set_notation) {
+		    fprintf(file, ".names %s %s\n- =%s\n",
+			    in_buf, out_buf, in_buf);
+		} else {
+		    vl_write_bit_connect(file, in_buf, out_buf, 0);
+		}
+	    } else {
+		sprintf(out_buf, "%s%s%d%s", out->name->name,
+			SEP_LBITSELECT, i, SEP_RBITSELECT);
+		if (i-out->lo <= in->hi-in->lo)
+		    sprintf(in_buf, "%s%s%d%s", in->name->name,
+			    SEP_LBITSELECT, i+in->lo-out->lo, SEP_RBITSELECT);
+		else
+		    sprintf(in_buf, "%s", WRT_BLIF_GND(file));
+		if (set_notation) {
+		    fprintf(file, ".names %s %s\n- =%s\n",
+			    in_buf, out_buf, in_buf);
+		} else {
+		    vl_write_bit_connect(file, in_buf, out_buf, 0);
+		}
+	    }
+	}
+
+	lsDestroy(args, vl_chk_free);
+    }
+}
+
+void shrink_term(FILE *file, vl_term *in, vl_term *out)
+{
+    int i;
+    char in_buf[MAXSTRLEN], out_buf[MAXSTRLEN];
+    lsList args;
+
+    assert(vector_width(in->lo, in->hi) >= vector_width(out->lo, out->hi));
+
+    if (vector_width(in->lo, in->hi) == vector_width(out->lo, out->hi)) {
+	vl_write_bin_connect(file, in, out, 0);
+    } else {
+	char buf[MAXSTRLEN];
+	args = lsCreate();
+	sprintf(buf, "%d", in->hi-in->lo+1);
+	lsNewEnd(args, (lsGeneric)vlStrdup(buf), 0);
+	sprintf(buf, "%d", out->hi-out->lo+1);
+	lsNewEnd(args, (lsGeneric)vlStrdup(buf), 0);
+
+	for (i=in->lo; i<=in->hi; i++) {
+	    if (out->lo > out->hi) {
+		if (i == in->lo) {
+		    sprintf(out_buf, "%s", out->name->name);
+		    sprintf(in_buf, "%s%s%d%s", in->name->name,
+			    SEP_LARRAY, i, SEP_RARRAY);
+		    if (set_notation) {
+			fprintf(file, ".names %s %s\n- =%s\n",
+				in_buf, out_buf, in_buf);
+		    } else {
+			vl_write_bit_connect(file, in_buf, out_buf, 0);
+		    }
+		}
+	    } else {
+		if (i-in->lo <= out->hi-out->lo) {
+		    sprintf(out_buf, "%s%s%d%s", out->name->name,
+			    SEP_LBITSELECT,i+in->lo-out->lo,SEP_RBITSELECT);
+		    sprintf(in_buf, "%s%s%d%s", in->name->name,
+			    SEP_LBITSELECT, i, SEP_RBITSELECT);
+		    if (set_notation) {
+			fprintf(file, ".names %s %s\n- =%s\n",
+				in_buf, out_buf, in_buf);
+		    } else {
+			vl_write_bit_connect(file, in_buf, out_buf, 0);
+		    }
+		}
+	    }
+	}
+
+	lsDestroy(args, vl_chk_free);
+    }
+}
+
+
+void subrange_term(FILE *file, vl_term *in, vl_term *out)
+{
+}
+
+
+vl_term *vl_write_nond_wire(FILE *file, vl_term *ctrl_term, lsList nond_list, vl_term *reference_term)
+{
+    vl_term *retval;
+    vl_term *nond_term;
+    vl_expr *nond_expr;
+    lsHandle handle;
+    lsGen gen;
+    lsList domain;
+    lsGen enum_gen;
+    vl_enumerator *enum_elt;
+    lsHandle enum_handle;
+    lsList nond_consts, nond_terms;
+    int num_terms, num_consts;
+    int i, j, k, l;
+
+    retval = typed_new_term(reference_term->term_type, NIL(vl_range),
+			    reference_term->lo, reference_term->hi);
+    if (vis_nond && rst_ckt) {
+	char *cp;
+	cp = (char*)chk_malloc(strlen(reference_term->name->name) +
+			       strlen(retval->name->name) +
+			       2*strlen(SEP_GATEPIN)+strlen(PIN_INITIAL)+1);
+	sprintf(cp, "%s%s%s%s%s", reference_term->name->name, SEP_GATEPIN,
+		PIN_INITIAL, SEP_GATEPIN, retval->name->name);
+	retval->name->name = cp;
+    }
+    retval->flag = reference_term->flag;
+    if (!vis_nond || rst_ckt)
+	write_var_decl(file, retval);
+    nond_consts = lsCreate();
+    nond_terms = lsCreate();
+    for (gen=lsStart(nond_list), num_terms=0, num_consts=0;
+	 lsNext(gen, (lsGeneric*)&nond_expr, &handle) != LS_NOMORE; ) {
+	if (ISVLCONST(nond_expr->type)) {
+
+	    num_consts++;
+	    lsNewEnd(nond_consts, (lsGeneric)nond_expr->u.intval, 0);
+	} else {
+
+	    num_terms++;
+	    lsNewEnd(nond_terms, (lsGeneric)nond_expr->term, 0);
+	}
+    }
+    (void)lsFinish(gen);
+
+
+    fprintf(file, ".names ");
+    for (gen=lsStart(nond_terms);
+	 lsNext(gen, (lsGeneric*)&nond_term, &handle) != LS_NOMORE; ) {
+	if (reference_term->lo > reference_term->hi ||
+	    reference_term->flag & MVar)
+	    if (nond_term->lo > nond_term->hi || reference_term->flag & MVar)
+		fprintf(file, "%s ", nond_term->name->name);
+	    else
+		fprintf(file, "%s%s%d%s ", nond_term->name->name,
+			SEP_LBITSELECT, nond_term->lo, SEP_RBITSELECT);
+	else {
+	    for (l=reference_term->lo; l<=reference_term->hi; l++)
+		fprintf(file, "%s%s%d%s ", nond_term->name->name,
+			SEP_LBITSELECT, l, SEP_RBITSELECT);
+	}
+    }
+    (void)lsFinish(gen);
+    if (reference_term->lo > reference_term->hi ||
+	reference_term->flag & MVar)
+	fprintf(file, "%s\n",
+		nond_output(retval->name->name, reference_term->name->name));
+    else {
+	fprintf(file, "%s ", HSIS_ARROW);
+	for (l=reference_term->lo; l<=reference_term->hi; l++)
+	    fprintf(file, "%s%s%d%s ",
+		    nond_output(retval->name->name,reference_term->name->name),
+		    SEP_LBITSELECT, l, SEP_RBITSELECT);
+	fprintf(file, "\n");
+    }
+
+
+
+    for (gen=lsStart(nond_consts);
+	 lsNext(gen,(lsGeneric*)&k,&handle) != LS_NOMORE; ) {
+	if (reference_term->lo > reference_term->hi ||
+	    reference_term->flag & MVar)
+	    for (j=0; j<num_terms; j++) fprintf(file, "- ");
+	else
+	    for (l=reference_term->lo; l<=reference_term->hi; l++)
+		for (j=0; j<num_terms; j++) fprintf(file, "- ");
+
+	if (reference_term->flag & MVar) {
+	    domain = reference_term->term_type->specifier->u.enum_type->domain_list;
+	    for (enum_gen = lsStart(domain), i=0;
+		 lsNext(enum_gen, (lsGeneric*)&enum_elt, &enum_handle) !=
+		     LS_NOMORE; i++)
+		if (k == i) {
+		    fprintf(file, "%s ", enum_elt->name);
+
+		}
+	    (void)lsFinish(enum_gen);
+	} else {
+	    if (reference_term->lo > reference_term->hi) {
+
+		fprintf(file, "%d", k);
+	    } else {
+
+		for (l=reference_term->lo, j=k; l<=reference_term->hi;
+		     l++, j >>= 1)
+		    fprintf(file, "%d ", j & 0x1);
+	    }
+	}
+	fprintf(file, "\n");
+    }
+    (void)lsFinish(gen);
+
+    for (gen=lsStart(nond_terms), j=0;
+	 lsNext(gen,(lsGeneric*)&nond_term,&handle) != LS_NOMORE; j++) {
+	if (set_notation || reference_term->lo <= reference_term->hi) {
+
+
+	    for (i=0; i<num_terms; i++)
+		if (reference_term->lo > reference_term->hi ||
+		    reference_term->flag & MVar)
+		    fprintf(file, "- ");
+		else {
+		    for (l=reference_term->lo; l<=reference_term->hi; l++)
+			fprintf(file, "- ");
+		}
+
+	    if (reference_term->lo > reference_term->hi ||
+		reference_term->flag & MVar) {
+		if (nond_term->lo > nond_term->hi)
+		    fprintf(file, "%s%s\n", HSIS_EQUAL, nond_term->name->name);
+		else
+		    fprintf(file, "%s%s%s%d%s\n", HSIS_EQUAL,
+			    nond_term->name->name,
+			    SEP_LBITSELECT, nond_term->lo, SEP_RBITSELECT);
+	    } else {
+		for (l=reference_term->lo; l<=reference_term->hi; l++)
+		    fprintf(file, "%s%s%s%d%s ", HSIS_EQUAL,
+			    nond_term->name->name,
+			    SEP_LBITSELECT,
+			    nond_term->lo-reference_term->lo+l,
+			    SEP_RBITSELECT);
+		fprintf(file, "\n");
+	    }
+
+	} else {
+
+
+	    if (reference_term->flag & MVar) {
+
+		domain = reference_term->term_type->specifier->u.enum_type->domain_list;
+		for (enum_gen=lsStart(domain);
+		     lsNext(enum_gen, (lsGeneric*)&enum_elt,
+			    &enum_handle) !=
+			 LS_NOMORE; ) {
+		    for (i=0; i<j; i++) fprintf(file, "- ");
+		    fprintf(file, "%s ", enum_elt->name);
+		    for (i++; i<num_terms; i++) fprintf(file, "- ");
+		    fprintf(file, "%s\n", enum_elt->name);
+		}
+		(void)lsFinish(enum_gen);
+	    } else {
+
+	    }
+
+	}
+    }
+    (void)lsFinish(gen);
+
+    lsDestroy(nond_consts, 0);
+    lsDestroy(nond_terms, 0);
+    return retval;
+}
+
+
+void vl_get_minmax_delay(vl_delay *delay, vl_expr **min_delay, vl_expr **max_delay)
+{
+    lsGen gen;
+    lsHandle handle;
+    vl_expr *delayi;
+    int i;
+
+    if (!(delay->delay3 && !delay->delay2)) return;
+    assert(lsLength((lsList)delay->delay1) == 2);
+
+    *min_delay = *max_delay = NIL(vl_expr);
+    for (gen=lsStart((lsList)delay->delay1), i=1;
+	 lsNext(gen, (lsGeneric*)&delayi, &handle) != LS_NOMORE; i++) {
+	if (i==1) *min_delay = delayi;
+	else if (i==2) *max_delay = delayi;
+	else break;
+    }
+    lsFinish(gen);
+}
+
+
+static int isTautology(lsList syndrome_expr_list)
+{
+    lsGen gen;
+    lsHandle handle;
+    syndrome_expr *se;
+    unsigned int i;
+    int unguarded = 0;
+
+    for (gen = lsStart(syndrome_expr_list);
+	 lsNext(gen, (lsGeneric*)&se, &handle) != LS_NOMORE; ) {
+	unguarded = 1;
+	for (i=0; i<strlen(se->syndrome); i++) {
+	    if ((se->syndrome)[i] != '-') {
+		unguarded = 0;
+		break;
+	    }
+	}
+	if (unguarded) break;
+    }
+    lsFinish(gen);
+
+    return unguarded;
+}
+
+
+
+void write_case_tag_const(FILE *file, vl_term *selector,
+			  vl_expr *tag_expr, st_table *vars)
+{
+
+    if (!tag_expr->term) {
+	if (tag_expr->type == IntExpr || tag_expr->type == BitExpr ||
+	    evaluable_expr(tag_expr)) {
+	    tag_expr->term = typed_new_term(selector->name->id_type,
+					NIL(vl_range),
+					selector->lo, selector->hi);
+	    write_var_decl(file, tag_expr->term);
+	    write_int_connect(file, vl_eval_expr(tag_expr), tag_expr->term);
+	} else if (tag_expr->type != IDExpr && tag_expr->type != ConcatExpr) {
+	    vl_write_expr(file, tag_expr, vars);
+	} else if (tag_expr->type == IDExpr) {
+	    vl_id_range *sel_id_sym;
+	    vl_enumerator *enum_elt;
+
+	    if (!st_lookup(vl_currentModule->sig_st, selector->name->name,
+			   (char**)&sel_id_sym)) {
+		sel_id_sym = vl_copy_id_range(selector->name);
+		if (selector->term_type)
+		    sel_id_sym->id_type = selector->term_type;
+		if (!strstr(selector->name->name, SEP_GATEPIN)) {
+		    st_insert(vl_currentModule->sig_st,
+			      vlStrdup(selector->name->name),
+			      (char*)sel_id_sym);
+		}
+	    }
+	    if (!sel_id_sym->id_type) {
+		vl_write_expr(file, tag_expr, vars);
+		return;
+	    }
+
+	    if (st_lookup(sel_id_sym->id_type->specifier->
+			  u.enum_type->domain_st,
+			  tag_expr->u.name->name,
+			  (char**)&enum_elt)) {
+
+		tag_expr->term = typed_new_term(selector->term_type,
+					    NIL(vl_range),
+					    selector->lo, selector->hi);
+		tag_expr->term->flag = selector->flag;
+		write_var_decl(file, tag_expr->term);
+		tag_expr->type = IntExpr;
+		tag_expr->u.intval = enum_elt->val;
+		vl_write_const(file, tag_expr, tag_expr->term);
+	    } else {
+		char buf[MAXSTRLEN];
+
+		sprintf(buf,"'%s':var '%s' should not be used as CASE-tag",
+			vl_currentModule->name->name, tag_expr->u.name->name);
+		semantic_error(buf);
+	    }
+	} else if (tag_expr->type == ConcatExpr) {
+	    vl_write_expr(file, tag_expr, vars);
+	}
+    }
+}
+
+
+void width_unknown()
+{
+    char buf[MAXSTRLEN];
+
+    sprintf(buf, "%s:you are giving me concatenation of something I can't determined the width", vl_currentModule->name->name);
+    yylineno = -1;
+    compile_error(buf);
+}
+
+
+vl_term *concate_assigns(array_t *assign_array)
+{
+    vl_term *retval;
+    vl_term *ith_term;
+    int n_bits;
+    int i;
+
+    n_bits=0;
+    for (i=0; i<array_n(assign_array); i++) {
+	ith_term = array_fetch(vl_term*, assign_array, i);
+	if (ith_term->flag & MVar)
+	    compile_error("boomer:concating symbolic variables");
+
+	if (ith_term->hi < ith_term->lo) n_bits++;
+	else n_bits += (ith_term->hi - ith_term->lo + 1);
+    }
+
+    retval = new_term(NIL(vl_range), 0, n_bits-1);
+
+    return retval;
+}
+
+
+void connect_concat(FILE *file, vl_term *assign_term, array_t *lhs_array)
+{
+    int i;
+    int old_lo, old_hi;
+    int n_bits, bit_pos;
+    vl_term *lhs_term;
+
+    old_lo = assign_term->lo;
+    old_hi = assign_term->hi;
+    for (i=array_n(lhs_array)-1, bit_pos = assign_term->lo; i>=0; i--) {
+	lhs_term = array_fetch(vl_term*, lhs_array, i);
+	if (lhs_term->hi < lhs_term->lo) n_bits = 1;
+	else n_bits = lhs_term->hi - lhs_term->lo + 1;
+	assign_term->lo = bit_pos;
+	assign_term->hi = assign_term->lo + n_bits - 1;
+	vl_write_bin_connect(file, assign_term, lhs_term, 0);
+	bit_pos += n_bits;
+    }
+    assign_term->lo = old_lo;
+    assign_term->hi = old_hi;
+}
+
+
+fg_graph_info *get_assoc_lc_name(char *loc, char *lc_name)
+{
+    int location;
+    lsGen ggen;
+    lsHandle ghandle;
+    graph_t *graph;
+    fg_graph_info *retval=NIL(fg_graph_info);
+
+    if (!loc) return retval;
+    if (!lc_name) return retval;
+
+    location = atoi(strstr(loc, FG_LLOC)+strlen(FG_LLOC));
+    for(ggen=lsStart(vl_currentModule->flow_graphs);
+	lsNext(ggen, (lsGeneric*)&graph, &ghandle) != LS_NOMORE; ) {
+	if (location >= ((fg_graph_info*)graph->user_data)->pause_lo &&
+	    location <  ((fg_graph_info*)graph->user_data)->pause_hi) {
+	    sprintf(lc_name, "%s%06x",
+		    FG_LC_PS, ((fg_graph_info*)graph->user_data)->fg_id);
+	    retval = (fg_graph_info*)(graph->user_data);
+	    break;
+	}
+    }
+    lsFinish(ggen);
+
+    return retval;
+}
+
+
+void write_out_port(FILE *file, vl_id_range *id_sym,
+		    int m_hi, int m_lo, vl_expr *inst_expr,
+		    st_table *auxSigST)
+{
+    if (inst_expr->type == IDExpr) {
+	st_insert(vl_currentModule->sig_st, inst_expr->u.name->name,
+		  (char*)vl_create_id_range(inst_expr->u.name->name,
+					    NIL(vl_range)));
+    }
+    inst_expr->term = new_term(NIL(vl_range), m_lo, m_hi);
+}
+
+
+void vl_write_outport_connect(FILE *file, vl_expr *inst_expr)
+{
+    int rep=1;
+    int i;
+    int bitWidth;
+    lsGen gen;
+    lsHandle handle;
+    vl_term *term_out;
+    vl_expr *e;
+
+    if (inst_expr->type != ConcatExpr) return;
+
+    if (inst_expr->u.exprs.e2) {
+	rep = vl_eval_expr(inst_expr->u.exprs.e2);
+    }
+
+    term_out = inst_expr->term;
+    assert(term_out);
+    term_out->hi = term_out->lo - 1;
+    for (i=0; i<rep; i++) {
+	for (gen=lsStart((lsList)(inst_expr->u.exprs.e1));
+	     lsNext(gen, (lsGeneric*)&e, &handle) != LS_NOMORE; ) {
+	    vl_write_expr(file, e, NIL(st_table));
+	    assert(e->term);
+	    bitWidth = (e->term->hi - e->term->lo+1);
+	    bitWidth = (bitWidth>0) ? bitWidth : 1;
+	    term_out->lo = term_out->hi + 1;
+	    term_out->hi = term_out->lo + bitWidth - 1;
+	    vl_write_bin_connect(file, term_out, e->term, 0);
+	}
+	lsFinish(gen);
+    }
+    term_out->lo = 0;
+}
+
+
+static int evaluable_expr(vl_expr *expr)
+{
+    int old_silent_err;
+    int retval;
+
+    old_silent_err = silent_err;
+    silent_err = 1;
+    Vlerrno = 0;
+
+    vl_eval_expr(expr);
+
+    retval = Vlerrno;
+    silent_err = old_silent_err;
+    return !retval;
+}
+
+
+void write_const_param(FILE *file, vl_expr *expr, vl_id_range *ival)
+{
+    int l, r;
+    vl_expr *ce;
+
+    if (expr->type == IDExpr) {
+
+	l = 31; r = 0;
+    } else {
+	l = vl_eval_expr(expr->u.idrng->range->left);
+	if (expr->u.idrng->range->right)
+	    r = vl_eval_expr(expr->u.idrng->range->right);
+	else
+	    r = l;
+    }
+
+    expr->term = new_term(NIL(vl_range), 0, (l>r)?l:r);
+    write_var_decl(file, expr->term);
+
+    ce = vl_create_expr(IntExpr, (int)ival->mpg_master_exp, (double)0.0,
+			NIL(void), NIL(void), NIL(void));
+    vl_write_const(file, ce, expr->term);
+    vl_chk_free((char*)ce);
+
+    expr->term->hi = (l>r)?l:r;
+    expr->term->lo = (l>r)?r:l;
+}
+
+
+void chkUndefPorts(vl_expr *expr, st_table *sig_st)
+{
+    char *dummy;
+
+    if (implicitDeclare)
+	if (sig_st)
+	    if (expr->type == IDExpr)
+		if (!st_lookup(vl_currentModule->sig_st, expr->u.name->name,
+			       &dummy)) {
+		    st_insert(sig_st, expr->u.name->name, 0);
+		}
+}
+
+
+void record_pseudo_cntxt(FILE *file, int fg_id, st_table *pre_cond,
+			 char *ctrl_syndrome,
+			 char *rst_ctrl_syndrome, st_table *vars)
+{
+    vl_id_range *cntxt_idsym;
+    vl_term *out_term, *new_out;
+
+    cntxt_idsym = vl_create_id_range(cntxt_event, NIL(vl_range));
+    cntxt_idsym->flags |= EventVar;
+    st_insert(vl_currentModule->sig_st, cntxt_idsym->name, (char*)cntxt_idsym);
+
+    out_term = new_term(NIL(vl_range), 0, -1);
+    write_int_connect(file, 1, out_term);
+    new_out = vl_copy_term(out_term);
+
+    if (!rst_ckt) {
+	lsNewEnd(cntxt_idsym->syndrome_expr_list,
+		 (lsGeneric)create_syndrome_expr(vlStrdup(ctrl_syndrome),
+						 new_out, pre_cond, fg_id),
+		 0);
+    } else {
+	lsNewEnd(cntxt_idsym->rst_syndrome_expr_list,
+		 (lsGeneric)create_syndrome_expr(vlStrdup(rst_ctrl_syndrome),
+						 new_out, pre_cond, fg_id),
+		 0);
+    }
+
+
+
+
+    st_insert(vars, cntxt_idsym->name,
+	      (char*)create_var_info(vl_copy_id_range(cntxt_idsym), out_term));
+
+    cntxt_event = NIL(char);
+}
+
+
+char *descape(char *str, char ch1, char ch2)
+{
+    static char retval[MAXSTRLEN];
+
+    strcpy(retval, str);
+    return retval;
+}
+
+
+char *triPort(char *name)
+{
+    static char retval[MAXSTRLEN];
+    vl_id_range *id_sym;
+
+    strcpy(retval, name);
+    if (st_lookup(vl_currentModule->sig_st, name, (char**)&id_sym)) {
+	if (Zconnection) {
+	    if ((id_sym->flags & InPort) && (id_sym->flags & OutPort)) {
+		strcat(retval, SEP_GATEPIN);  strcat(retval, PIN_INOUT);
+	    }
+	}
+    }
+    return retval;
+}
+
+
+static char *
+nond_output(char *local_name, char *var_name)
+{
+    static char buf[MAXSTRLEN];
+    char *cp;
+
+    if (vis_nond && !rst_ckt) {
+	sprintf(buf, var_name);
+	if ((cp=strstr(buf, SEP_GATEPIN))) *cp = '\0';
+	vis_nond_var = 1;
+	return buf;
+    } else {
+	return local_name;
+    }
+}
+
+
+void to_upper(char *str)
+{
+    int i;
+    int len;
+
+    len = strlen(str);
+    for (i=0; i<len; i++)
+	if (islower((int)(str[i])))
+	    str[i] += ('A' - 'a');
+}
+
+
+char *
+shift_mv_vars(char *inputs, int nval)
+{
+    static char buf[MAXSTRLEN];
+    int len, i;
+    char arg[MAXSTRLEN];
+    char token[MAXSTRLEN];
+    char *cp;
+    int ith;
+
+    buf[0] = '\0';
+    len = strlen(inputs);
+    for (cp=inputs, ith=0; cp<inputs+len; ith++) {
+	i=0;
+	while ((*cp == ' ' || *cp == '\t') && *cp != '\0') cp++;
+	while ((*cp != ' ' && *cp != '\t') && *cp != '\0') {
+	    token[i] = *cp;
+	    cp++;  i++;
+	}
+	if (i > 0) {
+	    token[i] = '\0';
+	    if (ith == 0)
+		sprintf(arg, " %s ", token);
+	    else
+		sprintf(arg, " , %s ", token);
+	    strcat(buf, arg);
+	}
+    }
+
+    return buf;
+}
Index: vis_dev/vl2mv-2.3/src/parser/vl_write_util.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vl_write_util.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vl_write_util.h	(revision 18)
@@ -0,0 +1,140 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/parser/vl_write_util.h,v 1.2 2009/03/09 20:25:58 fabio Exp $
+
+
+*/
+EXTERN void vl_mv_to_bin ARGS((vl_term *));
+EXTERN void vl_bin_to_mv ARGS((vl_term *));
+EXTERN void vl_write_mv_comp ARGS((FILE *, short, vl_term *, vl_term *, vl_term *));
+EXTERN void vl_write_bin_comp ARGS((FILE *, short, vl_term *, vl_term *, vl_term *));
+EXTERN void vl_write_mv_connect ARGS((FILE *, vl_term *, vl_term *));
+EXTERN void vl_write_bin_connect ARGS((FILE *, vl_term *, vl_term *, int));
+EXTERN void vl_write_const ARGS((FILE *, vl_expr *, vl_term *));
+EXTERN void vl_write_consts ARGS((FILE *));
+EXTERN void write_int_connect ARGS((FILE*, int, vl_term*));
+EXTERN vl_term *write_local_control ARGS((FILE*, vl_term*, lsList, int));
+EXTERN char *new_termname ARGS(());
+EXTERN char *new_instname ARGS(());
+EXTERN vl_range *get_decl_range ARGS((void *));
+EXTERN vl_expr *get_decl_range_left ARGS((void *));
+EXTERN vl_expr *get_decl_range_right ARGS((void *));
+EXTERN short get_decl_flags ARGS((void *));
+EXTERN void get_hilo ARGS((vl_id_range *, int *, int *));
+EXTERN void insert_control_list ARGS((var_info*, vl_term*));
+EXTERN void print_control_var_pair ARGS((FILE *, char *, char *));
+EXTERN vl_term *write_multi_in_or ARGS((FILE *, lsList));
+EXTERN vl_term *syndrome_to_control ARGS((FILE*, char*, st_table*));
+EXTERN lsList put_guard_zero ARGS((FILE *, lsList));
+EXTERN lsList get_transition ARGS((FILE *));
+EXTERN vl_term *write_array_access ARGS((FILE *, vl_id_range *, vl_term *, vl_expr *));
+EXTERN char *sel_var ARGS((char *));
+EXTERN char *check_dc ARGS((lsList));
+EXTERN char *write_red_op ARGS((FILE*, short, vl_term*, vl_term*, vl_term*));
+EXTERN char *write_op_vector_bop ARGS((FILE *, short, vl_term*, vl_term*, vl_term*));
+EXTERN char *write_rel_vector_bop ARGS((FILE *, short, vl_term*, vl_term*, vl_term*));
+EXTERN void put_nblock_transition ARGS((FILE *, int, int, vl_id_range *, int, int, int, char *, lsList));
+EXTERN vl_port *search_match_port ARGS((char *, lsList));
+EXTERN vl_port_connect *search_inst_port ARGS((char *, lsList));
+EXTERN char *vl_translated_prim_symbol ARGS((unsigned char));
+EXTERN char *vl_translate_prim_symbol ARGS((unsigned char));
+EXTERN vl_term *array_or ARGS((FILE *, array_t *));
+EXTERN vl_term *vl_write_nond_wire ARGS((FILE*, vl_term*, lsList, vl_term*));
+EXTERN vl_term *concate_assigns ARGS((array_t *));
+EXTERN char *descape ARGS((char*, char, char));
+EXTERN char *triPort ARGS((char*));
+EXTERN void *chng_decl_range ARGS((void *decl, vl_range *new_range));
+EXTERN void to_upper ARGS((char*));
+EXTERN char *shift_mv_vars ARGS((char *inputs, int nval));
+EXTERN void declare_mvar_io ARGS((FILE *file, char *dir, vl_id_range *id_sym));
+EXTERN void declare_bin_scalar_io ARGS((FILE *file, char *dir, vl_id_range *id_sym));
+EXTERN void declare_bin_vector_io ARGS((FILE *file, char *dir, vl_id_range *id_sym));
+EXTERN int vector_width ARGS((int lo, int hi));
+EXTERN int need_edge_detector ARGS((lsList table_entries, int ith_port));
+EXTERN int put_entry ARGS((FILE *file, char *str, char *dc, int need_leading_and));
+EXTERN void chkUndefPorts ARGS((vl_expr *expr, st_table *sig_st));
+EXTERN void write_out_port ARGS((FILE *file, vl_id_range *id_sym,
+				 int m_hi, int m_lo, vl_expr *inst_expr,
+				 st_table *auxSigST));
+EXTERN void put_const_port_connect ARGS((FILE *file, char *outstr,
+					 vl_id_range *master,
+					 vl_port_connect *instance,
+					 lsList input_consts,
+					 vl_term *term_out));
+
+EXTERN void put_mvar_port_connect ARGS((FILE *file, char *outstr,
+					vl_id_range *master,
+					vl_port_connect *instance));
+EXTERN void put_bin_scalar_port_connect ARGS((FILE *file, char *outstr,
+					      vl_id_range *master,
+					      vl_port_connect *instance));
+EXTERN void put_bin_vector_port_connect ARGS((FILE *file, char *outstr,
+					      vl_id_range *master,
+					      vl_port_connect *instance));
+EXTERN void vl_write_outport_connect ARGS((FILE *file, vl_expr *inst_expr));
+EXTERN int isOutPort ARGS((short unsigned flag));
+EXTERN void record_pseudo_cntxt ARGS((FILE *file, int fg_id,
+				      st_table *pre_cond,
+				      char *ctrl_syndrome,
+				      char *rst_ctrl_syndrome,
+				      st_table *vars));
+EXTERN void check_assign ARGS((vl_bassign_stmt *assign, int procedural));
+EXTERN void write_switch ARGS((FILE *file, vl_id_range *id_sym,
+			       vl_term *sel, vl_expr *sel_expr,
+			       vl_term *orig, vl_term *new,
+			       vl_term *out_term));
+EXTERN void dump_debug_information ARGS((FILE *file, vl_id_range *id_var,
+					 vl_term *current_term, int lineno,
+					 lsList ctrl_list,
+					 char *ctrl_syndrome));
+EXTERN void patch_unaffected_term ARGS((FILE *file, vl_id_range *id_sym,
+					vl_term *orig_term,
+					vl_term *out_term));
+EXTERN void connect_concat ARGS((FILE *file, vl_term *assign_term, array_t *lhs_array));
+EXTERN void write_const_param ARGS((FILE *file, vl_expr *expr, vl_id_range *ival));
+EXTERN void subrange_term ARGS((FILE *file, vl_term *in, vl_term *out));
+EXTERN void expand_term ARGS((FILE *file, vl_term *in, vl_term *out));
+EXTERN void shrink_term ARGS((FILE *file, vl_term *in, vl_term *out));
+EXTERN void width_unknown ARGS(());
+EXTERN void write_case_tag_const ARGS((FILE *file, vl_term *selector,
+				       vl_expr *tag_expr, st_table *vars));
+EXTERN void put_bin_scalar_func_connect ARGS((FILE *file,
+					      vl_id_range *master,
+					      vl_term *instance));
+EXTERN void put_bin_vector_func_connect ARGS((FILE *file, vl_id_range *master,
+					      vl_term *instance));
+EXTERN void put_quasi_table ARGS((FILE *file, char *dc, char *quasi_name,
+				  char *sync_name, vl_id_range *id_sym,
+				  vl_term *out_term, int lo, int hi,
+				  int n_entries));
+EXTERN void instantiate_reset_mux ARGS((FILE *file, vl_id_range *id_sym,
+					int lo, int hi,
+					var_info *var, var_info *lvar));
+EXTERN void instantiate_input_latch ARGS((FILE *file, vl_id_range *id_sym));
+EXTERN void instantiate_hidden_latch ARGS((FILE *file, vl_id_range *id_sym));
+EXTERN void create_wire_nondeterminism ARGS((FILE *file, char * var_name,
+					     vl_id_range *id_sym,
+					     array_t *vars_array));
+EXTERN void put_nblock_mout_transition ARGS((FILE *file, int non_block_wire,
+					     int n_entries, 
+					     vl_id_range *id_sym,
+					     int idx_lo, int idx_hi, int cur,
+					     char *dc, char *latch_name));
Index: vis_dev/vl2mv-2.3/src/parser/vlr_int.h
===================================================================
--- vis_dev/vl2mv-2.3/src/parser/vlr_int.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/parser/vlr_int.h	(revision 18)
@@ -0,0 +1,265 @@
+/*
+
+  Copyright (c) 1992, 1993
+        Regents of the University of California
+  All rights reserved.
+
+  Use and copying of this software and preparation of derivative works
+  based upon this software are permitted.  However, any distribution of
+  this software or derivative works must include the above copyright 
+  notice.
+
+  This software is made available AS IS, and neither the Electronics
+  Research Laboratory or the Universify of California make any
+  warranty about the software, its performance or its conformity to
+  any specification.
+
+  Author: Szu-Tsung Cheng, stcheng@ic.Berkeley.EDU
+          10/92
+          10/93
+
+  $Id: vlr_int.h,v 1.6 2009/03/09 20:25:58 fabio Exp $
+
+*/
+
+
+#define VL2MV_VERSION "2.1"
+
+#define MAXSTRLEN    16384
+#define MAXBITNUM    32
+#define ERR_CHK      1
+#define ERR_COMPILE  2
+#define ERR_INTERNAL 3
+#define ERR_ASSERT   4
+#define ERR_SEMANTIC 5
+
+#define NODE           "_n"
+#define PC             "_pc"
+#define LABEL          "_label"
+
+
+#define VL_NOND        "$ND"
+
+#define SEP_LBITSELECT "<"
+#define SEP_RBITSELECT ">"
+#define SEP_LARRAY     "<*"
+#define SEP_RARRAY     "*>"
+#define SEP_LTRANGE    "<<"
+#define SEP_RTRANGE    ">>"
+#define SEP_GATEPIN   "$"
+#define SEP_DIR       "___"
+#define SEP_LATCH     "_V_"
+#define SEP_QUASI     "_Q_"
+#define SEP_SEL_VAR   "+"
+#define PIN_INITIAL   "initial"
+#define PIN_DELAYED   "*"
+#define PIN_LATCH     "lat"
+#define PIN_RAWOUT    "raw"
+#define PIN_TRUE      "true"
+#define PIN_FALSE     "false"
+#define PIN_IN        "in"
+#define PIN_PS        "ps"
+#define PIN_NS        "ns"
+#define PIN_FEEDBACK  "@"
+#define PIN_DELAY     "prev"
+#define PIN_EVENT     "e"
+#define PIN_HIDDEN    "*||*"
+#define PIN_INOUT     "_IO_"
+
+
+#define HSIS_EQUAL    "="
+#define HSIS_ARROW    "->"
+#define HSIS_DEFAULT  ".def"
+#define HSIS_SET_BEGIN "("
+#define HSIS_SET_END   ")"
+#define HSIS_SET_SEP   ","
+#define HSIS_BLIF_MVT_TIMER "T"
+#define HSIS_DELTA_TIMER    "dD"
+#define HSIS_TIMER_SEP "&&"
+#define HSIS_COMMENT   "#"
+#define HSIS_MODEL     ".model"
+#define HSIS_TYPE      "type"
+#define HSIS_MEMREAD   "HSIS_READ_MEM"
+#define HSIS_MEMWRITE  "HSIS_WRITE_MEM"
+#define HSIS_REGFILE   "regfile"
+#define HSIS_ADDRESS   "address"
+#define HSIS_VALUE     "value"
+
+
+#define SMV_COMMENT    "--"
+#define SMV_DEFINE     "DEFINE"
+#define SMV_ASSIGN     "ASSIGN"
+#define SMV_VAR        "VAR"
+#define SMV_WIRE       "WIRE"
+#define SMV_MODULE     "MODULE"
+#define SMV_PROLOGUE   ""
+#define SMV_EPILOGUE   ""
+#define SMV_INPUT      "INPUT"
+#define SMV_OUTPUT     "OUTPUT"
+#define SMV_CLOCK      "CLOCK"
+#define SMV_MEMORY     "MEMORY"
+#define SMV_IF         "if"
+#define SMV_COL_ASSIGN ":="
+#define SMV_COLON      ":"
+#define SMV_CMPL       "~"
+#define SMV_NOT        "!"
+#define SMV_AND        "&"
+#define SMV_OR         "|"
+#define SMV_XOR        "^"
+#define SMV_MOD        "mod"
+#define SMV_EQUIV      "<->"
+#define SMV_IMP        "->"
+#define SMV_EQUAL      "="
+#define SMV_NEQUAL     "~="
+#define SMV_LBRACE     "{"
+#define SMV_RBRACE     "}"
+#define SMV_LBRACKET   "("
+#define SMV_RBRACKET   ")"
+#define SMV_COMMA      ","
+#define SMV_RANGE      ".."
+#define SMV_PLUS       "+"
+#define SMV_MINUS      "-"
+#define SMV_LE         "<="
+#define SMV_GE         ">="
+#define SMV_OF         "of"
+#define SMV_ARRAY      "array"
+#define SMV_BOOLEAN    "boolean"
+#define SMV_FOR        "for"
+#define SMV_PROCESS    "process"
+#define SMV_INIT       "init"
+#define SMV_TRANS      "next"
+
+#define SMV_CASE       "case {"
+#define SMV_ESAC       "}"
+#define SMV_CTL_OP     "AEFGUX"
+
+
+#define SMV_BIN_DC     "{0,1}"
+#define SMV_INDEX      "__SMV_index__"
+
+
+#define SCRATCH_FILE  "gate.blif"
+#define OUT_SCRATCH   "gate.o"
+#define SCRIPT_NAME   "script.complement"
+#define SIS_LOG       "sis.log"
+
+
+#define CLOCK         "clk"
+
+
+#define NO_MUX        0x0
+#define MUX_T         0x3    
+#define MUX_F         0x2    
+
+
+#define DEFAULT_MAX_TABLE_SIZE 1
+
+
+#define MACRO_DEFINE  "define"
+#define MACRO_IFDEF   "ifdef"
+#define MACRO_IFNDEF  "ifndef"
+#define MACRO_ELSE    "else"
+#define MACRO_ENDIF   "endif"
+
+
+
+
+
+#define BLIF_GND         "_BLIF_GND"
+#define BLIF_SUP         "_BLIF_SUP"
+#define BLIF_LIB_AND     "_BLIF_AND"
+#define BLIF_LIB_OR      "_BLIF_OR"
+#define BLIF_LIB_XOR     "_BLIF_XOR"
+#define BLIF_LIB_XNOR    "_BLIF_XNOR"
+#define BLIF_LIB_ADD     "_BLIF_ADD"
+#define BLIF_LIB_SUB     "_BLIF_SUB"
+
+
+#define LIB_MUX      0
+
+#define SIG_ST(crt_module) (((crt_module)->type==ModDecl)? \
+                               (((vl_module*)(crt_module))->sig_st): \
+ 			       (((vl_function*)(crt_module))->sig_st))
+#define YYTRACE(str) if (YYTrace) fprintf(stderr, "%s\n", str);
+#define CpyTRACE(str) if (CpyTrace) fprintf(stderr, "  <Y>%s", str);
+#define CreTRACE(str) if (CreTrace) fprintf(stderr, "  <C>%s", str);
+#define PrtTRACE(str) if (PrtTrace) fprintf(stderr, "  <P>%s", str);
+#define StpTRACE(str) if (StpTrace) fprintf(stderr, "  <S>%s", str);
+#define WrtTRACE(str) if (WrtTrace) fprintf(stderr, "  <W>%s", str);
+#define TODO(str) \
+  {fprintf(stderr, "%d:not implemented (translation not precise)\n%s\n", yylineno, str); }
+#define ASSERT(cond,msg) if (!(cond)) {fprintf(stderr,"ASSERT Fail:%s\n",msg);}
+#define Assert(cond)  if (!cond) {fprintf(stderr,"Assert fail: file \"%s\", line %d\n",__FILE__,__LINE__);exit(ERR_ASSERT);}
+				      
+#define ISVLCONST(type) ((type)==BitExpr||(type)==IntExpr||(type)==RealExpr)
+#define IS_VLR_REL_OP(type) ((type)==BgtExpr||(type)==BltExpr||(type)==BgeExpr||(type)==BleExpr)
+#define IS_VLR_LOG_OP(type) ((type)==BlandExpr||(type)==BlorExpr)
+#define ISREDUCTION(type) ((type)==UnandExpr||(type)==UnorExpr|| \
+			   (type)==UxnorExpr||(type)==UandExpr|| \
+			   (type)==UorExpr||(type)==UxorExpr)
+#define RIPPLE_INTERFERE(type) ((type)==UandExpr||(type)==UnandExpr|| \
+                                (type)==UorExpr||(type)==UnorExpr|| \
+                                (type)==UxorExpr||(type)==UxnorExpr|| \
+                                (type)==BplusExpr||(type)==BminusExpr|| \
+                                (type)==BltExpr||(type)==BleExpr|| \
+                                (type)==BgtExpr||(type)==BgeExpr)
+#define IS_TRANSITION(sym) ((sym)==PrimR || (sym)==PrimF || (sym)==PrimS || \
+                            (sym)==PrimBB|| (sym)==PrimQ0|| (sym)==PrimQ1|| \
+			    (sym)==PrimQB|| (sym)==Prim0X|| (sym)==Prim1X|| \
+			    (sym)==PrimX0|| (sym)==PrimX1|| (sym)==PrimXB|| \
+			    (sym)==PrimBX)
+
+
+#if defined(_IBMR2) || defined(_snake)
+extern unsigned char yytext[];
+#else
+extern char *yytext;
+#endif
+extern int yylineno;
+extern FILE *yyin;
+extern struct vl_desc *vl_description;
+extern struct vl_module *vl_currentModule;
+extern struct vl_primitive *vl_currentPrimitive;
+extern struct vl_function *vl_currentFunction;
+
+void yyerror ARGS((char *str));
+
+int yywrap ARGS(());
+void skipcommentblock ARGS(());
+void skipcommentline ARGS(());
+void binbin ARGS((char *, char *));
+void octbin ARGS((char *, char *));
+void decbin ARGS((char *, char *));
+void hexbin ARGS((char *, char *));
+char *utol ARGS((char *));
+void memorize_macro ARGS((char *, st_table *));
+void expand_macro ARGS((char *, st_table *));
+
+
+void chk_error ARGS((char *));
+char *chk_malloc ARGS((unsigned));
+void vl_chk_free ARGS((lsGeneric));
+char *vlStrdup ARGS((char *));
+char *strappend ARGS((char*, char*));
+char *strappendS ARGS((char*, char*));
+char *WRT_BLIF_DC ARGS((FILE *));
+char *WRT_BLIF_MV_DC ARGS((FILE *, lsList));
+char *WRT_BLIF_GND ARGS((FILE *));
+char *WRT_BLIF_SUP ARGS((FILE *));
+vl_term *true_term ARGS((FILE *));
+vl_term *false_term ARGS((FILE *));
+int ptrcmp ARGS((const char *, const char *));
+int ptrhash ARGS((char *, int));
+int declcmp ARGS((char *, char *));
+int declhash ARGS((char *, int));
+char *strip_char ARGS((char *, char *));
+FILE *open_file ARGS((char *, char *));
+void close_file ARGS((FILE *));
+char *num_to_binstr ARGS((int, int));
+int min_bit_width ARGS((int));
+char *sys_lib_encode ARGS((int, int, int));
+char *lib_encode ARGS((int, int));
+char *gen_lib_encode ARGS((int, lsList));
+EXTERN int ipower ARGS((int, int));
+char *basename ARGS((char *));
+char *extname ARGS((char *));
Index: vis_dev/vl2mv-2.3/src/set/set.c
===================================================================
--- vis_dev/vl2mv-2.3/src/set/set.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/set/set.c	(revision 18)
@@ -0,0 +1,279 @@
+/*
+ *  Utilities for handling sets.
+ *
+ *  Copyright (c) 1992, 1993
+ *        Regents of the University of California
+ *  All rights reserved.
+ *
+ *  Use and copying of this software and preparation of derivative works
+ *  based upon this software are permitted.  However, any distribution of
+ *  this software or derivative works must include the above copyright 
+ *  notice.
+ *
+ *  This software is made available AS IS, and neither the Electronics
+ *  Research Laboratory or the Universify of California make any
+ *  warranty about the software, its performance or its conformity to
+ *  any specification.
+ *
+ *  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/set/set.c,v 1.1.1.1 2001/07/09 23:22:43 fabio Exp $
+ *
+ * Author: STCheng, stcheng@ic.berkeley.edu
+ */
+
+#include <stdio.h>
+#include "util.h"
+#include "st.h"
+#include "set.h"
+
+/*
+ * strdup 
+ *
+ *     duplicate a string
+ */
+static char *SetStrdup(str)
+char *str;
+{
+    char *retval;
+
+    retval = ALLOC(char, strlen(str)+1);
+    strcpy(retval, str);
+    return retval;
+}
+
+
+/*
+ * set_empty
+ *
+ *     initialize a new empty set
+ *
+ * argument:
+ *
+ * returns: {}
+ *
+ * bugs:
+ * 
+ * comments:
+ */
+set_t *set_empty()
+{
+    set_t *retval;
+
+    retval = st_init_table(strcmp, st_strhash);
+    return retval;
+}
+
+/*
+ * set_destroy
+ *
+ *     destroy a set data structure
+ *
+ * argument: s
+ *
+ * returns:
+ *
+ * bugs:
+ *
+ * comments:
+ */
+void set_destroy(s)
+set_t *s;
+{
+    st_generator *gen;
+    char *key, *data;
+
+    gen = st_init_gen(s);
+    while (st_gen(gen, &key, &data)) {
+	if (key != data)
+	    FREE(key);
+	FREE(data);
+    }
+    st_free_gen(gen);
+
+    st_free_table(s);
+}
+
+/*
+ * set_add
+ *
+ *     add am element to a set
+ *
+ * argument: a, s
+ *
+ * returns: s'
+ *
+ * side effects: s will be modified
+ *
+ * bugs:
+ * 
+ * comment:
+ */
+set_t *set_add(a, s)
+char *a;
+set_t *s;
+{
+    char *dummy;
+
+    if (!st_lookup(s, a, &dummy)) {
+	st_insert(s, SetStrdup(a), SetStrdup(a));
+    }
+    return s;
+}
+
+/*
+ * set_eliminate
+ *
+ *     remove am element from a set
+ *
+ * argument: a, s
+ *
+ * returns: s'
+ *
+ * side effects: s will be modified
+ *
+ * bugs:
+ * 
+ * comment:
+ */
+set_t *set_eliminate(a, s)
+char *a;
+set_t *s;
+{
+    char *dummy;
+    char *key;
+
+    if (st_lookup(s, a, &dummy)) {
+	key = a;
+	st_delete(s, &key, &dummy);
+	FREE(dummy);
+	FREE(dummy);
+    }
+    return s;
+}
+
+/*
+ * set_find
+ * 
+ *     determine if an element a is in s
+ *
+ * arguments: a, s
+ *
+ * returns: 1/0
+ *
+ * side effects:
+ *
+ * bugs:
+ * 
+ * comments:
+ */
+int set_find(a, s)
+char *a;
+set_t *s;
+{
+    char *dummy;
+
+    return (st_lookup(s, a, &dummy));
+}
+
+/*
+ * set_union
+ * 
+ *     given two sets (s1, s2) find their union
+ *
+ * argument: s1, s2
+ *
+ * returns: s1 + s2
+ *
+ * bugs:
+ *
+ * comments:
+ */
+set_t *set_union(s1, s2)
+set_t *s1;
+set_t *s2;
+{
+    st_generator *gen;
+    set_t *retval;
+    char *key, *data, *dummy;
+
+    retval = st_init_table(strcmp, st_strhash);
+    gen = st_init_gen(s1);
+    while (st_gen(gen, &key, &data)) {
+	st_insert(retval, SetStrdup(key), SetStrdup(data));
+    }
+    st_free_gen(gen);
+    gen = st_init_gen(s2);
+    while (st_gen(gen, &key, &data)) {
+	if (!st_lookup(s1, key, &dummy)) {
+	    st_insert(retval, SetStrdup(key), SetStrdup(data));
+	}
+    }
+    st_free_gen(gen);
+
+    return retval;
+}
+
+/*
+ * set_intersect
+ * 
+ *     given two sets (s1, s2) find their intersection
+ *
+ * argument: s1, s2
+ *
+ * returns: s1 * s2
+ *
+ * bugs:
+ *
+ * comments:
+ */
+set_t *set_intersect(s1, s2)
+set_t *s1;
+set_t *s2;
+{
+    st_generator *gen;
+    set_t *retval;
+    char *key, *data, *dummy;
+
+    retval = st_init_table(strcmp, st_strhash);
+    gen = st_init_gen(s1);
+    while (st_gen(gen, &key, &data)) {
+	if (st_lookup(s2, key, &dummy)) {
+	    st_insert(retval, SetStrdup(key), SetStrdup(key));
+	}
+    }
+    st_free_gen(gen);
+
+    return retval;
+}
+
+/*
+ * set_dup
+ * 
+ *     duplicate a set and all its elements
+ *
+ * arguments: s
+ *
+ * returns: s' ( = s )
+ *
+ * side effects:
+ *
+ * bugs:
+ * 
+ * comments:
+ */
+set_t *set_dup(s)
+set_t *s;
+{
+    st_generator *gen;
+    set_t *retval;
+    char *key, *data;
+
+    retval = st_init_table(strcmp, st_strhash);
+    gen = st_init_gen(s);
+    while (st_gen(gen, &key, &data)) {
+	st_insert(retval, SetStrdup(key), SetStrdup(data));
+    }
+    st_free_gen(gen);
+
+    return retval;
+}
+
Index: vis_dev/vl2mv-2.3/src/set/set.h
===================================================================
--- vis_dev/vl2mv-2.3/src/set/set.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/set/set.h	(revision 18)
@@ -0,0 +1,10 @@
+#define set_t st_table
+
+EXTERN set_t *set_empty ARGS(());
+EXTERN set_t *set_add ARGS((char*, set_t*));
+EXTERN set_t *set_dup ARGS((set_t*));
+EXTERN set_t *set_eliminate ARGS((char*, set_t*));
+EXTERN int   set_find ARGS((char*, set_t*));
+EXTERN set_t *set_union ARGS((set_t*, set_t*));
+EXTERN set_t *set_intersect ARGS((set_t*, set_t*));
+EXTERN void set_destroy ARGS((set_t*));
Index: vis_dev/vl2mv-2.3/src/set/set.make
===================================================================
--- vis_dev/vl2mv-2.3/src/set/set.make	(revision 18)
+++ vis_dev/vl2mv-2.3/src/set/set.make	(revision 18)
@@ -0,0 +1,4 @@
+CSRC += set.c
+HEADERS += set.h
+
+DEPENDENCYFILES = $(CSRC)
Index: vis_dev/vl2mv-2.3/src/stack/stack.c
===================================================================
--- vis_dev/vl2mv-2.3/src/stack/stack.c	(revision 18)
+++ vis_dev/vl2mv-2.3/src/stack/stack.c	(revision 18)
@@ -0,0 +1,70 @@
+/*
+ *  Utilities for handling sets.
+ *
+ *  Copyright (c) 1992, 1993
+ *        Regents of the University of California
+ *  All rights reserved.
+ *
+ *  Use and copying of this software and preparation of derivative works
+ *  based upon this software are permitted.  However, any distribution of
+ *  this software or derivative works must include the above copyright 
+ *  notice.
+ *
+ *  This software is made available AS IS, and neither the Electronics
+ *  Research Laboratory or the Universify of California make any
+ *  warranty about the software, its performance or its conformity to
+ *  any specification.
+ *
+ *  $Header: /projects/development/hsv/CVSRepository/vl2mv/src/stack/stack.c,v 1.1.1.1 2001/07/09 23:22:44 fabio Exp $
+ *
+ * Author: STCheng, stcheng@ic.berkeley.edu
+ */
+
+#include <stdio.h>
+#include "util.h"
+#include "list.h"
+#include "stack.h"
+
+lsList create_stack()
+{
+    return lsCreate();
+}
+
+void destroy_stack(stack, del_func)
+lsList stack;
+void (*del_func)();
+{
+    (void) lsDestroy(stack, del_func);
+}
+
+void push_stack(obj_stack, item)
+lsList obj_stack;
+void *item;
+{
+    lsNewEnd(obj_stack, item, 0);
+}
+
+void *pop_stack(obj_stack, item)
+lsList obj_stack;
+void **item;
+{
+    if (lsDelEnd(obj_stack, (lsGeneric*)item) == LS_NOMORE) {
+	*item = NIL(void);
+	return *item;
+    } 
+
+    return *item;
+}
+
+void *top_stack(obj_stack)
+lsList obj_stack;
+{
+    void *item;
+
+    if (lsLastItem(obj_stack, (lsGeneric*)&item, 0) == LS_NOMORE) {
+	item = NIL(void);
+	return item;
+    }
+
+    return item;
+}
Index: vis_dev/vl2mv-2.3/src/stack/stack.h
===================================================================
--- vis_dev/vl2mv-2.3/src/stack/stack.h	(revision 18)
+++ vis_dev/vl2mv-2.3/src/stack/stack.h	(revision 18)
@@ -0,0 +1,7 @@
+#define stack_t lsList
+
+EXTERN lsList create_stack ARGS(());
+EXTERN void destroy_stack ARGS((lsList, void(*)()));
+EXTERN void push_stack ARGS((lsList, void*));
+EXTERN void *pop_stack ARGS((lsList, void**));
+EXTERN void *top_stack ARGS((lsList));
Index: vis_dev/vl2mv-2.3/src/stack/stack.make
===================================================================
--- vis_dev/vl2mv-2.3/src/stack/stack.make	(revision 18)
+++ vis_dev/vl2mv-2.3/src/stack/stack.make	(revision 18)
@@ -0,0 +1,4 @@
+CSRC += stack.c
+HEADERS += stack.h
+
+DEPENDENCYFILES = $(CSRC)
Index: vis_dev/vl2mv-2.3/vl2mv.1
===================================================================
--- vis_dev/vl2mv-2.3/vl2mv.1	(revision 18)
+++ vis_dev/vl2mv-2.3/vl2mv.1	(revision 18)
@@ -0,0 +1,52 @@
+.\" SCCSID: @(#)verilog.1     8.1     9/11/90
+.TH vl2mv 1
+.SH Name
+vl2mv \- Compile the synthesizable subset of Verilog Programs into BLIF-MV
+.SH Syntax
+.B vl2mv [\fIoptions\fR] filename
+.SH Description
+The
+.B vl2mv
+command compiles programs in the synthesizable subset of Verilog into 
+BLIF-MV. It is not able to handle full set Verilog language now due to 
+its dynamic nature. The output file, if not specified, is inferred by 
+removing everything after the last . and appending mv.
+.SH Options
+.IP \fB\-a\fR 0.3i
+Use .subcircuits/.macros to abstract all behavioral operators. All integers
+and bit vectors are abstracted as symbolic variables and expanded in
+subcircuits using \fI.bundle\fR construct.
+.IP \fB\-A\fR 0.3i
+Send output to \fBstdout\fR.
+.IP \fB\-c\fR 0.3i
+Explicit clocking scheme, clocking wires and auxiliary circuits are 
+generated in resulting BLIF-MV file in order to emulate edge triggerred
+latches and level sensitive latches.
+.IP \fB\-g\fR 0.3i
+Put source debugging information in the BLIF-MV target. All debugging 
+information begins with '##'.
+.IP \fB\-h\fR 0.3i
+Generate HSIS system calls instead of real subcircuits/flattened tables for 
+\fIand\fR, \fInand\fR, \fIor\fR, \fInor\fR, \fIxor\fR, \fIxnor\fR,
+\fIadd\fR, and \fIminus\fR.
+.IP \fB\-m\fR 0.3i
+Use .macro in place of abstracted behavioral operators. This option is 
+effective only when \fB\-a\fR is provided.
+.IP \fB\-o\ \fIfile\fR 0.3i
+Send output to \fIfile.\fR
+.IP \fB\-p\fR 0.3i
+Dump out the internal representations for input programs.
+.IP \fB\-S\fR 0.3i
+Do not use set notation in BLIF-MV.
+In general, set abbreviation notation (=, .default, []) in BLIF-MV can result
+in a more compact target file.
+.IP \fB\-T\ \fIwidth\fR 0.3i
+Decompose tables for nonblocking assignments when number of control
+variables plus that of temporary variables for assignments is greater than
+\fIwidth\fR.
+
+.SH Authors
+Szu-Tsung Cheng, Gary York
+.SH See Also
+For the synthesizable subset of Verilog and how it is compiled into BLIF-MV, 
+please refer to the related documentations and examples.
