diff --git a/alliance/src/mbk/Makefile.am b/alliance/src/mbk/Makefile.am new file mode 100644 index 00000000..20db1515 --- /dev/null +++ b/alliance/src/mbk/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src man1 man3 diff --git a/alliance/src/mbk/Makefile.in b/alliance/src/mbk/Makefile.in new file mode 100644 index 00000000..5ada1382 --- /dev/null +++ b/alliance/src/mbk/Makefile.in @@ -0,0 +1,276 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = .. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +RANLIB = @RANLIB@ +VERSION = @VERSION@ + +SUBDIRS = src man1 man3 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +DIST_COMMON = Makefile.am Makefile.in configure.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign mbk/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. + +@SET_MAKE@ + +all-recursive install-data-recursive install-exec-recursive \ +installdirs-recursive install-recursive uninstall-recursive \ +check-recursive installcheck-recursive info-recursive dvi-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \ + rev="$$subdir $$rev"; \ + test "$$subdir" = "." && dot_seen=yes; \ + done; \ + test "$$dot_seen" = "no" && rev=". $$rev"; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = mbk + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign mbk/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + chmod 777 $(distdir)/$$subdir; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir=../$(top_distdir) distdir=../$(distdir)/$$subdir distdir) \ + || exit 1; \ + fi; \ + done +info-am: +info: info-recursive +dvi-am: +dvi: dvi-recursive +check-am: all-am +check: check-recursive +installcheck-am: +installcheck: installcheck-recursive +install-exec-am: +install-exec: install-exec-recursive + +install-data-am: +install-data: install-data-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-recursive +uninstall-am: +uninstall: uninstall-recursive +all-am: Makefile +all-redirect: all-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: installdirs-recursive +installdirs-am: + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-tags mostlyclean-generic + +mostlyclean: mostlyclean-recursive + +clean-am: clean-tags clean-generic mostlyclean-am + +clean: clean-recursive + +distclean-am: distclean-tags distclean-generic clean-am + +distclean: distclean-recursive + +maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \ + distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-recursive + +.PHONY: install-data-recursive uninstall-data-recursive \ +install-exec-recursive uninstall-exec-recursive installdirs-recursive \ +uninstalldirs-recursive all-recursive check-recursive \ +installcheck-recursive info-recursive dvi-recursive \ +mostlyclean-recursive distclean-recursive clean-recursive \ +maintainer-clean-recursive tags tags-recursive mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir info-am info \ +dvi-am dvi check check-am installcheck-am installcheck install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs-am \ +installdirs mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/alliance/src/mbk/configure.in b/alliance/src/mbk/configure.in new file mode 100644 index 00000000..85037462 --- /dev/null +++ b/alliance/src/mbk/configure.in @@ -0,0 +1,49 @@ +dnl +/* +dnl This file is part of the Alliance CAD System +dnl Copyright (C) Laboratoire LIP6 - Département ASIM +dnl Universite Pierre et Marie Curie +dnl +dnl Home page : http://www-asim.lip6.fr/alliance/ +dnl E-mail support : mailto:alliance-support@asim.lip6.fr +dnl +dnl This library is free software; you can redistribute it and/or modify it +dnl under the terms of the GNU Library General Public License as published +dnl by the Free Software Foundation; either version 2 of the License, or (at +dnl your option) any later version. +dnl +dnl Alliance VLSI CAD System is distributed in the hope that it will be +dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +dnl Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License along +dnl with the GNU C Library; see the file COPYING. If not, write to the Free +dnl Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +dnl +dnl Purpose : Auto stuffing Alliance +dnl Almost ten years since I wrote this stuff, I just can't +dnl believe it +dnl Date : 01/02/2002 +dnl Author : Frederic Petrot +dnl $Id: configure.in,v 1.1 2002/03/08 13:51:00 fred Exp $ +dnl +dnl +AC_INIT(src/mut.h) +AM_INIT_AUTOMAKE(mbk, 4.2) +AC_PROG_INSTALL +AC_PROG_CC +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(fcntl.h malloc.h strings.h sys/time.h unistd.h) +AC_C_CONST +AC_TYPE_SIGNAL +AC_FUNC_VFORK +AC_PROG_RANLIB + +AC_OUTPUT([ +Makefile +src/Makefile +man1/Makefile +man3/Makefile +]) diff --git a/alliance/src/mbk/man1/MBK_CATAL_NAME.1 b/alliance/src/mbk/man1/MBK_CATAL_NAME.1 new file mode 100644 index 00000000..6d44007e --- /dev/null +++ b/alliance/src/mbk/man1/MBK_CATAL_NAME.1 @@ -0,0 +1,54 @@ +.\" $Id: MBK_CATAL_NAME.1,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)MBK_CATAL_NAME.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_CATAL_NAME +.XE \} +.TH MBK_CATAL_NAME 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_CATAL_NAME \- define the mbk catalog file +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_CATAL_NAME file +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_CATAL_NAME\fP sets the name of the catalog file, that contains +information about the cells of a design. The catalog file syntax is a cellname, +plus a flag. The cellname may appear many times with a different flag. +.TP +Three flags are available: + C : tells the flatten functions to stop a this level. +.br + G : informs the user that this is a phantom cell. +.br + F : says that this is a feed through. +.br +The seaching mecanism first look in \fBMBK_WORK_LIB\fP(1), and then +in \fBMBK_CATA_LIB\fP(1). So it is recommended to have a catalog file in +the \fBMBK_WORK_LIB\fP(1). +.br +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_CATAL_NAME catalog +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_CATA_LIB.1 b/alliance/src/mbk/man1/MBK_CATA_LIB.1 new file mode 100644 index 00000000..b1cd08da --- /dev/null +++ b/alliance/src/mbk/man1/MBK_CATA_LIB.1 @@ -0,0 +1,63 @@ +.\" $Id: MBK_CATA_LIB.1,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)MBK_CATA_LIB.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_CATA_LIB +.XE \} +.TH MBK_CATA_LIB 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_CATA_LIB \- define the mbk catalog directory +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_CATA_LIB path1:path2:path3:...:...:pathn +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_CATA_LIB\fP sets the directories that are to be searched thru for +reading. When instanciating a cell for example, the first cell that is found +with the given name is loaded in memory. +.br +The seaching mecanism first look in +\fBMBK_WORK_LIB\fP(1), and then, in path1 thru pathn, in the order defined by the +user when typing the setenv command. +This directories are considered to be, from a mbk point of view, read only. +.br +The pathi arguments must be actually accessible pathes on your host machine. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"mbk_fopen : can't open file 'unix_path/file.xx' thru directories : path1, ..., pathn" +.ft R +.RS +This occurs when either the unix path is irrelevent, or when the file doesn't +exist. This can also be a unix right problem if the file is not accessible for +reading, but this is seldom. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_CATA_LIB ~fred/crechan/uom:/labo/sclib +.ft R +.fi +.SH DIAGNOSTICS +Only the first path may be given with a '~', since the shell extents it only +when seen first. +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR MBK_WORK_LIB (1). + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_FILTER_SFX.1 b/alliance/src/mbk/man1/MBK_FILTER_SFX.1 new file mode 100644 index 00000000..13f1cb2c --- /dev/null +++ b/alliance/src/mbk/man1/MBK_FILTER_SFX.1 @@ -0,0 +1,33 @@ +.\" $Id: MBK_FILTER_SFX.1,v 1.1 2002/03/08 13:51:04 fred Exp $ + +.TH MBK_FILTER_SFX 1 "October 1, 1999" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" + +.SH NAME +MBK_FILTER_SFX \- define the input\/output filter suffixe. + +.so man1/alc_origin.1 + +.SH DESCRIPTION +\fBMBK_FILTER_SFX\fP tells to Alliance the extention set by compression tools. +This variable must be set in order to activate filters. Note the leading points +of extention must be set if necessary. + +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +For compressed files with gzip : + setenv MBK_FILTER_SFX ".gz" +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR MBK_IN_FILTER (1), +.BR MBK_OUT_FILTER (1), +.BR mbkenv (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_IN_FILTER.1 b/alliance/src/mbk/man1/MBK_IN_FILTER.1 new file mode 100644 index 00000000..184d9739 --- /dev/null +++ b/alliance/src/mbk/man1/MBK_IN_FILTER.1 @@ -0,0 +1,39 @@ +.\" $Id: MBK_IN_FILTER.1,v 1.1 2002/03/08 13:51:04 fred Exp $ + +.TH MBK_IN_FILTER 1 "October 1, 1999" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" + +.SH NAME +MBK_IN_FILTER \- define the input filter + +.so man1/alc_origin.1 + +.SH DESCRIPTION +\fBMBK_IN_FILTER\fP set the input filter for reading compressed Alliance files. +Filter is typically a string containing filename and options. This filter +must read compressed data flow on it standard input and write non compressed +data flow on it standard output. Files are taken in the first directory where +they are found according to the environment variable \fbMBK_CATA_LIB\fb. If a +file compressed version and a file non compressed version exist booth in the +same directory, the non compressed is opended, and a warning message is +supllyed. To activate filters, variable \fbMBK_FILTER_SFX\fb must be set. + +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +Opening compressed files with gzip : + setenv MBK_IN_FILTER "/asim/gnu/bin/gunzip -c" + setenv MBK_FILTER_SFX ".gz" +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR MBK_FILTER_SFX (1), +.BR MBK_OUT_FILTER (1), +.BR mbkenv (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_IN_LO.1 b/alliance/src/mbk/man1/MBK_IN_LO.1 new file mode 100644 index 00000000..2f9051ce --- /dev/null +++ b/alliance/src/mbk/man1/MBK_IN_LO.1 @@ -0,0 +1,64 @@ +.\" $Id: MBK_IN_LO.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_IN_LO.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_IN_LO +.XE \} +.TH MBK_IN_LO 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_IN_LO \- define the logical input format of mbk and genlib +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_IN_LO format +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_IN_LO\fP sets the logical input format of the mbk database. The database +will be filled with informations found in the given format file. +.TP +valid formats are : +\- \fBal\fP, \fBalx\fP, that are alliance logical formats +.br +\- \fBedi\fP, that is edif standart netlist format +.br +\- \fBhns\fP, \fBfns\fP, \fBfne\fP, \fBfdn\fP, \fBhdn\fP, that are vti logical +formats +.br +\- \fBspi\fP, that's spice netlist +.br +\- \fBvst\fP, that structural vhdl description +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"MBK_IN_LO : 'xxx' unknown format" +.ft R +.RS +The argument given to the setenv is not a legal logical input format for mbk. +You must changed it before any other action. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_IN_LO al +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR MBK_OUT_LO (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_IN_PH.1 b/alliance/src/mbk/man1/MBK_IN_PH.1 new file mode 100644 index 00000000..318ec02a --- /dev/null +++ b/alliance/src/mbk/man1/MBK_IN_PH.1 @@ -0,0 +1,58 @@ +.\" $Id: MBK_IN_PH.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_IN_PH.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_IN_PH +.XE \} +.TH MBK_IN_PH 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_IN_PH \- define the physical input format of mbk and genlib +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_IN_PH format +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_IN_PH\fP sets the physical input format of the mbk data structure. +The data structure will be filled with informations found in the given format +file. +.TP +valid formats are : +\- \fBap\fP, alliance physical format +.br +\- \fBcp\fP, vti physical format +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"MBK_IN_PH : 'xxx' unknown format" +.ft R +.RS +The argument given to the setenv is not a legal physical input format for mbk. +You must changed it before any other action. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_IN_PH al +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR MBK_OUT_PH (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_OUT_FILTER.1 b/alliance/src/mbk/man1/MBK_OUT_FILTER.1 new file mode 100644 index 00000000..76d4092e --- /dev/null +++ b/alliance/src/mbk/man1/MBK_OUT_FILTER.1 @@ -0,0 +1,39 @@ +.\" $Id: MBK_OUT_FILTER.1,v 1.1 2002/03/08 13:51:05 fred Exp $ + +.TH MBK_OUT_FILTER 1 "October 1, 1999" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" + +.SH NAME +MBK_OUT_FILTER \- define the input filter + +.so man1/alc_origin.1 + +.SH DESCRIPTION +\fBMBK_OUT_FILTER\fP sets the output filter for writting compressed Alliance +files. Filter is typically a string containing filename and options. This filter +must read non compressed data flow on it standard input and write compressed +data flow on it standard output. If a non compressed version of a file exist in +the same target directory the designer want the save a file's compressed +version, to ensure that file will be read later and not the non compressed one, +the non compressed file is DELETED. To activate filters, variable +MBK_FILTER_SFX must be set. + +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +Writing compressed files with gzip : + setenv MBK_OUT_FILTER "/asim/gnu/bin/gzip -c" + setenv MBK_FILTER_SFX ".gz" +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR MBK_FILTER_SFX (1), +.BR MBK_IN_FILTER (1), +.BR mbkenv (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_OUT_LO.1 b/alliance/src/mbk/man1/MBK_OUT_LO.1 new file mode 100644 index 00000000..9a3c6433 --- /dev/null +++ b/alliance/src/mbk/man1/MBK_OUT_LO.1 @@ -0,0 +1,70 @@ +.\" $Id: MBK_OUT_LO.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_OUT_LO.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_OUT_LO +.XE \} +.TH MBK_OUT_LO 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_OUT_LO \- define the logical output format of mbk and genlib +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_OUT_LO format +.ft R +.fi +.so man1/alc_origin.1 +.SH PARAMETERS +.TP 20 +\fIparam\fP +pwet +.SH DESCRIPTION +\fBMBK_OUT_LO\fP sets the logical output format of the mbk data structure. +The files resulting of the work on mbk will have the given format. +.TP +valid formats are : +\- \fBal\fP, \fBalx\fP, that are alliance logical formats +.br +\- \fBcct\fP, that is genrad hilo netlist format +.br +\- \fBedi\fP, that is edif standart netlist format +.br +\- \fBhns\fP, \fBfns\fP, \fBfne\fP, \fBfdn\fP, \fBhdn\fP, that are vti logical +formats +.br +\- \fBspi\fP, that's spice netlist +.br +\- \fBvst\fP, that is structural vhdl description +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"MBK_OUT_LO : 'xxx' unknown format" +.ft R +.RS +The argument given to the setenv is not a legal logical output format for mbk. +You must changed it before any other action. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_OUT_LO al +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR MBK_IN_LO (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_OUT_PH.1 b/alliance/src/mbk/man1/MBK_OUT_PH.1 new file mode 100644 index 00000000..74898513 --- /dev/null +++ b/alliance/src/mbk/man1/MBK_OUT_PH.1 @@ -0,0 +1,57 @@ +.\" $Id: MBK_OUT_PH.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_OUT_PH.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_OUT_PH +.XE \} +.TH MBK_OUT_PH 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_OUT_PH \- define the physical output format of mbk and genlib +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_OUT_PH format +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_OUT_PH\fP sets the physical output format of the mbk data structure. +The files resulting of the work on mbk will have the given format. +.TP +valid formats are : +\- \fBap\fP, for alliance physical output +.br +\- \fBcp\fP, in order to obtain a vti physical file +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"MBK_OUT_PH : 'xxx' unknown format" +.ft R +.RS +The argument given to the setenv is not a legal physical output format for mbk. +You must changed it before any other action. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_OUT_PH al +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR MBK_IN_PH (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_SEPAR.1 b/alliance/src/mbk/man1/MBK_SEPAR.1 new file mode 100644 index 00000000..57c24257 --- /dev/null +++ b/alliance/src/mbk/man1/MBK_SEPAR.1 @@ -0,0 +1,43 @@ +.\" $Id: MBK_SEPAR.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_SEPAR.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_SEPAR +.XE \} +.TH MBK_SEPAR 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_SEPAR \- define the separator character for hierarchy +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_SEPAR character +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_SEPAR\fP sets the character that is to be used while concatening +names, during a flatten, for example. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_SEPAR / +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR concatname (3), +.BR nameindex (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_TRACE_GETENV.1 b/alliance/src/mbk/man1/MBK_TRACE_GETENV.1 new file mode 100644 index 00000000..72a6d9ab --- /dev/null +++ b/alliance/src/mbk/man1/MBK_TRACE_GETENV.1 @@ -0,0 +1,30 @@ +.\" Alliance man +.\" Author: Czo +.\" $Id: MBK_TRACE_GETENV.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.TH MBK_TRACE_GETENV 1 "$Date: 2002/03/08 13:51:05 $" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +\fBMBK_TRACE_GETENV\fP \- defines getenv() debug output + +.so man1/alc_origin.1 + +.SH SYNOPSIS +.TP +.TP +Bourne Shell : \fBMBK_TRACE_GETENV\fR=\fIyes\fR; export MBK_TRACE_GETENV +.TP +C-shell : sentenv \f4MBK_TRACE_GETENV\fR \fIyes\fR + +.SH DESCRIPTION +If \fBMBK_TRACE_GETENV\fR is set to "yes", all alliance tools will print debug info to stdout each time a getenv() syscall is done. + +.SH OUTPUT EXAMPLE +.RS +\f4--- mbk --- mbkgetenv VH_PATSFX : pat\fR + +.SH SEE ALSO +.PP +.BR mbk(1) +.BR mbkgetenv(3). + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_VDD.1 b/alliance/src/mbk/man1/MBK_VDD.1 new file mode 100644 index 00000000..009b1d75 --- /dev/null +++ b/alliance/src/mbk/man1/MBK_VDD.1 @@ -0,0 +1,46 @@ +.\" $Id: MBK_VDD.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_VDD.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_VDD +.XE \} +.TH MBK_VDD 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_VDD \- define the high level power name pattern +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_VDD powername +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_VDD\fP sets the pattern to be matched in a name to indicate a power +supply for the tools based upon \fBmbk\fP. +Its default value is \fBvdd\fP. +Therefore all names of the form `*\fBvdd\fP*' indicates a power supply. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_VDD vcc +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR isvdd (3), +.BR isvss (3), +.BR MBK_VSS (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_VSS.1 b/alliance/src/mbk/man1/MBK_VSS.1 new file mode 100644 index 00000000..9514da3a --- /dev/null +++ b/alliance/src/mbk/man1/MBK_VSS.1 @@ -0,0 +1,46 @@ +.\" $Id: MBK_VSS.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_VSS.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_VSS +.XE \} +.TH MBK_VSS 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_VSS \- define the ground power name pattern +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_VSS groundname +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_VSS\fP sets the pattern to be matched in a name to indicate a +ground node for the tools based upon +Its default value is \fBvss\fP. +Therefore all names of the form `*\fBvss\fP*' in indicates a ground node. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_VSS gnd +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR isvss (3), +.BR isvdd (3), +.BR MBK_VDD (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/MBK_WORK_LIB.1 b/alliance/src/mbk/man1/MBK_WORK_LIB.1 new file mode 100644 index 00000000..2acdb735 --- /dev/null +++ b/alliance/src/mbk/man1/MBK_WORK_LIB.1 @@ -0,0 +1,60 @@ +.\" $Id: MBK_WORK_LIB.1,v 1.1 2002/03/08 13:51:05 fred Exp $ +.\" @(#)MBK_WORK_LIB.8 2.11 91/08/22; Labo Cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +MBK_WORK_LIB +.XE \} +.TH MBK_WORK_LIB 1 "October 1, 1997" "ASIM/LIP6" "MBK ENVIRONMENT VARIABLES" +.SH NAME +MBK_WORK_LIB \- define the mbk working directory +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +c-shell running +setenv MBK_WORK_LIB unix path +.ft R +.fi +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBMBK_WORK_LIB\fP sets the directory where are saved the results of an +invocation of mbk or genlib. This directory is considered to be, from an +mbk point of view, read and write. +.br +Also, when a file is searched for +reading, the first directory to be looked at is the \fBMBK_WORK_LIB\fP, and then +the one defined in \fBMBK_CATA_LIB\fP(1). +.br +The unix path argument must be a actually accessible path on your host machine. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"mbk_fopen : can't open file 'unix_path/file.xx'" +.ft R +.RS +This occurs when either the unix path is irrelevent, or when the file doesn't +exist if it is open for reading, or when you don't have the right on the file +or directory while trying to write it. +.SH EXAMPLE +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + setenv MBK_WORK_LIB ~fred/crechan/uom +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR MBK_CATA_LIB (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man1/Makefile.am b/alliance/src/mbk/man1/Makefile.am new file mode 100644 index 00000000..db9b29d1 --- /dev/null +++ b/alliance/src/mbk/man1/Makefile.am @@ -0,0 +1,14 @@ +man_MANS = MBK_CATAL_NAME.1 \ + MBK_CATA_LIB.1 \ + MBK_FILTER_SFX.1 \ + MBK_IN_FILTER.1 \ + MBK_IN_LO.1 \ + MBK_IN_PH.1 \ + MBK_OUT_FILTER.1 \ + MBK_OUT_LO.1 \ + MBK_OUT_PH.1 \ + MBK_SEPAR.1 \ + MBK_TRACE_GETENV.1 \ + MBK_VDD.1 \ + MBK_VSS.1 \ + MBK_WORK_LIB.1 diff --git a/alliance/src/mbk/man3/Makefile.am b/alliance/src/mbk/man3/Makefile.am new file mode 100644 index 00000000..6b4829ea --- /dev/null +++ b/alliance/src/mbk/man3/Makefile.am @@ -0,0 +1,133 @@ +man_MANS = addcapa.3 \ + addchain.3 \ + addht.3 \ + addhtitem.3 \ + addlocon.3 \ + addlofig.3 \ + addloins.3 \ + addlomodel.3 \ + addlosig.3 \ + addlotrs.3 \ + addnum.3 \ + addphcon.3 \ + addphfig.3 \ + addphins.3 \ + addphref.3 \ + addphseg.3 \ + addphvia.3 \ + addptype.3 \ + alliancebanner.3 \ + append.3 \ + bigvia.3 \ + chain.3 \ + checkloconorder.3 \ + concatname.3 \ + defab.3 \ + delchain.3 \ + delht.3 \ + delhtitem.3 \ + dellocon.3 \ + dellofig.3 \ + delloins.3 \ + dellosig.3 \ + dellotrs.3 \ + delnum.3 \ + delphcon.3 \ + delphfig.3 \ + delphins.3 \ + delphref.3 \ + delphseg.3 \ + delphvia.3 \ + delptype.3 \ + downstr.3 \ + filepath.3 \ + flattenlofig.3 \ + flattenphfig.3 \ + freechain.3 \ + freelomodel.3 \ + freenum.3 \ + freeptype.3 \ + gethtitem.3 \ + getlocon.3 \ + getlofig.3 \ + getloins.3 \ + getlomodel.3 \ + getlosig.3 \ + getphcon.3 \ + getphfig.3 \ + getphins.3 \ + getphref.3 \ + getptype.3 \ + getsigname.3 \ + givelosig.3 \ + guessextdir.3 \ + incatalog.3 \ + incatalogdelete.3 \ + incatalogfeed.3 \ + incataloggds.3 \ + instanceface.3 \ + instr.3 \ + isvdd.3 \ + isvss.3 \ + libpat.3 \ + loadlofig.3 \ + loadphfig.3 \ + locon.3 \ + lofig.3 \ + lofigchain.3 \ + log.3 \ + loins.3 \ + losig.3 \ + lotrs.3 \ + mbk.3 \ + mbkalloc.3 \ + mbkenv.3 \ + mbkfopen.3 \ + mbkfree.3 \ + mbkgetenv.3 \ + mbkps.3 \ + mbkrealloc.3 \ + mbksetautoackchld.3 \ + mbkunlink.3 \ + mbkwaitpid.3 \ + mlodebug.3 \ + mphdebug.3 \ + namealloc.3 \ + namefind.3 \ + nameindex.3 \ + naturalstrcmp.3 \ + phcon.3 \ + phfig.3 \ + phins.3 \ + phref.3 \ + phseg.3 \ + phvia.3 \ + ptype.3 \ + restorealldir.3 \ + restoredirvbe.3 \ + reverse.3 \ + rflattenlofig.3 \ + rflattenphfig.3 \ + savelofig.3 \ + savephfig.3 \ + sethtitem.3 \ + sortlocon.3 \ + sortlosig.3 \ + unflattenlofig.3 \ + upstr.3 \ + viewht.3 \ + viewlo.3 \ + viewlofig.3 \ + viewlofigcon.3 \ + viewloins.3 \ + viewloinscon.3 \ + viewlosig.3 \ + viewlotrs.3 \ + viewph.3 \ + viewphcon.3 \ + viewphfig.3 \ + viewphins.3 \ + viewphref.3 \ + viewphseg.3 \ + viewphvia.3 \ + xyflat.3 diff --git a/alliance/src/mbk/man3/addcapa.3 b/alliance/src/mbk/man3/addcapa.3 new file mode 100644 index 00000000..9b022745 --- /dev/null +++ b/alliance/src/mbk/man3/addcapa.3 @@ -0,0 +1,57 @@ +.\" $Id: addcapa.3,v 1.1 2002/03/08 13:51:00 fred Exp $ +.\" @(#)addcapa.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addcapa +.XE \} +.TH ADDCAPA 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +addcapa \- add a capacitance to a signal +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void addcapa(ptsig, ctot) +losig_list \(**ptsig; +float ctot; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the signal in which the capacitance should be added +.TP +\fIctot\fP +Total capacitance +.SH DESCRIPTION +\fBaddcapa\fP add the \fIcapa\fP value to \fIptsig\->CAPA\fP. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void more_capa(pt, i, c) +lofig_list \(**pt; +long i; +float c; +{ + addcapa(getlosig(pt, i), c); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR losig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addchain.3 b/alliance/src/mbk/man3/addchain.3 new file mode 100644 index 00000000..09543ffe --- /dev/null +++ b/alliance/src/mbk/man3/addchain.3 @@ -0,0 +1,80 @@ +.\" $Id: addchain.3,v 1.1 2002/03/08 13:51:00 fred Exp $ +.\" @(#)addchain.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addchain +.XE +.XS4 \n% +.ti 0.2i +addchain +.XE4 \} +.TH ADDCHAIN 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +addchain \- create a \fBchain\fP and add it to a list +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +chain_list \(**addchain(pthead, ptdata) +chain_list \(**pthead; +void \(**ptdata; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpthead\fP +Pointer to a \fBchain_list\fP +.TP +\fIptdata\fP +Generic pointer to any kind of information +.SH DESCRIPTION +\fBaddchain\fP creates a new \fBchain\fP element and adds it to the +front of the list pointed to by \fIpthead\fP, and becomes itself the list head. +.br +The \fBchain_list\fPs are mosty used to create temporary lists of homogeneous +elements, for binary trees, and so on. +.br +The \fIptdata\fP points to any kind of list or may itself be a value, if proper +cast is performed at compilation time, and fills the \fIDATA\fP field of the +\fBchain\fP structure. +For details on the structure, see \fBchain\fR(3). +.SH RETURN VALUE +\fBaddchain\fP returns a pointer to the new head of list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +chain_list \(**get_external_connectors(ptfig) +lofig_list \(**ptfig; +{ +locon_list \(**pt = ptfig\->LOCON; +chain_list \(**c = NULL; /\(** initialized for regularity \(**/ + while (pt) { + if (pt\->TYPE == EXTERNAL) + c = addchain(c, (void \(**)pt) + pt = pt\->NEXT; + } + return c; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR chain (3), +.BR freechain (3), +.BR delchain (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addht.3 b/alliance/src/mbk/man3/addht.3 new file mode 100644 index 00000000..5ad06796 --- /dev/null +++ b/alliance/src/mbk/man3/addht.3 @@ -0,0 +1,81 @@ +.\" $Id: addht.3,v 1.1 2002/03/08 13:51:00 fred Exp $ +.\" @(#)addht.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun +.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92 +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addht +.XE +.XS4 \n% +.ti 0.2i +addht +.XE4 \} +.TH ADDHT 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS" +.SH NAME +addht \- create an hash table +.so man1/alc_origin.1 +.SH SYNOPSYS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +ht \(**addht(len) +unsigned int len; +.fi +.ft R +.SH PARAMETER +.TP 20 +\fIlen\fP +Number of entries in the hash table +.SH DESCRIPTION +\fBaddht()\fP creates a new hash table in memory. +\fIlen\fP is an estimate of the maximum number of entries that the +table will contain. +This number may be automatically adjusted when using access functions +by a dynamic reallocation, in order to warranty fast access time. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +ht \(**sigHtable(ptfig) /\(** h table suitable for signals \(**/ +lofig_list \(**ptfig; +{ +losig_list \(**ptsig = ptfig->LOSIG; +unsigned int i = 0; + while (ptsig) { + i++; + ptsig = ptsig->NEXT; + } + return addht(i); +} +.ft R +.fi +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addht : \fIlen\fP is '0'" +.ft R +.RS +The hash table size cannot be zero, guess why! +.RE +.SH SEE ALSO +.BR mbk (1), +.BR delht (3), +.BR addhtitem (3), +.BR gethtitem (3), +.BR sethtitem (3), +.BR delhtitem (3), +.BR viewht (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addhtitem.3 b/alliance/src/mbk/man3/addhtitem.3 new file mode 100644 index 00000000..7d64bf72 --- /dev/null +++ b/alliance/src/mbk/man3/addhtitem.3 @@ -0,0 +1,91 @@ +.\" $Id: addhtitem.3,v 1.1 2002/03/08 13:51:00 fred Exp $ +.\" @(#)addhtitem.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun +.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92 +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addhtitem +.XE +.XS4 \n% +.ti 0.2i +addhtitem +.XE4 \} +.TH ADDHTITEM 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS" +.SH NAME +addhtitem \- adds a new item in a hash table. +.so man1/alc_origin.1 +.SH SYNOPSYS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +void addhtitem(table, key, value) +ht \(**table; +void \(**key; +int value; +.fi +.ft R +.SH PARAMETERS +.TP 20 +\fItable\fP +Hash table pointer +.TP 20 +\fIkey\fP +Key used by the hash coding function to add the item +.TP 20 +\fIvalue\fP +Value associated with the key +.SH DESCRIPTION +\fBaddhtitem()\fP adds a new item in the hash table pointed to by \fItable\fP. +If the key already exists, the old value is changed to the new one. +\fIValue\fP must be distinct from \fBEMPTYHT\fP and \fBDELETEHT\fP. +The length of the table increases automatically when the length given +in \fBaddht()\fP leads to a performance shut down. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +#include "mlo.h" +void conHenter(h, ptfig) +ht \(**h; +lofig_list \(**ptfig; +{ +locon_list \(**ptcon; + /\(** since connector names are unique, add them without check \(**/ + for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT) + addhtitem(h, ptcon->NAME, 0); +} +.fi +.ft R +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addhtitem impossible : +value is \fBEMPTYHT\fP or \fBDELETEHT\fP" +.ft R +.RS +The values \fBEMPTYHT\fP, \fI-1\fP, and \fBDELETEHT\fP, \fI-2\fP, +are reserved for internal use, sorry. +.SH DIAGNOSTICS +The value must be distinct from \fI-1\fP and \fI-2\fP. +.SH SEE ALSO +.BR mbk (1), +.BR addht (3), +.BR delht (3), +.BR gethtitem (3), +.BR sethtitem (3), +.BR delhtitem (3), +.BR viewht (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addlocon.3 b/alliance/src/mbk/man3/addlocon.3 new file mode 100644 index 00000000..4f78070f --- /dev/null +++ b/alliance/src/mbk/man3/addlocon.3 @@ -0,0 +1,111 @@ +.\" $Id: addlocon.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addlocon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addlocon +.XE +.XS2 \n% +.ti 0.2i +addlocon +.XE2 \} +.TH ADDLOCON 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +addlocon \- create a logical connector +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +locon_list \(**addlocon(ptfig, name, ptsig, dir) +lofig_list \(**ptfig; +char \(**name; +losig_list \(**ptsig; +char dir; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the connector should be added +.TP +\fIname\fP +Name of the connector +.TP +\fIptsig\fP +Pointer on the signal linked to the connector +.TP +\fIdir\fP +Connector direction type +.SH DESCRIPTION +\fBaddlocon\fP creates a new figure connector called \fIname\fP and adds it +to the list of connectors pointed to by \fIptfig\->LOCON\fP. +The new connector is added in front of the list, and becomes itself the +list head. +.br +The parameters \fIname\fP, \fIptsig\fP, \fIdir\fP, +\fIwidth\fP fill respectivly the \fINAME\fP, \fISIG\fP and \fIDIR\fP +fields of the \fIlocon\fP structure. The name should be unique at a given +hierarchical level since it's the connector identifier. +.br +The field \fITYPE\fP is set to \fBEXTERNAL\fP since a cell connector is +beeing created. The instance connectors are builded up by the \fBaddloins\fP(3) +call. See \fBaddloins\fP(3) for details. +For a list of valid \fIdir\fP, see \fBlocon\fR(3). +.SH RETURN VALUE +\fBaddlocon\fP returns a pointer to the newly created connector. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addlocon impossible : +connector \fIname\fP already exists in figure \fIptfig\->NAME\fP" +.ft R +.RS +The \fIname\fP beeing the logical connector idenfier, two connectors may not +have the same name in a given figure. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addlocon impossible : +bad direction \fIdir\fP in \fIfigure ptfig\->NAME\fP" +.ft R +.RS +The \fIdir\fP does not have a legal value. For the set of legal values, see +\fIlocon\fP(3). +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +locon_list \(**du_con(ptfig, ptcon) /\(** duplicate connector \(**/ +lofig_list \(**ptfig; +locon_list \(**ptcon; +{ + return addlocon(ptfig, ptcon\->NAME, ptcon\->SIG, ptcon\->DIR); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR locon (3), +.BR loins (3), +.BR lofig (3), +.BR getlocon (3), +.BR dellocon (3), +.BR phcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addlofig.3 b/alliance/src/mbk/man3/addlofig.3 new file mode 100644 index 00000000..aa4706cd --- /dev/null +++ b/alliance/src/mbk/man3/addlofig.3 @@ -0,0 +1,90 @@ +.\" $Id: addlofig.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addlofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addlofig +.XE +.XS2 \n% +.ti 0.2i +addlofig +.XE2 \} +.TH ADDLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +addlofig \- create a new structural cell model +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +lofig_list \(**addlofig(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the figure to be created +.SH DESCRIPTION +\fBaddlofig\fP creates a new figure called \fIfigname\fP and adds it to the +list of figure in memory. The new figure is added in front of the list, and +becomes itself the list head. No check is performed to see if a figure with +the \fIfigname\fP exists on disk. If it is the case, the preexisting file will +be erased while saving. +.br +The fields \fILOCON\fP, \fILOINS\fP, \fILOSIG\fP, \fIBKSIG\fP, \fILOPAR\fP +\fILOTRS\fP and \fIUSER\fP are set to \fBNULL\fP. +.br +The field \fIMODE\fP is set to \fB'A'\fP. +.br +The field \fINEXT\fP points to the previous head of list. +.SH RETURN VALUE +\fBaddlofig\fP returns a pointer to the newly created figure. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addlofig figure \fIfigname\fP already exists" +.ft R +.RS +There is already a logical figure called \fIfigname\fP in memory, so it's +impossible to give this name to a cell to be created. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +lofig_list \(**get_the_fig(name) +char \(**name; +{ +lofig_list \(**pt, \(**fill_fig(/\(** lofig_list \(** \(**/); + /\(** scan figure list \(**/ + for (pt = HEAD_LOFIG; pt; pt = pt\->NEXT) + if (!strcmp(pt\->NAME, figname)) + break; + return pt ? pt : fill_fig(addlofig(figname)); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR getlofig (3), +.BR dellofig (3), +.BR loadlofig (3), +.BR savelofig (3), +.BR flattenlofig (3), +.BR rflattenlofig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addloins.3 b/alliance/src/mbk/man3/addloins.3 new file mode 100644 index 00000000..2a4c3e83 --- /dev/null +++ b/alliance/src/mbk/man3/addloins.3 @@ -0,0 +1,136 @@ +.\" $Id: addloins.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addloins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addloins +.XE +.XS2 \n% +.ti 0.2i +addloins +.XE2 \} +.TH ADDLOINS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +addloins \- create a logical instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +loins_list \(**addloins(ptfig, insname, ptmodel, sigchain) +lofig_list \(**ptfig; +char \(**insname; +lofig_list \(**ptmodel; +chain_list \(**sigchain; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the instance should be added +.TP +\fIinsname\fP +Instance name +.TP +\fIptmodel\fP +Pointer to the instance model +.TP +\fIsigchain\fP +Pointer to chain list of signal pointers +.SH DESCRIPTION +\fBaddloins\fP creates a new instance, and adds it to the +list of instances pointed to by \fIptfig\->LOINS\fP. The new instance is +added in front of the list, and becomes itself the list head. +.br +The parameter \fIinsname\fP fills the \fIINSNAME\fP field of the \fIloins\fP +structure. +.br +The \fIptmodel\fP is used for two purposes. First, the \fIptmodel\->NAME\fP +fills the \fIFIGNAME\fP field. Second, the connectors of the figure pointed +to by \fIptmodel\fP are duplicated in the \fILOCON\fP field, but the signals +linked to each connector are the one given in the \fIsigchain\fP argument. See +\fBchain\fP(3) for details on \fBchain_list\fPs. +.br +The matching is done in order, it means that the first connector is linked +to the first signal of the \fIsigchain\fP, and so on. Care must be taken when +instanciating in order to warranty the validity of the netlist. +For details on the structure, see \fBloins\fR(3). +.SH RETURN VALUE +\fBaddloins\fP returns a pointer to the newly created instance. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addloins impossible : instance \fIinsname\fP already +exist in figure \fIptfig\->NAME\fP" +.ft R +.RS +The \fIinsname\fP is the instance identifier. So it must be unique at a given +hierarchy level. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addloins impossible : instance model is the +figure \fIfigname\fP itself" +.ft R +.RS +The model of the instance has the same name that the figure where the +instantiation takes place. This check is only performed for a single hierarchy +level, in terms of its instances. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addloins impossible : connector number discrepancy +between figure \fIptmodel\->NAME\fP and instance \fIinsname\fP +in figure \fIptfig\->NAME\fP" +.ft R +.RS +The number of signals in the \fIsigchain\fP is not equal to the number of +connectors of the model. The matching is not done correctly. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void add_na2_y(pt, in1, in2, out) /\(** add an instance of na2_y \(**/ +lofig_list \(**pt; /\(** pointer to the figure \(**/ +long in1, in2, out; /\(** signals indexes \(**/ +{ +chain_list \(**signal = NULL; + /\(** get the pointer when signal index is known \(**/ + signal = addchain(signal, (void \(**)givelosig(pt, in1)); + signal = addchain(signal, (void \(**)givelosig(pt, in2)); + signal = addchain(signal, (void \(**)givelosig(pt, out)); + /\(** get vdd and vss \(**/ + signal = addchain(signal, (void \(**)give_vdd(pt)); + signal = addchain(signal, (void \(**)give_vss(pt)); + /\(** reverse the list \(**/ + signal = reverse(signal); + addloins(pt, "nand", getlofig("na2_y"), signal); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR loins (3), +.BR chain (3), +.BR getloins (3), +.BR delloins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addlomodel.3 b/alliance/src/mbk/man3/addlomodel.3 new file mode 100644 index 00000000..70e00fe0 --- /dev/null +++ b/alliance/src/mbk/man3/addlomodel.3 @@ -0,0 +1,83 @@ +.\" $Id: addlomodel.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addlomodel.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addlomodel +.XE +.XS2 \n% +.ti 0.2i +addlomodel +.XE2 \} +.TH ADDLOMODEL 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +addlomodel \- create a tempotary logical model and add it to a list +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +lofig_list \(**addlomodel(model, name) +lofig_list \(**model; +char \(**name; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fImodel\fP +Pointer to the head of a model list +.TP +\fIname\fP +Name of the model to be created +.SH DESCRIPTION +\fBaddlomodel\fP creates a new \fBlofig_list\fP element and adds it to the +front of the list pointed to by \fImodel\fP, and becomes itself the list head. +.br +The \fBaddlomodel\fP function is mosty used to create a temporary list of +\fBlofig\fP in order to represent the "in file" instances' models. +In fact, all the file format used with mbk have the notion of models local to +files, so they are not figure, but are temporarly used to create instance +connectors, for example. +For details on the structure, see \fBlofig\fR(3). +.SH RETURN VALUE +\fBaddlomodel\fP returns a pointer to the new head of model list. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addlomodel impossible : model \fIname\fP already exists" +.ft R +.RS +The model, not the figure, is already present in the model list pointed to by +\fImodel\fP, and since a model should be unique, this can't be. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +void add_model(name) +char \(**name; +{ + MODEL = addlomodel(MODEL, name); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR getlomodel (3), +.BR freelomodel (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addlosig.3 b/alliance/src/mbk/man3/addlosig.3 new file mode 100644 index 00000000..71cc66e5 --- /dev/null +++ b/alliance/src/mbk/man3/addlosig.3 @@ -0,0 +1,118 @@ +.\" $Id: addlosig.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addlosig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addlosig +.XE +.XS2 \n% +.ti 0.2i +addlosig +.XE2 \} +.TH ADDLOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +addlosig \- create a logical signal +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +losig_list \(**addlosig(ptfig, index, namechain, type) +lofig_list \(**ptfig; +long index; +chain_list \(**namechain; +char type; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the signal should be added +.TP +\fIindex\fP +Signal index +.TP +\fInamechain\fP +List of names of the signal +.TP +\fItype\fP +Signal type +.SH DESCRIPTION +\fBaddlosig\fP creates a new signal, and adds it to the +list of signals pointed to by \fIptfig\->LOSIG\fP. The new signal is +added in front of the list, and becomes itself the list head. +.br +The \fItype\fP parameter can take two values : +.RS +.TP 20 +\fBEXTERNAL\fP +The signal is attached to at least one connector of the figure. +.TP +\fBINTERNAL\fP +The signal is only attached to instance or transistor connector. +.RE +The \fIindex\fP and \fItype\fP arguments fill the \fIINDEX\fP and +\fITYPE\fP fields of the \fBlosig\fP(3) structure. The index +is the signal identifier, so it should be unique at a given hierarchical level. +.br +The \fInamechain\fP argument is a list of names, given in a \fBchain_list\fP. +See \fBchain\fP(3) for details. +.SH RETURN VALUE +\fBaddlosig\fP returns a pointer to the newly created signal. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addlosig impossible signal \fIindex\fP already exist +in figure \fIptfig\->NAME\fP" +.ft R +.RS +The \fIindex\fP is already used in an other signal, and since it's the signal +identifier, it can't be. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +losig_list \(**merge_and_create(pt, s0, s1) /\(** merge two signal in a third \(**/ +lofig_list \(**pt; +losig_list \(**s0, \(**s1; +{ +chain_list \(**c; +losig_list \(**s; +long max_index; + /\(** merge names \(**/ + for (c = s0\->NAMECHAIN; c; c = c\->NEXT) + s1\->NAMECHAIN = addchain(s1\->NAMECHAIN, c); + /\(** find maximum index \(**/ + for (s = pt\->LOSIG; s; s = s\->NEXT) + if (max_index < s\->INDEX) + max_index = s\->INDEX; + s = addlosig(pt, ++max_index, s1\->NAMECHAIN, + s0\->TYPE == EXTERNAL || s1\->TYPE == EXTERNAL ? + EXTERNAL : INTERNAL); + dellosig(pt, s0); + dellosig(pt, s1); + return s; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR losig (3), +.BR getlosig (3), +.BR dellosig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addlotrs.3 b/alliance/src/mbk/man3/addlotrs.3 new file mode 100644 index 00000000..5e60c3c4 --- /dev/null +++ b/alliance/src/mbk/man3/addlotrs.3 @@ -0,0 +1,135 @@ +.\" $Id: addlotrs.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addlotrs.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addlotrs +.XE +.XS2 \n% +.ti 0.2i +addlotrs +.XE2 \} +.TH ADDLOTRS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +addlotrs \- create a logical transistor +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 23n +#include "mlo.3" +lotrs_list \(**addlotrs(ptfig, type, x, y, width, length, + ps, pd, xs, xd, + ptgrid, ptsource, ptdrain) +lofig_list \(**ptfig; +char type; +long x, y; +unsigned short width, length; +unsigned short ps, pd; +unsigned short xs, xd; +losig_list \(**ptgrid, \(**ptsource, \(**ptdrain; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the transistor should be added +.TP +\fItype\fP +transistor type +.TP +\fIx, y\fP +Transistor coordinates +.TP +\fIwidth, length\fP +Transistor grid width and length +.TP +\fIps, pd\fP +Perimeters of the source and drain +.TP +\fIxs, xd\fP +Values to compute the areas of the source and drain, see \fBlotrs\fP(3) +for the effective area computation +.TP +\fIptgrid\fP +Pointer to the signal to be connected on the transistor grid +.TP +\fIptsource\fP +Pointer to the signal to be connected on the transistor source +.TP +\fIptdrain\fP +Pointer to the signal to be connected on the transistor drain +.SH DESCRIPTION +\fBaddlotrs\fP creates a new transistor, and adds it to the +list of transistors pointed to by \fIptfig\->LOTRS\fP. The new transistor is +added in front of the list, and becomes itself the list head. +.br +The \fItype\fP parameter can take two values : +.RS +.TP 20 +\fBTRANSN\fP +for a N channel transistor +.TP +\fBTRANSP\fP +for a P channel transistor +.RE +.LP +The \fIx\fP, \fIy\fP, \fIwidth\fP , \fIlength\fP, \fIps\fP, \fIpd\fP, +\fIxs\fP and \fIxd\fP, arguments fill +respectivly the \fIX\fP, \fIY\fP, \fIWIDTH\fP, \fILENGTH\fP, \fIPS\fP, +\fIPD\fP, \fIXS\fP and \fIXD\fP fields. +.br +Three connectors are created each time a transistor is added, and the +\fIptgrid\fP, \fIptsource\fP and \fIptdrain\fP \fBlosig\fPs are attached to +the \fISIG\fP field of the \fBlocon\fP of the appropriate connector. The +connectors names are \fIgrid\fP, \fIsource\fP and \fIdrain\fP, their +direction, \fIDIR\fP, are set to \fB'T'\fP, and their \fITYPE\fP \fBINTERNAL\fP. +For details on the structures, see \fBlocon\fP(3) and \fBlotrs\fR(3). +.SH RETURN VALUE +\fBaddlotrs\fP returns a pointer to the newly created transistor. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal transistor type : \fItype\fP" +.ft R +.RS +The \fItype\fP is not legal a legal transistor type. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void n1_y() /\(** transistor netlist of an inverter \(**/ +{ +lofig_list \(**pt; +losig_list \(**in, \(**out, \(**vdd, \(**vss; + pt = addlofig("n1_y"); + addlocon(pt, "in", in = givelosig(pt, 0), IN); + addlocon(pt, "out", out = givelosig(pt, 1), OUT); + addlocon(pt, "vdd", vdd = givelosig(pt, 2), IN); + addlocon(pt, "vss", vdd = givelosig(pt, 3), IN); + addlotrs(pt, TRANSN, 0, 0, 6, 1, in, vss, out); + addlotrs(pt, TRANSP, 0, 0, 12, 1, in, vdd, out); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR lotrs (3), +.BR locon (3), +.BR dellotrs (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addnum.3 b/alliance/src/mbk/man3/addnum.3 new file mode 100644 index 00000000..fe89d68a --- /dev/null +++ b/alliance/src/mbk/man3/addnum.3 @@ -0,0 +1,73 @@ +.\" $Id: addnum.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addnum.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addnum +.XE +.XS4 \n% +.ti 0.2i +addnum +.XE4 \} +.TH ADDNUM 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +addnum \- create a \fBnum\fP and add it to a list +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +num_list \(**addnum(ptnum, data) +num_list \(**ptnum; +long data; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptnum\fP +Pointer to a \fBnum_list\fP +.TP +\fIdata\fP +Value of the data +.SH DESCRIPTION +\fBaddnum\fP creates a new \fBnum\fP element and adds it to the +front of the list pointed to by \fIptnum\fP, and becomes itself the list head. +.br +The \fIdata\fP fills the \fIDATA\fP field of the \fBnum\fP strucutre. +For details on the structure, see \fBnum\fR(3). +.SH RETURN VALUE +\fBaddnum\fP returns a pointer to the new head of list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +void count(pn) +num_list \(**pn; +{ +num_list \(**c = NULL; /\(** initialized for regularity \(**/ + while (pt) { + if (pt\->TYPE == EXTERNAL) + c = addnum(c, (void \(**)pt) + pt = pt\->NEXT; + } + return c; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR num (3), +.BR freenum (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addphcon.3 b/alliance/src/mbk/man3/addphcon.3 new file mode 100644 index 00000000..057f07b5 --- /dev/null +++ b/alliance/src/mbk/man3/addphcon.3 @@ -0,0 +1,140 @@ +.\" $Id: addphcon.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addphcon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addphcon +.XE +.XS0 \n% +.ti 0.2i +addphcon +.XE0 \} +.TH ADDPHCON 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +addphcon \- create a physical connector +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phcon_list \(**addphcon(ptfig, orient, conname, x, y, layer, width) +phfig_list \(**ptfig; +char orient; +char \(**conname; +long x, y; +char layer; +long width; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the connector should be added +.TP +\fIorient\fP +Face of the connector +.TP +\fIconname\fP +Name of the connector +.TP +\fIx, y\fP +Absolute connector coordinates +.TP +\fIlayer\fP +Connector symbolic layer +.TP +\fIwidth\fP +Connector symbolic width +.SH DESCRIPTION +\fBaddphcon\fP creates a new connector called \fIconname\fP and adds it to the +list of connectors pointed to by \fIptfig\->PHCON\fP. The new connector is +added in front of the list, and becomes itself the list head. +.br +The parameters \fIconname\fP, \fIorient\fP, \fIx\fP, \fIy\fP, \fIlayer\fP, +\fIwidth\fP fill respectivly the \fINAME\fP, \fIORIENT\fP, \fIXCON\fP, +\fIYCON\fP, \fILAYER\fP, \fIWIDTH\fP fields of the \fIphcon\fP structure. +See \fBphcon\fR(3) for details. +.br +The \fIINDEX\fP field is computed by the \fBaddphcon\fP function in order to +warranty index unicity. A topological sort is performed, checking \fIx\fP, +then \fIy\fP, then the \fIlayer\fP. So for a given figure, each connector will +have a constant \fIINDEX\fP. +.br +The \fIx\fP, \fIy\fP coordinates must be placed inside the \fIbutment box\fP +of the figure. +.br +The \fIwidth\fP is a layer extension that takes place in parallel to the +connector face. +.br +For a list of valid \fIorient\fP and \fIlayer\fPs, see +\fBlocon\fR(3). +.SH RETURN VALUE +\fBaddphcon\fP returns a pointer to the newly created connector. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphcon unknow layer \fIlayer\fP in \fIconname\fP" +.ft R +.RS +The \fIlayer\fP parameter is out of range, and does not represent a legal +symbolic layer. See \fBlocon\fP(3) for a complete list of layers. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphcon connector \fIconname\fP not in +abutment box" +.ft R +.RS +The connector coordinates are not included in the rectangle of the figure +\fIabutment\fP box. This means that the \fIabutment box\fP field of the +\fIphfig\fP must be filled befor any call to \fBaddphcon\fP. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphcon orientation is \fIorient\fP in +\fIconname\fP" +.ft R +.RS +The \fIorient\fP parameter is not in the set of legal values. See +\fBlocon\fP(3) for the complete list of orientations. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phcon_list \(**du_con(ptfig, ptcon) /\(** duplicate connector \(**/ +phfig_list \(**ptfig; +phcon_list \(**ptcon; +{ + /\(** the index depends from what's in ptfig\->PHCON, not from me \(**/ + return addphcon(ptfig, ptcon\->ORIENT, ptcon\->NAME, + ptcon\->XCON, ptcon\->YCON, + ptcon\->LAYER, ptcon\->WIDTH); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phcon (3), +.BR getphcon (3), +.BR delphcon (3), +.BR locon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addphfig.3 b/alliance/src/mbk/man3/addphfig.3 new file mode 100644 index 00000000..13805977 --- /dev/null +++ b/alliance/src/mbk/man3/addphfig.3 @@ -0,0 +1,93 @@ +.\" $Id: addphfig.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addphfig +.XE +.XS0 \n% +.ti 0.2i +addphfig +.XE0 \} +.TH ADDPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +addphfig \- create a new physical cell model +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phfig_list \(**addphfig(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the figure to be created +.SH DESCRIPTION +\fBaddphfig\fP creates a new figure called \fIfigname\fP and adds it to the +list of figure in memory. The new figure is added in front of the list, and +becomes itself the list head. No check is performed to see if a figure with +the \fIfigname\fP exists on disk. If it is the case, the preexisting file will +be erased while saving. +.br +The fields \fIPHCON\fP, \fIPHINS\fP, \fIPHSEG\fP, \fIPHVIA\fP, \fIPHREF\fP and +\fIUSER\fP are set to \fBNULL\fP. +.br +The fields \fIXAB1\fP, \fIYAB1\fP, \fIXAB2\fP, \fIXAB2\fP are set to +\fB0L\fP. +.br +The field \fIMODE\fP is set to \fB'A'\fP. +.br +The field \fINEXT\fP points to the previous head of list. +.SH RETURN VALUE +\fBaddphfig\fP returns a pointer to the newly created figure. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphfig figure \fIfigname\fP already exists" +.ft R +.RS +There is already a figure called \fIfigname\fP in memory, so it's impossible +to give this name to a cell to be created. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phfig_list \(**get_the_fig(name) +char \(**name; +{ +phfig_list \(**pt, \(**fill_fig(/\(** phfig_list \(** \(**/); + /\(** scan figure list \(**/ + for (pt = HEAD_PHFIG; pt; pt = pt\->NEXT) + if (!strcmp(pt\->NAME, figname)) + break; + return pt ? pt : fill_fig(addphfig(figname)); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR getphfig (3), +.BR delphfig (3), +.BR loadphfig (3), +.BR savephfig (3), +.BR flattenphfig (3), +.BR rflattenphfig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addphins.3 b/alliance/src/mbk/man3/addphins.3 new file mode 100644 index 00000000..5e452f4d --- /dev/null +++ b/alliance/src/mbk/man3/addphins.3 @@ -0,0 +1,129 @@ +.\" $Id: addphins.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addphins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addphins +.XE +.XS0 \n% +.ti 0.2i +addphins +.XE0 \} +.TH ADDPHINS 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +addphins \- create a physical instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phins_list \(**addphins(ptfig, figname, insname, sym, x, y) +phfig_list \(**ptfig; +char \(**figname; +char \(**insname; +char sym; +long x, y; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the instance should be added +.TP +\fIfigname\fP +Instance model name +.TP +\fIinsname\fP +Instance name +.TP +\fIsym\fP +Geometrical operation performed on the instance +.TP +\fIx, y\fP +Coordinates of the lower left corner of the instance +.SH DESCRIPTION +\fBaddphins\fP creates a new instance whose lower left corner is at the given +coordinates, and adds it to the +list of instances pointed to by \fIptfig\->PHINS\fP. The new instance is +added in front of the list, and becomes itself the list head. +.br +The parameters \fIfigname\fP, \fIinsname\fP, \fIsym\fP, \fIx\fP and \fIy\fP +fill respectivly +the \fIFIGNAME\fP, \fIINSNAME\fP, \fITRANSF\fP, \fIXINS\fP and \fIYINS\fP +fields of the \fIphins\fP structure. +.br +The \fBaddphins\fP function does not check in memory or on disk to see +if the instanciated model exists, since no informations on it are needed. +.br +The coordinates are not transformation dependant. It means that the +transformation is performed before placing the instance at the given point. +For details on the structure, see \fBphins\fR(3). +.SH RETURN VALUE +\fBaddphins\fP returns a pointer to the newly created instance. +.SH ERRORS +.LP +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** addphins figure \fIfigname\fP cannot be part of itself" +.ft R +.RS +The instance has for model name of the figure on the which it is to be added. +It's illegal and dangerous. This check is made at the actual hierachy level +only, not recursivly on the structure, so it still may happend. +.RE +.LP +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphins transformation \fIsym\fP in : \fIinsname\fP" +.ft R +.RS +The geometrical operation is not in the legal range. See \fBphins\fP(3) for +a complete list of values. +.RE +.LP +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphins duplicate instance name : \fIinsname\fP" +.ft R +.RS +The instance name is an identifier, so it can't appear twice in the same figure. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phins_list \(**ins_dup(pfd, pfs) /\(** duplicate instances \(**/ +phfig_list \(**pfd, \(**pfs; +{ +phins_list \(**pi; + for (pi = pfs\->phins; pi != NULL; pi = pi\->NEXT) + addphins(pfd, pi\->FIGNAME, pi\->INSNAME, pi\->TRANSF, + pi\->XINS, pi\->YINS); + return pfd\->PHINS; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phins (3), +.BR getphins (3), +.BR delphins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addphref.3 b/alliance/src/mbk/man3/addphref.3 new file mode 100644 index 00000000..616c242e --- /dev/null +++ b/alliance/src/mbk/man3/addphref.3 @@ -0,0 +1,93 @@ +.\" $Id: addphref.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addphref.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addphref +.XE +.XS0 \n% +.ti 0.2i +addphref +.XE0 \} +.TH ADDPHREF 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +addphref \- create a physical reference +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phref_list \(**addphref(ptfig, type, name, x, y) +phfig_list \(**ptfig; +char \(**type; +char \(**name; +long x, y; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the reference should be added +.TP +\fItype\fP +Reference type +.TP +\fIname\fP +Reference name +.TP +\fIx, y\fP +Coordinates of the center of the reference. +.SH DESCRIPTION +\fBaddphref\fP creates a new reference whose center is at the given coordinates, +and adds it to the +list of references pointed to by \fIptfig\->PHREF\fP. The new reference is +added in front of the list, and becomes itself the list head. +.br +The parameters \fItype\fP, \fIname\fP, \fIx\fP and \fIy\fP fill respectivly +the \fIFIGNAME\fP, \fINAME\fP, \fIXREF\fP and \fIYREF\fP fields of the +\fIphref\fP structure. +.br +The \fItype\fPs may have any value, but only two type +are now recognized by tools based upon mbk : +.TP 20 +\fB"ref_con"\fP +for multi-access connectors +.TP +\fB"ref_ref"\fP +for cell programming +.LP +For details on the structure, see \fBphref\fR(3). +.SH RETURN VALUE +\fBaddphref\fP returns a pointer to the newly created reference. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phref_list \(**ref_dup(pfd, pfs) /\(** duplicate refs \(**/ +phfig_list \(**pfd, \(**pfs; +{ +phref_list \(**pr; + for (pr = pfs\->phref; pr != NULL; pr = pr\->NEXT) + addphref(pfd, pr\->FIGNAME, pr\->NAME, pr\->XREF, pr\->YREF); + return pfd\->PHREF; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phref (3), +.BR getphref (3), +.BR delphref (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addphseg.3 b/alliance/src/mbk/man3/addphseg.3 new file mode 100644 index 00000000..d4044625 --- /dev/null +++ b/alliance/src/mbk/man3/addphseg.3 @@ -0,0 +1,123 @@ +.\" $Id: addphseg.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addphseg.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addphseg +.XE +.XS0 \n% +.ti 0.2i +addphseg +.XE0 \} +.TH ADDPHSEG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +addphseg \- create a physical segment +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phseg_list \(**addphseg(ptfig, layer, width, x1, y1, x2, y2, nodename) +phfig_list \(**ptfig; +char layer; +long width; +long x1, y1, x2, y2; +char \(**nodename; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the segment should be added +.TP +\fIlayer\fP +Segment symbolic layer +.TP +\fIwidth\fP +Segment symbolic width +.TP +\fIx1, y1, x2, y2\fP +Segment endpoints coordinates +.TP +\fInodename\fP +Name of the segment +.SH DESCRIPTION +\fBaddphseg\fP creates a new segment at the given coordinates, possibly called +\fIsegname\fP, and adds it to the list of segments pointed to by +\fIptfig\->PHSEG\fP. The new segment is +added in front of the list, and becomes itself the list head. The segment name +is an optional information, and does not allow the segment identification. When +not needed, this parameter should be set to \fINULL\fP. +.br +The parameters \fInodename\fP, \fIlayer\fP and \fIwidth\fP fill respectivly +the \fINAME\fP, \fILAYER\fP and \fIWIDTH\fP fields of the \fIphseg\fP structure. +.br +\fIx1\fP, \fIy1\fP, \fIx2\fP, \fIy2\fP are sorted to warranty that the fields +\fIX1\fP and \fIY1\fP contain the minimum of, respectivly, \fIx1\fP, \fIx2\fP +and \fIy1\fP, \fIy2\fP, and the \fIX2\fP, \fIY2\fP fields the maximum. +.br +The \fITYPE\fP field is computed by the \fBaddphseg\fP function. +It will be either \fBVER\fP if \fIx1\fP equals \fIx2\fP, or \fBHOR\fP if +\fIy1\fP equals \fIy2\fP. +.br +The \fIwidth\fP is a layer extension that takes place in perpendicular to the +segment \fITYPE\fP. +.br +For a list of valid \fIlayer\fPs, and details on the structure, see +\fBphseg\fR(3). +.SH RETURN VALUE +\fBaddphseg\fP returns a pointer to the newly created segment. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphseg wrong layer code \fIlayer\fP in +\fIx1\fP, \fIy1\fP, \fIx2\fP, \fIy2\fP" +.ft R +.RS +The \fIlayer\fP parameter is out of range, and does not represent a legal +symbolic layer. See \fBphseg\fP(3) for a complete list of layers. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphseg : \fIx1\fP, \fIy1\fP, \fIx2\fP, \fIy2\fP" +.ft R +.RS +The segment coordinates are such that the segment is neither vertical nor +horizontal. So it's not a legal symbolic segment. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phseg_list \(**du_seg(pfd, pfs) +phfig_list \(**pfd, \(**pfs; +{ +phseg_list \(**ps; + /\(** names don't matter \(**/ + for (ps = pfs\->PHSEG; ps != NULL; ps = ps\->NEXT) + addphseg(pfd, ps\->LAYER, ps\->WIDTH, ps\->X1, ps\->Y1, + ps\->X2, ps\->Y2, NULL); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phseg (3), +.BR delphseg (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addphvia.3 b/alliance/src/mbk/man3/addphvia.3 new file mode 100644 index 00000000..54618b94 --- /dev/null +++ b/alliance/src/mbk/man3/addphvia.3 @@ -0,0 +1,91 @@ +.\" $Id: addphvia.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addphvia.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addphvia +.XE +.XS0 \n% +.ti 0.2i +addphvia +.XE0 \} +.TH ADDPHVIA 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +addphvia \- create a physical via +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phvia_list \(**addphvia(ptfig, viatype, x, y) +phfig_list \(**ptfig; +char viatype; +long x, y; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the via should be added +.TP +\fIviatype\fP +Contact type +.TP +\fIx, y\fP +Coordinates of the center of the via. +.SH DESCRIPTION +\fBaddphvia\fP creates a new via whose center is at the given coordinates, +and adds it to the +list of vias pointed to by \fIptfig\->PHVIA\fP. The new via is +added in front of the list, and becomes itself the list head. +.br +The parameters \fIviatype\fP, \fIx\fP and \fIy\fP fill respectivly +the \fITYPE\fP, \fIXVIA\fP and \fIYVIA\fP fields of the \fIphvia\fP structure. +.br +For a list of valid \fIviatype\fPs, and details on the structure, see +\fBphvia\fR(3). +.SH RETURN VALUE +\fBaddphvia\fP returns a pointer to the newly created via. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal addphvia viatype : \fIviatype\fP at +\fIx\fP, \fIy\fP" +.ft R +.RS +The via type is not a predefined contact. For a list of legal via types, +see \fBphvia\fP(3). +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phvia_list \(**via_dup(pfd, pfs) /\(** duplicate vias \(**/ +phfig_list \(**pfd, \(**pfs; +{ +phvia_list \(**pv; + for (pv = pfs\->phvia; pv != NULL; pv = pv\->NEXT) + addphvia(pfd, pv\->TYPE, ps\->XVIA, ps\->YVIA); + return pfd\->PHVIA; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phvia (3), +.BR delphvia (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/addptype.3 b/alliance/src/mbk/man3/addptype.3 new file mode 100644 index 00000000..93a745d1 --- /dev/null +++ b/alliance/src/mbk/man3/addptype.3 @@ -0,0 +1,91 @@ +.\" $Id: addptype.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)addptype.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +addptype +.XE +.XS4 \n% +.ti 0.2i +addptype +.XE4 \} +.TH ADDPTYPE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +addptype \- create a \fBptype\fP and add it to a \fBptype_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +ptype_list \(**addptype(pthead,type,ptdata) +ptype_list \(**pthead; +void \(**ptdata; +long type; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpthead\fP +Pointer to a \fBptype\fP list +.TP +\fItype\fP +Flag indicating the pointer owner +.TP +\fIptdata\fP +Generic pointer to any kind of information +.SH DESCRIPTION +\fBaddptype\fP creates a new \fBptype\fP element and adds it to the +front of the list pointed to by \fIpthead\fP, and becomes itself the list head. +.br +The \fBptype_list\fPs are mosty used to create lists of homogeneous +elements in mbk, but also for trees, graphs, and so on. +.br +The \fItype\fP argument indicates the pointer type, at the C type meaning, +for its owner. +.br +The \fItype\fPs allow to access the pointers with adequat cast, and for example +to share informations in the \fIUSER\fP fields of mbk structures. +.br +The \fIptdata\fP points to any kind of list or may itself be a value, if proper +cast is performed at compilation time, and fills the \fIDATA\fP field of the +\fBptype\fP structure. +For details on the structure, see \fBptype\fR(3). +.SH RETURN VALUE +\fBaddptype\fP returns a pointer to the new head of list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mph.h" +void corner(ptfig, name) +phfig_list \(**ptfig; +char \(**name; +{ +phins_list \(**i = getphins(ptfig, name); +num_list \(**ptnum; +phfig_list \(**model; + model = getphfig(i\->FIGNAME); + ptnum = addnum((num_list \(**)NULL, model\->X2 - model\->X1); + ptnum = addnum(ptnum, model\->Y2 - model\->Y1); + i\->USER = addptype(i\->USER, (long)PLACEABOX, (void \(**)ptnum); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR ptype (3), +.BR freeptype (3), +.BR getptype (3), +.BR delptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/alliancebanner.3 b/alliance/src/mbk/man3/alliancebanner.3 new file mode 100644 index 00000000..98129d5b --- /dev/null +++ b/alliance/src/mbk/man3/alliancebanner.3 @@ -0,0 +1,72 @@ +.\" $Id: alliancebanner.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)alliancebanner.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.ie t \{\ +.fp 4 C \} +.el \{\ +.fp 4 B \} +.TH ALLIANCEBANNER 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +alliancebanner \- display the standardized Alliance banner +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.ft 4 +#include "mut.h" +void alliancebanner(tool, tv, comment, date, av) +char \(**tool, \(**tv, \(**comment, \(**date, \(**av; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\f4tool\fP +Name of the tool. +This is what will be displayed as banner. +.TP 20 +\f4tv\fP +Tool version. +.TP 20 +\f4comment\fP +Indicates the tool's usefulness. +.TP 20 +\f4date\fP +Copyright dates. +.TP 20 +\f4av\fP +Alliance version. +.SH DESCRIPTION +\fBalliancebanner\fP ouputs on \f4stdout\fR a standardized banner with +the name of the tool in large letters, and a cartouche containing some +informations about the Alliance CAD system. +This function is to be used by all the Alliance tools, and expect a +display 80 columns wide. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.ft 4 +#include "ba315n.h" +#define nfloptitle(name) \\ + alliancebanner("nFloP", VERSION,\\ + "not a FloorPlan router", "92, 93",\\ + ALLIANCE_VERSION) +.ft R +.fi +.SH SEE ALSO +.BR alliance (1). + + +.SH DIAGNOSTICS +\f4alliancebanner: Error: Resulting size bigger than 80 columns not allowed\fR +.RS +The \fItool\fR argument must be such that its resulting size isn't wider that +80 culumns. +This means, since the character set is proportional, that the longest name +to be output is about 8 characters long. +.RE +\f4alliancebanner: Error: Character out of [0-9A-Za-z] range\fR +.RS +The \fItool\fR parameter has a non allowed character in it. +For simplicity purposes, only numbers and letters are accepted. +.RE + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/append.3 b/alliance/src/mbk/man3/append.3 new file mode 100644 index 00000000..26182e4c --- /dev/null +++ b/alliance/src/mbk/man3/append.3 @@ -0,0 +1,67 @@ +.\" $Id: append.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)append.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +append +.XE +.XS4 \n% +.ti 0.2i +append +.XE4 \} +.TH APPEND 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +append \- append a \fBchain_list\fP to an other \fBchain_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +chain_list \(**append(pt1, pt2) +chain_list \(**pt1,\(**pt2; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpt1\fP +Pointer to a \fBchain_list\fP +.TP +\fIpt2\fP +Pointer to a \fBchain_list\fP +.SH DESCRIPTION +\fBappend\fP appends the contains of the \fBchain_list\fP pointed to by +\fIpt2\fP at the end of the one pointed to by \fIpt1\fP. +.br +The lists consistency is warranted by the use of the adequat \fBadd\fI +functions. +.SH RETURN VALUE +\fBappend\fP returns a pointer to the new head of list. +If \fIpt1\fP is not \fBNULL\fP, it has the value of \fIpt1\fP, else it is +\fIpt2\fP. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +void sig_names(s0, s1) +losig_list \(**s0, \(**s1; +{ + s0\->NAMECHAIN = append(s0\->NAMECHAIN, s1\->NAMECHAIN); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR chain (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/bigvia.3 b/alliance/src/mbk/man3/bigvia.3 new file mode 100644 index 00000000..0328c345 --- /dev/null +++ b/alliance/src/mbk/man3/bigvia.3 @@ -0,0 +1,81 @@ +.\" $Id: bigvia.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)bigvia.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +bigvia +.XE +.XS1 \n% +.ti 0.2i +bigvia +.XE1 \} +.TH BIGVIA 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +bigvia \- draws a non minimal via as a bunch of vias +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void \(**bigvia(figure, viatype, x, y, dx, dy) +phfig_list \(**figure; +char viatype; +long x, y, dx, dy; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIfigure\fP +Pointer to the physical figure in the which vias must be put. +.TP 20 +\fIviatype\fP +Contact type to be put. +.TP 20 +\fIx, y\fP +Coordinate of the center of the bigvia. +.TP 20 +\fIdx, dy\fP +Maximun rectangle to be filled with vias. +.SH DESCRIPTION +\fBbigvia\fP draws as many vias as necessary to fill the rectangle defined by +its \fIdx\fP and \fPdy\fP arguments. +The ``bigvia'' center is indicated with \fIdx\fP and \fPdy\fP, thus making this +function much like \fBaddphvia\fP. +The necessary segments are drawn to avoid having notches or other drc rules +violated. +.br +This function is tipically used by routers when connecting two non minimal wires, +like supplies or clocks. +.br +The values for drawing the via correctly, ie avoid drc violations, are taken +from the idps set of rules, and are not changeable at run time. +.SH ERRORS +.RS +"*** mbk error *** +bigvia impossible : negative values dx, dy in figure figure at (x, y)" +.RE +If either \fIdx\fP or \fIdy\fP are negative, the function complains and exits. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +#define BigVia(x, y, dx, dy) \\ + bigvia(WORK_PHFIG, CONT_VIA, x, y, dx, dy) +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR addphvia (3), +.BR addphseg (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/chain.3 b/alliance/src/mbk/man3/chain.3 new file mode 100644 index 00000000..1d49cc50 --- /dev/null +++ b/alliance/src/mbk/man3/chain.3 @@ -0,0 +1,58 @@ +.\" $Id: chain.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)chain.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +chain +.XE +.XS4 \n% +.ti 0.2i +chain +.XE4 \} +.TH CHAIN 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY STRUCTURE DEFINITIONS" +.SH NAME +chain \- mbk lisp-like service structure +.SH DESCRIPTION +The \fBchain\fP is used for any purpose, when a list of pointer is required. +The use of this structure is strongly recommanded, when such a need occurs. +.LP +The declarations needed to work on \fBchain\fP are available in the header file +\fI"/labo/include/mut315.h"\fP, where '\fI315\fP' is the actual mbk version. +.LP +The following C structure supports the description of the chain : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct chain { + struct chain \(**NEXT; + void \(**DATA; +} chain_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBchain\fP of the list. +.TP +\fIDATA\fP +Generic pointer used to point to any kind of object. Do not forget to +cast the pointer back to its previous type when using this field. +.TP +Remark : +a specialized memory allocator has been built in order to create and free +\fBchain_list\fPs, so absolutly avoid to create or free them an other way than +through the access functions. +.SH SEE ALSO +.BR mbk (1), +.BR addchain (3), +.BR freechain (3), +.BR delchain (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/checkloconorder.3 b/alliance/src/mbk/man3/checkloconorder.3 new file mode 100644 index 00000000..a57cd429 --- /dev/null +++ b/alliance/src/mbk/man3/checkloconorder.3 @@ -0,0 +1,112 @@ +.\" $Id: checkloconorder.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)checkloconorder.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +checkloconorder +.XE +.XS2 \n% +.ti 0.2i +checkloconorder +.XE2 \} +.TH CHECKLOCONORDER 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +checkloconorder \- checks the consistency of a list of logical connectors +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void checkloconorder(connectors) +locon_list \(**connectors; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIconnectors\fP +Pointer to the head of the connector list that is to be sorted +.SH DESCRIPTION +\fBcheckloconorder\fP checks the list of logical connectors pointed to +by \fI\(**connectors\fP for conformity towards \fBmbk\fP(1) consistency +rules. +Checks are done to warranty : +.TP 20 +\fBorder\fP +the functions checks that vectorized connectors are ordered and evolve +monotonically, with a step of 1. +.TP 20 +\fBname unicity\fP +Vector radicals may not appear as single entity. +.TP 20 +\fBname validity\fP +No space should appear in the name, but a single one followed by a number +in a vector. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** radical \fIname\fP already used in a +connector" +.ft R +.RS +The \fIname\fP is already used in a connector, either vectorized or not, +and therefore cannot be used once more. +This ensures that \fBf\fP and \fBf 3\fP will not be used simultaneously. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** the radical \fIname\fP has a spurious +vectorized value" +.ft R +.RS +The \fIname\fP is seen as a vector in \fBmbk\fP(1), but its index is not a +number or some text follows that number. +.RE +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** the radical \fIname\fP is not +vectorized properly" +.ft R +.RS +The \fIname\fP is seen as a vector in \fBmbk\fP(1), but its index changes +in such a way that it is not monotonically increasing or decreasing with +a step of 1. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void savewithcheck(figname) +char \(**figname; +{ +lofig_list \(**figure = getlocon(figname, 'A'); + checkloconorder(figure->LOCON); + savelofig(figure); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR locon (3), +.BR addlocon (3), +.BR dellocon (3), +.BR checkloconorder (3), +.BR qsort (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/concatname.3 b/alliance/src/mbk/man3/concatname.3 new file mode 100644 index 00000000..363fff53 --- /dev/null +++ b/alliance/src/mbk/man3/concatname.3 @@ -0,0 +1,69 @@ +.\" $Id: concatname.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)concatname.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +concatname +.XE +.XS4 \n% +.ti 0.2i +concatname +.XE4 \} +.TH CONCATNAME 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +concatname \- concatenate two names with user separator +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**concatname(s, t) +char \(**s, \(**t; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIs\fP +Pointer to a string +.TP +\fIt\fP +Pointer to a string +.SH DESCRIPTION +The \fBconcatname\fP function adds the separator defined by \fBMBK_SEPAR\fP(1), +and then the string \fIt\fP at the end of string \fIs\fP. This is not like a +\fBstrcat\fP(3) of the standard library, because \fIs\fP is not beeing modified. +The string returned has already been put in the names dictionary by +a call to \fBnamealloc\fP(3). +.SH RETURN VALUE +\fBconcatname\fP returns a pointer to a string in the name hash table. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +void flat_sig_alias(ptsig, insname) +losig_list \(**ptsig; +char \(**insname; +{ +chain_list \(**pt; + for (pt = ptsig\->NAMECHAIN; pt; pt = pt\->NEXT) + pt\->DATA = (void \(**)concatname(insname, (char \(**)pt\->DATA); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR namealloc (3), +.BR MBK_SEPAR (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/defab.3 b/alliance/src/mbk/man3/defab.3 new file mode 100644 index 00000000..e94d3dc8 --- /dev/null +++ b/alliance/src/mbk/man3/defab.3 @@ -0,0 +1,59 @@ +.\" $Id: defab.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)defab.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +defab +.XE \} +.TH DEFAB 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +defab \- defines the \fIabutment box\fP of a \fBphfig\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void defab(ptfig, x1, y1, x2, y2) +phfig_list \(**ptfig; +long x1, x2, y1, y2; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to a \fBphfig\fP +.TP +\fIx1, y1, x2, y2\fP +Coordinates of the \fIabutment box\fP +.SH DESCRIPTION +\fBdefab\fP redefines the \fIabutment box\fP of the figure pointed to by +\fIptfig\fP. +It overwrite any existing value in the \fIXAB1\fP, \fIYAB1\fP, \fIXAB2\fP and +\fIYAB2\fP by the given arguments. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void add_half_rules(fig) +phfig_list \(**fig; +{ + defab(fig, fig\->XAB1 + HALF_RULE, fig\->YAB1 + HALF_RULE, + fig\->XAB2 + HALF_RULE, fig\->YAB2 + HALF_RULE); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delchain.3 b/alliance/src/mbk/man3/delchain.3 new file mode 100644 index 00000000..320c2df8 --- /dev/null +++ b/alliance/src/mbk/man3/delchain.3 @@ -0,0 +1,83 @@ +.\" $Id: delchain.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delchain.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delchain +.XE +.XS4 \n% +.ti 0.2i +delchain +.XE4 \} +.TH DELCHAIN 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +delchain \- delete an element of a \fBchain_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +chain_list \(**delchain(pthead, ptdel) +chain_list \(**pthead; +chain_list \(**ptdel; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpthead\fP +Pointer to a \fBchain\fP list +.TP +\fIptdel\fP +Pointer to the element to be deleted. +.SH DESCRIPTION +\fBdelchain\fP deletes the element of the \fBchain_list\fP pointed to by +\fIptdel\fP in the list pointed to by \fIpthead\fP. +The list consistency is maintainded, and the element put back in the list +of free blocks. +.SH RETURN VALUE +\fBdelchain\fP returns a pointer to the new head of list if the \fIptdel\fP +pointer used to belong to the list. In most case, it has the value of +\fIpthead\fP. If the pointer doesn't belong to the list, \fBNULL\fP is returned. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** delchain impossible : pointer NULL" +.ft R +.RS +At least one of the arguments are pointing to \fBNULL\fP, and that clear that +such a pointer can't be deleted, or used for freeing. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void delete_match(c0, c1) +chain_list \(**c0, \(**c1; +{ +chain_list \(**t0, \(**t1, \(**next; + for (t0 = c0; t0; t0 = next) + for (t1 = c1; t1; t1 = t1\->NEXT) + if (t1\->DATA == t0\->DATA) + next = delchain(c0, t0); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR chain (3), +.BR addchain (3), +.BR freechain (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delht.3 b/alliance/src/mbk/man3/delht.3 new file mode 100644 index 00000000..bc5594d0 --- /dev/null +++ b/alliance/src/mbk/man3/delht.3 @@ -0,0 +1,71 @@ +.\" $Id: delht.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delht.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun +.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92 +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delht +.XE +.XS4 \n% +.ti 0.2i +delht +.XE4 \} +.TH DELHT 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS" +.SH NAME +delht \- removes an hash table +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +#include "mut.h" +void delht(table) +ht \(**table; +.fi +.SH PARAMETER +.TP 20 +\fItable\fP +Hash table pointer +.SH DESCRIPTION +\fBdelht()\fP removes the hash table pointed to by \fItable\fP from +memory. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +checksigname(p) +lofig_list \(**p; +{ +ht \(**h; +int i; +char \(**amatla; + for (i = 0, ptsig = p->LOSIG; ptsig; i++, ptsig = ptsig->NEXT); + h = addht(i); + for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT) + addhtitem(h, ptcon->NAME, 0); + for (ptsig = p->LOSIG; ptsig; ptsig = ptsig->NEXT) { + if (ptsig->TYPE == INTERNAL) { + amatla = getsigname(ptsig); + if (!sethtitem(h, amatla, 0)) { + printf("N %s;\\n", amatla); + } + } + } + delht(h); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR addht (3), +.BR addhtitem (3), +.BR gethtitem (3), +.BR delhtitem (3), +.BR viewht (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delhtitem.3 b/alliance/src/mbk/man3/delhtitem.3 new file mode 100644 index 00000000..5b275122 --- /dev/null +++ b/alliance/src/mbk/man3/delhtitem.3 @@ -0,0 +1,84 @@ +.\" $Id: delhtitem.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delhtitem.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun +.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92 +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delhtitem +.XE +.XS4 \n% +.ti 0.2i +delhtitem +.XE4 \} +.TH DELHTITEM 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS" +.SH NAME +delhtitem \- removes an item in an hash table +.so man1/alc_origin.1 +.SH SYNOPSYS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +int delhtitem(table, key) +ht \(**table; +void \(**key; +.fi +.ft R +.SH PARAMETERS +.TP 20 +\fItable\fP +Hash table pointer +.TP 20 +\fIkey\fP +Key used by the hash coding function indicating the item to be deleted +.SH DESCRIPTION +\fBdelhtitem()\fP removes an item in the hash table pointed to by \fItable\fP. +.SH RETURN VALUE +If the key doesn't exist, the function returns \fBEMPTYHT\fP, +if it does, then its associated value is returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +checksigname(p, h) +lofig_list \(**p; +ht \(**h; +{ +int i; +char \(**amatla; + /\(** check for signal and connector name unicity \(**/ + for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT) + addhtitem(h, ptcon->NAME, 0); + for (ptsig = p->LOSIG; ptsig; ptsig = ptsig->NEXT) { + if (ptsig->TYPE == INTERNAL) { + amatla = getsigname(ptsig); + if (!sethtitem(h, amatla, 0)) { + printf("N %s;\\n", amatla); + } + } + } + /\(** keep only internal signal names in the hash table \(**/ + for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT) + (void)delhtitem(h, ptcon->NAME); +} +.fi +.ft R +.SH SEE ALSO +.BR mbk (1), +.BR addth (3), +.BR delht (3), +.BR addhtitem (3), +.BR gethtitem (3), +.BR sethtitem (3), +.BR viewht (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/dellocon.3 b/alliance/src/mbk/man3/dellocon.3 new file mode 100644 index 00000000..fb9a829d --- /dev/null +++ b/alliance/src/mbk/man3/dellocon.3 @@ -0,0 +1,69 @@ +.\" $Id: dellocon.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)dellocon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +dellocon +.XE +.XS2 \n% +.ti 0.2i +dellocon +.XE2 \} +.TH DELLOCON 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +dellocon \- delete a logical connector +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int dellocon(ptfig, name) +lofig_list \(**ptfig; +char \(**name; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the connector should be deleted +.TP +\fIname\fP +Name of the connector to be deleted. +.SH DESCRIPTION +\fBdellocon\fP deletes the connector called \fIname\fP in the figure +pointed to by \fIptfig\fP. The list consistency is maintained, and the space +freed. +.SH RETURN VALUE +\fBdellocon\fP returns \fB1\fP if the connector has been deleted, \fB0\fP +if no such connector exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +char \(**was_existing(p, s) +lofig_list \(**p; +char \(**s; +{ + return dellocon(p, s) ? "you just killed it!\n" + : "wasn't here anyway\n"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR locon (3), +.BR addlocon (3), +.BR getlocon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/dellofig.3 b/alliance/src/mbk/man3/dellofig.3 new file mode 100644 index 00000000..fc294b47 --- /dev/null +++ b/alliance/src/mbk/man3/dellofig.3 @@ -0,0 +1,68 @@ +.\" $Id: dellofig.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)dellofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +dellofig +.XE +.XS2 \n% +.ti 0.2i +dellofig +.XE2 \} +.TH DELLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +dellofig \- delete and free a logical figure +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int dellofig(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the figure to be deleted +.SH DESCRIPTION +\fBdellofig\fP deletes the figure called \fIfigname\fP from the list of +logical figure in memory. All the lists of elements belonging to the figure +are also deleted and freed. +.SH RETURN VALUE +\fBdellofig\fP returns \fB1\fP if the figure was delete, and \fB0\fP if no +figure called \fIfigname\fP was present in memory. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void delete_na2_y() +{ + if (dellofig("na2_y")) + (void)fputs("deleted na2_y successfully", stdout); + else + (void)fputs("na2_y not present in ram !", stdout); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR addlofig (3), +.BR getlofig (3), +.BR loadlofig (3), +.BR savelofig (3), +.BR flattenlofig (3), +.BR rflattenlofig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delloins.3 b/alliance/src/mbk/man3/delloins.3 new file mode 100644 index 00000000..25f003a2 --- /dev/null +++ b/alliance/src/mbk/man3/delloins.3 @@ -0,0 +1,72 @@ +.\" $Id: delloins.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delloins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delloins +.XE +.XS2 \n% +.ti 0.2i +delloins +.XE2 \} +.TH DELLOINS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +delloins \- delete a logical instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int delloins(ptfig, insname) +lofig_list \(**ptfig; +char \(**insname; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the instance should be deleted +.TP +\fIinsname\fP +Name of the instance to be deleted. +.SH DESCRIPTION +\fBdelloins\fP delete the instance called \fIinsname\fP in the figure +pointed to by \fIptfig\fP. This instance is warrantied to be unique, because +its name is an identifier at the given hierarchical level. +The list consistency is maintainded, and the space freed. The instance +connectors are also freed, since if the instance disapear, no more connections +can occur on it. +.SH RETURN VALUE +\fBdelloins\fP returns \fB1\fP if the instance has been deleted, \fB0\fP +if no such instance exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +char \(**was_existing(ptfig, insname) +lofig_list \(**ptfig; +char \(**insname; +{ + return delloins(ptfig, insname) ? "you just killed it!" + : "wasn't here anyway"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR loins (3), +.BR addloins (3), +.BR getloins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/dellosig.3 b/alliance/src/mbk/man3/dellosig.3 new file mode 100644 index 00000000..4296a01c --- /dev/null +++ b/alliance/src/mbk/man3/dellosig.3 @@ -0,0 +1,69 @@ +.\" $Id: dellosig.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)dellosig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +dellosig +.XE +.XS2 \n% +.ti 0.2i +dellosig +.XE2 \} +.TH DELLOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +dellosig \- delete a logical signal +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int dellosig(ptfig, index) +lofig_list \(**ptfig; +long index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the signal should be deleted +.TP +\fIindex\fP +Index of the signal to be deleted. +.SH DESCRIPTION +\fBdellosig\fP delete the signal that has \fIindex\fP as \fIINDEX\fP +in the figure pointed to by \fIptfig\fP. +The list consistency is maintainded, and the space freed. +.SH RETURN VALUE +\fBdellosig\fP returns \fB1\fP if the signal has been deleted, \fB0\fP +if the signal index does not exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +char \(**was_existing(ptfig, index) +lofig_list \(**ptfig; +long index; +{ + return dellosig(ptfig, index) ? "you just killed it!" + : "wasn't here anyway"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR losig (3), +.BR addlosig (3), +.BR getlosig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/dellotrs.3 b/alliance/src/mbk/man3/dellotrs.3 new file mode 100644 index 00000000..78a8ff17 --- /dev/null +++ b/alliance/src/mbk/man3/dellotrs.3 @@ -0,0 +1,70 @@ +.\" $Id: dellotrs.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)dellotrs.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +dellotrs +.XE +.XS2 \n% +.ti 0.2i +dellotrs +.XE2 \} +.TH DELLOTRS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +dellotrs \- delete a logical transistor +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int dellotrs(ptfig, pttrs) +lofig_list \(**ptfig; +lotrs_list \(**pttrs; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the transistor should be deleted +.TP +\fIpttrs\fP +Pointer to the transistor to be deleted. +.SH DESCRIPTION +\fBdellotrs\fP delete the transistor pointed to by \fIpttrs\fP in the figure +pointed to by \fIptfig\fP. +The list consistency is maintainded, and the space freed. The transistor +connectors are also freed, since if the transistor disapear, +no more connections can occur on it. +.SH RETURN VALUE +\fBdellotrs\fP returns \fB1\fP if the transistor has been deleted, \fB0\fP +if the transistor pointer does nit exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +char \(**was_existing(ptfig, pttrs) +lofig_list \(**ptfig; +lotrs_list \(**pttrs; +{ + return dellotrs(ptfig, pttrs) ? "you just killed it!" + : "wasn't here anyway"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR lotrs (3), +.BR addlotrs (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delnum.3 b/alliance/src/mbk/man3/delnum.3 new file mode 100644 index 00000000..958870c6 --- /dev/null +++ b/alliance/src/mbk/man3/delnum.3 @@ -0,0 +1,82 @@ +.\" $Id: delnum.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delnum.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delnum +.XE +.XS4 \n% +.ti 0.2i +delnum +.XE4 \} +.TH DELNUM 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +delnum \- delete an element of a \fBnum_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +num_list \(**delnum(pthead, ptdel) +num_list \(**pthead, \(**ptdel; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpthead\fP +Pointer to a \fBnum\fP list +.TP +\fIptdel\fP +Pointer to the element to be deleted. +.SH DESCRIPTION +\fBdelnum\fP deletes the element of the \fBnum_list\fP pointed to by +\fIptdel\fP in the list pointed to by \fIpthead\fP. +The list consistency is maintainded, and the element put back in the list +of free blocks. +.SH RETURN VALUE +\fBdelnum\fP returns a pointer to the new head of list if the \fIptdel\fP +pointer used to belong to the list. In most case, it has the value of +\fIpthead\fP. If the pointer doesn't belong to the list, \fBNULL\fP is returned. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** delnum impossible : pointer NULL" +.ft R +.RS +At least one of the arguments are pointing to \fBNULL\fP, and that clear that +such a pointer can't be deleted. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void delete_match(c0, c1) +num_list \(**c1, \(**c2; +{ +num_list \(**t0, \(**t1, \(**next; + for (t0 = c0; t0; t0 = next) + for (t1 = c1; t1; t1 = t1\->NEXT) + if (t1\->DATA == t0\->DATA) + next = delnum(c0, t0); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR num (3), +.BR addnum (3), +.BR freenum (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delphcon.3 b/alliance/src/mbk/man3/delphcon.3 new file mode 100644 index 00000000..c241950c --- /dev/null +++ b/alliance/src/mbk/man3/delphcon.3 @@ -0,0 +1,70 @@ +.\" $Id: delphcon.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delphcon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delphcon +.XE +.XS0 \n% +.ti 0.2i +delphcon +.XE0 \} +.TH DELPHCON 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +delphcon \- delete a physical connector +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +int delphcon(ptfig, ptcon) +phfig_list \(**ptfig; +phcon_list \(**ptcon; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the connector should be deleted +.TP +\fIptcon\fP +Pointer to the connector to be deleted. +.SH DESCRIPTION +\fBdelphcon\fP delete the connector pointed to by \fIptcon\fP in the figure +pointed to by \fIptfig\fP. +The list and index consistency is maintainded, and the space freed. +.SH RETURN VALUE +\fBdelphcon\fP returns \fB1\fP if the connector has been deleted, \fB0\fP +if no such connector exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +char \(**was_existing(ptfig, ptcon) +phfig_list \(**ptfig; +phcon_list \(**ptcon; +{ + /\(** if only one exists, it's this one \(**/ + return delphcon(ptfig, ptcon) ? "you just killed it!\n" + : "wasn't here anyway\n"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phcon (3), +.BR addphcon (3), +.BR getphcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delphfig.3 b/alliance/src/mbk/man3/delphfig.3 new file mode 100644 index 00000000..c3a582ec --- /dev/null +++ b/alliance/src/mbk/man3/delphfig.3 @@ -0,0 +1,68 @@ +.\" $Id: delphfig.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delphfig +.XE +.XS0 \n% +.ti 0.2i +delphfig +.XE0 \} +.TH DELPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +delphfig \- delete and free a physical figure +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +int delphfig(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the figure to be deleted +.SH DESCRIPTION +\fBdelphfig\fP deletes the figure called \fIfigname\fP from the list of +physical figure in memory. All the lists of elements belonging to the figure +are also deleted and freed. +.SH RETURN VALUE +\fBdelphfig\fP returns \fB1\fP if the figure was delete, and \fB0\fP if no +figure called \fIfigname\fP was present in memory. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void delete_na2_y() +{ + if (delphfig("na2_y")) + (void)fputs("deleted na2_y successfully", stdout); + else + (void)fputs("na2_y not present in ram !", stdout); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR addphfig (3), +.BR getphfig (3), +.BR loadphfig (3), +.BR savephfig (3), +.BR flattenphfig (3), +.BR rflattenphfig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delphins.3 b/alliance/src/mbk/man3/delphins.3 new file mode 100644 index 00000000..e96c98da --- /dev/null +++ b/alliance/src/mbk/man3/delphins.3 @@ -0,0 +1,70 @@ +.\" $Id: delphins.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delphins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delphins +.XE +.XS0 \n% +.ti 0.2i +delphins +.XE0 \} +.TH DELPHINS 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +delphins \- delete a physical instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +int delphins(ptfig, insname) +phfig_list \(**ptfig; +char \(**insname; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the instance should be deleted +.TP +\fIinsname\fP +Name of the instance to be deleted. +.SH DESCRIPTION +\fBdelphins\fP delete the instance called \fIinsname\fP in the figure +pointed to by \fIptfig\fP. This instance is warrantied to be unique, because +its name is an identifier at the given hierarchical level. +The list consistency is maintainded, and the space freed. +.SH RETURN VALUE +\fBdelphins\fP returns \fB1\fP if the instance has been deleted, \fB0\fP +if no such instance exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +char \(**was_existing(ptfig, insname) +phfig_list \(**ptfig; +char \(**insname; +{ + return delphins(ptfig, insname) ? "you just killed it!" + : "wasn't here anyway"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phins (3), +.BR addphins (3), +.BR getphins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delphref.3 b/alliance/src/mbk/man3/delphref.3 new file mode 100644 index 00000000..4dbd575c --- /dev/null +++ b/alliance/src/mbk/man3/delphref.3 @@ -0,0 +1,70 @@ +.\" $Id: delphref.3,v 1.1 2002/03/08 13:51:01 fred Exp $ +.\" @(#)delphref.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delphref +.XE +.XS0 \n% +.ti 0.2i +delphref +.XE0 \} +.TH DELPHREF 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +delphref \- delete a physical reference +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +int delphref(ptfig, ptref) +phfig_list \(**ptfig; +phref_list \(**ptref; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the reference should be deleted +.TP +\fIptref\fP +Pointer to the reference to be deleted. +.SH DESCRIPTION +\fBdelphref\fP delete the reference pointed to by \fIptref\fP in the figure +pointed to by \fIptfig\fP. +The list consistency is maintainded, and the space freed. +.SH RETURN VALUE +\fBdelphref\fP returns \fB1\fP if the reference has been deleted, \fB0\fP +if no such reference exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +char \(**was_existing(ptfig, ptref) +phfig_list \(**ptfig; +phref_list \(**ptref; +{ + /\(** if only one exists, it's this one \(**/ + return delphref(ptfig, ptref) ? "you just killed it!" + : "wasn't here anyway"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phref (3), +.BR addphref (3), +.BR getphref (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delphseg.3 b/alliance/src/mbk/man3/delphseg.3 new file mode 100644 index 00000000..a09bffbe --- /dev/null +++ b/alliance/src/mbk/man3/delphseg.3 @@ -0,0 +1,69 @@ +.\" $Id: delphseg.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)delphseg.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delphseg +.XE +.XS0 \n% +.ti 0.2i +delphseg +.XE0 \} +.TH DELPHSEG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +delphseg \- delete a physical segment +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +int delphseg(ptfig, ptseg) +phfig_list \(**ptfig; +phseg_list \(**ptseg; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the segment should be deleted +.TP +\fIptseg\fP +Pointer to the segment to be deleted +.SH DESCRIPTION +\fBdelphseg\fP delete the segment pointed to by \fIptseg\fP in the figure +pointed to by \fIptfig\fP. +The list consistency is maintainded, and the space freed. +.SH RETURN VALUE +\fBdelphseg\fP returns \fB1\fP if the segment has been deleted, \fB0\fP +if no such segment exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +char \(**was_existing(ptfig, ptseg) +phfig_list \(**ptfig; +phseg_list \(**ptseg; +{ + /\(** if only one exists, it's this one \(**/ + return delphseg(ptfig, ptseg) ? "you just killed it!" + : "wasn't here anyway"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phseg (3), +.BR addphseg (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delphvia.3 b/alliance/src/mbk/man3/delphvia.3 new file mode 100644 index 00000000..6192ea7b --- /dev/null +++ b/alliance/src/mbk/man3/delphvia.3 @@ -0,0 +1,69 @@ +.\" $Id: delphvia.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)delphvia.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delphvia +.XE +.XS0 \n% +.ti 0.2i +delphvia +.XE0 \} +.TH DELPHVIA 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +delphvia \- delete a physical via +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +int delphvia(ptfig, ptvia) +phfig_list \(**ptfig; +phvia_list \(**ptvia; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the via should be deleted +.TP +\fIptvia\fP +Pointer to the via to be deleted. +.SH DESCRIPTION +\fBdelphvia\fP delete the via pointed to by \fIptvia\fP in the figure +pointed to by \fIptfig\fP. +The list consistency is maintainded, and the space freed. +.SH RETURN VALUE +\fBdelphvia\fP returns \fB1\fP if the via has been deleted, \fB0\fP +if no such via exists in the list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +char \(**was_existing(ptfig, ptvia) +phfig_list \(**ptfig; +phvia_list \(**ptvia; +{ + /\(** if only one exists, it's this one \(**/ + return delphvia(ptfig, ptvia) ? "you just killed it!" + : "wasn't here anyway"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phvia (3), +.BR addphvia (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/delptype.3 b/alliance/src/mbk/man3/delptype.3 new file mode 100644 index 00000000..6ffb4e0f --- /dev/null +++ b/alliance/src/mbk/man3/delptype.3 @@ -0,0 +1,84 @@ +.\" $Id: delptype.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)delptype.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +delptype +.XE +.XS4 \n% +.ti 0.2i +delptype +.XE4 \} +.TH DELPTYPE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +delptype \- delete an element of a \fBptype_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +ptype_list \(**delptype(pthead, type) +ptype_list \(**pthead; +long type; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpthead\fP +Pointer to a \fBptype\fP list +.TP +\fItype\fP +The pointer of this type is to be deleted. +.SH DESCRIPTION +\fBdelptype\fP deletes the element of the \fBptype_list\fP that has the type +\fItype\fP in the list pointed to by \fIpthead\fP. +The list consistency is maintained, and the element put back in the list +of free blocks. +.SH RETURN VALUE +\fBdelptype\fP returns a pointer to the new head of list if a \fItype\fPd +pointer used to belong to the list. In most case, it has the value of +\fIpthead\fP. If the \fItype\fP doesn't belong to the list, \fBNULL\fP is +returned. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** delptype impossible : pthead = NULL" +.ft R +.RS +The pointer to the head of list is \fBNULL\fP, and that clear that +such a list can't be ran thru. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mph.h" +void delete_user(ptfig) +phfig_list \(**ptfig; +{ +phins_list \(**i; + for (i = ptfig\->PHINS; i; i = i\->NEXT) + i\->USER = delptype(i\->USER, PLACEABOX); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR ptype (3), +.BR addptype (3), +.BR getptype (3), +.BR freeptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/downstr.3 b/alliance/src/mbk/man3/downstr.3 new file mode 100644 index 00000000..ed643e60 --- /dev/null +++ b/alliance/src/mbk/man3/downstr.3 @@ -0,0 +1,64 @@ +.\" $Id: downstr.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)downstr.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +downstr +.XE +.XS4 \n% +.ti 0.2i +downstr +.XE4 \} +.TH DOWNSTR 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +downstr \- convert a string to lower case +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void downstr(s, t) +char \(**s, \(**t; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIs\fP +Pointer to the source string +.TP +\fIt\fP +Pointer to the destination string +.SH DESCRIPTION +\fBdownstr\fP converts the \fIs\fP string to lower case in \fIt\fP. +The space for \fIt\fP must be allocated by the caller, and be at least +\fBstrlen(s) + 1\fP long. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void cmp() +{ +char \(**s = "PWET", t[5]; + downstr(s, t); + if (strcmp(t, "pwet")) { + fprintf(stderr, "Downstr sucks, man"); + EXIT(); + } +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR upstr (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/filepath.3 b/alliance/src/mbk/man3/filepath.3 new file mode 100644 index 00000000..fff02c03 --- /dev/null +++ b/alliance/src/mbk/man3/filepath.3 @@ -0,0 +1,81 @@ +.\" $Id: filepath.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)filepath.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +filepath +.XE +.XS4 \n% +.ti 0.2i +filepath +.XE4 \} +.TH FILEPATH 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +filepath \- return the whole search path of a file +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**filepath(name, extension) +char \(**name, \(**extension; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIname\fP +Name of the file to be search for +.TP +\fIextension\fP +File extension +.SH DESCRIPTION +\fBfilepath\fP return the absolute path of a cell. +This is useful for error messages, since the caller of mbk file functions +is not able to specify explicitly which file it opened. +Having such an information is also necessary when last modification times or +access times are needed, as for consistency checks. +The file is searched through the environment variable \fBMBK_WORK_LIB\fP(1), +and if not found, through \fBMBK_CATA_LIB\fP(1) in the user defined order. +.br +The file to be searched is called \fIname.extension\fP, if extension is not +\fBNULL\fP, else it is \fIname\fP. If \fIextension\fP is the empty string, +\fB""\fP, then the file name will be \fIname.\fP\ . +.br +.SH RETURN VALUE +\fBfilepath\fP returns \fBNULL\fP on failure, ie the file is not in the pathes, +or the absolute path on success. +The value returned, when not \fBNULL\fP, is stored in a \fBstatic\fP buffer, +so this values is to use at return time or copied into a user buffer. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mut.h" +#include "mph.h" +void vti_error(fig, error) +phfig_list \(**fig; +char *(*error)(); +{ + fprintf(stderr, "Syntax error in %s\\n", filepath(fig->NAME, "cp")); + fprintf(stderr, "%s\\n", error()); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR MBK_WORK_LIB (1), +.BR MBK_CATA_LIB (1), +.BR mbkfopen (3). +.BR mbkunlink (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/flattenlofig.3 b/alliance/src/mbk/man3/flattenlofig.3 new file mode 100644 index 00000000..8980386c --- /dev/null +++ b/alliance/src/mbk/man3/flattenlofig.3 @@ -0,0 +1,87 @@ +.\" $Id: flattenlofig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)flattenlofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +flattenlofig +.XE +.XS3 \n% +.ti 0.2i +flattenlofig +.XE3 \} +.TH FLATTENLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +flattenlofig \- flatten a instance in a logical figure +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void flattenlofig(ptfig, insname, concat) +lofig_list \(**ptfig; +char \(**insname; +char concat; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to a logical figure +.TP +\fIinsname\fP +Name of the instance to be flattened +.TP +\fIconcat\fP +Name generation mode +.SH DESCRIPTION +\fBflattenlofig\fP flattens the instance called \fIinsname\fP in the figure +pointed to by \fIptfig\fP. Flattening means incorporating the +contents of the instance in the figure and removing it from its instance list. +.br +the \fIconcat\fP argument can take either the value \fBYES\fP in which case the +name of the objects comming from the instance are named +\fIinsname'X'objectname\fP, where \fI'X'\fP is the caracter set int the +\fBMBK_SEPAR\fP(1) environment variable, or the value \fBNO\fP, and then the +object name remains inchanged. This is quite dangerous since name unicity is +no more warrantied, and may cause the flatten to fail. See \fBMBK_SEPAR\fP(1), +\fBmbkenv\fP(3) and \fBconcatname\fP(3) for details. +.SH ERRORS +No errors can directly result from a call to \fBflattenlofig\fP, but since it +uses many other mbk functions, it may be an error starting point. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void flatten_na2_y_s(ptfig) +lofig_list \(**ptfig; +{ +loins_list \(**pt; + for (pt = ptfig\->LOINS; pt; pt = pt\->NEXT) /\(** scan instance list \(**/ + if (!strcmp(pt\->FIGNAME, "na2_y")) + flattenlofig(ptfig, pt\->INSNAME, NO); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR lofig (3), +.BR addlofig (3), +.BR getlofig (3), +.BR dellofig (3), +.BR loadlofig (3), +.BR savelofig (3), +.BR rflattenlofig (3), +.BR MBK_SEPAR (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/flattenphfig.3 b/alliance/src/mbk/man3/flattenphfig.3 new file mode 100644 index 00000000..e3372b3e --- /dev/null +++ b/alliance/src/mbk/man3/flattenphfig.3 @@ -0,0 +1,87 @@ +.\" $Id: flattenphfig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)flatenphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +flattenphfig +.XE +.XS1 \n% +.ti 0.2i +flattenphfig +.XE1 \} +.TH FLATTENPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +flatenphfig \- flatten a instance in a figure +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void flatenphfig(ptfig, insname, concat) +phfig_list \(**ptfig; +char \(**insname; +char concat; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to a physical figure +.TP +\fIinsname\fP +Name of the instance to be flattened +.TP +\fIconcat\fP +Name generation mode +.SH DESCRIPTION +\fBflatenphfig\fP flattens the instance called \fIinsname\fP in the figure +pointed to by \fIptfig\fP. Flattening means incorporating the +contents of the instance in the figure and removing it from its instance list. +.br +the \fIconcat\fP argument can take either the value \fBYES\fP in which case the +name of the object comming from the instance are named +\fIinsname'X'objectname\fP, where \fI'X'\fP is the caracter set int the +\fBMBK_SEPAR\fP(1) environment variable, or the value \fBNO\fP, and then the +object name remains inchanged. This is quite dangerous since name unicity is +no more warrantied, and may cause the flatten to fail. See \fBMBK_SEPAR(1)\fP, +\fBmbkenv(3)\fP and \fBconcatname(3)\fP for details. +.SH ERRORS +No errors can directly result from a call to \fBflatenphfig\fP, but since it +uses many other mbk functions, it may be an error starting point. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void flatten_na2_y_s(ptfig) +phfig_list \(**ptfig; +{ +phins_list \(**pt; + for (pt = ptfig\->PHINS; pt; pt = pt\->NEXT) /\(** scan instance list \(**/ + if (!strcmp(pt\->FIGNAME, "na2_y")) + flatenphfig(ptfig, pt\->INSNAME, NO); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR phfig (3), +.BR addphfig (3), +.BR getphfig (3), +.BR delphfig (3), +.BR loadphfig (3), +.BR savephfig (3), +.BR rflatenphfig (3), +.BR MBK_SEPAR (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/freechain.3 b/alliance/src/mbk/man3/freechain.3 new file mode 100644 index 00000000..4d83c39d --- /dev/null +++ b/alliance/src/mbk/man3/freechain.3 @@ -0,0 +1,63 @@ +.\" $Id: freechain.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)freechain.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +freechain +.XE +.XS4 \n% +.ti 0.2i +freechain +.XE4 \} +.TH FREECHAIN 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +freechain \- free a \fBchain_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void freechain(pt) +chain_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBchain\fP list to be freed +.SH DESCRIPTION +\fBfreechain\fP frees the \fBchain_list\fP pointed to by \fIpt\fP. +All the elements of the list are put back in the list of free blocks. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void free_from(c, i) /\(** erase list from ith element \(**/ +chain_list \(**c; +int i; +{ +chain_list \(**t; + while (i--) + c = c\->NEXT; + t = c\->NEXT, c\->NEXT = NULL; + freechain(t); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR chain (3), +.BR addchain (3), +.BR delchain (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/freelomodel.3 b/alliance/src/mbk/man3/freelomodel.3 new file mode 100644 index 00000000..6c829664 --- /dev/null +++ b/alliance/src/mbk/man3/freelomodel.3 @@ -0,0 +1,57 @@ +.\" $Id: freelomodel.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)freelomodel.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +freelomodel +.XE +.XS2 \n% +.ti 0.2i +freelomodel +.XE2 \} +.TH FREELOMODEL 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +freelomodel \- free a \fBlofig_list\fP for temporary models +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void freelomodel(ptmodel) +lofig_list \(**ptmodel; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptmodel\fP +Pointer to the model list to be freed +.SH DESCRIPTION +\fBfreelomodel\fP free the \fBlofig_list\fP pointed to by \fIptmodel\fP. +All the elements of the list are given back to the system. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void end_of_parse() /\(** erase model list \(**/ +{ + freelomodel(MODEL); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR addlomodel (3), +.BR getlomodel (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/freenum.3 b/alliance/src/mbk/man3/freenum.3 new file mode 100644 index 00000000..73c9d59f --- /dev/null +++ b/alliance/src/mbk/man3/freenum.3 @@ -0,0 +1,62 @@ +.\" $Id: freenum.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)freenum.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +freenum +.XE +.XS4 \n% +.ti 0.2i +freenum +.XE4 \} +.TH FREENUM 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +freenum \- free a \fBnum_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void freenum(pt) +num_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBnum\fP list to be freed +.SH DESCRIPTION +\fBfreenum\fP frees the \fBnum_list\fP pointed to by \fIpt\fP. +All the elements of the list are put back in the list of free blocks. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void free_from(c, i) /\(** erase list from ith element \(**/ +num_list \(**c; +int i; +{ +num_list \(**t; + while (i--) + c = c\->NEXT; + t = c\->NEXT, c\->NEXT = NULL; + freenum(t); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR num (3), +.BR addnum (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/freeptype.3 b/alliance/src/mbk/man3/freeptype.3 new file mode 100644 index 00000000..992f4aa7 --- /dev/null +++ b/alliance/src/mbk/man3/freeptype.3 @@ -0,0 +1,64 @@ +.\" $Id: freeptype.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)freeptype.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +freeptype +.XE +.XS4 \n% +.ti 0.2i +freeptype +.XE4 \} +.TH FREEPTYPE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +freeptype \- free a \fBptype_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +ptype_list \(**freeptype(pt) +ptype_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the ptype list to be freed +.SH DESCRIPTION +\fBfreeptype\fP frees the \fBptype_list\fP pointed to by \fIpt\fP. +All the elements of the list are put back in the list of free blocks. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void free_from(c, i) /\(** erase list from ith element \(**/ +ptype_list \(**c; +int i; +{ +ptype_list \(**t; + while (i--) + c = c\->NEXT; + t = c\->NEXT, c\->NEXT = NULL; + freeptype(t); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR ptype (3), +.BR addptype (3), +.BR getptype (3), +.BR delptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/gethtitem.3 b/alliance/src/mbk/man3/gethtitem.3 new file mode 100644 index 00000000..730c4723 --- /dev/null +++ b/alliance/src/mbk/man3/gethtitem.3 @@ -0,0 +1,87 @@ +.\" $Id: gethtitem.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)gethtitem.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun +.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92 +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +gethtitem +.XE +.XS4 \n% +.ti 0.2i +gethtitem +.XE4 \} +.TH GETHTITEM 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS" +.SH NAME +gethtitem \- searches an item in a hash table +.so man1/alc_origin.1 +.SH SYNOPSYS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +int gethtitem(table, key) +ht \(**table; +void \(**key; +.fi +.ft R +.SH PARAMETERS +.TP 20 +\fItable\fP +Hash table pointer +.TP 20 +\fIkey\fP +Key used by the hash coding function +.SH DESCRIPTION +\fBgethtitem()\fP searches an item in the hash table pointed to by \fItable\fP. +.SH RETURN VALUE +If the key \fIkey\fP exists, the associated value is returned, +if it doesn't, the function returns \fBEMPTYHT\fP. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include +#include "mut.h" +check(p) +losig_list *p; +{ +char *amatla; +losig_list *ptsig; +locon_list *ptcon; +ht *h; + for (i = 0, ptsig = p->LOSIG; ptsig; i++, ptsig = ptsig->NEXT); + h = addht(i); + /* two connectors can't have the same name! */ + for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT) + addhtitem(h, ptcon->NAME, 0); + for (ptsig = p->LOSIG; ptsig; ptsig = ptsig->NEXT) { + if (ptsig->TYPE == INTERNAL) { + amatla = getsigname(ptsig); + /* this is nicely done with sethtitem! */ + if (gethtitem(h, amatla) == EMPTYHT) { + printf("N %s;\\n", amatla); + addhtitem(h, amatla, 0); + } + } + } + delht(); +} +.fi +.ft R +.SH SEE ALSO +.BR mbk (1), +.BR addht (3), +.BR delht (3), +.BR addhtitem (3), +.BR delhtitem (3), +.BR viewht (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getlocon.3 b/alliance/src/mbk/man3/getlocon.3 new file mode 100644 index 00000000..1e8c551d --- /dev/null +++ b/alliance/src/mbk/man3/getlocon.3 @@ -0,0 +1,77 @@ +.\" $Id: getlocon.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getlocon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getlocon +.XE +.XS2 \n% +.ti 0.2i +getlocon +.XE2 \} +.TH GETLOCON 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +getlocon \- retrieve a logical connector +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +locon_list \(**getlocon(ptfig, name) +lofig_list \(**ptfig; +char \(**name; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the connector should be seeked +.TP +\fIname\fP +Name of the connector +.SH DESCRIPTION +\fBgetlocon\fP looks in the list of connectors of the logical model pointed +to by \fIptfig\fP for a connector identified by its \fIname\fP, since it +should be unique at a given hierachical level. +.SH RETURN VALUE +\fBgetlocon\fP returns a pointer to the given connector. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** getlocon impossible : +connector \fIname\fP doesn't exist in figure \fIptfig\->NAME\fP" +.ft R +.RS +No connector matches the name. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +locon_list \(**exist(figname, conname) +char \(**figname, \(**conname; +{ + return getlocon(getlofig(figname), conname); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR locon (3), +.BR addlocon (3), +.BR dellocon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getlofig.3 b/alliance/src/mbk/man3/getlofig.3 new file mode 100644 index 00000000..d0f3ca93 --- /dev/null +++ b/alliance/src/mbk/man3/getlofig.3 @@ -0,0 +1,81 @@ +.\" $Id: getlofig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getlofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getlofig +.XE +.XS3 \n% +.ti 0.2i +getlofig +.XE3 \} +.TH GETLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +getlofig \- give back a pointer to a \fIlofig\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +lofig_list \(**getlofig(figname, mode) +char \(**figname; +char mode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIfigname\fP +Name of the figure to be created +.TP +\fImode\fP +Demanded mode for the figure +.SH DESCRIPTION +\fBgetlofig\fP returns a pointer to the figure called \fIfigname\fP with the +warranty that the expected information is present in memory. +.br +If \fImode\fP is \fB'A'\fP then the figure has all its lists filled, else +the figure may either be complete or interface only. +.br +This function allows to completly mask disk access for applications +programs. If the figure is in memory, with the specified \fImode\fP, +then the function returns the appropriate pointer. Else, the function performs +a call to the \fBloadlofig(3)\fP and returns a pointer to the loaded +figure. +.SH RETURN VALUE +\fBgetlofig\fP returns a pointer to the wanted figure. +.SH ERRORS +\fBgetlofig\fP cannot give any errors, but the subsequent calls it performs +to parsers do. So the source of trouble may be the call to \fBgetlofig\fP. +See \fBloadlofig\fP(3) for details. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +lofig_list \(**na2_y() +{ + /\(** find in memory or load from disk na2_y \(**/ + return getlofig("na2_y", 'A'); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR addlofig (3), +.BR dellofig (3), +.BR loadlofig (3), +.BR savelofig (3), +.BR flattenlofig (3), +.BR rflattenlofig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getloins.3 b/alliance/src/mbk/man3/getloins.3 new file mode 100644 index 00000000..0b8f4854 --- /dev/null +++ b/alliance/src/mbk/man3/getloins.3 @@ -0,0 +1,78 @@ +.\" $Id: getloins.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getloins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getloins +.XE +.XS2 \n% +.ti 0.2i +getloins +.XE2 \} +.TH GETLOINS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +getloins \- retrieve a logical instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +loins_list \(**getloins(ptfig, name) +lofig_list \(**ptfig; +char \(**name; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the instance should be seeked +.TP +\fIname\fP +Name of the instance +.SH DESCRIPTION +\fBgetloins\fP looks in the list of instances of the logical model pointed +to by \fIptfig\fP for a instance identified by its \fIname\fP. This instance +is unique, since the \fIname\fP is the instance identifier. +.SH RETURN VALUE +\fBgetloins\fP returns a pointer to the instance that matches the +\fIname\fP. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal getloins instance \fIname\fP doesn't exist +in figure \fIptfig\->NAME\fP" +.ft R +.RS +No instance is called \fIname\fP in the figure. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +loins_list \(**get_ins_by_name(figname, insname) +char \(**figname, \(**insname; +{ + return getloins(getlofig(figname), insname); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR loins (3), +.BR addloins (3), +.BR delloins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getlomodel.3 b/alliance/src/mbk/man3/getlomodel.3 new file mode 100644 index 00000000..b861d4ed --- /dev/null +++ b/alliance/src/mbk/man3/getlomodel.3 @@ -0,0 +1,68 @@ +.\" $Id: getlomodel.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getlomodel.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getlomodel +.XE +.XS2 \n% +.ti 0.2i +getlomodel +.XE2 \} +.TH GETLOMODEL 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +getlomodel \- retrieve a model from a \fBlofig_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +lofig_list \(**getlomodel(model, name) +lofig_list \(**model; +char \(**name; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fImodel\fP +Pointer to a lofig list +.TP +\fIname\fP +String indicating the model to be looked for +.SH DESCRIPTION +\fBgetlomodel\fP seeks a \fBlofig\fP element in the list pointed to by +\fImodel\fP. +.SH RETURN VALUE +\fBgetlomodel\fP returns a pointer to the \fBlofig\fP that match the \fIname\fP. +If no \fBlofig\fP has the given \fIname\fP, then \fBNULL\fP is returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +locon_list *get_model_cons(model, name) +lofig_list \(**model; +char \(**name; +{ +lofig_list \(**p = getlomodel(model, name); + return p ? p\->LOCON : NULL; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR addlomodel (3), +.BR freelomodel (3), +.BR dellomodel (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getlosig.3 b/alliance/src/mbk/man3/getlosig.3 new file mode 100644 index 00000000..84be2b46 --- /dev/null +++ b/alliance/src/mbk/man3/getlosig.3 @@ -0,0 +1,79 @@ +.\" $Id: getlosig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getlosig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getlosig +.XE +.XS2 \n% +.ti 0.2i +getlosig +.XE2 \} +.TH GETLOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +getlosig \- retrieve a logical signal +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +losig_list \(**getlosig(ptfig, index) +lofig_list \(**ptfig; +long index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the signal should be seeked +.TP +\fIindex\fP +Index of the signal +.SH DESCRIPTION +\fBgetlosig\fP looks in the list of signals of the logical model pointed +to by \fIptfig\fP for a signal identified by its \fIindex\fP. This signal +is unique, since the \fIindex\fP is the signal identifier. +.SH RETURN VALUE +\fBgetlosig\fP returns a pointer to the signal that matches the +\fIindex\fP. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal getlosig signal \fIindex\fP doesn't exist +in figure \fIptfig\->NAME\fP" +.ft R +.RS +No signal has \fIindex\fP as \fIINDEX\fP in the figure. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +losig_list \(**get_sig_by_name(figname, index) +char \(**figname; +long index; +{ + return getlosig(getlofig(figname), index); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR losig (3), +.BR addlosig (3), +.BR dellosig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getphcon.3 b/alliance/src/mbk/man3/getphcon.3 new file mode 100644 index 00000000..b6758da4 --- /dev/null +++ b/alliance/src/mbk/man3/getphcon.3 @@ -0,0 +1,83 @@ +.\" $Id: getphcon.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getphcon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getphcon +.XE +.XS0 \n% +.ti 0.2i +getphcon +.XE0 \} +.TH GETPHCON 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +getphcon \- retrieve a physical connector +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phcon_list \(**getphcon(ptfig, conname, index) +phfig_list \(**ptfig; +char \(**conname; +long index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the connector should be seeked +.TP +\fIconname\fP +Name of the connector +.TP +\fIindex\fP +Connector index +.SH DESCRIPTION +\fBgetphcon\fP looks in the list of connectors of the physical model pointed +to by \fIptfig\fP for a connector identified by its \fIconname\fP and +\fIindex\fP. Both are needed to make sure the right connector is given back +since \fIn\fP internally wired connectors have the same name. +.SH RETURN VALUE +\fBgetphcon\fP returns a pointer to the given connector. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal getphcon connector \fIconname.index\fP +doesn't exist in figure \fIptfig\->NAME\fP" +.ft R +.RS +No connectors match both arguments. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phcon_list \(**exist(figname, conname) +char \(**figname, \(**conname; +{ + /\(** if only one exists, it's this one \(**/ + return getphcon(getphfig(figname), conname, 0L); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phcon (3), +.BR addphcon (3), +.BR delphcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getphfig.3 b/alliance/src/mbk/man3/getphfig.3 new file mode 100644 index 00000000..dbabc931 --- /dev/null +++ b/alliance/src/mbk/man3/getphfig.3 @@ -0,0 +1,80 @@ +.\" $Id: getphfig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getphfig +.XE +.XS1 \n% +.ti 0.2i +getphfig +.XE1 \} +.TH GETPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +getphfig \- give back a pointer to a \fIphfig\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phfig_list \(**getphfig(figname, mode) +char \(**figname; +char mode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIfigname\fP +Name of the figure to be created +\fImode\fP +Demanded mode for the figure +.SH DESCRIPTION +\fBgetphfig\fP returns a pointer to the figure called \fIfigname\fP with the +warranty that the expected information is present in memory. +.br +If \fImode\fP is \fB'A'\fP then the figure has all its lists filled, else +the figure may either be complete or interface only. +.br +This function allows to completly mask disk access for applications +programs. If the figure is in memory, with the specified \fImode\fP, +then the function returns the appropriate pointer. Else, the function performs +a call to the \fBloadphfig\fP(3) and returns a pointer to the loaded +figure. +.SH RETURN VALUE +\fBgetphfig\fP returns a pointer to the wanted figure. +.SH ERRORS +\fBgetphfig\fP cannot give any errors, but the subsequent calls it performs +to parsers do. So the source of trouble may be the call to \fBgetphfig\fP. +See \fBloadphfig\fP(3) for details. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phfig_list \(**na2_y() +{ + /\(** find in memory or load from disk na2_y \(**/ + return getphfig("na2_y", 'A'); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR addphfig (3), +.BR delphfig (3), +.BR loadphfig (3), +.BR savephfig (3), +.BR flattenphfig (3), +.BR rflattenphfig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getphins.3 b/alliance/src/mbk/man3/getphins.3 new file mode 100644 index 00000000..4daafafe --- /dev/null +++ b/alliance/src/mbk/man3/getphins.3 @@ -0,0 +1,77 @@ +.\" $Id: getphins.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getphins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getphins +.XE +.XS0 \n% +.ti 0.2i +getphins +.XE0 \} +.TH GETPHINS 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +getphins \- retrieve a physical instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phins_list \(**getphins(ptfig, insname) +phfig_list \(**ptfig; +char \(**insname; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the instance should be seeked +.TP +\fIinsname\fP +Name of the instance +.SH DESCRIPTION +\fBgetphins\fP looks in the list of instances of the physical model pointed +to by \fIptfig\fP for a instance identified by its \fIinsname\fP. +.SH RETURN VALUE +\fBgetphins\fP returns a pointer to the instance that matches the +\fIinsname\fP. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal getphins instance \fIinsname\fP doesn't exist +in figure \fIptfig\->NAME\fP" +.ft R +.RS +No instance is called \fIinsname\fP in the figure. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phins_list \(**exist(figname, insname) +char \(**figname, \(**insname; +{ + return getphins(getphfig(figname), insname); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phins (3), +.BR addphins (3), +.BR delphins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getphref.3 b/alliance/src/mbk/man3/getphref.3 new file mode 100644 index 00000000..33320bf1 --- /dev/null +++ b/alliance/src/mbk/man3/getphref.3 @@ -0,0 +1,77 @@ +.\" $Id: getphref.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getphref.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getphref +.XE +.XS0 \n% +.ti 0.2i +getphref +.XE0 \} +.TH GETPHREF 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +getphref \- retrieve a physical reference +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phref_list \(**getphref(ptfig, refname) +phfig_list \(**ptfig; +char \(**refname; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the reference should be seeked +.TP +\fIrefname\fP +Name of the reference +.SH DESCRIPTION +\fBgetphref\fP looks in the list of references of the physical model pointed +to by \fIptfig\fP for a reference identified by its \fIrefname\fP. +.SH RETURN VALUE +\fBgetphref\fP returns a pointer to the reference that matches the +\fIrefname\fP. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** illegal getphref reference \fIrefname\fP doesn't exist +in figure \fIptfig\->NAME\fP" +.ft R +.RS +No reference is called \fIrefname\fP in the figure. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phref_list \(**exist(figname, refname) +char \(**figname, \(**refname; +{ + return getphref(getphfig(figname), refname); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phref (3), +.BR addphref (3), +.BR delphref (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getptype.3 b/alliance/src/mbk/man3/getptype.3 new file mode 100644 index 00000000..db2b7a39 --- /dev/null +++ b/alliance/src/mbk/man3/getptype.3 @@ -0,0 +1,73 @@ +.\" $Id: getptype.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getptype.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getptype +.XE +.XS4 \n% +.ti 0.2i +getptype +.XE4 \} +.TH GETPTYPE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +getptype \- retrieve a \fBptype\fP from a \fBptype_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +ptype_list \(**getptype(pthead,type) +ptype_list \(**pthead; +long type; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpthead\fP +Pointer to a \fBptype\fP list +.TP +\fItype\fP +Flag indicating the pointer owner +.SH DESCRIPTION +\fBgetptype\fP looks for a \fBptype\fP element in the list pointed to by +\fIpthead\fP. +.SH RETURN VALUE +\fBgetptype\fP returns a pointer to the \fBptype\fP that match the \fItype\fP. +Be careful, it is not the \fIptype\->DATA\fP that is returned. +If no \fBptype\fP has the given \fItype\fP, then \fBNULL\fP is returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mph.h" +void get_corner(ptfig, name, x2, y2) +phfig_list \(**ptfig; +char \(**name; +int \(**x2, \(**y2; +{ +phins_list \(**i = getphins(ptfig, name); +ptype_list \(**p = getptype(i\->USER, (long)PLACEABOX); + \(**x2 = (num_list \(**)(p\->DATA)\->DATA; + \(**y2 = (num_list \(**)(p\->DATA)\->NEXT\->DATA; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR ptype (3), +.BR addptype (3), +.BR freeptype (3), +.BR delptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/getsigname.3 b/alliance/src/mbk/man3/getsigname.3 new file mode 100644 index 00000000..6817bf09 --- /dev/null +++ b/alliance/src/mbk/man3/getsigname.3 @@ -0,0 +1,60 @@ +.\" $Id: getsigname.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)getsigname.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +getsigname +.XE \} +.TH GETSIGNAME 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +getsigname \- choose a signal name in alias list +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +char \(**getsigname(ptsig) +losig_list \(**ptsig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptsig\fP +Pointer to \fBlosig_list\fP +.SH DESCRIPTION +The \fBgetsigname\fP function choose the higher hierachical level name of the +alias list of a signal. +The alias list is pointer to by the \fINAMECHAIN\fP pointer of the \fBlosig\fP +structure, and contains zero or more names corresponding to the signal. +Since the signal may result from a flatten, instance names may be concatenated +to the actual signal name. +.SH RETURN VALUE +\fBgetsigname\fP returns the higher hierachy level name, if +\fIptsig\->NAMECHAIN\fP is not \fBNULL\fP, else a name constructed with +the signal \fBINDEX\fP is returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void print_signame(p) +losig_list \(**p; +{ + fprintf(stdout, "signal name : %s\\n", getsigname(p)); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR losig (3), +.BR chain (3). + + +.so man1/alc_bug_report.1 diff --git a/alliance/src/mbk/man3/givelosig.3 b/alliance/src/mbk/man3/givelosig.3 new file mode 100644 index 00000000..6a3b07c7 --- /dev/null +++ b/alliance/src/mbk/man3/givelosig.3 @@ -0,0 +1,70 @@ +.\" $Id: givelosig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)givelosig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +givelosig +.XE +.XS3 \n% +.ti 0.2i +givelosig +.XE3 \} +.TH GIVELOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +givelosig \- give a logical signal +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +losig_list \(**givelosig(ptfig, index) +lofig_list \(**ptfig; +long index; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to the figure in which the signal should be seeked or created +.TP +\fIindex\fP +Index of the signal to find or create +.SH DESCRIPTION +\fBgivelosig\fP looks in the list of signals of the logical model pointed +to by \fIptfig\fP for a signal identified by its \fIindex\fP. If this signal +exists, then its pointer is returned, else, the signal is created, with +direction, \fIDIR\fP, \fBUNKNOWN\fP, and \fITYPE\fP \fBINTERNAL\fP, and, of +course \fIINDEX\fP \fIindex\fP, and the pointer is returned. +.SH RETURN VALUE +\fBgivelosig\fP returns a pointer to the signal. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +losig_list \(**give_sig_by_name(figname, index) +char \(**figname; +long index; +{ + /\(** never fails \(**/ + return givelosig(getlofig(figname), index); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR losig (3), +.BR addlosig (3), +.BR dellosig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/guessextdir.3 b/alliance/src/mbk/man3/guessextdir.3 new file mode 100644 index 00000000..40528e9a --- /dev/null +++ b/alliance/src/mbk/man3/guessextdir.3 @@ -0,0 +1,86 @@ +.\" $Id: guessextdir.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)guessextdir.2 1.00 92/10/27 ; Labo masi cao-vlsi; Author : Vincent POUILLEY +.\"modified by Frederic Petrot to meet english language requirements! +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +guessextdir +.XE +.XS2 \n% +.ti 0.2i +guessextdir +.XE2 \} +.TH GUESSEXTDIR 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +guessextdir \- guess external connectors directions from internal connectors directions +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int guessextdir(ptfig) +lofig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to a lofig_list +.SH DESCRIPTION +The \fBguessextdir\fP function guesses external connectors directions from +internal connectors' ones. +The translation table below indicates the resulting direction +for two internals connectors. +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} + IN OUT INOUT UNKNOWN TRISTATE TRANSCV +IN IN INOUT INOUT IN TRANSCV TRANSCV +OUT INOUT OUT+ INOUT+ OUT OUT+ TRANSCV+ +INOUT INOUT INOUT+ INOUT+ INOUT INOUT+ INOUT+ +UNKNOWN IN OUT INOUT UNKNOWN TRISTATE TRANSCV +TRISTATE TRANSCV OUT+ INOUT+ TRISTATE TRISTATE TRANSCV +TRANSCV TRANSCV TRANSCV+ INOUT+ TRANSCV TRANSCV TRANSCV +.SH RETURN VALUE +\fBguessextdir\fP returns \fB1\fP on success, \fB0\fP +if there is an error in the translation. +.SH ERROR +The values followed by a \fB+\fP character in the translation table indicate +an error. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +lofig_list \(** getgoodlofig(figname, mode) +char \(**figname; +char mode; +{ +lofig_list \(**ptfig; + ptfig = getlofig(figname, mode); + restorealldir(ptfig); + guessextdir(ptfig); + return ptfig; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR locon (3), +.BR getlofig (3), +.BR restorealldir (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/incatalog.3 b/alliance/src/mbk/man3/incatalog.3 new file mode 100644 index 00000000..2f4d6354 --- /dev/null +++ b/alliance/src/mbk/man3/incatalog.3 @@ -0,0 +1,75 @@ +.\" $Id: incatalog.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)incatalog.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +incatalog +.XE +.XS4 \n% +.ti 0.2i +incatalog +.XE4 \} +.TH INCATALOG 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +incatalog \- test if cell belongs to the catalog file +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +int incatalog(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the cell to be checked +.SH DESCRIPTION +\fBincatalog\fP checks a cell represented by its \fIfigname\fP beeing +present in the catalog file with the \fB'C'\fP attribut. +.br +This means that when flattening, the hierachy destruction stops when +encountering a cell belonging to the catalog. +This is meant for both logical and physical views, of course. +.br +The catalog is the sum of all the catalogs of the cells libraries specified +in the \fBMBK_CATA_LIB\fP(1) and \fBMBK_WORK_LIB\fP(1). +The catalogs of the \fBMBK_CATA_LIB\fP(1) are the files called \fBCATAL\fP, +and the \fBMBK_WORK_LIB\fP(1) is by default \fBCATAL\fP but can be changed +to \fBMBK_CATAL_NAME\fP(1). +.SH RETURN VALUE +\fBincatalog\fP returns \fB0\fP if the cell does not belong to the catalog +with the \fB'C'\fP attribut, +a value different from \fB0\fP if it does. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**tell_if_incatalog(name) +char \(**name; +{ + return incatalog(name) ? "Jawohl, mein Herr" : "Nein, danke"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR incatalogfeed (3), +.BR incatalogdelete (3), +.BR incataloggds (3), +.BR MBK_CATAL_NAME (1), +.BR MBK_CATA_LIB (1), +.BR MBK_WORK_LIB (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/incatalogdelete.3 b/alliance/src/mbk/man3/incatalogdelete.3 new file mode 100644 index 00000000..2e41b1f1 --- /dev/null +++ b/alliance/src/mbk/man3/incatalogdelete.3 @@ -0,0 +1,71 @@ +.\" $Id: incatalogdelete.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)incatalogdelete.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +incatalogdelete +.XE +.XS4 \n% +.ti 0.2i +incatalogdelete +.XE4 \} +.TH INCATALOGDELETE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +incatalogdelete \- test if cell belongs to the catalog file +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +int incatalogdelete(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the cell to be checked +.SH DESCRIPTION +\fBincatalogdelete\fP checks a cell represented by its \fIfigname\fP beeing +present in the catalog file with the \fB'D'\fP attribut. +This means that the cell is to be deleted from the catalog. +\fBincatalogdelete\fP returns \fB0\fP if the cell does not belong to the +catalog with the \fB'D'\fP attribut, \fB1\fP if it does. +.br +The catalog is the sum of all the catalogs of the cells libraries specified +in the \fBMBK_CATA_LIB\fP(1) and \fBMBK_WORK_LIB\fP(1). +The catalogs of the \fBMBK_CATA_LIB\fP(1) are the files called \fBCATAL\fP, +and the \fBMBK_WORK_LIB\fP(1) is by default \fBCATAL\fP but can be changed +to \fBMBK_CATAL_NAME\fP(1). +.SH RETURN VALUE +\fBincatalogdelete\fP returns \fB0\fP if the cell does not belong to the +catalog with the \fB'D'\fP attribut, +a value different from \fB0\fP if it does. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**tell_if_incatalogdelete(name) +char \(**name; +{ + return incatalogdelete(name) ? "Not checked for catalog" : "Checked"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR incatalog (3), +.BR incatalogfeed (3). +.BR incataloggds (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/incatalogfeed.3 b/alliance/src/mbk/man3/incatalogfeed.3 new file mode 100644 index 00000000..5e202c45 --- /dev/null +++ b/alliance/src/mbk/man3/incatalogfeed.3 @@ -0,0 +1,73 @@ +.\" $Id: incatalogfeed.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)incatalogfeed.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +incatalogfeed +.XE +.XS4 \n% +.ti 0.2i +incatalogfeed +.XE4 \} +.TH INCATALOGFEED 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +incatalogfeed \- test if cell belongs to the catalog file +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +int incatalogfeed(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the cell to be checked +.SH DESCRIPTION +\fBincatalogfeed\fP checks a cell represented by its \fIfigname\fP beeing +present in the catalog file with the \fI'F'\fP attribut. +This means that the cell is a feed through, and does not have a logical +equivalent representation while beeing physicaly used. +.br +This information is mostly needed by routers, since \fI"logical feed through"\fP +has no design meaning. +.br +The catalog is the sum of all the catalogs of the cells libraries specified +in the \fBMBK_CATA_LIB\fP(1) and \fBMBK_WORK_LIB\fP(1). +The catalogs of the \fBMBK_CATA_LIB\fP(1) are the files called \fBCATAL\fP, +and the \fBMBK_WORK_LIB\fP(1) is by default \fBCATAL\fP but can be changed +to \fBMBK_CATAL_NAME\fP(1). +.SH RETURN VALUE +\fBincatalogfeed\fP returns \fB0\fP if the cell does not belong to the +catalog with the \fB'F'\fP attribut, +a value different from \fB0\fP if it does. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**tell_if_incatalogfeed(name) +char \(**name; +{ + return incatalogfeed(name) ? "Jawohl, mein Herr" : "Nein, danke"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR incatalog (3), +.BR incatalogdelete (3), +.BR incataloggds (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/incataloggds.3 b/alliance/src/mbk/man3/incataloggds.3 new file mode 100644 index 00000000..2928c650 --- /dev/null +++ b/alliance/src/mbk/man3/incataloggds.3 @@ -0,0 +1,74 @@ +.\" $Id: incataloggds.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)incataloggds.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +incataloggds +.XE +.XS4 \n% +.ti 0.2i +incataloggds +.XE4 \} +.TH INCATALOGGDS 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +incataloggds \- test if cell belongs to the catalog file +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +int incataloggds(figname) +char \(**figname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIfigname\fP +Name of the cell to be checked +.SH DESCRIPTION +\fBincataloggds\fP checks a cell represented by its \fIfigname\fP beeing +present in the catalog file with the \fB'G'\fP attribut. +This means that the cell is a phantom of a gds cell. +.br +This is useful when traducing a symbolic layout into physical one, because +then the \fB'G'\fP attribued cells are not to be translated, but just replaced +in the output. +This is mostly used for pads. +.br +The catalog is the sum of all the catalogs of the cells libraries specified +in the \fBMBK_CATA_LIB\fP(1) and \fBMBK_WORK_LIB\fP(1). +The catalogs of the \fBMBK_CATA_LIB\fP(1) are the files called \fBCATAL\fP, +and the \fBMBK_WORK_LIB\fP(1) is by default \fBCATAL\fP but can be changed +to \fBMBK_CATAL_NAME\fP(1). +.SH RETURN VALUE +\fBincataloggds\fP returns \fB0\fP if the cell does not belong to the +catalog with the \fB'G'\fP attribut, +a value different from \fB0\fP if it does. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**tell_if_incataloggds(name) +char \(**name; +{ + return incataloggds(name) ? "Jawohl, es ist ein pad" : "Nein, keine"; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR incatalog (3), +.BR incatalogdelete (3), +.BR incatalogfeed (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/instanceface.3 b/alliance/src/mbk/man3/instanceface.3 new file mode 100644 index 00000000..7f75ec0c --- /dev/null +++ b/alliance/src/mbk/man3/instanceface.3 @@ -0,0 +1,80 @@ +.\" $Id: instanceface.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)instanceface.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +instanceface +.XE +.XS1 \n% +.ti 0.2i +instanceface +.XE1 \} +.TH INSTANCEFACE 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +instanceface \- returns the face of a connector in a placed instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void \(**instanceface(modelface, symmetry) +char modelface, symmetry; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fImodelface\fP +Face of a connector in its figure. +.TP 20 +\fIsymmetry\fP +Geometrical operation applied to the instanciation of the figure. +.SH DESCRIPTION +\fBinstanceface\fP determines the orientation of a connector in an instance of +its model. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +char channelFace(channelDir, i, c) +char channelDir; +phins_list *i; +phcon_list *c; +{ + if (channelDir == VER) + switch (instanceface(c->ORIENT, i->TRANSF)) { + case EAST : + return WEST; + case WEST : + return EAST; + default : + return instanceface(c->ORIENT, i->TRANSF); + } + else + switch (instanceface(c->ORIENT, i->TRANSF)) { + case NORTH : + return SOUTH; + case SOUTH : + return NORTH; + default : + return instanceface(c->ORIENT, i->TRANSF); + } +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phcon (3), +.BR phfig (3), +.BR phins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/instr.3 b/alliance/src/mbk/man3/instr.3 new file mode 100644 index 00000000..8c2a6db1 --- /dev/null +++ b/alliance/src/mbk/man3/instr.3 @@ -0,0 +1,77 @@ +.\" $Id: instr.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)instr.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +instr +.XE +.XS4 \n% +.ti 0.2i +instr +.XE4 \} +.TH INSTR 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +instr \- find an occurence of a string in a string, starting at a +specified character. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**instr(s, find, from) +char \(**s, \(**find, from; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIs\fP +Pointer to the string to be searched for the pattern +.TP +\fIfind\fP +Pointer to the string to be found, the pattern +.TP +\fIfrom\fP +Character to be searched backwards before searching for the pattern +.SH DESCRIPTION +\fBinstr\fP searches the first occurence of the string \fIfind\fP in the string +\fIs\fP, starting its search at the last occurence of the \fIfrom\fP character +in the string \fIs\fP. +.LP +If either \fIs\fP or \fIfind\fP is \fBNULL\fP, the function returns \fBNULL\fP. +If \fIfrom\fP is \fB(char)0\fP, the pattern is searched from the begining of +\fIs\fP. +.br +This quite exotic behaviour is useful to search the occurence of a name in a +string resulting from a flatten, when only a terminal object name is to be +taken into account. +.SH RETURN VALUES +\fBinstr\fP return \fBNULL\fP either if the pattern \fIfind\fP is not present +in the searched string \fIs\fP, or if one at least of these two string are +\fBNULL\fP. +If the pattern is found, a value different from \fBNULL\fP is returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +/* check for the pattern 'ck' anywhere in the string */ +#define contains_ck(name) instr(name, "ck", '\0') +/* check for the pattern 'ck' in the signal name, not instance ones */ +#define isclock(ptsig) instr(getsigname(ptsig), "ck", SEPAR) +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR isvdd (3), +.BR isvss (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/isvdd.3 b/alliance/src/mbk/man3/isvdd.3 new file mode 100644 index 00000000..ba8745a7 --- /dev/null +++ b/alliance/src/mbk/man3/isvdd.3 @@ -0,0 +1,79 @@ +.\" $Id: isvdd.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)isvdd.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +isvdd +.XE +.XS4 \n% +.ti 0.2i +isvdd +.XE4 \} +.TH ISVDD 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +isvdd \-tells if a name contains the pattern defined by the user +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void isvdd(s) +char \(**s; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIs\fP +Pointer to the string to be check as power high +.SH DESCRIPTION +\fBisvdd\fP searches an occurence of the string defined by the \fBMBK_VDD\fP(1) +environment variable in the string \fIs\fP. +If this string is not set by the user, its default value is "vdd". +.SH RETURN VALUE +\fBisvdd\fP return \fBNULL\fP the pattern is not present +If the pattern is found, a value different from \fBNULL\fP is returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +find_a_vdd(f) +lofig_list *f; +{ +locon_list *c; +losig_list *s; + /* first check connectors */ + for (c = f->LOCON; c; c = c->NEXT) { + if (isvdd(c->NAME)) + return c->SIG; + if (isvdd(getsigname(c->SIG))) + return c->SIG; + } + /* then check internal signals */ + for (s = f->LOSIG; s; s = s->NEXT) + if (s->TYPE == INTERNAL) + if (isvdd(getsigname(s))) + return s; + return NULL; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR instr (3), +.BR isvss (3), +.BR MBK_VDD (1), +.BR MBK_VSS (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/isvss.3 b/alliance/src/mbk/man3/isvss.3 new file mode 100644 index 00000000..d66c588a --- /dev/null +++ b/alliance/src/mbk/man3/isvss.3 @@ -0,0 +1,79 @@ +.\" $Id: isvss.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)isvss.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +isvss +.XE +.XS4 \n% +.ti 0.2i +isvss +.XE4 \} +.TH ISVSS 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +isvss \-tells if a name contains the pattern defined by the user +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void isvss(s) +char \(**s; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIs\fP +Pointer to the string to be check as power high +.SH DESCRIPTION +\fBisvss\fP searches an occurence of the string defined by the \fBMBK_VSS\fP(1) +environment variable in the string \fIs\fP. +If this string is not set by the user, its default value is "vss". +.SH RETURN VALUE +\fBisvss\fP return \fBNULL\fP the pattern is not present +If the pattern is found, a value different from \fBNULL\fP is returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +find_a_vss(f) +lofig_list *f; +{ +locon_list *c; +losig_list *s; + /* first check connectors */ + for (c = f->LOCON; c; c = c->NEXT) { + if (isvss(c->NAME)) + return c->SIG; + if (isvss(getsigname(c->SIG))) + return c->SIG; + } + /* then check internal signals */ + for (s = f->LOSIG; s; s = s->NEXT) + if (s->TYPE == INTERNAL) + if (isvss(getsigname(s))) + return s; + return NULL; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR instr (3), +.BR isvdd (3), +.BR MBK_VDD (1), +.BR MBK_VSS (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/libpat.3 b/alliance/src/mbk/man3/libpat.3 new file mode 100644 index 00000000..3d86fe2b --- /dev/null +++ b/alliance/src/mbk/man3/libpat.3 @@ -0,0 +1,146 @@ +.\" $Id: libpat.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)pat.2 106 Sep 30 1996 UPMC; Pirouz BAZARGAN SABET +.TH LIBPAT 3 "October 1, 1997" "ASIM/LIP6" "cao\-vlsi reference manual" + +.so man1/alc_origin.1 +.SH NAME +.PP +\fBPAT\fP \- Generic pattern data structure + +.SH DESCRIPTION +.PP +\fBPAT\fP is a generic data structure supporting vlsi concepts. +It allows representation of a sequence of simulation patterns in a data +structure. + +.PP +The goal of \fBPAT\fP is to define an ad hoc single data structure (object), +with well known fixed meaning for each concept manipulated in pattern +description. So any tools that needs to access simulation patterns can be +build upon it, using these structures. + +.PP +For each object (data structure), a set of functions has been defined in order +to add, delete or access it. These functions are defined in a low\-level library +\fIlibPat106.a\fP. Some other functions are higher level. They are defined in a +high\-level library \fIlibPhl106.a\fP. There are also some parsers\-drivers. +A parser reads a pattern description file in a given format and build up a +complete \fBPAT\fP data base. A driver creates a text file in a given format +from a \fBPAT\fP data base. A \fBpat\fP format parser\-driver is available +in the \fIlibPpt106.a\fP library. + +.PP +Pattern description envolves the following notions (for further details see +pat(5)): + +.TP 20 +\fIinput\fP +port controlled by the user +.TP 20 +\fIoutput\fP +signal or port observed by the user +.TP 20 +\fIinitialization\fP +forcing the value of a register +.TP 20 +\fIpattern sequence\fP +list of values to be forced on inputs or to be checked as the result of the +simulation on outputs + +.PP +The input\-output list is represented by two data structures: \fIpagrp\fP +contains informations relative to actual or virtual arraies and, \fIpaiol\fP +represents a one\-bit input\-output. Both are simply chained lists. However, +to make a more efficient access to \fIpaiol\fP structures, they are organized +in a table. So, a \fIpaiol\fP can also be addressed using an offset. + +.PP +Another group of data structures is used to represent a pattern. \fIpaini\fP +contains values to be forced into registers before processing the pattern. +An event (a modification of value) on an input\-output is given by a +\fIpaevt\fP structure. A third structure, \fIpapat\fP gathers all information +concerning a pattern (including initializations \- \fIpaini\fP \- and events \- +\fIpaevt\fP). + +.PP +A \fIpacom\fP is used to represent a comment. + +.PP +Finally, all these structures can be accessed through a unique structure, +\fIpaseq\fP, designed to represent a complete sequence of simulation patterns. + +.SH ORGANIZATION +.PP +In order to use \fBPAT\fP, concepts on use of libraries are needed. And, since +these libraries are under development, the code is subject to change. + +.PP +To enable work, a static version of each library is always present for the +user. Libraries and header files are suffixed by a number (the library's +version). The programmer can prefer to work with an earlier version of a +library rather than the most recent one. However, it is recommended to adapt +softwares to libraries as soon as possible in order to spotlight potential +compatibility problems before old libraries are removed. + +.PP +A \fImakefile\fP is necessary for all \fBPAT\fP applications. +This is required because any soft must be easily recompilable, and knowing +the needed libraries for a \fBPAT\fP based program is not an easy matter. +It can't be achieved by an other way, so do use \fImakefile\fP. + +.PP +In terms of software organization, \fBPAT\fP is splitted into two libraries +for the basic functions, a header file for structures and variable declarations +and, up to now, one parser\-driver library for \fBpat\fP format. + +.PP +It is to be noticed that library's version number is incremented when, at least, +one function composing the library has been modified. Therefore, \fBPAT\fP +libraries may evolve independently form each other. + +.PP +Here follows the list of the libraries and their contents. + +.TP 20 +libPat106.a: +\fBpat_addpaseq, pat_addpagrp,\fP +\fBpat_addpaiol, pat_addpapat,\fP +\fBpat_addpaevt, pat_addpaini,\fP +\fBpat_addpacom, pat_frepaini,\fP +\fBpat_frepaiol, pat_frepacom,\fP +\fBpat_frepapat, pat_frepaevt,\fP +\fBpat_crtpaiol\fP + +.TP 20 +libPhl106.a: +\fBpat_debug, pat_getcount\fP + +.TP 20 +libPpt106.a: +\fBpat_lodpaseq, pat_savpaseq,\fP +\fBpat_drvpat, pat_prspat\fP + +.PP +The libraries are organized in such a way that no cycle can appear through +calls. It means that, if in a given library a function calls another function +in another library, then none of the functions of this one does call any +function that belongs to the first library. + +.SH EXAMPLE +.PP +In order to use \fBPAT\fP libraries, one needs something like this in its +\fImakefile\fP: + +.RS +HEADER = -I/labo/include +.br +LIB = -L/labo/lib -lPat106 -lPhl106 -lPpt106 -lMut315 +.RE + +.SH SEE ALSO +.PP +mbk(1), pat(5) + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/loadlofig.3 b/alliance/src/mbk/man3/loadlofig.3 new file mode 100644 index 00000000..780a2cc4 --- /dev/null +++ b/alliance/src/mbk/man3/loadlofig.3 @@ -0,0 +1,138 @@ +.\" $Id: loadlofig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)loadlofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +loadlofig +.XE +.XS3 \n% +.ti 0.2i +loadlofig +.XE3 \} +.TH LOADLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +loadlofig \- load a new logical cell model from disk +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void loadlofig(ptfig, figname, mode) +lofig_list \(**ptfig; +char \(**figname; +char mode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to an allocated but empty \fIlofig\fP +.TP +\fIfigname\fP +Name of the figure to be loaded +.TP +\fImode\fP +Loading mode +.SH DESCRIPTION +\fBloadlofig\fP fills the \fIlofig\fP pointed to by \fIptfig\fP with the +contents of a disk file called \fIfigname\fP. The loading mode may be either +\fB'A'\fP, then the entire content is parsed, or \fB'P'\fP then only +connectors and extrernal signals are loaded in memory, or \fB'C'\fP, that +loads the "complement" of an already partially loaded cell in order to +keep the same pointer when accessing the same file. +.br +The \fBloadlofig\fP(3) function in fact performs a call to a parser, choosen +by the \fBMBK_IN_LO\fP(1) environment variable. The directories searched for the +file are first the one sets by \fBMBK_WORK_LIB\fP(1) and then, in the described +order, the ones set by \fBMBK_CATA_LIB\fP(1). +See \fBMBK_IN_LO\fP(1), \fBMBK_WORK_LIB\fP(1), \fBMBK_CATA_LIB\fP(1) and +\fBmbkenv\fP(3) for details. +.SH ERRORS +Some errors resulting from a call to \fBloadlofig\fP are due to the parsers, +and are prefixed by the parser format (pf). +.br +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** not supported logical input format 'xxx'" +.ft R +.RS +The environment variable \fBMBK_IN_LO\fP is not set to a legal logical +format. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** pfloadlofig : could not open file \fIfigname\fP" +.ft R +.RS +No file called \fIfigname.ext\fP, where \fIext\fP is the file format extension, +has been found in the directories set by the environment. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** pfloadlofig : syntax error line x parsing \fIfigname.ext\fP" +.ft R +.RS +Either the file has been corrupted and its syntax is not legal, or there is a +bug in the given parser. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +lofig_list \(**get_the_lofig(figname, mode) +char \(**figname; +char mode; +{ +lofig_list \(**pt; + for (pt = HEAD_LOFIG; pt; pt = pt\->NEXT) /\(** scan figure list \(**/ + if (!strcmp(pt\->NAME, figname)) + break; + if (!pt) { /\(** figure doesn't exist \(**/ + pt = addlofig(figname); + pt\->MODE = mode == 'A' ? mode : 'P'; + loadlofig(pt, figname, pt\->MODE); + return pt; + } + if (ptfig\->MODE != 'A') { /\(** figure exists interface only \(**/ + if (mode == 'A') { + pt\->MODE = 'A'; + loadlofig(pt, figname, 'C'); + return pt; + } else + return pt; + } else /\(** figure exists interface and body \(**/ + return pt; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR lofig (3), +.BR addlofig (3), +.BR getlofig (3), +.BR dellofig (3), +.BR savelofig (3), +.BR flattenlofig (3), +.BR rflattenlofig (3), +.BR MBK_IN_LO (1), +.BR MBK_WORK_LIB (1), +.BR MBK_CATA_LIB (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/loadphfig.3 b/alliance/src/mbk/man3/loadphfig.3 new file mode 100644 index 00000000..b4b882d4 --- /dev/null +++ b/alliance/src/mbk/man3/loadphfig.3 @@ -0,0 +1,139 @@ +.\" $Id: loadphfig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)loadphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +loadphfig +.XE +.XS1 \n% +.ti 0.2i +loadphfig +.XE1 \} +.TH LOADPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +loadphfig \- load a new physical cell model from disk +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void loadphfig(ptfig, figname, mode) +phfig_list \(**ptfig; +char \(**figname; +char mode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to an allocated but empty \fIphfig\fP +.TP +\fIfigname\fP +Name of the figure to be loaded +.TP +\fImode\fP +Loading mode +.SH DESCRIPTION +\fBloadphfig\fP fills the \fIphfig\fP pointed to by \fIptfig\fP with the +contents of a disk file called \fIfigname\fP. The loading mode may be either +\fB'A'\fP, then the entire content is parsed, or \fB'P'\fP then only +connectors, abutment box, and through routes are loaded, or \fB'C'\fP, that +finishes to fill an already loaded figure in \fB'P'\fP mode, in order to have +it all in memory. This last mode allows to keep the same \fIptfig\fP pointer +when reaccessing the same file. +.br +The \fBloadphfig\fP function in fact performs a call to a parser, choosen +by the \fBMBK_IN_PH\fP(1) environment variable. The directories seached for the +file are first the one set by \fBMBK_WORK_LIB\fP(1) and then, in the described +order, the ones set by \fBMBK_CATA_LIB\fP(1). +See \fBMBK_IN_PH\fP(1), \fBMBK_WORK_LIB\fP(1), \fBMBK_CATA_LIB\fP(1) and +\fBmbkenv\fP(3) for details. +.SH ERRORS +Some errors resulting from a call to \fBloadphfig\fP are due to the parsers, +and are prefixed by the parser format (pf). +.br +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** not supported physical input format 'xxx'" +.ft R +.RS +The environment variable \fIMBK_IN_PH\fP is not set to a legal physical +format. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** pfloadphfig : could not open file \fIfigname\fP" +.ft R +.RS +No file called \fIfigname.ext\fP, where \fIext\fP is the file format extension, +has been found in the directories set by the environment. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** pfloadphfig : syntax error line x parsing \fIfigname.ext\fP" +.ft R +.RS +Either the file has been corrupted and its syntax is not legal, or there is a +bug in the given parser. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +phfig_list \(**get_the_phfig(figname, mode) +char \(**figname; +char mode; +{ +phfig_list \(**pt; + for (pt = HEAD_PHFIG; pt; pt = pt\->NEXT) /\(** scan figure list \(**/ + if (!strcmp(pt\->NAME, figname)) + break; + if (!pt) { /\(** figure doesn't exist \(**/ + pt = addphfig(figname); + pt\->MODE = mode == 'A' ? mode : 'P'; + loadphfig(pt, figname, pt\->MODE); + return pt; + } + if (ptfig\->MODE != 'A') { /\(** figure exists interface only \(**/ + if (mode == 'A') { + pt\->MODE = 'A'; + loadphfig(pt, figname, 'C'); + return pt; + } else + return pt; + } else /\(** figure exists interface and body \(**/ + return pt; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR phfig (3), +.BR addphfig (3), +.BR getphfig (3), +.BR delphfig (3), +.BR savephfig (3), +.BR flattenphfig (3), +.BR rflattenphfig (3), +.BR MBK_IN_PH (1), +.BR MBK_WORK_LIB (1), +.BR MBK_CATA_LIB (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/locon.3 b/alliance/src/mbk/man3/locon.3 new file mode 100644 index 00000000..1ed7f0ee --- /dev/null +++ b/alliance/src/mbk/man3/locon.3 @@ -0,0 +1,119 @@ +.\" $Id: locon.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)locon.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +locon +.XE +.XS2 \n% +.ti 0.2i +locon +.XE2 \} +.TH LOCON 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL STRUCTURE DEFINITIONS" +.SH NAME +locon \- mbk logical connector +.SH DESCRIPTION +The \fBlocon\fP is used to describe a connector of the logical view +of a figure. Connectors are describing the cell interface, and are the link +between its physical and logical views, so the names must be the same. +.LP +The declarations needed to work on \fBlocon\fP are available in the header file +\fI"/labo/include/mlo404.h"\fP, where '\fI404\fP' is the actual mbk version. +.LP +The following C structure supports the description of the logical connector : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct locon { + struct locon \(**NEXT; + char \(**NAME; + struct losig \(**SIG; + void \(**ROOT; + char DIRECTION; + char TYPE; + struct ptype \(**USER; +} locon_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBlocon\fP of the list. +.TP +\fINAME\fP +Name of the connector. It identifies the connector, so it should unique in a +given logical figure. A logical connector with a given name correspond to the +physical connector or connectors of this name. +.TP +\fISIG\fP +Pointer to the signal linked to the connector. This signal is, of course, +unique. See \fBlosig\fP(3) for details. +.TP +\fIROOT\fP +Pointer to the object it belongs to. This object may be either a \fBlofig\fP, +or a \fBloins\fP, depending on the type of the connector. +See \fBlofig\fP(3) and \fBloins\fP for details. +.TP +\fIDIRECTION\fP +This indicates the way of the information going through the connector. +Six directions are legal : +.RS +.TP 20 +\fBIN\fP +input +.TP +\fBOUT\fP +output +.TP +\fBINOUT\fP +input and output +.TP +\fBUNKNOWN\fP +no information is available +.TP +\fBTRISTATE\fP +tristate output +.TP +\fBTRANSCV\fP +tristate output and input +.RE +.fi +.TP +\fITYPE\fP +Character indicating if the connector belongs to a model or an instance. It +can take two values : +.RS +.TP 20 +\fBEXTERNAL\fP +for figure connectors +.TP +\fBINTERNAL\fP +for instance connectors +.LP +The \fITYPE\fP is needed to appropriatly cast the \fIROOT\fP field, and must +be approriatly filled by the parsers. A misuse of it may cause strange +behaviours. +.RE +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP for details, that is a general purpose +pointer used to share informations on the connector. +.SH SEE ALSO +.BR mbk(1), +.BR mbk(3), +.BR addlocon (3), +.BR getlocon (3), +.BR dellocon (3), +.BR losig (3), +.BR ptype (3), +.BR loins (3), +.BR lofig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/lofig.3 b/alliance/src/mbk/man3/lofig.3 new file mode 100644 index 00000000..1ebcdcd8 --- /dev/null +++ b/alliance/src/mbk/man3/lofig.3 @@ -0,0 +1,118 @@ +.\" $Id: lofig.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)lofig.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +lofig +.XE +.XS2 \n% +.ti 0.2i +lofig +.XE2 \} +.TH LOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL STRUCTURE DEFINITIONS" +.SH NAME +lofig \- mbk logical figure +.SH DESCRIPTION +The \fBlofig\fP is used to describe a hierarchical level of the logical view +of a figure. The logical view is also called the netlist, for list of nets, +because it represents the interconections between elements of a cell. +.LP +The declarations needed to work on \fBlofig\fP are available in the header file +\fI"/labo/include/mlo404.h"\fP, where '\fI404\fP' is the actual mbk version. +.LP +The following C structure supports the description of the netlist +representation : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct lofig { + struct lofig \(**NEXT; + struct chain \(**MODELCHAIN; + struct locon \(**LOCON; + struct losig \(**LOSIG; + struct ptype \(**BKSIG; + struct loins \(**LOINS; + struct lotrs \(**LOTRS; + char \(**NAME; + char MODE; + struct ptype \(**USER; +} lofig_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBlofig\fP loaded in ram. +.TP +\fINAME\fP +Name of the figure. It identifies a figure (or \fImodel\fP), so it should +be unique in order to warranty consistency of cells libraries. In order +to ensure this consistency, the \fINAME\fP field must be filled with the +disk file name while parsing, and must be used as file name for driving. +.TP +\fILOINS\fP +Pointer to the head of the list of instances being used for the model +description. See \fBloins\fP(3) for details. +.TP +\fILOCON\fP +Pointer to the head of the list of connectors (terminals) of the model. +See \fBlocon\fP(3) for details. +.TP +\fILOSIG\fP +Pointer to the head of the list of signal of the model. +See \fBlosig\fP(3) for details. +.TP +\fIBKSIG\fP +Pointer to a hash table that contains arrays of \fILOSIG\fP. It is only an +other way to represent the same elements that in the list, but allows a +faster access. The Mbk Logical Functions warranty the consitency between +the two representations. +.TP +\fILOTRS\fP +Pointer to the list of transistors belonging to the figure. It is to be noticed +that transistors are not instances of a particular type. +.TP +\fIMODE\fP +Caracter indicating the status of the figure in memory. This field can +take two values : +.RS +.TP 10 +.B \'A\' +all the cell is loaded in ram. +.TP +.B \'P\' +only information concerning the model interface is present, that +means connectors, and signals linked to external connectors. +All other lists are empty. +.RE +.TP +\fIMODELCHAIN\fP +Pointer to a chain list, see \fBchain\fP(3) for details, of names. These are +the names of the models that are at least instanciated once in the figure. +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, that is a general +purpose pointer used to share informations on the model. +.SH SEE ALSO +.BR mbk (1), +.BR addlofig (3), +.BR getlofig (3), +.BR dellofig (3), +.BR loadlofig (3), +.BR savelofig (3), +.BR loins (3), +.BR lotrs (3), +.BR locon (3), +.BR losig (3), +.BR ptype (3), +.BR chain (3), +.BR phfig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/lofigchain.3 b/alliance/src/mbk/man3/lofigchain.3 new file mode 100644 index 00000000..d431e8a9 --- /dev/null +++ b/alliance/src/mbk/man3/lofigchain.3 @@ -0,0 +1,97 @@ +.\" $Id: lofigchain.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)lofigchain.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +lofigchain +.XE +.XS2 \n% +.ti 0.2i +lofigchain +.XE2 \} +.TH LOFIGCHAIN 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +lofigchain \- creates a netlist in terms of connectors on signals +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void lofigchain(ptfig) +lofig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to a lofig_list +.SH DESCRIPTION +The \fBlofigchain\fP function creates the dual representation of natural +mbk netlists. In mbk, netlists are described in terms of signal attached to +connectors. +With \fBlofigchain\fP, one can have the dual sight : connectors attached to +signals. +This can be very useful, depending on the application, but it's also memory +consuming on big netlists, since two views of the same thing are present in +memory at the same time. +.LP +The information resulting of a call to \fBlofigchain\fP is present in the +\fIUSER\fP field of all signals of the figure, accessible through +\fIptfig\->LOSIG\fP. The \fIUSER\fP field has a \fBptype\fP typed +\fILOFIGCHAIN\fP, that points on a \fBchain_list\fP whose \fIDATA\fP points on +each \fBlocon\fP beeing connected to the given signal. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** lofigchain impossible : figure \fIptfig\->NAME\fP is +interface only" +.ft R +.RS +In order to be valid, the netlist resulting of a call to \fBlofigchain\fP must +be done on a figure entirely loaded in ram. See \fBgetlofig\fP for details. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +void print_netlist(p) +lofig_list \(**p; +{ +losig_list \(**s; +chain_list \(**c; + lofigchain(p); + for (s = p\->LOSIG; s; s = s\->NEXT){ + (void)fprintf(stdout, "signal : index = %ld name = %s\\n", + s\->INDEX, getsigname(s)); + c = (chain_list \(**)(getptype(s\->USER, (long)LOFIGCHAIN)\->DATA); + while (c) { + fprintf(stdout, "conname : %s\\n", + (locon_list \(**)(c\->DATA)\->NAME); + c = c\->NEXT; + } + } +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR locon (3), +.BR losig (3), +.BR getlofig (3), +.BR loadlofig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/log.3 b/alliance/src/mbk/man3/log.3 new file mode 100644 index 00000000..815590de --- /dev/null +++ b/alliance/src/mbk/man3/log.3 @@ -0,0 +1,34 @@ +.\" $Id: log.3,v 1.1 2002/03/08 13:51:02 fred Exp $ +.\" @(#)log.2 0.0 92/08/01 UPMC; Author: Luc Burgun +.pl -.4 +.TH LOG 3 "October 1, 1997" "ASIM/LIP6" "cao\-vlsi reference manual" +.SH NAME +\fBlog\fP \- logical representations for boolean functions and utilities. +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBlog\fP is a set of structures and functions that permits to manipulate several representations of boolean functions. Several programs and libraries of the \fIcao-vlsi cad tools\fP rest on the \fIlog\fP package. Two different kind of functions are available for: +.TP 20 +Prefixed representation for boolean functions +.TP 20 +Ordered binary decision diagrams representation +.SH EXAMPLE +Let's suppose that actual mbk version is 'nnn'. +In order to use log, \fIlibMutnnn.a\fP library must be called. +.br +\fImakefile\fP: +.br +HEADER = -I/labo/include +.br +LIB = -L/labo/lib -lMutnnn -ltshmmm -lablmmm -lbddmmm +.br +Each library can be called separatly. The "logmmm.h" header file must be inserted in the files that use the functions or the structures defined in a library. +.br +.SH SEE ALSO +.BR mbk (1), +.BR beh (1), +.SH AUTHOR +L. BURGUN salle 30 T. 55-65 Universite P&M Curie - 4 pl. Jussieu - FRANCE +.br + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/loins.3 b/alliance/src/mbk/man3/loins.3 new file mode 100644 index 00000000..9c1aa475 --- /dev/null +++ b/alliance/src/mbk/man3/loins.3 @@ -0,0 +1,73 @@ +.\" $Id: loins.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)loins.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +loins +.XE +.XS2 \n% +.ti 0.2i +loins +.XE2 \} +.TH LOINS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL STRUCTURE DEFINITIONS" +.SH NAME +loins \- mbk logical instance +.SH DESCRIPTION +The \fBloins\fP is used to describe an instance of the logical view +of a figure. +.LP +The declarations needed to work on \fBloins\fP are available in the header file +\fI"/labo/include/mlo404.h"\fP, where '\fI404\fP' is the actual mbk version. +.LP +The following C structure supports the description of the logical instance : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct loins { + struct loins \(**NEXT; + struct locon \(**LOCON; + char \(**INSNAME; + char \(**FIGNAME; + struct ptype \(**USER; +} loins_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBloins\fP of the list. +.TP +\fIINSNAME\fP +Local name of the instance. It identifies the instance at a given hierarchical +level, so it should unique. When working on both layout and netlist views of +a cell, instance names should be the same on each representation. +.TP +\fIFIGNAME\fP +Name of the model of the instanciated cell. +.TP +\fILOCON\fP +Pointer to the head of the list of connectors of the instance. Consistency +between the connectors of the instance and the connectors of its model on disk +is not ensured by the parsers, because a model local to the file beeing parsed +is used, not the possible model on disk. See \fBlocon\fP(3) for details. +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, that is a general purpose +pointer used to share informations on the instance. +.SH SEE ALSO +.BR mbk (1), +.BR addloins (3), +.BR getloins (3), +.BR delloins (3), +.BR locon (3), +.BR lofig (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/losig.3 b/alliance/src/mbk/man3/losig.3 new file mode 100644 index 00000000..6e0d14b0 --- /dev/null +++ b/alliance/src/mbk/man3/losig.3 @@ -0,0 +1,100 @@ +.\" $Id: losig.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)losig.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +losig +.XE +.XS2 \n% +.ti 0.2i +losig +.XE2 \} +.TH LOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL STRUCTURE DEFINITIONS" +.SH NAME +losig \- mbk logical signal +.SH DESCRIPTION +The \fBlosig\fP is used to describe a logical signal. +.LP +The declarations needed to work on \fBlosig\fP are available in the header file +\fI"/labo/include/mlo404.h"\fP, where '\fI404\fP' is the actual mbk version. +.LP +The following C structure supports the description of the logical signal : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct losig { + struct losig \(**NEXT; + struct chain \(**NAMECHAIN; + float CAPA; + long INDEX; + char TYPE; + struct ptype \(**USER; +} losig_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBlosig\fP of the list. +.TP +\fIINDEX\fP +Long integer beeing the signal identifier. It represents the net +number at a given hierachical level, and must be unique. +.TP +\fINAMECHAIN\fP +Pointer to a list of names, aliases, attached to the signal. If no names +are given then the field points to \fINULL\fP. Many names can be present if +the signal result of the flatten of a netlist. +See \fBchain\fP(3) for details. +.TP +\fICAPA\fP +Floating point number containing the value of the total capacitance attached +to a signal in respect to ground. This field may be set to zero, since it +make sens only if the signal is the result of a layout extraction, or has +been used for electrical simulation purposes. +.TP +\fITYPE\fP +This field can take two legal values depending on the types of the connectors +attached to it. See \fBlocon\fP(3) for detail. +.RS +.TP 20 +\fBEXTERNAL\fP +The signal is connected at least to one external +connector, a connector of the figure beeing described. +.TP +\fBINTERNAL\fP +The signal is connected only to instances or +transistors connectors. +.LP +The tools using the \fITYPE\fP should fill it with care, since unexpected +results may appear if the consistency with connectors is violated. +.RE +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, that is a general +purpose pointer used to share informations on the signal. +.TP +Remark : +the netlist view is given in terms of connectors pointing to signals, +but it may be useful to have also the dual representation, in term of +list of connectors attached to a single signal. This may be obtained by +the \fBlofigchain\fP function. +.SH SEE ALSO +.BR mbk (1), +.BR addlosig (3), +.BR getlosig (3), +.BR dellosig (3), +.BR lofigchain (3), +.BR locon (3), +.BR lofig (3), +.BR chain (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/lotrs.3 b/alliance/src/mbk/man3/lotrs.3 new file mode 100644 index 00000000..ff01231e --- /dev/null +++ b/alliance/src/mbk/man3/lotrs.3 @@ -0,0 +1,115 @@ +.\" $Id: lotrs.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)lotrs.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +lotrs +.XE +.XS2 \n% +.ti 0.2i +lotrs +.XE2 \} +.TH LOTRS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL STRUCTURE DEFINITIONS" +.SH NAME +lotrs \- mbk logical transistor +.SH DESCRIPTION +The \fBlotrs\fP is used to describe a logical transistor. It is mostly used +to describe leaf cells in terms of transistors interconnections, and as a +result of layout extractions. Since the only target technology is CMOS, only +NMOS and PMOS transistors are used. +.LP +The declarations needed to work on \fBlotrs\fP are available in the header file +\fI"/labo/include/mlo404.h"\fP, where '\fI404\fP' is the actual mbk version. +.LP +The following C structure supports the description of the logical transistor : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct lotrs { + struct lotrs \(**NEXT; + struct locon \(**DRAIN; + struct locon \(**GRID; + struct locon \(**SOURCE; + long X,Y; + unsigned short WIDTH, LENGTH; + unsigned short PS, PD; + unsigned short XS, XD; + char TYPE; + struct ptype \(**USER; +} lotrs_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBlotrs\fP of the list. +.TP +\fIDRAIN\fP +Pointer to the drain connector of the transistor. This connector is, +of course unique. See \fBlocon\fP(3) for details. +.TP +\fIGRID\fP +Pointer to the grid connector of the transistor. This connector is, +of course unique. See \fBlocon\fP(3) for details. +.TP +\fISOURCE\fP +Pointer to the source connector of the transistor. This connector is, +of course unique. See \fBlocon\fP(3) for details. +.TP +\fIX, Y\fP +Coordinates of the transistor in a layout. These informations have sens only if +the transistor netlist is the result of a layout extraction. They are +otherwise set to zero. +These coordinates are given in micron times the scale factor \fBSCALE_X\fP, +since the extracted view is technology +dependant. +.TP +\fIWIDTH, LENGTH\fP +Respectivly width and length of the transistor grid. +.TP +\fIPS, PD\fP +Respectivly perimeter of the source and drain, in micron times the scale +factor \fBSCALE_X\fP. +.TP +\fIXS, XD\fP +These values are needed to compute respectivly the source and drain areas. +Let \fIAs\fP be the source area in square microns, and \fIWidth\fP be the +transistor grid width in micron, then +\fIlotrs->XS = As / Width * SCALE_X\fP +.TP +\fITYPE\fP +Canal type of the transistor. Two legal values are available : +.RS +.TP 20 +\fBTRANSN\fP +N type MOS transistor +.TP +\fBTRANSP\fP +P type MOS transistor +.RE +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, +that is a general purpose +pointer used to share informations on the transistor. +.TP +Remark : +The transistors do not have a bulk connector, since in integrated techniques +NMOS transistor bulk is always set to ground, and PMOS transistor bulk is +always set to positive supply. +.SH SEE ALSO +.BR mbk (1), +.BR addlotrs (3), +.BR dellotrs (3), +.BR locon (3), +.BR lofig (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbk.3 b/alliance/src/mbk/man3/mbk.3 new file mode 100644 index 00000000..5deb5a92 --- /dev/null +++ b/alliance/src/mbk/man3/mbk.3 @@ -0,0 +1,20 @@ +.\" $Id: mbk.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbk.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +\fBPresentation of generic \fIlayout\fP and \fInetlist\fP data structures\fR +.XE \} +.TH MBK 3 "October 1, 1997" "ASIM/LIP6" "cao\-vlsi reference manual" +.SH NAME +mbk \- Generic \fIlayout\fP ,\fInetlist\fP and \fIutility\fP data structures +.so man1/alc_origin.1 +.SH DESCRIPTION +\fBmbk\fP has several global variables that need to be known by the programmer. + +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1). + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkalloc.3 b/alliance/src/mbk/man3/mbkalloc.3 new file mode 100644 index 00000000..85a6c571 --- /dev/null +++ b/alliance/src/mbk/man3/mbkalloc.3 @@ -0,0 +1,76 @@ +.\" $Id: mbkalloc.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkalloc.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkalloc +.XE +.XS4 \n% +.ti 0.2i +mbkalloc +.XE4 \} +.TH MBKALLOC 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkalloc \- mbk memory allocator +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**mbkalloc(bytes) +unsigned int bytes; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIbytes\fP +Number of memory bytes to be contiguously allocated +.SH DESCRIPTION +\fBmbkalloc\fP returns a block of \fIbytes\fP length, for any purpose. +It is now a day just an encapsulation of the system \fBmalloc\fP function, +but may evolve to a special allocator in the future. Its use is strongly +encouraged. +.TP 20 +Remark : +a global variable, \fBlong mbkalloc_stat\fP, updates the number of allocated +bytes, and may be accessed by anyone to see the amount of allocated memory. +.SH RETURN VALUE +\fBmbkalloc\fP returns a pointer to a \fIbytes\fP long block. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** mbkalloc impossible : not enough memory" +.ft R +.RS +System break can't be moved anymore, no more memory can be retrieved from +the system. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**dup_str(s); +{ +char \(**t = (char \(**)mbkalloc(strlen(s) + (unsigned int)1); + strcpy(t, s); + return t; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkfree (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkenv.3 b/alliance/src/mbk/man3/mbkenv.3 new file mode 100644 index 00000000..b2df87c9 --- /dev/null +++ b/alliance/src/mbk/man3/mbkenv.3 @@ -0,0 +1,150 @@ +.\" $Id: mbkenv.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkenv.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkenv +.XE +.XS4 \n% +.ti 0.2i +mbkenv +.XE4 \} +.TH MBKENV 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkenv \- set user preferences +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void mbkenv(); +.ft R +.fi +.SH DESCRIPTION +The \fBmbkenv\fP function set the user preferences through unix +environment variables. if all the variables are not defined, default values +are used. +.LP the environment variables are : +.TP 30 +\fBMBK_WORK_LIB\fP +internally \fBchar \(**WORK_LIB\fP, sets the working directory for reading and +writting, result of a \fBsavephfig\fP for example. Its value is \fB"."\fP by +default. +.TP +\fBMBK_CATA_LIB\fP +internally \fBchar \(**\(**CATA_LIB\fP, sets the working directories for reading only. +This is a set of pathes, like the unix \fBPATH\fP variable. +It is used in \fBloadlofig\fP for example. Its value is \fB"."\fP by default. +.TP +\fBMBK_CATAL_NAME\fP +internally \fBchar \(**CATAL_NAME\fP, sets the name of the catalog file, needed +to know where to stop a flatten, and so on. Set to \fB"CATAL"\fP by default. +.TP +\fBMBK_SEPAR\fP +internally \fBchar SEPAR\fP, sets the character used for string concatenation. +Used for example in \fBconcatname\fP. +By default it is \fB"."\fP. +.TP +\fBMBK_VDD\fP +internally \fBchar *VDD\fP, sets the name to be used as power level +recognition pattern by the tools based upon mbk that needs to identify +supplies. +The default is \fB"vdd"\fP. +.TP +\fBMBK_VSS\fP +internally \fBchar *VSS\fP, sets the name to be used as ground level +recognition pattern by the tools based upon mbk that needs to identify +supplies. +The default is \fB"vss"\fP. +.TP +\fBMBK_TRACE_MODE\fP +internally \fBchar TRACE_MODE\fP, output information in each mbk access +function it enters. +Used for debugging purposes. +By default it is \fB'N'\fP. +.TP +\fBMBK_DEBUG_MODE\fP +internally \fBchar DEBUG_MODE\fP, output information in function that +makes a check on its values : mostly parsers for debug. It is very +verbose, and mostly unusable. No mbk function take care of it. +By default it is \fB'N'\fP. +.TP +\fBMBK_FAST_MODE\fP +internally \fBchar FAST_MODE\fP. If set to \fB'Y'\fP, no consistency checked are +performed on many mbk functions. This can work only on a program that is +warrantied to be bugless, else undefined results would occur. +By default it is \fB'N'\fP. +.TP +\fBMBK_IN_LO\fP +internally \fBchar IN_LO[5]\fP. Defines the logical input format demanded +by the user. See \fBMBK_IN_LO\fP(1) for a list of valid formats. +By default its value is \fB"al"\fP. +.TP +\fBMBK_OUT_LO\fP +internally \fBchar OUT_LO[5]\fP. Defines the logical input format demanded +by the user. See \fBMBK_OUT_LO\fP(1) for a list of valid formats. +By default its value is \fB"al"\fP. +.TP +\fBMBK_IN_PH\fP +internally \fBchar IN_PH[5]\fP. Defines the logical input format demanded +by the user. See \fBMBK_IN_PH\fP(1) for a list of valid formats. +By default its value is \fB"ap"\fP. +.TP +\fBMBK_OUT_PH\fP +internally \fBchar OUT_PH[5]\fP. Defines the logical input format demanded +by the user. See \fBMBK_OUT_PH\fP(1) for a list of valid formats. +By default its value is \fB"ap"\fP. +.TP +\fBMBK_SCALE_X\fP +internally \fBlong SCALE_X\fP. Defines a scale factor for all coordinates, in +order to be able to use files that works with half lambda rules for example. +Parsers, drivers and genlib's macros use it extensivly. +Its value is ten by default. +.TP +\fbMBK_IN_FILTER\fp +internaly \fbIN_FILTER\fb. Filter string for reading compressed Alliance files. +It has no value by default, means no filter is used. +.TP +\fbMBK_OUT_FILTER\fp +internaly \fbOUT_FILTER\fb. Filter string for writing compressed Alliance files. +It has no value by default, means no filter is used. +.TP +\fbMBK_FILTER_SFX\fp +internaly \fbFILTER_SFX\fb. Extention of compressed files. +It has no value by default, means no filter is used. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +lofig_list \(**load_fig(name) +char \(**name; +{ + mbkenv(); /\(** make sure the good environnement is used \(**/ + return getlofig(name, 'A'); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR genlib (1), +.BR loadlofig (3), +.BR loadphfig (3), +.BR savelofig (3), +.BR savephfig (3), +.BR isvdd (3), +.BR isvss (3), +.BR concatname (3), +.BR nameindex (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkfopen.3 b/alliance/src/mbk/man3/mbkfopen.3 new file mode 100644 index 00000000..6b25128b --- /dev/null +++ b/alliance/src/mbk/man3/mbkfopen.3 @@ -0,0 +1,115 @@ +.\" $Id: mbkfopen.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkfopen.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkfopen +.XE +.XS4 \n% +.ti 0.2i +mbkfopen +.XE4 \} +.TH MBKFOPEN 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkfopen \- open a file with several search pathes +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +FILE \(**mbkfopen(name, extension, mode) +char \(**name, \(**extension, \(**mode; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIname\fP +Name of the file to be opened +.TP +\fIextension\fP +Extension to the file name +.TP +\fImodel\fP +File opening mode +.SH DESCRIPTION +\fBmbkfopen\fP opens a file, searching it through the pathes given in the +environment variables \fBMBK_CATA_LIB\fP(1) and \fBMBK_WORK_LIB\fP(1). +Its main issue is to enable simple file access for any program that works +with mbk path environment variables. +.br +The file to be opened is called \fIname.extension\fP, if extension is not +\fBNULL\fP, else it is \fIname\fP. If \fIextension\fP is the empty string, +\fB""\fP, then the file name will be \fIname.\fP\~. +.br +The legal values for \fImode\fP are +.TP 20 +\fBREAD_TEXT\fP +opens for reading +.TP +\fBWRITE_TEXT\fP +discards and opens for writting +.br +since disk access should be a straight forward operation knowing mbk's needs. +.LP +The search algorithm depends on the value of \fImode\fP. +If \fImode\fP is \fBWRITE_TEXT\fP, then the file is open for writting in +\fBMBK_WORK_LIB\fP(1). If \fImode\fP is \fBREAD_TEXT\fP then the file is first +searched through \fBMBK_WORK_LIB\fP(1), and if not found, through each directory +specified in \fBMBK_CATA_LIB\fP(1), in the order of declaration under unix. +No internal hash table is generated, in order to let the user choose its +directory priority. +As soon as the file is found, it is opened. +There is no check for redundant files in the specified pathes, since it is +neither illegal nor bad to have many files with the same names. +.SH RETURN VALUE +\fBmbkfopen\fP returns a pointer to the opened file. +If the file read or write access are violated, or the file not found, +a \fBNULL\fP pointer is returned. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** mbkfopen : unknown file opening mode \fImode\fP" +.ft R +.RS +The \fImode\fP parameter is not one of the two legal values. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mph.h" +phfig_list \(**load_vti_ph(name) +char \(**name; +{ +FILE \(**file; + if ((file = mbkfopen(name, "cp", READ_TEXT)) == NULL) { + (void)fprintf(stderr, "Pfhhh, can't open \fIname.cp\fP\\n"); + EXIT(); + } + ph_parse(file); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR MBK_CATA_LIB (1), +.BR MBK_WORK_LIB (1), +.BR loadlofig (3), +.BR loadphfig (3), +.BR savelofig (3), +.BR savephfig (3), +.BR fopen (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkfree.3 b/alliance/src/mbk/man3/mbkfree.3 new file mode 100644 index 00000000..652b820d --- /dev/null +++ b/alliance/src/mbk/man3/mbkfree.3 @@ -0,0 +1,65 @@ +.\" $Id: mbkfree.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkfree.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkfree +.XE +.XS4 \n% +.ti 0.2i +mbkfree +.XE4 \} +.TH MBKFREE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkfree \- mbk memory allocator +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void mbkfree(p) +void \(**p; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIp\fP +Pointer to be given back to the system +.SH DESCRIPTION +\fBmbkfree\fP frees a pointer. +It is now a day just an encapsulation of the system \fBfree\fP function, +but may evolve to a special allocator in the future. Its use is strongly +encouraged. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +void free_con(pt) +lofig_list \(**pt; +{ +locon_list \(**c = pt\->LOCON, \(**next; + while (c) { + next = c\->NEXT; + mbkfree((void \(**)c); + c = next; + } + pt\->LOCON = NULL; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkalloc (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkgetenv.3 b/alliance/src/mbk/man3/mbkgetenv.3 new file mode 100644 index 00000000..c19e036f --- /dev/null +++ b/alliance/src/mbk/man3/mbkgetenv.3 @@ -0,0 +1,30 @@ +.TH MBKGETENV 3 "$Date: 2002/03/08 13:51:03 $" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +\fBmbkgetenv\fP \- get an environment variable + +.so man1/alc_origin.1 + +.SH SYNOPSIS +.nf +.B #include "MUT_H" +.sp +.BI "char *mbkgetenv(const char *" name ); +.fi +.SH DESCRIPTION +The \fBmbkgetenv()\fP function searches the environment list for a string +that matches the string pointed to by \fIname\fP. The strings are of +the form \fIname = value\fP. +.SH "RETURN VALUE" +The \fBmbkgetenv()\fP function returns a pointer to the value in the +environment, or NULL if there is no match. +If \fBMBK_TRACE_GETENV\fR is set to "yes", mbkgetenv() will print debug info to stdout before thre real getenv() syscall is done. + +.SH SEE ALSO +.PP +.BR mbk(1) +.BR MBK_TRACE_GETENV(1) +.BR getenv(3). + +.so man1/alc_bug_report.1 + + diff --git a/alliance/src/mbk/man3/mbkps.3 b/alliance/src/mbk/man3/mbkps.3 new file mode 100644 index 00000000..ba2eb302 --- /dev/null +++ b/alliance/src/mbk/man3/mbkps.3 @@ -0,0 +1,77 @@ +.\" $Id: mbkps.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkps.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkps +.XE +.XS4 \n% +.ti 0.2i +mbkps +.XE4 \} +.TH MBKPS 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkps \- mbk process state +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void mbkps() +.ft R +.fi +.SH DESCRIPTION +\fBmbkps\fP does some functions calls and gathers informations about +time and memory spend during a program run. +encouraged. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +lofig_list \(**check_flat(pt) +lofig_list \(**pt; +{ + mbkps(); + pt = rflattenlofig(pt, YES, NO); + mbkps(); + return pt; +} +.ft R +.fi +that would output something like : +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +mbk stats : 1 call +user time : 0 sec +system time : 0 sec +real size : 504 k +mbkalloc peak size : 68 k +mallinfo size : 96 k +mbk stats : 2 call +user time : 1 sec +system time : 0 sec +real size : 924 k +mbkalloc peak size : 2560 k +mallinfo size : 512 k +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR getrusage (3), +.BR mallinfo (3V). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkrealloc.3 b/alliance/src/mbk/man3/mbkrealloc.3 new file mode 100644 index 00000000..0bc6dcb2 --- /dev/null +++ b/alliance/src/mbk/man3/mbkrealloc.3 @@ -0,0 +1,83 @@ +.\" $Id: mbkrealloc.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkrealloc.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkrealloc +.XE +.XS4 \n% +.ti 0.2i +mbkrealloc +.XE4 \} +.TH MBKREALLOC 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkrealloc \- mbk memory reallocator +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void \(**mbkrealloc(pt, bytes) +void \(**pt; +unsigned int bytes; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIpt\fP +Pointer to an already allocated area, allocated using \fBmbkalloc\P +.TP 20 +\fIbytes\fP +Number of memory bytes to be contiguously allocated +.SH DESCRIPTION +\fBmbkrealloc\fP returns a block of \fIbytes\fP length, for any purpose. +It increases or decreases the size of the area, and return a pointer to +the new block. +It is now a day only an encapsulation of the system \fBrealloc\fP function, +but may evolve to a special allocator in the future. Its use is strongly +encouraged. +.TP 20 +Remark : +a global variable, \fBlong mbkrealloc_stat\fP, updates the number of allocated +bytes, and may be accessed by anyone to see the amount of allocated memory. +.SH RETURN VALUE +\fBmbkrealloc\fP returns a pointer to a \fIbytes\fP long block. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** mbkrealloc impossible : not enough memory" +.ft R +.RS +System break can't be moved anymore, no more memory can be retrieved from +the system. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**concatstring(t, s); +{ + t = (char \(**)mbkrealloc(strlen(t) + strlen(s) + 1); + strcat(t, s); + return t; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkalloc (3), +.BR mbkfree (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbksetautoackchld.3 b/alliance/src/mbk/man3/mbksetautoackchld.3 new file mode 100644 index 00000000..db3b5a7c --- /dev/null +++ b/alliance/src/mbk/man3/mbksetautoackchld.3 @@ -0,0 +1,48 @@ +.\" $Id: mbksetautoackchld.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkalloc.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkalloc +.XE +.XS4 \n% +.ti 0.2i +mbkalloc +.XE4 \} +.TH MBKSETAUTOACKCHLD 3 "November 20, 2000" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbksetautoackchld \- Tells Alliance to automatically handle terminaison of child process. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void mbksetautoackchld( pid ) +int pid; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpid\fP +Process pid to automatically handle. +.SH DESCRIPTION +\fBmbksetautoackchld\fP provide a centralised way to catch terminated child +process. Because some Alliance library can create a child process, and user +application can do so, there must be a centralized way to get the exit status +of process. If the programmer don't want to know the state of a child process, +or if he don't want to know what is the terminaison code of such process, he +must tells it to Alliance with this call. The programmer should never modify +the handler of SIGCHLD. +.SH RETURN VALUE +\fBmbksetautoackchld\fP don't return value. +.SH SEE ALSO +.BR mbk (1), +.BR mbkwaitpid (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkunlink.3 b/alliance/src/mbk/man3/mbkunlink.3 new file mode 100644 index 00000000..0da1c8fc --- /dev/null +++ b/alliance/src/mbk/man3/mbkunlink.3 @@ -0,0 +1,80 @@ +.\" $Id: mbkunlink.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkunlink.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkunlink +.XE +.XS4 \n% +.ti 0.2i +mbkunlink +.XE4 \} +.TH MBKUNLINK 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkunlink \- delete a file in the \fBWORK_LIB\P. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +FILE \(**mbkunlink(name, extension) +char \(**name, \(**extension; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIname\fP +Name of the file to be deleted +.TP +\fIextension\fP +Extension to the file name +.SH DESCRIPTION +\fBmbkunlink\fP deletes a file, searching it in the path specified with +the environment variable \fBMBK_WORK_LIB\fP(1). +Its main issue is to enable simple file deletion for any program that works +with mbk path environment variables. +.br +The file to be erased is called \fIname.extension\fP, if extension is not +\fBNULL\fP, else it is \fIname\fP. If \fIextension\fP is the empty string, +\fB""\fP, then the file name will be \fIname.\fP\~. +.br +.SH RETURN VALUE +\fBmbkunlink\fP returns : +.TP 20 +\-\fB1\fP +on failure, ie the file is not in the \fBMBK_WORK_LIB\fP path. +.TP 20 +\fB0\fP +on success. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mph.h" +void update_work_lib(name) +char \(**name; +{ +char *path; + if (incatalogdelete(name)) + if (mbkunlink(name, "cp")) + fprintf(stdout, "The file %s.cp was not in the work lib\n", + name); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR MBK_WORK_LIB (1), +.BR unlink (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mbkwaitpid.3 b/alliance/src/mbk/man3/mbkwaitpid.3 new file mode 100644 index 00000000..013d6383 --- /dev/null +++ b/alliance/src/mbk/man3/mbkwaitpid.3 @@ -0,0 +1,53 @@ +.\" $Id: mbkwaitpid.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mbkalloc.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mbkalloc +.XE +.XS4 \n% +.ti 0.2i +mbkalloc +.XE4 \} +.TH MBKWAITPID 3 "November 20, 2000" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +mbkwaitpid \- wait for the end of a particular child process. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +int mbkwaitpid( pid, mode, status ) +int pid; +int mode; +int \(**status; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpid\fP +Process number to wait. +.TP +\fImode\fP +If mode is set to 1, this function return only when the child process is +terminated. Otherwise, function return immediatly. +.TP +\fIstatus\fP +If not NULL, the exit status of terminated child process. +.SH DESCRIPTION +\fBmbkwaitpid\fP provides a centralized way to catch terminated child process. +Because some Alliance library can create a child process, and user application +can do so, there must be a centralized way to get the exit status of process. +The programmer should never modify the handler for SIGCHLD. +.SH RETURN VALUE +\fBmbkwaitpid\fP return 1 if child process is terminated, and 0 if isn't (case +mode != 1 ). +.SH SEE ALSO +.BR mbk (1), +.BR mbksetautoackchld(). +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mlodebug.3 b/alliance/src/mbk/man3/mlodebug.3 new file mode 100644 index 00000000..249ff799 --- /dev/null +++ b/alliance/src/mbk/man3/mlodebug.3 @@ -0,0 +1,96 @@ +.\" $Id: mlodebug.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mlodebug.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mlodebug +.XE +.XS3 \n% +.ti 0.2i +mlodebug +.XE3 \} +.TH MLODEBUG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +mlodebug \- logical data structure contents debug function +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void mlodebug(headpointer, structurename) +void \(**headpointer; +char \(**structurename; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIheadpointer\fP +Pointer to a structure to be displayed +.TP 20 +\fIstructurename\fP +Name of the structure to be explored +.SH DESCRIPTION +\fBmlodebug\fP allows a user interactive visualisation of the internal contents +of the structural view of \fBmbk\fP. +.br +Through the use of a small, but convenient, textual user interface, a step +by step exploration of each fields of the data structure is made available. +However, if the structure is big, it may be painful to use. +.br +First of all, the contents of the expected struture is displayed, with +its fields named as they appear in the appropriate header file. +Then the user is prompted by a `>>' for an input. +.br +The input may be either a field name, or a predefined symbol. +Field names are to be typed the way they are displayed. +.br +Predefined symbols are: +.TP 20 +\fI_exit\fP +that quit the current debugging session. +.TP +\fI_up\fP +that comes back to the previous structure. +.TP +\fI_top\fP +returns to the root of the function invocation. +.TP +\fI_stop\fP +puts kind of a tag at the current position in the structure. +It will be available later on to return to this position. +.TP +\fI_back\fP +returns to the previous \fI_stop\fP position. +.LP +The debugger functions are easy to understand, so just try it! +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void scan_n1_y() +{ + getlofig("n1_y", 'A'); + mlodebug(HEAD_LOFIG, "lofig"); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR locon (3), +.BR loins (3), +.BR losig (3), +.BR lotrs (3), +.BR mphdebug (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/mphdebug.3 b/alliance/src/mbk/man3/mphdebug.3 new file mode 100644 index 00000000..cbeec351 --- /dev/null +++ b/alliance/src/mbk/man3/mphdebug.3 @@ -0,0 +1,95 @@ +.\" $Id: mphdebug.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)mphdebug.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +mphdebug +.XE +.XS1 \n% +.ti 0.2i +mphdebug +.XE1 \} +.TH MPHDEBUG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +mphdebug \- physical data structure contents debug function +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void mphdebug(headpointer, structurename) +void \(**headpointer; +char \(**structurename; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIheadpointer\fP +Pointer to a structure to be displayed +.TP 20 +\fIstructurename\fP +Name of the structure to be explored +.SH DESCRIPTION +\fBmphdebug\fP allows a user interactive visualisation of the internal contents +of the physical view of \fBmbk\fP. +.br +Through the use of a small, but convenient, textual user interface, a step +by step exploration of each fields of the data structure is made available. +However, if the structure is big, it may be painful to use. +.br +First of all, the contents of the expected struture is displayed, with +its fields named as they appear in the appropriate header file. +Then the user is prompted by a `>>' for an input. +.br +The input may be either a field name, or a predefined symbol. +Field names are to be typed the way they are displayed. +Predefined symbols are: +.TP 20 +\fI_exit\fP +that quit the current debugging session. +.TP +\fI_up\fP +that comes back to the previous structure. +.TP +\fI_top\fP +returns to the root of the function invocation. +.TP +\fI_stop\fP +puts kind of a tag at the current position in the structure. +It will be available later on to return to this position. +.TP +\fI_back\fP +returns to the previous \fI_stop\fP position. +.LP +The debugger functions are easy to understand, so just try it! +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void scan_na2_y() +{ + getphfig("na2_y", 'A'); + mphdebug(HEAD_PHFIG, "phfig"); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phcon (3), +.BR phins (3), +.BR phvia (3), +.BR phref (3), +.BR mlodebug (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/namealloc.3 b/alliance/src/mbk/man3/namealloc.3 new file mode 100644 index 00000000..b668d85f --- /dev/null +++ b/alliance/src/mbk/man3/namealloc.3 @@ -0,0 +1,85 @@ +.\" $Id: namealloc.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)namealloc.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +namealloc +.XE +.XS4 \n% +.ti 0.2i +namealloc +.XE4 \} +.TH NAMEALLOC 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +namealloc \- hash table for strings +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**namealloc(inputname) +char \(**inputname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIinputname\fP +Pointer to a string of characters +.SH DESCRIPTION +The \fBnamealloc\fP function creates a dictionnary of names in mbk. +It warranties equality on characters string if the pointers to these +strings are equal, at \fBstrcmp\fP(3) meaning. This means also that there +is a single memory address for a given string. +.br +The case of the letters do not matter. All names are changed to lower case +before beeing introduced in the symbol table. This is needed because most +of the file format do not check case. +.br +\fBnamealloc\fP is used by all mbk utility function using names, so its use +should be needed only when directly filling or modifing the structure, or when +having to compare an external string to mbk internal ones. This should speed +up string comparisons. +.br +One shall never modify the contains of a string pointed to by a result of +\fBnamealloc\fP, since all the field that points to this name would have +there values modified, and that there is no chance that the new hash code +will be the same as the old one, so pointer comparison would be +meaningless. All string used by \fBnamealloc\fP are constants string, and +therefore must be left alone. +.SH RETURN VALUE +\fBnamealloc\fP returns a string pointer. +If the \fIinputname\fP is already in the hash table, then its internal pointer +is returned, else a new entry is created, and then the new pointer returned. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +lofig_list \(**find_fig(name) +char \(**name; +{ +lofig_list \(**p; + name = namealloc(name); + for (p = HEAD_LOFIG; p; p = p\->NEXT) + if (p\->NAME == name) /\(** pointer equality \(**/ + return p; + return NULL; +} +.ft R +.fi +.SH DIAGNOSTICS +\fBnamealloc\fP can be used only after a call to \fBmbkenv\fP(3). +.SH SEE ALSO +.BR mbk (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/namefind.3 b/alliance/src/mbk/man3/namefind.3 new file mode 100644 index 00000000..f4219b5b --- /dev/null +++ b/alliance/src/mbk/man3/namefind.3 @@ -0,0 +1,86 @@ +.\" $Id: namefind.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)namefind.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +namefind +.XE +.XS4 \n% +.ti 0.2i +namefind +.XE4 \} +.TH namefind 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +namefind \- hash table for strings +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**namefind(inputname) +char \(**inputname; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIinputname\fP +Pointer to a string of characters +.SH DESCRIPTION +The \fBnamefind\fP function search the mbk dictionnary of names. +If the string has already been inserted in the dictionnary, then a pointer +to this string is return, else \fBnamefind\fP returns NULL. +.br +The case of the letters do not matter. All names are changed to lower case +before beeing searched in the symbol table. This is needed because most +of the file format do not check case. +.br +\fBnamefind\fP is used by all mbk utility function using names, so its use +should be needed only when directly filling or modifing the structure, or when +having to compare an external string to mbk internal ones. This should speed +up string comparisons. +.br +One shall never modify the contains of a string pointed to by a result of +\fBnamefind\fP, since all the field that points to this name would have +there values modified, and that there is no chance that the new hash code +will be the same as the old one, so pointer comparison would be +meaningless. All string used by \fBnamefind\fP are constants string, and +therefore must be left alone. +.SH RETURN VALUE +\fBnamefind\fP returns a string pointer if the \fIinputname\fP is already +in the hash table, else NULL. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +lofig_list \(**find_fig(name) +char \(**name; +{ +lofig_list \(**p; + name = namefind(name); + if (name == NULL) + return NULL; + for (p = HEAD_LOFIG; p; p = p\->NEXT) + if (p\->NAME == name) /\(** pointer equality \(**/ + return p; + return NULL; +} +.ft R +.fi +.SH DIAGNOSTICS +\fBnamefind\fP can be used only after a call to \fBmbkenv\fP(3). +.SH SEE ALSO +.BR mbk (1) +.BR namealloc(3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/nameindex.3 b/alliance/src/mbk/man3/nameindex.3 new file mode 100644 index 00000000..d11dc393 --- /dev/null +++ b/alliance/src/mbk/man3/nameindex.3 @@ -0,0 +1,70 @@ +.\" $Id: nameindex.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)nameindex.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +nameindex +.XE +.XS4 \n% +.ti 0.2i +nameindex +.XE4 \} +.TH NAMEINDEX 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +nameindex \- concatenate a name and index with user separator +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +char \(**nameindex(s, i) +char \(**s; +long i; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIs\fP +Pointer to a string +.TP +\fIt\fP +Long integer +.SH DESCRIPTION +The \fBnameindex\fP function adds the separator defined by \fBMBK_SEPAR\fP(1), +and then the string version of \fIi\fP at the end of string \fIs\fP. +This is not like a \fBstrcat\fP(3) of the standard library, because \fIs\fP is +not beeing modified. +.br +The string returned has already been put in the names dictionary by +a call to \fBnamealloc\fP(3). +.SH RETURN VALUE +\fBnameindex\fP returns a pointer to a string in the name hash table. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +void a_sig_name(ptsig) +losig_list \(**ptsig; +{ + return pt\->NAMECHAIN ? (char \(**)(pt\->NAMECHAIN\->DATA) + : nameindex("mbk_sig", pt\->INDEX); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR namealloc (3), +.BR MBK_SEPAR (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/naturalstrcmp.3 b/alliance/src/mbk/man3/naturalstrcmp.3 new file mode 100644 index 00000000..f413b2f9 --- /dev/null +++ b/alliance/src/mbk/man3/naturalstrcmp.3 @@ -0,0 +1,66 @@ +.\" $Id: naturalstrcmp.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)naturalstrcmp.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +naturalstrcmp +.XE +.XS4 \n% +.ti 0.2i +naturalstrcmp +.XE4 \} +.TH NATURALSTRCMP 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +naturalstrcmp \- compare string in alphabetical order for letters +and numerical for digits. +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +int naturalstrcmp(s, t) +char \(**s, \(**t; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIs\fP +Pointer to the first string to compare +.TP +\fIt\fP +Pointer to the second string to compare +.SH DESCRIPTION +\fBnaturalstrcmp\fP is an alphanumerical comparison function that ensures +\fBx12 > x2\fP for example. +First, the alphabetical part of the string is compared, using \fBstrcmp\fP(3), +then, if it has trailing numbers, they are compared using a numerical function. +.SH RETURN VALUES +\fBnaturalstrcmp\fP has the same return values than the standard library +\fBstrcmp\fP(3) function. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +static int + connectorcmp(flc, slc) +locon_list **flc, **slc; +{ + return naturalstrcmp((*slc)->NAME, (*flc)->NAME); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR strcmp (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/phcon.3 b/alliance/src/mbk/man3/phcon.3 new file mode 100644 index 00000000..f3efa7a9 --- /dev/null +++ b/alliance/src/mbk/man3/phcon.3 @@ -0,0 +1,154 @@ +.\" $Id: phcon.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)phcon.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +phcon +.XE +.XS0 \n% +.ti 0.2i +phcon +.XE0 \} +.TH PHCON 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL STRUCTURE DEFINITIONS" +.SH NAME +phcon \- mbk physical connector +.SH DESCRIPTION +The \fBphcon\fP structure is used to describe a connector belonging to a +symbolic layout model, see \fBphfig\fP(3) for details. A strong convention on +the mbk data structure is that two connector internally wired have the same +name, the 'logical' name. +.LP +The declarations needed to work on \fBphcon\fP are available in the header file +\fI"/labo/include/mph402.h"\fP, where '\fI402\fP' is the actual mbk version. +.LP +The following C structure supports the description of the connector : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct phcon { + struct phcon \(**NEXT; + char \(**NAME; + long INDEX; + long XCON, YCON; + long WIDTH; + char ORIENT; + char LAYER; + struct ptype \(**USER; +} phcon_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next connector of the model. +.TP +\fINAME\fP +Name of the connector. A model may posseses more than one connector with a +given name, if they are internally wired. +.TP +\fIINDEX\fP +Index of the connector. Since a model may have many connectors with the same +name, it is needed to be able to point out one of them. The index allows to +distinguish every connector using a topological order. This field is filled +by the \fBaddphcon\fP function, and shall not be modified otherwise. +.TP +\fIXCON, YCON\fP +Connector coordinates. the point \fI(XCON, YCON)\fP must be placed on or +inside of the \fIabutment box\fP of the model. +.TP +\fIORIENT\fP +Caracter indicating the face of the model on the which the connector is placed. +It may take four values : +.RS +.TP 20 +\fBNORTH\fP +connector placed on top of cell +.TP +\fBSOUTH\fP +connector placed on bottom of cell +.TP +\fBEAST\fP +connector placed on right of cell +.TP +\fBWEST\fP +connector placed on left of cell +.RE +.TP +\fILAYER\fP +Symbolic layer used for the connector. The legal values are : +.RS +.TP 20 +\fBNWELL\fP +N bulk +.TP +\fBPWELL\fP +P bulk +.TP +\fBNTIE\fP +N implant in P bulk +.TP +\fBPTIE\fP +P implant in N bulk +.TP +\fBNDIF\fP +N diffusion +.TP +\fBPDIF\fP +P diffusion +.TP +\fBNTRANS\fP +N transistor +.TP +\fBPTRANS\fP +P transistor +.TP +\fBPOLY\fP +polysilicium +.TP +\fBALU1\fP +first metal +.TP +\fBALU2\fP +second metal +.TP +\fBALU3\fP +third metal +.TP +\fBTPOLY\fP +polysilicum through route +.TP +\fBTALU1\fP +first metal through route +.TP +\fBTALU2\fP +second metal through route +.TP +\fBTALU3\fP +third metal through route +.RE +.TP +\fIWIDTH\fP +Width of the connector. The physical extension, concerning the width, of a +connector is paralell to its face. +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP for details, that is a general purpose +pointer used to share informations on the connector. +.SH SEE ALSO +.BR mbk (1), +.BR addphcon (3), +.BR getphcon (3), +.BR delphcon (3), +.BR phfig (3), +.BR phref (3), +.BR locon (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/phfig.3 b/alliance/src/mbk/man3/phfig.3 new file mode 100644 index 00000000..49838a4c --- /dev/null +++ b/alliance/src/mbk/man3/phfig.3 @@ -0,0 +1,135 @@ +.\" $Id: phfig.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)phfig.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.ta 1.5i 5.0i +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +phfig +.XE +.XS0 \n% +.ti 0.2i +phfig +.XE0 \} +.TH PHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL STRUCTURE DEFINITIONS" +.SH NAME +phfig \- mbk physical figure +.SH DESCRIPTION +The \fBphfig\fP is used to describe a hierarchical level of a +\fIsymbolic layout\fP +and may contain any of the legal physical objects needed for a layout but +a \fBphfig\fP. +All coordinates are \fIsymbolic\fP and therefor put on a virtual grid in booth +x and y directions. +.LP +The declarations needed to work on \fBphfig\fP are available in the header file +\fI"/labo/include/mph402.h"\fP, where '\fI402\fP' is the actual mbk version. +.LP +The following C structure supports the description of the layout view : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct phfig { + struct phfig \(**NEXT; + struct chain \(**MODELCHAIN; + struct phseg \(**PHSEG; + struct phvia \(**PHVIA; + struct phref \(**PHREF; + struct phins \(**PHINS; + struct phcon \(**PHCON; + char \(**NAME; + char MODE; + long XAB1, YAB1, XAB2, YAB2; + struct ptype \(**USER; +} phfig_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBphfig\fP present in ram. +.TP +\fINAME\fP +Name of the figure. It identifies a figure (or \fImodel\fP), so it should +be unique in order to warranty consistency of cells libraries. In order +to ensure this consistency, the \fINAME\fP field must be filled with the +disk file name while parsing, and must be used as file name for driving. +.TP +\fIPHINS\fP +Pointer to the head of the list of instances being used for the model +description. See \fBphins\fP(3) for details. +.TP +\fIPHCON\fP +Pointer to the head of the list of connectors (terminals) of the model. +See \fBphcon\fP(3) for details. +.TP +\fIPHSEG\fP +Pointer to the head of the list of segments (wires) of the model. +See \fBphseg\fP(3) for details. +.TP +\fIPHVIA\fP +Pointer to the head of the list of contacs and vias of the model. +See \fBphvia\fP(3) for details. +.TP +\fIPHREF\fP +Pointer to the head of the list of references of the model. +See \fBphref\fP(3) for details. +.TP +\fIXAB1, YAB1, XAB2, YAB2\fP +Coordinates of the bottom left corner of the \fIabutment box\fP of the +figure. The \fIabutment box\fP of a model represents the external visibility of +a figure and is what reference is made to when instanciating the model. +One should well distinguish the \fIabutment box\fP from the \fIbounding box\fP, +which is the smallest rectangle that includes all cell descriptors. +The size and position of the \fIabutment box\fP is a designer concern, and +cannot be computed. +.TP +\fIMODE\fP +Caracter indicating the status of the figure in memory. This field can +take two values : +.RS +.TP 10 +.B +\'A\' +all the cell is loaded in ram. +.TP +.B +\'P\' +only information concerning the model interface is present, that +means connectors and the \fIabutment box\fP. All other lists are empty. +.RE +.TP +\fIMODELCHAIN\fP +Pointer to a chain list, see \fBchain\fP(3) for details, of names. These are the +names of the models that are at least instanciated once in the figure. +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, +that is a general purpose +pointer used to share informations on the model. +.TP +Remark : +mbk's physical view of a cell is releted to it's logical view by means +of connector names, that must be identical. +.SH SEE ALSO +.BR mbk (1), +.BR addphfig (3), +.BR getphfig (3), +.BR delphfig (3), +.BR loadphfig(3), +.BR savephfig (3), +.BR phins (3), +.BR phvia (3), +.BR phcon (3), +.BR phseg (3), +.BR phref (3), +.BR ptype (3), +.BR lofig (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/phins.3 b/alliance/src/mbk/man3/phins.3 new file mode 100644 index 00000000..34d60c96 --- /dev/null +++ b/alliance/src/mbk/man3/phins.3 @@ -0,0 +1,106 @@ +.\" $Id: phins.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)phins.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +phins +.XE +.XS0 \n% +.ti 0.2i +phins +.XE0 \} +.TH PHINS 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL STRUCTURE DEFINITIONS" +.SH NAME +phins \- mbk physical instance +.SH DESCRIPTION +The \fBphins\fP structure is used to describe a instance belonging to a +symbolic layout model, see \fBphfig\fP(3) for details. +.LP +The declarations needed to work on \fBphins\fP are available in the header file +\fI"/labo/include/mph402.h"\fP, where '\fI402\fP' is the actual mbk version. +.LP +The following C structure supports the description of the instance : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct phins { + struct phins \(**NEXT; + char \(**INSNAME; + char \(**FIGNAME; + long XINS,YINS; + char TRANSF; + struct ptype \(**USER; +} phins_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next instance in the list. +.TP +\fIFIGNAME\fP +Model of the instance. This gives the name of the figure that is currently +beeing instanciated. The model may not be present in memory. +.TP +\fINAME\fP +Name of the instance. The instance is identified by its name, so it should be +unique at a given hierarchical level. +.TP +\fIXINS, YINS\fP +Coordinates of the lower left corner of the instance, after possible +geometrical operation. +.TP +\fITRANSF\fP +Contains the geometrical operations that should be performed before placing +the instance. Eight legal values are allowed : +.RS +.TP 20 +\fBNOSYM\fP +no operation +.TP +\fBSYM_X\fP +x becomes -x +.TP +\fBSYM_Y\fP +y becomes -y +.TP +\fBSYMXY\fP +x becomes -x and y becomes -y +.TP +\fBROT_P\fP +rotates 90 degrees counter clockwise +.TP +\fBROT_M\fP +rotates 90 degrees clockwise +.TP +\fBSY_RP\fP +x becomes -x then rotates 90 degrees counter clockwise +.TP +\fBSY_RM\fP +x becomes -x then rotates 90 degrees clockwise +.RE +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, that is a general +purpose pointer used to share informations on the instance. +.TP +Remark : +the \fBphins\fP structure does not contain any information about +the size of the instance. Neither the \fIabutment box\fP nor the connectors +are available. The model must be loaded when such information is needed. +.SH SEE ALSO +.BR mbk (1), +.BR addphins (3), +.BR getphins (3), +.BR delphins (3), +.BR phfig (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/phref.3 b/alliance/src/mbk/man3/phref.3 new file mode 100644 index 00000000..33d19128 --- /dev/null +++ b/alliance/src/mbk/man3/phref.3 @@ -0,0 +1,81 @@ +.\" $Id: phref.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)phref.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +phref +.XE +.XS0 \n% +.ti 0.2i +phref +.XE0 \} +.TH PHREF 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL STRUCTURE DEFINITIONS" +.SH NAME +phref \- mbk physical reference +.SH DESCRIPTION +The \fBphref\fP structure is used to describe a reference belonging to a +symbolic layout model, see \fBphfig\fP(3) for details. +A reference allows to name a point anywhere in a given model. It may then +be seen as a name, and not anymore as a couple of coordinates. +References are mostly used for cell programming and multi-access connector +representation. +.LP +The declarations needed to work on \fBphref\fP are available in the header file +\fI"/labo/include/mph402.h"\fP, where '\fI402\fP' is the actual mbk version. +.LP +The following C structure supports the description of the reference : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct phref { + struct phref \(**NEXT; + char \(**FIGNAME; + char \(**NAME; + long XREF,YREF; + struct ptype \(**USER; +} phref_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next reference in the list. +.TP +\fIFIGNAME\fP +Kind of reference. Gives information about the possible uses of the object. +Some \fIFIGNAME\fP are in use today : +.RS +.TP 20 +\fB"ref_con"\fP +for multi-access connectors +.TP +\fB"ref_ref"\fP +for all other uses +.RE +.TP +\fINAME\fP +Name of the reference. The refence is identified by its name, so it should be +unique at a given hierarchical level. +.TP +\fIXREF, YREF\fP +Coordinates of the point beeing referenced. +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, that is a general +purpose pointer used to share informations on the reference. +.SH SEE ALSO +.BR mbk (1), +.BR addphref (3), +.BR getphref (3), +.BR delphref (3), +.BR phfig (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/phseg.3 b/alliance/src/mbk/man3/phseg.3 new file mode 100644 index 00000000..99e99690 --- /dev/null +++ b/alliance/src/mbk/man3/phseg.3 @@ -0,0 +1,141 @@ +.\" $Id: phseg.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)phseg.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +phseg +.XE +.XS0 \n% +.ti 0.2i +phseg +.XE0 \} +.TH PHSEG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL STRUCTURE DEFINITIONS" +.SH NAME +phseg \- mbk physical segment +.SH DESCRIPTION +The \fBphseg\fP structure is used to describe a segment belonging to a +symbolic layout model, see \fBphfig\fP(3) for details. +Transistors are segments of a particular layer. +.LP +The declarations needed to work on \fBphseg\fP are available in the header file +\fI"/labo/include/mph402.h"\fP, where '\fI402\fP' is the actual mbk version. +.LP +The following C structure supports the description of the segment : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct phseg { + struct phseg \(**NEXT; + char \(**NAME; + long X1,Y1,X2,Y2; + long WIDTH; + char TYPE; + char LAYER; + struct ptype \(**USER; +} phseg_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next segment in the list. +.TP +\fINAME\fP +Name of the segment. The name is not an identifier, and a name is present only +if the designer used one for debug purposes. +.TP +\fIX1, Y1, X2, Y2\fP +Coordinates of each end of the segment. Since it's a symbolic segment, one +alway has either \fIX1 = X2\fP or \fIY1 = Y2\fP. Furthermore, by construction, +it is warranty, if one accesses the data structure through the legal functions, +that \fIX1 <= X2\fP and \fIY1 <= Y2\fP. +.TP +\fITYPE\fP +This caracter can take four values : +.RS +.TP 20 +\fBLEFT\fP or \fBRIGHT\fR +if \fIY1 = Y2\fP. +The exact value is chosen by \fBaddphseg\fR, depending upon \fIX1\fR and +\fBX2\fP relations. +.TP +\fBUP\fP or \fBDOWN\fR +if \fIX1 = X2\fP +.RE +.TP +\fILAYER\fP +Symbolic layer used for the segment. The legal values are : +.RS +.TP 20 +\fBNWELL\fP +N bulk +.TP +\fBPWELL\fP +P bulk +.TP +\fBNTIE\fP +N implant in P bulk +.TP +\fBPTIE\fP +P implant in N bulk +.TP +\fBNDIF\fP +N diffusion +.TP +\fBPDIF\fP +P diffusion +.TP +\fBNTRANS\fP +N transistor +.TP +\fBPTRANS\fP +P transistor +.TP +\fBPOLY\fP +polysilicium +.TP +\fBALU1\fP +first metal +.TP +\fBALU2\fP +second metal +.TP +\fBALU3\fP +third metal +.TP +\fBTPOLY\fP +polysilicum through route +.TP +\fBTALU1\fP +first metal through route +.TP +\fBTALU2\fP +second metal through route +.TP +\fBTALU3\fP +third metal through route +.RE +.TP +\fIWIDTH\fP +Width of the segment. The physical extension of a segment is perpendicular +to its direction. +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP for details, that is a general purpose +pointer used to share informations on the segment. +.SH SEE ALSO +.BR mbk (1), +.BR addphseg (3), +.BR getphseg (3), +.BR delphseg (3), +.BR phfig (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/phvia.3 b/alliance/src/mbk/man3/phvia.3 new file mode 100644 index 00000000..1c030636 --- /dev/null +++ b/alliance/src/mbk/man3/phvia.3 @@ -0,0 +1,92 @@ +.\" $Id: phvia.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)phvia.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +phvia +.XE +.XS0 \n% +.ti 0.2i +phvia +.XE0 \} +.TH PHVIA 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL STRUCTURE DEFINITIONS" +.SH NAME +phvia \- mbk physical contact +.SH DESCRIPTION +The \fBphvia\fP structure is used to describe a via or contact belonging to a +symbolic layout model, see \fBphfig\fP(3) for details. +.LP +The declarations needed to work on \fBphvia\fP are available in the header file +\fI"/labo/include/mph402.h"\fP, where '\fI402\fP' is the actual mbk version. +.LP +The following C structure supports the description of the via : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct phvia { + struct phvia \(**NEXT; + char TYPE; + long XVIA,YVIA; + struct ptype \(**USER; +} phvia_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBphvia\fP in the list. +.TP +\fIXVIA, YVIA\fP +Coordinates of the center of the via. Vias are macro generated patterns, +so only their center is a matter of concern. +.TP +\fITYPE\fP +Via type. The legal types for via are +.RS +.TP 20 +\fBCONT_POLY\fP +poly alu1 contact +.TP +\fBCONT_VIA\fP +alu2 alu1 contact +.TP +\fBCONT_DIF_N\fP +alu1 difn contact +.TP +\fBCONT_DIF_P\fP +alu1 difp contact +.TP +\fBCONT_BODY_N\fP +alu1 nwell contact +.TP +\fBCONT_BODY_P\fP +alu1 pwell contact +.TP +\fBCONT_VIA2\fP +alu2 alu3 contact +.TP +\fBC_X_N\fP +L shaped N transistor corner filling +.TP +\fBC_X_P\fP +L shaped P transistor corner filling +.RE +.TP +\fIUSER\fP +Pointer to a ptype list, see \fBptype\fP(3) for details, that is a general +purpose pointer used to share informations on the via. +.SH SEE ALSO +.BR mbk (1), +.BR addphvia (3), +.BR delphvia (3), +.BR phfig (3), +.BR ptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/ptype.3 b/alliance/src/mbk/man3/ptype.3 new file mode 100644 index 00000000..c2b0bd93 --- /dev/null +++ b/alliance/src/mbk/man3/ptype.3 @@ -0,0 +1,88 @@ +.\" $Id: ptype.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)ptype.l 0.0 90/22/08 UPMC; Author: Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +ptype +.XE +.XS4 \n% +.ti 0.2i +ptype +.XE4 \} +.TH PTYPE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY STRUCTURE DEFINITIONS" +.SH NAME +ptype \- mbk list of typed pointers +.SH DESCRIPTION +The \fBptype\fP is used to save typed pointers in a list. +The use of this structure is strongly recommanded, when such a need occurs. +It is the case in the \fIUSER\fP field of all mbk layout and netlist objects, +where data specific to different proccessing may be accessed through this +unique field. It is the charge of the user to give its pointers a type that +will not collide with existing types. +.LP +The declarations needed to work on \fBptype\fP are available in the header file +\fI"/labo/include/mut315.h"\fP, where '\fI315\fP' is the actual mbk version. +.LP +The following C structure describes the list of typed pointers : +.RS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.ta 3n 20n 30n +typedef struct ptype { + struct ptype \(**NEXT; + void \(**DATA; + long TYPE; +} ptype_list; +.ft R +.fi +.RE +.TP 20 +\fINEXT\fP +Pointer to the next \fBptype\fP of the list. +.TP +\fIDATA\fP +Generic pointer that may point where the user wants to. +.TP +\fITYPE\fP +Identifier of the user of the pointed data. One shall not access someone else +\fBptype\fP since it doesn't know what's in it. This means also that a +\fBptype\fP user should free the space taken by its datas since it is the only +one to know how to do it. +.TP +Remark 1: +a specialized memory allocator has been built in order to create and free +\fIptype_list\fPs, so absolutly avoid to create or free them an other way than +through the access functions. +.TP +Remark 2: +Now a day, three tools are known to use the \fIUSER\fP field of some +mbk structures : +.RS +.TP 20 +\fBVTIPARSER\fP +the parser of vti physical format '\fI.cp\fP' files uses the \fBphcon\fP(3) +\fIUSER\fP field. +.TP +\fBLOFIGCHAIN\fP +the \fBlofigchain\fP function constructs a dual representation of the netlist +in the \fIUSER\fP field of the \fBlosig\fP(3) structure. +.TP +\fBPLACEABOX\fP +Genlib's physical placement functions, in order to have model sizes in +instances. +It uses the \fBphins\fP(3) \fIUSER\fP field. +.RE +.SH SEE ALSO +.BR mbk (1), +.BR addptype (3), +.BR freeptype (3), +.BR getptype (3), +.BR delptype (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/restorealldir.3 b/alliance/src/mbk/man3/restorealldir.3 new file mode 100644 index 00000000..c8dbca95 --- /dev/null +++ b/alliance/src/mbk/man3/restorealldir.3 @@ -0,0 +1,82 @@ +.\" $Id: restorealldir.3,v 1.1 2002/03/08 13:51:03 fred Exp $ +.\" @(#)restorealldir.2 1.00 92/10/27 ; Labo masi cao-vlsi; Author : Vincent POUILLEY +.\"modified by Frederic Petrot to meet the english language requirements! +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +restorealldir +.XE +.XS2 \n% +.ti 0.2i +restorealldir +.XE2 \} +.TH RESTOREALLDIR 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +restorealldir \- restore all instances' connectors directions +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int restorealldir(ptfig) +lofig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to a lofig_list +.SH DESCRIPTION +The \fBrestorealldir\fP function restores the directions of all the +connectors of the instances. +Each instance model logical view is loaded, and the \fBrestoredirvbe\fP +function applied. +If a model doesn't have a \fBvbe\fP file on the path, +the \fBrestorealldir\fP and \fBguessextdir\fP functions +are used on the model. +.br +It is the charge of the user to delete the models loaded in memory for the +function purpose. +.SH RETURN VALUE +\fBrestorealldir\fP returns \fB1\fP on success, \fB0\fP +if there is an error while reading the vbe file. +.SH ERROR +\fBrestorealldir\fP cannot give any errors, but the function use +\fBrestoredirvbe\fP +that can give errors reading vbe files. +see \fBrestoredirvbe\fP for details. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +lofig_list \(** getgoodlofig(figname, mode) +char \(**figname; +char mode; +{ +lofig_list \(**ptfig; + ptfig = getlofig(figname, mode); + restorealldir(ptfig); + return ptfig; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR locon (3), +.BR getlofig (3), +.BR restoredirvbe (3). +.BR guessextdir (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/restoredirvbe.3 b/alliance/src/mbk/man3/restoredirvbe.3 new file mode 100644 index 00000000..41ca09ee --- /dev/null +++ b/alliance/src/mbk/man3/restoredirvbe.3 @@ -0,0 +1,107 @@ +.\" $Id: restoredirvbe.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)restoredirvbe.2 1.00 92/10/27 ; Labo masi cao-vlsi; Author : Vincent POUILLEY +.\"modified by Frederic Petrot to meet the english language requirements! +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +restoredirvbe +.XE +.XS2 \n% +.ti 0.2i +restoredirvbe +.XE2 \} +.TH RESTOREDIRVBE 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +restoredirvbe \- restore connectors directions from behavioral view +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +int restoredirvbe(ptfig) +lofig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to a lofig_list +.SH DESCRIPTION +The \fBrestoredirvbe\fP function read the \fBPORT\fP section of the +\fIvhdl\fP behavuoiral view of the +figure, restores the externals connectors directions and order them +as indicated in the vbe. +.SH RETURN VALUE +\fBrestoredirvbe\fP returns \fB1\fP on success, \fB0\fP +if there is an error while reading the vbe file, \fB-1\fP if their is no vbe. +.SH ERROR +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** restoredirvbe : no figure given" +.ft R +.RS +The ptfig parameter is NULL. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** restoredirvbe : figure %s have more connectors than vbe" +.ft R +.RS +Number of connetors in vbe and in figure must be identical. If the vbe have more +connectors, the getlocon function give an error on the unknown connector. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** restoredirvbe : cannot read port well!" +.ft R +.RS +To restore the connectors directions, the vbe description must have a port well. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** restoredirvbe : bit_vect neither to nor downto" +.ft R +.RS +In a port section of a vbe, the bit vector must have indication of the sens of incrementation. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +#include "mlo.h" +lofig_list \(** getgoodlofig(figname, mode) +char \(**figname; +char mode; +{ +lofig_list \(**ptfig; + ptfig = getlofig(figname, mode); + restoredirvbe(ptfig); + return ptfig; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR locon (3), +.BR getlofig (3), + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/reverse.3 b/alliance/src/mbk/man3/reverse.3 new file mode 100644 index 00000000..48fcd9aa --- /dev/null +++ b/alliance/src/mbk/man3/reverse.3 @@ -0,0 +1,67 @@ +.\" $Id: reverse.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)reverse.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +reverse +.XE +.XS4 \n% +.ti 0.2i +reverse +.XE4 \} +.TH REVERSE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +reverse \- reverse a list of \fBchain\fPed elements +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +chain_list \(**reverse(ptold) +chain_list \(**ptold; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptold\fP +Pointer to a \fBchain_list\fP to be reversed +.SH DESCRIPTION +The \fBreverse\fP function allows to reverse the order of the elements of +a \fIchain_list\fP. It means that the last element becomes the first one, +the one before the last one the second one, and so on. +.TP +remark : +all mbk structures have for first field the \fINEXT\fP field, so, with +appropriate cast, one can reverse any mbk list. Let's notice that nothing +in the C language description demands a structure to be defined in +memory the same way its members are defined in C. But all compiler do it +this way now a day. +Let's hope it will continue! +.SH RETURN VALUE +\fBreverse\fP returns a pointer to the head of the reversed list. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void reverse_con(p) +lofig_list \(**p; +{ + p\->LOCON = (locon_list \(**)reverse((chain_list \(**)p\->LOCON); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR chain (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/rflattenlofig.3 b/alliance/src/mbk/man3/rflattenlofig.3 new file mode 100644 index 00000000..ece66037 --- /dev/null +++ b/alliance/src/mbk/man3/rflattenlofig.3 @@ -0,0 +1,94 @@ +.\" $Id: rflattenlofig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)rflattenlofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +rflattenlofig +.XE +.XS3 \n% +.ti 0.2i +rflattenlofig +.XE3 \} +.TH RFLATTENLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +rflattenlofig \- recursivly flatten a figure +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlu.h" +void rflattenlofig(ptfig, concat, catal) +lofig_list \(**ptfig; +char concat; +char catal; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to a logical figure +.TP +\fIconcat\fP +Name generation mode +.TP +\fIcatal\fP +End level choice +.SH DESCRIPTION +\fBrflattenlofig\fP recursivly flattens all the instances of the figure +pointed to by \fIptfig\fP. +.br +The \fIconcat\fP argument can take either the value \fBYES\fP in which case the +name of the objects comming from instances are named +\fIinsname'X'objectname\fP, where \fI'X'\fP is the caracter set int the +\fBMBK_SEPAR\fP(1) environment variable, or the value \fBNO\fP, and then the +object name remains inchanged. This is quite dangerous since name unicity is +no more warrantied, and may cause the flatten to fail. See \fBMBK_SEPAR\fP(1), +\fBmbkenv\fP(3) and \fBconcatname\fP(3) for details. +.br +The \fIcatal\fP argument may be set to \fBNO\fP, in which case flattening stops +at the transistor level, all hierachies and instances have desapeard, only +terminal elements remains. If set to \fBYES\fP, flattening stops when it +encounters an instance model beeing present in the catalog file, set by +the \fBMBK_CATAL_NAME\fP(1) environment variable. +See \fBMBK_CATAL_NAME\fP(1) and \fBincatalog\fP(3) for details. +.SH ERRORS +No errors can directly result from a call to \fBrflattenlofig\fP, but since it +uses many other mbk functions, it may be a good error starting point. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlu.h" +void flatten_my_amd2901() +{ +loins_list \(**pt; + pt = getlofig("my_amd2901", 'A'); + rflattenlofig(pt, YES, YES); + pt\->NAME = "my_flattened_amd2901"; + savelofig(pt); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR incatalog (3), +.BR mbkenv (3), +.BR lofig (3), +.BR addlofig (3), +.BR getlofig (3), +.BR dellofig (3), +.BR loadlofig (3), +.BR savelofig (3), +.BR flattenlofig (3), +.BR MBK_CATAL_NAME (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/rflattenphfig.3 b/alliance/src/mbk/man3/rflattenphfig.3 new file mode 100644 index 00000000..1e6a3f35 --- /dev/null +++ b/alliance/src/mbk/man3/rflattenphfig.3 @@ -0,0 +1,94 @@ +.\" $Id: rflattenphfig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)rflattenphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +rflattenphfig +.XE +.XS1 \n% +.ti 0.2i +rflattenphfig +.XE1 \} +.TH RFLATTENPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +rflattenphfig \- recursivly flatten a figure +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void rflattenphfig(ptfig, concat, catal) +phfig_list \(**ptfig; +char concat; +char catal; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to a physical figure +.TP +\fIconcat\fP +Name generation mode +.TP +\fIcatal\fP +End level choice +.SH DESCRIPTION +\fBrflattenphfig\fP recursivly flattens all the instances of the figure +pointed to by \fIptfig\fP. +.br +The \fIconcat\fP argument can take either the value \fBYES\fP in which case the +name of the objects comming from instances are named +\fIinsname'X'objectname\fP, where \fI'X'\fP is the caracter set int the +\fBMBK_SEPAR\fP(1) environment variable, or the value \fBNO\fP, and then the +object name remains inchanged. This is quite dangerous since name unicity is +no more warrantied, and may cause the flatten to fail. See \fBMBK_SEPAR\fP(1), +\fBmbkenv\fP(3) and \fBconcatname\fP(3) for details. +.br +The \fIcatal\fP argument may be set to \fBNO\fP, in which case flattening stops +at the transistor level, all hierachies and instances have desapeard, only +terminal elements remains. If set to \fBYES\fP, flattening stops when it +encounters an instance model beeing present in the catalog file, set by +the \fBMBK_CATAL_NAME\fP(1) environment variable. See \fBMBK_CATAL_NAME\fP(1) and +\fBincatalog\fP(3) for details. +.SH ERRORS +No errors can directly result from a call to \fBrflattenphfig\fP, but since it +uses many other mbk functions, it may be a good error starting point. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void flatten_my_amd2901() +{ +phins_list \(**pt; + pt = getphfig("my_amd2901", 'A'); + rflattenphfig(pt, YES, YES); + pt\->NAME = "my_flattened_amd2901"; + savephfig(pt); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR incatalog (3), +.BR mbkenv (3), +.BR phfig (3), +.BR addphfig (3), +.BR getphfig (3), +.BR delphfig (3), +.BR loadphfig (3), +.BR savephfig (3), +.BR flattenphfig (3), +.BR MBK_CATAL_NAME (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/savelofig.3 b/alliance/src/mbk/man3/savelofig.3 new file mode 100644 index 00000000..3352168d --- /dev/null +++ b/alliance/src/mbk/man3/savelofig.3 @@ -0,0 +1,93 @@ +.\" $Id: savelofig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)savelofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +savelofig +.XE +.XS2 \n% +.ti 0.2i +savelofig +.XE2 \} +.TH SAVELOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +savelofig \- save a logical figure on disk +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlu.h" +void savelofig(ptfig) +lofig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to the \fIlofig\fP to be written on disk +.SH DESCRIPTION +\fBsavelofig\fP writes on disk the contents of the figure pointer to by +\fIptfig\fP. All the figure lists are ran through, and the appropriate objects +written, independently of the figure \fImode\fP. +.br +The \fBsavelofig\fP function in fact performs a call to a driver, choosen +by the \fBMBK_OUT_LO\fP(1) environment variable. The directory in which the file +is to be written is the one set by \fBMBK_WORK_LIB\fP(1). +See \fBMBK_OUT_LO\fP(1), \fBMBK_WORK_LIB\fP(1) and +\fBmbkenv\fP(3) for details. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** not supported logical output format 'xxx'" +.ft R +.RS +The environment variable \fIMBK_OUT_LO\fP is not set to a legal logical +format. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** savelofig : could not open file \fIfigname.ext\fP" +.ft R +.RS +Either the directory or the file are write protected, so it's not possible to +open \fIfigname.ext\fP, where \fIext\fP is the file format extension, for +writting. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlu.h" +void save_na2_y() +{ + savelofig(getlofig("na2_y")); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR lofig (3), +.BR addlofig (3), +.BR getlofig (3), +.BR dellofig (3), +.BR loadlofig (3), +.BR flattenlofig (3), +.BR rflattenlofig (3), +.BR MBK_OUT_LO (1), +.BR MBK_WORK_LIB (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/savephfig.3 b/alliance/src/mbk/man3/savephfig.3 new file mode 100644 index 00000000..a435523c --- /dev/null +++ b/alliance/src/mbk/man3/savephfig.3 @@ -0,0 +1,93 @@ +.\" $Id: savephfig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)savephfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +savephfig +.XE +.XS0 \n% +.ti 0.2i +savephfig +.XE0 \} +.TH SAVEPHFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL UTILITY FUNCTIONS" +.SH NAME +savephfig \- save a physical figure on disk +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mpu.h" +void savephfig(ptfig) +phfig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to the \fIphfig\fP to write on disk +.SH DESCRIPTION +\fBsavephfig\fP writes on disk the contents of the figure pointer to by +\fIptfig\fP. All the figure lists are ran through, and the appropriate objects +written, independently of the figure \fImode\fP. +.br +The \fBsavephfig\fP function in fact performs a call to a driver, choosen +by the \fIMBK_OUT_PH\fP(1) environment variable. The directory in which the file +is to be written is the one set by \fBMBK_WORK_LIB\fP(1). +See \fBMBK_OUT_PH\fP(1), \fBMBK_WORK_LIB\fP(1) and +\fBmbkenv\fP(3) for details. +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** not supported physical output format 'xxx'" +.ft R +.RS +The environment variable \fIMBK_OUT_PH\fP is not set to a legal physical +format. +.RE +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** savephfig : could not open file \fIfigname.ext\fP" +.ft R +.RS +Either the directory or the file are write protected, so it's not possible to +open \fIfigname.ext\fP, where \fIext\fP is the file format extension, for +writting. +.RE +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mpu.h" +void save_na2_y() +{ + savephfig(getphfig("na2_y")); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR phfig (3), +.BR addphfig (3), +.BR getphfig (3), +.BR delphfig (3), +.BR loadphfig (3), +.BR flattenphfig (3), +.BR rflattenphfig (3), +.BR MBK_OUT_PH (1), +.BR MBK_WORK_LIB (1). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/sethtitem.3 b/alliance/src/mbk/man3/sethtitem.3 new file mode 100644 index 00000000..8b6dd1e4 --- /dev/null +++ b/alliance/src/mbk/man3/sethtitem.3 @@ -0,0 +1,99 @@ +.\" $Id: sethtitem.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)sethtitem.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun +.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92 +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +sethtitem +.XE +.XS4 \n% +.ti 0.2i +sethtitem +.XE4 \} +.TH SETHTITEM 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS" +.SH NAME +sethtitem \- test and set an item in an hash table. +.so man1/alc_origin.1 +.SH SYNOPSYS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +int sethtitem(table, key) +ht \(**table; +void \(**key; +.fi +.SH PARAMETERS +.TP 20 +\fItable\fP +Hash table pointer +.TP 20 +\fIkey\fP +Key used by the hash coding function to set an item +.SH DESCRIPTION +\fBsethtitem()\fP adds an item in the hash table pointed to by \fItable\fP, +whether it existed or not, and returns an appropriate value. +This is kind of a \fItest and set\fP operator. +.SH RETURN VALUE +If the key exists, the funtion return 1, +if it doesn't, the item is stored and the function returns 0. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include +#include "mut.h" +checksigname(p) +lofig_list *p; +{ +int i; +losig_list *ptsig; +locon_list *ptcon; +ht *h; +char *amatla; + for (i = 0, ptsig = p->LOSIG; ptsig; i++, ptsig = ptsig->NEXT); + h = addht(i << 1); /* half empty hash tables are faster! */ + for (ptcon = p->LOCON; ptcon; ptcon = ptcon->NEXT) + addhtitem(h, ptcon->NAME, 0); + for (ptsig = p->LOSIG; ptsig; ptsig = ptsig->NEXT) { + if (ptsig->TYPE == INTERNAL) { + amatla = getsigname(ptsig); + if (!sethtitem(h, amatla, 0)) + printf("node %s is now unique\\n", amatla); + } + } + delht(h); +} +.fi +.ft R +.SH ERRORS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +"\(**\(**\(** mbk error \(**\(**\(** sethtitem impossible : +value is \fBEMPTYHT\fP or \fBDELETEHT\fP" +.ft R +.RS +The values \fBEMPTYHT\fP, \fI-1\fP, and \fBDELETEHT\fP, \fI-2\fP, are reserved +for internal use, sorry. +.SH DIAGNOSTICS +The value must be distinct from \fI-1\fP and \fI-2\fP. +.SH SEE ALSO +.BR mbk (1), +.BR addht (3), +.BR delht (3), +.BR addhtitem (3), +.BR gethtitem (3), +.BR delhtitem (3), +.BR viewht (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/sortlocon.3 b/alliance/src/mbk/man3/sortlocon.3 new file mode 100644 index 00000000..a9454792 --- /dev/null +++ b/alliance/src/mbk/man3/sortlocon.3 @@ -0,0 +1,71 @@ +.\" $Id: sortlocon.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)sortlocon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +sortlocon +.XE +.XS2 \n% +.ti 0.2i +sortlocon +.XE2 \} +.TH SORTLOCON 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +sortlocon \- sort the logical connectors of a figure by name +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void sortlocon(connectors) +locon_list \(**\(**connectors; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIconnectors\fP +Pointer to the head of the connector list that is to be sorted +.SH DESCRIPTION +\fBsortlocon\fP sorts the list of logical connectors pointed to +by \fI\(**connectors\fP. +The connectors are sorted by names, using a numerical comparison function +that ensures \fBx_12 > x_2\fP. +.br +The standart \fBqsort\fP(3) function library is called for sorting. +Therefore, a table the number of connectors wide is created. +This is not very memory consuming since the number of connectors in a circuit +interface is quite small, nor very time consuming since this algorithm runs +in a n log n time. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void savesorted(figname) +char \(**figname; +{ +lofig_list \(**figure = getlocon(figname, 'A'); + sortlocon(&figure->LOCON); + sortlosig(&figure->LOSIG); + savelofig(figure); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR locon (3), +.BR addlocon (3), +.BR dellocon (3), +.BR checkloconorder (3), +.BR qsort (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/sortlosig.3 b/alliance/src/mbk/man3/sortlosig.3 new file mode 100644 index 00000000..f9981fa1 --- /dev/null +++ b/alliance/src/mbk/man3/sortlosig.3 @@ -0,0 +1,74 @@ +.\" $Id: sortlosig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)sortlosig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +sortlosig +.XE +.XS2 \n% +.ti 0.2i +sortlosig +.XE2 \} +.TH SORTLOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +sortlosig \- sort the logical signals of a figure by name +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void sortlosig(signals) +losig_list \(**\(**signals; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fI\(**\(**signals\fP +Pointer to the head of the list of signals that is to be sorted +.SH DESCRIPTION +\fBsortlosig\fP sorts the list of signals pointed to by \fIsignals\fP. +The signals are sorted by names, but since names are not the signals +identifier, the \fBgetsigname\fP(3) routine is called to retrieve a +signal name. +.br +The standart \fBqsort\fP(3) function library is called for sorting. +Therefore, a table the number of signal wide is created, requiring +a lot of memory with big circuits. +Also, even if \fBqsort\fP(3) runs in n log n time, \fBgetsigname\fP(3) +is called twice, and the natural comparison function once, and this is +quite time consuming with big circuits. +It is recommended to use this function only if needed. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void savesorted(figname) +char \(**figname; +{ +lofig_list \(**figure = getlosig(figname, 'A'); + sortlocon(&figure->LOCON); + sortlosig(&figure->LOSIG); + savelofig(figure); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR losig (3), +.BR addlosig (3), +.BR dellosig (3), +.BR getsigname (3), +.BR sortlocon (3), +.BR qsort (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/unflattenlofig.3 b/alliance/src/mbk/man3/unflattenlofig.3 new file mode 100644 index 00000000..57fbf2c3 --- /dev/null +++ b/alliance/src/mbk/man3/unflattenlofig.3 @@ -0,0 +1,97 @@ +.\" $Id: unflattenlofig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)unflattenlofig.2 2.11 92/10/01 ; Labo masi cao-vlsi; Author : Francois Nacabal +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +unflattenlofig +.XE +.XS3 \n% +.ti 0.2i +unflattenlofig +.XE3 \} +.TH UNFLATTENLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL UTILITY FUNCTIONS" +.SH NAME +unflattenlofig \- creates a hierarchy level from instances of a figure +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void unflattenlofig(ptfig, figname, insname, list) +lofig_list \(**ptfig; +char \(**figname; +char \(**insname; +chain_list \(**list; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIptfig\fP +Pointer to a logical figure +.TP +\fIfigname\fP +Name of the new figure (model) +.TP +\fIinsname\fP +Instance name of the new figure +.TP +\fIlist\fP +Pointer to the head of a chain_list, containing instance pointers +.SH DESCRIPTION +\fBunflattenlofig\fP creates a new figure, \fIfigname\fP, containing the +instances listed in \fIlist\fP, and adds it in the figure pointed to by +\fIptfig\fP, with the name \fIinsname\fP. +.br +All the terminals of the new figure are called using the name of the +corresponding signal if it exists, or with the name of a connector +connected to this signal. +The new name is suffixed with a number, obtained with an internal counter, +in order to ensure that names are differents. +.SH ERRORS +No errors can directly result from a call to \fBunflattenlofig\fP, but since it +uses many other mbk functions, it may be a good error starting point. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +{ + lofig_list *lofig; + chain_list *list = NULL; + lofig = getlofig ( "rootfig", 'A'); + list = addchain (list, (void *)getloins (lofig, "nan0"); + list = addchain (list, (void *)getloins (lofig, "nor2"); + unflattenlofig ( lofig, "newfig", "newins", list); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR mbkenv (3), +.BR lofig (3), +.BR getlofig (3), +.BR addlofig (3), +.BR addloins (3), +.BR delloins (3), +.BR addlocon (3), +.BR addlosig (3), +.BR dellosig (3), +.BR getsigname (3), +.BR lofigchain (3), +.BR getptype (3), +.BR addptype (3), +.BR delptype (3), +.BR addchain (3), +.BR freechain (3), +.BR reverse (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/upstr.3 b/alliance/src/mbk/man3/upstr.3 new file mode 100644 index 00000000..ab935ef4 --- /dev/null +++ b/alliance/src/mbk/man3/upstr.3 @@ -0,0 +1,64 @@ +.\" $Id: upstr.3,v 1.1 2002/03/08 13:51:00 fred Exp $ +.\" @(#)upstr.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +upstr +.XE +.XS4 \n% +.ti 0.2i +upstr +.XE4 \} +.TH UPSTR 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" +.SH NAME +upstr \- convert a string to upper case +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void upstr(s, t) +char \(**s, \(**t; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIs\fP +Pointer to the source string +.TP +\fIt\fP +Pointer to the destination string +.SH DESCRIPTION +\fBupstr\fP converts the \fIs\fP string to upper case in \fIt\fP. +The space for \fIt\fP must be allocated by the caller, and be at least +\fBstrlen(s) + 1\fP long. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mut.h" +void cmp() +{ +char \(**s = "pwet", t[5]; + upstr(s, t); + if (strcmp(t, "PWET")) { + fprintf(stderr, "Upstr sucks, man"); + EXIT(); + } +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR downstr (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewht.3 b/alliance/src/mbk/man3/viewht.3 new file mode 100644 index 00000000..177a832d --- /dev/null +++ b/alliance/src/mbk/man3/viewht.3 @@ -0,0 +1,95 @@ +.\" $Id: viewht.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewht.2 7.01 92/08/22 ; Labo masi cao-vlsi; Author : Luc Burgun +.\" slightly modified by Fred Petrot for mbk adaptation on 22/06/92 +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewht +.XE +.XS4 \n% +.ti 0.2i +viewht +.XE4 \} +.TH VIEWHT 3 "October 1, 1997" "ASIM/LIP6" "MBK HASH TABLE MANAGEMENT FUNCTIONS" +.SH NAME +viewht \- displays a hash table contents +.so man1/alc_origin.1 +.SH SYNOPSYS +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +void viewht(table, display) +ht \(**table; +char \(**(\(**display)(); +.fi +.ft R +.SH PARAMETER +.TP 20 +\fItable\fP +Hash table to be viewed +.TP 20 +\fIdisplay\fP +Function to be used for displaying an item of the table +This function needs a user supplied parameter, the pointer +to the item. +.SH DESCRIPTION +\fBviewht()\fP displays all items of \fItable\fP : +.TP 20 +index +This is the entry index of the hash table +.TP +key +This pointer is the one given by the user. +It is displayed using something like +.br +\fBfprintf(stdout, "%s\\n", \fIdisplay(key)\fP);\fP. +.TP +value +This is the value associated with the key. +It is displayed as an \fIint\fP. +.LP +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +.nf +#include "mut.h" +#include +typedef struct of_fp { + char \(**name; + float f; + void \(**p; +} fp; +char \(**printout(s) +fp \(**s; +{ +char t[BUFSIZ]; + sprintf(t, "name : `%s' :~~~: float value : `%.6f' <%#x>", + s->name, s->f, s->p); + return t; +} +void displayall(h) +ht *h; +{ + viewht(h, printout); +} +.fi +.ft R +.SH SEE ALSO +.BR mbk (1), +.BR addht (3), +.BR delht (3), +.BR addhtitem (3), +.BR gethtitem (3), +.BR sethtitem (3), +.BR delhtitem (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewlo.3 b/alliance/src/mbk/man3/viewlo.3 new file mode 100644 index 00000000..0db34ea9 --- /dev/null +++ b/alliance/src/mbk/man3/viewlo.3 @@ -0,0 +1,70 @@ +.\" $Id: viewlo.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewlo.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewlo +.XE +.XS2 \n% +.ti 0.2i +viewlo +.XE2 \} +.TH VIEWLO 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +viewlo \- scan all \fBlofig_list\fPs and display their elements +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void viewlo(); +.ft R +.fi +.SH DESCRIPTION +\fBviewlo\fP scans all the elements of the entire \fBlofig_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +All the figures are treated, the first one beeing pointed to by +\fBHEAD_LOFIG\fP, the global variable that points to the head of all +\fBlofig\fPs. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mlo.h" +void view_all_to_file(name) +char \(**name; +{ +FILE \(**file = freopen(name, WRITE_TEXT, stdout); + if (!file) { + (void)fputs("Can't reopen stdout!\\n", stderr); + EXIT(); + } + viewlo(); /\(** to file called name \(**/ + (void)fclose(file); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR viewlofig (3), +.BR viewloins (3), +.BR viewlotrs (3), +.BR viewlosig (3), +.BR viewloinscon (3), +.BR viewlofigcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewlofig.3 b/alliance/src/mbk/man3/viewlofig.3 new file mode 100644 index 00000000..f2eace9e --- /dev/null +++ b/alliance/src/mbk/man3/viewlofig.3 @@ -0,0 +1,74 @@ +.\" $Id: viewlofig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewlofig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewlofig +.XE +.XS2 \n% +.ti 0.2i +viewlofig +.XE2 \} +.TH VIEWLOFIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +viewlofig \- display elements of a \fBlofig_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void viewlofig(ptfig) +lofig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to the \fBlofig\fP to be scaned +.SH DESCRIPTION +\fBviewlofig\fP scans all the primary elements of the \fBlofig_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +The \fILOINS\fP, \fILOCON\fP, \fILOSIG\fP and \fILOTRS\fP are scaned, and +their contents displayed. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mlo.h" +void view_fig_to_file(ptfig) +lofig_list \(**ptfig; +{ +FILE \(**file = freopen(ptfig\->NAME, WRITE_TEXT, stdout); + if (!file) { + (void)fputs("Can't reopen stdout!\\n", stderr); + EXIT(); + } + viewlofig(ptfig\->NAME); /\(** to file called name \(**/ + (void)fclose(file); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lofig (3), +.BR viewlo (3), +.BR viewloins (3), +.BR viewlotrs (3), +.BR viewlosig (3), +.BR viewloinscon (3), +.BR viewlofigcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewlofigcon.3 b/alliance/src/mbk/man3/viewlofigcon.3 new file mode 100644 index 00000000..413f80fc --- /dev/null +++ b/alliance/src/mbk/man3/viewlofigcon.3 @@ -0,0 +1,69 @@ +.\" $Id: viewlofigcon.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewlofigcon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewlofigcon +.XE +.XS2 \n% +.ti 0.2i +viewlofigcon +.XE2 \} +.so man1/alc_origin.1 +.SH NAME +viewlofigcon \- display elements of a \fBlocon_list\fP attached to a +figure +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void viewlofigcon(ptcon) +locon_list \(**ptcon; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptcon\fP +Pointer to the \fBlocon\fP to be scaned +.SH DESCRIPTION +\fBviewlofigcon\fP scans all the primary elements of the \fBlocon_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mlo.h" +void view_figcon(ptfig) +lofig_list \(**ptfig; +{ +locon_list \(**figcon; + for (figcon = ptfig\->LOCON; figcon; figcon = figcon\->NEXT) + viewlofigcon(figcon); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR locon (3), +.BR lofig (3), +.BR viewlo (3), +.BR viewlofig (3), +.BR viewlotrs (3), +.BR viewlosig (3), +.BR viewloinscon (3), +.BR viewlofigcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewloins.3 b/alliance/src/mbk/man3/viewloins.3 new file mode 100644 index 00000000..821c8e03 --- /dev/null +++ b/alliance/src/mbk/man3/viewloins.3 @@ -0,0 +1,70 @@ +.\" $Id: viewloins.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewloins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewloins +.XE +.XS2 \n% +.ti 0.2i +viewloins +.XE2 \} +.TH VIEWLOINS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +viewloins \- display elements of a \fBloins_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void viewloins(pt) +loins_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBloins\fP to be scaned +.SH DESCRIPTION +\fBviewloins\fP scans all the primary elements of the \fBloins_list\fP +pointed to by \fIpt\fP, and displays a textual output of the data strcuture +contents. +The \fILOCON\fP field is scaned, and its contents displayed. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mlo.h" +void view_ins(ptfig) +lofig_list \(**ptfig; +{ +loins_list \(**ins; + for (ins = ptfig\->LOINS; ins; ins = ins\->NEXT) + viewloins(ins); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR loins (3), +.BR viewlo (3), +.BR viewlofig (3), +.BR viewlotrs (3), +.BR viewlosig (3), +.BR viewloinscon (3), +.BR viewloinscon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewloinscon.3 b/alliance/src/mbk/man3/viewloinscon.3 new file mode 100644 index 00000000..2df82a50 --- /dev/null +++ b/alliance/src/mbk/man3/viewloinscon.3 @@ -0,0 +1,70 @@ +.\" $Id: viewloinscon.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewloinscon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewloinscon +.XE +.XS2 \n% +.ti 0.2i +viewloinscon +.XE2 \} +.TH VIEWLOINSCON 3 "October 1, 1997" "ASIM/LIP6" "Mbk Logical Functions" +.SH NAME +\fBviewloinscon\fP \- display elements of a \fBlocon_list\fP attached to an +instance +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void viewloinscon(ptcon) +locon_list \(**ptcon; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptcon\fP +Pointer to the \fBlocon\fP to be scaned +.SH DESCRIPTION +\fBviewloinscon\fP scans all the primary elements of the \fBlocon_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mlo.h" +void view_inscon(ptins) +loins_list \(**ptins; +{ +locon_list \(**inscon; + for (inscon = ptins\->LOCON; inscon; inscon = inscon\->NEXT) + viewloinscon(inscon); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR locon (3), +.BR loins (3), +.BR viewlo (3), +.BR viewlofig (3), +.BR viewlotrs (3), +.BR viewlosig (3), +.BR viewloinscon (3), +.BR viewlofigcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewlosig.3 b/alliance/src/mbk/man3/viewlosig.3 new file mode 100644 index 00000000..42974406 --- /dev/null +++ b/alliance/src/mbk/man3/viewlosig.3 @@ -0,0 +1,68 @@ +.\" $Id: viewlosig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewlosig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewlosig +.XE +.XS2 \n% +.ti 0.2i +viewlosig +.XE2 \} +.TH VIEWLOSIG 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +viewlosig \- display elements of a \fBlosig_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void viewlosig(ptsig) +losig_list \(**ptsig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptsig\fP +Pointer to the \fBlosig\fP to be scaned +.SH DESCRIPTION +\fBviewlosig\fP scans all the primary elements of the \fBlosig_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mlo.h" +void view_sig(ptfig) +lofig_list \(**ptfig; +{ +losig_list \(**sig; + for (sig = ptfig\->LOSIG; sig; sig = sig\->NEXT) + viewlosig(sig); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR losig (3), +.BR viewlo (3), +.BR viewlofig (3), +.BR viewlotrs (3), +.BR viewlosig (3), +.BR viewloinscon (3), +.BR viewlofigcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewlotrs.3 b/alliance/src/mbk/man3/viewlotrs.3 new file mode 100644 index 00000000..28a77dda --- /dev/null +++ b/alliance/src/mbk/man3/viewlotrs.3 @@ -0,0 +1,70 @@ +.\" $Id: viewlotrs.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewlotrs.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot + +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewlotrs +.XE +.XS2 \n% +.ti 0.2i +viewlotrs +.XE2 \} + +.TH VIEWLOTRS 3 "October 1, 1997" "ASIM/LIP6" "MBK LOGICAL FUNCTIONS" +.SH NAME +viewlotrs \- display elements of a \fBlotrs_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mlo.h" +void viewlotrs(pttrs) +lotrs_list \(**pttrs; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpttrs\fP +Pointer to the \fBlotrs\fP to be scaned +.SH DESCRIPTION +\fBviewlotrs\fP scans all the primary elements of the \fBlotrs_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mlo.h" +void view_trs(ptfig) +lofig_list \(**ptfig; +{ +lotrs_list \(**trs; + for (trs = ptfig\->LOTRS; trs; trs = trs\->NEXT) + viewlotrs(trs); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR lotrs (3), +.BR viewlo (3), +.BR viewlofig (3), +.BR viewlotrs (3), +.BR viewlosig (3), +.BR viewloinscon (3), +.BR viewlofigcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewph.3 b/alliance/src/mbk/man3/viewph.3 new file mode 100644 index 00000000..4b0943c6 --- /dev/null +++ b/alliance/src/mbk/man3/viewph.3 @@ -0,0 +1,70 @@ +.\" $Id: viewph.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewph.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewph +.XE +.XS0 \n% +.ti 0.2i +viewph +.XE0 \} +.TH VIEWPH 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +viewph \- display all the \fBphfig_list\fPs and their elements +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void viewph(); +.ft R +.fi +.SH DESCRIPTION +\fBviewph\fP scans all the elements of the entire \fBphfig_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +All the figures are treated, the first one beeing pointed to by +\fBHEAD_PHFIG\fP, the global variable that points to the head of all +\fBphfig\fPs. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mph.h" +void view_all_to_file(name) +char \(**name; +{ +FILE \(**file = freopen(name, WRITE_TEXT, stdout); + if (!file) { + (void)fputs("Can't reopen stdout!\\n", stderr); + EXIT(); + } + viewph(); /\(** to file called name \(**/ + (void)fclose(file); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR view_phfig (3), +.BR view_phins (3), +.BR view_phseg (3), +.BR view_phref (3), +.BR view_phvia (3), +.BR view_phfigcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewphcon.3 b/alliance/src/mbk/man3/viewphcon.3 new file mode 100644 index 00000000..7a1f5bac --- /dev/null +++ b/alliance/src/mbk/man3/viewphcon.3 @@ -0,0 +1,69 @@ +.\" $Id: viewphcon.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewphcon.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewphcon +.XE +.XS0 \n% +.ti 0.2i +viewphcon +.XE0 \} +.TH VIEWPHCON 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +viewphcon \- display elements of a \fBphcon_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void viewphcon(pt) +phcon_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBphcon\fP to be scaned +.SH DESCRIPTION +\fBviewphcon\fP scans all the primary elements of the \fBphcon_list\fP +pointed to by \fIpt\fP, and displays a textual output of the data strcuture +contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mph.h" +void view_con(ptfig) +phfig_list \(**ptfig; +{ +phcon_list \(**con; + for (con = ptfig\->PHCON; con; con = con\->NEXT) + viewphcon(con); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phcon (3), +.BR viewph (3), +.BR viewphfig (3), +.BR viewphseg (3), +.BR viewphref (3), +.BR viewphvia (3), +.BR viewphins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewphfig.3 b/alliance/src/mbk/man3/viewphfig.3 new file mode 100644 index 00000000..1aa0842e --- /dev/null +++ b/alliance/src/mbk/man3/viewphfig.3 @@ -0,0 +1,73 @@ +.\" $Id: viewphfig.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewphfig.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewphfig +.XE +.XS0 \n% +.ti 0.2i +viewphfig +.XE0 \} +.so man1/alc_origin.1 +.SH NAME +viewphfig \- display elements of a \fBphfig_list\fP +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void viewphfig(ptfig) +phfig_list \(**ptfig; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIptfig\fP +Pointer to the \fBphfig\fP to be scaned +.SH DESCRIPTION +\fBviewphfig\fP scans all the primary elements of the \fBphfig_list\fP +loaded in ram, and displays a textual output of the data strcuture contents. +The \fIPHINS\fP, \fIPHCON\fP, \fIPHSEG\fP, \fIPHVIA\fP and \fIPHREF\fP are +scaned, and their contents displayed. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mph.h" +void view_fig_to_file(ptfig) +phfig_list \(**ptfig; +{ +FILE \(**file = freopen(ptfig\->NAME, WRITE_TEXT, stdout); + if (!file) { + (void)fputs("Can't reopen stdout!\\n", stderr); + EXIT(); + } + viewphfig(ptfig); /\(** to file called name \(**/ + (void)fclose(file); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR viewph (3), +.BR viewphins (3), +.BR viewphseg (3), +.BR viewphref (3), +.BR viewphvia (3), +.BR viewphcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewphins.3 b/alliance/src/mbk/man3/viewphins.3 new file mode 100644 index 00000000..79a3ce59 --- /dev/null +++ b/alliance/src/mbk/man3/viewphins.3 @@ -0,0 +1,69 @@ +.\" $Id: viewphins.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewphins.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewphins +.XE +.XS0 \n% +.ti 0.2i +viewphins +.XE0 \} +.TH VIEWPHINS 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +viewphins \- display elements of a \fBphins_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void viewphins(pt) +phins_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBphins\fP to be scaned +.SH DESCRIPTION +\fBviewphins\fP scans all the primary elements of the \fBphins_list\fP +pointed to by \fIpt\fP, and displays a textual output of the data strcuture +contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mph.h" +void view_ins(ptfig) +phfig_list \(**ptfig; +{ +phins_list \(**ins; + for (ins = ptfig\->PHINS; ins; ins = ins\->NEXT) + viewphins(ins); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phins (3), +.BR viewph (3), +.BR viewphfig (3), +.BR viewphseg (3), +.BR viewphref (3), +.BR viewphvia (3), +.BR viewphcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewphref.3 b/alliance/src/mbk/man3/viewphref.3 new file mode 100644 index 00000000..78ba7f3f --- /dev/null +++ b/alliance/src/mbk/man3/viewphref.3 @@ -0,0 +1,69 @@ +.\" $Id: viewphref.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewphref.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewphref +.XE +.XS0 \n% +.ti 0.2i +viewphref +.XE0 \} +.TH VIEWPHREF 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +viewphref \- display elements of a \fBphref_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void viewphref(pt) +phref_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBphref\fP to be scaned +.SH DESCRIPTION +\fBviewphref\fP scans all the primary elements of the \fBphref_list\fP +pointed to by \fIpt\fP, and displays a textual output of the data strcuture +contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mph.h" +void view_ref(ptfig) +phfig_list \(**ptfig; +{ +phref_list \(**ref; + for (ref = ptfig\->PHREF; ref; ref = ref\->NEXT) + viewphref(ref); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phref (3), +.BR viewph (3), +.BR viewphfig (3), +.BR viewphseg (3), +.BR viewphins (3), +.BR viewphvia (3), +.BR viewphcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewphseg.3 b/alliance/src/mbk/man3/viewphseg.3 new file mode 100644 index 00000000..f9e20602 --- /dev/null +++ b/alliance/src/mbk/man3/viewphseg.3 @@ -0,0 +1,69 @@ +.\" $Id: viewphseg.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewphseg.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewphseg +.XE +.XS0 \n% +.ti 0.2i +viewphseg +.XE0 \} +.TH VIEWPHSEG 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +viewphseg \- display elements of a \fBphseg_list\fP +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void viewphseg(pt) +phseg_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBphseg\fP to be scaned +.SH DESCRIPTION +\fBviewphseg\fP scans all the primary elements of the \fBphseg_list\fP +pointed to by \fIpt\fP, and displays a textual output of the data strcuture +contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mph.h" +void view_seg(ptfig) +phfig_list \(**ptfig; +{ +phseg_list \(**seg; + for (seg = ptfig\->PHSEG; seg; seg = seg\->NEXT) + viewphseg(seg); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phseg (3), +.BR viewph (3), +.BR viewphfig (3), +.BR viewphins (3), +.BR viewphref (3), +.BR viewphvia (3), +.BR viewphcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/viewphvia.3 b/alliance/src/mbk/man3/viewphvia.3 new file mode 100644 index 00000000..1d58e484 --- /dev/null +++ b/alliance/src/mbk/man3/viewphvia.3 @@ -0,0 +1,68 @@ +.\" $Id: viewphvia.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)viewphvia.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +viewphvia +.XE +.XS0 \n% +.ti 0.2i +viewphvia +.XE0 \} +.so man1/alc_origin.1 +.SH NAME +viewphvia \- display elements of a \fBphvia_list\fP +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void viewphvia(pt) +phvia_list \(**pt; +.ft R +.fi +.SH PARAMETER +.TP 20 +\fIpt\fP +Pointer to the \fBphvia\fP to be scaned +.SH DESCRIPTION +\fBviewphvia\fP scans all the primary elements of the \fBphvia_list\fP +pointed to by \fIpt\fP, and displays a textual output of the data strcuture +contents. +.br +Its use is mostly for debugging purposes, and educational ones, since the +output is quite verbose, even if very easy to understand. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include +#include "mph.h" +void view_via(ptfig) +phfig_list \(**ptfig; +{ +phvia_list \(**via; + for (via = ptfig\->PHVIA; via; via = via\->NEXT) + viewphvia(via); +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phvia (3), +.BR viewph (3), +.BR viewphfig (3), +.BR viewphseg (3), +.BR viewphref (3), +.BR viewphins (3), +.BR viewphcon (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/man3/x b/alliance/src/mbk/man3/x new file mode 100644 index 00000000..38e87ca5 --- /dev/null +++ b/alliance/src/mbk/man3/x @@ -0,0 +1 @@ +map f :%s/"m\(..\)...\.h"/"m\1.h"/g diff --git a/alliance/src/mbk/man3/xyflat.3 b/alliance/src/mbk/man3/xyflat.3 new file mode 100644 index 00000000..a985e669 --- /dev/null +++ b/alliance/src/mbk/man3/xyflat.3 @@ -0,0 +1,90 @@ +.\" $Id: xyflat.3,v 1.1 2002/03/08 13:51:04 fred Exp $ +.\" @(#)xyflat.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot +.if t \{\ +.so man1/alc_contents.mac +.XS \n% +.ti 0.2i +xyflat +.XE \} +.TH XYFLAT 3 "October 1, 1997" "ASIM/LIP6" "MBK PHYSICAL FUNCTIONS" +.SH NAME +xyflat \- compute hierarchical coordinates +.so man1/alc_origin.1 +.SH SYNOPSYS +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +void xyflat(xout, yout, x, y, xins, yins, x1, y1, x2, y2, trsf) +long \(**xout, \(**yout; +long x, y; +long xins, yins; +long x1, y1, x2, y2; +char trsf; +.ft R +.fi +.SH PARAMETERS +.TP 20 +\fIxout, yout\fP +Values filled by the function call, return values, that represent coordinates +of the point in the figure +.TP +\fIx, y\fP +Coordinates of a point in the instance +.TP +\fIxins, yins\fP +Coordinates of the lower left corner of the instance +.TP +\fIx1, y1, x2, y2\fP +Coordinates of the \fIabutment box\fP of the model of the instance +.TP +\fItrsf\fP +Geometrical operation applied to the instance +.SH DESCRIPTION +\fBxyflat\fP computes coordinates relative to a model of instance in order to +give them in figure coordinates, taking care of the transformation performed +on the instance. +.br +This function is very useful when flattening, or getting coordinates of an +object belonging to an istance at figure level. +.br +Care must be taken that the \fIx1, y1, x2, y2\fP parameters are \fInot\fP the +current figure \fIabutment box\fP coordinates, but the instance model +\fIabutment box\fP coordinates. +.SH EXAMPLE +.ta 3n 6n 9n 12n 15n 18n 21n +.nf +.if n \{\ +.ft B \} +.if t \{\ +.ft CR \} +#include "mph.h" +long GET_CON_X(insname, conname, index) +char \(**insname, \(**conname; +long index; +{ +phfig_list \(**ptfig; /\(** pointer on model of instance called insname \(**/ +phins_list \(**ptins; /\(** pointer on instance called insname \(**/ +phcon_list \(**ptcon; /\(** pointer on the conname called con inside ptins \(**/ +long x_con, y_con; /\(** return values, y_con here for beauty \(**/ + ptins = getphins(WORK_PHFIG, insname); + ptfig = getphfig(ptins\->FIGNAME, 'P'); + ptcon = getphcon(ptfig, conname, index); + xyflat(&x_con, &y_con, ptcon\->XCON, ptcon\->YCON, + ptins\->XINS, ptins\->YIINS, + ptfig\->XAB1, ptfig\->YAB1, ptfig\->XAB2, ptfig\->YAB2, + ptins\->TRANSF); + return x_con; +} +.ft R +.fi +.SH SEE ALSO +.BR mbk (1), +.BR phfig (3), +.BR phins (3). + + +.so man1/alc_bug_report.1 + diff --git a/alliance/src/mbk/src/Makefile.am b/alliance/src/mbk/src/Makefile.am new file mode 100644 index 00000000..a608df7d --- /dev/null +++ b/alliance/src/mbk/src/Makefile.am @@ -0,0 +1,8 @@ +lib_LIBRARIES = libMph.a libMpu.a libMlo.a libMlu.a libMut.a libRcn.a +include_HEADERS = mlu.h mlo.h mpu.h mph.h mut.h rcn.h +libMph_a_SOURCES = mbk_ph.c mbk_ph.h +libMpu_a_SOURCES = mbk_ph_util.c mbk_ph_util.h +libMlo_a_SOURCES = mbk_lo.c mbk_lo.h +libMlu_a_SOURCES = mbk_lo_util.c mbk_lo_util.h +libMut_a_SOURCES = mbk_sys.c mbk_sys.h +libRcn_a_SOURCES = mbk_util.c mbk_util.h diff --git a/alliance/src/mbk/src/mbk_lo.c b/alliance/src/mbk/src/mbk_lo.c new file mode 100644 index 00000000..06bac0ce --- /dev/null +++ b/alliance/src/mbk/src/mbk_lo.c @@ -0,0 +1,1574 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : acces functions to logical structures + * Date : 30/04/91 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * Modified by 1997,98 + */ + +#ident "$Id: mbk_lo.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +#include +#include +#include + +#include "mut.h" +#include "mlo.h" +#include "rcn.h" +#include "mbk_lo.h" + +int NB_TAT_LOSIG = 0; +/******************************************************************************* +* global variable for netlist view * +*******************************************************************************/ +lofig_list *HEAD_LOFIG; /* physical figure list head */ + +/******************************************************************************* +* function addlofig() * +*******************************************************************************/ +lofig_list *addlofig(const char *fname) +{ +lofig_list *ptfig; +char *name; + + name = namealloc(fname); + /* scan figure list */ + ptfig = HEAD_LOFIG; + while (ptfig != NULL && ptfig->NAME != name) + ptfig = ptfig->NEXT; + + if (ptfig != NULL) { /* figure exists */ + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addlofig impossible : "); + (void)fprintf(stderr, "figure %s already exists\n", name); + EXIT(1); + } + ptfig = (lofig_list *)mbkalloc(sizeof(lofig_list)); + ptfig->MODE = 'A'; + ptfig->NAME = name; + ptfig->MODELCHAIN = NULL; + ptfig->LOINS = NULL; + ptfig->LOTRS = NULL; + ptfig->LOCON = NULL; + ptfig->LOSIG = NULL; + ptfig->BKSIG = NULL; + ptfig->USER = NULL; + ptfig->NEXT = HEAD_LOFIG; + HEAD_LOFIG = ptfig; + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- addlofig : %s\n", name); + + return ptfig; +} + +/******************************************************************************* +* function addlomodel() * +* used by the parsers to construct a temporary model * +*******************************************************************************/ +lofig_list *addlomodel(lofig_list *model, const char *fname) +{ +lofig_list *fig; +char *name = namealloc(fname); + + /* check to see if the model has already been loaded */ + for (fig = model; fig && fig->NAME != name; fig = fig->NEXT); + + if (fig) { /* figure exists */ + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addlomodel impossible : "); + (void)fprintf(stderr, "model %s already exists \n", name); + EXIT(1); + } + fig = (lofig_list *)mbkalloc(sizeof(lofig_list)); + fig->MODE = 'A'; + fig->NAME = name; + fig->MODELCHAIN = NULL; + fig->LOINS = NULL; + fig->LOTRS = NULL; + fig->LOCON = NULL; + fig->LOSIG = NULL; + fig->BKSIG = NULL; + fig->USER = NULL; + fig->NEXT = model; + model = fig; + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- addlomodel : %s\n", name); + + return model; +} + +/******************************************************************************* +* function addlotrs() * +*******************************************************************************/ +lotrs_list *addlotrs(lofig_list *ptfig, char type, long x, long y, long width, long length, long ps, long pd, long xs, long xd, losig_list *ptgrid, losig_list *ptsource, losig_list *ptdrain, losig_list *ptbulk, const char *name) +{ +static char *grid, *drain, *source, *bulk; +lotrs_list *pttrs; +locon_list *ptcon; + + if (!grid) { + grid = namealloc("grid"); + drain = namealloc("drain"); + source = namealloc("source"); + bulk = namealloc("bulk"); + } + +#if 0 + if (type != TRANSN && type != TRANSP) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, " illegal transistor type : %ld\n", (long)type); + EXIT(1); + } +#endif + + pttrs = (lotrs_list *)mbkalloc(sizeof(lotrs_list)); + pttrs->X = x; + pttrs->Y = y; + pttrs->WIDTH = width; + pttrs->LENGTH = length; + pttrs->PS = ps; + pttrs->PD = pd; + pttrs->XS = xs; + pttrs->XD = xd; + pttrs->TYPE = type; + pttrs->NEXT = ptfig->LOTRS; + ptfig->LOTRS = pttrs; + pttrs->USER = NULL; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon->NAME = grid; + ptcon->SIG = ptgrid; + ptcon->ROOT = (void *)pttrs; + ptcon->TYPE = TRANSCV; + ptcon->DIRECTION = INTERNAL; + ptcon->USER = NULL; + ptcon->PNODE = NULL; + pttrs->GRID = ptcon; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon->NAME = drain; + ptcon->SIG = ptdrain; + ptcon->ROOT = (void *)pttrs; + ptcon->TYPE = TRANSCV; + ptcon->DIRECTION = INTERNAL; + ptcon->USER = NULL; + ptcon->PNODE = NULL; + pttrs->DRAIN = ptcon; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon->NAME = source; + ptcon->SIG = ptsource; + ptcon->ROOT = (void *)pttrs; + ptcon->TYPE = TRANSCV; + ptcon->DIRECTION = INTERNAL; + ptcon->USER = NULL; + ptcon->PNODE = NULL; + pttrs->SOURCE = ptcon; + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon->NAME = bulk; + ptcon->SIG = ptbulk; + ptcon->ROOT = (void *)pttrs; + ptcon->TYPE = TRANSCV; + ptcon->DIRECTION = INTERNAL; + ptcon->USER = NULL; + ptcon->PNODE = NULL; + pttrs->BULK = ptcon; + + /* No check is done for transistor name unicity */ + pttrs->TRNAME = namealloc(name); + + if ((TRACE_MODE == 'Y')) + (void)fprintf(stdout, + "--- mbk --- addlotrs : %s X=%ld, Y=%ld, W=%ld, L=%ld, PS = %ld, PD = %ld, XS = %ld, XD = %ld\n", + type == TRANSN ? "TRANSN" : "TRANSP", x, y, width, length, + ps, pd, xs, xd); + + return pttrs; +} + +/******************************************************************************* +* function addloins() * +*******************************************************************************/ +loins_list *addloins(lofig_list *ptfig, const char *iname, lofig_list *ptnewfig, chain_list *sigchain) +{ +locon_list *ptcon = NULL; +locon_list *ptnewcon = NULL; +loins_list *ptins = NULL; +char *figname; +char *insname; +chain_list *ptchain; + + insname = namealloc(iname); + figname = ptnewfig->NAME; + + /* check insname unicity */ + if (strcmp(insname, "*") && FAST_MODE != 'Y') { + for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT) { + if (ptins->INSNAME == insname) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addloins impossible : "); + (void)fprintf(stderr, "instance %s already exist in figure %s\n", + insname, ptfig->NAME); + EXIT(1); + } + } + } + + if (ptfig->NAME == figname) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addloins impossible :\n"); + (void)fprintf(stderr, "instance model is the figure %s itself\n", + figname); + EXIT(1); + } + + ptins = (loins_list *)mbkalloc(sizeof(loins_list)); + + ptins->INSNAME = insname; + ptins->FIGNAME = figname; + ptins->LOCON = NULL; + ptins->USER = NULL; + ptins->NEXT = ptfig->LOINS; + ptfig->LOINS = ptins; + + /* update model list */ + for (ptchain = ptfig->MODELCHAIN; ptchain; ptchain = ptchain->NEXT) + if (ptchain->DATA == (void *)figname) + break; + + if (!ptchain) + ptfig->MODELCHAIN = addchain(ptfig->MODELCHAIN, (void *)figname); + + for (ptcon = ptnewfig->LOCON; ptcon; ptcon = ptcon->NEXT) { + if (sigchain == NULL) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addloins impossible : connector number "); + (void)fprintf(stderr, "discrepancy between figure %s", + ptnewfig->NAME); + (void)fprintf(stderr, " and instance %s in figure %s\n", + insname, ptfig->NAME); + EXIT(1); + } + ptnewcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptnewcon->NAME = ptcon->NAME; + ptnewcon->DIRECTION = ptcon->DIRECTION; + ptnewcon->TYPE = 'I'; + ptnewcon->SIG = (losig_list *)sigchain->DATA; + ptnewcon->ROOT = (void *)ptins; + ptnewcon->USER = NULL; + ptnewcon->PNODE= NULL; + ptnewcon->NEXT = ptins->LOCON; + ptins->LOCON = ptnewcon; + sigchain = sigchain->NEXT; + } + if (sigchain != NULL) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addloins impossible : "); + (void)fprintf(stderr, "connector number discrepancy between figure %s ", + ptnewfig->NAME); + (void)fprintf(stderr, "and instance %s in figure %s\n", + insname, ptfig->NAME); + EXIT(1); + } + + ptins->LOCON = (locon_list *)reverse((chain_list *)ptins->LOCON); + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- addloins : %s of figure %s\n", + insname, figname); + return ptins; +} + +/******************************************************************************* +* function addlocon() * +*******************************************************************************/ +locon_list *addlocon(lofig_list *ptfig, const char *cname, losig_list *ptsig, char dir) +{ +locon_list *ptcon; +char *name = namealloc(cname); + + /* check name unicity */ + if (FAST_MODE != 'Y') { + for (ptcon = ptfig->LOCON; ptcon; ptcon = ptcon->NEXT) { + if (ptcon->NAME == name) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addlocon impossible :\n"); + (void)fprintf(stderr, "connector %s already exists in figure %s\n", + name, ptfig->NAME); + EXIT(1); + } + } + if (dir != 'I' && dir != 'O' && dir != 'X' && dir != 'B' + && dir != 'Z' && dir != 'T') { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addlocon impossible :\n"); + (void)fprintf(stderr, "bad direction %c in figure %s\n", + dir, ptfig->NAME); + EXIT(1); + } + } + + ptcon = (locon_list *)mbkalloc(sizeof(locon_list)); + ptcon->NAME = name; + ptcon->TYPE = 'E'; + ptcon->SIG = ptsig; + ptcon->ROOT = (void *)ptfig; + ptcon->DIRECTION = dir; + ptcon->USER = NULL; + ptcon->NEXT = ptfig->LOCON; + ptcon->PNODE = NULL; + ptfig->LOCON = ptcon; + + if (TRACE_MODE == 'Y') + { + if (ptsig!=NULL) + (void)fprintf(stdout, "--- mbk --- addlocon : %s linked to %ld\n", + name, ptsig->INDEX); + else + (void)fprintf(stdout, "--- mbk --- addlocon : %s no signal\n", name); + } + + return ptcon; +} + +/******************************************************************************* +* function addlosig() * +*******************************************************************************/ + +losig_list *addlosig(lofig_list *ptfig, long index, chain_list *namechain, char type) +{ +losig_list *ptsig; +losig_list *pthead; +ptype_list *pt; +chain_list *ptchain; +int high; +int low; +int i; +int sigsize; + + sigsize = getsigsize( ptfig ); + + low = (index % sigsize); + high = (index / sigsize); + for (pt = ptfig->BKSIG; pt; pt = pt->NEXT) + if (pt->TYPE == high) + break; + if (pt == NULL) { + pthead = (losig_list *)mbkalloc(sigsize * sizeof(losig_list)); + ptsig = pthead; + for (i = 0; i < sigsize; i++) { + ptsig->INDEX = 0; + ptsig++; + } + ptfig->BKSIG = (ptype_list *)addptype(ptfig->BKSIG, + (long)high, (void *)pthead); + pt = ptfig->BKSIG; + } + ptsig = (losig_list *)(pt->DATA) + low; + + /* check index unicity */ + if (ptsig->INDEX != 0L) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addlosig impossible :\n"); + (void)fprintf(stderr, "signal %ld already exist in figure %s\n", + index, ptfig->NAME); + EXIT(1); + } + for (ptchain = namechain; ptchain; ptchain = ptchain->NEXT) + ptchain->DATA = (void *)namealloc((char *)ptchain->DATA); + + ptsig->NAMECHAIN = namechain; + ptsig->INDEX = index; + ptsig->USER = NULL; + ptsig->PRCN = NULL; + ptsig->TYPE = type; + ptsig->NEXT = ptfig->LOSIG; + ptfig->LOSIG = ptsig; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- addlosig : %ld ", index); + if (ptsig->NAMECHAIN) + if (ptsig->NAMECHAIN->DATA) + (void)fprintf(stdout, "name : %s", + (char *)((chain_list *)(ptsig->NAMECHAIN))->DATA); + (void)fprintf(stdout, "\n"); + } + + return ptsig; +} + +/******************************************************************************* +* function dellofig() * +*******************************************************************************/ +int dellofig(const char *fname) +{ +lofig_list *ptfig; +losig_list *ptsig; +loins_list *ptins; +locon_list *ptcon; +lotrs_list *pttrs; +ptype_list *pt; +char *name = namealloc(fname); + +void *ptold=NULL, *ptt; + + for (ptfig = HEAD_LOFIG; ptfig; ptfig = ptfig->NEXT) { + if (ptfig->NAME == name) + break; + ptold = (void *)ptfig; + } + + if (ptfig == NULL) + return 0; + else if (ptfig == HEAD_LOFIG) + HEAD_LOFIG = ptfig->NEXT; + else + ((lofig_list *)ptold)->NEXT = ptfig->NEXT; + + freectclist( ptfig, NULL ); + for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT) + { + freechain(ptsig->NAMECHAIN); + if(ptsig->PRCN) + freelorcnet(ptsig); + dellosiguser( ptsig ); + } + + for (ptins = ptfig->LOINS; ptins; ptins = (loins_list *)ptold) { + delloinsuser( ptins ); + for (ptcon = ptins->LOCON; ptcon; ptcon = (locon_list *)ptt) { + ptt = (void *)ptcon->NEXT; + delloconuser( ptcon ); + mbkfree((void *)ptcon); + } + ptold = (void *)ptins->NEXT; + mbkfree((void *)ptins); + } + + for (pt = ptfig->BKSIG; pt; pt = pt->NEXT) { + mbkfree((void *)pt->DATA); + } + freeptype(ptfig->BKSIG); + for (ptcon = ptfig->LOCON; ptcon; ptcon = (locon_list *)ptold) { + ptold = (void *)ptcon->NEXT; + delloconuser( ptcon ); + mbkfree((void *)ptcon); + } + for (pttrs = ptfig->LOTRS; pttrs; pttrs = (lotrs_list *)ptold) { + delloconuser( pttrs->GRID ); + delloconuser( pttrs->SOURCE ); + delloconuser( pttrs->DRAIN ); + delloconuser( pttrs->BULK ); + mbkfree((void *)pttrs->GRID); + mbkfree((void *)pttrs->SOURCE); + mbkfree((void *)pttrs->DRAIN); + mbkfree((void *)pttrs->BULK); + ptold = (void *)pttrs->NEXT; + dellotrsuser( pttrs ); + mbkfree((void *)pttrs); + } + dellofiguser( ptfig ); + freechain(ptfig->MODELCHAIN); + mbkfree((void *)ptfig); + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- dellofig : %s\n", name); + return 1; +} + +/******************************************************************************* +* function freelomodel() * +*******************************************************************************/ +void freelomodel(lofig_list *ptmodel) +{ +lofig_list *ptfig; +locon_list *ptcon; +locon_list *ptc; + + if (!ptmodel) /* nothing to be freed */ + return; + + ptfig = ptmodel->NEXT; + while (1) { + for (ptcon = ptmodel->LOCON; ptcon; ptcon = ptc) { + ptc = ptcon->NEXT; + mbkfree((void *)ptcon); + } + mbkfree((void *)ptmodel); + ptmodel = ptfig; + if (!ptfig) + break; + ptfig = ptfig->NEXT; + } + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- freelomodel\n"); +} + +/******************************************************************************* +* function dellosig() * +*******************************************************************************/ +int dellosig(lofig_list *ptfig, long index) +{ +losig_list *ptsav=NULL; +losig_list *ptsig; + + for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT) { + if (ptsig->INDEX == index) + break; + ptsav = ptsig; + } + + if (ptsig == NULL) + return 0; + else if (ptsig == ptfig->LOSIG) + ptfig->LOSIG = ptsig->NEXT; + else + ptsav->NEXT = ptsig->NEXT; + + if( ptsig->PRCN ) + freelorcnet( ptsig ); + ptsig->INDEX = 0L; + + freechain(ptsig->NAMECHAIN); + ptsig->NAMECHAIN=NULL; + + dellosiguser( ptsig ); + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- dellosig : %ld\n", index); + + return 1; +} + +/******************************************************************************* +* function dellotrs() * +*******************************************************************************/ +int dellotrs(lofig_list *ptfig, lotrs_list *pttrs) +{ +lotrs_list *pt; +lotrs_list *ptsav=NULL; + + for (pt = ptfig->LOTRS; pt; pt = pt->NEXT) { + if (pt == pttrs) + break; + ptsav = pt; + } + if (pt == NULL) + return 0; + else if (pt == ptfig->LOTRS) + ptfig->LOTRS = pt->NEXT; + else + ptsav->NEXT = pt->NEXT; + + if( pt->GRID->PNODE ) + delrcnlocon( pt->GRID ); + delloconuser( pt->GRID ); + mbkfree((void *)pt->GRID); + + if( pt->SOURCE->PNODE ) + delrcnlocon( pt->SOURCE ); + delloconuser( pt->SOURCE ); + mbkfree((void *)pt->SOURCE); + + if( pt->DRAIN->PNODE ) + delrcnlocon( pt->DRAIN ); + delloconuser( pt->DRAIN ); + mbkfree((void *)pt->DRAIN); + + if( pt->BULK->PNODE ) + delrcnlocon( pt->BULK ); + delloconuser( pt->BULK ); + mbkfree((void *)pt->BULK); + + dellotrsuser( pt ); + mbkfree((void *)pt); + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- dellotrs : \n"); + return 1; +} + +/******************************************************************************* +* function delloins() * +*******************************************************************************/ +int delloins(lofig_list *ptfig, const char *iname) +{ +loins_list *ptins; +locon_list *ptcon; +chain_list *ptchain; +chain_list *pttmpchain=NULL; +void *pt=NULL; +char *figname; +char *insname; + + insname = namealloc(iname); + for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT) { + if (ptins->INSNAME == insname) + break; + pt = (void *)ptins; + } + if (ptins == NULL) + return 0; + if (ptins == ptfig->LOINS) { + figname = ptins->FIGNAME; + ptfig->LOINS = ptins->NEXT; + } else { + figname = ptins->FIGNAME; + ((loins_list *)pt)->NEXT = ptins->NEXT; + } + for (ptcon = ptins->LOCON; ptcon; ptcon = (locon_list *)pt) { + if( ptcon->PNODE ) + delrcnlocon( ptcon ); + pt = (void *)ptcon->NEXT; + delloconuser( ptcon ); + mbkfree((void *)ptcon); + } + + delloinsuser( ptins ); + mbkfree((void *)ptins); + + for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT) + if (ptins->FIGNAME == figname) + break; + if (ptins == NULL) { /* if no more instance have this model, destroy */ + for (ptchain = ptfig->MODELCHAIN; ptchain; ptchain = ptchain->NEXT) { + if (ptchain->DATA == (void *)figname) + break; + pttmpchain = ptchain; + } + if (ptchain == ptfig->MODELCHAIN && ptchain != NULL) + ptfig->MODELCHAIN = ptchain ->NEXT; + else if (ptchain) + pttmpchain->NEXT = ptchain->NEXT; + + if( ptchain ) + { + ptchain->NEXT = NULL; + freechain( ptchain ); + } + } + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- delloins : %s\n", insname); + return 1; +} + +/******************************************************************************* +* function dellocon() * +*******************************************************************************/ +int dellocon(lofig_list *ptfig, const char *cname) +{ +locon_list *ptcon; +locon_list *ptsav=NULL; +char *name = namealloc(cname); + + for (ptcon = ptfig->LOCON; ptcon; ptcon = ptcon->NEXT) { + if (ptcon->NAME == name) + break; + ptsav = ptcon; + } + if (ptcon == NULL) + return 0; + else if (ptcon == ptfig->LOCON) + ptfig->LOCON = ptcon->NEXT; + else + ptsav->NEXT = ptcon->NEXT; + + if( ptcon->PNODE ) + delrcnlocon( ptcon ); + + delloconuser( ptcon ); + mbkfree((void *)ptcon); + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- dellocon : %s\n", name); + + return 1; +} + +/******************************************************************************* +* function getlomodel * +* gives a pointer to a model or NULL if it doesn't exist * +*******************************************************************************/ +lofig_list *getlomodel(lofig_list *ptmodel, const char *mname) +{ +lofig_list *ptfig; + +char *name = namealloc(mname); + for (ptfig = ptmodel; ptfig; ptfig = ptfig->NEXT) + if (ptfig->NAME == name) + return ptfig; + return NULL; +} + +/******************************************************************************* +* function getloins() * +*******************************************************************************/ +loins_list *getloins(lofig_list *ptfig, const char *iname) +{ +loins_list *ptins; +char *name = namealloc(iname); + + for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT) + if (ptins->INSNAME == name) + return ptins; + + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "getloins impossible :\n"); + (void)fprintf(stderr, "instance %s doesn't exist in figure %s\n", + name, ptfig->NAME); + EXIT(1); + return NULL; /* never reached */ +} + +/******************************************************************************* +* function getlotrs() * +*******************************************************************************/ +lotrs_list *getlotrs(lofig_list *ptfig, const char *tname) +{ +lotrs_list *pttrs; +char *name = namealloc(tname); + + for (pttrs = ptfig->LOTRS; pttrs; pttrs = pttrs->NEXT) + if (pttrs->TRNAME == name) + return pttrs; + + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "getlotrs impossible :\n"); + (void)fprintf(stderr, "transistor %s doesn't exist in figure %s\n", + name, ptfig->NAME); + EXIT(1); + return NULL; /* never reached */ +} + +/******************************************************************************* +* function getlocon() * +*******************************************************************************/ +locon_list *getlocon(lofig_list *ptfig, const char *cname) +{ +locon_list *ptcon; +char *name = namealloc(cname); + + for (ptcon = ptfig->LOCON; ptcon; ptcon = ptcon->NEXT) + if (ptcon->NAME == name) + return ptcon; + + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "getlocon impossible :\n"); + (void)fprintf(stderr, "connector %s doesn't exist in figure %s\n", + name, ptfig->NAME); + EXIT(1); + return NULL; /* never reached */ +} + +/******************************************************************************* +* function getlosig() * +*******************************************************************************/ +losig_list *getlosig(lofig_list *ptfig, long index) +{ +losig_list *ptsig; +ptype_list *pt; +int low; +int high; +int sigsize; + + sigsize = getsigsize( ptfig ); + low = (index % sigsize); + high = (index / sigsize); + for (pt = ptfig->BKSIG; pt; pt = pt->NEXT) + if (pt->TYPE == high) break; + if (pt != NULL) { + ptsig = (losig_list *)(pt->DATA) + low; + if (ptsig->INDEX == index) + return ptsig; + } + + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "getlosig impossible :\n"); + (void)fprintf(stderr, "signal %ld doesn't exist in figure %s\n", + index, ptfig->NAME); + EXIT(1); + return NULL; /* never reached */ +} + +/******************************************************************************* +* function lofigchain() * +* For each signal, construct the list of connectors associated * +* with the signal.(Field USER of the "losig" structure with * +* the code "LOFIGCHAIN") * +* This provide the "dual" representation of the net-list * +*******************************************************************************/ +void lofigchain(lofig_list *ptfig) +{ +locon_list *ptcon = NULL; +losig_list *ptsig = NULL; +loins_list *ptins = NULL; +lotrs_list *pttrs = NULL; +ptype_list *ptype = NULL; + + if (ptfig->MODE == 'P') { + /* + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\nlofigchain impossible "); + (void)fprintf(stderr, ": figure %s is interface only\n", + ptfig->NAME); + EXIT(1); + */ + return; + } + + /* cleaning ... */ + for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT) { + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + if (ptype != (ptype_list *)NULL) { + freechain((chain_list *)ptype->DATA); + ptype->DATA = (void *)NULL; + } else + ptsig->USER = addptype(ptsig->USER, (long)LOFIGCHAIN, (void *)NULL); + } + + /* scan connector list */ + for (ptcon=ptfig->LOCON; ptcon; ptcon=ptcon->NEXT) { + ptsig = ptcon->SIG; + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + ptype->DATA = (void *)addchain((chain_list *)ptype->DATA, (void *)ptcon); + } + + /* scan instance list */ + for (ptins =ptfig->LOINS; ptins; ptins=ptins->NEXT) { + for (ptcon=ptins->LOCON; ptcon; ptcon=ptcon->NEXT) { + ptsig=ptcon->SIG; + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + ptype->DATA = (void *)addchain((chain_list *)ptype->DATA, + (void *)ptcon); + } + } + + /* scan transistor list */ + for (pttrs = ptfig->LOTRS; pttrs; pttrs = pttrs->NEXT) { + ptsig = pttrs->GRID->SIG; + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + ptype->DATA = (void *)addchain((chain_list *)ptype->DATA, + (void *)pttrs->GRID); + ptsig = pttrs->SOURCE->SIG; + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + ptype->DATA = (void *)addchain((chain_list *)ptype->DATA, + (void *)pttrs->SOURCE); + ptsig = pttrs->DRAIN->SIG; + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + ptype->DATA = (void *)addchain((chain_list *)ptype->DATA, + (void *)pttrs->DRAIN); + ptsig = pttrs->BULK->SIG; + if( ptsig ) { + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + ptype->DATA = (void *)addchain((chain_list *)ptype->DATA, + (void *)pttrs->BULK); + } + } + if (DEBUG_MODE == 'Y') + (void)printf("--- mbk --- lofigchain %s\n", ptfig->NAME); +} + +/******************************************************************************* +* function getsigname() * +* choose the least concatened signal name * +*******************************************************************************/ +char *getsigname(losig_list *ptsig) +{ +chain_list *ptscan; +char *ptchar; +char buffer[50]; +char *result = NULL; +register int nseparmin = 1000; + + if (ptsig == NULL) + return NULL; + + for (ptscan = ptsig->NAMECHAIN; ptscan; ptscan = ptscan->NEXT) { + register int nsepar = 0; + if (ptscan->DATA != NULL) { + for (ptchar = (char *)ptscan->DATA; *ptchar != '\0'; ptchar++) + if (*ptchar == SEPAR) + nsepar++; + if (nsepar < nseparmin) { + nseparmin = nsepar; + result = (char *)ptscan->DATA; + } + } + } + if (!result) { + (void)sprintf(buffer, "%ld", ptsig->INDEX); + result = namealloc(buffer); + } + return result; +} + +/******************************************************************************* +* function viewlo() * +* display on screen the content of all logical figures * +*******************************************************************************/ +void viewlo(void) +{ +lofig_list *ptfig; + + if (HEAD_LOFIG == NULL) { + (void)printf("\n!!! viewlo : empty list of figure !!!\n"); + return; + } else for (ptfig = HEAD_LOFIG; ptfig; ptfig = ptfig->NEXT) + viewlofig(ptfig); +} + +/******************************************************************************* +* function viewlofig() * +* display on screen the content of logical figure ptfig * +*******************************************************************************/ +void viewlofig(lofig_list *ptfig) +{ +locon_list *ptcon; +losig_list *ptsig; +loins_list *ptins; +lotrs_list *pttrs; +chain_list *scanchain; +ptype_list *pt; + + if (ptfig->NAME == NULL) + (void)printf("!!! figure without name !!! /n"); + else + (void)printf("\nfigure : %-20s mode : %c\n", ptfig->NAME, ptfig->MODE); + + if (ptfig->LOCON == NULL) + (void)printf(" |---empty connector list\n"); + else + { + for (ptcon = ptfig->LOCON; ptcon; ptcon = ptcon->NEXT) + viewlofigcon(ptcon); + + pt = getptype( ptfig->USER, PH_INTERF ); + if( pt ) + { + (void)printf(" |---connector list physical order\n"); + for( scanchain = (chain_list*)(pt->DATA); scanchain ; scanchain = scanchain->NEXT ) + (void)printf(" | |---%s\n",(char*)(scanchain->DATA) ); + (void)printf(" |\n"); + } + } + + if (ptfig->LOSIG == NULL) + (void)printf(" |---empty signal list\n"); + else for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT) + viewlosig(ptsig); + + if (ptfig->LOINS == NULL) + (void)printf(" |---empty instance list\n"); + else for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT) + viewloins(ptins); + + if (ptfig->LOTRS == NULL) + (void)printf(" |---empty transistor list\n"); + else for (pttrs = ptfig->LOTRS; pttrs; pttrs = pttrs->NEXT) + viewlotrs(pttrs); + + if (ptfig->USER != NULL) + { + (void)printf(" |---USER field\n"); + for( pt = ptfig->USER ; pt ; pt = pt->NEXT ) + (void)printf(" | |-- %ld\n",pt->TYPE); + } + else + (void)printf(" |---empty USER field\n"); + + (void)printf(" | \n"); +} + +/******************************************************************************* +* function viewlofigcon() * +*******************************************************************************/ +void viewlofigcon(locon_list *ptcon) +{ + num_list *scannum; + ptype_list *scanptype; + chain_list *scanchain; + + if (ptcon->NAME == NULL) + (void)printf(" |--- !!! connector without name !!!\n"); + else + (void)printf(" |---connector : \"%s\"\n", ptcon->NAME); + (void)printf(" | |---direction : %c\n", ptcon->DIRECTION); + if (ptcon->SIG == NULL) + (void)printf(" | |---no signal\n"); + else + (void)printf(" | |---signal : %ld\n", ptcon->SIG->INDEX); + if (ptcon->ROOT == NULL) + (void)printf(" |---no root\n"); + else + (void)printf(" | |---root : %s\n", + ((char *)(((lofig_list *)(ptcon->ROOT))->NAME))); + (void)printf(" | |---type : %c \n", ptcon->TYPE); + + (void)printf(" | |---USER list\n"); + for( scanptype = ptcon->USER ; scanptype ; scanptype = scanptype->NEXT ) + { + switch( scanptype->TYPE ) + { + case PNODENAME: + (void)printf(" | | |---PNODENAME\n"); + for( scanchain = (chain_list*)(scanptype->DATA); + scanchain; + scanchain = scanchain->NEXT ) + (void)printf(" | | | |---%s\n", (char*)(scanchain->DATA)?(char*)(scanchain->DATA):"NULL" ); + break; + default: + (void)printf(" | | | |---%ld\n",scanptype->TYPE); + } + } + + if(ptcon->PNODE == NULL) + (void)printf(" | |---no node\n"); + else { + (void)printf(" | |---node\n"); + for(scannum = ptcon->PNODE; scannum; scannum = scannum->NEXT ) + (void)printf(" | | |---%ld\n",scannum->DATA); + + } + + (void)printf(" |\n"); +} + +/******************************************************************************* +* function viewlosig() * +*******************************************************************************/ +void viewlosig(losig_list *ptsig) +{ +chain_list *ptchain; +lowire_list *scanwire; +chain_list *scanctc; +loctc_list *ptctc; +char levelrc; +ptype_list *ptptype; +num_list *scannum; + + (void)printf(" |---signal : %ld \n" , ptsig->INDEX); + if (ptsig->NAMECHAIN == NULL) + (void)printf(" | |---no alias names\n"); + else for (ptchain = ptsig->NAMECHAIN; ptchain; ptchain = ptchain->NEXT) { + if (ptchain->DATA == NULL) + (void)printf(" | |--- !!! empty name !!!\n"); + else + (void)printf(" | |---alias : \"%s\"\n", (char *)ptchain->DATA); + } + (void)printf(" | |---type : %c\n" , ptsig->TYPE); + + levelrc = rclevel( ptsig ); + + if( levelrc == MBK_RC_A ) + (void)printf(" | |---no parasitic data\n"); + else { + (void)printf(" | |---parasitic data\n"); + (void)printf(" | | |---capacitance : %g\n" , ptsig->PRCN->CAPA); + if( levelrc == MBK_RC_C || levelrc == MBK_RC_E ) { + (void)printf(" | | |---wire list\n"); + for( scanwire = ptsig->PRCN->PWIRE ; scanwire != NULL ; scanwire = scanwire->NEXT ) + (void)printf(" | | | |- %s n1=%3ld n2=%3ld r=%g c=%g\n", + scanwire->LAYER == RCN_WIRE_ALU1 ? "ALU1" : + scanwire->LAYER == RCN_WIRE_ALU2 ? "ALU2" : + scanwire->LAYER == RCN_WIRE_POLY ? "POLY" : + scanwire->LAYER == RCN_WIRE_CONT_POLY ? "CONT_POLY" : + scanwire->LAYER == RCN_WIRE_CONT_DIF_N ? "CONT_DIF_N" : + scanwire->LAYER == RCN_WIRE_CONT_VIA ? "CONT_VIA" : + scanwire->LAYER == RCN_WIRE_CONT_VIA2 ? "CONT_VIA2" : + "UNKNOWN", + scanwire->NODE1, + scanwire->NODE2, + scanwire->RESI, + scanwire->CAPA ); + } + else + (void)printf(" | | |---no wire\n"); + if( levelrc == MBK_RC_D || levelrc == MBK_RC_E ) { + (void)printf(" | | |---crosstalk capacitance list\n"); + for( scanctc = ptsig->PRCN->PCTC ; scanctc != NULL ; scanctc = scanctc->NEXT ) { + ptctc = (loctc_list*)scanctc->DATA; + (void)printf(" | | | |-S1=%3ld N1=%3ld S2=%3ld N2=%3ld Capa=%g.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + ptctc->CAPA + ); + } + } + else + (void)printf(" | | |---no crosstalk capacitance\n"); + (void)printf(" | | |---%ld node\n",ptsig->PRCN->NBNODE); + } + (void)printf(" | |---USER list\n"); + for( ptptype = ptsig->USER ; ptptype ; ptptype = ptptype->NEXT ) + { + switch( ptptype->TYPE ) + { + case LOFIGCHAIN: + printf( " | | |-LOFIGCHAIN\n" ); + for( ptchain = (chain_list*)ptptype->DATA ; ptchain ; ptchain = ptchain->NEXT ) + { + printf( " | | | |-%s ",((locon_list*)ptchain->DATA)->NAME); + switch( ((locon_list*)ptchain->DATA)->TYPE ) + { + case 'T': + printf( "(T%c : %s) ",((lotrs_list*)((locon_list*)ptchain->DATA)->ROOT)->TYPE==TRANSN?'N':'P',((lotrs_list*)((locon_list*)ptchain->DATA)->ROOT)->TRNAME ? ((lotrs_list*)((locon_list*)ptchain->DATA)->ROOT)->TRNAME : "No name" ); + break; + case 'I': + printf( "(I : %s) ",((loins_list*)((locon_list*)ptchain->DATA)->ROOT)->INSNAME ? ((loins_list*)((locon_list*)ptchain->DATA)->ROOT)->INSNAME : "No name" ); + break; + case 'E': + printf( "(Figure) " ); + break; + default: + printf( "No valid type.\n" ); + } + for( scannum = ((locon_list*)ptchain->DATA)->PNODE ; scannum ; scannum = scannum->NEXT ) + printf( "%ld ", scannum->DATA ); + printf( "\n" ); + } + break; + default: + } + } + { + } + (void)printf(" | \n"); +} + + +/******************************************************************************* +* function viewloins() * +*******************************************************************************/ +void viewloins(loins_list *ptins) +{ +locon_list *ptcon; +chain_list *scanchain; +ptype_list *pt; + +if (ptins->INSNAME == NULL) + (void)printf(" |--- !!! no instance name !!!\n"); +else + (void)printf(" |---instance : %s\n", ptins->INSNAME); +if (ptins->FIGNAME == NULL) + (void)printf(" | |--- !!! no instance model !!!\n"); +else + (void)printf(" | |---model : %s \n" , ptins->FIGNAME); +if (ptins->LOCON == NULL) + (void)printf(" | |---empty list of connectors\n"); +else +{ + for (ptcon = ptins->LOCON; ptcon != NULL; ptcon = ptcon->NEXT) + viewloinscon(ptcon); + pt = getptype( ptins->USER, PH_INTERF ); + if( pt ) + { + (void)printf(" | |---connector list physical order\n"); + for( scanchain = (chain_list*)(pt->DATA); scanchain ; scanchain = scanchain->NEXT ) + (void)printf(" | | |---%s\n",(char*)(scanchain->DATA) ); + (void)printf(" | |\n"); + } +} +if (ptins->USER != NULL) + (void)printf(" | |---non empty USER field\n"); + (void)printf(" | \n"); +} + +/******************************************************************************* +* function viewlotrs() * +*******************************************************************************/ +void viewlotrs(lotrs_list *pttrs) +{ + (void)printf(" |---transistor\n"); + (void)printf(" | |---type : %c %s %s\n", + IsTransN(pttrs->TYPE)?'N':'P', + IsTransFast(pttrs->TYPE)?"FAST":"SLOW", + IsTransHvio(pttrs->TYPE)?"HVIO":"----" + ); +if (pttrs->TRNAME != NULL ) + (void)printf(" | |---name : %s\n", pttrs->TRNAME ); +else + (void)printf(" | |---no name\n" ); + +if (pttrs->SOURCE == NULL) + (void)printf(" | |--- !!! no signal on source !!! \n"); +else + viewloinscon( pttrs->SOURCE ); + +if (pttrs->GRID == NULL) + (void)printf(" | |--- !!! no signal on grid !!!\n"); +else + viewloinscon( pttrs->GRID ); + +if (pttrs->DRAIN == NULL) + (void)printf(" | |--- !!! no signal on drain !!!\n"); +else + viewloinscon( pttrs->DRAIN ); + +if (pttrs->BULK == NULL) + (void)printf(" | |--- !!! no signal on bulk !!!\n"); +else + viewloinscon( pttrs->BULK ); + + (void)printf(" | |---x : %ld\n", pttrs->X); + (void)printf(" | |---y : %ld\n", pttrs->Y); + (void)printf(" | |---width : %ld\n", pttrs->WIDTH); + (void)printf(" | |---length : %ld\n", pttrs->LENGTH); + (void)printf(" | |---ps : %ld\n", pttrs->PS); + (void)printf(" | |---pd : %ld\n", pttrs->PD); + (void)printf(" | |---xs : %ld\n", pttrs->XS); + (void)printf(" | |---xd : %ld\n", pttrs->XD); +if (pttrs->USER != NULL) + (void)printf(" | |---non empty USER field\n"); + (void)printf(" |\n"); +} + +/******************************************************************************* +* function viewloinscon() * +*******************************************************************************/ +void viewloinscon(locon_list *ptcon) +{ +num_list *scannum; +ptype_list *scanptype; +chain_list *scanchain; + +if (ptcon->NAME == NULL) + (void)printf(" | |---no connector name\n"); +else + (void)printf(" | |---connector : \"%s\"\n" , ptcon->NAME); + (void)printf(" | | |---direction : %c\n" , ptcon->DIRECTION); +if (ptcon->SIG == NULL) + (void)printf(" | | |---no signal\n"); +else + (void)printf(" | | |---signal : %ld\n" , ptcon->SIG->INDEX); +if ((ptcon->ROOT) == NULL) + (void)printf(" | | |---no root\n"); +else + switch( ptcon->TYPE ) + { + case 'I': + (void)printf(" | | |---root : %s\n" , ((char*)(((loins_list *)(ptcon->ROOT))->INSNAME))); + break; + case 'T': + (void)printf(" | | |---root : %s\n" , + ((lotrs_list*)(ptcon->ROOT))->TRNAME?((lotrs_list*)(ptcon->ROOT))->TRNAME:"no transistor name" ); + break; + default: + (void)printf(" | | |---root : *** BAD TYPE ***\n" ); + } + (void)printf(" | | |---type : %c\n" , ptcon->TYPE); + if(ptcon->PNODE == NULL) + (void)printf(" | | |---no node\n"); + else { + (void)printf(" | | |---node\n"); + for(scannum = ptcon->PNODE; scannum; scannum = scannum->NEXT ) + (void)printf(" | | | |---%ld\n",scannum->DATA); + } + (void)printf(" | | |---USER list\n"); + for( scanptype = ptcon->USER ; scanptype ; scanptype = scanptype->NEXT ) + { + switch( scanptype->TYPE ) + { + case PNODENAME: + (void)printf(" | | | |---PNODENAME\n"); + for( scanchain = (chain_list*)(scanptype->DATA); + scanchain; + scanchain = scanchain->NEXT ) + (void)printf(" | | | | |---%s\n", (char*)(scanchain->DATA)?(char*)(scanchain->DATA):"NULL" ); + break; + default: + (void)printf(" | | | |---%ld\n",scanptype->TYPE); + } + } + (void)printf(" | | \n"); +} + +/******************************************************************************* +* function getsigsize() * +*******************************************************************************/ + +int getsigsize(lofig_list *ptfig) +{ + ptype_list *ptl; + + ptl = getptype( ptfig->USER, PTSIGSIZE ); + if( ptl ) + return( (int)(ptl->DATA) ); + + return( SIGSIZE ); +} + +/******************************************************************************* +* function setsigsize() * +*******************************************************************************/ + +void setsigsize(lofig_list *ptfig, int nb) +{ + ptype_list *ptl; + + if( ptfig->BKSIG ) + { + fflush( stdout ); + fprintf( stderr,"*** mbk error ***\n" ); + fprintf( stderr,"setsigsize() impossible\n" ); + fprintf( stderr,"BKSIG not NULL.\n" ); + EXIT(1); + } + + ptl = getptype( ptfig->USER, PTSIGSIZE ); + if( !ptl ) + ptfig->USER = addptype( ptfig->USER, PTSIGSIZE, (void*)nb ); + else + ptl->DATA = (void*)nb; +} + + +/******************************************************************************* +* function for cleaning USER field of structures. * +*******************************************************************************/ + +/*#define MBK_TRACE_BAD_PTYPE 0*/ + +void delloconuser(locon_list *ptlocon) +{ + ptype_list *scanptype; + ptype_list *next; + ptype_list *prev; + int del; + + prev = NULL; + for( scanptype = ptlocon->USER ; scanptype ; scanptype = next ) + { + next = scanptype->NEXT; + del = 0; + + switch( scanptype->TYPE ) + { + case PNODENAME: + freechain( scanptype->DATA ); + del = 1; + break; + default: +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n", + scanptype->TYPE + ); +#endif + } + + if( del ) + { + if( !prev ) + ptlocon->USER = next; + else + prev->NEXT = next; + scanptype->NEXT = NULL; + freeptype( scanptype ); + } + else + prev = scanptype; + } +} + +void dellofiguser(lofig_list *ptlofig) +{ + ptype_list *scanptype; + ptype_list *next; + ptype_list *prev; + int del; + + prev = NULL; + for( scanptype = ptlofig->USER ; scanptype ; scanptype = next ) + { + next = scanptype->NEXT; + del = 0; + + switch( scanptype->TYPE ) + { + case PH_INTERF: + freechain( scanptype->DATA ); + del = 1; + break; + case PTSIGSIZE: + del = 1; + break; + default: +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n", + scanptype->TYPE + ); +#endif + } + + if( del ) + { + if( !prev ) + ptlofig->USER = next; + else + prev->NEXT = next; + scanptype->NEXT = NULL; + freeptype( scanptype ); + } + else + prev = scanptype; + } +} + +void delloinsuser(loins_list *ptloins) +{ + ptype_list *scanptype; + ptype_list *next; + ptype_list *prev; + int del; + + prev = NULL; + for( scanptype = ptloins->USER ; scanptype ; scanptype = next ) + { + next = scanptype->NEXT; + del = 0; + + switch( scanptype->TYPE ) + { + case PH_INTERF: + freechain( scanptype->DATA ); + del = 1; + break; + default: +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n", + scanptype->TYPE + ); +#endif + } + + if( del ) + { + if( !prev ) + ptloins->USER = next; + else + prev->NEXT = next; + scanptype->NEXT = NULL; + freeptype( scanptype ); + } + else + prev = scanptype; + } +} + +void dellotrsuser(lotrs_list *ptlotrs) +{ + ptype_list *scanptype; + ptype_list *next; + ptype_list *prev; + int del; + + prev = NULL; + for( scanptype = ptlotrs->USER ; scanptype ; scanptype = next ) + { + next = scanptype->NEXT; + del = 0; + + switch( scanptype->TYPE ) + { + default: +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n", + scanptype->TYPE + ); +#endif + } + + if( del ) + { + if( !prev ) + ptlotrs->USER = next; + else + prev->NEXT = next; + scanptype->NEXT = NULL; + freeptype( scanptype ); + } + else + prev = scanptype; + } +} + +void dellosiguser(losig_list *ptlosig) +{ + ptype_list *scanptype; + ptype_list *next; + ptype_list *prev; + int del; + + prev = NULL; + for( scanptype = ptlosig->USER ; scanptype ; scanptype = next ) + { + next = scanptype->NEXT; + del = 0; + + switch( scanptype->TYPE ) + { + case LOFIGCHAIN: + freechain( scanptype->DATA ); + del = 1; + break; + default: +#ifdef MBK_TRACE_BAD_PTYPE + fprintf( stderr, "WARNING in delloconuser() : unknown ptype %ld\n", + scanptype->TYPE + ); +#endif + } + + if( del ) + { + if( !prev ) + ptlosig->USER = next; + else + prev->NEXT = next; + scanptype->NEXT = NULL; + freeptype( scanptype ); + } + else + prev = scanptype; + } +} diff --git a/alliance/src/mbk/src/mbk_lo.h b/alliance/src/mbk/src/mbk_lo.h new file mode 100644 index 00000000..73bf46cd --- /dev/null +++ b/alliance/src/mbk/src/mbk_lo.h @@ -0,0 +1,73 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : mbk_lo.c header file for functions declarations + * Date : 18/12/91 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mbk_lo.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MBK_LO_H_ +#define _MBK_LO_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + + extern locon_list * addlocon __P((lofig_list *ptfig, const char *name, losig_list *ptsig, char dir)); + extern lofig_list * addlofig __P((const char *name)); + extern loins_list * addloins __P((lofig_list *ptfig, const char *insname, lofig_list *ptnewfig, chain_list *sigchain)); + extern lofig_list * addlomodel __P((lofig_list *model, const char *name)); + extern losig_list * addlosig __P((lofig_list *ptfig, long index, chain_list *namechain, char type)); + extern losig_list * AX_addlosig __P((lofig_list *ptfig, long index, chain_list *namechain, char type)); + extern lotrs_list * addlotrs __P((lofig_list *ptfig, char type, long x, long y, long width, long length, long ps, long pd, long xs, long xd, losig_list *ptgrid, losig_list *ptsource, losig_list *ptdrain, losig_list *ptbulk, const char *name)); + extern int dellocon __P((lofig_list *ptfig, const char *name)); + extern int dellofig __P((const char *name)); + extern int delloins __P((lofig_list *ptfig, const char *insname)); + extern int dellosig __P((lofig_list *ptfig, long index)); + extern int dellotrs __P((lofig_list *ptfig, lotrs_list *pttrs)); + extern void freelomodel __P((lofig_list *ptmodel)); + extern locon_list * getlocon __P((lofig_list *ptfig, const char *name)); + extern lofig_list * getlofig __P((const char *figname, char mode)); + extern loins_list * getloins __P((lofig_list *ptfig, const char *name)); + extern lofig_list * getlomodel __P((lofig_list *ptmodel, const char *name)); + extern losig_list * getlosig __P((lofig_list *ptfig, long index)); + extern lotrs_list * getlotrs __P((lofig_list *ptfig, const char *name)); + extern void lofigchain __P((lofig_list *ptfig)); + extern void viewlo __P(()); + extern void viewlofig __P((lofig_list *ptfig)); + extern void viewlofigcon __P((locon_list *ptcon)); + extern void viewloins __P((loins_list *ptins)); + extern void viewloinscon __P((locon_list *ptcon)); + extern void viewlosig __P((losig_list *ptsig)); + extern void viewlotrs __P((lotrs_list *pttrs)); + + +#endif + diff --git a/alliance/src/mbk/src/mbk_lo_util.c b/alliance/src/mbk/src/mbk_lo_util.c new file mode 100644 index 00000000..05272559 --- /dev/null +++ b/alliance/src/mbk/src/mbk_lo_util.c @@ -0,0 +1,3339 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : utilities for logical structures + * Date : 05/11/92 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + */ + +#ident "$Id: mbk_lo_util.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +#include +#include +#include +#include +#include +#include + +#include "mut.h" +#include "mlo.h" +#include "rcn.h" +#include "mlu.h" +#include "mbk_lo_util.h" +#include "rcn_lo.h" + +/* local for flattenlofig */ +#define FLATTEN_CTC 19971215 +#define FLATTEN_POSTRAIT 19971216 + +void debugctc ( losig_list*, int ); +void debugctc2 ( lofig_list* ); + +/******************************************************************************* +* function getlofig() * +* if mode == 'A' all the figure is needed * +* if mode == 'P' interface only is needed * +*******************************************************************************/ +lofig_list *getlofig(const char *fname, char mode) +{ +lofig_list *ptfig; +char *figname = namealloc(fname); + /* scan figure list */ + for (ptfig = HEAD_LOFIG; ptfig; ptfig = ptfig->NEXT) + if (ptfig->NAME == figname) + break; + + if (ptfig == NULL) { /* figure doesn't exist */ + ptfig = (lofig_list *)mbkalloc(sizeof(lofig_list)); + ptfig->NAME = figname; + ptfig->MODELCHAIN = NULL; + ptfig->LOINS = NULL; + ptfig->LOTRS = NULL; + ptfig->LOCON = NULL; + ptfig->LOSIG = NULL; + ptfig->BKSIG = NULL; + ptfig->USER = NULL; + ptfig->NEXT = HEAD_LOFIG; + HEAD_LOFIG = ptfig; + ptfig->MODE = mode; + loadlofig(ptfig, figname, mode ); + return ptfig; + } + + return ptfig; +} + +/******************************************************************************* +* function givelosig() * +*******************************************************************************/ +losig_list *givelosig(lofig_list *ptfig, long index) +{ +losig_list *ptsig = NULL; +ptype_list *pt = NULL; +int low; +int type; +int sigsize; + sigsize = getsigsize( ptfig ); + low = (index % sigsize); + type = (index / sigsize); + for (pt = ptfig->BKSIG; pt; pt = pt->NEXT) + if (pt->TYPE == type) + break; + if (pt != NULL) { + ptsig = (losig_list *)(pt->DATA) + low; + if (ptsig->INDEX == index) + return ptsig; + } + return addlosig(ptfig, index, (chain_list *)NULL, 'I' ); +} + +/******************************************************************************* +* function flattenlofig() * +* * +* the instance "insname" is suppressed as a hierarchical level * +* in figure pointed by "ptfig". Capacitances and netlist * +* consistency is preserved. * +* Modified by Gregoire AVOT for rcn support. * +*******************************************************************************/ +void flattenlofig(lofig_list *ptfig, const char *iname, char concat) +{ + struct st_interf + { + struct st_interf *next; + int base; + losig_list *sig; + }; + + struct st_contact + { + struct st_contact *next; + locon_list *con1; /* on instance */ + int node1; + locon_list *con2; /* on lofig of instance */ + int node2; + int interf; + }; + + chain_list *nextscanctc; + loins_list *ptins; + lofig_list *figins; + losig_list *scanlosig; + int maxsig; + locon_list *ptcon; + chain_list *scanchain; + ptype_list *ptptype; + struct st_interf *interf; + struct st_interf *ptinterf; + struct st_contact *contact; + struct st_contact *ptcontact; + int nbinterf; + num_list *sn1; + num_list *sn2; + lowire_list *scanwire; + int node1; + struct st_interf *ctinterf; + int *newnode; + losig_list *newsig; + locon_list *scanlocon; + int maxnode; + chain_list *scanctc; + locon_list *nextlocon; + void *forfree; + loctc_list *ptctc; + loctc_list *ptctc2; + chain_list *prevctc; + chain_list *prevctc2; + chain_list *scanctc2; + losig_list *sigctc2; + int othernode; + int scanctcnode; + losig_list *othersig; + chain_list *posttreatsig=NULL; + ptype_list *ptbksig=NULL; + int maxnode_itrf; + int newnode_itrf; + chain_list *scanmodel; + chain_list *lofigc; + chain_list *chainhtab; + chain_list *chainht; + chain_list *loconchain; + chain_list *chain; + htitem *ptitem ; + long nbi; + + int verif; + + lotrs_list *scantrs; + loins_list *scanins; + + int i; + char all; + long key ; + ht *htab ; + const char *insname; + + /* recupere l'index maximum des signaux sur la figure */ + maxsig = -1 ; + for( ptptype = ptfig->BKSIG ; ptptype ; ptptype = ptptype->NEXT ) + { + if( ptptype->TYPE > maxsig ) + { + maxsig = ptptype->TYPE; + ptbksig = ptptype; + } + } + + scanlosig = (losig_list*)(ptbksig->DATA); + verif = getsigsize( ptfig ); + for( i=0 ; i< verif ; i++ ) + { + if( scanlosig[i].INDEX > maxsig ) + maxsig = scanlosig[i].INDEX; + } + + maxsig++; + + /* si insname == NULL on met a plat au niveau transistor */ + + if(iname == NULL) + all = 'Y' ; + else + all = 'N' ; + + /* On verifie que le lofigchain est bien a jour. Tous les signaux d'une + * lofig ont le ptype dans leur champ USER, meme si il est vide */ + + if (!getptype(ptfig->LOSIG->USER, LOFIGCHAIN)) { +#if 0 + fflush( stdout ); + fprintf( stderr, "*** mbk warning ***\n" ); + fprintf( stderr, "lofigchain is missing on lofig %s.\n", ptfig->NAME ); +#endif + + lofigchain( ptfig ); + } + +while(ptfig->LOINS != NULL) +{ + if(all == 'Y') + { + insname = ptfig->LOINS->INSNAME ; + } + else + insname = iname; + + ptins = getloins( ptfig, insname ); + figins = rduplofig( getlofig( ptins->FIGNAME, 'A' ) ); + + lofigchain( figins ); + + for( ptcon = ptins->LOCON ; ptcon ; ptcon = ptcon->NEXT ) + if( ptcon->SIG->PRCN && gettabnode( ptcon->SIG->PRCN ) ) + freetable( ptcon->SIG ); + + /* Si un seul signal a un RC, on en cree un sur tous les autres */ + + for( ptcon = ptins->LOCON ; ptcon ; ptcon = ptcon->NEXT ) + if( ptcon->SIG->PRCN ) + break; + + if( !ptcon ) + for( scanlosig = figins->LOSIG ; scanlosig ; scanlosig = scanlosig->NEXT ) + if( scanlosig->PRCN ) + break; + + if( scanlosig || ptcon ) + { + for( ptcon = ptins->LOCON ; ptcon ; ptcon = ptcon->NEXT ) + { + if( ! ptcon->SIG->PRCN ) + { + addlorcnet( ptcon->SIG ); + } + + if( gettabnode( ptcon->SIG->PRCN ) ) + freetable( ptcon->SIG ); + } + + for( scanlosig = figins->LOSIG ; scanlosig ; scanlosig = scanlosig->NEXT ) + { + if( ! scanlosig->PRCN ) + addlorcnet( scanlosig ); + + if( gettabnode( scanlosig->PRCN ) ) + freetable( scanlosig ); + } + } + + /* Au boulot */ + for( scanlosig = figins->LOSIG ; scanlosig ; scanlosig = scanlosig->NEXT ) + { + if( scanlosig->TYPE == INTERNAL ) + { + newsig = addlosig( ptfig, maxsig, NULL, INTERNAL ); + maxsig++; + + newsig->USER = addptype( newsig->USER, LOFIGCHAIN, NULL ); + + /* concatene les nom si necessaire */ + if( concat != NO ) + for( scanchain = scanlosig->NAMECHAIN ; + scanchain ; + scanchain = scanchain->NEXT + ) + scanchain->DATA = concatname( insname, (char*)(scanchain->DATA) ); + newsig->NAMECHAIN = scanlosig->NAMECHAIN; + scanlosig->NAMECHAIN = NULL; + + ptptype = getptype( newsig->USER, LOFIGCHAIN ); + for( scanchain = getptype( scanlosig->USER, LOFIGCHAIN )->DATA ; + scanchain ; + scanchain = scanchain->NEXT ) + { + ptcon = (locon_list*)(scanchain->DATA); + ptcon->SIG = newsig; + ptptype->DATA = (void*)addchain( (chain_list*)ptptype->DATA, ptcon ); + } + + if( scanlosig->PRCN ) + { + duplorcnet( newsig, scanlosig ); + + /* Duplication des CTC */ + + for( scanctc = scanlosig->PRCN->PCTC ; + scanctc ; + scanctc = scanctc->NEXT ) + { + ptctc = (loctc_list*)scanctc->DATA; + if( !ptctc ) + { + fflush( stdout ); + fprintf( stderr, "*** mbk error ***\n" ); + fprintf( stderr, + "Null CTC on signal %ld (1) in instance %s.\n", + scanlosig->INDEX, + insname + ); + } + + if( ptctc->SIG1 == scanlosig ) + { + newsig->PRCN->PCTC = addchain( newsig->PRCN->PCTC, ptctc ); + ptctc->SIG1 = newsig; + } + + if( ptctc->SIG2 == scanlosig ) + { + newsig->PRCN->PCTC = addchain( newsig->PRCN->PCTC, ptctc ); + ptctc->SIG2 = newsig; + } + } + } + } + else /* scanlosig->TYPE == EXTERNAL */ + { + /* cree la liste interf */ + interf = (struct st_interf*)mbkalloc( sizeof( struct st_interf ) ); + interf->base = 0; + interf->next = NULL; + interf->sig = scanlosig; + + loconchain = NULL ; + + for( scanchain = + (chain_list*)(getptype( scanlosig->USER, LOFIGCHAIN )->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptcon = (locon_list*)(scanchain->DATA); + if( ptcon->ROOT == figins ) + { + for( scanlocon = ptins->LOCON ; + scanlocon ; + scanlocon = scanlocon->NEXT + ) + { + if( scanlocon->NAME == ptcon->NAME ) + break; + } + + if( ! scanlocon ) + { + fflush( stdout ); + fprintf( stderr, "*** mbk error ***\n" ); + fprintf( stderr, + "flattenlofig : Connector %s exist only in instance %s.\n", + ptcon->NAME, + insname + ); + EXIT(1); + } + + loconchain = addchain(loconchain,scanlocon) ; + + ptinterf = (struct st_interf*) + mbkalloc( sizeof( struct st_interf ) ); + ptinterf->base = 0; + ptinterf->next = interf; + ptinterf->sig = scanlocon->SIG; + interf = ptinterf; + + if( ! scanlocon->PNODE && ptcon->PNODE ) + { + for( maxnode_itrf = 0, sn1 = ptcon->PNODE ; sn1 ; sn1 = sn1->NEXT, maxnode_itrf++ ); + + newnode_itrf = addlonode( scanlocon->SIG, NULL ); + + for( i = 1 ; i <= maxnode_itrf ; i++ ) + setloconnode( scanlocon, newnode_itrf ); + } + + if( scanlocon->PNODE && ! ptcon->PNODE ) + { + for( maxnode_itrf = 0, sn1 = scanlocon->PNODE ; sn1 ; sn1 = sn1->NEXT, maxnode_itrf++ ); + + newnode_itrf = addlonode( ptcon->SIG, NULL ); + + for( i = 1 ; i <= maxnode_itrf ; i++ ) + setloconnode( ptcon, newnode_itrf ); + } + + } + } + + for( ptinterf = interf ; ptinterf ; ptinterf = ptinterf->next ) + if(ptinterf->sig != scanlosig) + break ; + + if(ptinterf) + { + newsig = ptinterf->sig ; + ptptype = getptype(newsig->USER,LOFIGCHAIN) ; + for(chain = loconchain ; chain != NULL ; chain = chain->NEXT) + { + scanchain = (chain_list*)ptptype->DATA ; + while( scanchain ) + { + ptcon = (locon_list*)(scanchain->DATA); + + if((locon_list *)chain->DATA == ptcon) + { + if(scanchain == (chain_list*)ptptype->DATA) + { + ptptype->DATA = delchain((chain_list*)ptptype->DATA, + scanchain) ; + scanchain = ptptype->DATA ; + } + else + { + lofigc->NEXT = delchain(lofigc->NEXT, + scanchain) ; + scanchain = lofigc->NEXT ; + } + break ; + } + else + { + lofigc = scanchain ; + scanchain = scanchain->NEXT ; + } + } + } + } + else + { + newsig = addlosig( ptfig, maxsig, NULL, INTERNAL ); + maxsig++; + newsig->USER = addptype( newsig->USER, LOFIGCHAIN, NULL ); + ptptype = newsig->USER ; + } + + freechain(loconchain) ; + + if(getptype(newsig->USER,FLATTEN_POSTRAIT) == NULL) + { + posttreatsig = addchain( posttreatsig, newsig ); + newsig->USER = addptype(newsig->USER,FLATTEN_POSTRAIT,NULL) ; + } + + /* cree la liste contact */ + contact = NULL; + if( newsig->PRCN ) + nbinterf = newsig->PRCN->NBNODE ; + else + nbinterf = 1; + + for( scanchain = + (chain_list*)(getptype( scanlosig->USER, LOFIGCHAIN )->DATA) ; + scanchain ; + scanchain = scanchain->NEXT ) + { + ptcon = (locon_list*)(scanchain->DATA); + if( ptcon->ROOT == figins ) + { + for( scanlocon = ptins->LOCON ; + scanlocon ; + scanlocon = scanlocon->NEXT + ) + { + if( scanlocon->NAME == ptcon->NAME ) + break; + } + + if( !scanlocon ) + { + fflush( stdout ); + fprintf( stderr, "*** mbk error ***\n" ); + fprintf( stderr, + "flattenlofig : Connector %s exist only in instance %s.\n", + ptcon->NAME, + ptfig->NAME + ); + EXIT(1); + } + + if( scanlocon->PNODE || ptcon->PNODE ) + { + for( sn1 = scanlocon->PNODE, sn2 = ptcon->PNODE ; + sn1 && sn2 ; + sn1 = sn1->NEXT, sn2 = sn2->NEXT + ) + { + ptcontact = + (struct st_contact*)mbkalloc( sizeof( struct st_contact ) ); + + ptcontact->next = contact; + ptcontact->con1 = scanlocon; + ptcontact->con2 = ptcon; + ptcontact->node1 = sn1->DATA; + ptcontact->node2 = sn2->DATA; + if(scanlocon->SIG == newsig) + ptcontact->interf = sn1->DATA ; + else + { + ptcontact->interf = nbinterf++; + } + + contact = ptcontact; + } + + if( sn1 || sn2 ) + { + fflush( stdout ); + fprintf( stderr, "*** mbk error ***\n" ); + fprintf( stderr, + "flattenlofig : Connector %s in instance %s : Number of physical node differ.\n", + ptcon->NAME, + figins->NAME + ); + EXIT(1); + } + } + else + { + ptcontact = + (struct st_contact*)mbkalloc( sizeof( struct st_contact ) ); + + ptcontact->next = contact; + ptcontact->con1 = scanlocon; + ptcontact->con2 = ptcon; + ptcontact->node1 = 0; + ptcontact->node2 = 0; + ptcontact->interf = 0; + + contact = ptcontact; + } + } + } + + /* Met a jour le champs base des structures inter */ + if( interf->sig->PRCN ) + { + if(!newsig->PRCN) + addlorcnet( newsig ); + + maxnode = nbinterf ; + + for( ptinterf = interf ; ptinterf ; ptinterf = ptinterf->next ) + { + if(ptinterf->sig != newsig) + { + ptinterf->base = maxnode - 1 ; + maxnode = maxnode + ptinterf->sig->PRCN->NBNODE - 1 ; + + newsig->PRCN->CAPA += ptinterf->sig->PRCN->CAPA; + } + else + ptinterf->base = 0 ; + } + } + + /* calcul le type de newsig */ + + for( ptinterf = interf ; ptinterf ; ptinterf = ptinterf->next ) + if( ptinterf->sig != scanlosig && ptinterf->sig->TYPE == EXTERNAL ) + break; + + if( ptinterf ) + newsig->TYPE = EXTERNAL; + else + newsig->TYPE = INTERNAL; + + /* met a jour le nom de newsig */ + for( ptinterf = interf ; ptinterf ; ptinterf = ptinterf->next ) + { + if(ptinterf->sig == newsig) + continue ; + if( concat != NO ) + { + if( ptinterf->sig == scanlosig ) + for( scanchain = ptinterf->sig->NAMECHAIN ; + scanchain ; + scanchain = scanchain->NEXT + ) + scanchain->DATA = concatname( insname, (char*)scanchain->DATA ); + } + newsig->NAMECHAIN = append( ptinterf->sig->NAMECHAIN, newsig->NAMECHAIN ); + ptinterf->sig->NAMECHAIN = NULL; + } + + /* Pour chaque signal S de interf */ + for( ptinterf = interf ; ptinterf ; ptinterf = ptinterf->next ) + { + if(ptinterf->sig == newsig) + continue ; + /* Pour chaque connecteur C de S */ + for( scanchain = + (chain_list*)(getptype( ptinterf->sig->USER, LOFIGCHAIN )->DATA); + scanchain ; + scanchain = scanchain->NEXT ) + { + ptcon = (locon_list*)(scanchain->DATA); + + for( ptcontact = contact ; ptcontact ; ptcontact = ptcontact->next ) + if( ptcon == ptcontact->con1 || ptcon == ptcontact->con2 ) + break; + + /* Si C n'est pas sur l'interface */ + if( !ptcontact ) + { + ptptype->DATA = (void*)addchain( (chain_list*)ptptype->DATA,ptcon); + + for( sn1 = ptcon->PNODE ; sn1 ; sn1 = sn1->NEXT ) + { + for( ptcontact = contact ; + ptcontact ; + ptcontact = ptcontact->next + ) + { + if( ptcontact->node1 == sn1->DATA && + ptcontact->con1->SIG == ptcon->SIG + ) + break; + if( ptcontact->node2 == sn1->DATA && + ptcontact->con2->SIG == ptcon->SIG + ) + break; + } + + if( ptcontact ) + /* cas particulier : si un noeud appartient aussi a un + * connecteur de l'interface */ + sn1->DATA = ptcontact->interf; + else + sn1->DATA = sn1->DATA + ptinterf->base ; + } + + ptcon->SIG = newsig; + for(sn1 = ptcon->PNODE ; sn1 ; sn1 = sn1->NEXT) + if(ptcon->SIG->PRCN->NBNODE <= sn1->DATA) + ptcon->SIG->PRCN->NBNODE = sn1->DATA + 1 ; + } + } + + if( ptinterf->sig->PRCN ) + { + /* Pour chaque noeud de S, on calcule son nouvel index dans + * un tableau newnode */ + newnode = mbkalloc( sizeof(int) * ( ptinterf->sig->PRCN->NBNODE + 1 )); + bzero( newnode, sizeof(int) * ( ptinterf->sig->PRCN->NBNODE + 1 ) ); + + for( ptcontact = contact ; ptcontact ; ptcontact = ptcontact->next ) + { + if(ptinterf->sig == ptcontact->con1->SIG) + { + newnode[ptcontact->node1] = ptcontact->interf; + } + else if(ptinterf->sig == ptcontact->con2->SIG) + { + newnode[ptcontact->node2] = ptcontact->interf; + } + } + + for( node1 = 1 ; node1 <= ptinterf->sig->PRCN->NBNODE ; node1++ ) + if( newnode[node1] == 0 ) + newnode[node1] = node1 + ptinterf->base; + + /* Pour chaque wire W de S */ + for( scanwire = ptinterf->sig->PRCN->PWIRE ; + scanwire ; + scanwire = scanwire->NEXT + ) + { + addlowire( newsig, + scanwire->LAYER, + scanwire->FLAG, + scanwire->RESI, + scanwire->CAPA, + scanwire->X, + scanwire->Y, + scanwire->DX, + scanwire->DY, + newnode[ scanwire->NODE1 ], + newnode[ scanwire->NODE2 ] + ); + } + + /* Pour chaque CTC de S */ + for( scanctc = ptinterf->sig->PRCN->PCTC ; + scanctc ; + scanctc = scanctc->NEXT + ) + { + + ptctc = (loctc_list*)scanctc->DATA; + + if( ptctc->SIG1 == ptinterf->sig ) + { + ptctc->SIG1 = newsig; + if( ptctc->NODE1 ) + ptctc->NODE1 = newnode[ ptctc->NODE1 ]; + } + else + { + for( ctinterf = interf ; ctinterf ; ctinterf = ctinterf->next ) + { + if( ptctc->SIG1 == ctinterf->sig ) + { + ptctc->SIG1 = newsig; + + if( ptctc->NODE1 ) + { + for( ptcontact = contact ; + ptcontact ; + ptcontact = ptcontact->next + ) + { + if( ( ctinterf->sig == ptcontact->con1->SIG && + ptctc->NODE1 == ptcontact->node1 ) || + ( ctinterf->sig == ptcontact->con2->SIG && + ptctc->NODE1 == ptcontact->node2 ) ) + { + ptctc->NODE1 = ptcontact->interf; + break; + } + } + if( !ptcontact ) + ptctc->NODE1 = ptctc->NODE1 + ctinterf->base; + break; + } + } + } + } + + if( ptctc->SIG2 == ptinterf->sig ) + { + ptctc->SIG2 = newsig; + if( ptctc->NODE2 ) + ptctc->NODE2 = newnode[ ptctc->NODE2 ]; + } + else + { + for( ctinterf = interf ; ctinterf ; ctinterf = ctinterf->next ) + { + if( ptctc->SIG2 == ctinterf->sig ) + { + ptctc->SIG2 = newsig; + + if( ptctc->NODE2 ) + { + for( ptcontact = contact ; + ptcontact ; + ptcontact = ptcontact->next + ) + { + if( ( ctinterf->sig == ptcontact->con1->SIG && + ptctc->NODE2 == ptcontact->node1 ) || + ( ctinterf->sig == ptcontact->con2->SIG && + ptctc->NODE2 == ptcontact->node2 ) ) + { + ptctc->NODE2 = ptcontact->interf; + break; + } + } + if( !ptcontact ) + ptctc->NODE2 = ptctc->NODE2 + ctinterf->base; + break; + } + } + } + } + + if(!ptctc) + { + fflush( stdout ); + fprintf( stderr, "*** mbk error ***\n" ); + fprintf( stderr, + "Null CTC on signal %ld (2) in instance %s.\n", + scanlosig->INDEX, + insname + ); + } + newsig->PRCN->PCTC = addchain( newsig->PRCN->PCTC, ptctc ); + + } + + mbkfree( newnode ); + + } + } + + for( ptinterf = interf ; ptinterf ; ptinterf = ptinterf->next ) + { + if(( ptinterf->sig != scanlosig ) && ( ptinterf->sig != newsig )) + { + ptptype = getptype( ptinterf->sig->USER, LOFIGCHAIN ); + freechain( (chain_list*)ptptype->DATA ); + ptptype->DATA = NULL; + if( ptinterf->sig->PRCN && ptinterf->sig->PRCN->PCTC ) + { + freechain( ptinterf->sig->PRCN->PCTC ); + ptinterf->sig->PRCN->PCTC = NULL; + } + dellosig( ptfig, ptinterf->sig->INDEX ); + } + } + + forfree = NULL; + for( ptcontact = contact ; ptcontact ; ptcontact=ptcontact->next ) + { + if( forfree ) + mbkfree( forfree ); + forfree = ptcontact; + } + if( forfree ) + mbkfree( forfree ); + + forfree = NULL; + for( ptinterf = interf ; ptinterf ; ptinterf=ptinterf->next ) + { + if( forfree ) + mbkfree( forfree ); + forfree = ptinterf; + } + if( forfree ) + mbkfree( forfree ); + } + /* vire scanlosig */ + ptptype = getptype( scanlosig->USER, LOFIGCHAIN ); + freechain( (chain_list*)ptptype->DATA ); + ptptype->DATA = NULL; + + if( scanlosig->PRCN && scanlosig->PRCN->PCTC ) + { + freechain( scanlosig->PRCN->PCTC ); + scanlosig->PRCN->PCTC = NULL; + } + + dellosig( figins, scanlosig->INDEX ); + + + } + + delloins( ptfig, ptins->INSNAME ); + + if( concat != NO ) + { + for( scanins = figins->LOINS ; scanins ; scanins = scanins->NEXT ) + { + scanins->INSNAME = concatname( insname, scanins->INSNAME ); + + for( scanlocon = scanins->LOCON ; scanlocon ; scanlocon = scanlocon->NEXT) + { + ptptype = getptype(scanlocon->USER, PNODENAME); + if( ptptype ) + { + for( scanchain = (chain_list*)(ptptype->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + scanchain->DATA = concatname( insname, (char*)(scanchain->DATA) ); + } + } + } + + for( scantrs = figins->LOTRS ; scantrs ; scantrs = scantrs->NEXT ) + { + if( scantrs->TRNAME ) + scantrs->TRNAME = concatname( insname, scantrs->TRNAME ); + + ptptype = getptype( scantrs->DRAIN->USER, PNODENAME); + if( ptptype ) + { + for( scanchain = (chain_list*)(ptptype->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + scanchain->DATA = concatname( insname, (char*)(scanchain->DATA) ); + } + + ptptype = getptype( scantrs->GRID->USER, PNODENAME); + if( ptptype ) + { + for( scanchain = (chain_list*)(ptptype->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + scanchain->DATA = concatname( insname, (char*)(scanchain->DATA) ); + } + + ptptype = getptype( scantrs->SOURCE->USER, PNODENAME); + if( ptptype ) + { + for( scanchain = (chain_list*)(ptptype->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + scanchain->DATA = concatname( insname, (char*)(scanchain->DATA) ); + } + + ptptype = getptype( scantrs->BULK->USER, PNODENAME); + if( ptptype ) + { + for( scanchain = (chain_list*)(ptptype->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + scanchain->DATA = concatname( insname, (char*)(scanchain->DATA) ); + } + } + } + + for( scanins = figins->LOINS ; scanins ; scanins = scanins->NEXT ) + { + for( scanmodel = ptfig->MODELCHAIN ; + scanmodel ; + scanmodel = scanmodel->NEXT ) + if( (char*)scanmodel->DATA == scanins->FIGNAME ) + break; + if( !scanmodel ) + ptfig->MODELCHAIN = addchain( ptfig->MODELCHAIN, scanins->FIGNAME ); + } + + ptfig->LOINS = (loins_list*)append( (chain_list*)figins->LOINS, + (chain_list*)ptfig->LOINS ); + ptfig->LOTRS = (lotrs_list*)append( (chain_list*)figins->LOTRS, + (chain_list*)ptfig->LOTRS ); + + figins->LOINS = NULL; + figins->LOTRS = NULL; + + for( scanlocon = figins->LOCON ; scanlocon ; scanlocon = nextlocon ) + { + nextlocon = scanlocon->NEXT; + delloconuser( scanlocon ); + mbkfree( (void*)scanlocon ); + } + figins->LOCON = NULL; + + for( ptptype = figins->BKSIG ; ptptype ; ptptype = ptptype->NEXT ) + mbkfree( (void*)ptptype->DATA ); + freeptype( figins->BKSIG ); + figins->BKSIG = NULL; + figins->LOSIG = NULL; + + freechain( figins->MODELCHAIN ); + figins->MODELCHAIN = NULL; + + /* Les seules valeurs qui peuvent arriver sont : PTSIGSIZE */ + + dellofiguser( figins ); + + if( figins->MODELCHAIN || + figins->LOCON || + figins->LOSIG || + figins->BKSIG || + figins->LOINS || + figins->LOTRS || + figins->USER ) + { + fflush( stdout ); + fprintf( stderr, + "*** mbk warning *** : figure %s not empty (type=%ld)\n", + figins->NAME, + figins->USER->TYPE + ); + } + mbkfree( (void*)figins ); + + if(all == 'N') + break ; +} + + /* Post traitement sur les CTC dont un des noeuds est a 0 */ + + /* Variable de debuggage */ + verif = 0; + + /* Regroupe les CTC en double */ + for( scanchain = posttreatsig ; scanchain ; scanchain = scanchain->NEXT ) + { + scanlosig = (losig_list*)(scanchain->DATA); + if(getptype(scanlosig->USER,FLATTEN_POSTRAIT) != NULL) + scanlosig->USER = delptype(scanlosig->USER,FLATTEN_POSTRAIT) ; + + if((scanlosig->INDEX == 0) || ( ! scanlosig->PRCN )) + continue; + + htab = addht(scanlosig->PRCN->NBNODE + 100) ; + + for( scanctc = scanlosig->PRCN->PCTC ; scanctc ; scanctc = scanctc->NEXT ) + { + ptctc = (loctc_list*)( scanctc->DATA ); + + if( ptctc->CAPA >= 0.0 ) + { + if( ptctc->SIG1 == scanlosig ) + { + othersig = ptctc->SIG2 ; + othernode = ptctc->NODE2 ; + scanctcnode = ptctc->NODE1 ; + } + else + { + othersig = ptctc->SIG1 ; + othernode = ptctc->NODE1 ; + scanctcnode = ptctc->NODE2 ; + } + if( othersig == scanlosig && othernode == scanctcnode ) + { + ptctc->CAPA = -1.0 ; + verif = verif + 2 ; + } + else + { + key = othersig->INDEX << 11 ; + key = (key | othernode) << 11 ; + key = (key | scanctcnode) ; + + if((chainhtab = (chain_list *)gethtitem(htab,(void *)key)) == (chain_list *)EMPTYHT) + { + chainhtab = addchain(NULL,ptctc) ; + addhtitem(htab,(void *)key,(long)chainhtab) ; + } + else + { + for(chainht = chainhtab ; chainht ; chainht = chainht->NEXT) + { + ptctc2 = (loctc_list*)(chainht->DATA); + + if( ptctc2->CAPA < 0.0 ) + continue; + + if((( ptctc2->SIG1 == scanlosig && ptctc2->SIG2 == othersig) && + (ptctc2->NODE1 == scanctcnode && ptctc2->NODE2 == othernode)) || + ((ptctc2->SIG2 == scanlosig && ptctc2->SIG1 == othersig) && + (ptctc2->NODE2 == scanctcnode && ptctc2->NODE1 == othernode))) + { + ptctc->CAPA+= ptctc2->CAPA; + ptctc2->CAPA = -1.0; + verif = verif + 2 ; + } + } + chainhtab = addchain(chainhtab,ptctc) ; + addhtitem(htab,(void *)key,(long)chainhtab) ; + } + } + } + } + for( nbi = 0 ; nbi < htab->length ; nbi++) + if((((ptitem = htab->pElem + nbi)->value) != (long)EMPTYHT) && + ((htab->pElem + nbi)->value != (long)DELETEHT)) + freechain((chain_list *)ptitem->value) ; + delht(htab) ; + } + + /* On fait le menage en virant les CTC dont la capa vaut -1 */ + + for( scanchain = posttreatsig ; scanchain ; scanchain = scanchain->NEXT ) + { + scanlosig = ( losig_list*)( scanchain->DATA ); + if((scanlosig->INDEX == 0) || ( ! scanlosig->PRCN )) + continue ; + + prevctc = NULL; + for( scanctc = scanlosig->PRCN->PCTC ; scanctc ; scanctc = nextscanctc ) + { + nextscanctc = scanctc->NEXT; + + ptctc = (loctc_list*)( scanctc->DATA ); + + if( ptctc->CAPA < 0.0 ) + { + if( prevctc ) + prevctc->NEXT = nextscanctc ; + else + scanlosig->PRCN->PCTC = nextscanctc ; + + scanctc->NEXT = NULL; + freechain( scanctc ); + + prevctc2 = NULL; + sigctc2 = ( ptctc->SIG1 == scanlosig ? ptctc->SIG2 : ptctc->SIG1 ); + for( scanctc2 = sigctc2->PRCN->PCTC ; + scanctc2 ; + scanctc2 = scanctc2->NEXT + ) + { + if( scanctc2->DATA == ptctc ) + { + /* cas particulier : une CTC sur un meme signal, dont les + chain_list sont consecutifs */ + if( scanctc2 == nextscanctc ) + nextscanctc = nextscanctc->NEXT; + + if( prevctc2 ) + prevctc2->NEXT = scanctc2->NEXT; + else + sigctc2->PRCN->PCTC = scanctc2->NEXT; + + scanctc2->NEXT = NULL; + freechain( scanctc2 ); + break; + } + prevctc2 = scanctc2; + } + + freeloctc( ptctc ); + } + else + prevctc = scanctc; + } + } + + freechain( posttreatsig ); +} + +void debugctc2 ( lofig_list *ptfig ) +{ + losig_list *sig; + chain_list *scanchain; + loctc_list *ptctc; + + printf( "Information sur la figure %s.\n", ptfig->NAME ); + for( sig = ptfig->LOSIG ; sig ; sig = sig->NEXT ) + { + printf( "Signal %2ld (%08X)\n", sig->INDEX, (unsigned int) sig ); + if( sig->PRCN ) + { + for( scanchain = sig->PRCN->PCTC ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptctc = ( loctc_list* )( scanchain->DATA ); + printf( + " CTC (%08X) entre le signal %2ld (%08X) et le signal %2ld (%08X).\n", + (unsigned int)ptctc, + ptctc->SIG1->INDEX, + (unsigned int)ptctc->SIG1, + ptctc->SIG2->INDEX, + (unsigned int)ptctc->SIG2 + ); + } + } + } +} + +void debugctc ( losig_list *headlosig, int niveau ) +{ + losig_list *scanlosig; + chain_list *scanctc; + chain_list *scanctc2; + loctc_list *ptctc; + + /* Boucle de debuggage */ + for( scanlosig = headlosig ; scanlosig ; scanlosig = scanlosig->NEXT ) + { + if( ! scanlosig->PRCN ) + continue; + + for( scanctc = scanlosig->PRCN->PCTC ; scanctc ; scanctc = scanctc->NEXT ) + { + ptctc = (loctc_list*)( scanctc->DATA ); + if( getptype( ptctc->USER, FLATTEN_CTC ) ) + { + printf( "(%d) FLATTEN_CTC trouve dans la CTC (%08X) entre %ld.%ld et %ld.%ld.\n", + niveau, + (unsigned int)ptctc, + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2 + ); + exit(-1); + } + + for( scanctc2 = ( ptctc->SIG1 == scanlosig ? ptctc->SIG2 : ptctc->SIG1 )->PRCN->PCTC ; + scanctc2 ; + scanctc2 = scanctc2->NEXT ) + { + if( scanctc2->DATA == ptctc ) + break; + } + if( !scanctc2 ) + { + printf( "(%d) CTC (%08X) entre %ld:%ld et %ld:%ld sur signal %ld non trouvee sur l'autre signal.\n", + niveau, + (unsigned int)ptctc, + ptctc->SIG1->INDEX, ptctc->NODE1, + ptctc->SIG2->INDEX, ptctc->NODE2, + scanlosig->INDEX + ); + exit(-1); + } + } + } +} + +/******************************************************************************* +* function loadlofig * +*******************************************************************************/ +void loadlofig(lofig_list *ptfig, const char *name, char mode) +{ + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, + "--- mbk --- loadlofig : reading file %s.%s mode %c\n", + name, IN_LO, mode); + if ((!strcmp(IN_LO, "hns")) || (!strcmp(IN_LO, "fne")) + || (!strcmp(IN_LO, "hdn")) || (!strcmp(IN_LO, "fdn"))) + vtiloadlofig(ptfig, name, mode); + else if ((!strcmp(IN_LO, "al")) || (!strcmp(IN_LO, "alx"))) + alcloadlofig(ptfig, name, mode); + else if (!strcmp(IN_LO, "spi") || !strcmp( IN_LO, "sp" ) || + !strcmp(IN_LO, "cir")) + spiceloadlofig(ptfig, name, mode); + else if (!strcmp(IN_LO, "edi")) + edifloadlofig(ptfig, name, mode); + else if (!strcmp(IN_LO, "vst")) + vhdlloadlofig(ptfig, name, mode); + else { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "MBK_IN_LO : '%s' unknown format\n", IN_LO); + EXIT(1); + } + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, + "--- mbk --- loadlofig : done reading file %s.%s\n", + name, IN_LO); +} + +/******************************************************************************* +* function savelofig * +*******************************************************************************/ +void savelofig(lofig_list *ptfig) +{ + if ((!strcmp(OUT_LO, "hns")) || (!strcmp(OUT_LO, "fne")) + || (!strcmp(OUT_LO, "hdn")) || (!strcmp(OUT_LO, "fdn"))) + vtisavelofig(ptfig); + else if ((!strcmp(OUT_LO, "al")) || (!strcmp(OUT_LO, "alx"))) + alcsavelofig(ptfig); + else if (!strcmp(OUT_LO, "spi") || !strcmp( OUT_LO, "sp" ) || + !strcmp(OUT_LO, "cir")) + spicesavelofig(ptfig); + else if (!strcmp(OUT_LO, "edi")) + edifsavelofig(ptfig); + else if (!strcmp(OUT_LO, "vst")) + vhdlsavelofig(ptfig); + else if (!strcmp(OUT_LO, "cct")) + hilosavelofig(ptfig); + else if (!strcmp(OUT_LO, "vlg")) + vlogsavelofig(ptfig); + else { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "MBK_OUT_LO : %s unknown format\n", OUT_LO); + EXIT(1); + } +} + +/******************************************************************************* +* function rflattenlofig() * +* flatten recursif sur une figure logique ptfig. * +* concat permet de generer les cheminons (concat != 'N') * +* la mise a plat s'effectue jusqu'au cellules du catalogue * +* non comprises. * +* catal = `y` ou catal=`Y` indique qu`il faut tenir compte du * +* catalogue. Une autre valeur implique un flatten complet. * +*******************************************************************************/ +void rflattenlofig(lofig_list *ptfig, char concat, char catal) +{ +loins_list *p; +chain_list *c; + + catal = catal == NO ? 0 : 1; + for (p = ptfig->LOINS; p != NULL;) { + if (!catal || !incatalog(p->FIGNAME) || incatalogdelete(p->FIGNAME)) { + flattenlofig(ptfig, p->INSNAME, concat); + p = ptfig->LOINS; + } + else + p = p->NEXT; + } + freechain(ptfig->MODELCHAIN); + ptfig->MODELCHAIN = NULL; + p = ptfig->LOINS; + while (p != NULL) { + c = ptfig->MODELCHAIN; + while (c != NULL) { + if ((char *)c->DATA == p->FIGNAME) + break; + c = c->NEXT; + } + if (c == NULL) + ptfig->MODELCHAIN = addchain(ptfig->MODELCHAIN, (void *)p->FIGNAME); + p = p->NEXT; + } +} + +/* +UNFLATLOFIG + +II. Algorithme +-------------- + +1. On fait un LOFIGCHAIN sur 'ptfig'. + +2. On veut construire deux 'chain_list' : + LI : signaux internes a la nouvelle figure + LX : signaux externes a la nouvelle figure + + Pour la figure 'ptfig', on parcourt la liste des signaux : + Pour chaque signal, on parcourt la liste des connecteurs qui lui + sont associes (par LOFIGCHAIN): + * Si AUCUN connecteur n'appartient a une instance presente dans + la liste 'list', on passe au signal suivant (pas d'insertion) + + * Sinon, si TOUS les connecteurs appartiennent a une instance + presente dans la liste 'list', le signal est insere dans la + liste LI + * Sinon, le signal est insere dans la liste LX + (au moins un connecteur n'appartient pas a la nouvelle figure) + +3. On construit la nouvelle figure. Il faut creer : + - une liste des signaux + - une liste des connecteurs externes + - une liste des instances, chacune contenant une liste de connecteurs + + a. liste des signaux + on parcourt la liste LI et la liste LX : on ajoute chaque signal a + la liste des signaux de la nouvelle figure. + On construit une structure ptype (de nom UNFLATLOFIG), donnant a + chaque signal de LI ou LX un pointeur vers le signal cree dans la + nouvelle figure. + + b. liste des connecteurs externes + on parcourt la liste LX : + pour chaque signal, on cherche le premier connecteur interne (a la + nouvelle figure) et le premier connecteur externe (a la nouvelle + figure), de preference un terminal de la figure pere: s'il en + existe un (terminal) on prend celui-la, sinon on prend le + premier externe a la nouvelle figure, mais non terminal dans + la figure pere. + On ajoute un connecteur externe a la nouvelle figure. Il pointe + sur le signal courant (dans la nouvelle). Sa direction est: + - si le connecteur n'appartenant pas a la nouvelle figure est + un terminal du pere (externe), le nouveau connecteur prend la + direction de ce terminal. + - si le connecteur n'appartenant pas a la nouvelle figure est un + connecteur d'instance, le nouveau connecteur prend la direction + du premier connecteur INTERNE a la nouvelle figure trouve + precedemment. + Le nom du nouveau connecteur est: + - le nom du signal auquel il est connecte si ce dernier en a un. + - sinon : + . si le premier connecteur n'appartenant pas a la nouvelle + figure est un terminal, le nouveau prend ce nom, + . si le premier connecteur n'appartenant pas a la nouvelle + figure est un connecteur d'instance, le nouveau prend le + nom du connecteur INTERNE a la nouvelle figure (comme pour + la direction). + Dans tous les cas, on concatene au nom un compteur (comptant le + nombre de connecteurs externes crees) pour assurer l'unicite. + + c. liste des instances + on parcourt la liste 'list' : + on insere chaque instance dans la liste d'instances de la nouvelle + figure. Pour chaque connecteur d'une instance de 'list', on + ajoute un connecteur dans la liste des connecteurs de l'instance + dans la nouvelle figure, dont le signal dans la nouvelle figure est + obtenu en consultant la structure ptype du signal dans la figure pere. + Les connecteurs prennent les directions des connecteurs dans les + instances de la figure pere. + +4. On modifie la figure pere. + On instancie la nouvelle figure. + On detruit les signaux internes (LI). + On detruit les instances de la liste 'list'. +*/ +/******************************************************************************* +* function unflattenlofig * +*******************************************************************************/ +lofig_list *unflattenlofig(lofig_list *ptfig, const char *figname, const char *insname, chain_list *list) +{ +lofig_list *newlofig = NULL; +chain_list *li_head = NULL, *lx_head = NULL, *ptchain; +losig_list *ptsig; + + if (ptfig == NULL) + return NULL; + lofigchain(ptfig); + /* scan signals: + construct LI and LX. */ + for (ptsig = ptfig->LOSIG; ptsig != NULL; ptsig = ptsig->NEXT) { + chain_list *loconchain; + int found_int = 0, found_ext = 0; + /* scan connectors of signal */ + for (loconchain = + (chain_list * )((getptype (ptsig->USER, (long)LOFIGCHAIN))->DATA); + loconchain != NULL; loconchain = loconchain->NEXT) { + locon_list *ptcon; + chain_list *loinschain; + ptcon = (locon_list * )(loconchain->DATA); + for (loinschain = list; loinschain != NULL; + loinschain = loinschain->NEXT) + if ((void *)(loinschain->DATA) == ptcon->ROOT) + break; + if (loinschain == NULL) + found_ext ++; + else + found_int ++; + } + if (found_int == 0) + continue; /* no insertion */ + if (found_ext == 0) + li_head = addchain(li_head, (void *)(ptsig)); /* insert LI */ + else + lx_head = addchain(lx_head, (void *)(ptsig)); /* insert LX */ + } /* endfor ptsig */ + + /***** add new figure : */ + /* create signals list */ + newlofig = addlofig(figname); + for (ptchain = li_head; ptchain != NULL; ptchain = ptchain->NEXT) { + losig_list * ptlosig; + ptype_list * ptype; + chain_list * namechain = NULL, *ptaux; + + ptlosig = (losig_list *)(ptchain->DATA); + for (ptaux = ptlosig->NAMECHAIN; ptaux != NULL; ptaux = + ptaux->NEXT) + namechain = addchain(namechain, ptaux->DATA); + newlofig->LOSIG = addlosig(newlofig, ptlosig->INDEX, namechain, INTERNAL ); + if( ptlosig->PRCN ) { + addlorcnet( newlofig->LOSIG ); + addcapa( newlofig->LOSIG, ptlosig->PRCN->CAPA ); + } + ptlosig->USER = addptype(ptlosig->USER, (long)UNFLATLOFIG, + (void * )NULL); + ptype = getptype(ptlosig->USER, (long)UNFLATLOFIG); + ptype->DATA = (void *)addchain((chain_list * )ptype->DATA, + (void *)(newlofig->LOSIG)); + } + for (ptchain = lx_head; ptchain != NULL; ptchain = ptchain->NEXT) { + losig_list *ptlosig; + ptype_list *ptype; + chain_list *namechain = NULL, *ptaux; + + ptlosig = (losig_list *)(ptchain->DATA); + for (ptaux = ptlosig->NAMECHAIN; ptaux != NULL; ptaux = + ptaux->NEXT) + namechain = addchain(namechain, ptaux->DATA); + newlofig->LOSIG = addlosig(newlofig, ptlosig->INDEX, namechain, EXTERNAL ); + if( ptlosig->PRCN ) { + addlorcnet( newlofig->LOSIG ); + addcapa( newlofig->LOSIG, ptlosig->PRCN->CAPA ); + } + + ptlosig->USER = addptype(ptlosig->USER, (long)UNFLATLOFIG, + (void * )NULL); + ptype = getptype (ptlosig->USER, (long)UNFLATLOFIG); + ptype->DATA = (void *)addchain((chain_list *)ptype->DATA, + (void *)(newlofig->LOSIG)); + } + + /* create terminals list */ + for (ptchain = lx_head; ptchain != NULL; ptchain = ptchain->NEXT) { + locon_list *intlocon = NULL, *extlocon = NULL; + losig_list *ptlosig, *newlosig; + ptype_list *ptype; + chain_list *loconchain, *auxchain; + static char loconname[BUFSIZE]; + char *name; + char locondir; + int i, foundterm = 0; + + /* scan connectors list of the current signal */ + ptlosig = (losig_list *)(ptchain->DATA); + for (loconchain = + (chain_list *)((getptype (ptlosig->USER, (long)LOFIGCHAIN))->DATA); + loconchain != NULL; loconchain = loconchain->NEXT) { + locon_list *ptlocon; + chain_list *loinschain; + + ptlocon = (locon_list *)(loconchain->DATA); + for (loinschain = list; loinschain != NULL; loinschain = + loinschain->NEXT) + if ((void *)(loinschain->DATA) == ptlocon->ROOT) + break; + if (loinschain == NULL) { /* external connector of new figure */ + if (ptlocon->TYPE == EXTERNAL) /* external con. in root figure too */ { + foundterm++; + extlocon = ptlocon; + } else if (extlocon == NULL) + extlocon = ptlocon; + } else if (intlocon == NULL) + intlocon = ptlocon; /* internal con. in new */ + } /* endfor loconchain */ + + /* create new external connector for the new figure */ + locondir = foundterm ? extlocon->DIRECTION : intlocon->DIRECTION; + name = (ptlosig->NAMECHAIN != NULL) ? getsigname(ptlosig) : + foundterm ? extlocon->NAME : intlocon->NAME; + i = 0; + /* + while ( (name[i] != '\0') && (name[i] != ' ') ) { + loconname [i] = name[i]; + i++; + } + loconname[i] = '\0'; + */ + /* Franck */ + strcpy(loconname, name); + if ((name = strchr(loconname, ' ')) != NULL) + *name = '_'; + + /* the format used to be %s%lu%s but it generates vectors with a + unique base name. + sprintf(loconname, "%s%lu%s", loconname, newtermcount++, &(name[i])); + Since the interface of the resulting figure is not supposed to be + used by humans, let's make simple names. + Hey Hey, this was true a while ago, but as always, now we want + humans to predict the ouput of the function. Fun, ain'it? */ + /* !Franck + sprintf(loconname, "%s_%lu", loconname, newtermcount++); + */ + ptype = getptype(ptlosig->USER, (long)UNFLATLOFIG); + auxchain = (chain_list *)(ptype->DATA); + newlosig = (losig_list *)(auxchain->DATA); + newlofig->LOCON = addlocon(newlofig, loconname, newlosig, locondir); + } /* endfor ptchain */ + + + /* create instances list */ + for (ptchain = list; ptchain != NULL; ptchain = ptchain->NEXT) { + loins_list *ptloins; + locon_list *ptlocon, *ptaux, *con; + chain_list *signal = NULL; + lofig_list *model; + /* Why this model ? + we need a name matching and not an order matching. + we have to read in the file, because we need to have a lofig in order + to be able to call addloins. + The matching is done trivially, using a n^2 loop: since the number of + connectors on an instance is small, an unflattenlofig very seldom + called :-) it's not worth some malloc + qsort, and furthermore, I'm + lazy today! */ + int i = 0, j = 0; + + ptloins = (loins_list *)(ptchain->DATA); + model = getlofig(ptloins->FIGNAME, 'P'); + for (con = model->LOCON; con != NULL; con = con->NEXT) + i++; + for (ptlocon = ptloins->LOCON; ptlocon != NULL; ptlocon = ptlocon->NEXT) + j++; + if (i != j) { + fflush(stdout); + fputs("*** mbk error ***\n", stderr); + fputs("unflattenlofig : connector number inconsistency between model", + stderr); + fprintf(stderr, " '%s' and instance '%s'\n", + model->NAME, ptloins->INSNAME); + EXIT(1); + } + for (con = model->LOCON; con != NULL; con = con->NEXT) { + for (ptlocon = ptloins->LOCON; ptlocon != NULL; + ptlocon = ptlocon->NEXT) { + chain_list *sigchain; + if (ptlocon->NAME == con->NAME) { + sigchain = (chain_list *)((getptype(ptlocon->SIG->USER, + (long)UNFLATLOFIG))->DATA); + signal = addchain(signal, (void *)(sigchain->DATA)); + break; + } + } + } + signal = reverse(signal); + newlofig->LOINS = addloins(newlofig, ptloins->INSNAME, model, signal); + for (ptlocon = newlofig->LOINS->LOCON, ptaux = ptloins->LOCON; + (ptlocon != NULL) && (ptaux != NULL); ptlocon = ptlocon->NEXT, + ptaux = ptaux->NEXT) + ptlocon->DIRECTION = ptaux->DIRECTION; + } + + /***** free ptype lists (lofigchain and unflatlofig) */ + /* free lofigchain */ + for (ptsig = ptfig->LOSIG; ptsig != NULL; ptsig = ptsig->NEXT) { + ptype_list *ptype; + + ptype = getptype(ptsig->USER, (long)LOFIGCHAIN); + freechain ((chain_list *)ptype->DATA); + ptype->DATA = (void *)NULL; + ptsig->USER = delptype(ptsig->USER, (long)LOFIGCHAIN); + } + + /* free unflatlofig in lx signals */ + for (ptchain = lx_head; ptchain != NULL; ptchain = ptchain->NEXT) { + ptype_list *ptype; + losig_list *ptlosig; + + ptlosig = (losig_list *)(ptchain->DATA); + ptype = getptype(ptlosig->USER, (long)UNFLATLOFIG); + freechain ((chain_list *)ptype->DATA); + ptype->DATA = (void *)NULL; + ptlosig->USER = delptype(ptlosig->USER, (long)UNFLATLOFIG); + } + + /* free unflatlofig in li signals */ + for (ptchain = li_head; ptchain != NULL; ptchain = ptchain->NEXT) { + ptype_list *ptype; + losig_list *ptlosig; + + ptlosig = (losig_list *)(ptchain->DATA); + ptype = getptype (ptlosig->USER, (long)UNFLATLOFIG); + freechain ((chain_list *)ptype->DATA); + ptype->DATA = (void *)NULL; + ptlosig->USER = delptype(ptlosig->USER, (long)UNFLATLOFIG); + } + + /***** modify the root figure :*/ + /* add new instancied figure */ + lx_head = reverse (lx_head); + ptfig->LOINS = addloins(ptfig, insname, getlofig(figname, 'P'), lx_head); + + /* delete signals */ + for (ptchain = li_head; ptchain != NULL; ptchain = ptchain->NEXT) + dellosig(ptfig, ((losig_list *)(ptchain->DATA))->INDEX); + + /* delete instances */ + for (ptchain = list; ptchain != NULL; ptchain = ptchain->NEXT) + delloins(ptfig, ((loins_list *)(ptchain->DATA))->INSNAME); + return newlofig; +} + +#define OK 1 +#define PROBLEM 0 +#define NOVBE -1 + +int restoredirvbe(lofig_list *lof) +{ +FILE *f = NULL; +char line[BUFSIZ]; +int p, q, r, from, to, inc, nbcon; +int run = 0; /* shall we interpret what we read? */ +char string[128], hook[128]; +locon_list * fc, *fct; +char dir; + + if (!lof) { + fprintf(stderr, "*** mbk error *** restoredirvbe : no figure given\n"); + return PROBLEM; + } + if ((f = mbkfopen(lof->NAME, "vbe", "r")) == NULL) + if ((f = mbkfopen(lof->NAME, "vst", "r")) == NULL) + return NOVBE; + lof->LOCON = (locon_list * )reverse((chain_list * )lof->LOCON); + nbcon = 0; + while (1) { + if (fgets(line, BUFSIZ, f) == NULL) + break; + for (p = 0; p < BUFSIZ && line[p] && line[p] != '\n'; p++) + if (isupper((int)line[p])) + line[p] = tolower(line[p]); + p = 0; + while (isspace((int)line[p])) + p++; + switch (line[p]) { + case 'e': /* either entity or end for us */ + if (!strncmp("entity", &line[p], 6)) /* we shall treat now */ + run = 1; + if (!strncmp("end", &line[p], 3)) /* we shall exit gracefully */ { + fclose(f); + for (p = 0, fct = lof->LOCON; fct; fct = fct->NEXT) + p++; + if (p != nbcon) { + fprintf(stderr, "*** mbk error *** restoredirvbe : figure %s have more connectors than vbe\n", + lof->NAME); + return PROBLEM; + } + return OK; + } + continue; /* next line guys */ + case 'p': /* port or nothing! */ + if (!run) + continue; + if (!strncmp("port", &line[p], 4)) { + p += 4; + while (isspace((int)line[p])) { + if (line[p] == '\n') { + fgets(line, BUFSIZ, f); + p = 0; + } else + p++; + } + if (line[p] != '(') { + fprintf(stderr, "*** mbk error *** restoredirvbe : cannot read port well!\n"); + fclose(f); + return PROBLEM; + } + + while (1) { + fgets(line, BUFSIZ, f); + for (p = 0; p < BUFSIZ && line[p]; p++) + if (isupper((int)line[p])) + line[p] = tolower(line[p]); + p = 0; + while (isspace((int)line[p])) + p++; + if (line[p] == ')') + break; + q = p; + while (!isspace((int)line[p]) && line[p] != ':') + p++; + strncpy(hook, &line[q], p - q); + hook[p - q] = '\0'; + + while (isspace((int)line[p]) || line[p] == ':') + p++; + q = p; + while (!isspace((int)line[p])) + p++; + strncpy(string, &line[q], p - q); + string[p - q] = '\0'; + while (isspace((int)line[p])) + p++; + if (line[p] == 'b' || line[p] == 'r') /* finished, dir ok */ { + if (!strcmp("in", string)) + dir = IN; + else if (!strcmp("out", string)) + dir = OUT; + else + dir = UNKNOWN; + } else { + if (!strcmp("inout", string)) + dir = TRANSCV; + else if (!strcmp("out", string)) + dir = TRISTATE; + else + dir = UNKNOWN; + } + while (line[p] != '(' && line[p] != '\0') + p++; + if (line[p] == '\0') { + fc = getlocon(lof, hook); + fc->DIRECTION = dir; + if (lof->LOCON != fc) { + for (fct = lof->LOCON; fct->NEXT != fc; fct = fct->NEXT) + ; + fct->NEXT = fc->NEXT; + fc->NEXT = lof->LOCON; + lof->LOCON = fc; + } + nbcon++; + } else { /* bit vector indeed */ + p++; /* skip ( */ + from = atoi(&line[p]); + while (isdigit((int)line[p])) + p++; + while (isspace((int)line[p])) + p++; + if (line[p] == 'd') + inc = -1; + else if (line[p] == 't') + inc = 1; + else + { + fprintf(stderr, "*** mbk error *** restoredirvbe : bit_vect neither to nor downto\n"); + fclose(f); + return PROBLEM; + } + while (!isspace((int)line[p])) + p++; + to = atoi(&line[p]); + + for (r = from; r <= to; r += inc) { + sprintf(string, "%s %d", hook, r); + fc = getlocon(lof, string); + fc->DIRECTION = dir; + if (lof->LOCON != fc) { + for (fct = lof->LOCON; fct->NEXT != fc; fct = fct->NEXT) +/* code folded from here */ + ; +/* unfolding */ + fct->NEXT = fc->NEXT; + fc->NEXT = lof->LOCON; + lof->LOCON = fc; + } + nbcon++; + } + } + continue; + } + } + continue; + default : + continue; + } + } + fclose(f); + for (p = 0, fct = lof->LOCON; fct; fct = fct->NEXT) + p++; + if (p != nbcon) { + fprintf(stderr, "*** mbk error *** restoredirvbe : figure %s have more connectors than vbe\n", lof->NAME); + return PROBLEM; + } + return OK; +} + +int guessextdir(lofig_list *lof) +{ +int ret = OK; +char dir; +locon_list *ec; +chain_list *pch; +ptype_list *getptype(); + + lofigchain(lof); + for (ec = lof->LOCON; ec; ec = ec->NEXT) { + dir = UNKNOWN; + for (pch = (chain_list * )(getptype(ec->SIG->USER, (long)LOFIGCHAIN)->DATA); pch; pch = pch->NEXT) { + if (((locon_list * )(pch->DATA))->TYPE != INTERNAL) + continue; + switch (((locon_list * )(pch->DATA))->DIRECTION) { + case IN : + switch (dir) { + case IN : + dir = IN; + break; + case OUT : + dir = INOUT; + break; + case INOUT : + dir = INOUT; + break; + case UNKNOWN : + dir = IN; + break; + case TRISTATE : + dir = TRANSCV; + break; + case TRANSCV : + dir = TRANSCV; + break; + } + break; + case OUT : + switch (dir) { + case IN : + dir = INOUT; + break; + case OUT : + dir = OUT; + fprintf(stderr, "Warning : signal %s have two OUT", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + case INOUT : + dir = INOUT; + fprintf(stderr, "Warning : signal %s have an OUT and an INOUT", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + case UNKNOWN : + dir = OUT; + break; + case TRISTATE : + dir = OUT; + fprintf(stderr, "Warning : signal %s have an OUT and a TRISTATE", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + case TRANSCV : + dir = TRANSCV; + fprintf(stderr, "Warning : signal %s have an OUT and a TRANSCV", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + } + break; + case INOUT : + switch (dir) { + case IN : + dir = INOUT; + break; + case OUT : + dir = INOUT; + fprintf(stderr, "Warning : signal %s have an INOUT and an OUT", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + case INOUT : + dir = INOUT; + fprintf(stderr, "Warning : signal %s have two INOUT", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + case UNKNOWN : + dir = INOUT; + break; + case TRISTATE : + dir = INOUT; + fprintf(stderr, "Warning : signal %s have an INOUT and a TRISTATE", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + case TRANSCV : + dir = INOUT; + fprintf(stderr, "Warning : signal %s have an INOUT and a TRANSCV", + getsigname(ec->SIG)); + ret = PROBLEM; + break; + } + break; + case UNKNOWN : + switch (dir) { + case IN : + dir = IN; + break; + case OUT : + dir = OUT; + break; + case INOUT : + dir = INOUT; + break; + case UNKNOWN : + dir = UNKNOWN; + break; + case TRISTATE : + dir = TRISTATE; + break; + case TRANSCV : + dir = TRANSCV; + break; + } + break; + case TRISTATE : + switch (dir) { + case IN : + dir = TRANSCV; + break; + case OUT : + dir = OUT; + fprintf(stderr, "Warning : signal %s have a TRISTATE and an OUT", getsigname(ec->SIG)); + ret = PROBLEM; + break; + case INOUT : + dir = INOUT; + fprintf(stderr, "Warning : signal %s have a TRISTATE and an INOUT", getsigname(ec->SIG)); + ret = PROBLEM; + break; + case UNKNOWN : + dir = TRISTATE; + break; + case TRISTATE : + dir = TRISTATE; + break; + case TRANSCV : + dir = TRANSCV; + break; + } + break; + case TRANSCV : + switch (dir) { + case IN : + dir = TRANSCV; + break; + case OUT : + dir = TRANSCV; + fprintf(stderr, "Warning : signal %s have a TRANSCV and an OUT", getsigname(ec->SIG)); + ret = PROBLEM; + break; + case INOUT : + dir = INOUT; + fprintf(stderr, "Warning : signal %s have a TRANSCV and an INOUT", getsigname(ec->SIG)); + ret = PROBLEM; + break; + case UNKNOWN : + dir = TRANSCV; + break; + case TRISTATE : + dir = TRANSCV; + break; + case TRANSCV : + dir = TRANSCV; + break; + } + break; + } + } + if (dir != UNKNOWN) + ec->DIRECTION = dir; + } + return ret; +} + +int restorealldir(lofig_list *lf) +{ +int ret = OK, res; +lofig_list *lof; +loins_list *li; +locon_list *ic, *fc; + + for (li = lf->LOINS; li; li = li->NEXT) { + /* get model of the instance and restore connector direction in it */ + for (lof = HEAD_LOFIG; lof; lof = lof->NEXT) + if (lof->NAME == li->FIGNAME) + break; + if (!lof) { + lof = getlofig(li->FIGNAME, 'P'); + res = restoredirvbe(lof); + if (res == PROBLEM) + ret = PROBLEM; + else if (res == NOVBE) { + lof = getlofig(lof->NAME, 'A'); + res = restorealldir(lof); + if (res == PROBLEM) + ret = PROBLEM; + res = guessextdir(lof); + if (res == PROBLEM) + ret = PROBLEM; + } + } else if (lof->LOCON->DIRECTION == UNKNOWN) { + res = restoredirvbe(lof); + if (res == PROBLEM) + ret = PROBLEM; + else if (res == NOVBE) { + if (lof->MODE != 'A') + lof = getlofig(lof->NAME, 'A'); + res = restorealldir(lof); + if (res == PROBLEM) + ret = PROBLEM; + res = guessextdir(lof); + if (res == PROBLEM) + ret = PROBLEM; + } + } + + /* restore connector direction in the instance */ + for (ic = li->LOCON; ic; ic = ic->NEXT) { + fc = getlocon(lof, ic->NAME); + ic->DIRECTION = fc->DIRECTION; + } + } + return ret; +} + +struct typoin /* structure used by dast_dbg */ + { /* to store its state */ + short type; /* code of the current structure*/ + short mark; /* stop mark */ + void *data; /* pointer of the structure */ + }; + +#define VHD_ERRDFN -1 +#define VHD__XTDFN 0 +#define VHD__UPDFN 1 +#define VHD__TPDFN 2 +#define VHD__SPDFN 3 +#define VHD__BKDFN 4 + +#define VHD_lofigDFN 5 +#define VHD_nextDFN 6 +#define VHD_modelchainDFN 7 +#define VHD_loconDFN 8 +#define VHD_losigDFN 9 +#define VHD_bksigDFN 10 +#define VHD_loinsDFN 11 +#define VHD_lotrsDFN 13 +#define VHD_nameDFN 14 +#define VHD_modeDFN 15 +#define VHD_userDFN 16 +#define VHD_drainDFN 17 +#define VHD_gridDFN 18 +#define VHD_sourceDFN 19 +#define VHD_bulkDFN 36 +#define VHD_widthDFN 20 +#define VHD_lengthDFN 21 +#define VHD_xDFN 22 +#define VHD_yDFN 23 +#define VHD_typeDFN 24 +#define VHD_insnameDFN 25 +#define VHD_fignameDFN 26 +#define VHD_sigDFN 27 +#define VHD_rootDFN 28 +#define VHD_directionDFN 29 +#define VHD_valDFN 30 +#define VHD_namechainDFN 31 +#define VHD_capaDFN 32 +#define VHD_indexDFN 33 +#define VHD_ptypeDFN 34 +#define VHD_dataDFN 35 + +#define VHD_MAXDFN 37 +static int vhd_getcmd(); +static int vhd_hash(); + +void mlodebug (head_pnt,stru_name) + +void *head_pnt; +char *stru_name; + + { + + int i; + int state; + int newsta0; + int readcmd = 0; + char readtab[3][20]; + int stk_pnt = 0; + int type = VHD__XTDFN; + struct chain *ptchain; + + struct typoin current_pnt; + struct typoin stk[200]; + + char empty[4]; + char avail[12]; + + int key[VHD_MAXDFN]; + char *tab[VHD_MAXDFN]; + void *nxt[VHD_MAXDFN]; + short typ[VHD_MAXDFN]; + + struct lofig *lofig_pnt; + struct locon *locon_pnt; + struct losig *losig_pnt; + struct ptype *ptype_pnt; + struct loins *loins_pnt; + struct lotrs *lotrs_pnt; + +key[VHD_lofigDFN] = vhd_hash ("lofig"); +key[VHD_nextDFN] = vhd_hash ("next"); +key[VHD_modelchainDFN] = vhd_hash ("modelchain"); +key[VHD_loconDFN] = vhd_hash ("locon"); +key[VHD_losigDFN] = vhd_hash ("losig"); +key[VHD_bksigDFN] = vhd_hash ("bksig"); +key[VHD_loinsDFN] = vhd_hash ("loins"); +key[VHD_lotrsDFN] = vhd_hash ("lotrs"); +key[VHD_nameDFN] = vhd_hash ("name"); +key[VHD_modeDFN] = vhd_hash ("mode"); +key[VHD_userDFN] = vhd_hash ("user"); +key[VHD_drainDFN] = vhd_hash ("drain"); +key[VHD_gridDFN] = vhd_hash ("grid"); +key[VHD_sourceDFN] = vhd_hash ("source"); +key[VHD_bulkDFN] = vhd_hash ("bulk"); +key[VHD_widthDFN] = vhd_hash ("width"); +key[VHD_lengthDFN] = vhd_hash ("length"); +key[VHD_xDFN] = vhd_hash ("x"); +key[VHD_yDFN] = vhd_hash ("y"); +key[VHD_typeDFN] = vhd_hash ("type"); +key[VHD_insnameDFN] = vhd_hash ("insname"); +key[VHD_fignameDFN] = vhd_hash ("figname"); +key[VHD_sigDFN] = vhd_hash ("sig"); +key[VHD_rootDFN] = vhd_hash ("root"); +key[VHD_directionDFN] = vhd_hash ("direction"); +key[VHD_valDFN] = vhd_hash ("val"); +key[VHD_namechainDFN] = vhd_hash ("namechain"); +key[VHD_capaDFN] = vhd_hash ("capa"); +key[VHD_indexDFN] = vhd_hash ("index"); +key[VHD_ptypeDFN] = vhd_hash ("ptype"); + + /* ###------------------------------------------------------### */ + /* Set of predefined commands */ + /* ###------------------------------------------------------### */ + + key[0] = vhd_hash ("_exit"); + key[1] = vhd_hash ("_up"); + key[2] = vhd_hash ("_top"); + key[3] = vhd_hash ("_stop"); + key[4] = vhd_hash ("_back"); + + (void)strcpy (empty,""); + (void)strcpy (avail,"AVAILABLE"); + + for (i=0 ; iNEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)lofig_pnt->NEXT; + typ[VHD_nextDFN] = VHD_lofigDFN; + } + if (lofig_pnt->LOCON != NULL) + { + tab[VHD_loconDFN] = avail; + nxt[VHD_loconDFN] = (void *)lofig_pnt->LOCON; + typ[VHD_loconDFN] = VHD_loconDFN; + } + if (lofig_pnt->LOSIG != NULL) + { + tab[VHD_losigDFN] = avail; + nxt[VHD_losigDFN] = (void *)lofig_pnt->LOSIG; + typ[VHD_losigDFN] = VHD_losigDFN; + } + if (lofig_pnt->BKSIG != NULL) + { + tab[VHD_bksigDFN] = avail; + nxt[VHD_bksigDFN] = (void *)lofig_pnt->BKSIG; + typ[VHD_bksigDFN] = VHD_ptypeDFN; + } + if (lofig_pnt->LOINS != NULL) + { + tab[VHD_loinsDFN] = avail; + nxt[VHD_loinsDFN] = (void *)lofig_pnt->LOINS; + typ[VHD_loinsDFN] = VHD_loinsDFN; + } + if (lofig_pnt->LOTRS != NULL) + { + tab[VHD_lotrsDFN] = avail; + nxt[VHD_lotrsDFN] = (void *)lofig_pnt->LOTRS; + typ[VHD_lotrsDFN] = VHD_lotrsDFN; + } + if (lofig_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)lofig_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + ptchain = lofig_pnt->MODELCHAIN; + (void)printf (" modelchain :\n"); + while (ptchain != NULL) + { + (void)printf (" %s\n",(char *)ptchain->DATA); + ptchain = ptchain->NEXT; + } + + (void)printf (" name : %s\n",lofig_pnt->NAME); + (void)printf (" mode : %c\n",lofig_pnt->MODE); + (void)printf ("-> locon : %s\n",tab[VHD_loconDFN]); + (void)printf ("-> losig : %s\n",tab[VHD_losigDFN]); + (void)printf ("-> bksig : %s\n",tab[VHD_bksigDFN]); + (void)printf ("-> loins : %s\n",tab[VHD_loinsDFN]); + (void)printf ("-> lotrs : %s\n",tab[VHD_lotrsDFN]); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_lotrsDFN): + + /* ###--------- lotrs ---------### */ + + lotrs_pnt = (struct lotrs *)(current_pnt.data); + + if (lotrs_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)lotrs_pnt->NEXT; + typ[VHD_nextDFN] = VHD_lotrsDFN; + } + if (lotrs_pnt->DRAIN != NULL) + { + tab[VHD_drainDFN] = avail; + nxt[VHD_drainDFN] = (void *)lotrs_pnt->DRAIN; + typ[VHD_drainDFN] = VHD_loconDFN; + } + if (lotrs_pnt->GRID != NULL) + { + tab[VHD_gridDFN] = avail; + nxt[VHD_gridDFN] = (void *)lotrs_pnt->GRID; + typ[VHD_gridDFN] = VHD_loconDFN; + } + if (lotrs_pnt->SOURCE != NULL) + { + tab[VHD_sourceDFN] = avail; + nxt[VHD_sourceDFN] = (void *)lotrs_pnt->SOURCE; + typ[VHD_sourceDFN] = VHD_loconDFN; + } + if (lotrs_pnt->BULK != NULL) + { + tab[VHD_sourceDFN] = avail; + nxt[VHD_sourceDFN] = (void *)lotrs_pnt->BULK; + typ[VHD_sourceDFN] = VHD_loconDFN; + } + if (lotrs_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)lotrs_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf ("-> drain : %s\n",tab[VHD_drainDFN]); + (void)printf ("-> grid : %s\n",tab[VHD_gridDFN]); + (void)printf ("-> source : %s\n",tab[VHD_sourceDFN]); + (void)printf ("-> bulk : %s\n",tab[VHD_bulkDFN]); + (void)printf (" length : %ld\n",lotrs_pnt->LENGTH); + (void)printf (" width : %ld\n",lotrs_pnt->WIDTH); + (void)printf (" y : %ld\n",lotrs_pnt->Y); + (void)printf (" x : %ld\n",lotrs_pnt->X); + (void)printf (" type : %c\n",lotrs_pnt->TYPE); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_loinsDFN): + + /* ###--------- loins ---------### */ + + loins_pnt = (struct loins *)(current_pnt.data); + + if (loins_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)loins_pnt->NEXT; + typ[VHD_nextDFN] = VHD_loinsDFN; + } + if (loins_pnt->LOCON != NULL) + { + tab[VHD_loconDFN] = avail; + nxt[VHD_loconDFN] = (void *)loins_pnt->LOCON; + typ[VHD_loconDFN] = VHD_loconDFN; + } + if (loins_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)loins_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" insname : %s\n",loins_pnt->INSNAME); + (void)printf (" figname : %s\n",loins_pnt->FIGNAME); + (void)printf ("-> locon : %s\n",tab[VHD_loconDFN]); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_loconDFN): + + /* ###--------- locon ---------### */ + + locon_pnt = (struct locon *)(current_pnt.data); + + if (locon_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)locon_pnt->NEXT; + typ[VHD_nextDFN] = VHD_loconDFN; + } + if (locon_pnt->SIG != NULL) + { + tab[VHD_sigDFN] = avail; + nxt[VHD_sigDFN] = (void *)locon_pnt->SIG; + typ[VHD_sigDFN] = VHD_losigDFN; + } + if (locon_pnt->ROOT != NULL) + { + tab[VHD_rootDFN] = avail; + nxt[VHD_rootDFN] = (void *)locon_pnt->ROOT; + if (locon_pnt->TYPE == 'I') + typ[VHD_rootDFN] = VHD_loinsDFN; + else + typ[VHD_rootDFN] = VHD_lofigDFN; + } + if (locon_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)locon_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" name : %s\n",locon_pnt->NAME); + (void)printf ("-> sig : %s\n",tab[VHD_sigDFN]); + (void)printf ("-> root : %s\n",tab[VHD_rootDFN]); + (void)printf (" direction : %c\n",locon_pnt->DIRECTION); + (void)printf (" type : %c\n",locon_pnt->TYPE); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_losigDFN): + + /* ###--------- losig ---------### */ + + losig_pnt = (struct losig *)(current_pnt.data); + + if (losig_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)losig_pnt->NEXT; + typ[VHD_nextDFN] = VHD_losigDFN; + } + if (losig_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)losig_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + ptchain = losig_pnt->NAMECHAIN; + (void)printf (" namechain :\n"); + while (ptchain != NULL) + { + (void)printf (" %s\n",(char *)ptchain->DATA); + ptchain = ptchain->NEXT; + } + + (void)printf (" capa : %f\n",(losig_pnt->PRCN->CAPA?losig_pnt->PRCN->CAPA:0.0) ); + (void)printf (" index : %ld\n",losig_pnt->INDEX); + (void)printf (" type : %c\n",losig_pnt->TYPE); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_ptypeDFN): + + /* ###--------- ptype ---------### */ + + ptype_pnt = (struct ptype *)(current_pnt.data); + + if (ptype_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)ptype_pnt->NEXT; + typ[VHD_nextDFN] = VHD_ptypeDFN; + } + if (ptype_pnt->DATA != NULL) + { + tab[VHD_dataDFN] = avail; + nxt[VHD_dataDFN] = (void *)ptype_pnt->DATA; + typ[VHD_dataDFN] = VHD_ERRDFN; +/*......typ[VHD_dataDFN] = .......................*/ + } + + (void)printf (" type : %ld\n",ptype_pnt->TYPE); + (void)printf ("-> data : %s\n",tab[VHD_dataDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + + } + + /* ###------------------------------------------------------### */ + /* Reading new command */ + /* ###------------------------------------------------------### */ + + readcmd = vhd_getcmd (readtab); + + for (i=0 ; i> "); + comd0[0] = '\0'; + comd1[0] = '\0'; + comd2[0] = '\0'; + (void)fgets( readstr, 60, stdin ); + (void)sscanf (readstr,"%s%s%s",comd0,comd1,comd2); + + if (strcmp(comd0,".")) + { + (void)strcpy (prvcmd[0], comd0); + (void)strcpy (prvcmd[1], comd1); + (void)strcpy (prvcmd[2], comd2); + } + code = vhd_hash (prvcmd[0]); + + (void)printf ("\n\n\n\n\n"); + return (code); + } + + + +static int vhd_hash (str) + +char *str; + + { + int code = 0; + + while(*str != '\0') + code = code<<1 ^ *str++; + + return (code); + } + +/*##------------------------------------------------------------------##*/ +/* Author : VUONG H.N. */ +/* Date : Dec 11 1991 */ +/* Cont. : Essentially functions to duplicate lofig structures */ +/* such a complete LOFIG or just a chain_list. */ +/*##------------------------------------------------------------------##*/ + +/*##------------------------------------------------------------------##*/ +/* Function : dupchainlst() */ +/* contents : duplicate a chain list and return a pointer on the new */ +/* structure. */ +/* called func. : reverse(), mbkalloc(), */ +/*##------------------------------------------------------------------##*/ + +chain_list *dupchainlst(chain_ptr) +chain_list *chain_ptr; + { + chain_list *chain_rpt = NULL; /* Returned chain pointer */ + + while(chain_ptr != NULL) + { + chain_rpt = addchain(chain_rpt, chain_ptr->DATA); + chain_ptr = chain_ptr->NEXT; + } + chain_rpt = reverse(chain_rpt); + return(chain_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duploconlst() */ +/* contents : duplicate a locon list and return a pointer on the new */ +/* structure. */ +/* called func. : duplocon(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +locon_list *duploconlst(locon_ptr) +locon_list *locon_ptr; + { + locon_list *locon_rpt = NULL; /* Returned locon pointer */ + locon_list *locon_tmpptr = NULL; /* Temporary pointer */ + + while(locon_ptr != NULL) + { + locon_tmpptr = duplocon(locon_ptr); + locon_tmpptr->NEXT = locon_rpt; + locon_rpt = locon_tmpptr; + + locon_ptr = locon_ptr->NEXT; + } + locon_rpt = (locon_list *)reverse((chain_list *)locon_rpt); + return(locon_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplocon() */ +/* contents : duplicate a locon and return a pointer on the new */ +/* structure. */ +/* called func. : mbkalloc(), */ +/* note : the ROOT and the SIG pointer are also duplicated */ +/*##------------------------------------------------------------------##*/ + +locon_list *duplocon(locon_ptr) +locon_list *locon_ptr; + { + locon_list *locon_rpt = NULL; /* Returned locon pointer */ + num_list *sn; + ptype_list *ptnodename; + + locon_rpt = (locon_list *)(mbkalloc(sizeof(locon_list))); + locon_rpt->NEXT = NULL; + locon_rpt->NAME = locon_ptr->NAME; + locon_rpt->SIG = locon_ptr->SIG; + locon_rpt->ROOT = locon_ptr->ROOT; + locon_rpt->DIRECTION = locon_ptr->DIRECTION; + locon_rpt->TYPE = locon_ptr->TYPE; + + locon_rpt->PNODE = NULL; + for( sn = locon_ptr->PNODE ; sn ; sn = sn->NEXT ) + locon_rpt->PNODE = addnum( locon_rpt->PNODE, sn->DATA ); + locon_rpt->PNODE = (num_list*)reverse( (chain_list*)locon_rpt->PNODE ); + + locon_rpt->USER = NULL; /* The ptype_list is not duplicated */ + + if( ( ptnodename = getptype( locon_ptr->USER, PNODENAME ) ) ) + locon_rpt->USER = addptype( locon_rpt->USER, + PNODENAME, + dupchainlst( ptnodename->DATA ) + ); + + return(locon_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duploinslst() */ +/* contents : duplicate a loins list and return a pointer on the new */ +/* structure. */ +/* called func. : duploins(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +loins_list *duploinslst(loins_ptr) +loins_list *loins_ptr; + { + loins_list *loins_rpt = NULL; /* Returned loins pointer */ + loins_list *loins_tmpptr = NULL; /* Temporary pointer */ + + while(loins_ptr != NULL) + { + loins_tmpptr = duploins(loins_ptr); + loins_tmpptr->NEXT = loins_rpt; + loins_rpt = loins_tmpptr; + + loins_ptr = loins_ptr->NEXT; + } + loins_rpt = (loins_list *)reverse((chain_list *)loins_rpt); + return(loins_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duploins() */ +/* contents : duplicate a loins and return a pointer on the new */ +/* structure. */ +/* called func. : mbkalloc(), */ +/* note : the LOCON pointer is also duplicated */ +/*##------------------------------------------------------------------##*/ + +loins_list *duploins(loins_ptr) +loins_list *loins_ptr; + { + loins_list *loins_rpt = NULL; /* Returned loins pointer */ + + loins_rpt = (loins_list *)(mbkalloc(sizeof(loins_list))); + loins_rpt->NEXT = NULL; + loins_rpt->LOCON = loins_ptr->LOCON; + loins_rpt->INSNAME = loins_ptr->INSNAME; + loins_rpt->FIGNAME = loins_ptr->FIGNAME; + loins_rpt->USER = NULL; /* The ptype_list is not duplicated */ + + return(loins_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplotrslst() */ +/* contents : duplicate a lotrs list and return a pointer on the new */ +/* structure. */ +/* called func. : duplotrs(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +lotrs_list *duplotrslst(lotrs_ptr) +lotrs_list *lotrs_ptr; + { + lotrs_list *lotrs_rpt = NULL; /* Returned lotrs pointer */ + lotrs_list *lotrs_tmpptr = NULL; /* Temporary pointer */ + + while(lotrs_ptr != NULL) + { + lotrs_tmpptr = duplotrs(lotrs_ptr); + lotrs_tmpptr->NEXT = lotrs_rpt; + lotrs_rpt = lotrs_tmpptr; + + lotrs_ptr = lotrs_ptr->NEXT; + } + lotrs_rpt = (lotrs_list *)reverse((chain_list *)lotrs_rpt); + return(lotrs_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplotrs() */ +/* contents : duplicate a lotrs and return a pointer on the new */ +/* structure. */ +/* called func. : mbkalloc(), duplocon() */ +/* note : the DRAIN, SOURCE, GRID, BULK pointers are also duplicated */ +/*##------------------------------------------------------------------##*/ + +lotrs_list *duplotrs(lotrs_ptr) +lotrs_list *lotrs_ptr; + { + lotrs_list *lotrs_rpt = NULL; /* Returned lotrs pointer */ + + lotrs_rpt = (lotrs_list *)mbkalloc(sizeof(lotrs_list)); + lotrs_rpt->NEXT = NULL; + lotrs_rpt->TRNAME = lotrs_ptr->TRNAME; + lotrs_rpt->DRAIN = lotrs_ptr->DRAIN; + lotrs_rpt->GRID = lotrs_ptr->GRID; + lotrs_rpt->SOURCE = lotrs_ptr->SOURCE; + lotrs_rpt->BULK = lotrs_ptr->BULK; + lotrs_rpt->WIDTH = lotrs_ptr->WIDTH; + lotrs_rpt->LENGTH = lotrs_ptr->LENGTH; + lotrs_rpt->PS = lotrs_ptr->PS; + lotrs_rpt->PD = lotrs_ptr->PD; + lotrs_rpt->XS = lotrs_ptr->XS; + lotrs_rpt->XD = lotrs_ptr->XD; + lotrs_rpt->X = lotrs_ptr->X; + lotrs_rpt->Y = lotrs_ptr->Y; + lotrs_rpt->TYPE = lotrs_ptr->TYPE; + lotrs_rpt->USER = NULL; /* The ptype_list is not duplicated */ + + return(lotrs_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplosiglst() */ +/* contents : duplicate a losig_list and return a pointer on the new */ +/* structure, a pointer on BKSIG must be given. */ +/* called func. :duplosig(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +losig_list *duplosiglst(losig_ptr,BKSIG_ptr,sigsize) +losig_list *losig_ptr; +ptype_list **BKSIG_ptr; +int sigsize; + { + losig_list *losig_rpt = NULL; /* Returned losig pointer */ + losig_list *losig_tmpptr = NULL; /* Temporary pointer */ + ptype_list *BKSIG_rpt = NULL; /* Returned BKSIG pointer */ + + while(losig_ptr != NULL) + { + losig_tmpptr = duplosig(losig_ptr, &BKSIG_rpt, sigsize); + losig_tmpptr->NEXT = losig_rpt; + losig_rpt = losig_tmpptr; + + losig_ptr = losig_ptr->NEXT; + } + losig_rpt = (losig_list *)reverse((chain_list *)losig_rpt); + *BKSIG_ptr = BKSIG_rpt; + return(losig_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplosig() */ +/* contents : duplicate a losig and return a pointer on the new */ +/* structure, a pointer on the BKSIG must be given. */ +/* called func. : mbkalloc, addptype, dupchainlst */ +/*##------------------------------------------------------------------##*/ + +losig_list *duplosig(losig_ptr, BKSIG_ptr, sigsize) +losig_list *losig_ptr; +ptype_list **BKSIG_ptr; +int sigsize; + { + ptype_list *ptype_ptr = NULL; + ptype_list *pt = NULL; + long index = losig_ptr->INDEX; + int i; + int low, high; + losig_list *ptsig = NULL; + losig_list *pthead = NULL; + + ptype_ptr = *BKSIG_ptr; + low = (index % sigsize); + high = (index / sigsize); + for (pt = ptype_ptr; pt; pt = pt->NEXT) + if (pt->TYPE == high) + break; + if (pt == NULL) + { + /* Initialization of the array of losig */ + pthead = (losig_list *)mbkalloc(sigsize * sizeof(losig_list)); + ptsig = pthead; + for (i = 0; i < sigsize; i++) + { + ptsig->INDEX = 0; + ptsig++; + } + pt = ptype_ptr = (ptype_list *)addptype(ptype_ptr,(long)high,(void *)pthead); + } + ptsig = (losig_list *)(pt->DATA) + low; + + /* check index unicity */ + if (ptsig->INDEX != 0L) + { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "duplosig impossible :\n"); + (void)fprintf(stderr, "signal %ld already exist\n", + index); + EXIT(1); + } + + ptsig->NEXT = NULL; + ptsig->NAMECHAIN = dupchainlst(losig_ptr->NAMECHAIN); + ptsig->PRCN = NULL; + ptsig->INDEX = losig_ptr->INDEX; + ptsig->USER = NULL; + ptsig->PRCN = NULL; /* The rc data is not duplicated */ + ptsig->TYPE = losig_ptr->TYPE; /* The ptype_list is not duplicated */ + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- duplosig : %ld ", index); + if (ptsig->NAMECHAIN) + if (ptsig->NAMECHAIN->DATA) + (void)fprintf(stdout, "name : %s", + (char *)((chain_list *)(ptsig->NAMECHAIN))->DATA); + (void)fprintf(stdout, "\n"); + } + + *BKSIG_ptr = ptype_ptr; + return ptsig; + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplofiglst() */ +/* contents : duplicate a lofig list and return a pointer on the new */ +/* structure. */ +/* called func. : duplofig(), reverse(), */ +/*##------------------------------------------------------------------##*/ + +lofig_list *duplofiglst(lofig_ptr) +lofig_list *lofig_ptr; + { + lofig_list *lofig_rpt = NULL; /* Returned lofig pointer */ + lofig_list *lofig_tmpptr = NULL; /* Temporary pointer */ + + while(lofig_ptr != NULL) + { + lofig_tmpptr = duplofig(lofig_ptr); + lofig_tmpptr->NEXT = lofig_rpt; + lofig_rpt = lofig_tmpptr; + + lofig_ptr = lofig_ptr->NEXT; + } + lofig_rpt = (lofig_list *)reverse((chain_list *)lofig_rpt); + return(lofig_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : duplofig() */ +/* contents : duplicate a lofig and return a pointer on the new */ +/* structure. */ +/* called func. : mbkalloc(), dupchainlst(), */ +/* note : the LOCON, LOSIG, BKSIG, LOINS, LOTRS pointers are */ +/* also duplicated */ +/*##------------------------------------------------------------------##*/ + +lofig_list *duplofig(lofig_ptr) +lofig_list *lofig_ptr; + { + lofig_list *lofig_rpt = NULL; /* Returned lofig pointer */ + + lofig_rpt = (lofig_list *)(mbkalloc(sizeof(lofig_list))); + lofig_rpt->BKSIG = NULL; + lofig_rpt->USER = NULL; /* The ptype_list is not duplicated */ + setsigsize( lofig_rpt, getsigsize( lofig_ptr )); + lofig_rpt->NEXT = NULL; + lofig_rpt->MODELCHAIN = dupchainlst(lofig_ptr->MODELCHAIN); + lofig_rpt->LOCON = lofig_ptr->LOCON; + lofig_rpt->LOSIG = lofig_ptr->LOSIG; + lofig_rpt->BKSIG = lofig_ptr->BKSIG; + lofig_rpt->LOINS = lofig_ptr->LOINS; + lofig_rpt->LOTRS = lofig_ptr->LOTRS; + lofig_rpt->NAME = lofig_ptr->NAME; + lofig_rpt->MODE = lofig_ptr->MODE; + + return(lofig_rpt); + } + +/*##------------------------------------------------------------------##*/ +/* Function : rduplofig() */ +/* contents : recursively duplicate a lofig and return a pointer on */ +/* the new structure. This structure is the entirely */ +/* double of the lofig duplicated. Except, that all the */ +/* USER fields are empty. */ +/* called func. : mbkalloc(), */ +/*##------------------------------------------------------------------##*/ + +lofig_list *rduplofig(lofig_ptr) +lofig_list *lofig_ptr; + { + lofig_list *lofig_rpt = NULL; /* Returned lofig pointer */ + ptype_list *ptype_ptr = NULL; + locon_list *locon_pt = NULL; + loins_list *loins_pt = NULL; + lotrs_list *lotrs_pt = NULL; + losig_list *losig_pt = NULL; + chain_list *headctc; + chain_list *scanchain; + loctc_list *ptctc; + long index = 0; + + lofig_rpt = duplofig(lofig_ptr); + lofig_rpt->LOSIG = duplosiglst(lofig_rpt->LOSIG, &ptype_ptr,getsigsize(lofig_rpt)); + lofig_rpt->BKSIG = ptype_ptr; + lofig_rpt->LOCON = duploconlst(lofig_rpt->LOCON); + lofig_rpt->LOINS = duploinslst(lofig_rpt->LOINS); + lofig_rpt->LOTRS = duplotrslst(lofig_rpt->LOTRS); + + /* Now verify and restitute the coherence of the figure */ + + /* Restitute coherence in the LOTRS List */ + lotrs_pt = lofig_rpt->LOTRS; + while(lotrs_pt != NULL) + { + lotrs_pt->GRID = duplocon(lotrs_pt->GRID); + locon_pt = lotrs_pt->GRID; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)lotrs_pt; + + locon_pt = locon_pt->NEXT; + } + + lotrs_pt->DRAIN = duplocon(lotrs_pt->DRAIN); + locon_pt = lotrs_pt->DRAIN; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)lotrs_pt; + + locon_pt = locon_pt->NEXT; + } + + lotrs_pt->SOURCE = duplocon(lotrs_pt->SOURCE); + locon_pt = lotrs_pt->SOURCE; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)lotrs_pt; + + locon_pt = locon_pt->NEXT; + } + + lotrs_pt->BULK = duplocon(lotrs_pt->BULK); + locon_pt = lotrs_pt->BULK; + while(locon_pt != NULL) + { + if( locon_pt->SIG ) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + } + else + { + locon_pt->SIG = NULL; + } + locon_pt->ROOT = (void *)lotrs_pt; + + locon_pt = locon_pt->NEXT; + } + + lotrs_pt = lotrs_pt->NEXT; + } + + /* Restitute coherence in the LOINS List */ + loins_pt = lofig_rpt->LOINS; + while(loins_pt != NULL) + { + loins_pt->LOCON = duploconlst(loins_pt->LOCON); + locon_pt = loins_pt->LOCON; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)loins_pt; + + locon_pt = locon_pt->NEXT; + } + loins_pt = loins_pt->NEXT; + } + + /* Restitute coherence in the LOCON List */ + locon_pt = lofig_rpt->LOCON; + while(locon_pt != NULL) + { + index = (locon_pt->SIG)->INDEX; + locon_pt->SIG = getlosig(lofig_rpt, index); + locon_pt->ROOT = (void *)lofig_rpt; + + locon_pt = locon_pt->NEXT; + } + + /* Duplicate rc data */ + for( losig_pt = lofig_ptr->LOSIG ; losig_pt ; losig_pt = losig_pt->NEXT ) + duplorcnet( getlosig( lofig_rpt, losig_pt->INDEX ), losig_pt ); + + headctc = getallctc( lofig_ptr ); + for( scanchain = headctc ; scanchain ; scanchain = scanchain->NEXT ) + { + ptctc = (loctc_list*)scanchain->DATA; + addloctc( getlosig( lofig_rpt, ptctc->SIG1->INDEX ), ptctc->NODE1, + getlosig( lofig_rpt, ptctc->SIG2->INDEX ), ptctc->NODE2, + ptctc->CAPA ); + } + freechain( headctc ); + + return(lofig_rpt); + } + +/* sort routines : + connectors and signals may have to be sorted by name for some + language purposes. */ + +static char Buffer0[255]; /* may be of use for other functions */ + +static int + connectorcmp(flc, slc) +locon_list **flc, **slc; +{ + return naturalstrcmp((*slc)->NAME, (*flc)->NAME); +} + +void + sortlocon(connectors) +locon_list **connectors; +{ +long n, i; +locon_list *lc, **tc; + + if (!connectors || !(*connectors)) + return; + + /* first : + count connectors. */ + for (n = 0, lc = *connectors; lc; lc = lc->NEXT) + n++; + tc = (locon_list **)mbkalloc(n * sizeof(locon_list *)); + for (n = 0, lc = *connectors; lc; lc = lc->NEXT) + tc[n++] = lc; + /* second : + sort them. */ + qsort((void *)tc, n, sizeof(locon_list *), connectorcmp); + /* tables : + the last element of the table is t[n - 1]. + relink the list in the sorted order. */ + n--; + *connectors = tc[0]; + for (i = 0; i < n; i++) + tc[i]->NEXT = tc[i + 1]; + tc[n]->NEXT = (locon_list *)NULL; + mbkfree((void *)tc); +} + +static int + signalcmp(fls, sls) +losig_list **fls, **sls; +{ + return naturalstrcmp(getsigname(*fls), getsigname(*sls)); +} + +void + sortlosig(signals) +losig_list **signals; +{ +long n, i; +losig_list *lc, **tc; + + if (!signals || !(*signals)) + return; + + /* first : + count signals. */ + for (n = 0, lc = *signals; lc; lc = lc->NEXT) + n++; + tc = (losig_list **)mbkalloc(n * sizeof(losig_list *)); + for (n = 0, lc = *signals; lc; lc = lc->NEXT) + tc[n++] = lc; + /* second : + sort them. */ + qsort((void *)tc, n, sizeof(losig_list *), signalcmp); + /* tables : + the last element of the table is t[n - 1]. + relink the list in the sorted order. */ + n--; + *signals = tc[0]; + for (i = 0; i < n; i++) + tc[i]->NEXT = tc[i + 1]; + tc[n]->NEXT = (losig_list *)NULL; + mbkfree((void *)tc); +} + +/* checking : + the validity of a list of connectors for vectorization purposes + is to be checked for some file formats, so let's do it. + The algorithm checks that : + vectorized radical do not appear on themselves + vectorized connectors are all together and ordered properly */ +#define HTSIZE 200 +int + checkloconorder(c) +locon_list *c; +{ +char *s=NULL, *t=NULL; +ht *table; +int first = 1, previous=0, delta=0, current=0; + + table = addht(HTSIZE); + while (c) { + /* vectorized ? + no. */ + if ((s = strchr(c->NAME, ' ')) == NULL) { +avoid_redundancy : + if (sethtitem(table, (void *)c->NAME, 0)) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, + "the radical %s is already used in a vector\n", + c->NAME); + delht(table); + EXIT(1); + return 1; + } + first = 1; + c = c->NEXT; + } else { + while (c) { + int i = 1; + /* redundancy : + I'ven't found an elegant way to do that, too bad. */ + if (!s) + if ((s = strchr(c->NAME, ' ')) == NULL) + goto avoid_redundancy; + /* Temporary change : + alter the string contents just a microsecond. */ + *s = '\0'; + strcpy(Buffer0, c->NAME); + *s = ' '; + while (*(s + i) && isdigit((int)*(s + i))) + i++; + if (*(s + i)) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, + "the radical %s has a spurious vectorized value %s (%s)\n", + Buffer0, s + 1, c->NAME); + delht(table); + EXIT(1); + return 1; + } + current = atoi(s + 1); + s = NULL; + /* first : + the name is not yet known. so I store it. + we do that each time a new vector is encountered. */ + if (first) { +its_first: + if (sethtitem(table, (void *)(t = namealloc(Buffer0)), 0)) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, + "the radical %s is already used in a vector\n", + Buffer0); + delht(table); + EXIT(1); + return 1; + } + delta = first = 0; + previous = current; + c = c->NEXT; + } else { /* let's see if it's a good vhdl legal vector */ + /* its a new vector : + in fact this vector follows an other vector! */ + if (t != namealloc(Buffer0)) + goto its_first; + if (!delta) + delta = previous - current; + else if (delta != previous - current) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, + "the radical %s is not vectorized properly,", + Buffer0); + (void)fprintf(stderr, + " %s %d follows %s %d\n", Buffer0, previous, + Buffer0, current); + delht(table); + EXIT(1); + return 1; + } + if (delta != 1 && delta != -1) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, + "the radical %s is not vectorized properly,", + c->NAME); + (void)fprintf(stderr, + " %s %d follows %s %d\n", Buffer0, previous, + Buffer0, current); + delht(table); + EXIT(1); + return 1; + } + previous = current; + c = c->NEXT; + } + } + } + } + delht(table); + return 0; +} diff --git a/alliance/src/mbk/src/mbk_lo_util.h b/alliance/src/mbk/src/mbk_lo_util.h new file mode 100644 index 00000000..7916bd0e --- /dev/null +++ b/alliance/src/mbk/src/mbk_lo_util.h @@ -0,0 +1,66 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : mbk_lo_util.c header file for functions declarations + * Date : 06/03/92 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mbk_lo_util.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +/* $Id: mbk_lo_util.h,v 1.1 2002/03/08 13:51:05 fred Exp $ */ + +#ifndef _MBK_LO_UTIL_H_ +#define _MBK_LO_UTIL_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + + extern void flattenlofig __P((lofig_list *ptfig, const char *insname, char concat)); +lofig_list *givelofig(); + extern losig_list * givelosig __P((lofig_list *ptfig, long index)); + extern void loadlofig __P((lofig_list *ptfig, const char *name, char mode)); + extern void rflattenlofig __P((lofig_list *ptfig, char concat, char catal)); + extern void savelofig __P((lofig_list *ptfig)); + extern lofig_list * unflattenlofig __P((lofig_list *ptfig, const char *figname, const char *insname, chain_list *list)); + extern losig_list * duplosiglst __P((losig_list *losig_ptr, ptype_list **BKSIG_ptr,int)); + extern losig_list * duplosig __P((losig_list *losig_ptr, ptype_list **BKSIG_ptr,int)); + extern chain_list * dupchainlst __P((chain_list *chain_ptr)); + extern locon_list * duploconlst __P((locon_list *locon_ptr)); + extern locon_list * duplocon __P((locon_list *locon_ptr)); + extern loins_list * duploinslst __P((loins_list *loins_ptr)); + extern loins_list * duploins __P((loins_list *loins_ptr)); + extern lotrs_list * duplotrslst __P((lotrs_list *lotrs_ptr)); + extern lotrs_list * duplotrs __P((lotrs_list *lotrs_ptr)); + extern lofig_list * duplofiglst __P((lofig_list *lofig_ptr)); + extern lofig_list * duplofig __P((lofig_list *lofig_ptr)); + extern lofig_list * rduplofig __P((lofig_list *lofig_ptr)); + +#endif + diff --git a/alliance/src/mbk/src/mbk_ph.c b/alliance/src/mbk/src/mbk_ph.c new file mode 100644 index 00000000..991cd1c8 --- /dev/null +++ b/alliance/src/mbk/src/mbk_ph.c @@ -0,0 +1,1235 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : access functions to physical structures + * Date : 06/03/92 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + */ + +#ident "$Id: mbk_ph.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +/* + * $Log: mbk_ph.c,v $ + * Revision 1.1 2002/03/08 13:51:05 fred + * Initial revision + * + * Revision 1.12 2001/02/07 11:47:40 fred + * Quite a few changes: + * Four new layers in the physical view: N/P TRANS FAST/HVIO + * A new field in the lotrs: char *MODELNAME that's the name of the + * spice model (in spice terminology) of the transistor. + * This field is supposed to be filled at extraction time and used at + * netlist generation time, by the techo dependant formats (ie spice) + * + * This implies recompilation of everything:) Be my guest + * + * Revision 1.11 2000/11/15 15:02:07 syf + * invxyflat ... + * + * Revision 1.10 2000/11/07 16:15:10 czo + * correction des #ident avec ; en trop + * + * Revision 1.9 2000/11/06 14:10:39 fred + * Add a test on name in addphvia to allow vias without names (NULL) + * + * Revision 1.8 2000/09/01 23:26:02 jpc + * * Alors Fred, on fait du sabotage? + * - Le bon test pour detecter si un layer est en CALU c'est : + * + * ((layer >= CALU1) && (layer <= CALU9)) + * ^^ + * + * Ca a du foutre un de ces bordels dans les programmes compiles + * aujourd'hui : on pouvait plus faire d'addphseg. + * + * - Y'a aussi une merde dans le rflattenphfig, mais il est temps de faire + * dodo. + * + * Revision 1.7 2000/08/31 15:29:15 fred + * Checks that a CLAYER has a name when creating a segment. + * + * Revision 1.6 2000/04/13 14:18:29 gregoire + * Plein de petites choses : + * + * Ajout de fonctions de libération des ressources utilisées. + * Traçage des chain_list pour détecter les blocs inutilisés. + * Debuggage de flatlofig. + * + * Revision 1.5 2000/02/22 13:58:15 syf + * ATTENTION GROSSE MODIF !!! + * les phvias possedent maintenant un champ NAME !!! + * + * Revision 1.4 2000/02/04 13:03:11 syf + * Ajout de nouveaux layers : CALU1...CALU9 + * Ajout de nouveaux contacts : TURN1...TURN9 + * + * Revision 1.3 2000/01/12 09:55:24 syf + * Attention !! + * -> deux nouveaux champs dans la structure de donnee + * phvia, DX et DY. + * -> deux nouveaux parametres dans la fonction addphvia + * + * Revision 1.2 1998/12/04 14:38:20 fred + * Added the layer info to addphcon output in verbose mode + * + * Revision 1.1.1.1 1998/10/02 15:27:10 alliance + * Imported by czo + * + * Revision 7.12 1998/06/15 16:44:56 mbk + * greg + * + * Revision 7.11 1998/04/06 10:06:58 mbk + * Czo : headers, small modifs + * + * Revision 7.11 1998/04/06 10:06:58 mbk + * Czo : headers, small modifs + * + * + * Revision 7.8 1997/11/05 14:45:15 mbk + * Slight modification in the index computation, that seems to be buggy + * + * Revision 7.7 1997/07/30 07:41:24 mbk + * Added the POLY2 layer and CONT_POLY2 contact + * Now accepts connectors inside the abutement box + * Changes the way the indexes are computed, in order to cope with the + * connectors that are inside the abutment box + * + */ + +#ident "$Id: mbk_ph.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +#include +#include + +#include "mut.h" +#include "mph.h" +#include "mbk_ph.h" + +/******************************************************************************* +* global variable for physical view * +*******************************************************************************/ +phfig_list *HEAD_PHFIG; /* logical figure list head */ + +/******************************************************************************* +* fonction addphfig * +*******************************************************************************/ +phfig_list *addphfig(const char *name) +{ +phfig_list *ptfig; +char *figname; + + figname = namealloc(name); + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- addphfig : %s\n", figname); + + /* scan figure_list */ + for (ptfig = HEAD_PHFIG; ptfig; ptfig = ptfig->NEXT) + if (ptfig->NAME == figname) + break; + + if (ptfig != NULL) { /* figure exists */ + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal addphfig\n"); + (void)fprintf(stderr, "figure %s already exists\n", figname); + EXIT(1); + } + ptfig = (phfig_list *)mbkalloc(sizeof(phfig_list)); + ptfig->MODE = 'A'; + ptfig->NAME = figname; + ptfig->MODELCHAIN = NULL; + ptfig->PHSEG = NULL; + ptfig->PHCON = NULL; + ptfig->PHINS = NULL; + ptfig->PHVIA = NULL; + ptfig->PHREF = NULL; + ptfig->XAB1 = 0; + ptfig->YAB1 = 0; + ptfig->XAB2 = 0; + ptfig->YAB2 = 0; + ptfig->USER = NULL; + ptfig->NEXT = HEAD_PHFIG; + HEAD_PHFIG = ptfig; + + return ptfig; +} + +/******************************************************************************* +* fonction addphins * +*******************************************************************************/ +phins_list *addphins(phfig_list *ptfig, const char *fname, const char *iname, char sym, long x, long y) +{ +phins_list *ptins; +chain_list *ptchain; +char *figname; +char *insname; + + insname = namealloc(iname); + figname = namealloc(fname); + + /* check consistency */ + if (FAST_MODE != 'Y' && strcmp(insname, "*")) { + if (sym != NOSYM && sym != SYM_X && sym != SYM_Y && sym != SYMXY && + sym != ROT_P && sym != ROT_M && sym != SY_RP && sym != SY_RM) { + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal addphins "); + (void)fprintf(stderr, "transformation %ld in : %s\n", + (long)sym, insname); + EXIT(1); + } + + /* check instance name unicity */ + for (ptins = ptfig->PHINS; ptins; ptins = ptins->NEXT) + if (ptins->INSNAME == insname) + break; + if (ptins != NULL) { + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal addphins\n"); + (void)fprintf(stderr, "duplicate instance name : %s\n", insname); + EXIT(1); + } + if (ptfig->NAME == figname) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\naddphins\n"); + (void)fprintf(stderr, "figure %s cannot be part of itself\n", figname); + EXIT(1); + } + } + + /* update instance list */ + ptins = (phins_list *)mbkalloc(sizeof(phins_list)); + ptins->INSNAME = insname; + ptins->FIGNAME = figname; + ptins->TRANSF = sym; + ptins->XINS = x; + ptins->YINS = y; + ptins->USER = NULL; + ptins->NEXT = ptfig->PHINS; + ptfig->PHINS = ptins; + + /* update model list */ + for (ptchain = ptfig->MODELCHAIN; ptchain; ptchain = ptchain->NEXT) + if (ptchain->DATA == (void *)figname) + break; + + if (ptchain == NULL) + ptfig->MODELCHAIN = addchain(ptfig->MODELCHAIN, (void *)figname); + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- addphins : "); + (void)fprintf(stdout, "%s x=%ld y=%ld trans=%ld\n", insname, x, y, + (long)(ptins->TRANSF)); + } + return ptins; +} + +/******************************************************************************* +* fonction addphvia * +*******************************************************************************/ +phvia_list *addphvia(phfig_list *ptfig, char viatype, long x, long y, long dx, long dy, const char *vname) +{ +phvia_list *ptvia; +char *name; + + if (vname) + name = namealloc(vname); + else + name = NULL; +/* check consistency */ + if (viatype < 0 || viatype > LAST_CONTACT) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\nillegal addphvia viatype "); + (void)fprintf(stderr, ": %ld at x=%ld y=%ld\n", (long)viatype, x, y); + EXIT(1); + } + + /* update via list */ + ptvia = (phvia_list *)mbkalloc(sizeof(phvia_list)); + ptvia->TYPE = viatype; + ptvia->NAME = name; + ptvia->XVIA = x; + ptvia->YVIA = y; + ptvia->DX = dx; + ptvia->DY = dy; + ptvia->USER = NULL; + ptvia->NEXT = ptfig->PHVIA; + ptfig->PHVIA = ptvia; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- addphvia : "); + (void)fprintf(stdout, "type=%ld x=%ld y=%ld dx=%ld dy=%ld\n", + (long)viatype, x, y, dx, dy); + } + return ptvia; +} + +/******************************************************************************* +* fonction addphref * +*******************************************************************************/ +phref_list *addphref(phfig_list *ptfig, const char *rtype, const char *rname, long x, long y) +{ +phref_list *ptref; +char *type; +char *name; + + name = namealloc(rname); + type = namealloc(rtype); + + /* update ref list */ + ptref = (phref_list *)mbkalloc(sizeof(phref_list)); + ptref->FIGNAME = type; + ptref->NAME = name; + ptref->XREF = x; + ptref->YREF = y; + ptref->USER = NULL; + ptref->NEXT = ptfig->PHREF; + ptfig->PHREF = ptref; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- addphref : "); + (void)fprintf(stdout, "type %s name %s x=%ld y=%ld \n", type, name, x, y); + } + return ptref; +} + +/******************************************************************************* +* fonction addphseg * +*******************************************************************************/ +phseg_list *addphseg(phfig_list *ptfig, char layer, long width, long x1, long y1, long x2, long y2, const char *sname) +{ +phseg_list *ptseg; +char *nodename = namealloc(sname); + + if (layer < 0 || layer > LAST_LAYER) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\nillegal addphseg\n"); + (void)fprintf(stderr, "wrong layer code = %ld on segment ", (long)layer); + (void)fprintf(stderr, "x1=%ld y1=%ld x2=%ld y2=%ld\n", x1, y1, x2, y2); + EXIT(1); + } + + if ((layer >= CALU1) && (layer <= CALU9)) + if (nodename == NULL || *nodename == (char)0 || !strcmp(nodename, "*")) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\nillegal addphseg\n"); + (void)fprintf(stderr, "Connection layer (%d) without a name\n", + layer); + (void)fprintf(stderr, "x1=%ld y1=%ld x2=%ld y2=%ld\n", x1, y1, x2, y2); + EXIT(1); + } + + + /* update segment list */ + ptseg = (phseg_list *)mbkalloc(sizeof(phseg_list)); + + if (y1 == y2) { + ptseg->Y1 = ptseg->Y2 = y1; + if (x1 < x2) { + ptseg->TYPE = RIGHT; + ptseg->X1 = x1; + ptseg->X2 = x2; + } else { + ptseg->TYPE = LEFT; + ptseg->X1 = x2; + ptseg->X2 = x1; + } + } else if (x1 == x2) { + ptseg->X1 = ptseg->X2 = x1; + if (y1 < y2) { + ptseg->TYPE = UP; + ptseg->Y1 = y1; + ptseg->Y2 = y2; + } else { + ptseg->TYPE = DOWN; + ptseg->Y1 = y2; + ptseg->Y2 = y1; + } + } else { + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal addphseg\n"); + (void)fprintf(stderr, "x1=%ld y1=%ld x2=%ld y2=%ld layer=%ld\n", + x1, y1, x2, y2, (long)layer); + EXIT(1); + } + ptseg->LAYER = layer; + ptseg->NAME = nodename; + ptseg->WIDTH = width; + ptseg->USER = NULL; + ptseg->NEXT = ptfig->PHSEG; + ptfig->PHSEG = ptseg; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- addphseg : "); + if (nodename == NULL || *nodename == (char)0 || !strcmp(nodename, "*")) + (void)printf("x1=%ld y1=%ld x2=%ld y2=%ld layer=%ld width=%ld\n", + x1, y1, x2, y2, (long)layer, width); + else + (void)printf("x1=%ld y1=%ld x2=%ld y2=%ld layer=%ld width=%ld name=%s\n", + x1, y1, x2, y2, (long)layer, width, nodename); + } + return ptseg; +} + +/******************************************************************************* +* fonction addsorted * +*******************************************************************************/ +static chain_list *addsorted(chain_list *pa, phcon_list *pco) +{ +chain_list *ptc, *oldp; + + if (pa == NULL) /* first connector */ + return addchain((chain_list *)NULL, (void *)pco); + /* insert in head */ + if (((phcon_list *)pa->DATA)->YCON > pco->YCON) + return addchain(pa, (void *)pco); + /* breaking ties */ + if (((phcon_list *)pa->DATA)->YCON == pco->YCON) { + if (((phcon_list *)pa->DATA)->XCON > pco->XCON) + return addchain(pa, (void *)pco); + if (((phcon_list *)pa->DATA)->XCON == pco->XCON) { + if (((phcon_list *)pa->DATA)->LAYER > pco->LAYER) + return addchain(pa, (void *)pco); + else if (((phcon_list *)pa->DATA)->LAYER < pco->LAYER) { + pa->NEXT = addchain(pa->NEXT, (void *)pco); + return pa; + } + if (((phcon_list *)pa->DATA)->ORIENT > pco->ORIENT) + return addchain(pa, (void *)pco); + pa->NEXT = addchain(pa->NEXT, (void *)pco); + return pa; + } + } + for (ptc = pa->NEXT, oldp = pa; ptc != NULL; /* general case */ + oldp = ptc, ptc = ptc->NEXT) { + if (((phcon_list *)ptc->DATA)->YCON > pco->YCON) { + oldp->NEXT = addchain(ptc, (void *)pco); + return pa; + } + if (((phcon_list *)ptc->DATA)->YCON == pco->YCON) { + if (((phcon_list *)ptc->DATA)->XCON > pco->XCON) { + oldp->NEXT = addchain(ptc, (void *)pco); + return pa; + } + if (((phcon_list *)ptc->DATA)->XCON == pco->XCON) { + if (((phcon_list *)ptc->DATA)->LAYER > pco->LAYER) { + oldp->NEXT = addchain(ptc, (void *)pco); + return pa; + } else if (((phcon_list *)ptc->DATA)->LAYER < pco->LAYER) { + ptc->NEXT = addchain(ptc->NEXT, (void *)pco); + return pa; + } + if (((phcon_list *)ptc->DATA)->ORIENT > pco->ORIENT) { + oldp->NEXT = addchain(ptc, (void *)pco); + return pa; + } + ptc->NEXT = addchain(ptc->NEXT, (void *)pco); + return pa; + } + } + } + /* put it at the end */ + oldp->NEXT = addchain((chain_list *)NULL, (void *)pco); + return pa; +} + +/******************************************************************************* +* fonction addphcon * +*******************************************************************************/ +phcon_list *addphcon(phfig_list *ptfig, char orient, const char *cname, long x, long y, char layer, long width) +{ +phcon_list *ptcon, *ptscan; +chain_list *pt, *ptchain = NULL; +long index; +char *conname; + + conname = namealloc(cname); + /* check consistency */ + if (layer < 0 || layer > LAST_LAYER) { + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal addphcon\n"); + (void)fprintf(stderr, "figure : %s\n", ptfig->NAME); + (void)fprintf(stderr, "code layer is %ld in %s\n", (long)layer, conname); + EXIT(1); + } + if (orient != NORTH && orient != EAST && orient != SOUTH && + orient != WEST) { + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal addphcon\n"); + (void)fprintf(stderr, "figure : %s\n", ptfig->NAME); + (void)fprintf(stderr, "orientation is %ld in : %s\n", (long)orient, + conname); + EXIT(1); + } + +#if 0 + if (x < ptfig->XAB1 || x > ptfig->XAB2 || y < ptfig->YAB1 + || y > ptfig->YAB2) { + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal addphcon\n"); + (void)fprintf(stderr, "connector %s (%ld, %ld) not in abutement box\n", + conname, x, y); + EXIT(1); + } +#endif + + /* update connector list */ + ptcon = (phcon_list *)mbkalloc(sizeof(phcon_list)); + ptcon->INDEX = 0; + ptcon->XCON = x; + ptcon->YCON = y; + ptcon->WIDTH = width; + ptcon->ORIENT = orient; + ptcon->NAME = conname; + ptcon->LAYER = layer; + ptcon->USER = NULL; + ptcon->NEXT = ptfig->PHCON; + ptfig->PHCON = ptcon; + + /* update index list with topological sort */ + for (ptscan = ptfig->PHCON; ptscan; ptscan = ptscan->NEXT) { + if (conname == ptscan->NAME) /* if such a connector already exists*/ + ptchain = addsorted(ptchain, ptscan); + } + for (pt = ptchain, index = 0; pt != NULL; index++, pt = pt->NEXT) + ((phcon_list *)pt->DATA)->INDEX = index; + freechain(ptchain); + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- addphcon : "); + (void)fprintf(stdout, "%s.%ld x=%ld y=%ld w=%ld layer=%d\n", conname, + index, x, y, width, layer); + } + return ptcon; +} + +/******************************************************************************* +* fonction defab * +*******************************************************************************/ +void defab(ptfig, x1, y1, x2, y2) +phfig_list *ptfig; +long x1, y1, x2, y2; +{ + ptfig->XAB1 = x1; + ptfig->YAB1 = y1; + ptfig->XAB2 = x2; + ptfig->YAB2 = y2; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- defab : "); + (void)fprintf(stdout, "%s x1= %ld y1=%ld x2=%ld y2=%ld\n", + ptfig->NAME, x1, y1, x2, y2); + } +} + +/******************************************************************************* +* fonction getphins * +*******************************************************************************/ +phins_list *getphins(phfig_list *ptfig, const char *iname) +{ +phins_list *ptins; +char *insname = namealloc(iname); + for (ptins = ptfig->PHINS; ptins; ptins = ptins->NEXT) + if (ptins->INSNAME == insname) + return ptins; + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error ***\nillegal getphins "); + (void)fprintf(stderr, "instance %s doesn't exist in figure %s\n", + insname, ptfig->NAME); + EXIT(1); + return NULL; /* never reached */ +} + +/******************************************************************************* +* fonction getphcon * +*******************************************************************************/ +phcon_list *getphcon(phfig_list *ptfig, const char *cname, long index) +{ +phcon_list *ptcon; +char *conname = namealloc(cname); + + if (ptfig->PHCON != NULL) + for (ptcon = ptfig->PHCON; ptcon; ptcon = ptcon->NEXT) + if (ptcon->NAME == conname && ptcon->INDEX == index) + return ptcon; + + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error *** illegal getphcon\n"); + (void)fprintf(stderr, "connector %s.%ld doesn't exist in figure %s\n", + conname, index, ptfig->NAME); + EXIT(1); + return NULL; /* never reached */ +} + +/******************************************************************************* +* fonction getphref * +*******************************************************************************/ +phref_list *getphref(phfig_list *ptfig, const char *rname) +{ +phref_list *ptref; +char *refname = namealloc(rname); + + for (ptref = ptfig->PHREF; ptref; ptref = ptref->NEXT) + if (ptref->NAME == refname) + return ptref; + (void)fflush(stdout); + (void)fprintf(stderr, "\n*** mbk error ***\nillegal getphref "); + (void)fprintf(stderr, "reference %s doesn't exist in figure %s\n", + refname, ptfig->NAME); + EXIT(1); + return NULL; /* never reached */ +} + +/******************************************************************************* +* fonction delphcon * +*******************************************************************************/ +int delphcon(phfig_list *ptfig, phcon_list *ptdelcon) +{ +phcon_list *ptsav; +phcon_list *ptcon, *ptscan; +chain_list *pt, *ptchain = NULL; +long index; +char *conname; + + for (ptcon = ptfig->PHCON; ptcon; ptcon = ptcon->NEXT) { + if (ptcon == ptdelcon) + break; + ptsav = ptcon; + } + if (ptcon == NULL) + return 0; + else if (ptcon == ptfig->PHCON) { + ptfig->PHCON = ptcon->NEXT; + conname = ptcon->NAME; + } else { + ptsav->NEXT = ptcon->NEXT; + conname = ptcon->NAME; + } + /* update index list with topological sort */ + for (ptscan = ptfig->PHCON; ptscan; ptscan = ptscan->NEXT) { + if (conname == ptscan->NAME) /* if such a connector already exists*/ + ptchain = addsorted(ptchain, ptscan); + } + for (pt = ptchain, index = 0; pt != NULL; index++, pt = pt->NEXT) + ((phcon_list *)pt->DATA)->INDEX = index; + freechain(ptchain); + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- delphcon : "); + (void)fprintf(stdout, "%s.%ld\n", ptdelcon->NAME, ptdelcon->INDEX); + } + mbkfree((void *)ptdelcon); + return 1; +} + +/******************************************************************************* +* fonction delphseg * +*******************************************************************************/ +int delphseg(phfig_list *ptfig, phseg_list *ptseg) +{ +phseg_list *ptsav; +phseg_list *pttmp; + + for (pttmp = ptfig->PHSEG; pttmp; pttmp = pttmp->NEXT) { + if (pttmp == ptseg) + break; + ptsav = pttmp; + } + + if (pttmp == NULL) + return 0; + else if (ptseg == ptfig->PHSEG) + ptfig->PHSEG = pttmp->NEXT; + else + ptsav->NEXT = pttmp->NEXT; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- delphseg : "); + (void)fprintf(stdout, "%s \n", ptseg->NAME); + } + + mbkfree((void *)ptseg); + return 1; +} + +/******************************************************************************* +* fonction delphvia * +*******************************************************************************/ +int delphvia(phfig_list *ptfig, phvia_list *ptvia) +{ +phvia_list *ptsav; +phvia_list *pttmp; + + for (pttmp = ptfig->PHVIA; pttmp; pttmp = pttmp->NEXT) { + if (pttmp == ptvia) + break; + ptsav = pttmp; + } + + if (pttmp == NULL) + return 0; + else if (ptvia == ptfig->PHVIA) + ptfig->PHVIA = pttmp->NEXT; + else + ptsav->NEXT = pttmp->NEXT; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- delphvia : "); + (void)fprintf(stdout, "%ld \n", (long)(ptvia->TYPE)); + } + mbkfree((void *)ptvia); + return 1; +} + +/******************************************************************************* +* fonction delphref * +*******************************************************************************/ +int delphref(phfig_list *ptfig, phref_list *ptref) +{ +phref_list *ptsav; +phref_list *pttmp; + + for (pttmp = ptfig->PHREF; pttmp; pttmp = pttmp->NEXT) { + if (pttmp == ptref) + break; + ptsav = pttmp; + } + + if (pttmp == NULL) + return 0; + else if (ptref == ptfig->PHREF) + ptfig->PHREF = pttmp->NEXT; + else + ptsav->NEXT = pttmp->NEXT; + + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- delphref : "); + (void)fprintf(stdout, "%s \n", ptref->NAME); + } + mbkfree((void *)ptref); + return 1; +} + +/******************************************************************************* +* fonction delphins * +*******************************************************************************/ +int delphins(phfig_list *ptfig, const char *iname) +{ +phins_list *ptsav; +phins_list *ptins; +chain_list *ptchain; +chain_list *pttmpchain; +char *figname; +char *insname = namealloc(iname); + + for (ptins = ptfig->PHINS; ptins; ptins = ptins->NEXT) { + if (ptins->INSNAME == insname) + break; + ptsav = ptins; + } + + if (ptins == NULL) + return 0; + else if (ptins == ptfig->PHINS) { + figname = ptins->FIGNAME; + ptfig->PHINS = ptins->NEXT; + } else { + figname = ptins->FIGNAME; + ptsav->NEXT = ptins->NEXT; + } + + mbkfree((void *)ptins); + + for (ptins = ptfig->PHINS; ptins; ptins = ptins->NEXT) + if (ptins->FIGNAME == figname) + break; + if (ptins == NULL) { + for (ptchain = ptfig->MODELCHAIN; ptchain; ptchain = ptchain->NEXT) { + if (ptchain->DATA == (void *)figname) + break; + pttmpchain = ptchain; + } + if (ptchain == ptfig->MODELCHAIN && ptchain != NULL) + ptfig->MODELCHAIN = ptchain ->NEXT; + else if (ptchain != NULL) + pttmpchain->NEXT = ptchain->NEXT; + } + if (TRACE_MODE == 'Y') { + (void)fprintf(stdout, "--- mbk --- delphins : "); + (void)fprintf(stdout, "%s of figure %s\n", insname, figname); + } + return 1; +} + +/******************************************************************************* +* fonction delphfig * +*******************************************************************************/ +int delphfig(const char *fname) +{ +phfig_list *ptfig; +phcon_list *ptcon; +phseg_list *ptseg; +phvia_list *ptvia; +phins_list *ptins; +phref_list *ptref; +phfig_list *ptfig_sav; +phcon_list *ptcon_sav; +phseg_list *ptseg_sav; +phvia_list *ptvia_sav; +phins_list *ptins_sav; +phref_list *ptref_sav; +char *name = namealloc(fname); + + for (ptfig = HEAD_PHFIG; ptfig; ptfig = ptfig->NEXT) { + if (ptfig->NAME == name) + break; + ptfig_sav = ptfig; + } + + if (ptfig == NULL) + return 0; + else if (ptfig == HEAD_PHFIG) + HEAD_PHFIG = ptfig->NEXT; + else + ptfig_sav->NEXT = ptfig->NEXT; + + for (ptins = ptfig->PHINS; ptins; ptins = ptins_sav) { + ptins_sav = ptins->NEXT; + mbkfree((void *)ptins); + } + for (ptseg = ptfig->PHSEG; ptseg; ptseg = ptseg_sav) { + ptseg_sav = ptseg->NEXT; + mbkfree((void *)ptseg); + } + for (ptref = ptfig->PHREF; ptref; ptref = ptref_sav) { + ptref_sav = ptref->NEXT; + mbkfree((void *)ptref); + } + for (ptvia = ptfig->PHVIA; ptvia; ptvia = ptvia_sav) { + ptvia_sav = ptvia->NEXT; + mbkfree((void *)ptvia); + } + for (ptcon = ptfig->PHCON; ptcon; ptcon = ptcon_sav) { + ptcon_sav = ptcon->NEXT; + mbkfree((void *)ptcon); + } + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- delphfig : %s\n", name); + mbkfree((void *)ptfig); + return 1; +} + +/******************************************************************************* +* fonction xyflat * +*******************************************************************************/ +void xyflat(xout, yout, x, y, xins, yins, x1, y1, x2, y2, trsf) +long *xout, *yout; +long x, y; +long xins, yins; +long x1, y1, x2, y2; +char trsf; +{ + switch (trsf) { + case NOSYM : + *xout = xins + x - x1; + *yout = yins + y - y1; + break; + case SYM_X : + *xout = xins - x + x2; + *yout = yins + y - y1; + break; + case SYM_Y : + *xout = xins + x - x1; + *yout = yins - y + y2; + break; + case SYMXY : + *xout = xins - x + x2; + *yout = yins - y + y2; + break; + case ROT_P : + *xout = xins - y + y2; + *yout = yins + x - x1; + break; + case ROT_M : + *xout = xins + y - y1; + *yout = yins - x + x2; + break; + case SY_RP : + *xout = xins + y - y1; + *yout = yins + x - x1; + break; + case SY_RM : + *xout = xins - y + y2; + *yout = yins - x + x2; + break; + } +} + +/******************************************************************************* +* fonction invxyflat * +*******************************************************************************/ +void invxyflat(x, y, xout, yout, xins, yins, x1, y1, x2, y2, trsf) +long *x, *y; +long xout, yout; +long xins, yins; +long x1, y1, x2, y2; +char trsf; +{ + switch (trsf) { + case NOSYM : + *x = xout - xins + x1; + *y = yout - yins + y1; + break; + case SYM_X : + *x = - xout + xins + x2; + *y = yout - yins + y1; + break; + case SYM_Y : + *x = xout - xins + x1; + *y = - yout + yins + y2; + break; + case SYMXY : + *x = - xout + xins + x2; + *y = - yout + yins + y2; + break; + case ROT_P : + *y = - xout + xins + y2; + *x = yout - yins + x1; + break; + case ROT_M : + *y = xout - xins + y1; + *x = - yout + yins + x2; + break; + case SY_RP : + *y = xout - xins + y1; + *x = yout - yins + x1; + break; + case SY_RM : + *y = - xout + xins + y2; + *x = - yout + yins + x2; + break; + } +} + +/******************************************************************************* +* fonction viewph * +* * +* display on screen the content of all physical figures * +*******************************************************************************/ +static const char *layername[LAST_LAYER + 2] = { + "NWELL", + "PWELL", + "NTIE", + "PTIE", + "NDIF", + "PDIF", + "NTRANS", + "PTRANS", + "NTRANS_FAST", + "PTRANS_FAST", + "NTRANS_HVIO", + "PTRANS_HVIO", + "POLY", + "POLY2", + "ALU1", + "ALU2", + "ALU3", + "ALU4", + "ALU5", + "ALU6", + "ALU7", + "ALU8", + "ALU9", + "TPOLY", + "TPOLY2", + "TALU1", + "TALU2", + "TALU3", + "TALU4", + "TALU5", + "TALU6", + "TALU7", + "TALU8", + "TALU9", + "CALU1", + "CALU2", + "CALU3", + "CALU4", + "CALU5", + "CALU6", + "CALU7", + "CALU8", + "CALU9", + "Unknown" +}; + +static const char *vianame[LAST_CONTACT + 2] = { + "CONT_POLY", + "CONT_DIF_N", + "CONT_DIF_P", + "CONT_BODY_N", + "CONT_BODY_P", + "CONT_VIA", + "CONT_VIA2", + "CONT_VIA3", + "CONT_VIA4", + "CONT_VIA5", + "CONT_VIA6", + "CONT_VIA7", + "CONT_VIA8", + "CONT_POLY2", + "C_X_N", + "C_X_P", + "CONT_TURN1", + "CONT_TURN2", + "CONT_TURN3", + "CONT_TURN4", + "CONT_TURN5", + "CONT_TURN6", + "CONT_TURN7", + "CONT_TURN8", + "CONT_TURN9", + "Unknown" +}; + + +void viewph() +{ +phfig_list *pt_fig = NULL; + + if (HEAD_PHFIG == NULL) + (void)fprintf(stderr, "\n!!! viewph : empty list of figures !!!\n"); + else { + for (pt_fig = HEAD_PHFIG; pt_fig; pt_fig = pt_fig->NEXT) + viewphfig(pt_fig); + } +} + +/************************************************************************ +* fonction viewphfig() * +* * +* display on screen the content of physical figure ptfig * +************************************************************************/ +void viewphfig(pt_fig) +phfig_list *pt_fig; +{ +phcon_list *pt_con = NULL; +phins_list *pt_ins = NULL; +chain_list *pt_chain = NULL; +phseg_list *pt_seg = NULL; +phvia_list *pt_via = NULL; +phref_list *pt_ref = NULL; + + if (!pt_fig) + return; + + if (pt_fig->NAME == NULL) + (void)printf("!!! figure without name !!!\n"); + else + (void)printf("\nfigure : %-20s mode : %c\n", pt_fig->NAME, pt_fig->MODE); + + (void)printf(" |---abutment box : %ld %ld %ld %ld\n", + pt_fig->XAB1, pt_fig->YAB1, pt_fig->XAB2, pt_fig->YAB2); + + if (pt_fig->MODELCHAIN == NULL) + (void)printf(" |---empty list of instance names\n"); + else { + (void)printf(" |---models \n"); + for (pt_chain = pt_fig->MODELCHAIN; pt_chain != NULL; pt_chain = pt_chain->NEXT) + (void)printf(" | |---%s \n", (char *)pt_chain->DATA); + } + + if (pt_fig->PHCON == NULL) + (void)printf(" |---empty list of connectors\n"); + else + for (pt_con = pt_fig->PHCON; pt_con != NULL; pt_con = pt_con->NEXT) + viewphcon(pt_con); + + if (pt_fig->PHINS == NULL) + (void)printf(" |---empty list of instances\n"); + else + for (pt_ins = pt_fig->PHINS; pt_ins != NULL; pt_ins = pt_ins->NEXT) + viewphins(pt_ins); + + if (pt_fig->PHSEG == NULL) + (void)printf(" |---empty list of segments\n"); + else + for (pt_seg = pt_fig->PHSEG; pt_seg != NULL; pt_seg = pt_seg->NEXT) + viewphseg(pt_seg); + + if (pt_fig->PHVIA == NULL) + (void)printf(" |---empty list of vias\n"); + else + for (pt_via = pt_fig->PHVIA; pt_via != NULL; pt_via = pt_via->NEXT) + viewphvia(pt_via); + + if (pt_fig->PHREF == NULL) + (void)printf(" |---empty list of references\n"); + else + for (pt_ref = pt_fig->PHREF; pt_ref != NULL; pt_ref = pt_ref->NEXT) + viewphref(pt_ref); + + if (pt_fig->USER != NULL) + (void)printf(" |--- non empty USER field\n"); + (void)printf(" | \n"); +} + +/******************************************************************************/ + +void viewphcon(pt_con) +phcon_list *pt_con; +{ + if (pt_con == NULL) { + (void)printf("!!! viewphcon : null connector pointer !!!\n"); + return; + } + if (pt_con->NAME == NULL) + (void)printf(" |--- !!! connector without name !!!\n"); + else + (void)printf(" |---connector : %s (%ld) \n", pt_con->NAME, pt_con->INDEX); + + (void)printf(" | |---coordinates : X = %ld, Y = %ld \n", + pt_con->XCON, pt_con->YCON); + (void)printf(" | |---orientation : %c \n", pt_con->ORIENT); + (void)printf(" | |---width : %ld \n", pt_con->WIDTH); + + (void)printf(" | |---layer : %s\n", layername[(int)pt_con->LAYER]); + if (pt_con->USER != NULL) + (void)printf(" | |---non empty USER field\n"); + (void)printf(" | \n"); +} + +/******************************************************************************/ +void viewphseg(pt_seg) +phseg_list *pt_seg; +{ + if (pt_seg == NULL) { + (void)printf("!!! viewphseg : null segment pointer !!!\n"); + return; + } + + if (pt_seg->NAME == NULL) + (void)printf(" |--- !!! segment without name !!! \n"); + else + (void)printf(" |---segment : %s \n", pt_seg->NAME); + + (void)printf(" | |---type : %c \n", pt_seg->TYPE); + + (void)printf(" | |---coordinates : X1 = %ld, Y1 = %ld, X2 = %ld, Y2 = %ld \n", pt_seg->X1, pt_seg->Y1, pt_seg->X2, pt_seg->Y2); + + (void)printf(" | |---width : %ld \n", pt_seg->WIDTH); + + (void)printf(" | |---layer : %s\n", layername[(int)pt_seg->LAYER]); + (void)printf(" | |---layer "); + if (pt_seg->USER != NULL) + (void)printf(" | |---non empty USER field\n"); + (void)printf(" | \n"); +} + +void viewphvia(pt_via) +phvia_list *pt_via; +{ + if (pt_via == NULL) { + (void)printf("!!! viewphvia : null via pointeur !!!\n"); + return; + } + (void)printf(" |---via \n"); + (void)printf(" | |---type :%s\n", vianame[(int)pt_via->TYPE]); + (void)printf(" | |---coordinates: X = %ld, Y = %ld, DX = %ld, DY = %ld\n", + pt_via->XVIA, pt_via->YVIA, pt_via->DX, pt_via->DY); + if (pt_via->USER != NULL) + (void)printf(" | |---non empty USER field\n"); + (void)printf(" | \n"); +} + +void viewphins(pt_ins) +phins_list *pt_ins; +{ + if (pt_ins == NULL) { + (void)printf("!!! viewphins : null instance pointer !!! \n"); + return; + } + if (pt_ins->INSNAME == NULL) + (void)printf(" |--- !!! instance without name !!! \n"); + else + (void)printf(" |---instance : %s \n", pt_ins->INSNAME); + + if (pt_ins->FIGNAME == NULL) + (void)printf(" | |--- !!! instance without model !!! \n"); + else + (void)printf(" | |---model : %s \n", pt_ins->FIGNAME); + + (void)printf(" | |---coordinates : X = %ld Y = %ld \n", + pt_ins->XINS, pt_ins->YINS); + + (void)printf(" | |---operation \n"); + switch(pt_ins->TRANSF) { + case NOSYM : + (void)printf(": NOSYM\n"); + break; + case ROT_P : + (void)printf(": ROT_P\n"); + break; + case SYMXY : + (void)printf(": SYMXY\n"); + break; + case ROT_M : + (void)printf(": ROT_M\n"); + break; + case SYM_X : + (void)printf(": SYM_X\n"); + break; + case SYM_Y : + (void)printf(": SYM_Y\n"); + break; + case SY_RP : + (void)printf(": SY_RP\n"); + break; + case SY_RM : + (void)printf(": SY_RM\n"); + break; + default : + (void)printf(": unknown\n"); + } + + if (pt_ins->USER != NULL) + (void)printf(" | |---non empty USER field\n"); + (void)printf(" | \n"); +} + +void viewphref(pt_ref) +phref_list *pt_ref; +{ + if (pt_ref == NULL) { + (void)printf("!!! viewphref : null reference pointer !!!\n"); + return; + } + (void)printf(" |---reference \n"); + (void)printf(" | |---type : %s\n", pt_ref->FIGNAME); + (void)printf(" | |---name : %s\n", pt_ref->NAME); + if (pt_ref->USER != NULL) + (void)printf(" | |---non empty USER field\n"); + (void)printf(" |\n"); +} diff --git a/alliance/src/mbk/src/mbk_ph.h b/alliance/src/mbk/src/mbk_ph.h new file mode 100644 index 00000000..9dced7c1 --- /dev/null +++ b/alliance/src/mbk/src/mbk_ph.h @@ -0,0 +1,70 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : mbk_ph.c header file for functions declarations + * Date : 18/12/91 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mbk_ph.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MBK_PH_H_ +#define _MBK_PH_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + + extern phcon_list * addphcon __P((phfig_list *ptfig, char orient, const char *conname, long x, long y, char layer, long width)); + extern phfig_list * addphfig __P((const char *figname)); + extern phins_list * addphins __P((phfig_list *ptfig, const char *figname, const char *insname, char sym, long x, long y)); + extern phref_list * addphref __P((phfig_list *ptfig, const char *type, const char *name, long x, long y)); + extern phseg_list * addphseg __P((phfig_list *ptfig, char layer, long width, long x1, long y1, long x2, long y2, const char *nodename)); + extern phvia_list * addphvia __P((phfig_list *ptfig, char viatype, long x, long y, long dx, long dy, const char *name)); +static chain_list *addsorted(); + extern void defab __P((phfig_list *ptfig, long x1, long y1, long x2, long y2)); + extern int delphcon __P((phfig_list *ptfig, phcon_list *ptdelcon)); + extern int delphfig __P((const char *name)); + extern int delphins __P((phfig_list *ptfig, const char *insname)); + extern int delphref __P((phfig_list *ptfig, phref_list *ptref)); + extern int delphseg __P((phfig_list *ptfig, phseg_list *ptseg)); + extern int delphvia __P((phfig_list *ptfig, phvia_list *ptvia)); + extern phcon_list * getphcon __P((phfig_list *ptfig, const char *conname, long index)); + extern phins_list * getphins __P((phfig_list *ptfig, const char *insname)); + extern phref_list * getphref __P((phfig_list *ptfig, const char *refname)); + extern void viewphcon __P((phcon_list *pt_con)); + extern void viewphins __P((phins_list *pt_ins)); + extern void viewphseg __P((phseg_list *pt_seg)); + extern void viewphvia __P((phvia_list *pt_via)); + extern void viewphref __P((phref_list *pt_ref)); + extern void viewph __P(()); + extern void viewphfig __P((phfig_list *pt_fig)); + extern void xyflat __P((long *xout, long *yout, long x, long y, long xins, long yins, long x1, long y1, long x2, long y2, char trsf)); + +#endif + diff --git a/alliance/src/mbk/src/mbk_ph_util.c b/alliance/src/mbk/src/mbk_ph_util.c new file mode 100644 index 00000000..9d585fad --- /dev/null +++ b/alliance/src/mbk/src/mbk_ph_util.c @@ -0,0 +1,1212 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : utilites functions for physical view + * Date : 06/03/92 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + */ + +#ident "$Id: mbk_ph_util.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +#include +#include +#include + +#include "mut.h" +#include "mph.h" +#include "mpu.h" +#include "mbk_ph_util.h" + +/******************************************************************************* +* fonction getphfig * +* if mode == 'A' all the figure is requested * +* if mode != 'A' interface only is requested * +*******************************************************************************/ +phfig_list *getphfig(const char *fname, char mode) +{ +phfig_list *ptfig; +char *figname = namealloc(fname); + + /* scan figure_list */ + for (ptfig = HEAD_PHFIG; ptfig; ptfig = ptfig->NEXT) + if (ptfig->NAME == figname) + break; + + if (ptfig == NULL) { /* figure doesn't exist */ + ptfig = (phfig_list *)mbkalloc(sizeof(phfig_list)); + ptfig->NAME = figname; + ptfig->MODELCHAIN = NULL; + ptfig->PHINS = NULL; + ptfig->PHCON = NULL; + ptfig->PHVIA = NULL; + ptfig->PHREF = NULL; + ptfig->PHSEG = NULL; + ptfig->USER = NULL; + ptfig->XAB1 = 0; + ptfig->XAB1 = 0; + ptfig->XAB2 = 0; + ptfig->YAB1 = 0; + ptfig->YAB2 = 0; + ptfig->NEXT = HEAD_PHFIG; + HEAD_PHFIG = ptfig; + if (mode == 'A') { + ptfig->MODE = 'A'; + loadphfig(ptfig, figname, 'A'); + return ptfig; + } else { + ptfig->MODE = 'P'; + loadphfig(ptfig, figname, 'P'); + return ptfig; + } + } + if (ptfig->MODE != 'A') { /* figure exists interface only */ + if (mode == 'A') { + ptfig->MODE = 'A'; + loadphfig(ptfig, figname, 'C'); + return ptfig; + } else + return ptfig; + } else /* figure exists interface and body */ + return ptfig; +} + +/******************************************************************************* +* fonction flattenphfig * +* newtrsf = trsf o ptins->TRANSF +*******************************************************************************/ +void flattenphfig(phfig_list *ptfig, const char *insname, char concat) +{ +phins_list *ptins = NULL; +phseg_list *ptseg = NULL; +phvia_list *ptvia = NULL; +phref_list *ptref = NULL; +phins_list *ptinstbf = NULL; +phfig_list *ptfigtbf = NULL; +phfig_list *pt = NULL; +long x1, y1, x2, y2; +long xins, yins; +long xab1, yab1, xab2, yab2; +long dx, dy; +long vx1, vx2, vy1, vy2; +char trsf; +char newtrsf; +int Layer; + + ptinstbf = getphins(ptfig, insname); + ptfigtbf = getphfig(ptinstbf->FIGNAME, 'A'); + xins = ptinstbf->XINS; + yins = ptinstbf->YINS; + xab1 = ptfigtbf->XAB1; + xab2 = ptfigtbf->XAB2; + yab1 = ptfigtbf->YAB1; + yab2 = ptfigtbf->YAB2; + trsf = ptinstbf->TRANSF; + + /* segments */ + for (ptseg = ptfigtbf->PHSEG; ptseg; ptseg = ptseg->NEXT) { + xyflat(&x1, &y1, ptseg->X1, ptseg->Y1, xins, yins, + xab1, yab1, xab2, yab2, trsf); + xyflat(&x2, &y2, ptseg->X2, ptseg->Y2, xins, yins, + xab1, yab1, xab2, yab2, trsf); + /* we must take care of the segment orientation at that time. + dx and dy are just temporary variables here, no semantic meaning + for sure! */ + switch (trsf) { + case NOSYM : + case SYMXY : + switch (ptseg->TYPE) { + case UP: + case DOWN: dy = y1; y1 = y2; y2 = dy; break; + case RIGHT: + case LEFT: dx = x1; x1 = x2; x2 = dx; break; + } + case ROT_M : + case ROT_P : + switch (ptseg->TYPE) { + case UP: + case DOWN: dx = x1; x1 = x2; x2 = dx; break; + case RIGHT: + case LEFT: dy = y1; y1 = y2; y2 = dy; break; + } + case SYM_X : + case SYM_Y : + switch (ptseg->TYPE) { + case UP: dy = y1; y1 = y2; y2 = dy; break; + case RIGHT: dx = x1; x1 = x2; x2 = dx; break; + case DOWN: + case LEFT: break; + } + case SY_RP : + case SY_RM : + switch (ptseg->TYPE) { + case UP: dx = x1; x1 = x2; x2 = dx; break; + case RIGHT: dy = y1; y1 = y2; y2 = dy; break; + case LEFT: + case DOWN: break; + } + } + Layer = ptseg->LAYER; + + if ( Layer == CALU1 ) Layer = ALU1; + else + if ( Layer == CALU2 ) Layer = ALU2; + else + if ( Layer == CALU3 ) Layer = ALU3; + else + if ( Layer == CALU4 ) Layer = ALU4; + else + if ( Layer == CALU5 ) Layer = ALU5; + else + if ( Layer == CALU6 ) Layer = ALU6; + else + if ( Layer == CALU7 ) Layer = ALU7; + else + if ( Layer == CALU8 ) Layer = ALU8; + else + if ( Layer == CALU9 ) Layer = ALU9; + + if (ptseg->NAME != NULL) + (void)addphseg(ptfig, Layer, ptseg->WIDTH, x1, y1, x2, y2, + concat == NO ? + ptseg->NAME : concatname(insname, ptseg->NAME)); + else + (void)addphseg(ptfig, Layer, ptseg->WIDTH, x1, y1, x2, y2, + (char *)NULL); + } + + /* vias */ + for (ptvia = ptfigtbf->PHVIA; ptvia; ptvia = ptvia->NEXT) { + dx = ptvia->DX >> 1; + dy = ptvia->DY >> 1; + vx1 = ptvia->XVIA - dx; + vy1 = ptvia->YVIA - dy; + vx2 = ptvia->XVIA + dx; + vy2 = ptvia->YVIA + dy; + xyflat(&x1, &y1, vx1, vy1, xins, yins, xab1, yab1, xab2, yab2, trsf); + xyflat(&x2, &y2, vx2, vy2, xins, yins, xab1, yab1, xab2, yab2, trsf); + + if ( x1 > x2 ) { vx1 = x2; vx2 = x1; } + else { vx1 = x1; vx2 = x2; } + + if ( y1 > y2 ) { vy1 = y2; vy2 = y1; } + else { vy1 = y1; vy2 = y2; } + + dx = vx2 - vx1; + dy = vy2 - vy1; + + if (ptvia->NAME != NULL) + (void)addphvia(ptfig, ptvia->TYPE, vx1 + (dx >> 1), vy1 + (dy >> 1), dx, dy, + concat == NO ? ptvia->NAME : concatname(insname, ptvia->NAME)); + else + (void)addphvia(ptfig, ptvia->TYPE, vx1 + (dx >> 1), vy1 + (dy >> 1), dx, dy, NULL ); + } + + /* references */ + for (ptref = ptfigtbf->PHREF; ptref; ptref = ptref->NEXT) { + /* ref_con : + since ref_con is connector like, I shall not copy it up! */ + if (!strcmp(ptref->FIGNAME, "ref_con")) + continue; + xyflat(&x1, &y1, ptref->XREF, ptref->YREF, xins, yins, + xab1, yab1, xab2, yab2, trsf); + if (ptref->NAME != NULL) + (void)addphref(ptfig, ptref->FIGNAME, + concat == NO ? + ptref->NAME : + concatname(insname, ptref->NAME), x1, y1); + else + (void)addphref(ptfig, ptref->FIGNAME, (char *)NULL, x1, y1); + } + + /* instances */ + for (ptins = ptfigtbf->PHINS; ptins; ptins = ptins->NEXT) { + xyflat(&x1, &y1, ptins->XINS, ptins->YINS, xins, yins, + xab1, yab1, xab2, yab2, trsf); + pt = getphfig(ptins->FIGNAME, 'P'); + dx = pt->XAB2 - pt->XAB1; + dy = pt->YAB2 - pt->YAB1; + switch (trsf) { + case NOSYM : + newtrsf = ptins->TRANSF; + break; + case SYM_X : + switch (ptins->TRANSF) { + case NOSYM : newtrsf = SYM_X; x1 -= dx; break; + case SYM_X : newtrsf = NOSYM; x1 -= dx; break; + case SYM_Y : newtrsf = SYMXY; x1 -= dx; break; + case SYMXY : newtrsf = SYM_Y; x1 -= dx; break; + case ROT_P : newtrsf = SY_RP; x1 -= dy; break; + case ROT_M : newtrsf = SY_RM; x1 -= dy; break; + case SY_RP : newtrsf = ROT_P; x1 -= dy; break; + case SY_RM : newtrsf = ROT_M; x1 -= dy; break; + } + break; + case SYM_Y : + switch (ptins->TRANSF) { + case NOSYM : newtrsf = SYM_Y; y1 -= dy; break; + case SYM_X : newtrsf = SYMXY; y1 -= dy; break; + case SYM_Y : newtrsf = NOSYM; y1 -= dy; break; + case SYMXY : newtrsf = SYM_X; y1 -= dy; break; + case ROT_P : newtrsf = SY_RM; y1 -= dx; break; + case ROT_M : newtrsf = SY_RP; y1 -= dx; break; + case SY_RP : newtrsf = ROT_M; y1 -= dx; break; + case SY_RM : newtrsf = ROT_P; y1 -= dx; break; + } + break; + case SYMXY : + switch (ptins->TRANSF) { + case NOSYM : newtrsf = SYMXY; x1 -= dx; y1 -= dy; break; + case SYM_X : newtrsf = SYM_Y; x1 -= dx; y1 -= dy; break; + case SYM_Y : newtrsf = SYM_X; x1 -= dx; y1 -= dy; break; + case SYMXY : newtrsf = NOSYM; x1 -= dx; y1 -= dy; break; + case ROT_P : newtrsf = ROT_M; x1 -= dy; y1 -= dx; break; + case ROT_M : newtrsf = ROT_P; x1 -= dy; y1 -= dx; break; + case SY_RP : newtrsf = SY_RM; x1 -= dy; y1 -= dx; break; + case SY_RM : newtrsf = SY_RP; x1 -= dy; y1 -= dx; break; + } + break; + case ROT_P : + switch (ptins->TRANSF) { + case NOSYM : newtrsf = ROT_P; x1 -= dy; break; + case SYM_X : newtrsf = SY_RM; x1 -= dy; break; + case SYM_Y : newtrsf = SY_RP; x1 -= dy; break; + case SYMXY : newtrsf = ROT_M; x1 -= dy; break; + case ROT_P : newtrsf = SYMXY; x1 -= dx; break; + case ROT_M : newtrsf = NOSYM; x1 -= dx; break; + case SY_RP : newtrsf = SYM_X; x1 -= dx; break; + case SY_RM : newtrsf = SYM_Y; x1 -= dx; break; + } + break; + case ROT_M : + switch (ptins->TRANSF) { + case NOSYM : newtrsf = ROT_M; y1 -= dx; break; + case SYM_X : newtrsf = SY_RP; y1 -= dx; break; + case SYM_Y : newtrsf = SY_RM; y1 -= dx; break; + case SYMXY : newtrsf = ROT_P; y1 -= dx; break; + case ROT_P : newtrsf = NOSYM; y1 -= dy; break; + case ROT_M : newtrsf = SYMXY; y1 -= dy; break; + case SY_RP : newtrsf = SYM_Y; y1 -= dy; break; + case SY_RM : newtrsf = SYM_X; y1 -= dy; break; + } + break; + case SY_RP : + switch (ptins->TRANSF) { + case NOSYM : newtrsf = SY_RP; break; + case SYM_X : newtrsf = ROT_M; break; + case SYM_Y : newtrsf = ROT_P; break; + case SYMXY : newtrsf = SY_RM; break; + case ROT_P : newtrsf = SYM_Y; break; + case ROT_M : newtrsf = SYM_X; break; + case SY_RP : newtrsf = NOSYM; break; + case SY_RM : newtrsf = SYMXY; break; + } + break; + case SY_RM : + switch (ptins->TRANSF) { + case NOSYM : newtrsf = SY_RM; x1 -= dy; y1 -= dx; break; + case SYM_X : newtrsf = ROT_P; x1 -= dy; y1 -= dx; break; + case SYM_Y : newtrsf = ROT_M; x1 -= dy; y1 -= dx; break; + case SYMXY : newtrsf = SY_RP; x1 -= dy; y1 -= dx; break; + case ROT_P : newtrsf = SYM_Y; x1 -= dx; y1 -= dy; break; + case ROT_M : newtrsf = SYM_X; x1 -= dx; y1 -= dy; break; + case SY_RP : newtrsf = SYMXY; x1 -= dx; y1 -= dy; break; + case SY_RM : newtrsf = NOSYM; x1 -= dx; y1 -= dy; break; + } + break; + } + (void)addphins(ptfig, ptins->FIGNAME, concat == NO ? ptins->INSNAME : + concatname(insname, ptins->INSNAME), newtrsf, x1, y1); + } + (void)delphins(ptfig, insname); + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- mbk --- flatten_phfig \n"); +} + +/******************************************************************************* +* fonction loadphfig * +*******************************************************************************/ +void loadphfig(phfig_list *ptfig, const char *figname, char mode) +{ + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, + "--- mbk --- loadphfig : reading file %s.%s mode %c\n", + figname, IN_PH, mode); + if (!strcmp(IN_PH, "cp")) + vtiloadphfig(ptfig, figname, mode); + else if (!strcmp(IN_PH, "ap")) + alcloadphfig(ptfig, figname, mode); + else if (!strcmp(IN_PH, "mg")) + mgnloadphfig(ptfig, figname, mode); + else { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "Unknown physical input format %s\n", IN_PH); + EXIT(1); + } + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, + "--- mbk --- loadphfig : done reading file %s.%s\n", + figname, IN_PH); +} + +/******************************************************************************* +* fonction savephfig * +*******************************************************************************/ +void savephfig(phfig_list *ptfig) +{ + if (!strcmp(OUT_PH, "cp")) + vtisavephfig(ptfig); + else if (!strcmp(OUT_PH, "ap")) + alcsavephfig(ptfig); + else if (!strcmp(OUT_PH, "mg")) + mgnsavephfig(ptfig); + else { + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "Unknown physical output format %s\n", OUT_PH); + EXIT(1); + } +} + +/******************************************************************************* +* function rflattenphfig * +*******************************************************************************/ +void rflattenphfig(phfig_list *ptfig, char concat, char catal) +{ +struct phins *p; + + catal = catal == NO ? 0 : 1; + for (p = ptfig->PHINS; p != NULL;) { + if (!catal || !incatalog(p->FIGNAME) || incatalogdelete(p->FIGNAME)) { + flattenphfig(ptfig, p->INSNAME, concat); + p = ptfig->PHINS; + } + else + p = p->NEXT; + } +} + +/******************************************************************************* +* function instanceface * +* return the orientation of a model connector knowing its face and symetry * +*******************************************************************************/ +char instanceface(face, sym) +char face, sym; +{ + switch (sym) { + case NOSYM : + return face; + case ROT_P : + switch (face) { + case NORTH : + return WEST; + case EAST : + return NORTH; + case SOUTH : + return EAST; + case WEST : + return SOUTH; + } + case SYMXY : + switch (face) { + case NORTH : + return SOUTH; + case EAST : + return WEST; + case SOUTH : + return NORTH; + case WEST : + return EAST; + } + case ROT_M : + switch (face) { + case NORTH : + return EAST; + case EAST : + return SOUTH; + case SOUTH : + return WEST; + case WEST : + return NORTH; + } + case SYM_X : + switch (face) { + case NORTH : + return NORTH; + case EAST : + return WEST; + case SOUTH : + return SOUTH; + case WEST : + return EAST; + } + case SY_RM : + switch (face) { + case NORTH : + return WEST; + case EAST : + return SOUTH; + case SOUTH : + return EAST; + case WEST : + return NORTH; + } + case SYM_Y : + switch (face) { + case NORTH : + return SOUTH; + case EAST : + return EAST; + case SOUTH : + return NORTH; + case WEST : + return WEST; + } + case SY_RP : + switch (face) { + case NORTH : + return EAST; + case EAST : + return NORTH; + case SOUTH : + return WEST; + case WEST : + return SOUTH; + } + } + + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "instanceface impossible :\n"); + (void)fprintf(stderr, "face: %c, sym %c\n", face, sym); + EXIT(1); + return (char)NULL; /* never reached */ +} + +#define BV_VIA_VIA 6 /* must be even, whatever! */ + /* 99/11/9 change from 4 to 6 because of new rules */ +#define BV_VIASIZE 3 /* design rule for equipotential vias actually 2 but somestimes 3 */ +#define BV_SLAYERSIZE 2 /* size of the small layer in the contact */ +#define BV_BLAYERSIZE 2 /* size of the big layer in the contact */ +#define MAX(a,b) ((a) > (b) ? (a) : (b)) +/******************************************************************************* +* this creates a mega-via, the best way we can do it, I hope * +* the envelop of the bigvia is calculated, and then its center is placed * +* as close as possible of the x, y coordinates given as arguments. * +*******************************************************************************/ +void bigvia(f, via, x, y, dx, dy) +phfig_list *f; +char via; +long x, y, dx, dy; +{ +int i, j; +long stepx, stepy, xv, yv, dxv, dyv; +char slayer, blayer; /* small and big layers */ + + if (dx < 0 || dy < 0) { + fflush(stdout); + fprintf(stderr, "*** mbk error ***\n bigvia impossible :"); + fprintf(stderr, " negative values dx = %ld, dy = %ld\n", dx, dy); + fprintf(stderr, "in figure '%s' at (%ld, %ld)\n", f->NAME, x, y); + EXIT(1); + } + dy = (dy < (BV_SLAYERSIZE*SCALE_X)) ? BV_SLAYERSIZE*SCALE_X : dy; + dx = (dx < (BV_BLAYERSIZE*SCALE_X)) ? BV_BLAYERSIZE*SCALE_X : dx; + switch (via) { + case CONT_POLY : + slayer = ALU1; + blayer = POLY; + break; + case CONT_POLY2 : + slayer = ALU1; + blayer = POLY2; + break; + case CONT_VIA : + slayer = ALU1; + blayer = ALU2; + break; + case CONT_VIA2 : + slayer = ALU2; + blayer = ALU3; + break; + case CONT_VIA3 : + slayer = ALU3; + blayer = ALU4; + break; + case CONT_VIA4 : + slayer = ALU4; + blayer = ALU5; + break; + case CONT_VIA5 : + slayer = ALU5; + blayer = ALU6; + break; + case CONT_VIA6 : + slayer = ALU6; + blayer = ALU7; + break; + case CONT_VIA7 : + slayer = ALU7; + blayer = ALU8; + break; + case CONT_VIA8 : + slayer = ALU8; + blayer = ALU9; + break; + case CONT_DIF_N : + slayer = ALU1; + blayer = NDIF; + break; + case CONT_DIF_P : + slayer = ALU1; + blayer = PDIF; + break; + case CONT_BODY_N : + slayer = ALU1; + blayer = NTIE; + break; + case CONT_BODY_P : + slayer = ALU1; + blayer = PTIE; + break; + default :; /* error later on */ + } + /* euclidian division : + dividing and then multipliing doesn't give the initial value. + I calculate the center of the bunch of vias and adjust it to the given + x, y coordinates. */ + stepx = (dx - BV_VIASIZE * SCALE_X) / (BV_VIA_VIA * SCALE_X); + stepy = (dy - BV_VIASIZE * SCALE_X) / (BV_VIA_VIA * SCALE_X); + dxv = stepx * BV_VIA_VIA * SCALE_X; + dyv = stepy * BV_VIA_VIA * SCALE_X; + xv = x - dxv / 2; + yv = y - dyv / 2; + /* draw the vias */ + for (i = 0; i <= stepx; i++) + for (j = 0; j <= stepy; j++) + addphvia(f, via, xv + i * BV_VIA_VIA * SCALE_X, + yv + j * BV_VIA_VIA * SCALE_X, 0, 0, NULL); + /* fill the leftover space : + we assume that layer extension is less or equal to the half size of the + layer in the contact. */ + if (dy) { +/* + * if (dyv) { + * addphseg(f, slayer, dxv + BV_SLAYERSIZE * SCALE_X, + * x, yv, x, yv + dyv, NULL); + * addphseg(f, blayer, dxv + BV_BLAYERSIZE * SCALE_X, + * x, yv, x, yv + dyv, NULL); + */ + addphseg(f, slayer, dx, + x, y - dy/2 + BV_SLAYERSIZE * SCALE_X / 2, + x, y + dy/2 - BV_SLAYERSIZE * SCALE_X / 2, NULL); + addphseg(f, blayer, dx, + x, y - dy/2 + BV_BLAYERSIZE * SCALE_X / 2, + x, y + dy/2 - BV_BLAYERSIZE * SCALE_X / 2, NULL); + } + if (dx) { +/* + * if (dxv) { + * addphseg(f, slayer, dyv + BV_SLAYERSIZE * SCALE_X, + * xv, y, xv + dxv, y, NULL); + * addphseg(f, blayer, dyv + BV_BLAYERSIZE * SCALE_X, + * xv, y, xv + dxv, y, NULL); + */ + addphseg(f, slayer, dy, + x - dx/2 + BV_SLAYERSIZE * SCALE_X / 2, y, + x + dx/2 - BV_SLAYERSIZE * SCALE_X / 2, y, NULL); + addphseg(f, blayer, dy, + x - dx/2 + BV_BLAYERSIZE * SCALE_X / 2, y, + x + dx/2 - BV_BLAYERSIZE * SCALE_X / 2, y, NULL); + } +} +#undef BV_VIA_VIA +#undef BV_VIASIZE +#undef BV_SLAYERSIZE +#undef BV_BLAYERSIZE +#undef MAX + +/******************************************************************************* +* User interactive on-line debugger, for the one unaware of dbx use * +*******************************************************************************/ +struct typoin /* structure used by dast_dbg */ + { /* to store its state */ + short type; /* code of the current structure*/ + short mark; /* stop mark */ + void *data; /* pointer of the structure */ + }; + +#define VHD_ERRDFN -1 +#define VHD__XTDFN 0 +#define VHD__UPDFN 1 +#define VHD__TPDFN 2 +#define VHD__SPDFN 3 +#define VHD__BKDFN 4 + +#define VHD_phfigDFN 5 +#define VHD_nextDFN 6 +#define VHD_modelchainDFN 7 +#define VHD_phsegDFN 8 +#define VHD_phviaDFN 9 +#define VHD_phrefDFN 10 +#define VHD_phinsDFN 11 +#define VHD_phconDFN 12 +#define VHD_nameDFN 13 +#define VHD_modeDFN 14 +#define VHD_xab1DFN 15 +#define VHD_yab1DFN 16 +#define VHD_xab2DFN 17 +#define VHD_yab2DFN 18 +#define VHD_userDFN 19 +#define VHD_indexDFN 20 +#define VHD_xconDFN 21 +#define VHD_yconDFN 22 +#define VHD_widthDFN 23 +#define VHD_orientDFN 24 +#define VHD_layerDFN 25 +#define VHD_x1DFN 26 +#define VHD_y1DFN 27 +#define VHD_x2DFN 28 +#define VHD_y2DFN 29 +#define VHD_typeDFN 30 +#define VHD_xviaDFN 31 +#define VHD_yviaDFN 32 +#define VHD_fignameDFN 33 +#define VHD_xrefDFN 34 +#define VHD_yrefDFN 35 +#define VHD_insnameDFN 36 +#define VHD_xinsDFN 37 +#define VHD_yinsDFN 38 +#define VHD_transfDFN 39 +#define VHD_ptypeDFN 40 +#define VHD_dataDFN 41 + +#define VHD_MAXDFN 42 + +static int vhd_getcmd(); +static int vhd_hash(); + +void mphdebug(head_pnt,stru_name) + +void *head_pnt; +char *stru_name; + + { + + int i; + int state; + int newsta0; + int readcmd = 0; + char readtab[3][20]; + int stk_pnt = 0; + int type = VHD__XTDFN; + struct chain *ptchain; + + struct typoin current_pnt; + struct typoin stk[200]; + + char empty[4]; + char avail[12]; + + int key[VHD_MAXDFN]; + char *tab[VHD_MAXDFN]; + void *nxt[VHD_MAXDFN]; + short typ[VHD_MAXDFN]; + + struct phfig *phfig_pnt; + struct phseg *phseg_pnt; + struct phvia *phvia_pnt; + struct phref *phref_pnt; + struct phins *phins_pnt; + struct phcon *phcon_pnt; + struct ptype *ptype_pnt; + + key[VHD_phfigDFN] = vhd_hash ("phfig"); + key[VHD_nextDFN] = vhd_hash ("next"); + key[VHD_modelchainDFN] = vhd_hash ("modelchain"); + key[VHD_phsegDFN] = vhd_hash ("phseg"); + key[VHD_phviaDFN] = vhd_hash ("phvia"); + key[VHD_phrefDFN] = vhd_hash ("phref"); + key[VHD_phinsDFN] = vhd_hash ("phins"); + key[VHD_phconDFN] = vhd_hash ("phcon"); + key[VHD_nameDFN] = vhd_hash ("name"); + key[VHD_modeDFN] = vhd_hash ("mode"); + key[VHD_xab1DFN] = vhd_hash ("xab1"); + key[VHD_yab1DFN] = vhd_hash ("yab1"); + key[VHD_xab2DFN] = vhd_hash ("xab2"); + key[VHD_yab2DFN] = vhd_hash ("yab2"); + key[VHD_userDFN] = vhd_hash ("user"); + key[VHD_indexDFN] = vhd_hash ("index"); + key[VHD_xconDFN] = vhd_hash ("xcon"); + key[VHD_yconDFN] = vhd_hash ("ycon"); + key[VHD_widthDFN] = vhd_hash ("width"); + key[VHD_orientDFN] = vhd_hash ("orient"); + key[VHD_layerDFN] = vhd_hash ("layer"); + key[VHD_x1DFN] = vhd_hash ("x1"); + key[VHD_y1DFN] = vhd_hash ("y1"); + key[VHD_x2DFN] = vhd_hash ("x2"); + key[VHD_y2DFN] = vhd_hash ("y2"); + key[VHD_typeDFN] = vhd_hash ("type"); + key[VHD_xviaDFN] = vhd_hash ("xvia"); + key[VHD_yviaDFN] = vhd_hash ("yvia"); + key[VHD_fignameDFN] = vhd_hash ("figname"); + key[VHD_xrefDFN] = vhd_hash ("xref"); + key[VHD_yrefDFN] = vhd_hash ("yref"); + key[VHD_insnameDFN] = vhd_hash ("insname"); + key[VHD_xinsDFN] = vhd_hash ("xins"); + key[VHD_yinsDFN] = vhd_hash ("yins"); + key[VHD_transfDFN] = vhd_hash ("transf"); + key[VHD_ptypeDFN] = vhd_hash ("ptype"); + key[VHD_dataDFN] = vhd_hash ("data"); + + /* ###------------------------------------------------------### */ + /* Set of predefined commands */ + /* ###------------------------------------------------------### */ + + key[0] = vhd_hash ("_exit"); + key[1] = vhd_hash ("_up"); + key[2] = vhd_hash ("_top"); + key[3] = vhd_hash ("_stop"); + key[4] = vhd_hash ("_back"); + + (void)strcpy (empty,""); + (void)strcpy (avail,"AVAILABLE"); + + for (i=0 ; iNEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)phfig_pnt->NEXT; + typ[VHD_nextDFN] = VHD_phfigDFN; + } + if (phfig_pnt->PHSEG != NULL) + { + tab[VHD_phsegDFN] = avail; + nxt[VHD_phsegDFN] = (void *)phfig_pnt->PHSEG; + typ[VHD_phsegDFN] = VHD_phsegDFN; + } + if (phfig_pnt->PHVIA != NULL) + { + tab[VHD_phviaDFN] = avail; + nxt[VHD_phviaDFN] = (void *)phfig_pnt->PHVIA; + typ[VHD_phviaDFN] = VHD_phviaDFN; + } + if (phfig_pnt->PHREF != NULL) + { + tab[VHD_phrefDFN] = avail; + nxt[VHD_phrefDFN] = (void *)phfig_pnt->PHREF; + typ[VHD_phrefDFN] = VHD_phrefDFN; + } + if (phfig_pnt->PHINS != NULL) + { + tab[VHD_phinsDFN] = avail; + nxt[VHD_phinsDFN] = (void *)phfig_pnt->PHINS; + typ[VHD_phinsDFN] = VHD_phinsDFN; + } + if (phfig_pnt->PHCON != NULL) + { + tab[VHD_phconDFN] = avail; + nxt[VHD_phconDFN] = (void *)phfig_pnt->PHCON; + typ[VHD_phconDFN] = VHD_phconDFN; + } + if (phfig_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)phfig_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" name : %s\n",phfig_pnt->NAME); + (void)printf (" modelchain :\n"); + ptchain = phfig_pnt->MODELCHAIN; + while (ptchain != NULL) + { + (void)printf (" %s\n",(char *)ptchain->DATA); + ptchain = ptchain->NEXT; + } + (void)printf ("-> phseg : %s\n",tab[VHD_phsegDFN]); + (void)printf ("-> phvia : %s\n",tab[VHD_phviaDFN]); + (void)printf ("-> phref : %s\n",tab[VHD_phrefDFN]); + (void)printf ("-> phins : %s\n",tab[VHD_phinsDFN]); + (void)printf ("-> phcon : %s\n",tab[VHD_phconDFN]); + (void)printf (" mode : %c\n",phfig_pnt->MODE); + (void)printf (" yab2 : %ld\n",phfig_pnt->YAB2); + (void)printf (" xab2 : %ld\n",phfig_pnt->XAB2); + (void)printf (" yab1 : %ld\n",phfig_pnt->YAB1); + (void)printf (" xab1 : %ld\n",phfig_pnt->XAB1); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_phconDFN): + + /* ###--------- phcon ---------### */ + + phcon_pnt = (struct phcon *)(current_pnt.data); + + if (phcon_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)phcon_pnt->NEXT; + typ[VHD_nextDFN] = VHD_phconDFN; + } + if (phcon_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)phcon_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" name : %s\n",phcon_pnt->NAME ? phcon_pnt->NAME : "NULL" ); + (void)printf (" index : %ld\n",phcon_pnt->INDEX); + (void)printf (" ycon : %ld\n",phcon_pnt->YCON); + (void)printf (" xcon : %ld\n",phcon_pnt->XCON); + (void)printf (" width : %ld\n",phcon_pnt->WIDTH); + (void)printf (" orient : %c\n",phcon_pnt->ORIENT); + (void)printf (" layer : %c\n",phcon_pnt->LAYER); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_phsegDFN): + + /* ###--------- phseg ---------### */ + + phseg_pnt = (struct phseg *)(current_pnt.data); + + if (phseg_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)phseg_pnt->NEXT; + typ[VHD_nextDFN] = VHD_phsegDFN; + } + if (phseg_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)phseg_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" name : %s\n",phseg_pnt->NAME ? phseg_pnt->NAME : "NULL" ); + (void)printf (" y2 : %ld\n",phseg_pnt->Y2); + (void)printf (" x2 : %ld\n",phseg_pnt->X2); + (void)printf (" y1 : %ld\n",phseg_pnt->Y1); + (void)printf (" x1 : %ld\n",phseg_pnt->X1); + (void)printf (" width : %ld\n",phseg_pnt->WIDTH); + (void)printf (" type : %c\n",phseg_pnt->TYPE); + (void)printf (" layer : %c\n",phseg_pnt->LAYER); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_phviaDFN): + + /* ###--------- phvia ---------### */ + + phvia_pnt = (struct phvia *)(current_pnt.data); + + if (phvia_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)phvia_pnt->NEXT; + typ[VHD_nextDFN] = VHD_phviaDFN; + } + if (phvia_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)phvia_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" name : %s\n",phvia_pnt->NAME ? phvia_pnt->NAME : "NULL" ); + (void)printf (" type : %c\n",phvia_pnt->TYPE); + (void)printf (" yvia : %ld\n",phvia_pnt->YVIA); + (void)printf (" xvia : %ld\n",phvia_pnt->XVIA); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_phrefDFN): + + /* ###--------- phref ---------### */ + + phref_pnt = (struct phref *)(current_pnt.data); + + if (phref_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)phref_pnt->NEXT; + typ[VHD_nextDFN] = VHD_phrefDFN; + } + if (phref_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)phref_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" figname : %s\n",phref_pnt->FIGNAME); + (void)printf (" name : %s\n",phref_pnt->NAME ? phref_pnt->NAME : "NULL" ); + (void)printf (" yref : %ld\n",phref_pnt->YREF); + (void)printf (" xref : %ld\n",phref_pnt->XREF); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_phinsDFN): + + /* ###--------- phins ---------### */ + + phins_pnt = (struct phins *)(current_pnt.data); + + if (phins_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)phins_pnt->NEXT; + typ[VHD_nextDFN] = VHD_phinsDFN; + } + if (phins_pnt->USER != NULL) + { + tab[VHD_userDFN] = avail; + nxt[VHD_userDFN] = (void *)phins_pnt->USER; + typ[VHD_userDFN] = VHD_ptypeDFN; + } + + (void)printf (" insname : %s\n",phins_pnt->INSNAME); + (void)printf (" figname : %s\n",phins_pnt->FIGNAME); + (void)printf (" yins : %ld\n",phins_pnt->YINS); + (void)printf (" xins : %ld\n",phins_pnt->XINS); + (void)printf (" transf : %c\n",phins_pnt->TRANSF); + (void)printf ("-> user : %s\n",tab[VHD_userDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + case (VHD_ptypeDFN): + + /* ###--------- ptype ---------### */ + + ptype_pnt = (struct ptype *)(current_pnt.data); + + if (ptype_pnt->NEXT != NULL) + { + tab[VHD_nextDFN] = avail; + nxt[VHD_nextDFN] = (void *)ptype_pnt->NEXT; + typ[VHD_nextDFN] = VHD_ptypeDFN; + } + if (ptype_pnt->DATA != NULL) + { + tab[VHD_dataDFN] = avail; + nxt[VHD_dataDFN] = (void *)ptype_pnt->DATA; + typ[VHD_dataDFN] = VHD_ERRDFN; +/*......typ[VHD_dataDFN] = .......................*/ + } + + (void)printf (" type : %ld\n",ptype_pnt->TYPE); + (void)printf ("-> data : %s\n",tab[VHD_dataDFN]); + (void)printf ("-> next : %s\n",tab[VHD_nextDFN]); + + break; + + } + + /* ###------------------------------------------------------### */ + /* Reading new command */ + /* ###------------------------------------------------------### */ + + readcmd = vhd_getcmd (readtab); + + for (i=0 ; i> "); + comd0[0] = '\0'; + comd1[0] = '\0'; + comd2[0] = '\0'; + (void)fgets( readstr, 60, stdin ); + (void)sscanf (readstr,"%s%s%s",comd0,comd1,comd2); + + if (strcmp(comd0,".")) + { + (void)strcpy (prvcmd[0], comd0); + (void)strcpy (prvcmd[1], comd1); + (void)strcpy (prvcmd[2], comd2); + } + code = vhd_hash (prvcmd[0]); + + (void)printf ("\n\n\n\n\n"); + return (code); + } + + + +static int vhd_hash (str) + +char *str; + + { + int code = 0; + + while(*str != '\0') + code = code<<1 ^ *str++; + + return (code); + } diff --git a/alliance/src/mbk/src/mbk_ph_util.h b/alliance/src/mbk/src/mbk_ph_util.h new file mode 100644 index 00000000..6f02afa7 --- /dev/null +++ b/alliance/src/mbk/src/mbk_ph_util.h @@ -0,0 +1,50 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : mbk_ph_util.c header file for utilities functions declarations + * Date : 18/12/91 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mbk_ph_util.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MBK_PH_UTIL_H_ +#define _MBK_PH_UTIL_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + + extern phfig_list * getphfig __P((const char *figname, char mode)); + extern void loadphfig __P((phfig_list *ptfig, const char *figname, char mode)); + extern void savephfig __P((phfig_list *ptfig)); + extern void rflattenphfig __P((phfig_list *ptfig, char concat, char catal)); + extern void flattenphfig __P((phfig_list *ptfig, const char *insname, char concat)); + +#endif + diff --git a/alliance/src/mbk/src/mbk_sys.c b/alliance/src/mbk/src/mbk_sys.c new file mode 100644 index 00000000..121d240e --- /dev/null +++ b/alliance/src/mbk/src/mbk_sys.c @@ -0,0 +1,903 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : system dependant functions + * Date : 06/03/92 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + */ + +#ident "$Id: mbk_sys.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mut.h" +#include "mbk_sys.h" + +static char filename[BUFSIZ]; +char MBKFOPEN_NAME[BUFSIZ]; +char MBKFOPEN_FILTER; +endchld_list *HEAD_ENDCHLD=NULL; +endchld_list *HEAD_ENDCHLD_FREE=NULL; +int STAT_ENDCHLD; +autoackchld_list *HEAD_AUTOACKCHLD=NULL; +autoackchld_list *HEAD_AUTOACKCHLD_FREE=NULL; +int STAT_AUTOACKCHLD; + +long mbkalloc_stat = 0; /* statistics on maximun allocated memory */ + +void *mbkalloc(unsigned int nbytes) +{ +void *pt; + + mbkalloc_stat += nbytes; + if (!(pt = malloc(nbytes))) { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***\n"); + (void)fprintf(stderr,"fatal mbkalloc error : not enough memory\n"); + EXIT(1); + } + return pt; +} + +void *mbkrealloc(void *pt, unsigned int nbytes) +{ + + mbkalloc_stat += nbytes; + if (!(pt = realloc(pt, nbytes))) { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***\n"); + (void)fprintf(stderr,"fatal mbkrealloc error : not enough memory\n"); + EXIT(1); + } + return pt; +} + +void mbkfree(void *ptr) +{ + (void)free(ptr); +} + +char *mbkgetenv(const char *name) +{ +char *value; + + if (name == NULL) + fprintf(stdout, "--- mbk --- ERROR : mbkgetenv(NULL)\n"); + + value = getenv(name); + + if (TRACE_GETENV) { + fprintf(stdout, "--- mbk --- mbkgetenv %s : %s\n", + name ? name : "NULL", value ? value : "NULL"); + } + + return value; +} + + +/* file opening : + defines the strategy used for searching and opening file in the + mbk environement. */ +FILE* mbkfopen(const char *name, const char *extension, const char *mode) +{ + FILE *ptf; + + ptf = mbkfopentrace(name, extension, mode); + if(( TRACE_FILE == 1 ) || (( TRACE_FILE == 3 ) && (ptf != NULL ))) + { + fflush( stdout ); + fprintf( stderr, + "*** mbkfopen( \"%s\", \"%s\", \"%s\" ) -> %s\n", + name, + extension ? extension : "", + mode, + ptf ? MBKFOPEN_NAME : "FAILED" + ); + } + return ptf; +} + +void mbkfopen_infos(const FILE *in, const char *filename, const char *name, const char *extension, const char *mode, const char filter) +{ + if( in ) + { + strcpy( MBKFOPEN_NAME, filename ); + MBKFOPEN_FILTER = filter; + } + + if( TRACE_FILE == 2 ) + { + /* La methode de Czo : y parait qu'on peut debugger avec ca... */ + fprintf( stdout, + "--- mbk --- mbkfopen %s : %s, (%s,%s,%s)\n", + in ? "ok" : "FAILED", + filename, + name, + extension ? extension : "", + mode + ); + } +} + +FILE *mbkfopentrace(const char *name, const char *extension, const char *mode) +{ +FILE *in=NULL; +FILE *insav; +int i; + + +if (!CATA_LIB || !WORK_LIB) + mbkenv(); /* not done yet */ + + + if( *mode == 'w' ) + { + if( OUT_FILTER && FILTER_SFX ) + { + if (extension) + (void)sprintf( filename, + "%s/%s.%s%s", + WORK_LIB, + name, + extension, + FILTER_SFX + ); + else + (void)sprintf(filename, "%s/%s%s", WORK_LIB, name, FILTER_SFX ); + + strcpy( MBKFOPEN_NAME, filename ); + in = mbkpopen( filename, OUT_FILTER, 'w' ); + mbkfopen_infos( in, filename, name, extension, mode, YES ); + if (extension) + (void)sprintf( filename, + "%s/%s.%s", + WORK_LIB, + name, + extension + ); + else + (void)sprintf(filename, "%s/%s", WORK_LIB, name ); + if((insav = fopen(filename,READ_TEXT)) != NULL) + { + fflush( stdout ); + fprintf( stderr, + "*** mbk warning : file %s already exist in the drive directory\n", filename) ; + fprintf( stderr, "it will be deleted\n" ) ; + fflush( stderr ); + unlink(filename) ; + fclose(insav) ; + } + return ( in ); + } + else + { + if (extension) + (void)sprintf( filename, + "%s/%s.%s", + WORK_LIB, + name, + extension + ); + else + (void)sprintf(filename, "%s/%s", WORK_LIB, name ); + + strcpy( MBKFOPEN_NAME, filename ); + in = fopen( filename, WRITE_TEXT ) ; + mbkfopen_infos( in, filename, name, extension, mode, NO ); + return ( in ); + } + } + else + if( *mode == 'r' ) + { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf( filename, + "%s/%s.%s", + WORK_LIB, + name, + extension + ); + else + (void)sprintf(filename, "%s/%s", WORK_LIB, name); + + in = fopen( filename, READ_TEXT ); + mbkfopen_infos( in, filename, name, extension, mode, NO ); + if( in ) + { + if( FILTER_SFX && IN_FILTER ) + { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf( filename, + "%s/%s.%s%s", + WORK_LIB, + name, + extension, + FILTER_SFX + ); + else + (void)sprintf(filename, "%s/%s%s", WORK_LIB, name , FILTER_SFX); + if((insav = fopen(filename,READ_TEXT)) != NULL) + { + fflush( stdout ); + fprintf( stderr, + "*** mbk warning : file %s also exist it will be ignored\n", filename) ; + fflush( stderr ); + fclose(insav) ; + } + } + return in; + } + + if( FILTER_SFX && IN_FILTER ) + { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf( filename, + "%s/%s.%s%s", + WORK_LIB, + name, + extension, + FILTER_SFX + ); + else + (void)sprintf(filename, "%s/%s%s", WORK_LIB, name, FILTER_SFX ); + + in = mbkpopen( filename, IN_FILTER, 'r' ); + mbkfopen_infos( in, filename, name, extension, mode, YES ); + if( in ) + return in ; + } + + i=0; + + while (CATA_LIB[i]) + { + if (extension) + (void)sprintf( filename, + "%s/%s.%s", + CATA_LIB[i], + name, + extension + ); + else + (void)sprintf( filename, + "%s/%s", + CATA_LIB[i], + name + ); + + in = fopen( filename, READ_TEXT ); + mbkfopen_infos( in, filename, name, extension, mode, NO ); + if( in ) + { + if( FILTER_SFX && IN_FILTER ) + { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf( filename, + "%s/%s.%s%s", + CATA_LIB[i], + name, + extension , + FILTER_SFX + ); + else + (void)sprintf(filename, "%s/%s%s", CATA_LIB[i], name ,FILTER_SFX); + if((insav = fopen(filename,READ_TEXT)) != NULL) + { + fflush( stdout ); + fprintf( stderr, + "*** mbk warning : file %s also exist it will be ignored\n", filename) ; + fflush( stderr ); + fclose(insav) ; + } + } + return( in ); + } + + if( FILTER_SFX && IN_FILTER ) + { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf( filename, + "%s/%s.%s%s", + CATA_LIB[i], + name, + extension, + FILTER_SFX + ); + else + (void)sprintf(filename, "%s/%s%s", CATA_LIB[i], name, FILTER_SFX ); + + in = mbkpopen( filename, IN_FILTER, 'r' ); + mbkfopen_infos( in, filename, name, extension, mode, YES ); + if( in ) + { + return in ; + } + } + + i++; + } + return( NULL ); + } + else + { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "unknown file opening mode %s\n", mode); + EXIT(1); + } + + return NULL; /* never reached */ +} + +/* unlink : + ensures that only files in the working library may be erased. */ +int mbkunlink(const char *name, const char *extension) +{ + if (!CATA_LIB || !WORK_LIB) + mbkenv(); /* not done yet */ + + if (extension) /* if extension is null, no dot is required */ + (void)sprintf(filename, "%s/%s.%s", WORK_LIB, name, extension); + else + (void)sprintf(filename, "%s/%s", WORK_LIB, name); + + return unlink(filename); +} + +/* filepath : + find the complete path of file from mbkfopen point of view. */ +char *filepath(const char *name, const char *extension) +{ +FILE *in; +int i ; + + if (!CATA_LIB || !WORK_LIB) + mbkenv(); /* not done yet */ + + if (extension) /* if extension is null, no dot is required */ + (void)sprintf(filename, "%s/%s.%s", WORK_LIB, name, extension ); + else + (void)sprintf(filename, "%s/%s", WORK_LIB, name ); + + if ((in = fopen(filename, READ_TEXT))) { + (void)fclose(in); + return filename; + } + + if( FILTER_SFX && IN_FILTER ) + { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf(filename, "%s/%s.%s%s", WORK_LIB, name, extension, FILTER_SFX ); + else + (void)sprintf(filename, "%s/%s%s", WORK_LIB, name, FILTER_SFX ); + + if ((in = fopen(filename, READ_TEXT))) { + (void)fclose(in); + return filename; + } + } + + + i = 0; + while (CATA_LIB[i]) { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf(filename, "%s/%s.%s", CATA_LIB[i], name, extension ); + else + (void)sprintf(filename, "%s/%s", CATA_LIB[i], name ); + + if ((in = fopen(filename, READ_TEXT))) { + (void)fclose(in); + return filename; + } + + if( FILTER_SFX && IN_FILTER ) + { + if (extension) /* if extension is null, no dot is required */ + (void)sprintf(filename, "%s/%s.%s%s", CATA_LIB[i], name, extension, FILTER_SFX ); + else + (void)sprintf(filename, "%s/%s%s", CATA_LIB[i], name, FILTER_SFX ); + + if ((in = fopen(filename, READ_TEXT))) { + (void)fclose(in); + return filename; + } + } + i++; + } + return NULL; +} + +/* mbkpopen : open a pipe with a filter, return a FILE* + * Gregoire.Avot + */ + +FILE* mbkpopen(const char *nom, const char *filter, char mode) +{ + int ptf[2]; + static int fic; + int pid; + FILE *file; + char **argv; + + if( mode == 'w' ) + fic = open( nom, + O_WRONLY|O_CREAT|O_TRUNC, + S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH + ); + else + fic = open( nom, O_RDONLY ); + + if( fic == -1 ) + return( NULL ); + + if( pipe( ptf ) == -1 ) + { + fflush( stdout ); + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" )\n", nom ); + perror( "pipe() "); + EXIT(1); + } + +#ifndef AUTO_HAS_VFORK + pid = fork(); +#else + pid = vfork(); +#endif + + if( pid == -1 ) + { + fflush( stdout ); + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" )\n", nom ); + perror( "(v)fork() "); + EXIT(1); + } + + if( pid == 0 ) + { + /* fils */ + fflush( stdout ); + + argv = decompfilter( filter ); + if( argv == NULL ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + fprintf( stderr, "Bad filter.\n" ); + EXIT(1); + } + + if( mode == 'w' ) + { + if( dup2( ptf[0], 0 ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "dup2( ptf[0], 0 ) "); + EXIT(1); + } + + if( dup2( fic, 1 ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "dup2( fic, 1 ) "); + EXIT(1); + } + } + else + { + if( dup2( ptf[1], 1 ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "dup2( ptf[1], 1 ) "); + EXIT(1); + } + + if( dup2( fic, 0 ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "dup2( fic, 0 ) "); + EXIT(1); + } + } + + if( close( fic ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "close( fic ) "); + EXIT(1); + } + + if( close( ptf[1] ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "close( ptf[1] ) "); + EXIT(1); + } + + if( close( ptf[0] ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "close( ptf[0] ) "); + EXIT(1); + } + + if( execvp( argv[0], &(argv[1]) ) == -1 ) + { + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) child\n", nom ); + perror( "execvp " ); + EXIT(1); + } + } + + mbksetautoackchld( pid ); + close( fic ); + + if( mode == 'w' ) + { + if( close( ptf[0] ) == -1 ) + { + fflush( stdout ); + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) parent\n", nom ); + perror( "close( ptf[0] ) "); + EXIT(1); + } + + file = fdopen( ptf[1], "w" ); + if( file == NULL ) + { + fflush( stdout ); + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) parent\n", nom ); + perror( "fdopen( ptf[1], \"w\" ) "); + EXIT(1); + } + } + else + { + if( close( ptf[1] ) == -1 ) + { + fflush( stdout ); + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) parent\n", nom ); + perror( "close( ptf[1] ) "); + EXIT(1); + } + + file = fdopen( ptf[0], "r" ); + if( file == NULL ) + { + fflush( stdout ); + fprintf( stderr, "*** Fatal error in mbkpopen( \"%s\" ) parent\n", nom ); + perror( "fdopen( ptf[0], \"r\" ) "); + EXIT(1); + } + } + + return( file ); +} + +char **decompfilter( const char *filter ) +{ + int pos; + int i; + char *pt; + char *fullpath; + char *argv0; + char *argvn; + chain_list *head; + chain_list *scan; + int nbarg; + char **ret; + + /* remove trailing space */ + for( pos = 0 ; filter[pos] == ' ' && filter[pos] != 0 ; pos++ ); + if( filter[pos] == 0 ) + return( NULL ); + + /* The full path to binairie */ + for( i = pos ; filter[i] != ' ' && filter[i] != 0 ; i++ ); + fullpath = (char*)mbkalloc( sizeof(char) * ( i-pos+1 ) ); + strncpy( fullpath, filter+pos, i-pos ); + fullpath[i-pos] = 0; + pos = i; + + /* The binairie himself */ + pt = strrchr( fullpath, '/' ); + argv0 = (char*)mbkalloc( sizeof( char ) * (strlen( fullpath ) + 1) ); + if( pt == NULL ) + strcpy( argv0, fullpath ); + else + strcpy( argv0, pt+sizeof(char) ); + + /* The arguments */ + head = NULL; + nbarg=2; + + do + { + for( ; filter[pos] == ' ' && filter[pos] != 0 ; pos++ ); + if( filter[pos] == 0 ) + break; + + for( i = pos ; filter[i] != ' ' && filter[i] != 0 ; i++ ); + argvn = (char*)mbkalloc( sizeof( char ) * ( i-pos+1 ) ); + strncpy( argvn, filter+pos, i-pos ); + argvn[i-pos] = 0; + pos = i; + head = addchain( head, argvn ); + nbarg++; + } + while( 1 ); + + head = reverse( head ); + + ret = (char**)mbkalloc( sizeof(char*) * (nbarg+1) ); + + ret[0] = fullpath; + ret[1] = argv0; + + for( scan = head, pos=2 ; scan ; scan = scan->NEXT, pos++ ) + ret[pos] = scan->DATA; + ret[pos] = NULL; + + freechain( head ); + + return( ret ); +} + +void mbkackchld( int sig ) +{ + int pid; + int status; + endchld_list *new; + int err; + autoackchld_list *scanauto, *prevauto; + + /* Le handlert d'interruption SIGCHLD. Il doit avoir été configuré pour ne + * pas être interrompu par lui même. */ + + if( sig != SIGCHLD ) + { + fflush( stdout ); + fprintf( stderr, + "*** mbk warning : call of mbkackchld with signal %d\n", + (int)sig + ); + return; + } + + do + { + errno = 0; + pid = waitpid( -1, &status, WNOHANG ); + err = errno ; + if( pid > 0 ) + { + for( scanauto = HEAD_AUTOACKCHLD, prevauto=NULL ; + scanauto ; + scanauto = scanauto->NEXT + ) + { + if( scanauto->PID == pid ) + break; + prevauto = scanauto ; + } + + if( scanauto ) + { + /* Process was previously put in the list auto acknowledge. */ + if( prevauto ) + prevauto->NEXT = scanauto->NEXT; + else + HEAD_AUTOACKCHLD = scanauto->NEXT; + + mbkfreeautoackchld( scanauto ); + } + else + { + /* Put process in the waiting queue to be read by user */ + new = mbkgetendchld(); + new->NEXT = HEAD_ENDCHLD; + HEAD_ENDCHLD = new; + new->PID = pid; + new->STATUS = status; + } + } + } + while( pid != 0 && err != ECHILD ); + +} + +/* Sur les architectures multipro, on peut avoir un malloc() interrompu par + * un signal. Si ou alloue une structure endchld_list avec un malloc dans le + * handler, on aura une réentrance du malloc. Cette caractéristiques n'est pour + * l'instant pas supportée. */ + +endchld_list* mbkgetendchld( void ) +{ + endchld_list *new; + + /* Cette fonction ne doit être appellée qu'à partir du handler du signal + * SIGCHLD. Si cela devait changer, il faudrait la protéger contre la + * réception de ce signal */ + + if( ! HEAD_ENDCHLD_FREE ) + { + fflush( stdout ); + fprintf( stderr, + "\n*** mbk ERROR : Not enought free slot in mbkgetfreeendchld().\n" + ); + exit(1); + } + + new = HEAD_ENDCHLD_FREE ; + HEAD_ENDCHLD_FREE = HEAD_ENDCHLD_FREE->NEXT ; + + STAT_ENDCHLD++; + return( new ); +} + +void mbkfreeendchld( endchld_list *bloc ) +{ + sigset_t set; + + /* Cette fonction est appellée à partir de mbkwaitpid(). Il peut y avoir une + * corruption de la liste si un signal SIGCHLD intervient entre les deux + * lignes puisque le handler appellera mbkgetendchld... */ + + /* On masque temporairement le signal embétant */ + sigemptyset( &set ); + sigaddset( &set, SIGCHLD ); + sigprocmask( SIG_BLOCK, &set, NULL ); + + + bloc->NEXT = HEAD_ENDCHLD_FREE ; + HEAD_ENDCHLD_FREE = bloc ; + + STAT_ENDCHLD--; + /* On le demasque. Si il y en a un qui est arrivé entre temps, il sera pris + * en compte maintenant. */ + /* sigrelse(SIGCHLD); (non défini sous SunOs) */ + sigprocmask( SIG_UNBLOCK, &set, NULL ); +} + +void mbkinitendchld( ) +{ + endchld_list *bloc; + int n; + + /* Là, pas de problèmes : le handler n'est pas encore positionné quand cette + * fonction est appellée. */ + bloc = (endchld_list*)mbkalloc( sizeof( endchld_list ) * ENDCHLD_MAX ); + n = ENDCHLD_MAX - 1; + bloc[n].NEXT = NULL ; + while( n > 0 ) + { + n-- ; + bloc[n].NEXT = &( bloc[n+1] ); + } + HEAD_ENDCHLD_FREE = &(bloc[0]); + STAT_ENDCHLD=0; +} + +autoackchld_list* mbkgetautoackchld( void ) +{ + autoackchld_list *new; + + if( ! HEAD_AUTOACKCHLD_FREE ) + { + fflush( stdout ); + fprintf( stderr, + "\n*** mbk ERROR : Not enought free slot in mbkgetautoackchld().\n" + ); + exit(1); + } + + new = HEAD_AUTOACKCHLD_FREE ; + HEAD_AUTOACKCHLD_FREE = HEAD_AUTOACKCHLD_FREE->NEXT ; + + STAT_AUTOACKCHLD++; + return( new ); +} + +void mbkfreeautoackchld( autoackchld_list *bloc ) +{ + bloc->NEXT = HEAD_AUTOACKCHLD_FREE ; + HEAD_AUTOACKCHLD_FREE = bloc ; + STAT_AUTOACKCHLD--; +} + +void mbkinitautoackchld( void ) +{ + autoackchld_list *bloc; + int n; + + bloc=(autoackchld_list*)mbkalloc( sizeof( autoackchld_list ) * ENDCHLD_MAX ); + n = AUTOACKCHLD_MAX - 1; + bloc[n].NEXT = NULL ; + while( n > 0 ) + { + n-- ; + bloc[n].NEXT = &( bloc[n+1] ); + } + HEAD_AUTOACKCHLD_FREE = &(bloc[0]); + STAT_AUTOACKCHLD=0; +} + +void mbksetautoackchld( int pid ) +{ + endchld_list *scan, *prev ; + autoackchld_list *new; + sigset_t set; + + /* Fonction utilisateur : on met dans la liste HEAD_AUTOACKCHLD un numéro de + * pid. Dès qu'un processus fils se termine ave ce pid, il sera + * automatiquement supprimé. */ + + /* Dans le déroulement normal du programme, on touche ici à des structures + * qui sont modifiées par le handler SIGCHLD. On évite de mettre le bazard en + * blindant le morceau de code. */ + + sigemptyset( &set ); + sigaddset( &set, SIGCHLD ); + sigprocmask( SIG_BLOCK, &set, NULL ); + + prev = NULL; + for( scan = HEAD_ENDCHLD ; scan ; scan = scan->NEXT ) + { + if( scan->PID == pid ) + break; + prev = scan; + } + + if( scan ) + { + /* Cas où le processus que l'on demande d'acquiter automatiquement est déjà + * terminé. Dans ce cas on le supprime de la file d'attente des processus + * terminés */ + + if( prev ) + prev->NEXT = scan->NEXT ; + else + HEAD_ENDCHLD = scan->NEXT ; + + mbkfreeendchld( scan ); + } + else + { + /* On ne voudra jamais savoir ce qu'est devenu le processus fils pid. On le + * met dans la liste des processus à acquiter automatiquement */ + new = mbkgetautoackchld(); + new->PID = pid; + new->NEXT = HEAD_AUTOACKCHLD ; + HEAD_AUTOACKCHLD = new ; + } + sigprocmask( SIG_UNBLOCK, &set, NULL ); +} diff --git a/alliance/src/mbk/src/mbk_sys.h b/alliance/src/mbk/src/mbk_sys.h new file mode 100644 index 00000000..aaa0d405 --- /dev/null +++ b/alliance/src/mbk/src/mbk_sys.h @@ -0,0 +1,54 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : mbk_sys.c header file for functions declarations + * Date : 18/12/91 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mbk_sys.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MBK_SYS_H_ +#define _MBK_SYS_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + + extern char* mbkgetenv __P((const char *name)); + extern FILE* mbkfopen __P((const char *name, const char *extension, const char *mode)); + extern FILE *mbkfopentrace __P((const char *name, const char *extension, const char *mode)); + extern void mbkfopen_infos __P((const FILE *in, const char *filename, const char *name, const char *extension, const char *mode, const char filter)); + extern void* mbkalloc __P((unsigned int nbytes)); + extern void* mbkrealloc __P((void *pt, unsigned int nbytes)); + extern void mbkfree __P((void *ptr)); + void ps(); + extern void mbkackchld __P((int)); + +#endif + diff --git a/alliance/src/mbk/src/mbk_util.c b/alliance/src/mbk/src/mbk_util.c new file mode 100644 index 00000000..9c802896 --- /dev/null +++ b/alliance/src/mbk/src/mbk_util.c @@ -0,0 +1,1581 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : services functions and global variables + * Date : 06/03/92 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + */ + +#ident "$Id: mbk_util.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mut.h" +#include "mbk_util.h" + + +/* Normally defined in values.h, but not available on all systems */ +#ifndef BITS +#define BITS(type) (8 * (int)sizeof(type)) +#endif + +/******************************************************************************* +* global variables * +*******************************************************************************/ +chain_list *HEAD_CHAIN = NULL; /* chain buffer head */ +chain_list *HEAD_BLOCK_CHAIN = NULL; +ptype_list *HEAD_PTYPE = NULL; /* ptype buffer head */ +num_list *HEAD_NUM = NULL; /* num buffer head */ +char TRACE_MODE = 'N'; /* trace if 'Y' */ +int TRACE_FILE = 0; /* trace if >0 */ +int TRACE_GETENV = 0; /* trace if >0 */ +char DEBUG_MODE = 'N'; /* debug if 'Y' */ +char FAST_MODE = 'N'; /* no consistency check if 'Y' */ +char SEPAR = '.'; /* char used in concatenation */ +char *WORK_LIB = NULL; /* working directory */ +char **CATA_LIB = NULL; /* read only directories */ +char *CATAL = NULL; /* catalog file */ +char IN_LO[5] = "al"; /* input logical format */ +char IN_PH[5] = "ap"; /* input physical format */ +char OUT_LO[5] = "al"; /* output logical format */ +char OUT_PH[5] = "ap"; /* output physical format */ +long SCALE_X = 100; /* distance scale definition */ +char PARSER_INFO[100] = "nothing yet"; /* version number, and so on */ +char *VDD = NULL; /* user name for power high */ +char *VSS = NULL; /* user name for power ground */ +char *IN_FILTER = NULL ; +char *OUT_FILTER = NULL ; +char *FILTER_SFX = NULL ; +/* table de hash de namealloc() et namefind() */ +static chain_list *NAME_HASHTABLE[HASHVAL]; +static char buffer[BUFSIZ]; /* buffer for namealloc strcpy */ +static char str[BUFSIZ]; /* buffer for concatname */ +static char tolowertable[1 << BITS(char)]; /* number of chars */ +static char touppertable[1 << BITS(char)]; /* number of chars */ +/* +** Added by Ludovic Jacomme (The slave) +** in order to "trap" exit with Graal/Dreal etc ... +*/ + void (*MBK_EXIT_FUNCTION)() = 0; + +static void dflhandler(int); +static void loadcatalog(char ***table, int *size, char type); +static void read_lib(void); + +/******************************************************************************* +* fonction handler() * +*******************************************************************************/ +static void dflhandler(int sig) +{ + exit(100); +} + +/******************************************************************************* +* fonction mbkwaitpid() * +* Verifie parmis les processus fils termines si pid en fait partie. Si status * +* est non nul, le code de retour est place dans cette variable. si mode vaut * +* 1, cet appel est bloquant, sinon il est non bloquant. * +*******************************************************************************/ +int mbkwaitpid( int pid, int mode, int *status ) +{ + endchld_list *scan, *prev; + + while(1) + { + prev = NULL; + for( scan = HEAD_ENDCHLD ; scan ; scan = scan->NEXT ) + { + if( scan->PID == pid ) + { + if( status ) + *status = scan->STATUS; + + if( prev ) + prev->NEXT = scan->NEXT; + else + HEAD_ENDCHLD = scan->NEXT; + + mbkfreeendchld( scan ); + return( 1 ); + } + prev = scan; + } + + if( mode != 1 ) + return( 0 ); + + sleep(3600); /* le sleep est interruptible : on ne perd rien */ + } + + return( 0 ); +} + +/******************************************************************************* +* fonction mbkenv() * +*******************************************************************************/ +void mbkenv(void) +{ +char *str; +long nchar; + +static char MBK_RAND_SEED[] = { 0x62, + 0x37, 0x34, 0x30, 0x30, 0x32, 0x31, 0x38, 0x61, 0x31, 0x37, 0x34, + 0x64, 0x34, 0x64, 0x36, 0x36, 0x65, 0x32, 0x35, 0x38, 0x30, 0x34, 0x63, + 0x31, 0x36, 0x32, 0x38, 0x34, 0x65, 0x37, 0x61 } ; + + + str = mbkgetenv("MBK_TRACE_GETENV"); + if (str != NULL) + { + if( !strcmp(str, "yes" ) ) + TRACE_GETENV = 1; + else if (!strcmp(str,"Y")) + TRACE_GETENV = 1; + } + + read_lib(); /* read the contents of MBK_WORK_LIB and MBK_CATA_LIB */ + + str = mbkgetenv("MBK_DEBUG_MODE"); + if (str != NULL) + if (!strcmp(str,"yes")) + DEBUG_MODE = 'Y'; + + str = mbkgetenv("MBK_TRACE_MODE"); + if (str != NULL) + if (!strcmp(str,"yes")) + TRACE_MODE = 'Y'; + + str = mbkgetenv("MBK_TRACE_FILE"); + if (str != NULL) + { + if( !strcmp(str, "true" ) ) + TRACE_FILE = 3; + else if (!strcmp(str,"yes")) + TRACE_FILE = 2; + else if( !strcmp(str, "Y" ) ) + TRACE_FILE = 1; + else if( !strcmp(str, "all" ) ) + TRACE_FILE = 1; + } + + str = mbkgetenv("MBK_FAST_MODE"); + if (str != NULL) + if (!strcmp(str,"yes")) + FAST_MODE = 'Y'; + + str = mbkgetenv("MBK_SCALE_X"); + if (str != NULL) + SCALE_X = (long)atoi(str); + + srand((unsigned int) MBK_RAND_SEED); + + str = mbkgetenv("MBK_IN_LO"); + if (str != NULL) { + if (!strcmp(str, "hns")) + (void)strcpy(IN_LO, "hns"); + else if (!strcmp(str, "fne")) + (void)strcpy(IN_LO, "fne"); + else if (!strcmp(str, "hdn")) + (void)strcpy(IN_LO, "hdn"); + else if (!strcmp(str, "fdn")) + (void)strcpy(IN_LO, "fdn"); + else if (!strcmp(str, "al" )) + (void)strcpy(IN_LO, "al"); + else if (!strcmp(str, "alx")) + (void)strcpy(IN_LO, "alx"); + else if (!strcmp(str, "spi")) + (void)strcpy(IN_LO, "spi"); + else if (!strcmp(str, "sp")) + (void)strcpy(IN_LO, "sp"); + else if (!strcmp(str, "cir")) + (void)strcpy(IN_LO, "cir"); + else if (!strcmp(str, "edi")) + (void)strcpy(IN_LO, "edi"); + else if (!strcmp(str, "vst")) + (void)strcpy(IN_LO, "vst"); + else { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***\n"); + (void)fprintf(stderr,"netlist input format '%s' not supported\n",str); + EXIT(1); + } + } + + str = mbkgetenv("MBK_OUT_LO"); + if (str != NULL) { + if (!strcmp(str, "hns")) + (void)strcpy(OUT_LO, "hns"); + else if (!strcmp(str, "fne")) + (void)strcpy(OUT_LO, "fne"); + else if (!strcmp(str, "hdn")) + (void)strcpy(OUT_LO, "hdn"); + else if (!strcmp(str, "fdn")) + (void)strcpy(OUT_LO, "fdn"); + else if (!strcmp(str, "al" )) + (void)strcpy(OUT_LO, "al"); + else if (!strcmp(str, "alx")) + (void)strcpy(OUT_LO, "alx"); + else if (!strcmp(str, "spi")) + (void)strcpy(OUT_LO, "spi"); + else if (!strcmp(str, "sp")) + (void)strcpy(OUT_LO, "sp"); + else if (!strcmp(str, "cir")) + (void)strcpy(OUT_LO, "cir"); + else if (!strcmp(str, "edi")) + (void)strcpy(OUT_LO, "edi"); + else if (!strcmp(str, "vst")) + (void)strcpy(OUT_LO, "vst"); + else if (!strcmp(str, "cct")) + (void)strcpy(OUT_LO, "cct"); + else if (!strcmp(str, "vlg")) + (void)strcpy(OUT_LO, "vlg"); + else { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***\n"); + (void)fprintf(stderr,"netlist output format '%s' not supported\n",str); + EXIT(1); + } + } + + str = mbkgetenv("MBK_IN_PH"); + if (str != NULL) { + if (!strcmp(str, "cp")) + (void)strcpy(IN_PH, "cp"); + else if (!strcmp(str, "ap")) + (void)strcpy(IN_PH, "ap"); + else if (!strcmp(str, "mg")) + (void)strcpy(IN_PH, "mg"); + else { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***\n"); + (void)fprintf(stderr,"layout input format '%s' not supported\n",str); + EXIT(1); + } + } + + str = mbkgetenv("MBK_OUT_PH"); + if (str != NULL) { + if (!strcmp(str, "cp")) + (void)strcpy(OUT_PH, "cp"); + else if (!strcmp(str, "ap")) + (void)strcpy(OUT_PH, "ap"); + else if (!strcmp(str, "mg")) + (void)strcpy(OUT_PH, "mg"); + else { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***\n"); + (void)fprintf(stderr,"layout output format '%s' not supported\n",str); + EXIT(1); + } + } + + str = mbkgetenv("MBK_CATAL_NAME"); + if (str != NULL) + CATAL = str; + else /* default value for catalog name */ + CATAL = "CATAL"; + + str = mbkgetenv("MBK_SEPAR"); + if (str != NULL) + SEPAR = *str; + + str = mbkgetenv("MBK_VDD"); + if (str != NULL) + VDD = str; + else /* default value for power high */ + VDD = "vdd"; + + str = mbkgetenv("MBK_VSS"); + if (str != NULL) + VSS = str; + else /* default value for power high */ + VSS = "vss"; + + str = mbkgetenv( "MBK_IN_FILTER" ); + if( str ) + IN_FILTER = str; + else + IN_FILTER = NULL; + + str = mbkgetenv( "MBK_OUT_FILTER" ); + if( str ) + OUT_FILTER = str; + else + OUT_FILTER = NULL; + + str = mbkgetenv( "MBK_FILTER_SFX" ); + if( str ) + FILTER_SFX = str; + else + FILTER_SFX = NULL; + + /* EXIT shall produce a real exit if not trapped */ + signal(SIGTERM, dflhandler); + + /* Initialize a table of lower case characters for the machine encoding */ + for (nchar = 0; nchar < sizeof(tolowertable); nchar++) + tolowertable[nchar] = isupper(nchar) ? tolower(nchar) : nchar; + + /* Initialize a table of upper case characters for the machine encoding */ + for (nchar = 0; nchar < sizeof(touppertable); nchar++) + touppertable[nchar] = islower(nchar) ? toupper(nchar) : nchar; + + mbkinitendchld(); + mbkinitautoackchld(); + /* Sous Solaris, certaines fonctions de haut niveau (fgets...) sont + * interruptible par la reception d'un signal. Ceci n'a jamais ete pris + * en compte auparavant : on conserve donc explicitement le comportement + * "normal" qui est que ces fonctions ne sont normalement pas + * interruptible. D'ou le SA_RESTART. + */ + + #ifndef AUTO_HAS_SA_RESTART + signal( SIGCHLD, mbkackchld ); + #else + sigemptyset( &ens ); + sgct.sa_handler = mbkackchld; + sgct.sa_mask = ens; + sgct.sa_flags = SA_RESTART; + sigaction( SIGCHLD, &sgct , NULL ); + #endif +} + +/******************************************************************************* +* function nameindex() * +* return a string that is the concatenation of the name argument, the mbk * +* separator, and an index * +*******************************************************************************/ +char *nameindex(char *name, long index) +{ +char str[100]; + + (void)sprintf(str,"%s%c%ld", name, SEPAR, index); + return namealloc(str); +} + +/******************************************************************************* +* fonction addnum() * +* num list specialized allocator to avoid too many mallocs * +*******************************************************************************/ +num_list *addnum(num_list *ptnum, long data) +{ +num_list *pt; +register int i; + + if (HEAD_NUM == NULL) { + HEAD_NUM = (num_list *)mbkalloc(BUFSIZE*sizeof(num_list)); + pt = HEAD_NUM; + for (i = 1; i < BUFSIZE; i++) { + pt->NEXT = pt + 1; + pt++; + } + pt->NEXT = NULL; + } + + pt = HEAD_NUM; + HEAD_NUM = HEAD_NUM->NEXT; + pt->NEXT = ptnum; + pt->DATA = data; + return pt; +} + +/******************************************************************************* +* function freenum() * +* gives back freed block to the num memory allocator * +*******************************************************************************/ +void freenum(num_list *pt) +{ + HEAD_NUM = (num_list *)append((chain_list *)pt, (chain_list *)HEAD_NUM); +} + +/******************************************************************************* +* function addchain() * +* chain list specialized allocator to avoid too many mallocs * +*******************************************************************************/ +#ifdef DEBUGCHAIN +chain_list *fnaddchain(chain_list *pthead, void *ptdata, int line, char *file) +#else +chain_list *addchain(chain_list *pthead, void *ptdata) +#endif +{ +#ifdef DEBUGCHAIN +chain_list *block; +#endif +chain_list *pt; +register int i; + + if (HEAD_CHAIN == NULL) { + pt = (chain_list *)mbkalloc(BUFSIZE*sizeof(chain_list)); + +#ifdef DEBUGCHAIN + block = (chain_list*)mbkalloc(sizeof(chain_list)); + block->DATA = pt; + block->NEXT = HEAD_BLOCK_CHAIN; + HEAD_BLOCK_CHAIN = block; +#endif + + HEAD_CHAIN = pt; + for (i = 1; i < BUFSIZE; i++) { + pt->NEXT = pt + 1; +#ifdef DEBUGCHAIN + pt->LINE = 0; +#endif + pt++; + } + pt->NEXT = NULL; +#ifdef DEBUGCHAIN + pt->LINE = 0; +#endif + } + + pt = HEAD_CHAIN; + HEAD_CHAIN = HEAD_CHAIN->NEXT; + pt->NEXT = pthead; + pt->DATA = ptdata; +#ifdef DEBUGCHAIN + pt->LINE = line; + pt->FILE = file; +#endif + return pt; +} + +/******************************************************************************* +* function freechain() * +* gives back freed block or blocks to the chain_list memory allocator * +*******************************************************************************/ +void freechain(chain_list *pt) +{ +#ifdef DEBUGCHAIN + chain_list *scanchain; + for( scanchain = pt ; scanchain ; scanchain = scanchain->NEXT ) + scanchain->LINE=0; +#endif + HEAD_CHAIN = append(pt, HEAD_CHAIN); +} + +/******************************************************************************* +* function delchain() * +* delete a single element of a chain_list and gives it back to freechain * +*******************************************************************************/ +chain_list *delchain(chain_list *pthead, chain_list *ptdel) +{ +chain_list *pt; +chain_list *ptsav = NULL; /* To make gcc -Wall silent */ + + if (pthead == NULL || ptdel == NULL) { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***"); + (void)fprintf(stderr," delchain() impossible : pointer = NULL !\n"); + EXIT(1); + } + + if (ptdel == pthead) { + pt = pthead->NEXT; + pthead->NEXT = NULL; + freechain(pthead); + return pt; + } else { + for (pt = pthead; pt; pt = pt->NEXT) { + if (pt == ptdel) + break; + ptsav = pt; + } + if (pt != NULL) { + ptsav->NEXT = pt->NEXT; + ptdel->NEXT = NULL; + freechain(ptdel); + return pthead; + } else + return NULL; + } +} + +/******************************************************************************* +* function addptype() * +*******************************************************************************/ +void testchain(void) +{ +#ifdef DEBUGCHAIN + chain_list *scanchain; + int i; + for( scanchain = HEAD_BLOCK_CHAIN ; scanchain ; scanchain = scanchain->NEXT ) + { + for( i = 0 ; i < BUFSIZE ; i++) + if( ((chain_list*)(scanchain->DATA))[i].LINE != 0 ) + printf( "%50s : %5d\n", ((chain_list*)(scanchain->DATA))[i].FILE, + ((chain_list*)(scanchain->DATA))[i].LINE + ); + } +#endif +} + +/******************************************************************************* +* function addptype() * +*******************************************************************************/ +ptype_list *addptype(ptype_list *pthead, long type, void *ptdata) +{ +ptype_list *pt; +register int i; + + if (HEAD_PTYPE == NULL) { + pt = (ptype_list *)mbkalloc(BUFSIZE * sizeof(ptype_list)); + HEAD_PTYPE = pt; + for (i = 1; i < BUFSIZE; i++) { + pt->NEXT = pt + 1; + pt++; + } + pt->NEXT = NULL; + } + + pt = HEAD_PTYPE; + HEAD_PTYPE = HEAD_PTYPE->NEXT; + pt->NEXT = pthead; + pt->DATA = ptdata; + pt->TYPE = type; + return pt; +} + +/******************************************************************************* +* function delptype() * +*******************************************************************************/ +ptype_list *delptype(ptype_list *pthead, long type) +{ +ptype_list *pt; +ptype_list *ptsav = NULL; /* To make gcc -Wall silent */ + + if (pthead == NULL) { + (void)fflush(stdout); + (void)fprintf(stderr,"*** mbk error ***\n"); + (void)fprintf(stderr,"delptype() impossible : pthead = NULL !\n"); + EXIT(1); + } + + if (pthead->TYPE == type) { + pt = pthead->NEXT; + pthead->NEXT = NULL; + freeptype(pthead); + return pt; + } else { + for (pt = pthead; pt; pt = pt->NEXT) { + if (pt->TYPE == type) + break; + ptsav = pt; + } + if (pt != NULL) { + ptsav->NEXT = pt->NEXT; + pt->NEXT = NULL; + freeptype(pt); + return pthead; + } else + return NULL; + } +} + +/******************************************************************************* +* function freeptype() * +*******************************************************************************/ +void freeptype(ptype_list *pt) +{ + HEAD_PTYPE = (ptype_list *)append((chain_list *)pt,(chain_list *)HEAD_PTYPE); +} + +/******************************************************************************* +* function getptype() * +*******************************************************************************/ +ptype_list *getptype(ptype_list *pthead, long type) +{ +ptype_list *pt; + + for (pt = pthead; pt; pt = pt->NEXT) + if (pt->TYPE == type) + return pt; + return NULL; +} + +/******************************************************************************* +* function append() * +*******************************************************************************/ +chain_list *append(chain_list *pt1, chain_list *pt2) +{ +chain_list *pt; + + if (pt1 == NULL) + return pt2; + else { + for (pt = pt1; pt->NEXT; pt = pt->NEXT); + pt->NEXT = pt2; /* append the list 2 at the end of list 1 */ + return pt1; + } +} + +/******************************************************************************* +* Dictonnary related functions * +*******************************************************************************/ + +/* Random hash function due to Don. E. Knuth, The Stanford Graph Base. + * Truly better than the previous one from my own experimentations. */ +#define HASH_MULT 314159 +#define HASH_PRIME 516595003 + +#define HASH_FUNC(inputname, name, code) \ + do { \ + while (*inputname) { \ + *name = tolowertable[(int)*inputname++]; \ + code += (code ^ (code >> 1)) + HASH_MULT * (unsigned char) *name++; \ + while (code >= HASH_PRIME) \ + code -= HASH_PRIME; \ + } \ + *name = '\0'; \ + code %= HASHVAL; \ + } while (0) + +/******************************************************************************* +* function namealloc() * +*******************************************************************************/ +char *namealloc(const char *inputname) +{ +chain_list *pt; +char *name = buffer; /* ensure no modification of parameter string */ +int code = 0; +static char *lastname; + + if (inputname == NULL) + return NULL; + + if (inputname == lastname) + return lastname; /* To make const acceptable, strange */ + + /* Beware, that's a define, ... */ + HASH_FUNC(inputname, name, code); + + for (pt = NAME_HASHTABLE[code]; pt; pt = pt->NEXT) + if (!strcmp(buffer, (char *)pt->DATA)) + return (char *)pt->DATA; + + name = (char *)mbkalloc((unsigned int)(strlen(buffer) + 1)); + (void)strcpy(name, buffer); + NAME_HASHTABLE[code] = addchain(NAME_HASHTABLE[code], (void *)name); +#ifdef DEBUGCHAIN + NAME_HASHTABLE[code]->LINE=0; /* pas de trace de debuggage dessus */ +#endif + lastname = (char *)(NAME_HASHTABLE[code]->DATA); + return lastname; +} + + +/******************************************************************************* +* function namefind() * +*******************************************************************************/ +char *namefind(const char *inputname) +{ +chain_list *pt; +char *name = buffer; /* ensure no modification of parameter string */ +register int code = 0; + + if (inputname == NULL) + return NULL; + + HASH_FUNC(inputname, name, code); + + for (pt = NAME_HASHTABLE[code]; pt; pt = pt->NEXT) + if (!strcmp(buffer, (char *)pt->DATA)) + return (char *)pt->DATA; + + return NULL ; +} + +/******************************************************************************* +* function downstr() * +*******************************************************************************/ +void downstr(const char *s, char *t) +{ + for (; *s; s++, t++) + *t = tolowertable[(int)*s]; + *t = *s; +} + +/******************************************************************************* +* function upstr() * +*******************************************************************************/ +void upstr(const char *s, char *t) +{ + for (; *s; s++, t++) + *t = touppertable[(int)*s]; + *t = *s; +} + +/******************************************************************************* +* function instr() : about strstr, but some systems don't have it * +*******************************************************************************/ +char *instr(char *s, const char *find, char separ) +{ +char *t, c, sc; +int len; + + if (!s || !find) + return NULL; + if (separ) { + t = s; + if ((s = strrchr(s, separ)) == NULL) + s = t; + else + s++; /* skip the separator itself */ + } + if ((c = *find++) != 0) { + len = strlen(find); + do { + do { + if ((sc = *s++) == 0) + return NULL; + } while (sc != c); + } while (strncmp(s, find, len) != 0); + s--; + } + return s; +} + +/******************************************************************************* +* function vectorize : builds a legal mbk vector from a name and an index * +*******************************************************************************/ +char *vectorize(const char *radical, long index) +{ + (void)sprintf(str,"%s %ld", radical, index); + return namealloc(str); +} + +/******************************************************************************* +* function vectorradical : returns the radical of an mbk vector * +*******************************************************************************/ +char *vectorradical(char *name) +{ +char *s; + + strcpy(str, name); + s = strchr(str, ' '); + + if (!s) + return name; + + *s = '\0'; + return namealloc(str); +} + +/******************************************************************************* +* function vectorindex : returns the index of an mbk vector * +*******************************************************************************/ +int vectorindex(const char *name) +{ +char *s = strchr(name, ' '); + + if (!s) + return -1; + + return atoi(s); +} + +/******************************************************************************* +* generic compaison function : * +* unlike strcmp, ensure that 10 > 2 for vectorized strings. * +* first, check strings, then check numerical values as numbers, not strings. * +*******************************************************************************/ +int naturalstrcmp(const char *s, const char *t) +{ +char *spt, *tpt; +const char *st = s, *tt = t; +int u, ls, lt; + + spt = buffer, tpt = str; + + while ((!isspace((int)*st)) && *st) + *spt++ = *st++; + *spt = '\0'; + + while ((!isspace((int)*tt)) && *tt) + *tpt++ = *tt++; + *tpt = '\0'; + + if ((u = strcmp(buffer, str)) != 0) + return u; + + if ((ls = strlen(s)) == (lt = strlen(t))) + return strcmp(s, t); + + return ls - lt; +} + +/******************************************************************************* +* function concatname() * +*******************************************************************************/ +char *concatname(const char *name1, const char *name2) +{ + (void)sprintf(str,"%s%c%s", name1, SEPAR, name2); + return namealloc(str); +} + +/******************************************************************************* +* mbkstrdup : since brain damaged system we aim at do not have it * +*******************************************************************************/ +char *mbkstrdup(const char *s) +{ + char *t; + + if (s == NULL) + return NULL; + + t = (char *)mbkalloc((unsigned int)(strlen(s) + 1)); + return strcpy(t, s); +} + +/******************************************************************************* +* function reverse * +*******************************************************************************/ +chain_list *reverse(chain_list *head) +{ +chain_list *p; +chain_list *q = (chain_list *)NULL; + + if (!head) + return NULL; + while ((p = head->NEXT)) { + head->NEXT = q; + q = head; + head = p; + } + head->NEXT = q; + return head; +} + +/******************************************************************************* +* function pstrcmp * +* used for qsort and bsearch use for catalog sorting and acessing * +*******************************************************************************/ +static int pstrcmp(const void *s, const void *t) +{ + return strcmp(*(const char **)s, *(const char **)t); +} + +/******************************************************************************* +* function incatalogfeed * +* tests if a model is present in the catalog with the F attribut * +*******************************************************************************/ +int incatalogfeed(const char *figname) +{ +static int size; +static char **table; + + if (!size) + loadcatalog(&table, &size, 'F'); + return size ? + (int)bsearch(&figname, table, size, sizeof(char *), pstrcmp) : 0; +} + +/******************************************************************************* +* function incataloggds * +* tests if a model is present in the catalog with the G attribut * +******************************************************************************/ +int incataloggds(const char *figname) +{ +static int size; +static char **table; + + if (!size) + loadcatalog(&table, &size, 'G'); + return size ? + (int)bsearch(&figname, table, size, sizeof(char *), pstrcmp) : 0; +} + +/******************************************************************************* +* function incatalog * +* tests if a model is present in the catalog with the C attribut * +*******************************************************************************/ +int incatalog(const char *figname) +{ +static int size; +static char **table; + + if (!size) + loadcatalog(&table, &size, 'C'); + return size ? + (int)bsearch(&figname, table, size, sizeof(char *), pstrcmp) : 0; +} + +/******************************************************************************* +* function incatalogdelete * +* tests if a model is present in the catalog with the D attribut * +*******************************************************************************/ +int incatalogdelete(const char *figname) +{ +static int size; +static char **table; + + if (!size) + loadcatalog(&table, &size, 'D'); + return size ? + (int)bsearch(&figname, table, size, sizeof(char *), pstrcmp) : 0; +} + +/******************************************************************************* +* function loadcatalog * +* read the catalog from disk checking the given type * +*******************************************************************************/ + +static void loadcatalog(char ***table, int *size, char type) +{ +void *pt; +char attrib; +int nb; +int nb_input; +int i = 0; +chain_list *files = (chain_list *)NULL; +/* Tables for quick cell search : + The catalog file is read only once, and sorted for speed. + The later calls to loadcatalog only return the approriate table. */ +static chain_list *cells[4]; +static char **tabs[4]; +static int sizes[4]; +static int read; + + if (!read) { + read++; + (void)sprintf(buffer, "%s/%s", WORK_LIB, CATAL ? CATAL : "CATAL"); + files = addchain(files, (void *)fopen(buffer, READ_TEXT)); + while (CATA_LIB[i]) { + (void)sprintf(buffer, "%s/CATAL", CATA_LIB[i++]); + files = addchain(files, (void *)fopen(buffer, READ_TEXT)); + } + /* error message : + To avoid malloc/free on file name, the error message is output + relatively to its order. */ + files = reverse(files); + for (i = 0, pt = (void *)files; pt; + pt = (void *)((chain_list *)pt)->NEXT, i++) { + if (!((chain_list *)pt)->DATA) + continue; + nb = 0; + while (!feof((FILE *)((chain_list *)pt)->DATA)) { + nb++; /* count lines */ + nb_input = fscanf((FILE *)((chain_list *)pt)->DATA, "%s %c\n", + buffer, &attrib); + if (nb_input == 0) /* skip white lines */ + continue; + if (nb_input != 2) { + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "loadcatalog syntax error line %d ", nb); + if (i == 0) + (void)fprintf(stderr, "in file %s/%s\n", WORK_LIB, CATAL); + else + (void)fprintf(stderr, "in file %s/CATAL\n", CATA_LIB[i - 1]); + EXIT(1); + } + attrib = islower((int)attrib) ? (char)toupper((int)attrib) : attrib; + switch (attrib) { + case 'C' : + cells[0] = addchain(cells[0], namealloc(buffer)); + sizes[0]++; + break; + case 'G' : + cells[1] = addchain(cells[1], namealloc(buffer)); + sizes[1]++; + break; + case 'F' : + cells[2] = addchain(cells[2], namealloc(buffer)); + sizes[2]++; + break; + case 'D' : + cells[3] = addchain(cells[3], namealloc(buffer)); + sizes[3]++; + break; + default : + (void)fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "loadcatalog syntax error line %d ", + nb); + if (i == 0) + (void)fprintf(stderr, "in file %s/%s\n", WORK_LIB, CATAL); + else + (void)fprintf(stderr, "in file %s/CATAL\n", + CATA_LIB[i - 1]); + (void)fprintf(stderr,"unknown attribut %c\n", attrib); + EXIT(1); + } + } + (void)fclose((FILE *)((chain_list *)pt)->DATA); + } + for (nb = 0; nb < 4; nb++) { + if (sizes[nb]) { + tabs[nb] = (char **)mbkalloc(sizes[nb] * sizeof(char *)); + for (i = 0, pt = (void *)cells[nb]; pt; + pt = (void *)((chain_list *)pt)->NEXT, i++) + tabs[nb][i] = (char *)((chain_list *)pt)->DATA; + qsort(tabs[nb], sizes[nb], sizeof(char *), pstrcmp); + freechain(cells[nb]); + } + } + } + + switch (type) { + case 'C' : + *table = tabs[0]; + *size = sizes[0]; + break; + case 'G' : + *table = tabs[1]; + *size = sizes[1]; + break; + case 'F' : + *table = tabs[2]; + *size = sizes[2]; + break; + case 'D' : + *table = tabs[3]; + *size = sizes[3]; + break; + } +} + +/******************************************************************************* +* function read_lib() * +* fills an array of char * in order to have a list of names as CATA_LIB * +*******************************************************************************/ +static void read_lib(void) +{ +char *str, *s, *stc, *c; +int argc = 0; + + str = mbkgetenv("MBK_WORK_LIB"); + if (str != NULL) { + WORK_LIB = + (char *)mbkalloc((unsigned int)(strlen(str) + 1) * sizeof(char)); + (void)strcpy(WORK_LIB, str); + } else { /* no specific path is given */ + WORK_LIB = (char *)mbkalloc((unsigned int)2 * sizeof(char)); + (void)strcpy(WORK_LIB, "."); + } + + str = mbkgetenv("MBK_CATA_LIB"); + if(str != NULL) { + s = (char *)mbkalloc((unsigned int)(strlen(str) + 1) * sizeof(char)); + (void)strcpy(s, str); + str = s; /* let's not modify the environement values */ + stc = str; /* for counting purposes */ + while (1) { + if ((c = strchr(stc, ':')) == NULL) + break; + argc++; + stc = ++c; + } + CATA_LIB = (char **)mbkalloc((unsigned int)(argc + 2) * sizeof(char *)); + argc = 0; + while (1) { + if ((s = strchr(str, ':')) == NULL) + break; + *(s++) = '\0'; + CATA_LIB[argc++] = str; /* no allocation necessary */ + str = s; + } + if (s == NULL) + CATA_LIB[argc++] = str == NULL || *str == '\0' ? NULL : str; + CATA_LIB[argc] = NULL; + } else { /* no specific path is given */ + CATA_LIB = (char **)mbkalloc((unsigned int)2 * sizeof(char *)); + CATA_LIB[0] = "."; + CATA_LIB[1] = NULL; + } +} +/******************************************************************************* +* Hash tables management functions, contributed to by Luc Burgun on 20/06/92 * +*******************************************************************************/ +static void reallocht(ht *pTable); +/******************************************************************************* +* dilution function for the table accesses * +*******************************************************************************/ +static unsigned long hash(void *p) +{ + return abs((long)p * ((long)p >> 5) >> 4); +} + +/******************************************************************************* +* function addht, create a hash table * +*******************************************************************************/ +ht *addht(unsigned long len) +{ +ht *pTable; +htitem *pEl; +int i; + + if (len == 0) { + fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addht impossible : hash table size is '0'\n"); + EXIT(1); + } + pTable = (ht *)mbkalloc(sizeof(struct htable)); + pTable->length = len; + pEl = (htitem *)mbkalloc(len * (sizeof(struct htitem))); + pTable->pElem = pEl; + for (i = 0; i < len; i++) { + pEl[i].key = NULL; + pEl[i].value = EMPTYHT; + } + pTable->count = 0; + return pTable; +} + +/******************************************************************************* +* function delht, delete a hash table * +*******************************************************************************/ +void delht(ht *pTable) +{ +htitem * pEl; + + pEl = pTable->pElem; + mbkfree(pEl); + mbkfree(pTable); +} + +/******************************************************************************* +* function gethtitem, get an element in a hash table * +*******************************************************************************/ +long gethtitem(ht *pTable, void *key) +{ +long co = 0; +long indice = 0; +htitem * pEl; + + indice = hash(key) % pTable->length; + do { + if (co++ > HMAX_CALLS) { + reallocht(pTable); + return gethtitem(pTable, key); + } + + pEl = (pTable->pElem) + indice; + if (pEl->value != EMPTYHT && pEl->value != DELETEHT) { + if ((long) key == (long) pEl->key) + return pEl->value; + } else if (pEl->value == EMPTYHT) + return EMPTYHT; + indice = (indice + 1) % pTable->length; + } while (1); +} + +/******************************************************************************* +* function addhtitem, get an element in a hash table * +*******************************************************************************/ +long addhtitem(ht *pTable, void *key, long value) +{ +int indice = 0; +htitem *pEl; +int co = 0; + + if (value == EMPTYHT || value == DELETEHT) { + fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "addhtitem impossible : value is EMPTYHT or DELETEHT\n"); + EXIT(1); + } + if (pTable->count++ > (pTable->length) * 8 / 10) { + reallocht(pTable); + return addhtitem(pTable, key, value); + } + + indice = hash(key) % pTable->length; + do { + if (co++ > HMAX_CALLS) { + reallocht(pTable); + return addhtitem(pTable, key, value); + } + pEl = (pTable->pElem) + indice; + if (pEl->value == EMPTYHT || pEl->value == DELETEHT) { + pEl->value = value; + pEl->key = key; + return value; + } else if ((long) pEl->key == (long) key) { + pTable->count--; + pEl->value = value; + return value; + } + indice = (indice + 1) % pTable->length; + } while (1); +} + +/******************************************************************************* +* function sethtitem, test if an element exists in a hash table, * +* adds it anyway, and returns 1 if it used to exist, 0 else. * +*******************************************************************************/ +long sethtitem(ht *pTable, void *key, long value) +{ +int indice = 0; +htitem *pEl; +int co = 0; + + if (value == EMPTYHT || value == DELETEHT) { + fflush(stdout); + (void)fprintf(stderr, "*** mbk error ***\n"); + (void)fprintf(stderr, "sethtitem impossible : value is EMPTYHT or DELETEHT\n"); + EXIT(1); + } + if (pTable->count++ > (pTable->length) * 8 / 10) { + reallocht(pTable); + return sethtitem(pTable, key, value); + } + + indice = hash(key) % pTable->length; + do { + if (co++ > HMAX_CALLS) { + reallocht(pTable); + return sethtitem(pTable, key, value); + } + pEl = (pTable->pElem) + indice; + if (pEl->value == EMPTYHT || pEl->value == DELETEHT) { + pEl->value = value; + pEl->key = key; + return 0; + } else if ((long) pEl->key == (long) key) { + pTable->count--; + pEl->value = value; + return 1; + } + indice = (indice + 1) % pTable->length; + } while (1); +} + +/******************************************************************************* +* function delhtitem, delete an element in a hash table * +*******************************************************************************/ +long delhtitem(ht *pTable, void *key) +{ +int indice = 0; +htitem *pEl; +int co = 0; + + indice = hash(key) % pTable->length; + do { + if (co++ > HMAX_CALLS) { + reallocht(pTable); + return delhtitem(pTable, key); + } + pEl = (pTable->pElem) + indice; + if (pEl->value != EMPTYHT && pEl->value != DELETEHT) { + if ((long) key == (long)pEl->key) { + pTable->count--; + pEl->value = DELETEHT; + return pEl->value; + } + } else if (pEl->value == EMPTYHT) + return EMPTYHT; + indice = (indice + 1) % pTable->length; + } while (1); +} + +/******************************************************************************* +* display contents of an hash table * +*******************************************************************************/ +void viewht(ht *pTable, char *(*pout)(void *)) +{ +long i; +htitem *pEl = pTable->pElem; + + (void)printf("================== viewht ================\n"); + (void)printf("length = %ld\t count = %ld\n", + pTable->length, pTable->count); + (void)printf("==========================================\n"); + for (i = 0; i < pTable->length; i++) { + if (pEl->value != EMPTYHT && pEl->value != DELETEHT) { + printf("index %ld\t", i); + printf("key %s\t", pout(pEl->key)); + printf("value %ld \n", pEl->value); + } + pEl++; + } +} + +/******************************************************************************* +* realloc space to adapt hash table size to number of entries * +*******************************************************************************/ +static void reallocht(ht *pTable) +{ +ht *tabBis; +htitem *pEl; +int i; + + pEl = pTable->pElem; + tabBis = addht((pTable->length) * 5); + for (i = 0; i < pTable->length; i++) { + if (pEl->value != EMPTYHT && pEl->value != DELETEHT) + addhtitem(tabBis, pEl->key, pEl->value); + pEl++; + } + mbkfree(pTable->pElem); + pTable->length = tabBis->length; + pTable->pElem = tabBis->pElem; + pTable->count = tabBis->count; + mbkfree(tabBis); +} + +/******************************************************************************* +* All that needed for a cute banner, by Frederic Petrot * +* Used to be a standalone library * +*******************************************************************************/ +#include +#define WINDOW_SIZE 81 +#define LINES 15 +#define ASCENT 13 +static char screen[LINES][WINDOW_SIZE]; + +static int indx(char c) +{ + return c >= '0' && c <= '9' ? (int)c - '0' + : isupper((int)c) ? (int)10 + c - 'A' + : islower((int)c) ? (int)11 + 'Z' - 'A' + c - 'a' + : -1; +} + +static void banner(const char *s, const char *police[][62], int nl) +{ +int i, j, k, l, m; +const char *line; + + /* rince off : + the buffer is filled with nul characteres. */ + for (j = 0; j < nl; j++) + for (i = 0; i < WINDOW_SIZE; i++) + screen[j][i] = '\0'; + /* first : + filling the buffer with direct table output. */ + while (*s) { + for (i = 0; i < nl; i++) { + if ((j = indx(*s)) == -1) { + fprintf(stderr, + "alliancebanner: Error: Character out of [0-9A-Za-z] range\n"); + exit(1); + } + line = police[j][i]; + if (strlen(line) + strlen(screen[i]) >= WINDOW_SIZE) { + fprintf(stderr, + "alliancebanner: Error: Resulting size bigger than %d columns not allowed\n", + WINDOW_SIZE - 1); + exit(1); + } + strcat(screen[i], line); + if (*(s + 1) != '\0') + strcat(screen[i], " "); + } + s++; + } + for (m = l = -1, j = 0; j < nl; j++) + for (i = 0; i < WINDOW_SIZE; i++) + if (screen[j][i] == '@') { + if (m == -1) + m = j; + l = j; + break; + } + k = strlen(screen[0]); + /* banner : + output on stdout. */ + putc('\n', stdout); + for (j = m; j <= l; j++) { + for (i = 0; i < (WINDOW_SIZE - k) / 2; i++) + putc(' ', stdout); + for (i = 0; i < k; i++) + putc(screen[j][i], stdout); + putc('\n', stdout); + } +} + +static void cartouche(const char *tool, const char *tv, const char *comment, const char *date, const char *av, const char *authors, const char *contrib) +{ +int i, j, k, l; +static char *msg[6] = { + "%s", + "Alliance CAD System %s,\"%s %s", + "Copyright (c) %s-%d,\"ASIM/LIP6/UPMC", + "Author(s):\"%s", + "Contributor(s):\"%s", + "E-mail support:\"alliance-support@asim.lip6.fr" +}; +int msgl[6]; +char *str; +time_t timer; +char day[4], month[4]; +int year, nday, hour, minute, second; + + (void)time(&timer); + (void)sscanf(ctime(&timer), "%s %s %d %d:%d:%d %d", + day, month, &nday, &hour, &minute, &second, &year); + /* rince off : + the buffer is filled with nul characteres. */ + for (j = 0; j < 12; j++) + for (i = 0; i < WINDOW_SIZE; i++) + screen[j][i] = '\0'; + i = strlen(tool); + str = mbkstrdup(tool); + for (k = 0; k < i; k++) + str[k] = isupper((int)tool[k]) ? tolower((int)tool[k]) : tool[k]; + sprintf(screen[0], msg[0], comment); + sprintf(screen[1], msg[1], av, str, tv); + mbkfree(str); + sprintf(screen[2], msg[2], date, year); + if (authors != (char *)0 ) + sprintf(screen[3], msg[3],authors); + else + screen[3][0] = '\0'; + if (contrib != (char *)0 ) + sprintf(screen[4], msg[4],contrib); + else + screen[4][0] = '\0'; + + strcat(screen[5], msg[5]); + + for (i = 1; i < 6; i++) { + msgl[i] = strlen(screen[i]); + j = j < msgl[i] ? msgl[i] : j; + } + for (i = 1; i < 6; i++) + for (l = 0, k = 0; k < WINDOW_SIZE; k++) { + if (screen[i][k] == '\0') { + screen[i + 6][k + l] = '\0'; + break; + } + if (screen[i][k] == '"') { /* only once per line */ + for (; l <= j - msgl[i]; l++) + screen[i + 6][k + l] = ' '; + continue; + } + screen[i + 6][k + l] = screen[i][k]; + } + /* cartouche : + output on stdout. */ + i = strlen(comment); + putc('\n', stdout); + for (k = 0; k < (WINDOW_SIZE - i) / 2; k++) + putc(' ', stdout); + puts(screen[0]); + putc('\n', stdout); + for (i = 1; i < 6; i++) { + if (screen[i][0]=='\0') continue; + for (k = 0; k < (WINDOW_SIZE - j) / 2; k++) + putc(' ', stdout); + for (k = 0; k <= j; k++) + if (screen[i + 6][k] != 0) /* not so nice, but */ + putc(screen[i + 6][k], stdout); + putc('\n', stdout); + } + putc('\n', stdout); +} + +void alliancebanner_with_contrib(const char *tool, const char *tv, const char *comment, const char *date, const char *av, const char *authors, const char *contrib) +{ + banner(tool, Unknown_Bold_Normal_14, 15); + cartouche(tool, tv, comment, date, av, authors,contrib); +} + +void alliancebanner_with_authors(const char *tool, const char *tv, const char *comment, const char *date, const char *av, const char *authors) +{ + alliancebanner_with_contrib( tool, tv, comment, date, av, authors, NULL ); +} + + +void alliancebanner(const char *tool, const char *tv, const char *comment, const char *date, const char *av) +{ + alliancebanner_with_contrib( tool, tv, comment, date, av, NULL, NULL ); +} + +/****************** +* Contributed to by Ludovic Jacomme +**************************/ +ptype_list *HEAD_MBKDEBUG = NULL; +char MBK_DEBUG_ON = 0; + +static void trapdebug(int dummy) +{ + ptype_list *ScanDebug; + + for ( ScanDebug = HEAD_MBKDEBUG; + ScanDebug != (ptype_list *)NULL; + ScanDebug = ScanDebug->NEXT ) + { + fprintf( stdout, "mbkdebug: file %s line %ld\n", + (char *)ScanDebug->DATA, ScanDebug->TYPE ); + } + + fflush( stdout ); + + signal( SIGQUIT, trapdebug ); + signal( SIGSEGV, SIG_DFL ); + signal( SIGBUS , SIG_DFL ); + signal( SIGILL , SIG_DFL ); +} + +void mbkdebug(void) +{ + signal( SIGSEGV, trapdebug ); + signal( SIGBUS, trapdebug ); + signal( SIGILL, trapdebug ); + signal( SIGQUIT, trapdebug ); + + MBK_DEBUG_ON = 1; +} + +/* +** Added by Ludovic Jacomme (The slave) +** in order to "trap" exit with Graal/Dreal etc ... +*/ + +void mbkexit( int ExitValue ) +{ + if ( MBK_EXIT_FUNCTION != NULL ) + { + (*MBK_EXIT_FUNCTION)( ExitValue ); + } + + kill( getpid(), SIGTERM ); +} + + +/* To compile with gcc under SunOS */ +#ifdef SunOS +void *dlopen(char *path, int mode) +{ +} +void *dlsym(void *handle, char *symbol) +{ +} +char *dlerror(void) +{ +} +int dlclose(void *handle) +{ +} +#endif diff --git a/alliance/src/mbk/src/mbk_util.h b/alliance/src/mbk/src/mbk_util.h new file mode 100644 index 00000000..ef922101 --- /dev/null +++ b/alliance/src/mbk/src/mbk_util.h @@ -0,0 +1,1177 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : header file for mbk_util.c used to declare functions + * Date : 20/06/92 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mbk_util.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MBK_UTIL_H_ +#define _MBK_UTIL_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/* hash tables maximun depth */ +#define HMAX_CALLS 20 + + +/* Font definition for the banner + + Rights on font material : + + Donated by H. Kagotani ; public domain + font from Japan + -Misc-Fixed-Medium-R-Normal--14-130-75-75-C-140-JISX0208.1983-0 + "Public domain font. Share and enjoy." + + This font has been extracted from X11r5 bdf file by myself, to + be used for the standard Aliiance CAD system banners. */ + +static const char *Unknown_Bold_Normal_14[][62] = { +{ +" ", +" @@@ ", +" @@ @@ ", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +" @@ @@ ", +" @@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2331 */ +{ +" ", +" @ ", +" @@ ", +"@@@@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2332 */ +{ +" ", +" @@@@ ", +" @ @@ ", +"@@ @@", +"@@@ @@", +" @ @@ ", +" @ ", +" @ ", +" @ ", +" @ @", +" @@@@@@ ", +"@@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2333 */ +{ +" ", +" @@@@ ", +" @ @@ ", +"@@ @@", +"@@ @@", +" @@ ", +" @@@ ", +" @ ", +"@@ @@", +"@@ @@", +" @ @@ ", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2334 */ +{ +" ", +" @@ ", +" @@@ ", +" @ @@ ", +" @ @@ ", +" @ @@ ", +" @ @@ ", +"@@ @@ ", +"@@@@@@@@@", +" @@ ", +" @@ ", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2335 */ +{ +" ", +" @@@@@@@", +" @@@@@@ ", +" @ ", +" @ ", +" @@@@@ ", +" @@ ", +" @@", +" @@", +"@@ @@", +"@@ @@ ", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2336 */ +{ +" ", +" @@@@ ", +" @ @@ ", +" @@ @@ ", +" @ ", +"@@ @@@@ ", +"@@@ @@ ", +"@@ @@", +"@@ @@", +"@@ @@", +" @@ @@ ", +" @@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2337 */ +{ +" ", +" @@@@@@@@", +" @@@@@@@ ", +"@ @ ", +" @ ", +" @ ", +" @ ", +" @ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2338 */ +{ +" ", +" @@@@ ", +" @ @ ", +"@@ @@", +"@@@ @@", +" @@@ @@ ", +" @@@@ ", +" @@ @@@ ", +"@@ @@@", +"@@ @@", +" @ @ ", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2339 */ +{ +" ", +" @@ ", +" @@ @@ ", +"@@ @@", +"@@ @@", +"@@ @@", +" @@ @@@", +" @@@ @@", +" @@", +"@@ @ ", +"@@ @ ", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2341 */ +{ +" ", +" @ ", +" @ ", +" @@@ ", +" @@@ ", +" @ @@ ", +" @ @@ ", +" @ @@ ", +" @@@@@@@ ", +" @ @@ ", +" @ @@ ", +"@@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2342 */ +{ +" ", +"@@@@@@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@@@@@ ", +" @@ @@ ", +" @@ @@", +" @@ @@", +" @@ @@ ", +"@@@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2343 */ +{ +" ", +" @@@@ @", +" @@ @@", +" @@ @", +"@@ @", +"@@ ", +"@@ ", +"@@ ", +"@@ ", +" @@ @", +" @@ @@", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2344 */ +{ +" ", +"@@@@@@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@", +" @@ @@", +" @@ @@", +" @@ @@", +" @@ @@", +" @@ @@ ", +" @@ @@ ", +"@@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2345 */ +{ +" ", +"@@@@@@@@@ ", +" @@ @ ", +" @@ @ ", +" @@ ", +" @@ @ ", +" @@@@@@ ", +" @@ @ ", +" @@ ", +" @@ @", +" @@ @ ", +"@@@@@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2346 */ +{ +" ", +"@@@@@@@@@ ", +" @@ @ ", +" @@ @", +" @@ ", +" @@ @ ", +" @@@@@@ ", +" @@ @ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2347 */ +{ +" ", +" @@@@ @ ", +" @@ @@ ", +" @@ @ ", +"@@ ", +"@@ ", +"@@ @@@@@", +"@@ @ @@ ", +"@@ @ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2348 */ +{ +" ", +"@@@@ @@@@", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@@@@@@@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +"@@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2349 */ +{ +" ", +"@@@@@@", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 234a */ +{ +" ", +" @@@@@@", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @ @@ ", +"@@@ @@ ", +"@@ @@ ", +" @@ @@ ", +" @@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 234b */ +{ +" ", +"@@@@ @@@@", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @@ ", +" @@ @ @@ ", +" @@@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +"@@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 234c */ +{ +" ", +"@@@@@@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ @", +" @@ @ ", +"@@@@@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 234d */ +{ +" ", +"@@@ @@@", +" @@ @@ ", +" @@@ @@@ ", +" @@@ @@@ ", +" @ @@ @ @@ ", +" @ @@ @ @@ ", +" @ @@@ @@ ", +" @ @@ @@ ", +" @ @ @@ ", +" @ @@ ", +"@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 234e */ +{ +" ", +"@@@ @@@", +" @@ @ ", +" @@@ @ ", +" @ @@ @ ", +" @ @@ @ ", +" @ @@ @ ", +" @ @@ @ ", +" @ @@ @ ", +" @ @@@ ", +" @ @@ ", +"@@@ @@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 234f */ +{ +" ", +" @@@ ", +" @@ @@ ", +" @@ @@ ", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +" @@ @@ ", +" @@ @@ ", +" @@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2350 */ +{ +" ", +"@@@@@@@ ", +" @@ @@ ", +" @@ @@", +" @@ @@", +" @@ @@ ", +" @@@@@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2351 */ +{ +" ", +" @@@ ", +" @@ @@ ", +" @@ @@ ", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@ @@", +" @@@ @ @@ ", +" @@ @@ ", +" @@@@@ ", +" @@", +" ", +" "}, +/* lines 15 */ +/* 2352 */ +{ +" ", +"@@@@@@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@@@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +"@@@@@ @@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2353 */ +{ +" ", +" @@@@ @ ", +" @ @@ ", +"@@ @ ", +"@@@ ", +" @@@@ ", +" @@@@ ", +" @@@ ", +"@ @@", +"@@ @@", +"@@@ @ ", +"@ @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2354 */ +{ +" ", +" @@@@@@@@@@ ", +" @ @@ @ ", +"@ @@ @", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2355 */ +{ +" ", +"@@@@ @@@", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2356 */ +{ +" ", +"@@@@ @@@", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@@ ", +" @@@ ", +" @ ", +" @ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2357 */ +{ +" ", +"@@@ @@@ @@@", +" @@ @@ @ ", +" @@ @@ @ ", +" @@ @@ @ ", +" @@ @@@ @ ", +" @@@ @@@ ", +" @@@ @@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2358 */ +{ +" ", +"@@@@ @@@@", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ ", +" @@ ", +" @@@ ", +" @ @@ ", +" @ @@ ", +" @ @@ ", +"@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2359 */ +{ +" ", +"@@@@ @@@@", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 235a */ +{ +" ", +" @@@@@@@@@ ", +" @ @@ ", +"@ @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ @", +" @@ @ ", +"@@@@@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2361 */ +{ +" ", +" ", +" ", +" ", +" @@@@ ", +" @@ @ ", +" @@ @@ ", +" @@@@@ ", +" @@ @@ ", +"@@ @@ ", +"@@ @@@ ", +" @@@@ @@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2362 */ +{ +" ", +"@@@ ", +" @@ ", +" @@ ", +" @@ @@ ", +" @@@ @@ ", +" @@ @@", +" @@ @@", +" @@ @@", +" @@ @@", +" @@@ @@ ", +"@@@ @@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2363 */ +{ +" ", +" ", +" ", +" ", +" @@@ ", +" @@ @@", +"@@ @", +"@@ ", +"@@ ", +"@@ @", +" @@ @@", +" @@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2364 */ +{ +" ", +" @@@ ", +" @@ ", +" @@ ", +" @@ @@ ", +" @@ @@@ ", +"@@ @@ ", +"@@ @@ ", +"@@ @@ ", +"@@ @@ ", +" @@ @@@ ", +" @@ @@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2365 */ +{ +" ", +" ", +" ", +" ", +" @@@@@ ", +" @ @ ", +"@@ @@", +"@@@@@@@@@", +"@@ ", +"@@ @", +" @@ @@", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2366 */ +{ +" ", +" @@@ ", +" @ @@", +" @@ @@", +" @@ ", +"@@@@@@@@", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2367 */ +{ +" ", +" ", +" ", +" ", +" @@@@@@", +" @@ @@ ", +" @ @@ ", +" @ @ ", +" @@@ ", +" @@ ", +" @@@@@@ ", +"@@ @@@", +" @ @", +" @@@@@ ", +" "}, +/* lines 15 */ +/* 2368 */ +{ +" ", +"@@@ ", +" @@ ", +" @@ ", +" @@ @@@ ", +" @@@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +"@@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2369 */ +{ +" ", +" @ ", +" @@@ ", +" @ ", +" ", +"@@@@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 236a */ +{ +" ", +" @ ", +" @@@", +" @ ", +" ", +" @@@@@", +" @@", +" @@", +" @@", +" @@", +" @@", +"@@ @@", +"@@ @ ", +" @@@ ", +" "}, +/* lines 15 */ +/* 236b */ +{ +" ", +"@@@ ", +" @@ ", +" @@ @@@ ", +" @@ @ ", +" @@ @ ", +" @@ @@@ ", +" @@@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +"@@@@ @@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 236c */ +{ +" ", +"@@@@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 236d */ +{ +" ", +" ", +" ", +" ", +"@@@ @@ @@@ ", +" @@@ @@ @@ ", +" @@ @@ @@ ", +" @@ @@ @@ ", +" @@ @@ @@ ", +" @@ @@ @@ ", +" @@ @@ @@ ", +"@@@@ @@@ @@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 236e */ +{ +" ", +" ", +" ", +" ", +"@@@ @@@ ", +" @@@ @ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +"@@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 236f */ +{ +" ", +" ", +" ", +" ", +" @@@ ", +" @@ @@ ", +"@@ @@", +"@@ @@", +"@@ @@", +"@@ @@", +" @@ @@ ", +" @@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2370 */ +{ +" ", +" ", +" ", +" ", +"@@@ @@@ ", +" @@@ @@ ", +" @@ @@", +" @@ @@", +" @@ @@", +" @@ @@", +" @@@ @@ ", +" @@ @@@ ", +" @@ ", +"@@@@ ", +" "}, +/* lines 15 */ +/* 2371 */ +{ +" ", +" ", +" ", +" ", +" @@@ @@@", +" @@ @@@ ", +"@@ @@ ", +"@@ @@ ", +"@@ @@ ", +"@@ @@ ", +" @@ @@@ ", +" @@@ @@ ", +" @@ ", +" @@@@", +" "}, +/* lines 15 */ +/* 2372 */ +{ +" ", +" ", +" ", +" ", +"@@@ @@@ ", +" @@@ @@", +" @@ @@", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2373 */ +{ +" ", +" ", +" ", +" ", +" @@@@@@ ", +"@@ @ ", +"@@@ ", +" @@@@ ", +" @@@@ ", +"@ @@@", +"@@ @@", +"@ @@@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2374 */ +{ +" ", +" ", +" @ ", +" @@ ", +" @@ ", +"@@@@@@@@", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ @", +" @@@@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2375 */ +{ +" ", +" ", +" ", +" ", +"@@@ @@@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@@ ", +" @@@@ @@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2376 */ +{ +" ", +" ", +" ", +" ", +"@@@@@ @@@", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ ", +" @@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2377 */ +{ +" ", +" ", +" ", +" ", +"@@@@ @@ @@@", +" @@ @@ @ ", +" @@ @@ @ ", +" @@@ @@ @ ", +" @@@ @@@ ", +" @@ @@ ", +" @@ @@ ", +" @@ @@ ", +" ", +" ", +" "}, +/* lines 15 */ +/* 2378 */ +{ +" ", +" ", +" ", +" ", +"@@@@ @@@", +" @@ @ ", +" @@ @ ", +" @@@ ", +" @@@ ", +" @ @@ ", +" @ @@ ", +"@@@ @@@@", +" ", +" ", +" "}, +/* lines 15 */ +/* 2379 */ +{ +" ", +" ", +" ", +" ", +"@@@@@ @@@", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@ @ ", +" @@@ ", +" @@ ", +"@@ @ ", +"@@ @ ", +" @@@ ", +" "}, +/* lines 15 */ +/* 237a */ +{ +" ", +" ", +" ", +" ", +"@@@@@@@@", +"@ @@ ", +" @@ ", +" @@ ", +" @@ ", +" @@ ", +"@@ @", +"@@@@@@@@", +" ", +" ", +" "} +}; + +#endif + diff --git a/alliance/src/mbk/src/mlo.h b/alliance/src/mbk/src/mlo.h new file mode 100644 index 00000000..7610dd45 --- /dev/null +++ b/alliance/src/mbk/src/mlo.h @@ -0,0 +1,180 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : constantes, externs, and data-structures + * Date : 05/08/93 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mlo.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MLO_H_ +#define _MLO_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/* transistor type */ +#define TRANSN 0 +#define TRANSP 1 + +#define TRANSFAST (1 << 1) +#define TRANSHVIO (1 << 3) + +#define TRANSN_FAST (TRANSN & TRANSFAST) +#define TRANSP_FAST (TRANSP & TRANSFAST) + +#define TRANSN_HVIO (TRANSN & TRANSHVIO) +#define TRANSP_HVIO (TRANSP & TRANSHVIO) + +#define IsTransP(type) (type & 1) +#define IsTransN(type) (!IsTransP(type)) +#define IsTransFast(type) ((type >> 1) & 1) +#define IsTransSlow(type) (!IsTransFast(type)) +#define IsTransHvio(type) ((type >> 3) & 1) + +/* connector & signal direction */ +#define INTERNAL 'I' /* instance connector or signal on instances only */ +#define EXTERNAL 'E' /* figure connector or signal on figure and instances */ + +/* connector direction */ +#define IN 'I' +#define OUT 'O' +#define INOUT 'B' +#define UNKNOWN 'X' +#define TRISTATE 'Z' +#define TRANSCV 'T' + +/******************************************************************************* +* netlist structures types * +*******************************************************************************/ +typedef struct lofig /* logical figure */ +{ +struct lofig *NEXT; /* next figure */ +struct chain *MODELCHAIN; /* list of models */ +struct locon *LOCON; /* connector list head */ +struct losig *LOSIG; /* signal list head */ +struct ptype *BKSIG; /* signal block list head */ +struct loins *LOINS; /* instance list head */ +struct lotrs *LOTRS; /* transistor list head */ +char *NAME; /* figure name (unique) */ +char MODE; /* 'A' or 'P' */ +struct ptype *USER; /* Application specific */ +} +lofig_list; + +typedef struct lotrs /* logical transistor */ +{ +struct lotrs *NEXT; /* next transistor */ +struct locon *DRAIN; /* drain connector */ +struct locon *GRID; /* grid connector */ +struct locon *SOURCE; /* source connector */ +struct locon *BULK; /* bulk connector */ +char *TRNAME; /* transistor instance name */ +long WIDTH,LENGTH; /* transistor width & length */ +long PS, PD; /* source & drain perimeters */ +long XS, XD; /* values for area computation */ +long X,Y; /* transistor coordinates */ +char TYPE; /* transistor type */ +struct ptype *USER; /* application specific */ +} +lotrs_list; + +typedef struct loins /* logical instance */ +{ +struct loins *NEXT; /* next figure */ +struct locon *LOCON; /* connector list head */ +char *INSNAME; /* instance name */ +char *FIGNAME; /* model name */ +struct ptype *USER; /* Application specific */ +} +loins_list; + +typedef struct locon /* logical connector */ +{ +struct locon *NEXT; /* next connector */ +char *NAME; /* connector name (unique) */ +struct losig *SIG; /* pointer on signal */ +void *ROOT; /* pointer on figure/instance */ +char DIRECTION; /* see defines for information */ +char TYPE; /* instance I / figure E */ +struct num *PNODE; /* nodes for physical connector*/ +struct ptype *USER; /* Application specific */ +} +locon_list; + +typedef struct losig /* logical signal */ +{ +struct losig *NEXT; /* next signal */ +struct chain *NAMECHAIN; /* list of alias name */ +long INDEX; /* signal index (unique) */ +char TYPE; /* internal I / external E */ +struct lorcnet *PRCN; /* pointer on parasitic RC */ +struct ptype *USER; /* application specific */ +} +losig_list; + +/******************************************************************************* +* externals for mbk netlist view * +*******************************************************************************/ + extern lofig_list *HEAD_LOFIG; /* physical figure list head */ + extern lofig_list * addlofig __P((const char *name)); + extern lofig_list * addlomodel __P((lofig_list *model, const char *name)); + + extern loins_list * addloins __P((lofig_list *ptfig, const char *insname, lofig_list *ptnewfig, chain_list *sigchain)); + extern lotrs_list * addlotrs __P((lofig_list *ptfig, char type, long x, long y, long width, long length, long ps, long pd, long xs, long xd, losig_list *ptgrid, losig_list *ptsource, losig_list *ptdrain, losig_list *ptbulk, const char *name)); + extern locon_list * addlocon __P((lofig_list *ptfig, const char *name, losig_list *ptsig, char dir)); + extern losig_list * addlosig __P((lofig_list *ptfig, long index, chain_list *namechain, char type)); + /* addlosig : field capa is not used */ + /* addcapa disparait */ + extern int dellofig __P((const char *name)); + extern void freelomodel __P((lofig_list *ptmodel)); + extern int dellosig __P((lofig_list *ptfig, long index)); + extern int delloins __P((lofig_list *ptfig, const char *insname)); + extern int dellotrs __P((lofig_list *ptfig, lotrs_list *pttrs)); + extern int dellocon __P((lofig_list *ptfig, const char *name)); + extern lofig_list * getlofig __P((const char *figname, char mode)); + extern lofig_list * getlomodel __P((lofig_list *ptmodel, const char *name)); + extern loins_list * getloins __P((lofig_list *ptfig, const char *name)); + extern locon_list * getlocon __P((lofig_list *ptfig, const char *name)); + extern losig_list * getlosig __P((lofig_list *ptfig, long index)); + extern lotrs_list * getlotrs __P((lofig_list *ptfig, const char *name)); + extern char * getsigname __P((losig_list *ptsig)); + extern void lofigchain __P((lofig_list *ptfig)); + extern void viewlo __P(()); + extern void setsigsize __P((lofig_list*, int)); + extern int getsigsize __P((lofig_list* )); + extern void dellosiguser __P((losig_list*)); + extern void dellotrsuser __P((lotrs_list*)); + extern void delloinsuser __P((loins_list*)); + extern void delloconuser __P((locon_list*)); + extern void dellofiguser __P((lofig_list*)); + + +#endif /* !MLO */ + diff --git a/alliance/src/mbk/src/mlu.h b/alliance/src/mbk/src/mlu.h new file mode 100644 index 00000000..673372b9 --- /dev/null +++ b/alliance/src/mbk/src/mlu.h @@ -0,0 +1,70 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : logical utility functions + * Date : 05/08/93 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mlu.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MLU_H_ +#define _MLU_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + + extern void flattenlofig __P((lofig_list *ptfig, const char *insname, char concat)); + extern lofig_list * unflattenlofig __P((lofig_list *ptfig, const char *figname, const char *insname, chain_list *list)); + extern void rflattenlofig __P((lofig_list *ptfig, char concat, char catal)); + extern void loadlofig __P((lofig_list *ptfig, const char *name, char mode)); + extern void savelofig __P((lofig_list *ptfig)); + extern void mlodebug __P((void *head_pnt, char *stru_name)); + extern losig_list * duplosiglst __P((losig_list *losig_ptr, ptype_list **BKSIG_ptr,int)); + extern losig_list * duplosig __P((losig_list *losig_ptr, ptype_list **BKSIG_ptr, int)); + extern chain_list * dupchainlst __P((chain_list *chain_ptr)); + extern locon_list * duploconlst __P((locon_list *locon_ptr)); + extern locon_list * duplocon __P((locon_list *locon_ptr)); + extern loins_list * duploinslst __P((loins_list *loins_ptr)); + extern loins_list * duploins __P((loins_list *loins_ptr)); + extern lotrs_list * duplotrslst __P((lotrs_list *lotrs_ptr)); + extern lotrs_list * duplotrs __P((lotrs_list *lotrs_ptr)); + extern lofig_list * duplofiglst __P((lofig_list *lofig_ptr)); + extern lofig_list * duplofig __P((lofig_list *lofig_ptr)); + extern lofig_list * rduplofig __P((lofig_list *lofig_ptr)); + extern void sortlocon __P((locon_list **connectors)); + extern void sortlosig __P((losig_list **signals)); + extern losig_list * givelosig __P((lofig_list *ptfig, long index)); + extern int checkloconorder __P((locon_list *c)); + extern int restoredirvbe __P((lofig_list *lof)); + extern int guessextdir __P((lofig_list *lof)); + extern int restorealldir __P((lofig_list *lf)); + +#endif /* !MLU */ + diff --git a/alliance/src/mbk/src/mph.h b/alliance/src/mbk/src/mph.h new file mode 100644 index 00000000..5debfa34 --- /dev/null +++ b/alliance/src/mbk/src/mph.h @@ -0,0 +1,253 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : constantes, externs, and data-structures + * Date : 05/08/93 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mph.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MPH_H_ +#define _MPH_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/* physical connector orientation */ +#define NORTH 'N' +#define EAST 'E' +#define SOUTH 'S' +#define WEST 'W' + +/* physical segment type */ +#define LEFT 'L' +#define UP 'U' +#define RIGHT 'R' +#define DOWN 'D' + +/* physical symetry type */ +#define NOSYM 0 /* vti : standart */ +#define ROT_P 1 /* vti : Rot90cc */ +#define SYMXY 2 /* vti : Rot180 */ +#define ROT_M 3 /* vti : Rot90c */ +#define SYM_X 4 /* vti : mx(x=-x) */ +#define SY_RM 5 /* vti : mxRot90cc */ +#define SYM_Y 6 /* vti : my(y=-y) */ +#define SY_RP 7 /* vti : myRot90cc */ + +enum { +/* physical contact type */ + CONT_POLY, + CONT_DIF_N, + CONT_DIF_P, + CONT_BODY_N, + CONT_BODY_P, + CONT_VIA, + CONT_VIA2, + CONT_VIA3, + CONT_VIA4, + CONT_VIA5, + CONT_VIA6, + CONT_VIA7, + CONT_VIA8, + CONT_POLY2, + +/* physical transistor flood fill macros */ + C_X_N, + C_X_P, + +/* turn via */ + CONT_TURN1, + CONT_TURN2, + CONT_TURN3, + CONT_TURN4, + CONT_TURN5, + CONT_TURN6, + CONT_TURN7, + CONT_TURN8, + CONT_TURN9 +}; + +#define LAST_CONTACT CONT_TURN9 + +enum { +/* physical layer code */ + NWELL, + PWELL, + NTIE, + PTIE, + NDIF, + PDIF, + NTRANS, + PTRANS, + NTRANS_FAST, + PTRANS_FAST, + NTRANS_HVIO, + PTRANS_HVIO, + POLY, + POLY2, + ALU1, + ALU2, + ALU3, + ALU4, + ALU5, + ALU6, + ALU7, + ALU8, + ALU9, +/* lack of layer */ + TPOLY, + TPOLY2, + TALU1, + TALU2, + TALU3, + TALU4, + TALU5, + TALU6, + TALU7, + TALU8, + TALU9, +/* connector segment layer code */ + CALU1, + CALU2, + CALU3, + CALU4, + CALU5, + CALU6, + CALU7, + CALU8, + CALU9 +}; + +#define LAST_LAYER CALU9 + +/******************************************************************************* +* layout structures types * +*******************************************************************************/ +typedef struct phfig /* physical figure */ +{ +struct phfig *NEXT; /* next figure */ +struct chain *MODELCHAIN; /* list of models */ +struct phseg *PHSEG; /* segment list head */ +struct phvia *PHVIA; /* contact list head */ +struct phref *PHREF; /* reference list head */ +struct phins *PHINS; /* instance list head */ +struct phcon *PHCON; /* connector list head */ +char *NAME; /* figure name (unique) */ +char MODE; /* if 'A' all , else perif */ +long XAB1,YAB1,XAB2,YAB2; /* abutment box coordinates */ +struct ptype *USER; /* Application specific */ +} +phfig_list; + +typedef struct phcon /* physical connector */ +{ +struct phcon *NEXT; /* next connector */ +char *NAME; /* connector name */ +long INDEX; /* connector index(unique) */ +long XCON,YCON; /* connector coordinates */ +long WIDTH; /* connector width */ +char ORIENT; /* possible values: N E S W */ +char LAYER; /* physical layer */ +struct ptype *USER; /* Application specific */ +} +phcon_list; + +typedef struct phseg /* physical (symbolic) segment */ +{ +struct phseg *NEXT; /* next segment */ +char *NAME; /* segment name */ +long X1,Y1,X2,Y2; /* segment coordinates */ +long WIDTH; /* segment width */ +char TYPE; /* possibles values: L U R D */ +char LAYER; /* physical layer */ +struct ptype *USER; /* Application specific */ +} +phseg_list; + +typedef struct phvia /* physical contact */ +{ +struct phvia *NEXT; /* next contact */ +char *NAME; /* via name */ +char TYPE; /* contact type: see define */ +long XVIA,YVIA; /* coordinates */ +long DX,DY; /* size of big vias */ +struct ptype *USER; /* Application specific */ +} +phvia_list; + +typedef struct phref /* physical reference */ +{ +struct phref *NEXT; /* next reference */ +char *FIGNAME; /* reference type */ +char *NAME; /* reference name (unique) */ +long XREF,YREF; /* coordinates */ +struct ptype *USER; /* Application specific */ +} +phref_list; + +typedef struct phins /* physical instance */ +{ +struct phins *NEXT; /* next instance */ +char *INSNAME; /* instance name (unique) */ +char *FIGNAME; /* model name */ +long XINS,YINS; /* coordinates */ +char TRANSF; /* possible values: cf define */ +struct ptype *USER; /* Application specific */ +} +phins_list; + +/******************************************************************************* +* externals for physical view * +*******************************************************************************/ +extern phfig_list *HEAD_PHFIG; /* physical figure list head */ + extern phfig_list * addphfig __P((const char *figname)); + extern phins_list * addphins __P((phfig_list *ptfig, const char *figname, const char *insname, char sym, long x, long y)); + extern phvia_list * addphvia __P((phfig_list *ptfig, char viatype, long x, long y, long dx, long dy, const char *name)); + extern phref_list * addphref __P((phfig_list *ptfig, const char *type, const char *name, long x, long y)); + extern phseg_list * addphseg __P((phfig_list *ptfig, char layer, long width, long x1, long y1, long x2, long y2, const char *nodename)); + extern phcon_list * addphcon __P((phfig_list *ptfig, char orient, const char *conname, long x, long y, char layer, long width)); + extern void defab __P((phfig_list *ptfig, long x1, long y1, long x2, long y2)); + extern phfig_list * getphfig __P((const char *figname, char mode)); + extern phins_list * getphins __P((phfig_list *ptfig, const char *insname)); + extern phcon_list * getphcon __P((phfig_list *ptfig, const char *conname, long index)); + extern phref_list * getphref __P((phfig_list *ptfig, const char *refname)); + extern int delphcon __P((phfig_list *ptfig, phcon_list *ptdelcon)); + extern int delphins __P((phfig_list *ptfig, const char *insname)); + extern int delphfig __P((const char *name)); + extern int delphvia __P((phfig_list *ptfig, phvia_list *ptvia)); + extern int delphseg __P((phfig_list *ptfig, phseg_list *ptseg)); + extern int delphref __P((phfig_list *ptfig, phref_list *ptref)); + extern void xyflat __P((long *xout, long *yout, long x, long y, long xins, long yins, long x1, long y1, long x2, long y2, char trsf)); + extern void invxyflat __P((long *x, long *y, long xout, long yout, long xins, long yins, long x1, long y1, long x2, long y2, char trsf)); + extern void viewph __P(()); + +#endif /* !MPH */ + diff --git a/alliance/src/mbk/src/mpu.h b/alliance/src/mbk/src/mpu.h new file mode 100644 index 00000000..d6d88e94 --- /dev/null +++ b/alliance/src/mbk/src/mpu.h @@ -0,0 +1,52 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : physical utilities declaration + * Date : 05/08/93 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mpu.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MPU_H_ +#define _MPU_H_ + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + + extern void flattenphfig __P((phfig_list *ptfig, const char *insname, char concat)); + extern void rflattenphfig __P((phfig_list *ptfig, char concat, char catal)); + extern char instanceface __P((char face, char sym)); + extern void bigvia __P((phfig_list *f, char via, long x, long y, long dx, long dy)); + extern void loadphfig __P((phfig_list *ptfig, const char *figname, char mode)); + extern void savephfig __P((phfig_list *ptfig)); + extern void mphdebug __P((void *head_pnt, char *stru_name)); + +#endif /* !MPU */ + diff --git a/alliance/src/mbk/src/mut.h b/alliance/src/mbk/src/mut.h new file mode 100644 index 00000000..52856a8b --- /dev/null +++ b/alliance/src/mbk/src/mut.h @@ -0,0 +1,310 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Purpose : constantes, externs, and data-structures + * Date : 31/08/93 + * Author : Frederic Petrot + * Modified by Czo 1997,98 + * $Id: mut.h,v 1.1 2002/03/08 13:51:05 fred Exp $ + */ + +#ifndef _MUT_H_ +#define _MUT_H_ + +#include +#include +#include + +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif + +/* namealloc hash table size: the 1230th prime */ +#define HASHVAL 10007 + +/* hash tables management defines */ +#define EMPTYHT -1 +#define DELETEHT -2 + + +/* read-write text-files opening codes: */ +#define READ_TEXT "r" /* read access */ +#define WRITE_TEXT "w" /* write access */ + +/* chain buffer size */ +#define BUFSIZE 1024 +#define SIGSIZE 1024 + +/* USER field codes */ +#define LOFIGCHAIN 4592 +#define PLACEABOX 5749 +#define VTIPARSER 9716 +#define CHECKFEED 6996 +#define UNFLATLOFIG 1992 +#define PTSIGSIZE 8111 + +/* Maximum number of simultaneous terminated process */ +#define ENDCHLD_MAX 1024 +/* Maximum number of autoacknowledge process ( should be the same as + * END_CHLD_MAX ) */ +#define AUTOACKCHLD_MAX 1024 + +/* concatenate names while flattening or copying up */ +#define YES 'Y' +#define NO 'N' + +/* enable debugging of chainlist */ +/* +#define DEBUGCHAIN 1 +*/ + +/******************************************************************************* +* macro definitions * +*******************************************************************************/ +#define EXIT(x) mbkexit(x) + +#define isvdd(name) instr(name, VDD, SEPAR) +#define isvss(name) instr(name, VSS, SEPAR) +#define funcin() if (MBK_DEBUG_ON) \ + HEAD_MBKDEBUG = addptype(HEAD_MBKDEBUG, \ + __LINE__, \ + (void *)__FILE__) +#define funcout() if (MBK_DEBUG_ON && HEAD_MBKDEBUG) \ + HEAD_MBKDEBUG = delptype(HEAD_MBKDEBUG, \ + HEAD_MBKDEBUG->TYPE) + +/******************************************************************************* +* service structures types * +*******************************************************************************/ + +typedef struct point /* point list */ +{ +struct point *NEXT; /* next point */ +long INDEX; /* index (unique) */ +long X,Y; /* coordinates */ +} +point_list; + +typedef struct chain /* pointer list, lisp lists */ +{ +struct chain *NEXT; /* next pointer */ +void *DATA; /* generic pointer */ +#ifdef DEBUGCHAIN +int LINE; +char *FILE; +#endif +} +chain_list; + +typedef struct ptype /* typed pointer list */ +{ +struct ptype *NEXT; /* next pointer */ +void *DATA; /* generic pointer */ +long TYPE; /* type */ +} +ptype_list; + +typedef struct num /* integer list */ +{ +struct num *NEXT; /* next integer */ +long DATA; /* integer value */ +} +num_list; + +typedef struct endchld /* list of ended process */ +{ + struct endchld *NEXT; + int PID; + int STATUS; +} endchld_list; + +typedef struct autoackchld /* list of process auto-ack */ +{ + struct autoackchld *NEXT; + int PID; +} autoackchld_list; + +/****************************************************************************** +* hash table structures types * +******************************************************************************/ +typedef struct htitem { /* hash table element */ + void *key; /* pointer for access */ + long value; /* associated value */ +} htitem; + +typedef struct htable { /* hash table itself */ + long length; /* table length */ + htitem *pElem; /* pointer to table start */ + long count; /* number of inserted elements */ +} ht; + +/******************************************************************************* +* mbk externals for the global variables defined in mbk_util.c * +*******************************************************************************/ +extern chain_list *HEAD_CHAIN; /* chain list buffer head */ +extern chain_list *HEAD_BLOCK_CHAIN; +extern ptype_list *HEAD_PTYPE; /* ptype list buffer head */ +extern num_list *HEAD_NUM; /* num list buffer head */ +extern char TRACE_MODE; /* trace if Y */ +extern int TRACE_FILE; /* trace if >0 */ +extern int TRACE_GETENV; /* trace if >0 */ +extern char DEBUG_MODE; /* debug if Y */ +extern char FAST_MODE; /* no consistency control if Y */ +extern char *WORK_LIB; /* working directory */ +extern char **CATA_LIB; /* read only directory */ +extern char *CATAL; /* catalog file name */ +extern char SEPAR; /* char used for concatenation */ +extern char IN_LO[]; /* logical input format */ +extern char IN_PH[]; /* physical input format */ +extern char OUT_LO[]; /* logical output format */ +extern char OUT_PH[]; /* physical output format */ +extern long SCALE_X; /* distance scale parameter */ +extern char PARSER_INFO[]; /* version number, and so on */ +extern char *VDD; /* user name for power high */ +extern char *VSS; /* user name for power ground */ +extern ptype_list *HEAD_MBKDEBUG; /* function debug list */ +extern char MBK_DEBUG_ON; /* mode for debug on/off */ +extern char *IN_FILTER; +extern char *OUT_FILTER; +extern char *FILTER_SFX; +extern char MBKFOPEN_NAME[]; /* dernier fichier ouvert */ +extern char MBKFOPEN_FILTER; +extern endchld_list *HEAD_ENDCHLD; /* list of terminated process */ +extern endchld_list *HEAD_ENDCHLD_FREE; +extern int STAT_ENDCHLD; +extern autoackchld_list *HEAD_AUTOACKCHLD; /* list of terminated process */ +extern autoackchld_list *HEAD_AUTOACKCHLD_FREE; +extern int STAT_AUTOACKCHLD; + + +extern void (*MBK_EXIT_FUNCTION)(); /* Added by Ludovic Jacomme */ +extern void mbkexit __P(( int ExitValue )); /* new exit handler system */ + +/******************************************************************************* +* externals for mbk_util.c functions * +*******************************************************************************/ + + extern void mbkenv __P(()); + extern char * nameindex __P((char *name, long index)); + extern num_list * addnum __P((num_list *ptnum, long data)); + extern void freenum __P((num_list *pt)); + +#if (defined(__STDC__) || defined(__GNUC__)) && defined(DEBUGCHAIN) +#define addchain( a, b ) (chain_list*)fnaddchain(a,b,__LINE__,__FILE__) +#elif defined(DEBUGCHAIN) +#define addchain( a, b ) (chain_list*)fnaddchain(a,b,0,"") +#endif + +#ifdef DEBUGCHAIN + extern chain_list * fnaddchain __P((chain_list *pthead, void *ptdata, int, char*)); +#else + extern chain_list * addchain __P((chain_list *pthead, void *ptdata)); +#endif + + extern chain_list * delchain __P((chain_list *pthead, chain_list *ptdel)); + extern void freechain __P((chain_list *pt)); + extern void testchain(); + extern ptype_list * addptype __P((ptype_list *pthead, long type, void *ptdata)); + extern ptype_list * delptype __P((ptype_list *pthead, long type)); + extern void freeptype __P((ptype_list *pt)); + extern ptype_list * getptype __P((ptype_list *pthead, long type)); + extern chain_list * append __P((chain_list *pt1, chain_list *pt2)); + extern char * namealloc __P((const char *inputname)); + extern char * namefind __P((const char *inputname)); + extern char * mbkstrdup __P((const char *s)); + extern void downstr __P((const char *s, char *t)); + extern void upstr __P((const char *s, char *t)); + extern char * instr __P((char *s, const char *find, char separ)); + extern char * vectorize __P((const char *radical, long index)); + extern char * vectorradical __P((char *name)); + extern int vectorindex __P((const char *name)); + extern char * concatname __P((const char *name1, const char *name2)); + extern chain_list * reverse __P((chain_list *head)); + extern int naturalstrcmp __P((const char *s, const char *t)); + extern ht * addht __P((unsigned long len)); + extern long gethtitem __P((ht *pTable, void *key)); + extern long addhtitem __P((ht *pTable, void *key, long value)); + extern long sethtitem __P((ht *pTable, void *key, long value)); + extern long delhtitem __P((ht *pTable, void *key)); + extern void viewht __P((ht *pTable, char *(*pout)())); + extern void delht __P((ht *pTable)); + extern int incatalog __P((const char *figname)); + extern int incataloggds __P((const char *figname)); + extern int incatalogfeed __P((const char *figname)); + extern int incatalogdelete __P((const char *figname)); + extern void alliancebanner __P((const char *tool, const char *tv, const char *comment, const char *date, const char *av)); + extern void alliancebanner_with_authors __P((const char *tool, const char *tv, const char *comment, const char *date, const char *av, const char *authors)); + extern void alliancebanner_with_contrib __P((const char *tool, const char *tv, const char *comment, const char *date, const char *av, const char *authors, const char *contrib)); + extern int mbkwaitpid __P(( int, int, int* )); + extern void mbkinitendchld __P((void)); + extern endchld_list* mbkgetendchld __P((void)); + extern void mbkfreeendchld __P((endchld_list*)); + extern void mbksetautoackchld __P(( int )); + extern void mbkinitautoackchld __P(( void )); + extern void mbkfreeautoackchld __P(( autoackchld_list* )); + extern autoackchld_list* mbkgetautoackchld __P(( void )); + +/******************************************************************************* +* externals for mbk_sys.c functions * +*******************************************************************************/ + extern void *mbkalloc __P((unsigned int nbytes)); + extern void *mbkrealloc __P((void *pt, unsigned int nbytes)); + extern void mbkfree __P((void *ptr)); + extern char *mbkgetenv __P((const char *name)); + extern FILE *mbkfopen __P((const char *name, const char *extension, const char *mode)); + extern int mbkunlink __P((const char *name, const char *extension)); + extern char *filepath __P((const char *name, const char *extension)); + extern char **decompfilter __P((const char*)); + extern FILE *mbkpopen __P((const char*, const char*, char)); + extern void mbkps __P((void)); + extern void mbkackchld __P(( int )); + +/******************************************************************************* +* externals for mbk_fake.c or parsers drivers functions * +*******************************************************************************/ +extern void vtiloadphfig(); +extern void vtiloadlofig(); +extern void alcloadphfig(); +extern void alcloadlofig(); +extern void spiceloadlofig(); +extern void vhdlloadlofig(); +extern void hiloloadlofig(); +extern void edifloadlofig(); +extern void vtisavephfig(); +extern void vtisavelofig(); +extern void alcsavephfig(); +extern void alcsavelofig(); +extern void spicesavelofig(); +extern void vhdlsavelofig(); +extern void hilosavelofig(); +extern void edifsavelofig(); +extern void vlogsavelofig(); +extern void mgnloadphfig(); +extern void mgnsavephfig(); + +#endif /* !MUTL */ diff --git a/alliance/src/mbk/src/rcn.h b/alliance/src/mbk/src/rcn.h new file mode 100644 index 00000000..1837d509 --- /dev/null +++ b/alliance/src/mbk/src/rcn.h @@ -0,0 +1,223 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ident "$Id: rcn.h,v 1.1 2002/03/08 13:51:05 fred Exp $" + +/******************************************************************************* +* rcn : constantes, externs, and data-structures * +* * +* version : 2.00 * +* date : 09/01/98 * +*******************************************************************************/ + +/******************************************************************************* +* Gregoire AVOT * +* Laboratoire LIP6 - Departement ASIM * +* Universite Paris 6 - Pierre et Marie Curie * +* 4, Place Jussieu * +* Paris Cedex 05. * +*******************************************************************************/ + +#ifndef RCNH +#define RCNH + +/* layer of wire */ +#define RCN_WIRE_UNKNOW ((unsigned char) 0x00000001) +#define RCN_WIRE_POLY ((unsigned char) 0x00000002) +#define RCN_WIRE_ALU1 ((unsigned char) 0x00000003) +#define RCN_WIRE_ALU2 ((unsigned char) 0x00000004) +#define RCN_WIRE_CONT_POLY ((unsigned char) 0x00000005) +#define RCN_WIRE_CONT_DIF_N ((unsigned char) 0x00000006) +#define RCN_WIRE_CONT_DIF_P ((unsigned char) 0x00000007) +#define RCN_WIRE_CONT_VIA ((unsigned char) 0x00000008) +#define RCN_WIRE_CONT_VIA2 ((unsigned char) 0x00000009) +#define RCN_WIRE_CAPA ((unsigned char) 0x00000010) +#define RCN_WIRE_RESI ((unsigned char) 0x00000020) + +/* Heap allocation */ +#define RCNBUFSIZE 64 + +/* State of a losig */ +#define MBK_RC_A ((int) 1) +#define MBK_RC_B ((int) 2) +#define MBK_RC_C ((int) 3) +#define MBK_RC_D ((int) 4) +#define MBK_RC_E ((int) 5) + +/* node type for lonode ptype */ +#define RCN_LOCON ((long) 19981201) +#define RCN_REPORTED ((long) 19981301) + +/* flags for lonode */ + +#define RCN_FLAG_ONE ((unsigned char) 0x00000001) /* Terminal node */ +#define RCN_FLAG_TWO ((unsigned char) 0x00000002) /* two wires connected */ +#define RCN_FLAG_CROSS ((unsigned char) 0x00000004) /* many wires connected */ +#define RCN_FLAG_LOCON ((unsigned char) 0x00000008) /* the node is a locon */ +#define RCN_FLAG_PASS ((unsigned char) 0x00000010) /* yet treated */ + +#define RCN_FLAG_TRUE ((unsigned char) 0x0000000F) /* true node */ + +/* flags for lowire */ + +#define RCN_FLAG_PASS ((unsigned char) 0x00000010) /* yet treated */ +#define RCN_FLAG_DEL ((unsigned char) 0x00000020) /* not a valid wire */ + +/* macro to use with flags */ + +#define RCN_SETFLAG(m,b) (m=(m)|(b)) +#define RCN_CLEARFLAG(m,b) (m=(m)&(~b)) +#define RCN_GETFLAG(m,b) ((m)&(b)) + +/* Macro to get the node table */ +#define RCN_LONODE 15543 +#define RCN_SIZETAB 15544 + +/* Ptype in lofig for order of physical order of locon on figure */ +#define PH_INTERF 19980318 + +/* Ptype in locon for name of physical connector (spice parser) */ +#define PNODENAME 19981103 + +/* Ptype in lonode for retreive the component connexe */ +#define CONNEXE 19990808 +/******************************************************************************* +* interconnect network structures * +*******************************************************************************/ + +typedef struct lorcnet /* logical rc network */ +{ +float CAPA; /* total capacitance */ +struct lowire *PWIRE; /* wire list */ +long NBNODE; /* number of lonode */ +chain_list *PCTC; /* cross talk capacitance */ +struct ptype *USER; /* Application specific */ +} +lorcnet_list; + +typedef struct lowire /* logical wire */ +{ +struct lowire *NEXT; /* next wire */ +long NODE1; /* interconnect network node1 */ +long NODE2; /* interconnect network node2 */ +unsigned char LAYER; /* physical layer */ +unsigned char FLAG; /* flags */ +float RESI; /* wire resistance */ +float CAPA; /* wire capacitance */ +long X; /* x position */ +long Y; /* y position */ +long DX; /* x rectangle wide */ +long DY; /* y rectangle length */ +struct ptype *USER; /* Application specific */ +} +lowire_list; + +typedef struct lonode /* logical node */ +{ +struct chain *WIRELIST; /* wire list */ +struct chain *CTCLIST; /* cross talk capacitance list */ +long FLAG; /* Flags */ +long INDEX; /* node index */ +struct ptype *USER; /* wire list */ +} +lonode_list; + +typedef struct loctc /* cross talk capacitance */ +{ +struct losig *SIG1; /* First losig */ +struct losig *SIG2; /* Second losig */ +long NODE1; /* first lonode */ +long NODE2; /* first lonode */ +float CAPA; /* cross talk capacitance */ +struct ptype *USER; /* application specific */ +} loctc_list; + +/******************************************************************************* +* externals for rcn view * +*******************************************************************************/ + +extern int rclevel __P((losig_list*)); +extern chain_list *gettabnode __P((lorcnet_list*)); +extern lorcnet_list *addlorcnet __P((losig_list *ptsig)); +extern lorcnet_list *givelorcnet __P((losig_list *ptsig)); +extern int freelorcnet __P((losig_list *ptsig)); + /* Il faut qu'il y ait un lofigchain */ + +extern float addcapa __P((losig_list *ptsig,float value)); +extern float setcapa __P((losig_list *ptsig,float value)); +extern float getcapa __P((losig_list *ptsig)); +extern float rcncalccapa __P((losig_list *ptsig)); +extern long addonode __P((losig_list *ptsig,locon_list *ptlocon)); +extern long addlonode __P((losig_list *ptsig,locon_list *ptlocon)); +extern lonode_list *getlonode __P((losig_list *ptsig, long index)); +extern lowire_list *addlowire __P((losig_list *ptsig, unsigned char layer, + unsigned char flag, float resi, + float capa, long x, long y, long dx, + long dy, long n1, long n2 )); +extern int dellowire __P((losig_list *ptsig, long node1, + long node2 )); +extern lowire_list *getlowire __P((losig_list *ptsig, long node1, + long node2 )); +extern loctc_list *addloctc __P((losig_list *ptsig1, long node1, + losig_list *ptsig2, long node2, + float value )); +extern int delloctc __P(( losig_list *ptsig1, long node1, + losig_list *ptsig2, long node2 )); +extern loctc_list *getloctc __P(( losig_list *ptsig1, long node1, + losig_list *ptsig2, long node2 )); +extern chain_list *getallctc __P(( lofig_list *ptfig )); +extern void freectclist __P(( lofig_list*, chain_list* )); +extern void freectcsig __P(( chain_list* )); +extern void setloconnode __P((locon_list *ptlocon, long node)); +extern void delloconnode __P((locon_list *ptcon, long index)); +extern chain_list *getloconnode __P((lonode_list *node)); +extern void delrcnlocon __P((locon_list *ptloc)); +extern void addcapawire __P((lowire_list *ptwire,float capa)); +extern void setcapawire __P((lowire_list *ptwire,float capa)); +extern void addresiwire __P((lowire_list *ptwire,float resi)); +extern void setresiwire __P((lowire_list *ptwire,float resi)); +extern void addpararesiwire __P((lowire_list *ptwire, float resi)); + +extern void buildtable __P((losig_list *ptsig)); +extern void freetable __P((losig_list *ptsig)); +extern int chkloop __P((losig_list *ptsig)); +/* 0 : no loop, 1 no node table, 2 : loop */ +extern lonode_list *givelonode __P((losig_list *ptsig, long index)); + +extern void chkrcn __P((losig_list *ptsig)); +void clearallwireflag __P(( lorcnet_list *ptrcnet, + unsigned char flag )); +extern void statrcn __P((void)); +extern void setdellowire __P(( losig_list*, lowire_list* )); +extern void mergedellowire __P(( losig_list* )); + +/******************************************************************************* +* Include for rcn_lo_util.c * +*******************************************************************************/ + +extern void duplorcnet __P((losig_list*, losig_list*)); +extern int breakloop __P(( losig_list* )); +extern int reduce_rcn __P(( losig_list* )); +extern int connexe __P(( losig_list* )); +extern int cleanrcnet __P(( losig_list* )); +#endif /* !RCNH */ diff --git a/alliance/src/mbk/src/rcn_lo.c b/alliance/src/mbk/src/rcn_lo.c new file mode 100644 index 00000000..c4de795f --- /dev/null +++ b/alliance/src/mbk/src/rcn_lo.c @@ -0,0 +1,2602 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ident "$Id: rcn_lo.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +/******************************************************************************* +* rcn : acces functions to logical rc network structures * +* * +* version : 1.02 * +* date : 07/06/96 * +*******************************************************************************/ + +/******************************************************************************* +* Grégoire AVOT * +* Laboratoire LIP6 - Département ASIM * +* Universite Paris 6 - Pierre et Marie Curie * +* 4, Place Jussieu * +* Paris Cedex 05. * +*******************************************************************************/ + +#include "mut.h" +#include "mlo.h" +#include "rcn.h" +#include "rcn_lo.h" + +lorcnet_list *HEAD_RCNET_FREE = NULL; +unsigned int NBRCNET=0; +lowire_list *HEAD_WIRE_FREE = NULL; +unsigned int NBWIRE=0; +loctc_list *HEAD_CTC_FREE = NULL; +unsigned int NBCTC=0; + +/******************************************************************************* +* function addlorcnet() * +*******************************************************************************/ +lorcnet_list *addlorcnet(ptsig) +losig_list *ptsig; +{ + + if( ptsig->PRCN ) + { + (void)fflush(stdout); + (void)fprintf(stderr, "*** rcn error *** : addlorcnet() impossible\n"); + (void)fprintf(stderr, "rc network already exists on signal %ld\n", + ptsig->INDEX); + EXIT(-1); + } + + ptsig->PRCN = heaprcnet(); + ptsig->PRCN->PWIRE = NULL; + ptsig->PRCN->PCTC = NULL; + + return( ptsig->PRCN ); +} + +/******************************************************************************* +* function givelorcnet() * +*******************************************************************************/ +lorcnet_list *givelorcnet(ptsig) +losig_list *ptsig; +{ + if( ! ptsig->PRCN ) + ptsig->PRCN = heaprcnet(); + return( ptsig->PRCN ); +} + +/******************************************************************************* +* function getcapa() * +*******************************************************************************/ +float getcapa(ptsig) +losig_list *ptsig; +{ + if( !ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : getcapa() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + return( ptsig->PRCN->CAPA ); +} + +/******************************************************************************* +* function setcapa() * +*******************************************************************************/ +float setcapa(ptsig,value) +losig_list *ptsig; +float value; +{ + + if( !ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : setcapa() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + ptsig->PRCN->CAPA = value ; + return( ptsig->PRCN->CAPA ); +} + +/******************************************************************************* +* function addcapa() * +*******************************************************************************/ +float addcapa(ptsig,value) +losig_list *ptsig; +float value; +{ + if( !ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : addcapa() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + ptsig->PRCN->CAPA = ptsig->PRCN->CAPA + value ; + return( ptsig->PRCN->CAPA ); +} + +/******************************************************************************* +* function addlowire() * +*******************************************************************************/ +lowire_list *addlowire(ptsig, layer, flag, resi, capa, x, y, dx, dy, n1, n2) +losig_list *ptsig; +unsigned char layer; +unsigned char flag; +float resi; +float capa; +long x; +long y; +long dx; +long dy; +long n1; +long n2; +{ + lowire_list *ptwire; + lonode_list *ptnode1; + lonode_list *ptnode2; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : addlowire() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + ptwire = heaplowire(); + ptwire->FLAG = flag; + ptwire->LAYER = layer; + ptwire->RESI = resi; + ptwire->CAPA = capa; + ptwire->X = x; + ptwire->Y = y; + ptwire->DX = dx; + ptwire->DY = dy; + ptwire->NODE1 = n1; + ptwire->NODE2 = n2; + ptwire->USER = NULL; + ptwire->NEXT = ptsig->PRCN->PWIRE; + + ptsig->PRCN->PWIRE = ptwire; + + if( gettabnode( ptsig->PRCN ) ) + { + ptnode1 = givelonode(ptsig, n1); + ptnode2 = givelonode(ptsig, n2); + ptnode1->WIRELIST = addchain(ptnode1->WIRELIST,ptwire); + ptnode2->WIRELIST = addchain(ptnode2->WIRELIST,ptwire); + + switch( RCN_GETFLAG(ptnode1->FLAG,RCN_FLAG_ONE|RCN_FLAG_CROSS|RCN_FLAG_TWO)) + { + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_CROSS); + case RCN_FLAG_CROSS: + break; + default: + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + } + + switch( RCN_GETFLAG(ptnode2->FLAG,RCN_FLAG_ONE|RCN_FLAG_CROSS|RCN_FLAG_TWO)) + { + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_CROSS); + break; + case RCN_FLAG_CROSS: + break; + default: + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + } + } + + if( n1 >= ptsig->PRCN->NBNODE ) + ptsig->PRCN->NBNODE = n1+1; + if( n2 >= ptsig->PRCN->NBNODE ) + ptsig->PRCN->NBNODE = n2+1; + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- rcn --- addlowire : between node %ld and node %ld on signal %ld\n", + ptwire->NODE1, ptwire->NODE2, ptsig->INDEX); + + return ptwire; +} + +/******************************************************************************* +* function addloctc() * +*******************************************************************************/ + +loctc_list* addloctc( ptsig1, node1, ptsig2, node2, value ) +losig_list *ptsig1; +long int node1; +losig_list *ptsig2; +long int node2; +float value; +{ + loctc_list *newctc; + lonode_list *ptnode1; + lonode_list *ptnode2; + + if( !ptsig1->PRCN ) + { + fflush ( stdout ); + fprintf( stderr, "*** mbk error *** : addloctc() impossible.\n" ); + fprintf( stderr, "No rc data on signal %ld.\n", ptsig1->INDEX ); + EXIT(1); + } + + if( !ptsig2->PRCN ) + { + fflush ( stdout ); + fprintf( stderr, "*** mbk error *** : addloctc() impossible.\n" ); + fprintf( stderr, "No rc data on signal %ld.\n", ptsig2->INDEX ); + EXIT(1); + } + + newctc = heaploctc(); + + newctc->CAPA = value; + newctc->SIG1 = ptsig1; + newctc->NODE1 = node1; + newctc->SIG2 = ptsig2; + newctc->NODE2 = node2; + + /* Pas de verification de l'existence d'une capa */ + + ptsig1->PRCN->PCTC = addchain( ptsig1->PRCN->PCTC, newctc ); + + if( ptsig1 != ptsig2 ) + ptsig2->PRCN->PCTC = addchain( ptsig2->PRCN->PCTC, newctc ); + + + if( gettabnode(ptsig1->PRCN) && node1 ) + { + ptnode1 = givelonode( ptsig1, node1 ); + ptnode1->CTCLIST = addchain( ptnode1->CTCLIST, newctc ); + } + + if( ptsig1->PRCN->NBNODE <= node1 ) + ptsig1->PRCN->NBNODE = node1+1; + + if( gettabnode(ptsig2->PRCN) && node2 ) + { + ptnode2 = givelonode( ptsig2, node2 ); + ptnode2->CTCLIST = addchain( ptnode2->CTCLIST, newctc ); + } + + if( ptsig2->PRCN->NBNODE <= node2 ) + ptsig2->PRCN->NBNODE = node2+1; + + return( newctc ); +} + +/******************************************************************************* +* function delloctc() * +*******************************************************************************/ +int delloctc( ptsig1, node1, ptsig2, node2 ) +losig_list *ptsig1; +long int node1; +losig_list *ptsig2; +long int node2; +{ + chain_list *ptloctc1; + chain_list *ptloctc2=NULL; + loctc_list *ptloctc; + chain_list *prev1; + chain_list *prev2=NULL; + + chain_list *scanchain; + lonode_list *ptnode; + + + if( !ptsig1->PRCN ) + { + fflush ( stdout ); + fprintf( stderr, "*** mbk error *** : delloctc() impossible.\n" ); + fprintf( stderr, "No rc data on signal %ld.\n", ptsig1->INDEX ); + EXIT(1); + } + + if( !ptsig2->PRCN ) + { + fflush ( stdout ); + fprintf( stderr, "*** mbk error *** : delloctc() impossible.\n" ); + fprintf( stderr, "No rc data on signal %ld.\n", ptsig2->INDEX ); + EXIT(1); + } + + /* Cherche le loctc */ + + ptloctc = NULL; + + prev1 = NULL; + + for( ptloctc1 = ptsig1->PRCN->PCTC ; + ptloctc1 != NULL ; + ptloctc1 = ptloctc1->NEXT ) + { + ptloctc = (loctc_list*) ptloctc1->DATA ; + + if( ptloctc->SIG1 == ptsig1 && + ptloctc->SIG2 == ptsig2 ) + { + if( ( ( node1 && ptloctc->NODE1 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE2 == node2 ) || !node2 ) ) + break; + } + + if( ptloctc->SIG1 == ptsig2 && + ptloctc->SIG2 == ptsig1 ) + { + if( ( ( node1 && ptloctc->NODE2 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE1 == node2 ) || !node2 ) ) + break; + } + + prev1 = ptloctc1; + } + + if( !ptloctc1 ) + return( 0 ); + + if( ptsig1 != ptsig2 ) + { + prev2 = NULL; + + for( ptloctc2 = ptsig2->PRCN->PCTC ; + ptloctc2 != NULL ; + ptloctc2 = ptloctc2->NEXT ) + { + ptloctc = (loctc_list*) ptloctc2->DATA ; + + if( ptloctc->SIG1 == ptsig1 && + ptloctc->SIG2 == ptsig2 ) + { + if( ( ( node1 && ptloctc->NODE1 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE2 == node2 ) || !node2 ) ) + break; + } + + if( ptloctc->SIG1 == ptsig2 && + ptloctc->SIG2 == ptsig1 ) + { + if( ( ( node1 && ptloctc->NODE2 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE1 == node2 ) || !node2 ) ) + break; + } + + prev2 = ptloctc2; + } + + if( !ptloctc2) + { + fflush( stdout ); + fprintf( stderr, "Erreur interne dans delloctc. Atchoum!, j'ai froid, je meurs...\n" ); + EXIT(1); + } + } + /* Cleanning element in lorcnet */ + + if( prev1 == NULL ) + ptsig1->PRCN->PCTC = ptloctc1->NEXT; + else + prev1->NEXT = ptloctc1->NEXT; + ptloctc1->NEXT = NULL; + freechain( ptloctc1 ); + + if( ptsig1 != ptsig2 ) + { + if( prev2 == NULL ) + ptsig2->PRCN->PCTC = ptloctc2->NEXT; + else + prev2->NEXT = ptloctc2->NEXT; + ptloctc2->NEXT = NULL; + freechain( ptloctc2 ); + } + + /* cleanning element in table */ + + if( gettabnode( ptloctc->SIG1->PRCN ) && ptloctc->NODE1 ) + { + ptnode = getlonode( ptloctc->SIG1, ptloctc->NODE1 ); + prev1 = NULL; + + for( scanchain = ptnode->CTCLIST ; scanchain ; scanchain = scanchain->NEXT ) + { + if( scanchain->DATA == ptloctc ) + break; + prev1 = scanchain; + } + + if( prev1 ) + prev1->NEXT = scanchain->NEXT; + else + ptnode->CTCLIST = scanchain->NEXT; + + scanchain->NEXT = NULL; + freechain( scanchain ); + } + + if( gettabnode( ptloctc->SIG2->PRCN ) && ptsig1 != ptsig2 && ptloctc->NODE2 ) + { + ptnode = getlonode( ptloctc->SIG2, ptloctc->NODE2 ); + prev2 = NULL; + + for( scanchain = ptnode->CTCLIST ; scanchain ; scanchain = scanchain->NEXT ) + { + if( scanchain->DATA == ptloctc ) + break; + prev2 = scanchain; + } + + if( prev2 ) + prev2->NEXT = scanchain->NEXT; + else + ptnode->CTCLIST = scanchain->NEXT; + + scanchain->NEXT = NULL; + freechain( scanchain ); + } + + /* Really clean the loctc */ + + freeloctc( ptloctc ); + + return(1); +} + +/******************************************************************************* +* function getloctc() * +*******************************************************************************/ +loctc_list* getloctc( ptsig1, node1, ptsig2, node2 ) +losig_list *ptsig1; +long int node1; +losig_list *ptsig2; +long int node2; +{ + chain_list *ptloctc1; + loctc_list *ptloctc; + lonode_list *ptnode; + + if( ! ptsig1->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : getloctc() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig1->INDEX); + EXIT(1); + } + + if( ! ptsig2->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : getloctc() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig2->INDEX); + EXIT(1); + } + + if( gettabnode(ptsig1->PRCN) ) + { + ptnode = getlonode( ptsig1, node1 ); + for( ptloctc1 = ptnode->CTCLIST ; + ptloctc1 != NULL ; + ptloctc1 = ptloctc1->NEXT ) + { + ptloctc = (loctc_list*) ptloctc1->DATA ; + + if( ptloctc->SIG1 == ptsig1 && + ptloctc->SIG2 == ptsig2 ) + { + if( ( ( node1 && ptloctc->NODE1 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE2 == node2 ) || !node2 ) ) + return( ptloctc ); + } + + if( ptloctc->SIG1 == ptsig2 && + ptloctc->SIG2 == ptsig1 ) + { + if( ( ( node1 && ptloctc->NODE2 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE1 == node2 ) || !node2 ) ) + return( ptloctc ); + } + } + return(NULL); + } + + for( ptloctc1 = ptsig1->PRCN->PCTC ; + ptloctc1 != NULL ; + ptloctc1 = ptloctc1->NEXT ) + { + ptloctc = (loctc_list*) ptloctc1->DATA ; + + if( ptloctc->SIG1 == ptsig1 && + ptloctc->SIG2 == ptsig2 ) + { + if( ( ( node1 && ptloctc->NODE1 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE2 == node2 ) || !node2 ) ) + return( ptloctc ); + } + + if( ptloctc->SIG1 == ptsig2 && + ptloctc->SIG2 == ptsig1 ) + { + if( ( ( node1 && ptloctc->NODE2 == node1 ) || !node1 ) && + ( ( node2 && ptloctc->NODE1 == node2 ) || !node2 ) ) + return( ptloctc ); + } + } + + return(NULL); +} + +/******************************************************************************* +* function freectclist() * +*******************************************************************************/ +void freectclist( ptfig, headsig ) +lofig_list *ptfig; +chain_list *headsig; +{ + chain_list *allsig; + losig_list *scansig; + + if( headsig == NULL ) + { + allsig = NULL; + for( scansig = ptfig->LOSIG ; scansig ; scansig = scansig->NEXT ) + if( scansig->PRCN ) + allsig = addchain( allsig, scansig ); + } + else + allsig = headsig; + + if( allsig ) + freectcsig( allsig ); + + if( allsig && !headsig ) + freechain( allsig ); +} + +/******************************************************************************* +* function freectcsig() * +*******************************************************************************/ +void freectcsig( headsig ) +chain_list *headsig; +{ + chain_list *boulot; + loctc_list *ptctc; + chain_list *efface; + chain_list *sc1; + chain_list *sc2; + chain_list *sc3; + losig_list *ptsig; + chain_list *prev; + lonode_list *ptnode; + + efface = NULL; + boulot = NULL; + + for( sc1 = headsig ; sc1 ; sc1 = sc1->NEXT ) + { + ptsig = (losig_list*)(sc1->DATA); + if( ptsig->PRCN ) + { + for( sc2 = ptsig->PRCN->PCTC ; sc2 ; sc2 = sc2->NEXT) + { + ptctc = (loctc_list*)( sc2->DATA ); + if( ptctc->CAPA >=0.0 ) + { + ptctc->CAPA = -1.0; + + if( !getptype( ptctc->SIG1->USER, RCN_REPORTED ) ) + { + ptctc->SIG1->USER = addptype( ptctc->SIG1->USER, + RCN_REPORTED, + NULL + ); + boulot = addchain( boulot, ptctc->SIG1 ); + } + + if( !getptype( ptctc->SIG2->USER, RCN_REPORTED ) ) + { + ptctc->SIG2->USER = addptype( ptctc->SIG2->USER, + RCN_REPORTED, + NULL + ); + boulot = addchain( boulot, ptctc->SIG2 ); + } + + efface = addchain( efface, ptctc ); + } + } + } + } + + for( sc3 = boulot ; sc3 ; sc3 = sc3->NEXT ) + { + ptsig = (losig_list*)(sc3->DATA); + ptsig->USER = delptype( ptsig->USER, RCN_REPORTED ); + + prev = NULL; + sc1 = ptsig->PRCN->PCTC ; + + while( sc1 ) + { + ptctc = (loctc_list*) sc1->DATA ; + sc2 = sc1->NEXT; + + if( ptctc->CAPA == -1.0 ) + { + if( sc1 == ptsig->PRCN->PCTC ) + ptsig->PRCN->PCTC = sc2; + else + prev->NEXT = sc2; + + sc1->NEXT = NULL; + freechain( sc1 ); + } + else + prev = sc1; + sc1 = sc2; + } + } + + for( sc1 = efface ; sc1 ; sc1 = sc1->NEXT ) + { + ptctc = (loctc_list*)(sc1->DATA); + + if( gettabnode( ptctc->SIG1->PRCN ) && ptctc->NODE1 ) + { + ptnode = getlonode( ptctc->SIG1, ptctc->NODE1 ); + prev = NULL; + + for( sc2 = ptnode->CTCLIST ; sc2 ; sc2 = sc2->NEXT ) + { + if( sc2->DATA == ptctc ) + break; + prev = sc2; + } + + if( prev ) + prev->NEXT = sc2->NEXT; + else + ptnode->CTCLIST = sc2->NEXT; + + sc2->NEXT = NULL; + freechain( sc2 ); + } + + if( gettabnode( ptctc->SIG2->PRCN ) && ptctc->NODE2 ) + { + ptnode = getlonode( ptctc->SIG2, ptctc->NODE2 ); + prev = NULL; + + for( sc2 = ptnode->CTCLIST ; sc2 ; sc2 = sc2->NEXT ) + { + if( sc2->DATA == ptctc ) + break; + prev = sc2; + } + + if( prev ) + prev->NEXT = sc2->NEXT; + else + ptnode->CTCLIST = sc2->NEXT; + + sc2->NEXT = NULL; + freechain( sc2 ); + } + + freeloctc( ptctc ); + } + + freechain( efface ); + freechain( boulot ); +} + +/******************************************************************************* +* function addlonode() * +*******************************************************************************/ +long addlonode(ptsig, ptlocon) +losig_list *ptsig; +locon_list *ptlocon; +{ + int dispo; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : addlonode() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + dispo = ptsig->PRCN->NBNODE; + ptsig->PRCN->NBNODE++ ; + + if(ptlocon != NULL) + setloconnode(ptlocon, dispo ); + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- rcn --- addlonode : on signal %ld\n", + ptsig->INDEX); + + return( dispo ); +} + +/******************************************************************************* +* function freelorcnet() * +*******************************************************************************/ +int freelorcnet(signal) +losig_list *signal; +{ + lowire_list *scanwire; + lowire_list *prevwire; + ptype_list *pt; + chain_list *scancon; + locon_list *ptcon; + chain_list *delsig; + + + if( ! signal->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : freelorcnet() impossible.\n"); + fprintf(stderr,"no rc view on signal %ld.\n",signal->INDEX); + EXIT(1); + } + + pt = getptype( signal->USER, LOFIGCHAIN ); + if( !pt ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : freelorcnet() impossible.\n"); + fprintf(stderr,"Call the function lofigchain() before delloconnode.\n"); + EXIT(1); + } + + /* Libère la table des noeuds */ + if( gettabnode(signal->PRCN) ) + freetable(signal); + + /* Efface les PNODEs des locons sur le signal */ + for( scancon = (chain_list*)(pt->DATA) ; scancon ; scancon = scancon->NEXT ) + { + ptcon = (locon_list*)(scancon->DATA); + + if( ptcon->PNODE ) + { + freenum(ptcon->PNODE); + ptcon->PNODE = NULL; + } + } + + /* efface les wire */ + + if( signal->PRCN->PWIRE ) + { + prevwire = NULL; + + for( scanwire = signal->PRCN->PWIRE ; + scanwire != NULL ; + scanwire = scanwire->NEXT) + { + if(prevwire) + freelowire(prevwire); + prevwire=scanwire; + } + + if(prevwire) + freelowire(prevwire); + } + + /* efface les ctc */ + + delsig = addchain( NULL, signal ); + freectcsig( delsig ); + freechain( delsig ); + + /* Finallement, on efface le reseau lui meme */ + freercnet(signal->PRCN); + signal->PRCN = NULL; + + return(1); +} + +/******************************************************************************* +* function dellowire() * +*******************************************************************************/ +int dellowire(ptsig, node1, node2) +losig_list *ptsig; +long node1; +long node2; +{ +lowire_list *ptwire; +lowire_list *ptsav=NULL; +lonode_list *ptnode1; +lonode_list *ptnode2; +chain_list *ptchain; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : dellowire() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + for (ptwire = ptsig->PRCN->PWIRE; ptwire != NULL ; ptwire = ptwire->NEXT) + { + if( (ptwire->NODE1 == node1 && ptwire->NODE2 == node2) + || (ptwire->NODE1 == node2 && ptwire->NODE2 == node1) ) + break; + ptsav = (void *)ptwire; + } + + if (ptwire == NULL) + return 0; + else + { + if (ptwire == ptsig->PRCN->PWIRE) /* premier de la liste */ + ptsig->PRCN->PWIRE = ptwire->NEXT; + else + ptsav->NEXT = ptwire->NEXT; + } + + freelowire(ptwire); + + if( gettabnode(ptsig->PRCN) != NULL) + { + ptnode1 = getlonode(ptsig, node1); + ptnode2 = getlonode(ptsig, node2); + + /* optimiser */ + for(ptchain = ptnode1->WIRELIST;ptchain != NULL;ptchain = ptchain->NEXT) + if(ptchain->DATA == (void *)ptwire) break; + ptnode1->WIRELIST = delchain(ptnode1->WIRELIST,ptchain); + + for(ptchain = ptnode2->WIRELIST;ptchain != NULL;ptchain = ptchain->NEXT) + if(ptchain->DATA == (void *)ptwire) break; + ptnode2->WIRELIST = delchain(ptnode2->WIRELIST,ptchain); + + switch(RCN_GETFLAG(ptnode1->FLAG,RCN_FLAG_CROSS|RCN_FLAG_ONE|RCN_FLAG_TWO)) + { + case RCN_FLAG_CROSS: + if(ptnode1->WIRELIST->NEXT->NEXT==NULL) + { + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_CROSS); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + } + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + break; + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + break; + default: + fprintf(stderr,"internal error : dellowire()\n"); + exit(-1); + } + + switch(RCN_GETFLAG(ptnode2->FLAG,RCN_FLAG_CROSS|RCN_FLAG_ONE|RCN_FLAG_TWO)) + { + case RCN_FLAG_CROSS: + if(ptnode2->WIRELIST->NEXT->NEXT==NULL) + { + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_CROSS); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + } + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + break; + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + break; + default: + fprintf(stderr,"internal error : dellowire()\n"); + exit(-1); + } + } + + if (TRACE_MODE == 'Y') + (void)fprintf(stdout, "--- rcn --- dellowire : between node %ld and node %ld on signal %ld\n", + node1, node2, ptsig->INDEX); + + return 1; +} + +/******************************************************************************* +* function mergedellowire() * +*******************************************************************************/ +void mergedellowire(ptsig) +losig_list *ptsig; +{ + lowire_list *ptwire; + lowire_list *ptprev; + lowire_list *suiv; + + if( !ptsig->PRCN ) + { + fflush( stdout ); + fprintf( stderr, "*** RCN error in mergedellowire() : no RCN.\n" ); + EXIT(1); + } + + ptprev = NULL; + for( ptwire = ptsig->PRCN->PWIRE ; ptwire ; ptwire = suiv ) + { + suiv = ptwire->NEXT; + if( RCN_GETFLAG( ptwire->FLAG, RCN_FLAG_DEL ) ) + { + if( ptprev == NULL ) + ptsig->PRCN->PWIRE = ptwire->NEXT; + else + ptprev->NEXT = ptwire->NEXT; + + freelowire( ptwire ); + } + else + ptprev = ptwire; + } +} + +/******************************************************************************* +* function setdellowire() * +*******************************************************************************/ +void setdellowire(ptsig, ptwire) +losig_list *ptsig; +lowire_list *ptwire; +{ +lonode_list *ptnode1; +lonode_list *ptnode2; +chain_list *ptchain; + + RCN_SETFLAG( ptwire->FLAG, RCN_FLAG_DEL ); + + if( gettabnode(ptsig->PRCN) != NULL) + { + ptnode1 = getlonode(ptsig, ptwire->NODE1); + ptnode2 = getlonode(ptsig, ptwire->NODE2); + + /* optimiser */ + for(ptchain = ptnode1->WIRELIST;ptchain != NULL;ptchain = ptchain->NEXT) + if(ptchain->DATA == (void *)ptwire) break; + ptnode1->WIRELIST = delchain(ptnode1->WIRELIST,ptchain); + + for(ptchain = ptnode2->WIRELIST;ptchain != NULL;ptchain = ptchain->NEXT) + if(ptchain->DATA == (void *)ptwire) break; + ptnode2->WIRELIST = delchain(ptnode2->WIRELIST,ptchain); + + switch(RCN_GETFLAG(ptnode1->FLAG,RCN_FLAG_CROSS|RCN_FLAG_ONE|RCN_FLAG_TWO)) + { + case RCN_FLAG_CROSS: + if(ptnode1->WIRELIST->NEXT->NEXT==NULL) + { + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_CROSS); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + } + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + break; + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + break; + default: + fprintf(stderr,"internal error : dellowire()\n"); + exit(-1); + } + + switch(RCN_GETFLAG(ptnode2->FLAG,RCN_FLAG_CROSS|RCN_FLAG_ONE|RCN_FLAG_TWO)) + { + case RCN_FLAG_CROSS: + if(ptnode2->WIRELIST->NEXT->NEXT==NULL) + { + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_CROSS); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + } + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + break; + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + break; + default: + fprintf(stderr,"internal error : dellowire()\n"); + exit(-1); + } + } +} + +/******************************************************************************* +* function getlowire() * +*******************************************************************************/ +lowire_list *getlowire(ptsig, node1, node2) +losig_list *ptsig; +long node1; +long node2; +{ + lowire_list *ptwire; + lonode_list *ptnode; + chain_list *ptchain; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : getlowire() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + if( ! gettabnode(ptsig->PRCN) ) + { + for ( ptwire = ptsig->PRCN->PWIRE ; ptwire != NULL ; ptwire = ptwire->NEXT ) + if ( ( (ptwire->NODE1 == node1 && ptwire->NODE2 == node2) + ||(ptwire->NODE1 == node2 && ptwire->NODE2 == node1) ) && + ! RCN_GETFLAG( ptwire->FLAG, RCN_FLAG_DEL ) ) + return ptwire; + return(NULL); + } + + ptnode = givelonode(ptsig,node1); + for(ptchain=ptnode->WIRELIST;ptchain!=NULL;ptchain=ptchain->NEXT) + { + ptwire = (lowire_list*)ptchain->DATA; + if( ( ptwire->NODE1 == node2 || ptwire->NODE2 == node2 ) && + ! RCN_GETFLAG( ptwire->FLAG, RCN_FLAG_DEL ) + ) + return ptwire; + } + return(NULL); +} + +/******************************************************************************* +* function getlonode() * +*******************************************************************************/ +lonode_list *getlonode(ptsig, index) +losig_list *ptsig; +long index; +{ + int taille; + ptype_list *head; + chain_list *scan; + int max; + int pos; + + head = getptype( ptsig->PRCN->USER, RCN_LONODE ); + if( head == NULL) + { + fflush( stdout ); + fprintf( stderr, "*** rcn error *** getlonode()\n" ); + fprintf( stderr, "No table exist on losig %ld.\n", ptsig->INDEX ); + EXIT(1); + } + + taille = (int)(getptype( ptsig->PRCN->USER, RCN_SIZETAB )->DATA); + scan = head->DATA; + + pos=0; + max = index / taille; + for( pos = 0 ; pos <= max ; pos++ ) + { + if( !scan ) + { + fflush( stdout ); + fprintf( stderr, "*** rcn error *** getlonode()\n" ); + fprintf( stderr, + "Non existant node on exist on losig %ld.\n", + ptsig->INDEX + ); + EXIT(1); + } + if(pos != max) + scan = scan->NEXT ; + } + + pos = index - max * taille ; + + return( &(((lonode_list*)(scan->DATA))[pos]) ); +} + +/******************************************************************************* +* function givelonode() * +*******************************************************************************/ +lonode_list *givelonode(ptsig, index) +losig_list *ptsig; +long index; +{ + int taille; + ptype_list *head; + chain_list *scan; + chain_list *prev; + int max; + int pos; + int i; + lonode_list *ptnode; + + if( !ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** rcn error *** : getlonode impossible\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + if( index >= ptsig->PRCN->NBNODE ) + ptsig->PRCN->NBNODE = index+1; + + head = getptype( ptsig->PRCN->USER, RCN_LONODE ); + if( head == NULL) + { + fflush( stdout ); + fprintf( stderr, "*** rcn error *** givelonode()\n" ); + fprintf( stderr, "No table exist on losig %ld.\n", ptsig->INDEX ); + EXIT(1); + } + + taille = (int)(getptype( ptsig->PRCN->USER, RCN_SIZETAB )->DATA); + scan = head->DATA; + prev = head->DATA; + + pos=0; + max = index / taille; + for( pos = 0 ; pos <= max ; pos++ ) + { + if( !scan ) + { + if( prev ) + { + prev->NEXT = addchain( NULL, + mbkalloc( sizeof( lonode_list ) * taille ) + ); + scan = prev->NEXT; + } + else + { + head->DATA = addchain( NULL, + mbkalloc( sizeof( lonode_list ) * taille ) + ); + scan = head->DATA; + } + + for( i = 0 ; i < taille ; i++ ) + { + ptnode = &(((lonode_list*)(scan->DATA))[i]); + ptnode->INDEX = i + pos * taille ; + ptnode->WIRELIST = NULL; + ptnode->CTCLIST = NULL; + ptnode->FLAG = 0; + ptnode->USER = NULL; + } + + } + prev = scan; + if(pos != max) + scan = scan->NEXT ; + } + + pos = index - max * taille ; + + return( &(((lonode_list*)(scan->DATA))[pos]) ); +} + +/******************************************************************************* +* function getloconnode() * +*******************************************************************************/ + +chain_list* getloconnode( node ) +lonode_list *node; +{ + ptype_list *ptptype; + + ptptype = getptype( node->USER, RCN_LOCON ); + if( !ptptype ) + return( NULL ); + + return( (chain_list*)ptptype->DATA ); +} + +/******************************************************************************* +* function setloconnode() * +*******************************************************************************/ + +void setloconnode(ptlocon, node) +locon_list *ptlocon; +long node; +{ + losig_list *ptsig; + ptype_list *ptptype; + chain_list *chain; + lonode_list *ptnode; + + ptsig = ptlocon->SIG; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : setloconnode() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + if( ptsig->PRCN->NBNODE <= node ) + ptsig->PRCN->NBNODE = node+1; + + if( gettabnode( ptsig->PRCN ) != NULL) + { + ptnode = givelonode( ptsig, node ); + + if(!RCN_GETFLAG(ptnode->FLAG,RCN_FLAG_LOCON)) + { + RCN_SETFLAG(ptnode->FLAG,RCN_FLAG_LOCON); + ptnode->USER = addptype(ptnode->USER,RCN_LOCON,addchain(NULL,ptlocon)); + } + else + { + ptptype = getptype(ptnode->USER,RCN_LOCON); + for(chain = (chain_list *)ptptype->DATA; chain; chain = chain->NEXT) + if(ptlocon == (locon_list *)chain->DATA) + break; + + if(chain == NULL) + ptptype->DATA = addchain(ptptype->DATA,ptlocon); + } + } + + ptlocon->PNODE = addnum( ptlocon->PNODE, node ); + +} + +/******************************************************************************* +* function delloconnode() * +*******************************************************************************/ + +void delloconnode(ptcon, index ) +locon_list *ptcon; +long index; +{ + losig_list *ptsig; + num_list *scannum; + num_list *prev; + ptype_list *ptptype; + chain_list *scanchain; + chain_list *prevchain; + lonode_list *ptnode; + + ptsig = ptcon->SIG; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : delloconnode() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + scannum = ptcon->PNODE ; + prev = NULL; + + while(1) + { + for(; scannum ; scannum = scannum->NEXT ) + { + if( scannum->DATA == index ) + break; + prev = scannum; + } + + if(scannum) + { + if( prev ) + { + prev->NEXT = scannum->NEXT; + scannum->NEXT = NULL; + freenum( scannum ); + scannum = prev->NEXT ; + } + else + { + ptcon->PNODE = scannum->NEXT; + scannum->NEXT = NULL; + freenum( scannum ); + scannum = ptcon->PNODE ; + } + } + else + break ; + } + + ptnode = NULL; + + if( gettabnode( ptsig->PRCN ) ) + { + ptnode = getlonode( ptsig, index ); + ptptype = getptype( ptnode->USER, RCN_LOCON ); + + prevchain = NULL; + + for( scanchain = (chain_list*)ptptype->DATA ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + if( scanchain->DATA == ptcon ) + break; + prevchain = scanchain; + } + + if( prevchain ) + prevchain->NEXT = scanchain->NEXT; + else + ptptype->DATA = scanchain->NEXT; + + scanchain->NEXT = NULL; + freechain( scanchain ); + + if( ptptype->DATA == NULL ) + { + ptnode->USER = delptype( ptnode->USER, RCN_LOCON ); + RCN_CLEARFLAG( ptnode->FLAG, RCN_FLAG_LOCON ); + } + } +} + +/******************************************************************************* +* function addcapawire() * +*******************************************************************************/ + +void addcapawire(ptwire, capa) +lowire_list *ptwire; +float capa; +{ + ptwire->CAPA += capa; +} + +/******************************************************************************* +* function setcapawire() * +*******************************************************************************/ + +void setcapawire(ptwire, capa) +lowire_list *ptwire; +float capa; +{ + ptwire->CAPA = capa; +} + +/******************************************************************************* +* function addresiwire() * +*******************************************************************************/ +void addresiwire(ptwire, resi) +lowire_list *ptwire; +float resi; +{ + ptwire->RESI += resi; +} + +/******************************************************************************* +* function setresiwire() * +*******************************************************************************/ +void setresiwire(ptwire, resi) +lowire_list *ptwire; +float resi; +{ + ptwire->RESI = resi; +} + +/******************************************************************************* +* function addpararesiwire() * +*******************************************************************************/ +void addpararesiwire(ptwire, resi) +lowire_list *ptwire; +float resi; +{ + if(ptwire->RESI==0.0 || resi==0.0) + ptwire->RESI = 0.0; + else + ptwire->RESI = 1 / ( 1/ptwire->RESI + 1/resi ); +} + +/******************************************************************************* +* lowire_list* heaplowire(void) * +*******************************************************************************/ + + +lowire_list* heaplowire() +{ + lowire_list *ptwire; + int i; + + if(HEAD_WIRE_FREE==NULL) + { + HEAD_WIRE_FREE=(lowire_list*)mbkalloc(RCNBUFSIZE*sizeof(lowire_list)); + ptwire=HEAD_WIRE_FREE; + for(i=1;iNEXT=ptwire+1; + ptwire++; + } + ptwire->NEXT=NULL; + } + ptwire=HEAD_WIRE_FREE; + HEAD_WIRE_FREE=HEAD_WIRE_FREE->NEXT; + + /* Clean the new wire */ + ptwire->NEXT = NULL; + ptwire->NODE1 = 0L; + ptwire->NODE2 = 0L; + ptwire->LAYER = RCN_WIRE_UNKNOW; + ptwire->FLAG = 0; + ptwire->RESI = 0.0; + ptwire->CAPA = 0.0; + ptwire->X = 0l; + ptwire->Y = 0l; + ptwire->DX = 0l; + ptwire->DY = 0l; + ptwire->USER = NULL; + + NBWIRE++; + return(ptwire); +} + +/******************************************************************************* +* loctc_list* heaploctc(void) * +*******************************************************************************/ + +loctc_list* heaploctc() +{ + loctc_list *ptctc; + int i; + + if(HEAD_CTC_FREE==NULL) + { + + /* Le chainage des CTC est realise par le champs SIG1 */ + + HEAD_CTC_FREE=(loctc_list*)mbkalloc(RCNBUFSIZE*sizeof(loctc_list)); + ptctc=HEAD_CTC_FREE; + for(i=1;iSIG1) = ptctc+1; + ptctc->NODE1 = -1000; + ptctc++; + } + (loctc_list*)(ptctc->SIG1) = NULL; + ptctc->NODE1 = -1000; + } + + ptctc=HEAD_CTC_FREE; + HEAD_CTC_FREE=(loctc_list*)(HEAD_CTC_FREE->SIG1); + + /* Clean the new ctc */ + if( ptctc->NODE1 != -1000 ) + { + printf( "***** Utilisation dans heaploctc d'une CTC deja prise.\n" ); + exit(-1); + } + + ptctc->SIG1 = NULL; + ptctc->NODE1 = 0; + ptctc->SIG2 = NULL; + ptctc->NODE2 = 0; + ptctc->CAPA = 0.0; + ptctc->USER = NULL; + + NBCTC++; + return(ptctc); +} +/******************************************************************************* +* lorcnet_list* heaprcnet(void) * +*******************************************************************************/ + +lorcnet_list* heaprcnet() +{ + lorcnet_list *ptrcnet; + int i; + + if(HEAD_RCNET_FREE==NULL) + { + HEAD_RCNET_FREE=(lorcnet_list*)mbkalloc(RCNBUFSIZE*sizeof(lorcnet_list)); + ptrcnet=HEAD_RCNET_FREE; + + for(i=1;iCAPA = 0.0; + ptrcnet->PWIRE = NULL; + ptrcnet->NBNODE = 1l; + ptrcnet->PCTC = NULL; + ptrcnet->USER = NULL; + + NBRCNET++; + return(ptrcnet); +} + +/******************************************************************************* +* void freercnet(lorcnet_list*) * +*******************************************************************************/ + +void freercnet(pt) +lorcnet_list *pt; +{ + *((lorcnet_list**)pt) = HEAD_RCNET_FREE; + HEAD_RCNET_FREE=pt; + + NBRCNET--; +} + +/******************************************************************************* +* void freelowire(lowire_list*) * +*******************************************************************************/ + +void freelowire(pt) +lowire_list *pt; +{ + if( pt->USER ) + { + fflush( stdout ); + fprintf( stderr, "*** Warnig : freelowire. USER field not empty.\n" ); + } + + pt->NEXT=HEAD_WIRE_FREE; + HEAD_WIRE_FREE=pt; + + NBWIRE--; +} + +/******************************************************************************* +* void freeloctc(loctc_list*) * +*******************************************************************************/ + +void freeloctc(pt) +loctc_list *pt; +{ + if( pt->USER ) + { + fflush( stdout ); + fprintf( stderr, "*** Warnig : freeloctc. USER field not empty.\n" ); + } + + pt->SIG1 = (losig_list*)HEAD_CTC_FREE; + if( pt->NODE1 == -1000 ) + { + printf( "***** Liberation d'une CTC deja liberee.\n" ); + exit(0); + } + pt->NODE1 = -1000; + HEAD_CTC_FREE = pt; + NBCTC--; +} + +/******************************************************************************* +* void freetable(rcnet_list*) * +*******************************************************************************/ + +void freetable(ptsig) +losig_list *ptsig; +{ + chain_list *head; + chain_list *scan; + int taille; + ptype_list *ptl; + int i; + lonode_list *ptnode; + + if( !ptsig->PRCN ) + { + (void)fflush(stdout); + (void)fprintf(stderr, "*** rcn error *** : freetable() impossible\n"); + (void)fprintf(stderr, "no rc on signal %ld\n",ptsig->INDEX); + exit(-1); + } + + ptl = getptype( ptsig->PRCN->USER, RCN_LONODE ); + head = (chain_list*)(ptl->DATA); + if( head == NULL) + { + fflush( stdout ); + fprintf(stderr,"\n*** rcn error ***\n"); + fprintf(stderr,"You can use the function freetable only when de node\n"); + fprintf(stderr,"table exist.\n"); + exit(-1); + } + + taille = (int)(getptype( ptsig->PRCN->USER, RCN_SIZETAB )->DATA ); + for( scan = head; scan ; scan = scan->NEXT ) + { + for( i=0 ; iDATA))[i]); + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) ) + { + ptl = getptype( ptnode->USER, RCN_LOCON ); + if( ptl ) + freechain( ptl->DATA ); + ptnode->USER = delptype( ptnode->USER, RCN_LOCON ); + freechain( ptnode->WIRELIST ); + freechain( ptnode->CTCLIST ); + if( ptnode->USER ) + { + fflush( stdout ); + fprintf( stderr, "*** rcn warning in freetable : non empty USER.\n"); + } + } + } + + mbkfree( scan->DATA ); + } + + freechain(head); + ptsig->PRCN->USER = delptype( ptsig->PRCN->USER, RCN_LONODE ); + ptsig->PRCN->USER = delptype( ptsig->PRCN->USER, RCN_SIZETAB ); +} + +/******************************************************************************* +* void buildtable(ptsig) * +*******************************************************************************/ + +void buildtable(ptsig) +losig_list *ptsig; +{ + lowire_list *ptwire; + lonode_list *ptnode1; + lonode_list *ptnode2; + chain_list *scancon; + locon_list *ptcon; + num_list *scannum; + lonode_list *ptnode; + ptype_list *ptlocon; + ptype_list *pt; + chain_list *scanctc; + loctc_list *ptloctc; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : buildtable() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + pt = getptype( ptsig->USER, LOFIGCHAIN ); + if( !pt ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : buildtable() impossible.\n"); + fprintf(stderr,"Call the function lofigchain() before buildtable().\n"); + EXIT(1); + } + + if( gettabnode( ptsig->PRCN ) ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : buildtable() impossible.\n"); + fprintf(stderr,"The node table already exist.\n"); + EXIT(1); + } + + ptsig->PRCN->USER = addptype( ptsig->PRCN->USER, + RCN_SIZETAB, + (void*)(ptsig->PRCN->NBNODE + 1) + ); + ptsig->PRCN->USER = addptype( ptsig->PRCN->USER, + RCN_LONODE, + NULL + ); + /* Cree les tables million pour tous les noeuds jusqu'a nbnode */ + givelonode(ptsig,ptsig->PRCN->NBNODE); + + if( ptsig->PRCN->PWIRE ) + { + for( ptwire = ptsig->PRCN->PWIRE ; ptwire != NULL ; ptwire = ptwire->NEXT ) + { + if( RCN_GETFLAG( ptwire->FLAG, RCN_FLAG_DEL ) ) + continue; + ptnode1 = givelonode(ptsig,ptwire->NODE1); + ptnode2 = givelonode(ptsig,ptwire->NODE2); + ptnode1->WIRELIST = addchain(ptnode1->WIRELIST,ptwire); + ptnode2->WIRELIST = addchain(ptnode2->WIRELIST,ptwire); + + switch( + RCN_GETFLAG( ptnode1->FLAG, RCN_FLAG_ONE | RCN_FLAG_CROSS | RCN_FLAG_TWO) + ) + { + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode1->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_CROSS); + break; + case RCN_FLAG_CROSS: + break; + default: + RCN_SETFLAG(ptnode1->FLAG,RCN_FLAG_ONE); + } + + switch( + RCN_GETFLAG( ptnode2->FLAG, RCN_FLAG_ONE | RCN_FLAG_CROSS | RCN_FLAG_TWO) + ) + { + case RCN_FLAG_ONE: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG(ptnode2->FLAG,RCN_FLAG_TWO); + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_CROSS); + break; + case RCN_FLAG_CROSS: + break; + default: + RCN_SETFLAG(ptnode2->FLAG,RCN_FLAG_ONE); + } + } + } + + for( scanctc = ptsig->PRCN->PCTC ; scanctc ; scanctc = scanctc->NEXT ) + { + ptloctc = (loctc_list*)( scanctc->DATA ); + if( ptloctc->SIG1 == ptsig && ptloctc->NODE1 ) + { + ptnode1 = givelonode( ptsig, ptloctc->NODE1 ); + ptnode1->CTCLIST = addchain( ptnode1->CTCLIST, ptloctc ); + } + if( ptloctc->SIG2 == ptsig && ptloctc->NODE2 ) + { + ptnode2 = givelonode( ptsig, ptloctc->NODE2 ); + ptnode2->CTCLIST = addchain( ptnode2->CTCLIST, ptloctc ); + } + } + + for( scancon = (chain_list*)(pt->DATA) ; scancon ; scancon = scancon->NEXT ) + { + ptcon = (locon_list*)(scancon->DATA); + + for( scannum = ptcon->PNODE ; scannum ; scannum = scannum->NEXT ) + { + ptnode = givelonode( ptsig, scannum->DATA ); + + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) ) + { + ptlocon = getptype(ptnode->USER, RCN_LOCON ); + (chain_list*)(ptlocon->DATA)= + addchain((chain_list*)(ptlocon->DATA),ptcon); + } + else + { + RCN_SETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ); + ptnode->USER = addptype( ptnode->USER, RCN_LOCON, addchain(NULL,ptcon)); + } + } + } +} + +/******************************************************************************* +* * +*******************************************************************************/ + +chain_list* gettabnode( prcnet ) +lorcnet_list *prcnet; +{ + ptype_list *pt; + + pt = getptype( prcnet->USER, RCN_LONODE ); + if( pt ) + return( (chain_list*)pt->DATA ); + return( NULL ); +} + +/******************************************************************************* +* * +*******************************************************************************/ + +void delrcnlocon( ptloc ) + locon_list *ptloc; +{ + freenum( ptloc->PNODE ); +} + +/******************************************************************************* +* * +*******************************************************************************/ + +int chkloopmain( ptsig, flag, org, from ) +losig_list *ptsig; +unsigned char flag; +long org; +lowire_list *from; +{ + lonode_list *ptnode; + long current_node; + int r; + chain_list *scanchain; + lowire_list *current_wire; + + ptnode = getlonode(ptsig,org); + if( RCN_GETFLAG(ptnode->FLAG, flag) ) + return(2); + + RCN_SETFLAG( ptnode->FLAG, flag ); + + /* + Récursif sur les branches multiples + Itératif entre 2 wires + */ + + for( scanchain = ptnode->WIRELIST ; scanchain ; scanchain = scanchain->NEXT ) + { + current_wire = (lowire_list*)(scanchain->DATA); + if( current_wire != from ) + { + current_node = (current_wire->NODE1==org ? current_wire->NODE2 : + current_wire->NODE1 ); + ptnode = getlonode( ptsig, current_node ); + + while( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) ) + { + if( RCN_GETFLAG(ptnode->FLAG,flag) ) + return(2); + + RCN_SETFLAG(ptnode->FLAG,flag); + + current_wire=(ptnode->WIRELIST->DATA==current_wire ? + ptnode->WIRELIST->NEXT->DATA : + ptnode->WIRELIST->DATA ); + + current_node=(current_wire->NODE1==current_node ? current_wire->NODE2 : + current_wire->NODE1 ); + + ptnode=getlonode(ptsig,current_node); + } + + if( RCN_GETFLAG(ptnode->FLAG,RCN_FLAG_ONE)) + { + if(RCN_GETFLAG(ptnode->FLAG,flag)) + return(2); + RCN_SETFLAG(ptnode->FLAG,flag); + } + + if( RCN_GETFLAG(ptnode->FLAG,RCN_FLAG_CROSS)) + { + r = chkloopmain(ptsig,flag,current_node,current_wire); + if(r) + return(r); + } + } + } + return(0); +} + +int chkloop( ptsig ) +losig_list *ptsig; +{ + int r=0; + long i; + lonode_list *ptnode; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : chkloop() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + if( ! gettabnode( ptsig->PRCN ) ) + return(1); + + clearallwireflag(ptsig->PRCN,RCN_FLAG_PASS); + + for( i=1; iPRCN->NBNODE; i++ ) + { + ptnode = givelonode( ptsig, i ); + if( !RCN_GETFLAG(ptnode->FLAG,RCN_FLAG_PASS) ) + { + r = chkloopmain( ptsig, RCN_FLAG_PASS, i, NULL ); + + if(r) + break; + } + } + + return(r); +} + +/******************************************************************************* +* void clearallwireflag( ptrcnet,flag ) * +*******************************************************************************/ + +void clearallwireflag(ptrcnet,flag) +lorcnet_list *ptrcnet; +unsigned char flag; +{ + long i; + ptype_list *head; + int taille; + chain_list *scan; + + head = getptype( ptrcnet->USER, RCN_LONODE ); + if( ! head ) + return; + + taille = (int)(getptype( ptrcnet->USER, RCN_SIZETAB )->DATA); + for( scan = (chain_list*)(head->DATA) ; scan ; scan = scan->NEXT ) + { + for( i=0 ; iDATA))[i].FLAG,flag); + } + } + +} + +int rclevel( ptsig ) +losig_list *ptsig; +{ + if( ! ptsig->PRCN ) + return( MBK_RC_A ); + if( ptsig->PRCN->PWIRE != NULL && ptsig->PRCN->PCTC != NULL ) + return( MBK_RC_E ); + if( ptsig->PRCN->PWIRE == NULL && ptsig->PRCN->PCTC == NULL ) + return( MBK_RC_B ); + if( ptsig->PRCN->PCTC == NULL ) + return( MBK_RC_C ); + if( ptsig->PRCN->PWIRE == NULL ) + return( MBK_RC_D ); + + /* never reached */ + return(0); +} + +chain_list *getallctc( ptfig ) +lofig_list *ptfig; +{ + chain_list *headctc; + losig_list *scansig; + chain_list *scanctc; + loctc_list *ptctc; + + headctc = NULL; + + for( scansig = ptfig->LOSIG ; scansig ; scansig = scansig->NEXT ) + { + if( scansig->PRCN ) + { + for( scanctc = scansig->PRCN->PCTC ; scanctc ; scanctc = scanctc->NEXT ) + { + ptctc = (loctc_list*)(scanctc->DATA); + + if( ! getptype( ptctc->USER, RCN_REPORTED ) ) + { + ptctc->USER = addptype( ptctc->USER, RCN_REPORTED, NULL ); + headctc = addchain( headctc, ptctc ); + } + } + } + } + + for( scanctc = headctc ; scanctc ; scanctc = scanctc->NEXT ) + { + ptctc = (loctc_list*)(scanctc->DATA); + + ptctc->USER = delptype( ptctc->USER, RCN_REPORTED ); + } + + return( headctc ); +} + +void statrcn(void) +{ + printf( "NBRCNET = %u\n", NBRCNET ); + printf( "NBWIRE = %u\n", NBWIRE ); + printf( "NBCTC = %u\n", NBCTC ); +} + +void chkrcn( ptsig ) +losig_list *ptsig; +{ + int trouve; + lonode_list *ptnode; + chain_list *scanchain; + chain_list *verifchain; + lowire_list *scanwire; + int ctcok; + int wireok; + int conok; + int i; + int nbwire; + ptype_list *ptptype; + locon_list *ptcon; + num_list *scannum; + chain_list *scanchcon; + loctc_list *ptctc; + loctc_list *ptctc2; + losig_list *sig2; + + + + if( !ptsig->PRCN ) + return; + + printf( "Verification coherence vue RC pour signal %ld [%s].\n", + ptsig->INDEX, + gettabnode( ptsig->PRCN ) ? "TABLE" : "SANS TABLE" + ); + + ctcok = 1; + wireok = 1; + conok = 1; + + for( scanchain = ptsig->PRCN->PCTC ; scanchain ; scanchain = scanchain->NEXT ) + { + if( !scanchain->DATA ) + { + ctcok = 0; + printf( " [ 6] CTC nulle sur le signal %ld.\n", ptsig->INDEX ); + } + ptctc = (loctc_list*)(scanchain->DATA); + + if( ptctc->SIG1 != ptsig && ptctc->SIG2 != ptsig ) + { + ctcok = 0; + printf( " [ 1] CTC pas sur le signal entre %ld.%ld et %ld.%ld.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2 + ); + } + + } + + if( gettabnode( ptsig->PRCN ) ) + { + /* Verification des CTC */ + + for( scanchain = ptsig->PRCN->PCTC ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptctc = (loctc_list*)(scanchain->DATA); + + sig2 = NULL; + + if( ptctc->SIG1 != ptsig ) + sig2 = ptctc->SIG1; + if( ptctc->SIG2 != ptsig ) + sig2 = ptctc->SIG2; + + if( ptctc->SIG1 != ptsig && ptctc->SIG2 != ptsig ) + { + } + else + { + if( sig2 ) + { + trouve = 0; + + for( verifchain = sig2->PRCN->PCTC ; + verifchain ; + verifchain = verifchain->NEXT + ) + { + if( verifchain->DATA == ptctc ) + { + if( trouve ) + { + ctcok = 0; + printf( " [ 2] CTC %ld.%ld et %ld.%ld definie plusieurs fois sur le signal %ld.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + sig2->INDEX + ); + } + trouve = 1; + } + } + + if( !trouve ) + { + ctcok = 0; + printf( " [ 3] CTC %ld.%ld et %ld.%ld non definie sur le signal %ld.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + sig2->INDEX + ); + } + } + + if( ptsig == ptctc->SIG1 && ptctc->NODE1 ) + { + ptnode = getlonode( ptsig, ptctc->NODE1 ); + + trouve = 0; + for( verifchain = ptnode->CTCLIST ; + verifchain ; + verifchain = verifchain->NEXT + ) + { + if( verifchain->DATA == ptctc ) + { + if( trouve ) + { + ctcok = 0; + printf( " [ 4] CTC %ld.%ld et %ld.%ld definie plusieurs fois sur le noeud %ld.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + ptctc->NODE1 + ); + } + trouve = 1; + } + } + if( !trouve ) + { + ctcok = 0; + printf( " [ 5] CTC %ld.%ld et %ld.%ld non definie sur le noeud %ld.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + ptctc->NODE1 + ); + } + } + + if( ptsig == ptctc->SIG2 && ptctc->NODE2 ) + { + ptnode = getlonode( ptsig, ptctc->NODE2 ); + + trouve = 0; + for( verifchain = ptnode->CTCLIST ; + verifchain ; + verifchain = verifchain->NEXT + ) + { + if( verifchain->DATA == ptctc ) + { + if( trouve ) + { + ctcok = 0; + printf( " [ 6] CTC %ld.%ld et %ld.%ld definie plusieurs fois sur le noeud %ld.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + ptctc->NODE2 + ); + } + trouve = 1; + } + } + if( !trouve ) + { + ctcok = 0; + printf( " [ 7] CTC %ld.%ld et %ld.%ld non definie sur le noeud %ld.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + ptctc->NODE2 + ); + } + } + } + + for( verifchain = scanchain->NEXT ; + verifchain ; + verifchain = verifchain->NEXT + ) + { + ptctc2 = (loctc_list*)(verifchain->DATA); + + if( ( ptctc->SIG1 == ptctc2->SIG1 && + ptctc->NODE1 == ptctc2->NODE1 && + ptctc->SIG2 == ptctc2->SIG2 && + ptctc->NODE2 == ptctc2->NODE2 ) || + ( ptctc->SIG2 == ptctc2->SIG1 && + ptctc->NODE2 == ptctc2->NODE1 && + ptctc->SIG1 == ptctc2->SIG2 && + ptctc->NODE1 == ptctc2->NODE2 ) ) + { + ctcok = 0; + printf( " [ 8] Plusieurs CTC entre %ld.%ld et %ld.%ld c=%g.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + ptctc->CAPA + ); + } + } + } + + for( i=1 ; i < ptsig->PRCN->NBNODE ; i++ ) + { + ptnode = getlonode( ptsig, i ); + if( !ptnode ) + continue; + + for( scanchain = ptnode->CTCLIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptctc = (loctc_list*)scanchain->DATA; + + if( ptctc->SIG1 != ptsig && ptctc->SIG2 != ptsig ) + { + ctcok = 0 ; + printf( " [ 9] CTC pas sur le signal entre %ld.%ld et %ld.%ld sur noeud %d.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + i + ); + } + + if( !( (ptctc->SIG1 == ptsig && ptctc->NODE1 == i ) || + (ptctc->SIG2 == ptsig && ptctc->NODE2 == i ) ) ) + { + ctcok = 0 ; + printf( " [11] CTC entre %ld.%ld et %ld.%ld sur mauvais noeud %d.\n", + ptctc->SIG1->INDEX, + ptctc->NODE1, + ptctc->SIG2->INDEX, + ptctc->NODE2, + i + ); + } + } + } + + /* Verification des wires */ + + for( scanwire = ptsig->PRCN->PWIRE ; scanwire ; scanwire = scanwire->NEXT ) + { + if( RCN_GETFLAG( scanwire->FLAG, RCN_FLAG_DEL ) ) + continue; + ptnode = getlonode( ptsig, scanwire->NODE1 ); + + trouve = 0; + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + if( scanchain->DATA == scanwire ) + { + if( trouve == 1 ) + { + wireok = 0; + printf( " [12] WIRE entre %ld et %ld existe plusieurs fois sur le noeud %ld.\n", + scanwire->NODE1, + scanwire->NODE2, + ptnode->INDEX + ); + } + trouve = 1; + } + } + + if( trouve == 0 ) + { + wireok = 0; + printf( " [13] WIRE entre %ld et %ld n'existe pas sur le noeud %ld.\n", + scanwire->NODE1, + scanwire->NODE2, + ptnode->INDEX + ); + } + + ptnode = getlonode( ptsig, scanwire->NODE2 ); + + trouve = 0; + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + if( scanchain->DATA == scanwire ) + { + if( trouve == 1 ) + { + wireok = 0; + printf( " [14] WIRE entre %ld et %ld existe plusieurs fois sur le noeud %ld.\n", + scanwire->NODE1, + scanwire->NODE2, + ptnode->INDEX + ); + } + trouve = 1; + } + } + + if( trouve == 0 ) + { + wireok = 0; + printf( " [15] WIRE entre %ld et %ld n'existe pas sur le noeud %ld.\n", + scanwire->NODE1, + scanwire->NODE2, + ptnode->INDEX + ); + } + } + + for( i=1 ; i < ptsig->PRCN->NBNODE ; i++ ) + { + ptnode = getlonode( ptsig, i ); + if( !ptnode ) + continue; + + nbwire = 0; + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + nbwire++; + for( scanwire = ptsig->PRCN->PWIRE ; + scanwire ; + scanwire = scanwire->NEXT + ) + { + if( scanwire == scanchain->DATA ) + break; + } + if( !scanwire ) + { + wireok = 0; + printf( " [16] Wire %08X inexistant trouve sur le noeud %d.\n", + (int)scanchain->DATA, + i + ); + } + } + + switch( nbwire ) + { + case 0 : + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_ONE ) || + RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) || + RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_CROSS ) ) + { + printf( " [17] Mauvais indicateur de nombre de wire sur le noeud %ld.\n", + ptnode->INDEX + ); + wireok = 0; + } + break; + case 1 : + if( !RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_ONE ) || + RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) || + RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_CROSS ) ) + { + printf( " [18] Mauvais indicateur de nombre de wire sur le noeud %ld.\n", + ptnode->INDEX + ); + wireok = 0; + } + break; + case 2 : + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_ONE ) || + !RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) || + RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_CROSS ) ) + { + printf( " [19] Mauvais indicateur de nombre de wire sur le noeud %ld.\n", + ptnode->INDEX + ); + wireok = 0; + } + break; + default : + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_ONE ) || + RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) || + !RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_CROSS ) ) + { + printf( " [20] Mauvais indicateur de nombre de wire sur le noeud %ld.\n", + ptnode->INDEX + ); + wireok = 0; + } + } + } + + /* Verification connecteurs */ + + ptptype = getptype( ptsig->USER, LOFIGCHAIN ); + if( !ptptype ) + printf( " Pas de lofigchain -> connecteurs non testes.\n" ); + else + { + for( scanchain = (chain_list*)ptptype->DATA ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptcon = (locon_list*)(scanchain->DATA) ; + + for( scannum = ptcon->PNODE ; scannum ; scannum = scannum->NEXT ) + { + ptnode = getlonode( ptsig, scannum->DATA ); + if( !RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) ) + { + printf( " [21] Le noeud %ld devrait porter l'indicateur RCN_FLAG_LOCON pour le connecteur %s.\n", + ptnode->INDEX, + ptcon->NAME + ); + conok = 0; + } + + ptptype = getptype( ptnode->USER, RCN_LOCON ); + if( !ptptype ) + printf( " [22] Pas de ptype RCN_LOCON sur le noeud %ld (locon %s).\n", + ptnode->INDEX, + ptcon->NAME + ); + else + { + trouve = 0; + for( scanchcon = (chain_list*)ptptype->DATA ; + scanchcon ; + scanchcon = scanchcon->NEXT + ) + if( scanchcon->DATA == ptcon ) + trouve = 1; + + if( trouve == 0 ) + { + printf( " [24] Locon %s non defini dans le node %ld.\n", + ptcon->NAME, + ptnode->INDEX + ); + conok = 0; + } + } + } + } + + for( i = 0 ; i < ptsig->PRCN->NBNODE ; i++ ) + { + ptnode = getlonode( ptsig, i ); + if( !ptnode ) + continue; + + ptptype = getptype( ptnode->USER, RCN_LOCON ); + + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) && ptptype ) + { + for( scanchcon = ptptype->DATA ; + scanchcon ; + scanchcon = scanchcon->NEXT ) + { + ptcon = (locon_list*)(scanchcon->DATA); + trouve = 0; + for( scannum = ptcon->PNODE; scannum ; scannum = scannum->NEXT ) + if( scannum->DATA == i ) + trouve = 1; + if( trouve == 0 ) + { + printf( " [26] Le noeud %d n'est pas defini dans le locon %s.\n", + i, + ptcon->NAME + ); + conok = 0; + } + } + } + + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) && ! ptptype ) + { + printf( " [27] Pas de champs ptype associe au RCN_FLAG_LOCON.\n" ); + conok = 0; + } + + if( !RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) && ptptype ) + { + printf( " [28] Champs ptype non associe au RCN_FLAG_LOCON.\n" ); + conok = 0; + } + } + } + } + + if( wireok ) + printf( " - structures WIRE coherentes.\n" ); + else + printf( " - structures WIRE incoherentes.\n" ); + + if( ctcok ) + printf( " - structures CTC coherentes.\n" ); + else + printf( " - structures CTC incoherentes.\n" ); + + if( conok ) + printf( " - Indications CONNECTEUR coherentes.\n" ); + else + printf( " - Indications CONNECTEUR incoherentes.\n" ); + + if( !wireok || !ctcok || !conok ) + EXIT(1); +} + +float rcncalccapa( losig_list *ptsig ) +{ + lowire_list *scanwire; + chain_list *scanctc; + + if( ! ptsig->PRCN ) + { + fflush(stdout); + fprintf(stderr,"*** mbk error *** : buildtable() impossible.\n"); + fprintf(stderr,"No rc data on signal %ld.\n",ptsig->INDEX); + EXIT(1); + } + + ptsig->PRCN->CAPA = 0.0; + for( scanwire = ptsig->PRCN->PWIRE ; scanwire ; scanwire = scanwire->NEXT ) + ptsig->PRCN->CAPA+=scanwire->CAPA; + for( scanctc = ptsig->PRCN->PCTC ; scanctc ; scanctc = scanctc->NEXT ) + ptsig->PRCN->CAPA+=((loctc_list*)scanctc->DATA)->CAPA; + + return( ptsig->PRCN->CAPA ); +} diff --git a/alliance/src/mbk/src/rcn_lo.h b/alliance/src/mbk/src/rcn_lo.h new file mode 100644 index 00000000..53b0b4f2 --- /dev/null +++ b/alliance/src/mbk/src/rcn_lo.h @@ -0,0 +1,51 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ident "$Id: rcn_lo.h,v 1.1 2002/03/08 13:51:05 fred Exp $" + +/******************************************************************************* +* rcn : rcn_lo.c header file for local function declaration * +* * +* version : 2.00 * +* date : 05/08/1997 * +*******************************************************************************/ + +/******************************************************************************* +* Grégoire AVOT * +* Laboratoire LIP6 - Département ASIM * +* Universite Paris 6 - Pierre et Marie Curie * +* 4, Place Jussieu * +* Paris Cedex 05. * +*******************************************************************************/ + +int chkloopmain __P((losig_list *ptsig, unsigned char flag, + long org, lowire_list *form)); + +/* Heap */ + +lowire_list *heaplowire __P((void)); +lorcnet_list *heaprcnet __P((void)); +loctc_list *heaploctc __P((void)); +void freercnet __P((lorcnet_list *pt)); +void freelowire __P((lowire_list *pt)); +void freeloctc __P((loctc_list *pt)); diff --git a/alliance/src/mbk/src/rcn_lo_util.c b/alliance/src/mbk/src/rcn_lo_util.c new file mode 100644 index 00000000..68243b08 --- /dev/null +++ b/alliance/src/mbk/src/rcn_lo_util.c @@ -0,0 +1,882 @@ +/* + * This file is part of the Alliance CAD System + * Copyright (C) Laboratoire LIP6 - Département ASIM + * Universite Pierre et Marie Curie + * + * Home page : http://www-asim.lip6.fr/alliance/ + * E-mail support : mailto:alliance-support@asim.lip6.fr + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Library General Public License as published + * by the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * Alliance VLSI CAD System 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 the GNU C Library; see the file COPYING. If not, write to the Free + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ident "$Id: rcn_lo_util.c,v 1.1 2002/03/08 13:51:05 fred Exp $" + +/******************************************************************************* +* rcn : acces functions to logical rc network structures * +* * +* version : 1.02 * +* date : 07/06/96 * +*******************************************************************************/ + +/******************************************************************************* +* Grégoire AVOT * +* Laboratoire LIP6 - Département ASIM * +* Universite Paris 6 - Pierre et Marie Curie * +* 4, Place Jussieu * +* Paris Cedex 05. * +*******************************************************************************/ + +#include "mut.h" +#include "mlo.h" +#include "rcn.h" +#include "rcn_lo.h" + +typedef struct s_todo +{ + struct s_todo *next; + lonode_list *ptnode; + chain_list *head_wire; +} todolist ; + +todolist* breakloop2 __P(( losig_list*, + lonode_list*, + lowire_list*, + todolist*, + chain_list** + )); + +void connexe_rec __P(( losig_list*, + lowire_list*, + lonode_list*, + int + )); + +/******************************************************************************/ + +void duplorcnet( ptsig_dest, ptsig_src ) +losig_list *ptsig_dest; +losig_list *ptsig_src; +{ + lowire_list *scanlowire; + lowire_list *newwire; + + if( ptsig_dest->PRCN ) + { + fflush( stdout ); + fprintf( stderr, + "*** MBK error in duplorcnet *** : ptsig_dest have already a rc datas.\n" + ); + EXIT(1); + } + + if( !ptsig_src->PRCN ) + return; + + addlorcnet( ptsig_dest ); + + /* Capacité du signal */ + ptsig_dest->PRCN->CAPA = ptsig_src->PRCN->CAPA; + + /* Wire constituant le signal */ + for( scanlowire = ptsig_src->PRCN->PWIRE ; + scanlowire ; + scanlowire = scanlowire->NEXT + ) + { + + if( RCN_GETFLAG( scanlowire->FLAG, RCN_FLAG_DEL ) ) + continue; + newwire = heaplowire(); + + newwire->NEXT = ptsig_dest->PRCN->PWIRE; + newwire->RESI = scanlowire->RESI; + newwire->CAPA = scanlowire->CAPA; + newwire->X = scanlowire->X; + newwire->Y = scanlowire->Y; + newwire->DX = scanlowire->DX; + newwire->DY = scanlowire->DY; + newwire->NODE1 = scanlowire->NODE1; + newwire->NODE2 = scanlowire->NODE2; + newwire->LAYER = scanlowire->LAYER; + newwire->FLAG = scanlowire->FLAG; + newwire->USER = NULL; + + ptsig_dest->PRCN->PWIRE = newwire; + } + + /* CTC sur le signal : non gere */ + ptsig_dest->PRCN->PCTC = NULL; + + /* NBNODE */ + ptsig_dest->PRCN->NBNODE = ptsig_src->PRCN->NBNODE ; + + /* USER */ + ptsig_dest->PRCN->USER = NULL; +} + +/******************************************************************************/ + +todolist* breakloop2( ptsig, ptnode, curwire, headtodo, cleanwire ) +losig_list *ptsig; +lonode_list *ptnode; +lowire_list *curwire; +todolist *headtodo; +chain_list **cleanwire; +{ + lowire_list *tmpwire; + chain_list *scanchain; + todolist *newtodo; + + if( curwire ) + { + if( RCN_GETFLAG( curwire->FLAG, RCN_FLAG_PASS ) ) + { + fflush( stdout ); + fprintf( stderr, "*** rcn error ***\n" ); + fprintf( stderr, "Internal error in function breakloop2().\n" ); + EXIT(1); + } + + RCN_SETFLAG( curwire->FLAG, RCN_FLAG_PASS ); + } + + do + { + /* On trouve une boucle */ + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_PASS ) ) + { + tmpwire = addlowire( ptsig, + curwire->LAYER, + curwire->FLAG, + curwire->RESI, + curwire->CAPA, + curwire->X, + curwire->Y, + curwire->DX, + curwire->DY, + curwire->NODE1, + addlonode( ptsig, NULL ) + ); + *cleanwire = addchain( *cleanwire, curwire ); + RCN_SETFLAG( tmpwire->FLAG, RCN_FLAG_PASS ); + RCN_SETFLAG( curwire->FLAG, RCN_FLAG_PASS ); + } + else + { + RCN_SETFLAG( ptnode->FLAG, RCN_FLAG_PASS ); + } + + /* Recherche un wire non parcouru sur le noeud courant */ + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + curwire = (lowire_list*)(scanchain->DATA); + if( ! RCN_GETFLAG( curwire->FLAG, RCN_FLAG_PASS ) ) + break; + } + + if( ! scanchain ) + break; /* on quitte le while */ + + /* Ajoute les autre wire non parcouru sur le noeud dans une + * structure todo */ + + newtodo = NULL; + + if( scanchain ) + { + for( scanchain = scanchain->NEXT ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + tmpwire = (lowire_list*)(scanchain->DATA); + + if( ! RCN_GETFLAG( tmpwire->FLAG, RCN_FLAG_PASS ) ) + { + if( !newtodo ) + { + newtodo = (todolist*)(mbkalloc( sizeof(todolist) ) ); + newtodo->next = headtodo ; + headtodo = newtodo; + newtodo->ptnode = ptnode; + newtodo->head_wire = NULL; + } + newtodo->head_wire = addchain( newtodo->head_wire, tmpwire ); + } + } + } + + ptnode = getlonode( ptsig, + ( curwire->NODE1 == ptnode->INDEX ) ? curwire->NODE2 : + curwire->NODE1 + ); + + RCN_SETFLAG( curwire->FLAG, RCN_FLAG_PASS ); + } + while(1); /* c'est ben vrai! */ + + return( headtodo ); +} + +int breakloop( ptsig ) +losig_list *ptsig; +{ + + todolist *headtodo ; + todolist *curtodo ; + todolist *scantodo ; + todolist *newtodo ; + lowire_list *firstwire; + lowire_list *curwire; + lonode_list *ptnode; + chain_list *cleanwire; + chain_list *scanchain; + + if( !ptsig->PRCN || !gettabnode( ptsig->PRCN ) ) + { + fflush( stdout ); + fprintf( stderr, "*** rcn error *** : breakloop() impossible.\n" ); + fprintf( stderr, "No rc data on signal %ld.\n", ptsig->INDEX ); + EXIT( 1 ); + } + + clearallwireflag( ptsig->PRCN, RCN_FLAG_PASS ); + cleanwire = NULL; + + /* Boucle pour parcourir les differentes composantes connexes */ + + for( firstwire = ptsig->PRCN->PWIRE ; + firstwire ; + firstwire = firstwire->NEXT + ) + { + if( RCN_GETFLAG( firstwire->FLAG, RCN_FLAG_DEL ) ) + continue; + + ptnode = getlonode( ptsig, firstwire->NODE1 ); + + if( ! RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_PASS ) ) + { + /* Corps d'une des composante connexe du reseau */ + + headtodo = breakloop2( ptsig, ptnode, NULL, NULL, &cleanwire ); + + while( headtodo ) + { + newtodo = NULL; + + for( scantodo = headtodo ; scantodo ; scantodo = scantodo->next ) + { + for( scanchain = scantodo->head_wire ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + + curwire = (lowire_list*)( scanchain->DATA ); + + if( ! RCN_GETFLAG( curwire->FLAG, RCN_FLAG_PASS ) ) + { + + newtodo = breakloop2( ptsig, + getlonode( ptsig, + ( scantodo->ptnode->INDEX == + curwire->NODE1 ) ? + curwire->NODE2 : + curwire->NODE1 + ), + curwire, + newtodo, + &cleanwire + ); + } + } + } + + while( headtodo ) + { + curtodo = headtodo->next; + freechain( headtodo->head_wire ); + mbkfree( headtodo ); + headtodo = curtodo; + } + + headtodo = newtodo; + } + } + } + + for( scanchain = cleanwire ; scanchain ; scanchain = scanchain->NEXT ) + { + curwire = (lowire_list*)( scanchain->DATA ); + dellowire( ptsig, curwire->NODE1, curwire->NODE2 ); + } + + freechain ( cleanwire ); + + return(1); +} + +int reduce_rcn( ptsig ) +losig_list *ptsig; +{ + lowire_list *scanwire; + lonode_list *ptnode; + chain_list *todo; + chain_list *doing; + chain_list *scanctc; + loctc_list *ptctc; + float resi; + int node1; + int node2; + lowire_list *wire1; + lowire_list *wire2; + int another; + + if( !gettabnode( ptsig->PRCN ) ) + { + fflush( stdout ); + fprintf( stderr, "*** Reduce RCN error\n" ); + fprintf( stderr, "Node table not built.\n" ); + EXIT(1); + } + + do + { + another = 0; + + todo = NULL; + ptsig->PRCN->CAPA = 0.0; + + for( scanwire = ptsig->PRCN->PWIRE ; scanwire ; scanwire = scanwire->NEXT ) + { + if( RCN_GETFLAG( scanwire->FLAG, RCN_FLAG_DEL ) ) + continue; + + ptsig->PRCN->CAPA = ptsig->PRCN->CAPA + scanwire->CAPA; + scanwire->CAPA = 0.0; + ptnode = getlonode( ptsig, scanwire->NODE1 ); + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) && + ! RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) && + ! RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_PASS ) + ) + { + todo = addchain( todo, ptnode ); + RCN_SETFLAG( ptnode->FLAG, RCN_FLAG_PASS ); + } + ptnode = getlonode( ptsig, scanwire->NODE2 ); + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) && + ! RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) && + ! RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_PASS ) + ) + { + todo = addchain( todo, ptnode ); + RCN_SETFLAG( ptnode->FLAG, RCN_FLAG_PASS ); + } + } + + for( scanctc = ptsig->PRCN->PCTC ; scanctc ; scanctc = scanctc->NEXT ) + { + ptctc = (loctc_list*)( scanctc->DATA ); + ptsig->PRCN->CAPA = ptsig->PRCN->CAPA + ptctc->CAPA; + } + + for( doing = todo ; doing ; doing = doing->NEXT ) + { + ptnode = (lonode_list*)( doing->DATA ); + if( ptnode->CTCLIST ) + continue; + + another = 1; + wire1 = (lowire_list*)( ptnode->WIRELIST->DATA ); + wire2 = (lowire_list*)( ptnode->WIRELIST->NEXT->DATA ); + + if( ptnode->WIRELIST->NEXT->NEXT ) + { + fprintf( stderr, "Anomalie.\n" ); + } + + resi = wire1->RESI + wire2->RESI ; + node1 = ( wire1->NODE1 == ptnode->INDEX ) ? wire1->NODE2 : wire1->NODE1 ; + node2 = ( wire2->NODE1 == ptnode->INDEX ) ? wire2->NODE2 : wire2->NODE1 ; + + setdellowire( ptsig, wire1 ); + setdellowire( ptsig, wire2 ); + wire1 = NULL; + wire2 = NULL; + + scanwire = getlowire( ptsig, node1, node2 ); + if( scanwire ) + addpararesiwire( scanwire, resi ); + else + addlowire( ptsig, + RCN_WIRE_UNKNOW, + 0, + resi, + 0.0, + 0l, + 0l, + 0l, + 0l, + node1, + node2 + ); + } + freechain( todo ); + + mergedellowire( ptsig ); + } + while( another ); + + return(1); +} + +void connexe_rec( losig_list *ptsig, + lowire_list *from, + lonode_list *ptnode, + int index + ) +{ + ptype_list *ptl; + chain_list *scanwire; + lonode_list *next; + + /* Le noeud par lequel on arrive est deja numerote */ + + /* Propagation sur les branches droites */ + while( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_TWO ) ) + { + if( (lowire_list*)(ptnode->WIRELIST->DATA) == from ) + from = (lowire_list*)(ptnode->WIRELIST->NEXT->DATA); + else + from = (lowire_list*)(ptnode->WIRELIST->DATA); + + if( from->NODE1 == ptnode->INDEX ) + ptnode = getlonode( ptsig, from->NODE2 ); + else + ptnode = getlonode( ptsig, from->NODE1 ); + + ptl = getptype( ptnode->USER, CONNEXE ); + if( (int)(ptl->DATA) != 0 ) + { + if( (int)(ptl->DATA) != index ) + { + fflush( stdout ); + fprintf( stderr, "RCN ERROR in connexe()\n" ); + fprintf( stderr, "index differs (1).\n" ); + exit( 1 ); + } + else + return; + } + else + ptl->DATA = (void*)(index); + } + + /* On arrive soit sur un noeud terminal, soit sur un embranchement */ + for( scanwire = ptnode->WIRELIST ; scanwire ; scanwire = scanwire->NEXT ) + { + from = ( lowire_list* )( scanwire->DATA ); + if( from->NODE1 == ptnode->INDEX ) + next = getlonode( ptsig, from->NODE2 ); + else + next = getlonode( ptsig, from->NODE1 ); + + ptl = getptype( next->USER, CONNEXE ); + if( (int)(ptl->DATA) == 0 ) + { + ptl->DATA = (void*)(index); + connexe_rec( ptsig, from, next, index ); + } + else + { + if( (int)(ptl->DATA) != index ) + { + fflush( stdout ); + fprintf( stderr, "RCN ERROR in connexe()\n" ); + fprintf( stderr, "index differs (2).\n" ); + exit( 1 ); + } + } + } + + return; +} + +int connexe( losig_list *ptsig ) +{ + lowire_list *scanlowire; + ptype_list *ptl; + lonode_list *ptnode; + int index; + + if( !gettabnode( ptsig->PRCN ) ) + { + fflush( stdout ); + fprintf( stderr, "*** Reduce RCN error\n" ); + fprintf( stderr, "Node table not built.\n" ); + EXIT(1); + } + + for( scanlowire = ptsig->PRCN->PWIRE ; + scanlowire ; + scanlowire = scanlowire->NEXT + ) + { + ptnode = getlonode( ptsig, scanlowire->NODE1 ); + ptl = getptype( ptnode->USER, CONNEXE ); + if( !ptl ) + ptnode->USER = addptype( ptnode->USER, CONNEXE, (void*)0 ); + else + ptl->DATA = (void*)0; + + ptnode = getlonode( ptsig, scanlowire->NODE2 ); + ptl = getptype( ptnode->USER, CONNEXE ); + if( !ptl ) + ptnode->USER = addptype( ptnode->USER, CONNEXE, (void*)0 ); + else + ptl->DATA = (void*)0; + } + + index = 0; + + for( scanlowire = ptsig->PRCN->PWIRE ; + scanlowire ; + scanlowire = scanlowire->NEXT + ) + { + ptnode = getlonode( ptsig, scanlowire->NODE1 ); + ptl = getptype( ptnode->USER, CONNEXE ); + + if( (int)(ptl->DATA) != 0 ) + continue; + + index++; + + ptl->DATA = (void*)index; + connexe_rec( ptsig, scanlowire, ptnode, index ); + + ptnode = getlonode( ptsig, scanlowire->NODE2 ); + ptl = getptype( ptnode->USER, CONNEXE ); + ptl->DATA = (void*)index; + connexe_rec( ptsig, scanlowire, ptnode, index ); + + } + + return( index ); +} + +int cleanrcnet( losig_list *ptsig ) +{ + lowire_list *scanwire; + lowire_list *ptwire; + lowire_list *parawire; + float capa; + lonode_list *ptnode; + lonode_list *fixnode; + chain_list *scanchain; + chain_list *next; + loctc_list *ptctc; + loctc_list *paractc; + int node; + chain_list *prev; + + if( !ptsig->PRCN ) + return(0); + + if( !gettabnode( ptsig->PRCN ) ) + { + fflush( stdout ); + fprintf( stderr, "*** Reduce RCN error\n" ); + fprintf( stderr, "Node table not built.\n" ); + EXIT(1); + } + + for( scanwire = ptsig->PRCN->PWIRE ; scanwire ; scanwire = scanwire->NEXT ) + { + if( RCN_GETFLAG( scanwire->FLAG, RCN_FLAG_DEL ) ) + continue; + + if( scanwire->RESI == 0.0 ) + { + if( scanwire->CAPA > 0.0 ) + { + capa = 0.0; + + /* Calcul de la capacité totale de chaque côtés de la résistance */ + + ptnode = getlonode( ptsig, scanwire->NODE1 ); + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptwire = (lowire_list*)scanchain->DATA; + if( ptwire != scanwire ) + capa = capa + ptwire->CAPA; + } + + ptnode = getlonode( ptsig, scanwire->NODE2 ); + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptwire = (lowire_list*)scanchain->DATA; + if( ptwire != scanwire ) + capa = capa + ptwire->CAPA; + } + + /* On transfert la capacité de la résistance proportionellement à la + * capacité des éléments voisins de cette résistance */ + ptnode = getlonode( ptsig, scanwire->NODE1 ); + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptwire = (lowire_list*)scanchain->DATA; + if( ptwire != scanwire ) + ptwire->CAPA = ptwire->CAPA*(1+scanwire->CAPA/capa); + } + + ptnode = getlonode( ptsig, scanwire->NODE2 ); + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptwire = (lowire_list*)scanchain->DATA; + if( ptwire != scanwire ) + ptwire->CAPA = ptwire->CAPA*(1+scanwire->CAPA/capa); + } + + scanwire->CAPA = 0.0; + } + + /* On choisi le neoud qui regroupera les 2 autres arbitrairement, sauf + * si on a un connecteur sur un des 2 côtés. + * On ne prend pas en compte le cas où on a une résistance en + * parallèle sur scanwire */ + + ptnode = getlonode( ptsig, scanwire->NODE2 ); + fixnode = getlonode( ptsig, scanwire->NODE1 ); + + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) && + !RCN_GETFLAG( fixnode->FLAG, RCN_FLAG_LOCON ) ) + { + lonode_list *tmp; + + tmp = ptnode ; + ptnode = fixnode; + fixnode = tmp; + } + else + if( RCN_GETFLAG( ptnode->FLAG, RCN_FLAG_LOCON ) && + RCN_GETFLAG( fixnode->FLAG, RCN_FLAG_LOCON ) ) + { + chain_list *sc2; + ptype_list *ptlfix; + ptype_list *ptlpt; + locon_list *ptlocon; + num_list *scannode; + + ptlfix = getptype( fixnode->USER, RCN_LOCON ); + ptlpt = getptype( ptnode->USER, RCN_LOCON ); + + /* Le noeud ptnode qui va disparaitre est un connecteur : on + * le transfert sur fixnode */ + + for( scanchain = (chain_list*)(ptlpt->DATA) ; + scanchain ; + scanchain = scanchain->NEXT + ) + { + ptlocon = (locon_list*)(scanchain->DATA); + for( scannode = ptlocon->PNODE ; + scannode ; + scannode = scannode->NEXT + ) + { + if( scannode->DATA == ptnode->INDEX ) + scannode->DATA = fixnode->INDEX; + } + for( sc2 =(chain_list*)(ptlfix->DATA); sc2 ; sc2 = sc2->NEXT ) + { + if( sc2->DATA == ptlocon ) + break; + } + if( !sc2 ) + ptlfix->DATA = (void*)addchain( (chain_list*)ptlfix->DATA, + (void*)ptlocon + ); + } + + + } + + prev = NULL; + for( scanchain = ptnode->WIRELIST ; + scanchain ; + scanchain = next + ) + { + next = scanchain->NEXT; + ptwire = (lowire_list*) scanchain->DATA; + if( ptwire == scanwire ) + { + prev = scanchain; + continue; + } + + if( ptwire->NODE1 == ptnode->INDEX ) + node = ptwire->NODE2; + else + node = ptwire->NODE1; + + parawire = getlowire( ptsig, fixnode->INDEX, node ); + if( parawire ) + { + addpararesiwire( parawire, ptwire->RESI ); + addcapawire( parawire, ptwire->CAPA ); + + setdellowire( ptsig, ptwire ); + } + else + { + if( ptwire->NODE1 == ptnode->INDEX ) + ptwire->NODE1 = fixnode->INDEX ; + else + ptwire->NODE2 = fixnode->INDEX ; + + fixnode->WIRELIST = addchain( fixnode->WIRELIST, ptwire ); + switch( RCN_GETFLAG( fixnode->FLAG, + RCN_FLAG_ONE|RCN_FLAG_TWO|RCN_FLAG_CROSS + ) + ) + { + case RCN_FLAG_ONE: + RCN_CLEARFLAG( fixnode->FLAG, RCN_FLAG_ONE ); + RCN_SETFLAG( fixnode->FLAG, RCN_FLAG_TWO ); + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG( fixnode->FLAG, RCN_FLAG_TWO ); + RCN_SETFLAG( fixnode->FLAG, RCN_FLAG_CROSS ); + break; + case RCN_FLAG_CROSS: + break; + default: + fprintf( stderr,"*** RCN internal error in cleanrcnet [1].\n"); + EXIT(1); + } + + switch( RCN_GETFLAG( ptnode->FLAG, + RCN_FLAG_ONE|RCN_FLAG_TWO|RCN_FLAG_CROSS + ) + ) + { + case RCN_FLAG_ONE: + RCN_CLEARFLAG( ptnode->FLAG, RCN_FLAG_ONE ); + break; + case RCN_FLAG_TWO: + RCN_CLEARFLAG( ptnode->FLAG, RCN_FLAG_TWO ); + RCN_SETFLAG( ptnode->FLAG, RCN_FLAG_ONE ); + break; + case RCN_FLAG_CROSS: + if( ptnode->WIRELIST->NEXT->NEXT->NEXT == NULL ) + { + RCN_CLEARFLAG( ptnode->FLAG, RCN_FLAG_CROSS ); + RCN_SETFLAG( ptnode->FLAG, RCN_FLAG_TWO ); + } + break; + default: + fprintf( stderr,"*** RCN internal error in cleanrcnet [1].\n"); + EXIT(1); + } + + if( !prev ) + ptnode->WIRELIST = next; + else + prev->NEXT = next; + scanchain->NEXT=NULL; + freechain( scanchain ); + + } + } + + /* On supprime éventuellement la CTC entre les deux extrémités de + * la résistance qu'on est en train de supprimer */ + ptctc = getloctc( ptsig, fixnode->INDEX, ptsig, ptnode->INDEX ); + if( ptctc ) + delloctc( ptsig, fixnode->INDEX, ptsig, ptnode->INDEX ); + + for( scanchain = ptnode->CTCLIST ; + scanchain ; + scanchain = next + ) + { + next = scanchain->NEXT; + ptctc = (loctc_list*)scanchain->DATA; + if( ptctc->SIG1 == ptsig && ptctc->NODE1 == ptnode->INDEX ) + { + paractc = getloctc( ptsig, fixnode->INDEX, + ptctc->SIG2, ptctc->NODE2 + ); + if( paractc ) + { + paractc->CAPA = paractc->CAPA + ptctc->CAPA; + delloctc( ptctc->SIG1, ptctc->NODE1, ptctc->SIG2, ptctc->NODE2 ); + } + else + { + ptctc->NODE1 = fixnode->INDEX; + fixnode->CTCLIST = addchain( fixnode->CTCLIST, ptctc ); + } + } + else + { + paractc = getloctc( ptsig, fixnode->INDEX, + ptctc->SIG1, ptctc->NODE1 + ); + if( paractc ) + { + paractc->CAPA = paractc->CAPA + ptctc->CAPA; + delloctc( ptctc->SIG1, ptctc->NODE1, ptctc->SIG2, ptctc->NODE2 ); + } + else + { + ptctc->NODE2 = fixnode->INDEX; + fixnode->CTCLIST = addchain( fixnode->CTCLIST, ptctc ); + } + } + } + if( ptnode->CTCLIST ) + { + freechain(ptnode->CTCLIST); + ptnode->CTCLIST = NULL; + } + + setdellowire( ptsig, scanwire ); + RCN_CLEARFLAG( ptnode->FLAG, RCN_FLAG_TRUE ); + } + + } + mergedellowire( ptsig ); + + return(1); +}