From d67e14a5f729b0e5eceaa9a24fdb7dea2e19083c Mon Sep 17 00:00:00 2001 From: Ludovic Jacomme Date: Thu, 21 Mar 2002 12:47:12 +0000 Subject: [PATCH] Hi --- alliance/src/vbh/Makefile.am | 1 + alliance/src/vbh/configure.in | 45 + alliance/src/vbh/src/Makefile.am | 6 + alliance/src/vbh/src/vbh.h | 537 ++++++++++ alliance/src/vbh/src/vbh_add.c | 948 +++++++++++++++++ alliance/src/vbh/src/vbh_crt.c | 93 ++ alliance/src/vbh/src/vbh_dup.c | 905 ++++++++++++++++ alliance/src/vbh/src/vbh_fre.c | 707 +++++++++++++ alliance/src/vbh/src/vbh_simp.c | 672 ++++++++++++ alliance/src/vbh/src/vbh_view.c | 1023 ++++++++++++++++++ alliance/src/vpd/Makefile.am | 1 + alliance/src/vpd/configure.in | 45 + alliance/src/vpd/src/Makefile.am | 7 + alliance/src/vpd/src/vpd.h | 68 ++ alliance/src/vpd/src/vpd_drive.c | 715 +++++++++++++ alliance/src/vpd/src/vpd_drive.h | 75 ++ alliance/src/vpd/src/vpd_error.c | 124 +++ alliance/src/vpd/src/vpd_error.h | 91 ++ alliance/src/vpd/src/vpd_parse.c | 1001 ++++++++++++++++++ alliance/src/vpd/src/vpd_parse.h | 75 ++ alliance/src/vpn/Makefile.am | 1 + alliance/src/vpn/configure.in | 45 + alliance/src/vpn/src/Makefile.am | 10 + alliance/src/vpn/src/main.c | 336 ++++++ alliance/src/vpn/src/toto.c | 191 ++++ alliance/src/vpn/src/vpn.h | 955 +++++++++++++++++ alliance/src/vpn/src/vpnadd.c | 1675 ++++++++++++++++++++++++++++++ alliance/src/vpn/src/vpnadd.h | 75 ++ alliance/src/vpn/src/vpnalloc.c | 249 +++++ alliance/src/vpn/src/vpnalloc.h | 75 ++ alliance/src/vpn/src/vpndel.c | 1084 +++++++++++++++++++ alliance/src/vpn/src/vpndel.h | 75 ++ alliance/src/vpn/src/vpnenv.c | 119 +++ alliance/src/vpn/src/vpnenv.h | 79 ++ alliance/src/vpn/src/vpnerror.c | 207 ++++ alliance/src/vpn/src/vpnerror.h | 112 ++ alliance/src/vpn/src/vpnfree.c | 286 +++++ alliance/src/vpn/src/vpnfree.h | 75 ++ alliance/src/vpn/src/vpnget.c | 126 +++ alliance/src/vpn/src/vpnget.h | 75 ++ alliance/src/vpn/src/vpnsearch.c | 369 +++++++ alliance/src/vpn/src/vpnsearch.h | 75 ++ alliance/src/vpn/src/vpnsimp.c | 178 ++++ alliance/src/vpn/src/vpnsimp.h | 75 ++ alliance/src/vpn/src/vpnunion.c | 100 ++ alliance/src/vpn/src/vpnunion.h | 75 ++ alliance/src/vpn/src/vpnview.c | 896 ++++++++++++++++ alliance/src/vpn/src/vpnview.h | 75 ++ 48 files changed, 14832 insertions(+) create mode 100644 alliance/src/vbh/Makefile.am create mode 100644 alliance/src/vbh/configure.in create mode 100644 alliance/src/vbh/src/Makefile.am create mode 100644 alliance/src/vbh/src/vbh.h create mode 100644 alliance/src/vbh/src/vbh_add.c create mode 100644 alliance/src/vbh/src/vbh_crt.c create mode 100644 alliance/src/vbh/src/vbh_dup.c create mode 100644 alliance/src/vbh/src/vbh_fre.c create mode 100644 alliance/src/vbh/src/vbh_simp.c create mode 100644 alliance/src/vbh/src/vbh_view.c create mode 100644 alliance/src/vpd/Makefile.am create mode 100644 alliance/src/vpd/configure.in create mode 100644 alliance/src/vpd/src/Makefile.am create mode 100644 alliance/src/vpd/src/vpd.h create mode 100644 alliance/src/vpd/src/vpd_drive.c create mode 100644 alliance/src/vpd/src/vpd_drive.h create mode 100644 alliance/src/vpd/src/vpd_error.c create mode 100644 alliance/src/vpd/src/vpd_error.h create mode 100644 alliance/src/vpd/src/vpd_parse.c create mode 100644 alliance/src/vpd/src/vpd_parse.h create mode 100644 alliance/src/vpn/Makefile.am create mode 100644 alliance/src/vpn/configure.in create mode 100644 alliance/src/vpn/src/Makefile.am create mode 100644 alliance/src/vpn/src/main.c create mode 100644 alliance/src/vpn/src/toto.c create mode 100644 alliance/src/vpn/src/vpn.h create mode 100644 alliance/src/vpn/src/vpnadd.c create mode 100644 alliance/src/vpn/src/vpnadd.h create mode 100644 alliance/src/vpn/src/vpnalloc.c create mode 100644 alliance/src/vpn/src/vpnalloc.h create mode 100644 alliance/src/vpn/src/vpndel.c create mode 100644 alliance/src/vpn/src/vpndel.h create mode 100644 alliance/src/vpn/src/vpnenv.c create mode 100644 alliance/src/vpn/src/vpnenv.h create mode 100644 alliance/src/vpn/src/vpnerror.c create mode 100644 alliance/src/vpn/src/vpnerror.h create mode 100644 alliance/src/vpn/src/vpnfree.c create mode 100644 alliance/src/vpn/src/vpnfree.h create mode 100644 alliance/src/vpn/src/vpnget.c create mode 100644 alliance/src/vpn/src/vpnget.h create mode 100644 alliance/src/vpn/src/vpnsearch.c create mode 100644 alliance/src/vpn/src/vpnsearch.h create mode 100644 alliance/src/vpn/src/vpnsimp.c create mode 100644 alliance/src/vpn/src/vpnsimp.h create mode 100644 alliance/src/vpn/src/vpnunion.c create mode 100644 alliance/src/vpn/src/vpnunion.h create mode 100644 alliance/src/vpn/src/vpnview.c create mode 100644 alliance/src/vpn/src/vpnview.h diff --git a/alliance/src/vbh/Makefile.am b/alliance/src/vbh/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/vbh/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/vbh/configure.in b/alliance/src/vbh/configure.in new file mode 100644 index 00000000..d1a1a3f5 --- /dev/null +++ b/alliance/src/vbh/configure.in @@ -0,0 +1,45 @@ +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/21 12:47:12 ludo Exp $ +dnl +dnl +AC_INIT(src/vbh.h) +AM_INIT_AUTOMAKE(vbh, 1.4) +AC_PROG_INSTALL +AC_PROG_CC +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/vbh/src/Makefile.am b/alliance/src/vbh/src/Makefile.am new file mode 100644 index 00000000..3ccc8819 --- /dev/null +++ b/alliance/src/vbh/src/Makefile.am @@ -0,0 +1,6 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libVbh.a +include_HEADERS = vbh.h +libVbh_a_SOURCES = \ +vbh.h vbh_add.c vbh_crt.c vbh_dup.c vbh_fre.c vbh_simp.c vbh_view.c diff --git a/alliance/src/vbh/src/vbh.h b/alliance/src/vbh/src/vbh.h new file mode 100644 index 00000000..6cb72bc8 --- /dev/null +++ b/alliance/src/vbh/src/vbh.h @@ -0,0 +1,537 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : vbh.h */ +/* date : Apr 13 1993 */ +/* version : 104 */ +/* */ +/* ###--------------------------------------------------------------### */ + +#ifndef VBH_DEFINE +#define VBH_DEFINE + + /* ###------------------------------------------------------### */ + /* defines */ + /* ###------------------------------------------------------### */ + +#define VBH_BEIFS 0 /* if statement ptype code */ +#define VBH_BECAS 1 /* case statement ptype code */ +#define VBH_BEASG 2 /* assign statement ptype code */ +#define VBH_BEVAR 3 /* var assign statement ptype code */ +#define VBH_BEFOR 4 /* for statement ptype code */ +#define VBH_BENXT 5 /* next statement ptype code */ +#define VBH_BEEXT 6 /* exit statement ptype code */ +#define VBH_BEWAS 7 /* exit statement ptype code */ +#define VBH_BEWHI 8 /* while statement ptype code */ +#define VBH_BERET 9 /* return statement ptype code */ +#define VBH_BECAL 10 /* call statement ptype code */ +#define VBH_BELOP 11 /* loop statement ptype code */ +#define VBH_BEAGR 12 /* agregate statement ptype code */ + +# define VBH_TIME_UNIT_UNKNOWN 0 +# define VBH_TIME_UNIT_FS 1 +# define VBH_TIME_UNIT_PS 2 +# define VBH_TIME_UNIT_NS 3 +# define VBH_TIME_UNIT_MS 4 +# define VBH_MAX_TIME_UNIT 5 + + +#define VBH_ATTR_ENTITY 0 +#define VBH_ATTR_ARCHITECTURE 1 +#define VBH_ATTR_PACKAGE 2 +#define VBH_ATTR_FUNCTION 3 +#define VBH_ATTR_PROCEDURE 4 +#define VBH_ATTR_SUBTYPE 5 +#define VBH_ATTR_CONSTANT 6 +#define VBH_ATTR_VARIABLE 7 +#define VBH_ATTR_SIGNAL 8 +#define VBH_ATTR_LABEL 9 +#define VBH_ATTR_TYPE 10 +#define VBH_ATTR_CONFIGURATION 11 +#define VBH_ATTR_COMPONENT 12 + +# define VBH_TYPE_SEVERITY VEX_TYPE_SEVERITY +# define VBH_TYPE_BOOLEAN VEX_TYPE_BOOLEAN +# define VBH_TYPE_CHARACTER VEX_TYPE_CHARACTER +# define VBH_TYPE_STRING VEX_TYPE_STRING +# define VBH_TYPE_BIT VEX_TYPE_BIT +# define VBH_TYPE_INTEGER VEX_TYPE_INTEGER +# define VBH_TYPE_NATURAL VEX_TYPE_NATURAL +# define VBH_TYPE_BIT_VECTOR VEX_TYPE_BIT_VECTOR +# define VBH_TYPE_STD_ULOGIC VEX_TYPE_STD_ULOGIC +# define VBH_TYPE_STD_LOGIC VEX_TYPE_STD_LOGIC +# define VBH_TYPE_STD_ULOGIC_VECTOR VEX_TYPE_STD_ULOGIC_VECTOR +# define VBH_TYPE_STD_LOGIC_VECTOR VEX_TYPE_STD_LOGIC_VECTOR +# define VBH_TYPE_X01 VEX_TYPE_X01 +# define VBH_TYPE_X01Z VEX_TYPE_X01Z +# define VBH_TYPE_UX01 VEX_TYPE_UX01 +# define VBH_TYPE_UX01Z VEX_TYPE_UX01Z +# define VBH_TYPE_UNSIGNED VEX_TYPE_UNSIGNED +# define VBH_TYPE_SIGNED VEX_TYPE_SIGNED +# define VBH_TYPE_SMALL_INT VEX_TYPE_SMALL_INT +# define VBH_TYPE_REG_BIT VEX_TYPE_REG_BIT +# define VBH_TYPE_REG_VECTOR VEX_TYPE_REG_VECTOR +# define VBH_TYPE_MUX_BIT VEX_TYPE_MUX_BIT +# define VBH_TYPE_MUX_VECTOR VEX_TYPE_MUX_VECTOR +# define VBH_TYPE_WOR_BIT VEX_TYPE_WOR_BIT +# define VBH_TYPE_WOR_VECTOR VEX_TYPE_WOR_VECTOR +# define VBH_MAX_TYPE VEX_TYPE_ENUMERATE + +# define VBH_KIND_NONE 0 +# define VBH_KIND_BUS 1 +# define VBH_KIND_REGISTER 2 +# define VBH_MAX_KIND 3 + +# define VBH_CLASS_NONE 0 +# define VBH_CLASS_CONSTANT 1 +# define VBH_CLASS_VARIABLE 2 +# define VBH_CLASS_SIGNAL 3 +# define VBH_MAX_CLASS 4 + +# define VBH_PROCESS_SEQUENTIAL_MASK 0x01 +# define VBH_PROCESS_WITHSELECT_MASK 0x02 +# define VBH_PROCESS_GUARDED_MASK 0x04 +# define VBH_PROCESS_CONDITIONNAL_MASK 0x08 + +# define VBH_GENERATE_IF 0x00 +# define VBH_GENERATE_FOR 0x01 + +# define VBH_DYNAMIC_TO 0x1 +# define VBH_DYNAMIC_DOWNTO 0x2 + +# define IsVbhProcSequential( P ) ( (P)->TYPE & VBH_PROCESS_SEQUENTIAL_MASK ) +# define IsVbhProcWithSelect( P ) ( (P)->TYPE & VBH_PROCESS_WITHSELECT_MASK ) +# define IsVbhProcConditionnal( P ) ( (P)->TYPE & VBH_PROCESS_CONDITIONNAL_MASK ) +# define IsVbhProcGuarded( P ) ( (P)->TYPE & VBH_PROCESS_GUARDED_MASK ) + +# define SetVbhProcSequential( P ) ( (P)->TYPE |= VBH_PROCESS_SEQUENTIAL_MASK ) +# define SetVbhProcWithSelect( P ) ( (P)->TYPE |= VBH_PROCESS_WITHSELECT_MASK ) +# define SetVbhProcConditionnal( P ) ( (P)->TYPE |= VBH_PROCESS_CONDITIONNAL_MASK ) +# define SetVbhProcGuarded( P ) ( (P)->TYPE |= VBH_PROCESS_GUARDED_MASK ) + +# define ClearVbhProcSequential( P ) ( (P)->TYPE &= ~VBH_PROCESS_SEQUENTIAL_MASK ) +# define ClearVbhProcWithSelect( P ) ( (P)->TYPE &= ~VBH_PROCESS_WITHSELECT_MASK ) +# define ClearVbhProcConditionnal( P ) ( (P)->TYPE &= ~VBH_PROCESS_CONDITIONNAL_MASK ) +# define ClearVbhProcGuarded( P ) ( (P)->TYPE &= ~VBH_PROCESS_GUARDED_MASK ) + + /* ###------------------------------------------------------### */ + /* structure definitions */ + /* ###------------------------------------------------------### */ + +typedef struct vbtyp /* type or subtype */ +{ + struct vbtyp *NEXT; /* next vbtyp */ + char *NAME; /* type's name */ + long LEFT; /* left bound */ + long RIGHT; /* right bound */ + char **VALUE; /* list of values */ + unsigned int SIZE; /* number of values */ + unsigned int BYTE; /* number of bytes needed to code values*/ + char CLASS; /* type's class (E, I, A, S) */ + unsigned char INDEX; /* the type id number */ + struct vbtyp *BASE; /* the base type or element's type */ + struct vbfun *RESOLV; /* resolution function */ + unsigned char DYNAMIC; + vexexpr *DYNAMIC_LEFT; + vexexpr *DYNAMIC_RIGHT; + long FLAGS; + long LINE; +} +vbtyp_list; + +typedef struct vbfig /* behaviour figure */ + { + struct vbfig *NEXT; /* next figure */ + char *NAME; /* model or package's name */ + struct vbaux *BEAUX; /* internal signals */ + struct vbcst *BECST; /* internal constants */ + struct vbpor *BEPOR; /* ports (reverse order of declaration) */ + struct vbgen *BEGEN; /* generics declarations */ + struct vbpcs *BEPCS; /* list of processes */ + struct vbfun *BEFUN; /* list of functions */ + struct vbtyp *BETYP; /* list of declared types */ + struct vbatr *BEATR; /* list of declared attributes */ + struct vbgnr *BEGNR; /* list of generates */ + authtable *HASH_TYPE; /* hash table for types */ + struct vbmod *BEMOD; /* list of declared model */ + struct vbins *BEINS; /* list of instance */ + struct ptype *USER; /* reserved for user's applications */ + chain_list *PACK_LIST; /* list of used packages */ + unsigned char PACKAGE; /* package figure ? */ + char FLAG; /* error flags */ + } +vbfig_list; + +typedef struct vbgnr /* generate statements */ + { + struct vbgnr *NEXT; /* next figure */ + char *LABEL; /* generate's label */ + char TYPE; /* generate's type (FOR/IF) */ + + vexexpr *FOR_VARIABLE; /* for variable */ + vexexpr *FOR_LEFT; /* for left bound */ + vexexpr *FOR_RIGHT; /* for right bound */ + char FOR_UP; /* for to or downto */ + vexexpr *IF_COND; /* if condition */ + + struct vbpcs *BEPCS; /* list of processes */ + struct vbins *BEINS; /* list of instance */ + struct vbgnr *BEGNR; /* list of generates */ + long LINE; + } +vbgnr_list; + +typedef struct vbmod +{ + struct vbmod *NEXT; + char *NAME; /* Name of the model */ + struct vbpor *BEPOR; /* Ports of the model */ + struct vbgen *BEGEN; /* Generic declarations */ + long LINE; +} +vbmod_list; + +typedef struct vbins +{ + struct vbins *NEXT; + char *NAME; /* Name of instance */ + char *MODEL; /* Name of the model */ + struct vbmap *PORT_MAP; /* List of port association */ + struct vbmap *GEN_MAP; /* List of generics association */ + long LINE; +} +vbins_list; + +typedef struct vbmap +{ + struct vbmap *NEXT; + vexexpr *FORMAL; + vexexpr *ACTUAL; + long LINE; +} +vbmap_list; + +typedef struct vbgen /* generic */ +{ + struct vbgen *NEXT; /* next constant */ + vexexpr *TARGET; /* generic name */ + vexexpr *VEX; /* generic init (VEX) */ + vbtyp_list *TYPE; /* generic type */ + long LINE; +} +vbgen_list; + +typedef struct vbatr +{ + struct vbatr *NEXT; + char *NAME; + char *ENTITY; + unsigned int TYPE; + char *VALUE; + long LINE; +} +vbatr_list; + +typedef struct vbaux /* auxiliary signal */ + { + struct vbaux *NEXT; /* next signal */ + vexexpr *TARGET; /* signal's name */ + vexexpr *VEX; /* signal's init (VEX) */ + unsigned char KIND; /* signal's kind */ + vbtyp_list *TYPE; /* signal's type */ + long LINE; + } +vbaux_list; + +typedef struct vbcst /* constant */ + { + struct vbcst *NEXT; /* next constant */ + vexexpr *TARGET; /* constant name */ + vexexpr *VEX; /* constant init (VEX) */ + vbtyp_list *TYPE; /* constant type */ + long LINE; + } +vbcst_list; + +typedef struct vbpor /* port */ + { + struct vbpor *NEXT; /* next port */ + vexexpr *TARGET; /* port's name */ + vexexpr *VEX; /* port's init (VEX) */ + unsigned char DIR; /* port's mode (same as LOCON) */ + unsigned char KIND; /* port's kind */ + vbtyp_list *TYPE; /* port's type (B, M or W) */ + long LINE; + } +vbpor_list; + +typedef struct vbpcs /* process */ +{ + struct vbpcs *NEXT; /* next process */ + char *LABEL; /* process's label */ + struct chain *SENSITIVITY; /* list of sensitivity */ + struct ptype *VARIABLE; /* list of variable */ + struct ptype *INSTRUCTION; /* list of instructions */ + unsigned char TYPE; /* process type */ + long LINE; +} +vbpcs_list; + +typedef struct vbifs /* if statement */ +{ + vexexpr *CND; /* condition (vex) */ + struct ptype *CNDTRUE; /* list of instructions when true */ + struct ptype *CNDFALSE; /* list of instructions when false */ + long LINE; +} +vbifs_list; + +typedef struct vbasg /* signal assignment statement */ +{ + vexexpr *TARGET; /* target (vex) */ + vexexpr *VEX; /* condition (vex) */ + vbtyp_list *TYPE; /* signal's type */ + long LINE; +} +vbasg_list; + +typedef struct vbagr +{ + struct ptype *ASSIGN; + long LINE; +} +vbagr_list; + +typedef struct vbvar /* variable assignment statement */ +{ + vexexpr *TARGET; /* target's name */ + vexexpr *VEX; /* condition (vex) */ + vbtyp_list *TYPE; /* signal's type */ + long LINE; +} +vbvar_list; + +typedef struct vbcas /* case statement */ +{ + vexexpr *VEX; /* list of expression (VEX) */ + struct vbcho *CHOICE; /* table of choices */ + vbtyp_list *TYPE; /* expression's type */ + unsigned int SIZE; /* size of choices' table */ + void *USER; + long LINE; +} +vbcas_list; + +typedef struct vbcho /* a choice in a case instruction */ +{ + chain_list *VALUES; /* the value's list of the choice */ + unsigned int SIZE; /* size of the value in byte */ + struct ptype *INSTRUCTION; /* list of instructions */ + long LINE; +} +vbcho_list; + +typedef struct vbwhi /* a loop instruction */ +{ + char *LABEL; /* the name of the loop */ + vexexpr *CND; /* condition clause */ + struct ptype *INSTRUCTION; /* list of instructions */ + long LINE; +} +vbwhi_list; + +typedef struct vblop /* a loop instruction */ +{ + char *LABEL; /* the name of the loop */ + struct ptype *INSTRUCTION; /* list of instructions */ + long LINE; +} +vblop_list; + +typedef struct vbfor /* a loop instruction */ +{ + char *LABEL; /* the name of the loop */ + vexexpr *VARIABLE; /* the name of the variable */ + vexexpr *LEFT; + vexexpr *RIGHT; + char UP; /* to or downto */ + struct ptype *INSTRUCTION; /* list of instructions */ + long LINE; +} +vbfor_list; + +typedef struct vbwas /* sequential wait statement */ +{ + struct chain *SEN; /* senisitvity list */ + vexexpr *CND; /* condition clause */ + unsigned char TIME_UNIT; /* name of the time unit */ + vexexpr *TIMEOUT; /* timeout clause */ + long LINE; +} +vbwas_list; + +typedef struct vbext /* exit statement */ +{ + char *LABEL; /* label of the targeted loop */ + vexexpr *CND; /* condition (vex) */ + long LINE; +} +vbext_list; + +typedef struct vbnxt /* next statement */ +{ + char *LABEL; /* label of the targeted loop */ + vexexpr *CND; /* condition (vex) */ + long LINE; +} +vbnxt_list; + +typedef struct vbret /* return statement */ +{ + vexexpr *RET; /* expression (vex) */ + long LINE; +} +vbret_list; + +typedef struct vbcal /* call statement */ +{ + vexexpr *CALL; /* procedure call (vex) */ + long LINE; +} +vbcal_list; + +typedef struct vbarg +{ + struct vbarg *NEXT; /* next param */ + vexexpr *TARGET; /* param's name */ + char DIR; /* param's mode (same as LOCON) */ + char CLASS; /* param's class C,V,S */ + vbtyp_list *TYPE; /* param's type (B, M or W) */ + long LINE; +} +vbarg_list; + +typedef struct vbfun /* function statement */ +{ + struct vbfun *NEXT; /* next process */ + char *NAME; /* function's name */ + struct vbarg *ARGUMENT; /* list of arguments */ + struct vbarg *RETURN; /* return value */ + struct ptype *VARIABLE; /* list of variable */ + struct ptype *INSTRUCTION; /* list of instructions */ + unsigned char TYPE; /* function type */ + long LINE; +} +vbfun_list; + + /* ###------------------------------------------------------### */ + /* low-level functions */ + /* ###------------------------------------------------------### */ + +extern struct vbaux *vbh_addvbaux (); +extern struct vbatr *vbh_addvbatr (); +extern struct vbcst *vbh_addvbcst (); +extern struct vbgen *vbh_addvbgen (); +extern struct vbfig *vbh_addvbfig (); +extern struct vbpor *vbh_addvbpor (); +extern struct ptype *vbh_addvbifs (); +extern struct ptype *vbh_addvbasg (); +extern struct ptype *vbh_addvbcas (); +extern struct ptype *vbh_addvbfor (); +extern struct ptype *vbh_addvbwhi (); +extern struct ptype *vbh_addvblop (); +extern struct vbpcs *vbh_addvbpcs (); +extern struct vbarg *vbh_addvbarg (); +extern ptype_list *vbh_addvbagr (); +extern struct vbfun *vbh_addvbfun (); +extern struct vbnxt *vbh_addvbnxt (); +extern struct vbret *vbh_addvbret (); +extern struct vbcal *vbh_addvbcal (); +extern struct vbext *vbh_addvbext (); +extern struct vbwas *vbh_addvbwas (); +extern ptype_list *vbh_addvbvar (); +extern struct vbtyp *vbh_addvbtyp (); +extern struct vbmap *vbh_addvbmap (); +extern struct vbmod *vbh_addvbmod (); +extern struct vbins *vbh_addvbins (); +extern struct vbgnr *vbh_addvbgnr (); + +extern struct vbtyp *vbh_crtvbtyp (); + +extern void vbh_delvbfig (); +extern void vbh_frevbfig (); +extern void vbh_frevbaux (); +extern void vbh_frevbatr (); +extern void vbh_frevbcst (); +extern void vbh_frevbgen (); +extern void vbh_frevbpor (); +extern void vbh_frevbpcs (); +extern void vbh_frevbarg (); +extern void vbh_frevbfun (); +extern void vbh_frevbifs (); +extern void vbh_frevbasg (); +extern void vbh_frevbcas (); +extern void vbh_frevbwhi (); +extern void vbh_frevblop (); +extern void vbh_frevbfor (); +extern void vbh_frevbpcs (); +extern void vbh_frevbnxt (); +extern void vbh_frevbret (); +extern void vbh_frevbcal (); +extern void vbh_frevbext (); +extern void vbh_frevbwas (); +extern void vbh_frevbvar (); +extern void vbh_frevbagr (); +extern void vbh_frevbtyp (); +extern void vbh_frevbinst (); +extern void vbh_frevbmod (); +extern void vbh_frevbins (); +extern void vbh_frevbmap (); +extern void vbh_frevbgnr (); + +extern void vbh_viewvbfig(); +extern void vbh_viewvbtyp(); +extern void vbh_viewvbinst(); + +extern void vbh_simpvbfig(); +extern void vbh_forallvexvbfig(); +extern void vbh_simpvbinst(); + +extern vbtyp_list *vbh_prdeftyp(); +extern vbtyp_list *vbh_getvbtyp(); +extern vbtyp_list *vbh_getvbtypbyindex(); + +extern void vbh_dupvbfig(); +extern ptype_list *vbh_dupvbinst(); + + /* ###------------------------------------------------------### */ + /* parser-driver functions */ + /* ###------------------------------------------------------### */ + +#endif diff --git a/alliance/src/vbh/src/vbh_add.c b/alliance/src/vbh/src/vbh_add.c new file mode 100644 index 00000000..3dd6783e --- /dev/null +++ b/alliance/src/vbh/src/vbh_add.c @@ -0,0 +1,948 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/* ###--------------------------------------------------------------### */ +/* */ +/* file : vbh_addvbasg.c */ +/* date : Aug 28 1992 */ +/* version : v102 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : contains a specific function used to create a */ +/* behaviour data structure */ +/* */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "aut.h" +#include "vex.h" +#include "vbh.h" + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbmod */ +/* description : create a VBMOD structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbmod *vbh_addvbmod (lastvbmod, name, line) + +struct vbmod *lastvbmod; +char *name; +long line; +{ + struct vbmod *ptmod; + + ptmod = (struct vbmod *) autallocheap (sizeof(struct vbmod)); + ptmod->NAME = namealloc( name );; + ptmod->LINE = line; + ptmod->NEXT = lastvbmod; + + return (ptmod); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbins */ +/* description : create a VBINS structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbins *vbh_addvbins (lastvbins, name, model, line) + +struct vbins *lastvbins; +char *name; +char *model; +long line; +{ + struct vbins *ptins; + + ptins = (struct vbins *) autallocheap (sizeof(struct vbins)); + ptins->NAME = namealloc( name );; + ptins->MODEL = namealloc( model );; + ptins->LINE = line; + ptins->NEXT = lastvbins; + + return (ptins); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbgnr */ +/* description : create a VBGNR structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbgnr *vbh_addvbgnr (lastvbgnr, label, line) + +struct vbgnr *lastvbgnr; +char *label; +long line; +{ + struct vbgnr *ptgnr; + + ptgnr = (struct vbgnr *) autallocheap (sizeof(struct vbgnr)); + ptgnr->LABEL = namealloc( label );; + ptgnr->LINE = line; + ptgnr->NEXT = lastvbgnr; + + return (ptgnr); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbmap */ +/* description : create a VBMAP structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbmap *vbh_addvbmap (lastvbmap, formal, actual, line) + +struct vbmap *lastvbmap; +vexexpr *formal; +vexexpr *actual; +long line; +{ + struct vbmap *ptmap; + + ptmap = (struct vbmap *) autallocheap (sizeof(struct vbmap)); + ptmap->FORMAL = formal; + ptmap->ACTUAL = actual; + ptmap->LINE = line; + ptmap->NEXT = lastvbmap; + + return (ptmap); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbagr */ +/* description : create a VBAGR structure at the top the list */ +/* called func. : addptype, autallocheap, namealloc */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvbagr (lastptype, assign_lst, line) + +struct ptype *lastptype; /* pointer on the last ptype structure */ +struct ptype *assign_lst; +long line; + +{ + struct ptype *ptptype; + struct vbagr *ptvbagr; + + ptvbagr = (struct vbagr *) autallocheap (sizeof(struct vbagr)); + ptvbagr->ASSIGN = assign_lst; + ptvbagr->LINE = line; + + ptptype = addptype (lastptype, VBH_BEAGR, (void *)ptvbagr); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbasg */ +/* description : create a VBASG structure at the top the list */ +/* called func. : addptype, autallocheap, namealloc */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvbasg (lastptype, target, vex, type, line) + +struct ptype *lastptype; /* pointer on the last ptype structure */ +vexexpr *target; /* signal's name */ +vexexpr *vex; /* condition's expression */ +vbtyp_list *type; /* signal's type (cannot be 0) */ +long line; + +{ + struct ptype *ptptype; + struct vbasg *ptvbasg; + + ptvbasg = (struct vbasg *) autallocheap (sizeof(struct vbasg)); + ptvbasg->TARGET = target; + ptvbasg->VEX = vex; + ptvbasg->TYPE = type; + ptvbasg->LINE = line; + + ptptype = addptype (lastptype, VBH_BEASG, (void *)ptvbasg); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbcst */ +/* description : create a VBCST structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbcst *vbh_addvbcst (lastvbcst, target, vex_expr, type,line) + +struct vbcst *lastvbcst; /* pointer on the last vbaux structure */ +vexexpr *target; /* constant name */ +vexexpr *vex_expr; /* constant expression (ABL) */ +vbtyp_list *type; /* constant type */ +long line; + +{ + struct vbcst *ptcst; + + ptcst = (struct vbcst *) autallocheap (sizeof(struct vbcst)); + ptcst->TARGET = target; + ptcst->VEX = vex_expr; + ptcst->TYPE = type; + ptcst->LINE = line; + ptcst->NEXT = lastvbcst; + + return (ptcst); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbgen */ +/* description : create a VBGEN structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbgen *vbh_addvbgen (lastvbgen, target, vex_expr, type,line) + +struct vbgen *lastvbgen; /* pointer on the last vbaux structure */ +vexexpr *target; /* generic name */ +vexexpr *vex_expr; /* generic expression (ABL) */ +vbtyp_list *type; /* generic type */ +long line; + +{ + struct vbgen *ptgen; + + ptgen = (struct vbgen *) autallocheap (sizeof(struct vbgen)); + ptgen->TARGET = target; + ptgen->VEX = vex_expr; + ptgen->TYPE = type; + ptgen->LINE = line; + ptgen->NEXT = lastvbgen; + + return (ptgen); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbatr */ +/* description : create a VBATR structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbatr *vbh_addvbatr (lastvbatr, name, entity, type, value, line ) + +struct vbatr *lastvbatr; /* pointer on the last vbatr structure */ +char *name; +char *entity; +int type; +char *value; +long line; +{ + struct vbatr *ptatr; + + ptatr = (struct vbatr *) autallocheap (sizeof(struct vbatr)); + ptatr->NAME = name; + ptatr->ENTITY = entity; + ptatr->TYPE = type; + ptatr->VALUE = value; + ptatr->LINE = line; + ptatr->NEXT = lastvbatr; + + return (ptatr); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbaux */ +/* description : create a VBAUX structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbaux *vbh_addvbaux (lastvbaux, target, vex_expr, kind, type,line) + +struct vbaux *lastvbaux; /* pointer on the last vbaux structure */ +vexexpr *target; /* signal's name */ +vexexpr *vex_expr; /* signal's expression (ABL) */ +unsigned char kind; /* signal's kind BUS */ +vbtyp_list *type; /* signal's type */ +long line; + +{ + struct vbaux *ptaux; + + ptaux = (struct vbaux *) autallocheap (sizeof(struct vbaux)); + ptaux->TARGET = target; + ptaux->VEX = vex_expr; + ptaux->KIND = kind; + ptaux->TYPE = type; + ptaux->LINE = line; + ptaux->NEXT = lastvbaux; + + return (ptaux); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbcas */ +/* description : create a VBCAS structure at the top the list */ +/* called func. : addptype, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvbcas (lastptype, Vex,type,line) + +struct ptype *lastptype; /* pointer on the last ptype structure */ +vexexpr *Vex; /* condition's expression */ +vbtyp_list *type; /* expression's type i */ +long line; +{ + struct ptype *ptptype; + struct vbcas *ptvbcas; + + ptvbcas = (struct vbcas *) autallocheap (sizeof(struct vbcas)); + ptvbcas->VEX = Vex; + ptvbcas->TYPE = type; + ptvbcas->LINE = line; + + ptptype = addptype (lastptype, VBH_BECAS, (void *)ptvbcas); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbext */ +/* description : create a VBEXT (sequential exit statement) */ +/* called func. : autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbext *vbh_addvbext (loop_label, cnd,line) + + char *loop_label; /* loop label name */ + vexexpr *cnd; /* condition clause */ + long line; +{ + struct vbext *ptext; + + ptext = (struct vbext *) autallocheap (sizeof(struct vbext)); + + ptext->LABEL = loop_label; + ptext->CND = cnd; + ptext->LINE = line; + + return (ptext); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbfig */ +/* description : create an empty BEFIG structure at the top of the list*/ +/* The VBH_HEDFIG list is not modified. */ +/* called func. : namealloc, autallocblock */ +/* ###--------------------------------------------------------------### */ + +struct vbfig *vbh_addvbfig (lastvbfig, name) + +struct vbfig *lastvbfig; /* pointer on the last vbfig structure */ +char *name; /* figure's name */ + +{ + struct vbfig *ptfig; + + name = namealloc (name); + + ptfig = (struct vbfig *) autallocblock (sizeof(struct vbfig)); + ptfig->NAME = name; + ptfig->HASH_TYPE = createauthtable( 50 ); + ptfig->NEXT = lastvbfig; + + vbh_prdeftyp( ptfig ); + + return (ptfig); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbifs */ +/* description : create a VBIFS structure at the top the list */ +/* called func. : addptype, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvbifs (lastptype, vex,line) + +struct ptype *lastptype; /* pointer on the last ptype structure */ +vexexpr *vex; /* condition's expression */ +long line; +{ + struct ptype *ptptype; + struct vbifs *ptvbifs; + + ptvbifs = (struct vbifs *) autallocheap (sizeof(struct vbifs)); + ptvbifs->CND = vex; + ptvbifs->LINE = line; + ptptype = addptype (lastptype, VBH_BEIFS, (void *)ptvbifs); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbfor */ +/* description : create a VBLOP structure at the top the list */ +/* called func. : addptype, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvbfor (lastptype,name,variable,left,right,up,line) + +struct ptype *lastptype; /* pointer on the last object */ +char *name; /* name of loop */ +vexexpr *variable; /* name of variable */ +vexexpr *left; /* low of for */ +vexexpr *right; /* up of for */ +unsigned char up; +long line; +{ + + struct ptype *ptptype; + struct vbfor *ptvblop; + + ptvblop = (struct vbfor *) autallocheap (sizeof(struct vbfor)); + ptvblop->LABEL = namealloc(name); + ptvblop->VARIABLE = variable; + ptvblop->LEFT = left; + ptvblop->RIGHT = right; + ptvblop->UP = up; + ptvblop->LINE = line; + + ptptype =addptype(lastptype,VBH_BEFOR,(void *)ptvblop); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvblop */ +/* description : create a VBLOP structure at the top the list */ +/* called func. : addptype, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvblop (lastptype,name,line) + +struct ptype *lastptype; /* pointer on the last object */ +char *name; /* name of loop */ +long line; +{ + + struct ptype *ptptype; + struct vblop *ptvblop; + + ptvblop = (struct vblop *) autallocheap (sizeof(struct vblop)); + ptvblop->LABEL = namealloc(name); + ptvblop->LINE = line; + + ptptype =addptype(lastptype,VBH_BELOP,(void *)ptvblop); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbwhi */ +/* description : create a VBLOP structure at the top the list */ +/* called func. : addptype, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvbwhi (lastptype,name,cnd,line) + +struct ptype *lastptype; /* pointer on the last object */ +char *name; /* name of loop */ +vexexpr *cnd; +long line; +{ + + struct ptype *ptptype; + struct vbwhi *ptvblop; + + ptvblop = (struct vbwhi *) autallocheap (sizeof(struct vbwhi)); + ptvblop->LABEL = namealloc(name); + ptvblop->CND = cnd; + ptvblop->LINE = line; + + ptptype =addptype(lastptype,VBH_BEWHI,(void *)ptvblop); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbret */ +/* description : create a VBRET (sequential return statement) */ +/* called func. : autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbret *vbh_addvbret (ret_value,line) + +vexexpr *ret_value; /* return value */ +long line; +{ + struct vbret *ptret; + + ptret = (struct vbret *) autallocheap (sizeof(struct vbret)); + + ptret->RET = ret_value; + ptret->LINE = line; + + return (ptret); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbcal */ +/* description : create a VBRET (sequential call statement) */ +/* called func. : autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbcal *vbh_addvbcal (cal_vex,line) + +vexexpr *cal_vex; /* call */ +long line; +{ + struct vbcal *ptcal; + + ptcal = (struct vbcal *) autallocheap (sizeof(struct vbcal)); + + ptcal->CALL = cal_vex; + ptcal->LINE = line; + + return (ptcal); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbnxt */ +/* description : create a VBNXT (sequential next statement) */ +/* called func. : autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbnxt *vbh_addvbnxt (loop_label, cnd,line) + + char *loop_label; /* loop label name */ +vexexpr *cnd; /* condition clause */ +long line; +{ + struct vbnxt *ptnxt; + + ptnxt = (struct vbnxt *) autallocheap (sizeof(struct vbnxt)); + + ptnxt->LABEL = loop_label; + ptnxt->CND = cnd; + ptnxt->LINE = line; + + return (ptnxt); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbpcs */ +/* description : create a VBPCS structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbpcs *vbh_addvbpcs (lastvbpcs, label, sens, inst, line ) + +struct vbpcs *lastvbpcs; /* pointer on the last vbpcs structure */ +char *label; /* process's label */ +struct chain *sens; /* sensitivity list */ +struct ptype *inst; /* list of instructions */ +long line; +{ + struct vbpcs *ptvbpcs; + + label = namealloc (label); + + ptvbpcs = (struct vbpcs *) autallocheap (sizeof(struct vbpcs)); + ptvbpcs->LABEL = label; + ptvbpcs->SENSITIVITY = sens; + ptvbpcs->INSTRUCTION = inst; + ptvbpcs->LINE = line; + + ptvbpcs->NEXT = lastvbpcs; + + return (ptvbpcs); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbfun */ +/* description : create a VBFUN structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbfun *vbh_addvbfun (lastvbfun, name, ret_param, lst_param, inst, line ) + +struct vbfun *lastvbfun; /* pointer on the last vbfun structure */ +char *name; +struct vbarg *ret_param; +struct vbarg *lst_param; +struct ptype *inst; +long line; +{ + struct vbfun *ptvbfun; + + name = namealloc(name); + + ptvbfun = (struct vbfun *) autallocheap (sizeof(struct vbfun)); + ptvbfun->NAME = name; + ptvbfun->RETURN = ret_param; + ptvbfun->ARGUMENT = lst_param; + ptvbfun->INSTRUCTION = inst; + ptvbfun->LINE = line; + + ptvbfun->NEXT = lastvbfun; + + return(ptvbfun); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbarg */ +/* description : create a VBPAR structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbarg *vbh_addvbarg (lastvbarg, target, dir, class, type,line) + +struct vbarg *lastvbarg; /* pointer on the last vbarg structure */ +vexexpr *target; /* signal's name */ +char dir; /* signal's mode (I, O, B, Z, or T) */ +char class; /* signal's class (C, V, S) */ +vbtyp_list *type; /* signal's type */ +long line; +{ + struct vbarg *ptvbarg; + + ptvbarg = (struct vbarg *) autallocheap (sizeof(struct vbarg)); + ptvbarg->TARGET = target; + ptvbarg->DIR = dir; + ptvbarg->CLASS = class; + ptvbarg->TYPE = type; + ptvbarg->LINE = line; + ptvbarg->NEXT = lastvbarg; + + return (ptvbarg); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbpor */ +/* description : create a VBPOR structure at the top the list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbpor *vbh_addvbpor (lastvbpor, target, vex, dir, kind, type,line) + +struct vbpor *lastvbpor; /* pointer on the last vbpor structure */ +vexexpr *target; /* signal's name */ +vexexpr *vex; /* signal's init */ +unsigned char dir; /* signal's dir (I, O, B, Z, or T) */ +unsigned char kind; /* signal's kind BUS */ +vbtyp_list *type; /* signal's type */ +long line; + +{ + struct vbpor *ptvbpor; + + ptvbpor = (struct vbpor *) autallocheap (sizeof(struct vbpor)); + ptvbpor->TARGET = target; + ptvbpor->VEX = vex; + ptvbpor->DIR = dir; + ptvbpor->KIND = kind; + ptvbpor->TYPE = type; + ptvbpor->LINE = line; + ptvbpor->NEXT = lastvbpor; + + return (ptvbpor); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbtyp */ +/* description : add an BETYP structure at the top of a list */ +/* called func. : namealloc, autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbtyp *vbh_addvbtyp ( Figure, name , left , right , value , + size , byte , base , typeid, resolv, class,line) + +vbfig_list *Figure; +char *name; /* type's name */ +long left; /* left bound */ +long right; /* right bound */ +char **value; /* list of values */ +unsigned int size; /* number of values */ +unsigned int byte; /* number of bytes needed to code values*/ +vbtyp_list *base; /* the base type or element's type */ +unsigned char typeid; /* the type of the index for an array */ +vbfun_list *resolv; /* index of resolution function */ +char class; /* type's class (E, I, A, S) */ +long line; +{ + struct vbtyp *ptvbtyp; + + name = namealloc (name); + + ptvbtyp = (struct vbtyp *) autallocheap (sizeof(struct vbtyp)); + + ptvbtyp->CLASS = class; + ptvbtyp->NAME = name; + ptvbtyp->LEFT = left; + ptvbtyp->RIGHT = right; + ptvbtyp->VALUE = value; + ptvbtyp->SIZE = size; + ptvbtyp->BYTE = byte; + ptvbtyp->BASE = base; + ptvbtyp->INDEX = typeid; + ptvbtyp->RESOLV = resolv; + + ptvbtyp->NEXT = Figure->BETYP;; + ptvbtyp->LINE = line; + Figure->BETYP = ptvbtyp; + + addauthelem( Figure->HASH_TYPE, name, (long)ptvbtyp ); + + return (ptvbtyp); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbvar */ +/* description : create a VBVAR structure at the top the list */ +/* called func. : addptype, autallocheap, namealloc */ +/* ###--------------------------------------------------------------### */ + +struct ptype *vbh_addvbvar (lastptype, target, vex, type,line) + +struct ptype *lastptype; /* pointer on the last ptype structure */ +vexexpr *target; /* signal's name */ +vexexpr *vex; /* condition's expression */ +vbtyp_list *type; /* signal's type (cannot be 0) */ +long line; +{ + struct ptype *ptptype; + struct vbvar *ptvbvar; + + ptvbvar = (struct vbvar *) autallocheap (sizeof(struct vbvar)); + ptvbvar->TARGET = target; + ptvbvar->VEX = vex; + ptvbvar->TYPE = type; + ptvbvar->LINE = line; + + ptptype = addptype (lastptype, VBH_BEVAR, (void *)ptvbvar); + + return (ptptype); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_addvbwas */ +/* description : create a VBWAS (sequential wait statement) */ +/* called func. : autallocheap */ +/* ###--------------------------------------------------------------### */ + +struct vbwas *vbh_addvbwas (sen, cnd,timeunit, timeout,line) + +struct chain *sen; /* senisitvity list */ +vexexpr *cnd; /* condition clause */ +unsigned char timeunit; /* timeout clause */ +vexexpr *timeout; /* timeout clause */ +long line; +{ + struct vbwas *ptwas; + + ptwas = (struct vbwas *) autallocheap (sizeof(struct vbwas)); + ptwas->SEN = sen; + ptwas->CND = cnd; + ptwas->TIME_UNIT = timeunit; + ptwas->TIMEOUT = timeout; + ptwas->LINE = line; + + return (ptwas); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_prdeftyp */ +/* description : create BETYPs for predefined types */ +/* called func. : vbh_addvbtyp, namealloc */ +/* ###--------------------------------------------------------------### */ + +struct vbtyp *vbh_prdeftyp( VbFigure ) + + vbfig_list *VbFigure; +{ + static char *bit_vl[2]; + static char *boolean_vl[2]; + static char *severity_vl[2]; + static char *std_ulogic_vl[9]; + + struct vbtyp *TypeBit; + struct vbtyp *TypeReg; + struct vbtyp *TypeMux; + struct vbtyp *TypeWor; + struct vbtyp *TypeInt; + struct vbtyp *TypeStd_logic; + struct vbtyp *TypeStd_ulogic; + struct vbtyp *TypeCharacter; + + boolean_vl[0] = namealloc ("false"); + boolean_vl[1] = namealloc ("true"); + + bit_vl[0] = namealloc ("'0'"); + bit_vl[1] = namealloc ("'1'"); + + severity_vl[0] = namealloc ("warning"); + severity_vl[1] = namealloc ("error"); + + std_ulogic_vl[ 0 ] = namealloc("'u'"); + std_ulogic_vl[ 1 ] = namealloc("'x'"); + std_ulogic_vl[ 2 ] = namealloc("'0'"); + std_ulogic_vl[ 3 ] = namealloc("'1'"); + std_ulogic_vl[ 4 ] = namealloc("'z'"); + std_ulogic_vl[ 5 ] = namealloc("'w'"); + std_ulogic_vl[ 6 ] = namealloc("'l'"); + std_ulogic_vl[ 7 ] = namealloc("'h'"); + std_ulogic_vl[ 8 ] = namealloc("'-'"); + + /* ###------------------------------------------------------### */ + /* Enumeration types */ + /* ###------------------------------------------------------### */ + + vbh_addvbtyp( VbFigure,"severity_level",0,1,severity_vl, + 2,1,NULL,VBH_TYPE_SEVERITY,NULL,'E',-1); + vbh_addvbtyp( VbFigure,"boolean" ,0,1,boolean_vl, + 2,1,NULL,VBH_TYPE_BOOLEAN,NULL,'E',-1); + + TypeBit = vbh_addvbtyp( VbFigure,"bit" ,0,1,bit_vl, + 2,1,NULL,VBH_TYPE_BIT,NULL,'E',-1); + + TypeCharacter = vbh_addvbtyp( VbFigure,"character" ,0,127,NULL, + 0,1,NULL,VBH_TYPE_CHARACTER,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"string",0,0x7fffffff, NULL, + 0,1,TypeCharacter,VBH_TYPE_STRING,NULL,'U',-1); + + /* ###------------------------------------------------------### */ + /* Integer types */ + /* ###------------------------------------------------------### */ + + TypeInt = vbh_addvbtyp(VbFigure,"integer",0x80000000,0x7fffffff,NULL, + 0,32,NULL,VBH_TYPE_INTEGER,NULL,'I',-1); + + /* ###------------------------------------------------------### */ + /* Subtypes */ + /* ###------------------------------------------------------### */ + + vbh_addvbtyp( VbFigure,"natural",0,0x7fffffff,NULL, + 0,31,TypeInt,VBH_TYPE_NATURAL,NULL,'I',-1); + + /* ###------------------------------------------------------### */ + /* Unconstraint array types */ + /* ###------------------------------------------------------### */ + + vbh_addvbtyp( VbFigure,"bit_vector",0,0x7fffffff, NULL, + 0,1,TypeBit,VBH_TYPE_BIT_VECTOR,NULL,'U',-1); + + /* ###------------------------------------------------------### */ + /* stdlogic_1164 package types */ + /* ###------------------------------------------------------### */ + + TypeStd_ulogic = vbh_addvbtyp( VbFigure, "std_ulogic" ,0,8,std_ulogic_vl, + 9,1,NULL,VBH_TYPE_STD_ULOGIC,NULL,'E',-1); + + TypeStd_logic = vbh_addvbtyp( VbFigure,"std_logic",0,1,NULL, + 0,1,TypeStd_ulogic,VBH_TYPE_STD_LOGIC,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"std_ulogic_vector",0,0x7fffffff, NULL, + 0,1,TypeStd_ulogic,VBH_TYPE_STD_ULOGIC_VECTOR,NULL,'U',-1); + + vbh_addvbtyp( VbFigure,"std_logic_vector",0,0x7fffffff, NULL, + 0,1,TypeStd_logic,VBH_TYPE_STD_LOGIC_VECTOR,NULL,'U',-1); + + vbh_addvbtyp( VbFigure,"x01",1,3,NULL, + 0,1,TypeStd_logic,VBH_TYPE_X01,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"x01z",1,4,NULL, + 0,1,TypeStd_logic,VBH_TYPE_X01Z,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"ux01",0,3,NULL, + 0,1,TypeStd_logic,VBH_TYPE_UX01,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"ux01z",0,4,NULL, + 0,1,TypeStd_logic,VBH_TYPE_UX01Z,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"unsigned",0,0x7fffffff, NULL, + 0,1,TypeStd_logic,VBH_TYPE_UNSIGNED,NULL,'U',-1); + + vbh_addvbtyp( VbFigure,"signed",0,0x7fffffff, NULL, + 0,1,TypeStd_logic,VBH_TYPE_SIGNED,NULL,'U',-1); + + vbh_addvbtyp( VbFigure,"small_int",0,1, NULL, + 0,1,TypeInt,VBH_TYPE_SMALL_INT,NULL,'I',-1); + + TypeReg = vbh_addvbtyp( VbFigure,"reg_bit" ,0,1,bit_vl, + 2,1,NULL,VBH_TYPE_REG_BIT,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"reg_vector",0,0x7fffffff, NULL, + 0,1,TypeReg,VBH_TYPE_REG_VECTOR,NULL,'U',-1); + + TypeMux = vbh_addvbtyp( VbFigure,"mux_bit" ,0,1,bit_vl, + 2,1,NULL,VBH_TYPE_MUX_BIT,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"mux_vector",0,0x7fffffff, NULL, + 0,1,TypeMux,VBH_TYPE_MUX_VECTOR,NULL,'U',-1); + + TypeWor = vbh_addvbtyp( VbFigure,"wor_bit" ,0,1,bit_vl, + 2,1,NULL,VBH_TYPE_WOR_BIT,NULL,'E',-1); + + vbh_addvbtyp( VbFigure,"wor_vector",0,0x7fffffff, NULL, + 0,1,TypeMux,VBH_TYPE_WOR_VECTOR,NULL,'U',-1); + + return ( VbFigure->BETYP ); +} + +vbtyp_list *vbh_getvbtyp( VbFigure, Name ) + + vbfig_list *VbFigure; + char *Name; +{ + authelem *Element; + + if ( Name == (char *)0 ) + { + return( (vbtyp_list *)0 ); + } + + Name = namealloc( Name ); + Element = searchauthelem( VbFigure->HASH_TYPE, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vbtyp_list *)Element->VALUE ); + } + + return( (vbtyp_list *)0 ); +} + +vbtyp_list *vbh_getvbtypbyindex( VbFigure, Index ) + + vbfig_list *VbFigure; + int Index; +{ + vbtyp_list *VbType; + + for ( VbType = VbFigure->BETYP; + VbType != (vbtyp_list *)0; + VbType = VbType->NEXT ) + { + if ( VbType->INDEX == Index ) return( VbType ); + } + + return( (vbtyp_list *)0 ); +} diff --git a/alliance/src/vbh/src/vbh_crt.c b/alliance/src/vbh/src/vbh_crt.c new file mode 100644 index 00000000..89a7c62d --- /dev/null +++ b/alliance/src/vbh/src/vbh_crt.c @@ -0,0 +1,93 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : vbh_crtvbrin.c */ +/* date : Aug 24 1992 */ +/* version : v102 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : contains a specific function used to create a */ +/* behaviour data structure */ +/* */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "aut.h" +#include "vex.h" +#include "vbh.h" + +/* ###--------------------------------------------------------------### */ +/* function : vbh_crtvbtyp */ +/* description : create an array of BETYPs from a list of BETYPs */ +/* called func. : namealloc, autallocblock */ +/* ###--------------------------------------------------------------### */ + +struct vbtyp *vbh_crtvbtyp (listvbtyp) + +struct vbtyp *listvbtyp; /* pointer on the list of vbtyps */ + +{ + struct vbtyp *lclvbtyp = listvbtyp; + struct vbtyp *ptvbtyp = NULL; + int size = 0; + + while (lclvbtyp != NULL) + { + lclvbtyp = lclvbtyp->NEXT; + size++; + } + + if (size != 0) + { + ptvbtyp = (struct vbtyp *) autallocblock (size * sizeof(struct vbtyp)); + lclvbtyp = ptvbtyp; + + while (listvbtyp != NULL) + { + lclvbtyp->NAME = listvbtyp->NAME; + lclvbtyp->LEFT = listvbtyp->LEFT; + lclvbtyp->RIGHT = listvbtyp->RIGHT; + lclvbtyp->VALUE = listvbtyp->VALUE; + lclvbtyp->SIZE = listvbtyp->SIZE; + lclvbtyp->BYTE = listvbtyp->BYTE; + lclvbtyp->BASE = listvbtyp->BASE; + lclvbtyp->INDEX = listvbtyp->INDEX; + lclvbtyp->RESOLV = listvbtyp->RESOLV; + lclvbtyp->CLASS = listvbtyp->CLASS; + + lclvbtyp->NEXT = lclvbtyp + 1; + + listvbtyp = listvbtyp->NEXT; + lclvbtyp++; + } + + (lclvbtyp - 1)->NEXT = NULL; + } + + return (ptvbtyp); +} diff --git a/alliance/src/vbh/src/vbh_dup.c b/alliance/src/vbh/src/vbh_dup.c new file mode 100644 index 00000000..29904d97 --- /dev/null +++ b/alliance/src/vbh/src/vbh_dup.c @@ -0,0 +1,905 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ + +#include "mut.h" +#include "aut.h" +#include "vex.h" +#include "vbh.h" + +/*------------------------------------------------------------\ +| | +| Local Variables | +| | +\------------------------------------------------------------*/ + + static vbfig_list *LocalDupFigure = (vbfig_list *)0; + static authtable *LocalHashTable = (authtable *)0; + + static ptype_list *loc_dupvbinst(); + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Port | +| | +\------------------------------------------------------------*/ + +static vbpor_list *loc_dupvbpor( DupPor, BePor ) + + vbpor_list *DupPor; + vbpor_list *BePor; +{ + vbtyp_list *DupType; + + DupType = vbh_getvbtyp( LocalDupFigure, BePor->TYPE->NAME ); + DupPor = vbh_addvbpor( DupPor, dupvexexpr( BePor->TARGET ), + dupvexexpr( BePor->VEX ), BePor->DIR, BePor->KIND, DupType, BePor->LINE ); + + return( DupPor ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Generic | +| | +\------------------------------------------------------------*/ + +static vbgen_list *loc_dupvbgen( DupGen, BeGen ) + + vbgen_list *DupGen; + vbgen_list *BeGen; +{ + vbtyp_list *DupType; + + DupType = vbh_getvbtyp( LocalDupFigure, BeGen->TYPE->NAME ); + DupGen = vbh_addvbgen( DupGen, dupvexexpr( BeGen->TARGET ), + dupvexexpr( BeGen->VEX ), DupType, BeGen->LINE ); + + return( DupGen ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Ifs | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbifs( PType, ScanIfs ) + + ptype_list *PType; + vbifs_list *ScanIfs; +{ + vbifs_list *DupIfs; + + PType = vbh_addvbifs( PType, dupvexexpr( ScanIfs->CND ), ScanIfs->LINE ); + DupIfs = (vbifs_list *)PType->DATA; + + DupIfs->CNDTRUE = loc_dupvbinst( ScanIfs->CNDTRUE ); + DupIfs->CNDFALSE = loc_dupvbinst( ScanIfs->CNDFALSE ); + + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Var | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbvar( PType, ScanVar ) + + ptype_list *PType; + vbvar_list *ScanVar; +{ + vbtyp_list *DupType; + + DupType = vbh_getvbtyp( LocalDupFigure, ScanVar->TYPE->NAME ); + PType = vbh_addvbvar( PType, dupvexexpr( ScanVar->TARGET ), + dupvexexpr( ScanVar->VEX ), DupType, ScanVar->LINE ); + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Asg | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbasg( PType, ScanAsg ) + + ptype_list *PType; + vbasg_list *ScanAsg; +{ + vbtyp_list *DupType; + + DupType = vbh_getvbtyp( LocalDupFigure, ScanAsg->TYPE->NAME ); + PType = vbh_addvbasg( PType, dupvexexpr( ScanAsg->TARGET ), + dupvexexpr( ScanAsg->VEX ), DupType, ScanAsg->LINE ); + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Case | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbcas( PType, ScanCase ) + + ptype_list *PType; + vbcas_list *ScanCase; +{ + vbtyp_list *DupType; + vbcas_list *DupCase; + vbcho_list *DupChoice; + vbcho_list *ScanChoice; + chain_list *ScanChain; + int Offset; + + DupType = vbh_getvbtyp( LocalDupFigure, ScanCase->TYPE->NAME ); + PType = vbh_addvbcas( PType, dupvexexpr( ScanCase->VEX ), DupType, ScanCase->LINE ); + + + DupCase = (vbcas_list *)PType->DATA; + DupChoice = (vbcho_list *)autallocblock( sizeof( vbcho_list ) * ScanCase->SIZE ); + + DupCase->SIZE = ScanCase->SIZE; + DupCase->CHOICE = DupChoice; + + for ( Offset = 0; Offset < ScanCase->SIZE; Offset++ ) + { + ScanChoice = &ScanCase->CHOICE[ Offset ]; + DupChoice = &DupCase->CHOICE[ Offset ]; + + DupChoice->VALUES = (chain_list *)0; + + for ( ScanChain = ScanChoice->VALUES; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + DupChoice->VALUES = addchain( DupChoice->VALUES, ScanChain->DATA ); + } + + DupChoice->SIZE = ScanChoice->SIZE; + DupChoice->INSTRUCTION = loc_dupvbinst( ScanChoice->INSTRUCTION ); + DupChoice->LINE = ScanChoice->LINE; + } + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Wait | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbwas( PType, ScanWait ) + + ptype_list *PType; + vbwas_list *ScanWait; +{ + vbwas_list *DupWait; + chain_list *ScanSens; + chain_list *DupSens; + + DupSens = (chain_list *)0; + + for ( ScanSens = ScanWait->SEN; + ScanSens != (chain_list *)0; + ScanSens = ScanSens->NEXT ) + { + DupSens = addchain( DupSens, ScanSens->DATA ); + } + + DupWait = vbh_addvbwas( DupSens, dupvexexpr( ScanWait->CND ), + ScanWait->TIME_UNIT, dupvexexpr( ScanWait->TIMEOUT ), ScanWait->LINE ); + + PType = addptype( PType, VBH_BEWAS, (void *)DupWait ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh For | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbfor( PType, ScanFor ) + + ptype_list *PType; + vbfor_list *ScanFor; +{ + vbfor_list *DupFor; + + PType = vbh_addvbfor( PType, ScanFor->LABEL, + dupvexexpr( ScanFor->VARIABLE ), + dupvexexpr( ScanFor->LEFT ), + dupvexexpr( ScanFor->RIGHT ), ScanFor->UP, ScanFor->LINE ); + + DupFor = (vbfor_list *)PType->DATA; + DupFor->INSTRUCTION = loc_dupvbinst( ScanFor->INSTRUCTION ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Loop | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvblop( PType, ScanLoop ) + + ptype_list *PType; + vblop_list *ScanLoop; +{ + vblop_list *DupLoop; + + PType = vbh_addvblop( PType, ScanLoop->LABEL, ScanLoop->LINE ); + + DupLoop = (vblop_list *)PType->DATA; + DupLoop->INSTRUCTION = loc_dupvbinst( ScanLoop->INSTRUCTION ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh While | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbwhi( PType, ScanWhile ) + + ptype_list *PType; + vbwhi_list *ScanWhile; +{ + vbwhi_list *DupWhile; + + PType = vbh_addvbwhi( PType, + ScanWhile->LABEL, dupvexexpr( ScanWhile->CND ), ScanWhile->LINE ); + + DupWhile = (vbwhi_list *)PType->DATA; + DupWhile->INSTRUCTION = loc_dupvbinst( ScanWhile->INSTRUCTION ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Aggregate | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbagr( PType, ScanAggreg ) + + ptype_list *PType; + vbagr_list *ScanAggreg; +{ + PType = vbh_addvbagr( PType, loc_dupvbinst( ScanAggreg->ASSIGN, ScanAggreg->LINE ) ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Exit | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbext( PType, ScanExit ) + + ptype_list *PType; + vbext_list *ScanExit; +{ + PType = addptype( PType, VBH_BEEXT, + vbh_addvbext( ScanExit->LABEL, dupvexexpr( ScanExit->CND ), ScanExit->LINE ) ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Next | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbnxt( PType, ScanNext ) + + ptype_list *PType; + vbnxt_list *ScanNext; +{ + + PType = addptype( PType, VBH_BENXT, + vbh_addvbnxt( ScanNext->LABEL, dupvexexpr( ScanNext->CND ), ScanNext->LINE ) ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Return | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbret( PType, ScanReturn ) + + ptype_list *PType; + vbret_list *ScanReturn; +{ + PType = addptype( PType, VBH_BERET, + vbh_addvbret( dupvexexpr( ScanReturn->RET ), ScanReturn->LINE ) ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Call | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbcal( PType, ScanCall ) + + ptype_list *PType; + vbcal_list *ScanCall; +{ + PType = addptype( PType, VBH_BECAL, + vbh_addvbcal( dupvexexpr( ScanCall->CALL ), ScanCall->LINE ) ); + + return( PType ); +} + +/*------------------------------------------------------------\ +| | +| Local Dup Vbh Instruction | +| | +\------------------------------------------------------------*/ + +static ptype_list *loc_dupvbinst( Instruction ) + + ptype_list *Instruction; +{ + ptype_list *DupInstruction; + + DupInstruction = (ptype_list *)0; + + while ( Instruction != (ptype_list *)0 ) + { + switch ( Instruction->TYPE ) + { + case VBH_BEIFS : DupInstruction = loc_dupvbifs( DupInstruction, Instruction->DATA ); + break; + + case VBH_BEASG : DupInstruction = loc_dupvbasg( DupInstruction, Instruction->DATA ); + break; + + case VBH_BEVAR : DupInstruction = loc_dupvbvar( DupInstruction, Instruction->DATA ); + break; + + case VBH_BECAS : DupInstruction = loc_dupvbcas( DupInstruction, Instruction->DATA ); + break; + + case VBH_BEWAS : DupInstruction = loc_dupvbwas( DupInstruction, Instruction->DATA ); + break; + + case VBH_BEFOR : DupInstruction = loc_dupvbfor( DupInstruction, Instruction->DATA ); + break; + + case VBH_BEWHI : DupInstruction = loc_dupvbwhi( DupInstruction, Instruction->DATA ); + break; + + case VBH_BELOP : DupInstruction = loc_dupvblop( DupInstruction, Instruction->DATA ); + break; + + case VBH_BENXT : DupInstruction = loc_dupvbnxt( DupInstruction, Instruction->DATA ); + break; + + case VBH_BEEXT : DupInstruction = loc_dupvbext( DupInstruction, Instruction->DATA ); + break; + + case VBH_BERET : DupInstruction = loc_dupvbret( DupInstruction, Instruction->DATA ); + break; + + case VBH_BECAL : DupInstruction = loc_dupvbcal( DupInstruction, Instruction->DATA ); + break; + + case VBH_BEAGR : DupInstruction = loc_dupvbagr( DupInstruction, Instruction->DATA ); + break; + } + + Instruction = Instruction->NEXT; + } + + DupInstruction = (ptype_list *)reverse( (chain_list *)DupInstruction ); + + return ( DupInstruction ); +} + +/*------------------------------------------------------------\ +| | +| Dup Vbh Type | +| | +\------------------------------------------------------------*/ + +static void loc_dupvbtyp( Figure, DupFigure ) + + vbfig_list *Figure; + vbfig_list *DupFigure; +{ + vbtyp_list *BeTyp; + vbtyp_list *DupTyp; + vbtyp_list *DupTypeBase; + int DupTypeIndex; + + DupTypeIndex = 0; + + for ( DupTyp = DupFigure->BETYP; + DupTyp != (vbtyp_list *)0; + DupTyp = DupTyp->NEXT ) + { + DupTypeIndex++; + } + + for ( BeTyp = Figure->BETYP; + BeTyp != (vbtyp_list *)0; + BeTyp = BeTyp->NEXT ) + { + if ( BeTyp->INDEX < VBH_MAX_TYPE ) continue; + + DupTyp = vbh_getvbtyp( DupFigure, BeTyp->NAME ); + + if ( DupTyp != (vbtyp_list *)0 ) continue; + + if ( BeTyp->BASE != (vbtyp_list *)0 ) + { + DupTypeBase = vbh_getvbtyp( DupFigure, BeTyp->BASE->NAME ); + } + else + { + DupTypeBase = (vbtyp_list *)0; + } + + DupTyp = vbh_addvbtyp( LocalDupFigure, + BeTyp->NAME, BeTyp->LEFT, BeTyp->RIGHT, BeTyp->VALUE, BeTyp->SIZE, + BeTyp->BYTE, + DupTypeBase, DupTypeIndex, (vbfun_list *)0, BeTyp->CLASS, BeTyp->LINE ); + + DupTyp->DYNAMIC = BeTyp->DYNAMIC; + DupTyp->DYNAMIC_LEFT = dupvexexpr( BeTyp->DYNAMIC_LEFT ); + DupTyp->DYNAMIC_RIGHT = dupvexexpr( BeTyp->DYNAMIC_RIGHT ); + + DupTypeIndex++; + } +} + +/*------------------------------------------------------------\ +| | +| Dup Vbh Map | +| | +\------------------------------------------------------------*/ + +static vbmap_list *loc_dupvbmap( DupMap, BeMap ) + + vbmap_list *DupMap; + vbmap_list *BeMap; +{ + DupMap = vbh_addvbmap( DupMap, + dupvexexpr( BeMap->FORMAL ), dupvexexpr( BeMap->ACTUAL ), BeMap->LINE ); + + return( DupMap ); +} + + +/*------------------------------------------------------------\ +| | +| Dup Vbh Instance | +| | +\------------------------------------------------------------*/ + +static vbins_list *loc_dupvbins( DupIns, BeIns ) + + vbins_list *DupIns; + vbins_list *BeIns; +{ + vbmap_list *BeMap; + + DupIns = vbh_addvbins( DupIns, BeIns->NAME, BeIns->MODEL, BeIns->LINE ); + + for ( BeMap = BeIns->PORT_MAP; + BeMap != (vbmap_list *)0; + BeMap = BeMap->NEXT ) + { + DupIns->PORT_MAP = loc_dupvbmap( DupIns->PORT_MAP, BeMap ); + } + + for ( BeMap = BeIns->GEN_MAP; + BeMap != (vbmap_list *)0; + BeMap = BeMap->NEXT ) + { + DupIns->GEN_MAP = loc_dupvbmap( DupIns->GEN_MAP, BeMap ); + } + + return( DupIns ); +} + +/*------------------------------------------------------------\ +| | +| Dup Vbh Aux | +| | +\------------------------------------------------------------*/ + +static vbaux_list *loc_dupvbaux( DupAux, BeAux ) + + vbaux_list *DupAux; + vbaux_list *BeAux; +{ + vbtyp_list *DupType; + + DupType = vbh_getvbtyp( LocalDupFigure, BeAux->TYPE->NAME ); + + DupAux = vbh_addvbaux( DupAux, dupvexexpr( BeAux->TARGET ), dupvexexpr( BeAux->VEX ), + BeAux->KIND, DupType, BeAux->LINE ); + + return( DupAux ); +} + +/*------------------------------------------------------------\ +| | +| Dup Vbh Arg | +| | +\------------------------------------------------------------*/ + +static vbarg_list *loc_dupvbarg( DupArg, BeArg ) + + vbarg_list *DupArg; + vbarg_list *BeArg; +{ + vbtyp_list *DupType; + + DupType = vbh_getvbtyp( LocalDupFigure, BeArg->TYPE->NAME ); + DupArg = vbh_addvbarg( DupArg, dupvexexpr( BeArg->TARGET ), + BeArg->DIR, BeArg->CLASS, DupType, BeArg->LINE ); + return( DupArg ); +} + +/*------------------------------------------------------------\ +| | +| Dup Vbh Fun | +| | +\------------------------------------------------------------*/ + +static vbfun_list *loc_dupvbfun( DupFun, BeFun ) + + vbfun_list *DupFun; + vbfun_list *BeFun; +{ + vbarg_list *BeArg; + + DupFun = vbh_addvbfun( DupFun, BeFun->NAME, + (vbarg_list *)0, (vbarg_list *)0, (ptype_list *)0, BeFun->LINE ); + + DupFun->TYPE = BeFun->TYPE; + + for ( BeArg = BeFun->ARGUMENT; + BeArg != (vbarg_list *)0; + BeArg = BeArg->NEXT ) + { + DupFun->ARGUMENT = loc_dupvbarg( DupFun->ARGUMENT, BeArg ); + } + + DupFun->ARGUMENT = (vbarg_list *)reverse( (chain_list *)DupFun->ARGUMENT ); + + if ( BeFun->RETURN != (vbarg_list *)0 ) + { + DupFun->RETURN = loc_dupvbarg( (vbarg_list *)0, BeFun->RETURN ); + } + + DupFun->VARIABLE = loc_dupvbinst( BeFun->VARIABLE ); + DupFun->INSTRUCTION = loc_dupvbinst( BeFun->INSTRUCTION ); + + return( DupFun ); +} + +/*------------------------------------------------------------\ +| | +| Dup Vbh Pcs | +| | +\------------------------------------------------------------*/ + +static vbpcs_list *loc_dupvbpcs( DupPcs, BePcs ) + + vbpcs_list *DupPcs; + vbpcs_list *BePcs; +{ + chain_list *ScanSens; + chain_list *DupSens; + + DupPcs = vbh_addvbpcs( DupPcs, BePcs->LABEL, (chain_list *)0, (ptype_list *)0, BePcs->LINE ); + + DupSens = (chain_list *)0; + + for ( ScanSens = BePcs->SENSITIVITY; + ScanSens != (chain_list *)0; + ScanSens = ScanSens->NEXT ) + { + DupSens = addchain( DupSens, ScanSens->DATA ); + } + + DupPcs->SENSITIVITY = DupSens; + DupPcs->TYPE = BePcs->TYPE; + DupPcs->VARIABLE = loc_dupvbinst( BePcs->VARIABLE ); + DupPcs->INSTRUCTION = loc_dupvbinst( BePcs->INSTRUCTION ); + + return( DupPcs ); +} + +/*------------------------------------------------------------\ +| | +| Dup Vbh Gnr | +| | +\------------------------------------------------------------*/ + +static vbgnr_list *loc_dupvbgnr( DupGnr, BeGnr ) + + vbgnr_list *DupGnr; + vbgnr_list *BeGnr; +{ + vbins_list *BeIns; + vbpcs_list *BePcs; + + DupGnr = vbh_addvbgnr( DupGnr, BeGnr->LABEL, BeGnr->LINE ); + + DupGnr->TYPE = BeGnr->TYPE; + DupGnr->FOR_UP = BeGnr->FOR_UP; + DupGnr->IF_COND = dupvexexpr( BeGnr->IF_COND ); + DupGnr->FOR_VARIABLE = dupvexexpr( BeGnr->FOR_VARIABLE ); + DupGnr->FOR_LEFT = dupvexexpr( BeGnr->FOR_LEFT ); + DupGnr->FOR_RIGHT = dupvexexpr( BeGnr->FOR_RIGHT ); + + for ( BeIns = BeGnr->BEINS; + BeIns != (vbins_list *)0; + BeIns = BeIns->NEXT ) + { + DupGnr->BEINS = loc_dupvbins( DupGnr->BEINS, BeIns ); + } + + for ( BePcs = BeGnr->BEPCS; + BePcs != (vbpcs_list *)0; + BePcs = BePcs->NEXT ) + { + DupGnr->BEPCS = loc_dupvbpcs( DupGnr->BEPCS, BePcs ); + } + + for ( BeGnr = BeGnr->BEGNR; + BeGnr != (vbgnr_list *)0; + BeGnr = BeGnr->NEXT ) + { + DupGnr->BEGNR = loc_dupvbgnr( DupGnr->BEGNR, BeGnr ); + } + + return( DupGnr ); +} + +/*------------------------------------------------------------\ +| | +| vbh_dupvbfig | +| | +\------------------------------------------------------------*/ + +void vbh_dupvbfig( DupFigure, Figure ) + + vbfig_list *DupFigure; + vbfig_list *Figure; +{ + vbgnr_list *BeGnr; + vbgen_list *BeGen; + vbins_list *BeIns; + vbmod_list *BeMod; + vbmod_list *DupMod; + vbaux_list *BeAux; + vbaux_list *DupAux; + vbatr_list *BeAtr; + vbatr_list *DupAtr; + vbcst_list *BeCst; + vbcst_list *DupCst; + vbpor_list *BePor; + vbpcs_list *BePcs; + vbfun_list *BeFun; + vbtyp_list *DupType; + chain_list *PackList; + authelem *Element; + + LocalDupFigure = DupFigure; + + if ( LocalHashTable == (authtable *)0 ) + { + LocalHashTable = createauthtable( 100 ); + } + + for ( PackList = Figure->PACK_LIST; + PackList != (chain_list *)0; + PackList = PackList->NEXT ) + { + DupFigure->PACK_LIST = addchain( DupFigure->PACK_LIST, PackList->DATA ); + } + + loc_dupvbtyp( Figure, DupFigure ); + + for ( BePor = Figure->BEPOR; + BePor != (vbpor_list *)0; + BePor = BePor->NEXT ) + { + DupFigure->BEPOR = loc_dupvbpor( DupFigure->BEPOR, BePor ); + } + + for ( BeGen = Figure->BEGEN; + BeGen != (vbgen_list *)0; + BeGen = BeGen->NEXT ) + { + DupFigure->BEGEN = loc_dupvbgen( DupFigure->BEGEN, BeGen ); + } + + for ( DupMod = DupFigure->BEMOD; + DupMod != (vbmod_list *)0; + DupMod = DupMod->NEXT ) + { + addauthelem( LocalHashTable, DupMod->NAME, 0 ); + } + + for ( BeMod = Figure->BEMOD; + BeMod != (vbmod_list *)0; + BeMod = BeMod->NEXT ) + { + Element = searchauthelem( LocalHashTable, BeMod->NAME ); + + if ( Element != (authelem *)0 ) continue; + + DupFigure->BEMOD = vbh_addvbmod( DupFigure->BEMOD, BeMod->NAME, BeMod->LINE ); + DupMod = DupFigure->BEMOD; + + for ( BePor = BeMod->BEPOR; + BePor != (vbpor_list *)0; + BePor = BePor->NEXT ) + { + DupMod->BEPOR = loc_dupvbpor( DupMod->BEPOR, BePor ); + } + + for ( BeGen = BeMod->BEGEN; + BeGen != (vbgen_list *)0; + BeGen = BeGen->NEXT ) + { + DupMod->BEGEN = loc_dupvbgen( DupMod->BEGEN, BeGen ); + } + } + + for ( DupAtr = DupFigure->BEATR; + DupAtr != (vbatr_list *)0; + DupAtr = DupAtr->NEXT ) + { + addauthelem( LocalHashTable, DupAtr->NAME, 0 ); + } + + for ( BeAtr = Figure->BEATR; + BeAtr != (vbatr_list *)0; + BeAtr = BeAtr->NEXT ) + { + Element = searchauthelem( LocalHashTable, BeAtr->NAME ); + + if ( Element != (authelem *)0 ) continue; + + DupFigure->BEATR = vbh_addvbatr( DupFigure->BEATR, BeAtr->NAME, BeAtr->ENTITY, + BeAtr->TYPE, BeAtr->VALUE, BeAtr->LINE ); + } + + for ( DupCst = DupFigure->BECST; + DupCst != (vbcst_list *)0; + DupCst = DupCst->NEXT ) + { + addauthelem( LocalHashTable, getvexatomname( DupCst->TARGET ), 0 ); + } + + for ( BeCst = Figure->BECST; + BeCst != (vbcst_list *)0; + BeCst = BeCst->NEXT ) + { + Element = searchauthelem( LocalHashTable, getvexatomname( BeCst->TARGET ) ); + + if ( Element != (authelem *)0 ) continue; + + DupType = vbh_getvbtyp( DupFigure, BeCst->TYPE->NAME ); + + DupFigure->BECST = vbh_addvbcst( DupFigure->BECST, dupvexexpr( BeCst->TARGET ), + dupvexexpr( BeCst->VEX ), DupType, BeCst->LINE ); + } + + for ( DupAux = DupFigure->BEAUX; + DupAux != (vbaux_list *)0; + DupAux = DupAux->NEXT ) + { + addauthelem( LocalHashTable, getvexatomname( DupAux->TARGET ), 0 ); + } + + for ( BeAux = Figure->BEAUX; + BeAux != (vbaux_list *)0; + BeAux = BeAux->NEXT ) + { + Element = searchauthelem( LocalHashTable, getvexatomname( BeAux->TARGET ) ); + + if ( Element != (authelem *)0 ) continue; + + DupFigure->BEAUX = loc_dupvbaux( DupFigure->BEAUX, BeAux ); + } + + for ( BeFun = Figure->BEFUN; + BeFun != (vbfun_list *)0; + BeFun = BeFun->NEXT ) + { + DupFigure->BEFUN = loc_dupvbfun( DupFigure->BEFUN, BeFun ); + } + + for ( BeIns = Figure->BEINS; + BeIns != (vbins_list *)0; + BeIns = BeIns->NEXT ) + { + DupFigure->BEINS = loc_dupvbins( DupFigure->BEINS, BeIns ); + } + + for ( BePcs = Figure->BEPCS; + BePcs != (vbpcs_list *)0; + BePcs = BePcs->NEXT ) + { + DupFigure->BEPCS = loc_dupvbpcs( DupFigure->BEPCS, BePcs ); + } + + for ( BeGnr = Figure->BEGNR; + BeGnr != (vbgnr_list *)0; + BeGnr = BeGnr->NEXT ) + { + DupFigure->BEGNR = loc_dupvbgnr( DupFigure->BEGNR, BeGnr ); + } + + resetauthtable( LocalHashTable ); +} + +/*------------------------------------------------------------\ +| | +| vbh_dupvbinst | +| | +\------------------------------------------------------------*/ + +ptype_list *vbh_dupvbinst( Figure, Instruction ) + + vbfig_list *Figure; + ptype_list *Instruction; +{ + LocalDupFigure = Figure; + + return( loc_dupvbinst( Instruction ) ); +} diff --git a/alliance/src/vbh/src/vbh_fre.c b/alliance/src/vbh/src/vbh_fre.c new file mode 100644 index 00000000..ec02e9ed --- /dev/null +++ b/alliance/src/vbh/src/vbh_fre.c @@ -0,0 +1,707 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ + +/* ###--------------------------------------------------------------### */ +/* */ +/* file : vbh_free.c */ +/* date : Aug 24 1992 */ +/* version : v102 */ +/* authors : Pirouz BAZARGAN SABET */ +/* content : contains a specific function used to delete a list */ +/* of behaviour data structures */ +/* */ +/* ###--------------------------------------------------------------### */ + +#include "mut.h" +#include "aut.h" +#include "vex.h" +#include "vbh.h" + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbfig */ +/* description : delete a list of BEFIG structures and all objects */ +/* pointed by any os BEFIGs in the list */ +/* called func. : autfreeblock */ +/* ###--------------------------------------------------------------### */ + +extern struct vbfig *VBL_HEADFIG; + +void vbh_delvbfig ( ptvbfig ) + +struct vbfig *ptvbfig; /* the vbfig to be deleted */ + +{ + struct vbfig *scanvbfig; + struct vbfig **prevvbfig; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + prevvbfig = &VBL_HEADFIG; + + for ( scanvbfig = VBL_HEADFIG; + scanvbfig != (vbfig_list *)0; + scanvbfig = scanvbfig->NEXT ) + { + if ( scanvbfig == ptvbfig ) + { + *prevvbfig = scanvbfig->NEXT; + scanvbfig->NEXT = (vbfig_list *)0; + + break; + } + + prevvbfig = &scanvbfig->NEXT; + } + + vbh_frevbfig( scanvbfig ); +} + +void vbh_frevbfig (listvbfig) + +struct vbfig *listvbfig; /* list of vbfig to be deleted */ + +{ + struct vbfig *ptvbfig; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbfig != NULL) + { + vbh_frevbatr (listvbfig->BEATR); + vbh_frevbaux (listvbfig->BEAUX); + vbh_frevbcst (listvbfig->BECST); + vbh_frevbgen (listvbfig->BEGEN); + vbh_frevbpor (listvbfig->BEPOR); + vbh_frevbpcs (listvbfig->BEPCS); + vbh_frevbfun (listvbfig->BEFUN); + vbh_frevbtyp (listvbfig->BETYP); + vbh_frevbmod (listvbfig->BEMOD); + vbh_frevbins (listvbfig->BEINS); + vbh_frevbgnr (listvbfig->BEGNR); + + destroyauthtable( listvbfig->HASH_TYPE ); + + freechain( listvbfig->PACK_LIST ); + + ptvbfig = listvbfig; + listvbfig = listvbfig->NEXT; + autfreeblock (ptvbfig); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbmap */ +/* description : delete a list of BEMOD structures and all objects */ +/* pointed by any os BEMODs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbmap (listvbmap) + +struct vbmap *listvbmap; /* list of vbmap to be deleted */ + +{ + struct vbmap *ptvbmap; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbmap != NULL) + { + freevexexpr( listvbmap->FORMAL ); + freevexexpr( listvbmap->ACTUAL ); + + ptvbmap = listvbmap; + listvbmap = listvbmap->NEXT; + autfreeheap (ptvbmap, sizeof(struct vbmap)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbgnr */ +/* description : delete a list of BEMOD structures and all objects */ +/* pointed by any os BEMODs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbgnr (listvbgnr) + +struct vbgnr *listvbgnr; /* list of vbgnr to be deleted */ + +{ + struct vbgnr *ptvbgnr; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + while (listvbgnr != NULL) + { + freevexexpr( listvbgnr->FOR_VARIABLE ); + freevexexpr( listvbgnr->FOR_LEFT ); + freevexexpr( listvbgnr->FOR_RIGHT ); + freevexexpr( listvbgnr->IF_COND ); + + vbh_frevbpcs( listvbgnr->BEPCS ); + vbh_frevbins( listvbgnr->BEINS ); + vbh_frevbgnr( listvbgnr->BEGNR ); + + ptvbgnr = listvbgnr; + listvbgnr = listvbgnr->NEXT; + autfreeheap (ptvbgnr, sizeof(struct vbgnr)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbins */ +/* description : delete a list of BEMOD structures and all objects */ +/* pointed by any os BEMODs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbins (listvbins) + +struct vbins *listvbins; /* list of vbins to be deleted */ + +{ + struct vbins *ptvbins; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbins != NULL) + { + vbh_frevbmap( listvbins->PORT_MAP ); + vbh_frevbmap( listvbins->GEN_MAP ); + + ptvbins = listvbins; + listvbins = listvbins->NEXT; + autfreeheap (ptvbins, sizeof(struct vbins)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbmod */ +/* description : delete a list of BEMOD structures and all objects */ +/* pointed by any os BEMODs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbmod (listvbmod) + +struct vbmod *listvbmod; /* list of vbmod to be deleted */ + +{ + struct vbmod *ptvbmod; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbmod != NULL) + { + vbh_frevbpor( listvbmod->BEPOR ); + vbh_frevbgen( listvbmod->BEGEN ); + + ptvbmod = listvbmod; + listvbmod = listvbmod->NEXT; + autfreeheap (ptvbmod, sizeof(struct vbmod)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbcst */ +/* description : delete a list of BECST structures and all objects */ +/* pointed by any os BECSTs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbcst (listvbcst) + +struct vbcst *listvbcst; /* list of vbcst to be deleted */ + +{ + struct vbcst *ptvbcst; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbcst != NULL) + { + freevexexpr (listvbcst->VEX); + freevexexpr (listvbcst->TARGET); + + ptvbcst = listvbcst; + listvbcst = listvbcst->NEXT; + autfreeheap (ptvbcst, sizeof(struct vbcst)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbgen */ +/* description : delete a list of BEGEN structures and all objects */ +/* pointed by any os BEGENs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbgen (listvbgen) + +struct vbgen *listvbgen; /* list of vbgen to be deleted */ + +{ + struct vbgen *ptvbgen; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbgen != NULL) + { + freevexexpr (listvbgen->VEX); + freevexexpr (listvbgen->TARGET); + + ptvbgen = listvbgen; + listvbgen = listvbgen->NEXT; + autfreeheap (ptvbgen, sizeof(struct vbgen)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbatr */ +/* description : delete a list of BEAUX structures and all objects */ +/* pointed by any os BEAUXs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbatr (listvbatr) + +struct vbatr *listvbatr; /* list of vbatr to be deleted */ + +{ + struct vbatr *ptvbatr; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbatr != NULL) + { + ptvbatr = listvbatr; + listvbatr = listvbatr->NEXT; + autfreeheap (ptvbatr, sizeof(struct vbatr)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbaux */ +/* description : delete a list of BEAUX structures and all objects */ +/* pointed by any os BEAUXs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbaux (listvbaux) + +struct vbaux *listvbaux; /* list of vbaux to be deleted */ + +{ + struct vbaux *ptvbaux; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbaux != NULL) + { + freevexexpr (listvbaux->VEX); + freevexexpr (listvbaux->TARGET); + + ptvbaux = listvbaux; + listvbaux = listvbaux->NEXT; + autfreeheap (ptvbaux, sizeof(struct vbaux)); + } + +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbarg */ +/* description : delete a list of BEAUX structures and all objects */ +/* pointed by any os BEAUXs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbarg (listvbarg) + +struct vbarg *listvbarg; /* list of vbarg to be deleted */ + +{ + struct vbarg *ptvbarg; + + /* ###------------------------------------------------------### */ + /* for each object of the list, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbarg != NULL) + { + freevexexpr (listvbarg->TARGET); + + ptvbarg = listvbarg; + listvbarg = listvbarg->NEXT; + autfreeheap (ptvbarg, sizeof(struct vbarg)); + } +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbpor */ +/* description : delete a list of BEAUX structures and all objects */ +/* pointed by any os BEAUXs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbpor (listvbpor) + +struct vbpor *listvbpor; /* list of vbpor to be deleted */ + +{ + struct vbpor *ptvbpor; + + /* ###------------------------------------------------------### */ + /* for each object of the list, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbpor != NULL) + { + freevexexpr (listvbpor->TARGET); + + ptvbpor = listvbpor; + listvbpor = listvbpor->NEXT; + autfreeheap (ptvbpor, sizeof(struct vbpor)); + } +} + +void vbh_frevbifs( ScanIfs ) + + vbifs_list *ScanIfs; +{ + freevexexpr( ScanIfs->CND ); + vbh_frevbinst( ScanIfs->CNDTRUE ); + vbh_frevbinst( ScanIfs->CNDFALSE ); + + autfreeheap( ScanIfs, sizeof(struct vbifs) ); +} + +void vbh_frevbfor( ScanFor ) + + vbfor_list *ScanFor; +{ + freevexexpr( ScanFor->VARIABLE ); + freevexexpr( ScanFor->LEFT ); + freevexexpr( ScanFor->RIGHT ); + + vbh_frevbinst( ScanFor->INSTRUCTION ); + autfreeheap( ScanFor, sizeof(struct vbfor) ); +} + +void vbh_frevblop( ScanLop ) + + vblop_list *ScanLop; +{ + vbh_frevbinst( ScanLop->INSTRUCTION ); + autfreeheap( ScanLop, sizeof(struct vblop) ); +} + +void vbh_frevbwhi( ScanWhi ) + + vbwhi_list *ScanWhi; +{ + freevexexpr( ScanWhi->CND ); + vbh_frevbinst( ScanWhi->INSTRUCTION ); + autfreeheap( ScanWhi, sizeof(struct vbwhi) ); +} + +void vbh_frevbext( ScanExit ) + + vbext_list *ScanExit; +{ + freevexexpr( ScanExit->CND ); + autfreeheap( ScanExit, sizeof(struct vbext) ); +} + +void vbh_frevbnxt( ScanNext ) + + vbnxt_list *ScanNext; +{ + freevexexpr( ScanNext->CND ); + autfreeheap( ScanNext, sizeof(struct vbnxt) ); +} + +void vbh_frevbret( ScanReturn ) + + vbret_list *ScanReturn; +{ + freevexexpr( ScanReturn->RET ); + autfreeheap( ScanReturn, sizeof(struct vbret) ); +} + +void vbh_frevbcal( ScanCall ) + + vbcal_list *ScanCall; +{ + freevexexpr( ScanCall->CALL ); + autfreeheap( ScanCall, sizeof(struct vbcal) ); +} + +void vbh_frevbasg( ScanAsg ) + + vbasg_list *ScanAsg; +{ + freevexexpr( ScanAsg->TARGET ); + freevexexpr( ScanAsg->VEX ); + + autfreeheap( ScanAsg, sizeof(struct vbasg) ); +} + +void vbh_frevbvar( ScanVar ) + + vbvar_list *ScanVar; +{ + freevexexpr( ScanVar->TARGET ); + freevexexpr( ScanVar->VEX ); + + autfreeheap( ScanVar, sizeof(struct vbvar) ); +} + +void vbh_frevbwas( ScanWas ) + + vbwas_list *ScanWas; +{ + freechain( ScanWas->SEN ); + freevexexpr( ScanWas->CND ); + freevexexpr( ScanWas->TIMEOUT ); + + autfreeheap( ScanWas, sizeof(struct vbwas) ); +} + +void vbh_frevbcas( ScanCas ) + + vbcas_list *ScanCas; +{ + vbcho_list *ScanCho; + int Offset; + + freevexexpr( ScanCas->VEX ); + + for ( Offset = 0; Offset < ScanCas->SIZE; Offset++ ) + { + ScanCho = &ScanCas->CHOICE[ Offset ]; + freechain( ScanCho->VALUES ); + vbh_frevbinst( ScanCho->INSTRUCTION ); + } + + autfreeblock( ScanCas->CHOICE ); + autfreeheap( ScanCas, sizeof(struct vbcas) ); +} + +void vbh_frevbagr( ScanAgr ) + + vbagr_list *ScanAgr; +{ + vbh_frevbinst( ScanAgr->ASSIGN ); + autfreeheap( ScanAgr, sizeof(struct vbagr) ); +} + +void vbh_frevbinst( HeadType ) + + ptype_list *HeadType; +{ + ptype_list *ScanType; + + for ( ScanType = HeadType; + ScanType != (ptype_list *)0; + ScanType = ScanType->NEXT ) + { + switch ( ScanType->TYPE ) + { + case VBH_BEIFS : vbh_frevbifs( ScanType->DATA ); + break; + + case VBH_BEASG : vbh_frevbasg( ScanType->DATA ); + break; + + case VBH_BEVAR : vbh_frevbvar( ScanType->DATA ); + break; + + case VBH_BECAS : vbh_frevbcas( ScanType->DATA ); + break; + + case VBH_BEWAS : vbh_frevbwas( ScanType->DATA ); + break; + + case VBH_BEWHI : vbh_frevbwhi( ScanType->DATA ); + break; + + case VBH_BELOP : vbh_frevblop( ScanType->DATA ); + break; + + case VBH_BEFOR : vbh_frevbfor( ScanType->DATA ); + break; + + case VBH_BENXT : vbh_frevbnxt( ScanType->DATA ); + break; + + case VBH_BEEXT : vbh_frevbext( ScanType->DATA ); + break; + + case VBH_BECAL : vbh_frevbcal( ScanType->DATA ); + break; + + case VBH_BERET : vbh_frevbret( ScanType->DATA ); + break; + + case VBH_BEAGR : vbh_frevbagr( ScanType->DATA ); + } + } + + freeptype( HeadType ); +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbpcs */ +/* description : delete a list of BEPCS structures and all objects */ +/* pointed by any os BEPCSs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbpcs (listvbpcs) + +struct vbpcs *listvbpcs; /* list of vbpcs to be deleted */ + +{ + struct vbpcs *ptvbpcs; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbpcs != NULL) + { + freechain( listvbpcs->SENSITIVITY ); + + vbh_frevbinst( listvbpcs->VARIABLE ); + vbh_frevbinst( listvbpcs->INSTRUCTION ); + + ptvbpcs = listvbpcs; + listvbpcs = listvbpcs->NEXT; + autfreeheap (ptvbpcs, sizeof(struct vbpcs) ); + } +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbfun */ +/* description : delete a list of BEFUN structures and all objects */ +/* pointed by any os BEFUNs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbfun (listvbfun) + +struct vbfun *listvbfun; /* list of vbfun to be deleted */ + +{ + struct vbfun *ptvbfun; + + /* ###------------------------------------------------------### */ + /* for each object of the list, first delete pointed objects */ + /* then, delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbfun != NULL) + { + vbh_frevbarg( listvbfun->RETURN ); + vbh_frevbarg( listvbfun->ARGUMENT ); + + vbh_frevbinst( listvbfun->VARIABLE ); + vbh_frevbinst( listvbfun->INSTRUCTION ); + + ptvbfun = listvbfun; + listvbfun = listvbfun->NEXT; + autfreeheap (ptvbfun, sizeof(struct vbfun) ); + } +} + +/* ###--------------------------------------------------------------### */ +/* function : vbh_frevbtyp */ +/* description : delete a list of BETYP structures and all objects */ +/* pointed by any os BETYPs in the list */ +/* called func. : autfreeheap */ +/* ###--------------------------------------------------------------### */ + +void vbh_frevbtyp (listvbtyp) + +struct vbtyp *listvbtyp; /* list of vbtyp to be deleted */ + +{ + struct vbtyp *ptvbtyp; + + /* ###------------------------------------------------------### */ + /* for each object of the list delete the object itself */ + /* ###------------------------------------------------------### */ + + while (listvbtyp != NULL) + { + ptvbtyp = listvbtyp; + freevexexpr( ptvbtyp->DYNAMIC_LEFT ); + freevexexpr( ptvbtyp->DYNAMIC_RIGHT ); + listvbtyp = listvbtyp->NEXT; + autfreeheap (ptvbtyp, sizeof(struct vbtyp) ); + } + +} diff --git a/alliance/src/vbh/src/vbh_simp.c b/alliance/src/vbh/src/vbh_simp.c new file mode 100644 index 00000000..93833f52 --- /dev/null +++ b/alliance/src/vbh/src/vbh_simp.c @@ -0,0 +1,672 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vbh | +| | +| File : vbhsimp.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vbh.h" + +# include +# include + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ + + static vexexpr *((*VbhFunctionL)()) = NULL; + static vexexpr *((*VbhFunctionR)()) = NULL; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Simp Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Ifs | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbifs( ScanIfs ) + + vbifs_list *ScanIfs; +{ + ScanIfs->CND = (*VbhFunctionR)( ScanIfs->CND ); + + if ( ScanIfs->CNDTRUE != (ptype_list *)0 ) + { + vbh_simpvbinst( ScanIfs->CNDTRUE ); + } + + if ( ScanIfs->CNDFALSE != (ptype_list *)0 ) + { + vbh_simpvbinst( ScanIfs->CNDFALSE ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Var | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbvar( ScanVar ) + + vbvar_list *ScanVar; +{ + ScanVar->TARGET = (*VbhFunctionL)( ScanVar->TARGET ); + ScanVar->VEX = (*VbhFunctionR)( ScanVar->VEX ); +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Asg | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbasg( ScanAsg ) + + vbasg_list *ScanAsg; +{ + ScanAsg->TARGET = (*VbhFunctionL)( ScanAsg->TARGET ); + ScanAsg->VEX = (*VbhFunctionR)( ScanAsg->VEX ); +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Agr | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbagr( ScanAgr ) + + vbagr_list *ScanAgr; +{ + vbh_simpvbinst( ScanAgr->ASSIGN ); +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Case | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbcas( ScanCase ) + + vbcas_list *ScanCase; +{ + vbcho_list *ScanChoice; + int Offset; + + ScanCase->VEX = (*VbhFunctionR)( ScanCase->VEX ); + + for ( Offset = 0; Offset < ScanCase->SIZE; Offset++ ) + { + ScanChoice = &ScanCase->CHOICE[ Offset ]; + vbh_simpvbinst( ScanChoice->INSTRUCTION ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Wait | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbwas( ScanWait ) + + vbwas_list *ScanWait; +{ + if ( ScanWait->CND != (vexexpr *)0 ) + { + ScanWait->CND = (*VbhFunctionR)( ScanWait->CND ); + } + + if ( ScanWait->TIMEOUT != (vexexpr *)0 ) + { + ScanWait->TIMEOUT = (*VbhFunctionR)( ScanWait->TIMEOUT ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh For | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbfor( ScanFor ) + + vbfor_list *ScanFor; +{ + ScanFor->VARIABLE = (*VbhFunctionL)( ScanFor->VARIABLE ); + + if ( ScanFor->LEFT != (vexexpr *)0 ) + { + ScanFor->LEFT = (*VbhFunctionR)( ScanFor->LEFT ); + } + + if ( ScanFor->RIGHT != (vexexpr *)0 ) + { + ScanFor->RIGHT = (*VbhFunctionR)( ScanFor->RIGHT ); + } + + vbh_simpvbinst( ScanFor->INSTRUCTION ); +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh While | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbwhi( ScanWhile ) + + vbwhi_list *ScanWhile; +{ + if ( ScanWhile->CND != (vexexpr *)0 ) + { + ScanWhile->CND = (*VbhFunctionR)( ScanWhile->CND ); + } + + vbh_simpvbinst( ScanWhile->INSTRUCTION ); +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Loop | +| | +\------------------------------------------------------------*/ + +static void loc_simpvblop( ScanLoop ) + + vblop_list *ScanLoop; +{ + vbh_simpvbinst( ScanLoop->INSTRUCTION ); +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Exit | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbext( ScanExit ) + + vbext_list *ScanExit; +{ + if ( ScanExit->CND != (vexexpr *)0 ) + { + ScanExit->CND = (*VbhFunctionR)( ScanExit->CND ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Next | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbnxt( ScanNext ) + + vbnxt_list *ScanNext; +{ + if ( ScanNext->CND != (vexexpr *)0 ) + { + ScanNext->CND = (*VbhFunctionR)( ScanNext->CND ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Return | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbret( ScanReturn ) + + vbret_list *ScanReturn; +{ + if ( ScanReturn->RET != (vexexpr *)0 ) + { + ScanReturn->RET = (*VbhFunctionR)( ScanReturn->RET ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Call | +| | +\------------------------------------------------------------*/ + +static void loc_simpvbcal( ScanCall ) + + vbcal_list *ScanCall; +{ + if ( ScanCall->CALL != (vexexpr *)0 ) + { + ScanCall->CALL = (*VbhFunctionR)( ScanCall->CALL ); + } +} + +/*------------------------------------------------------------\ +| | +| Local Simp Vbh Instruction | +| | +\------------------------------------------------------------*/ + +void vbh_simpvbinst( Instruction ) + + ptype_list *Instruction; +{ + while ( Instruction != (ptype_list *)0 ) + { + switch ( Instruction->TYPE ) + { + case VBH_BEIFS : loc_simpvbifs( Instruction->DATA ); + break; + + case VBH_BEASG : loc_simpvbasg( Instruction->DATA ); + break; + + case VBH_BEVAR : loc_simpvbvar( Instruction->DATA ); + break; + + case VBH_BECAS : loc_simpvbcas( Instruction->DATA ); + break; + + case VBH_BEWAS : loc_simpvbwas( Instruction->DATA ); + break; + + case VBH_BEFOR : loc_simpvbfor( Instruction->DATA ); + break; + + case VBH_BEWHI : loc_simpvbwhi( Instruction->DATA ); + break; + + case VBH_BELOP : loc_simpvblop( Instruction->DATA ); + break; + + case VBH_BENXT : loc_simpvbnxt( Instruction->DATA ); + break; + + case VBH_BEEXT : loc_simpvbext( Instruction->DATA ); + break; + + case VBH_BERET : loc_simpvbret( Instruction->DATA ); + break; + + case VBH_BECAL : loc_simpvbcal( Instruction->DATA ); + break; + + case VBH_BEAGR : loc_simpvbagr( Instruction->DATA ); + break; + } + + Instruction = Instruction->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| Simp Vbh Instance | +| | +\------------------------------------------------------------*/ + +void loc_simpvbins( BeIns ) + + vbins_list *BeIns; +{ + vbmap_list *BeMap; + + while ( BeIns != (vbins_list *)0 ) + { + for ( BeMap = BeIns->PORT_MAP; + BeMap != (vbmap_list *)0; + BeMap = BeMap->NEXT ) + { + if ( BeMap->FORMAL != (vexexpr *)0 ) + { + BeMap->FORMAL = (*VbhFunctionL)( BeMap->FORMAL ); + } + + if ( BeMap->ACTUAL != (vexexpr *)0 ) + { + BeMap->ACTUAL = (*VbhFunctionR)( BeMap->ACTUAL ); + } + } + + for ( BeMap = BeIns->GEN_MAP; + BeMap != (vbmap_list *)0; + BeMap = BeMap->NEXT ) + { + if ( BeMap->FORMAL != (vexexpr *)0 ) + { + BeMap->FORMAL = (*VbhFunctionR)( BeMap->FORMAL ); + } + + if ( BeMap->ACTUAL != (vexexpr *)0 ) + { + BeMap->ACTUAL = (*VbhFunctionL)( BeMap->ACTUAL ); + } + } + + BeIns = BeIns->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| Simp Vbh Aux | +| | +\------------------------------------------------------------*/ + +void loc_simpvbaux( BeAux ) + + vbaux_list *BeAux; +{ + while ( BeAux != (vbaux_list *)0 ) + { + BeAux->TARGET = (*VbhFunctionL)( BeAux->TARGET ); + if ( BeAux->VEX != (vexexpr *)0 ) + { + BeAux->VEX = (*VbhFunctionR)( BeAux->VEX ); + } + + BeAux = BeAux->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| Simp Vbh Pcs | +| | +\------------------------------------------------------------*/ + +void loc_simpvbpcs( BePcs ) + + vbpcs_list *BePcs; +{ + ptype_list *ScanPtype; + vbvar_list *BeVar; + + while( BePcs != (vbpcs_list *)0 ) + { + for ( ScanPtype = BePcs->VARIABLE; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + BeVar = (vbvar_list *)ScanPtype->DATA; + + BeVar->TARGET = (*VbhFunctionL)( BeVar->TARGET ); + if ( BeVar->VEX != (vexexpr *)0 ) + { + BeVar->VEX = (*VbhFunctionR)( BeVar->VEX ); + } + } + + vbh_simpvbinst( BePcs->INSTRUCTION ); + BePcs = BePcs->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| Simp Vbh Generates | +| | +\------------------------------------------------------------*/ + +void loc_simpvbgnr( BeGnr ) + + vbgnr_list *BeGnr; +{ + while( BeGnr != (vbgnr_list *)0 ) + { + if ( BeGnr->FOR_VARIABLE != (vexexpr *)0 ) + { + BeGnr->FOR_VARIABLE = (*VbhFunctionL)( BeGnr->FOR_VARIABLE ); + } + + if ( BeGnr->FOR_LEFT != (vexexpr *)0 ) + { + BeGnr->FOR_LEFT = (*VbhFunctionR)( BeGnr->FOR_LEFT ); + } + + if ( BeGnr->FOR_RIGHT != (vexexpr *)0 ) + { + BeGnr->FOR_RIGHT = (*VbhFunctionR)( BeGnr->FOR_RIGHT ); + } + + if ( BeGnr->IF_COND != (vexexpr *)0 ) + { + BeGnr->IF_COND = (*VbhFunctionR)( BeGnr->IF_COND ); + } + + loc_simpvbpcs( BeGnr->BEPCS ); + loc_simpvbins( BeGnr->BEINS ); + loc_simpvbgnr( BeGnr->BEGNR ); + + BeGnr = BeGnr->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| For All Vex Vbh Figure | +| | +\------------------------------------------------------------*/ + +void vbh_forallvexvbfig( Figure, FunctionL, FunctionR ) + + vbfig_list *Figure; + vexexpr *(*FunctionL)(); + vexexpr *(*FunctionR)(); +{ + vbmod_list *BeMod; + vbgen_list *BeGen; + vbtyp_list *BeTyp; + vbcst_list *BeCst; + vbpor_list *BePor; + vbfun_list *BeFun; + vbarg_list *BePar; + vbvar_list *BeVar; + ptype_list *ScanPtype; + long Left; + long Right; + + VbhFunctionL = FunctionL; + VbhFunctionR = FunctionR; + + for ( BeTyp = Figure->BETYP; + BeTyp != (vbtyp_list *)0; + BeTyp = BeTyp->NEXT ) + { + if ( BeTyp->DYNAMIC ) + { + BeTyp->DYNAMIC_LEFT = (*VbhFunctionR)( BeTyp->DYNAMIC_LEFT ); + BeTyp->DYNAMIC_RIGHT = (*VbhFunctionR)( BeTyp->DYNAMIC_RIGHT ); + + if ( ( ! evalvexatomlong( BeTyp->DYNAMIC_LEFT , &Left ) ) && + ( ! evalvexatomlong( BeTyp->DYNAMIC_RIGHT, &Right ) ) ) + { + BeTyp->LEFT = Left; + BeTyp->RIGHT = Right; + BeTyp->DYNAMIC = 0; + + freevexexpr( BeTyp->DYNAMIC_LEFT ); + freevexexpr( BeTyp->DYNAMIC_RIGHT ); + + BeTyp->DYNAMIC_RIGHT = (vexexpr *)0; + BeTyp->DYNAMIC_LEFT = (vexexpr *)0; + } + } + } + + for ( BePor = Figure->BEPOR; + BePor != (vbpor_list *)0; + BePor = BePor->NEXT ) + { + BePor->TARGET = (*VbhFunctionL)( BePor->TARGET ); + if ( BePor->VEX != (vexexpr *)0 ) + { + BePor->VEX = (*VbhFunctionR)( BePor->VEX ); + } + } + + for ( BeGen = Figure->BEGEN; + BeGen != (vbgen_list *)0; + BeGen = BeGen->NEXT ) + { + BeGen->TARGET = (*VbhFunctionL)( BeGen->TARGET ); + if ( BeGen->VEX != (vexexpr *)0 ) + { + BeGen->VEX = (*VbhFunctionR)( BeGen->VEX ); + } + } + + for ( BeMod = Figure->BEMOD; + BeMod != (vbmod_list *)0; + BeMod = BeMod->NEXT ) + { + for ( BePor = BeMod->BEPOR; + BePor != (vbpor_list *)0; + BePor = BePor->NEXT ) + { + BePor->TARGET = (*VbhFunctionL)( BePor->TARGET ); + if ( BePor->VEX != (vexexpr *)0 ) + { + BePor->VEX = (*VbhFunctionR)( BePor->VEX ); + } + } + + for ( BeGen = BeMod->BEGEN; + BeGen != (vbgen_list *)0; + BeGen = BeGen->NEXT ) + { + BeGen->TARGET = (*VbhFunctionL)( BeGen->TARGET ); + if ( BeGen->VEX != (vexexpr *)0 ) + { + BeGen->VEX = (*VbhFunctionR)( BeGen->VEX ); + } + } + } + + for ( BeCst = Figure->BECST; + BeCst != (vbcst_list *)0; + BeCst = BeCst->NEXT ) + { + BeCst->TARGET = (*VbhFunctionL)( BeCst->TARGET ); + if ( BeCst->VEX != (vexexpr *)0 ) + { + BeCst->VEX = (*VbhFunctionR)( BeCst->VEX ); + } + } + + for ( BeFun = Figure->BEFUN; + BeFun != (vbfun_list *)0; + BeFun = BeFun->NEXT ) + { + for ( BePar = BeFun->ARGUMENT; + BePar != (vbarg_list *)0; + BePar = BePar->NEXT ) + { + BePar->TARGET = (*VbhFunctionL)( BePar->TARGET ); + } + + if ( BeFun->RETURN != (vbarg_list *)0 ) + { + BePar = BeFun->RETURN; + + BePar->TARGET = (*VbhFunctionL)( BePar->TARGET ); + } + + for ( ScanPtype = BeFun->VARIABLE; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + BeVar = (vbvar_list *)ScanPtype->DATA; + + BeVar->TARGET = (*VbhFunctionL)( BeVar->TARGET ); + if ( BeVar->VEX != (vexexpr *)0 ) + { + BeVar->VEX = (*VbhFunctionR)( BeVar->VEX ); + } + } + + vbh_simpvbinst( BeFun->INSTRUCTION ); + } + + loc_simpvbaux( Figure->BEAUX ); + loc_simpvbins( Figure->BEINS ); + loc_simpvbpcs( Figure->BEPCS ); + loc_simpvbgnr( Figure->BEGNR ); +} + +/*------------------------------------------------------------\ +| | +| Simplify Vbh Figure | +| | +\------------------------------------------------------------*/ + +void vbh_simpvbfig( Figure ) + + vbfig_list *Figure; +{ + vbh_forallvexvbfig( Figure, simpvexexpr, simpvexexpr ); +} diff --git a/alliance/src/vbh/src/vbh_view.c b/alliance/src/vbh/src/vbh_view.c new file mode 100644 index 00000000..52577b39 --- /dev/null +++ b/alliance/src/vbh/src/vbh_view.c @@ -0,0 +1,1023 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vbh | +| | +| File : vbhview.c | +| | +| Date : 03.12.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vbh.h" + +# include +# include + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + + static char *VBH_TIME_UNIT_NAME[ VBH_MAX_TIME_UNIT ] = + { + "UNKNOWN", + "FS", + "PS", + "NS", + "MS" + }; + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Local Get Vbh Type | +| | +\------------------------------------------------------------*/ + +static char *loc_getvbhtypename( Type ) + + vbtyp_list *Type; +{ + static char NotDefined[] = "not defined !"; + + if ( Type == (vbtyp_list *)0 ) + { + return( NotDefined ); + } + + return( Type->NAME ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Port | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbpor( BePor ) + + vbpor_list *BePor; +{ + fprintf( stdout, " > [%ld]", BePor->LINE ); + viewvexexprbound( BePor->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BePor->TYPE ) ); + fprintf( stdout, " DIR %c ", BePor->DIR ); + fprintf( stdout, " KIND %d ", BePor->KIND ); + if ( BePor->VEX != (vexexpr *)0 ) + { + fprintf( stdout, " := " ); + viewvexexprbound( BePor->VEX ); + } + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Generic | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbgen( BeGen ) + + vbgen_list *BeGen; +{ + fprintf( stdout, " > [%ld]", BeGen->LINE ); + viewvexexprbound( BeGen->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BeGen->TYPE ) ); + if ( BeGen->VEX != (vexexpr *)0 ) + { + fprintf( stdout, " := " ); + viewvexexprbound( BeGen->VEX ); + } + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Ifs | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbifs( ScanIfs ) + + vbifs_list *ScanIfs; +{ + fprintf( stdout, "[%ld] ", ScanIfs->LINE ); + fprintf( stdout, "IF (" ); + viewvexexprbound( ScanIfs->CND ); + fprintf( stdout, ")\nTHEN\n" ); + + if ( ScanIfs->CNDTRUE != (ptype_list *)0 ) + { + vbh_viewvbinst( ScanIfs->CNDTRUE ); + } + + if ( ScanIfs->CNDFALSE != (ptype_list *)0 ) + { + fprintf( stdout, "ELSE\n" ); + vbh_viewvbinst( ScanIfs->CNDFALSE ); + } + fprintf( stdout, "END IF\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Var | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbvar( ScanVar ) + + vbvar_list *ScanVar; +{ + fprintf( stdout, "[%ld] ", ScanVar->LINE ); + viewvexexprbound( ScanVar->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( ScanVar->TYPE ) ); + fprintf( stdout, " := " ); + viewvexexprbound( ScanVar->VEX ); + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Asg | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbasg( ScanAsg ) + + vbasg_list *ScanAsg; +{ + fprintf( stdout, "[%ld] ", ScanAsg->LINE ); + viewvexexprbound( ScanAsg->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( ScanAsg->TYPE ) ); + fprintf( stdout, " <= " ); + viewvexexprbound( ScanAsg->VEX ); + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Case | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbcas( ScanCase ) + + vbcas_list *ScanCase; +{ + vbcho_list *ScanChoice; + chain_list *ScanChain; + int Offset; + + fprintf( stdout, "[%ld] ", ScanCase->LINE ); + fprintf( stdout, "CASE (" ); + viewvexexprbound( ScanCase->VEX ); + fprintf( stdout, ") IS\n" ); + + for ( Offset = 0; Offset < ScanCase->SIZE; Offset++ ) + { + ScanChoice = &ScanCase->CHOICE[ Offset ]; + + fprintf( stdout, "WHEN " ); + + for ( ScanChain = ScanChoice->VALUES; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + fprintf( stdout, "%s ", (char *)ScanChain->DATA ); + + if ( ScanChain->NEXT != (chain_list *)0 ) + { + fprintf( stdout, " | " ); + } + } + + fprintf( stdout, "=> " ); + + vbh_viewvbinst( ScanChoice->INSTRUCTION ); + } + + fprintf( stdout, "END CASE\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Wait | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbwas( ScanWait ) + + vbwas_list *ScanWait; +{ + chain_list *ScanSens; + + fprintf( stdout, "[%ld] ", ScanWait->LINE ); + fprintf( stdout, "WAIT" ); + + if ( ScanWait->SEN != (chain_list *)0 ) + { + fprintf( stdout, " ON " ); + for ( ScanSens = ScanWait->SEN; + ScanSens != (chain_list *)0; + ScanSens = ScanSens->NEXT ) + { + fprintf( stdout, "%s", (char *)ScanSens->DATA ); + if ( ScanSens->NEXT != (chain_list *)0 ) + { + fprintf( stdout, ", " ); + } + } + } + + if ( ScanWait->CND != (vexexpr *)0 ) + { + fprintf( stdout, " UNTIL " ); + viewvexexprbound( ScanWait->CND ); + } + + if ( ScanWait->TIMEOUT != (vexexpr *)0 ) + { + fprintf( stdout, " FOR " ); + viewvexexprbound( ScanWait->TIMEOUT ); + + if ( ScanWait->TIME_UNIT < VBH_MAX_TIME_UNIT ) + { + fprintf( stdout, " %s", VBH_TIME_UNIT_NAME[ ScanWait->TIME_UNIT ] ); + } + else + { + fprintf( stdout, " unknown (%d)", ScanWait->TIME_UNIT ); + } + } + + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh For | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbfor( ScanFor ) + + vbfor_list *ScanFor; +{ + fprintf( stdout, "[%ld] ", ScanFor->LINE ); + fprintf( stdout, "%s : ", ScanFor->LABEL ); + + fprintf( stdout, "FOR " ); + viewvexexprbound( ScanFor->VARIABLE ); + fprintf( stdout, "IN " ); + + viewvexexprbound( ScanFor->LEFT ); + if ( ScanFor->UP ) fprintf( stdout, " TO " ); + else fprintf( stdout, " DOWNTO " ); + viewvexexprbound( ScanFor->RIGHT ); + + fprintf( stdout, "\nLOOP\n" ); + + vbh_viewvbinst( ScanFor->INSTRUCTION ); + + fprintf( stdout, "END LOOP %s\n", ScanFor->LABEL ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Loop | +| | +\------------------------------------------------------------*/ + +static void loc_viewvblop( ScanLoop ) + + vblop_list *ScanLoop; +{ + fprintf( stdout, "[%ld] ", ScanLoop->LINE ); + fprintf( stdout, "%s : ", ScanLoop->LABEL ); + + fprintf( stdout, "LOOP\n" ); + + vbh_viewvbinst( ScanLoop->INSTRUCTION ); + + fprintf( stdout, "END LOOP %s\n", ScanLoop->LABEL ); + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh While | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbwhi( ScanWhile ) + + vbwhi_list *ScanWhile; +{ + fprintf( stdout, "[%ld] ", ScanWhile->LINE ); + fprintf( stdout, "%s : ", ScanWhile->LABEL ); + + fprintf( stdout, "WHILE ( " ); + viewvexexprbound( ScanWhile->CND ); + fprintf( stdout, " )\n" ); + fprintf( stdout, "LOOP\n" ); + + vbh_viewvbinst( ScanWhile->INSTRUCTION ); + + fprintf( stdout, "END LOOP %s\n", ScanWhile->LABEL ); + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Aggregate | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbagr( ScanAggreg ) + + vbagr_list *ScanAggreg; +{ + fprintf( stdout, "[%ld] ", ScanAggreg->LINE ); + fprintf( stdout, "AGGREGATE (\n" ); + vbh_viewvbinst( ScanAggreg->ASSIGN ); + fprintf( stdout, ")\n\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Exit | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbext( ScanExit ) + + vbext_list *ScanExit; +{ + fprintf( stdout, "[%ld] ", ScanExit->LINE ); + fprintf( stdout, "EXIT" ); + + if ( ScanExit->LABEL != (char *)0 ) + { + fprintf( stdout, " %s", ScanExit->LABEL ); + } + + if ( ScanExit->CND != (vexexpr *)0 ) + { + fprintf( stdout," WHEN ( " ); + viewvexexprbound( ScanExit->CND ); + fprintf( stdout, " )\n" ); + } + else + { + fprintf( stdout, "\n" ); + } +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Next | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbnxt( ScanNext ) + + vbnxt_list *ScanNext; +{ + fprintf( stdout, "[%ld] ", ScanNext->LINE ); + fprintf( stdout, "NEXT" ); + + if ( ScanNext->LABEL != (char *)0 ) + { + fprintf( stdout, " %s", ScanNext->LABEL ); + } + + if ( ScanNext->CND != (vexexpr *)0 ) + { + fprintf( stdout," WHEN ( " ); + viewvexexprbound( ScanNext->CND ); + fprintf( stdout, " )\n" ); + } + else + { + fprintf( stdout, "\n" ); + } +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Return | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbret( ScanReturn ) + + vbret_list *ScanReturn; +{ + fprintf( stdout, "[%ld] ", ScanReturn->LINE ); + fprintf( stdout, "RETURN " ); + + viewvexexprbound( ScanReturn->RET ); + + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Call | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbcal( ScanCall ) + + vbcal_list *ScanCall; +{ + fprintf( stdout, "[%ld] ", ScanCall->LINE ); + fprintf( stdout, "CALL " ); + + viewvexexprbound( ScanCall->CALL ); + + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| Local View Vbh Instruction | +| | +\------------------------------------------------------------*/ + +void vbh_viewvbinst( Instruction ) + + ptype_list *Instruction; +{ + while ( Instruction != (ptype_list *)0 ) + { + switch ( Instruction->TYPE ) + { + case VBH_BEIFS : loc_viewvbifs( Instruction->DATA ); + break; + + case VBH_BEASG : loc_viewvbasg( Instruction->DATA ); + break; + + case VBH_BEVAR : loc_viewvbvar( Instruction->DATA ); + break; + + case VBH_BECAS : loc_viewvbcas( Instruction->DATA ); + break; + + case VBH_BEWAS : loc_viewvbwas( Instruction->DATA ); + break; + + case VBH_BEFOR : loc_viewvbfor( Instruction->DATA ); + break; + + case VBH_BEWHI : loc_viewvbwhi( Instruction->DATA ); + break; + + case VBH_BELOP : loc_viewvblop( Instruction->DATA ); + break; + + case VBH_BENXT : loc_viewvbnxt( Instruction->DATA ); + break; + + case VBH_BEEXT : loc_viewvbext( Instruction->DATA ); + break; + + case VBH_BERET : loc_viewvbret( Instruction->DATA ); + break; + + case VBH_BECAL : loc_viewvbcal( Instruction->DATA ); + break; + + case VBH_BEAGR : loc_viewvbagr( Instruction->DATA ); + break; + + default : fprintf( stdout, "ERROR unknown instruction %ld\n", + Instruction->TYPE ); + } + + Instruction = Instruction->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| View Vbh Type | +| | +\------------------------------------------------------------*/ + +void vbh_viewvbtyp( BeTyp ) + + vbtyp_list *BeTyp; +{ + int Index; + + fprintf( stdout, " > [%ld]\n", BeTyp->LINE ); + fprintf( stdout, " NAME : %s\n", BeTyp->NAME ); + fprintf( stdout, " LEFT : %d\n", (int)BeTyp->LEFT ); + fprintf( stdout, " RIGHT : %d\n", (int)BeTyp->RIGHT ); + fprintf( stdout, " VALUE : \n" ); + + for ( Index = 0; Index < BeTyp->SIZE; Index++ ) + { + fprintf( stdout, "%s ", BeTyp->VALUE[ Index ] ); + } + + if ( BeTyp->SIZE != 0 ) fprintf( stdout, "\n" ); + + fprintf( stdout, " SIZE : %d\n", BeTyp->SIZE ); + fprintf( stdout, " BYTE : %d\n", BeTyp->BYTE ); + fprintf( stdout, " CLASS : %c\n", BeTyp->CLASS ); + fprintf( stdout, " INDEX : %d\n", BeTyp->INDEX ); + + if ( BeTyp->BASE != (vbtyp_list *)0 ) + { + fprintf( stdout, " BASE : %s\n", BeTyp->BASE->NAME ); + } + else + { + fprintf( stdout, " BASE : none\n" ); + } + + if ( BeTyp->RESOLV != (vbfun_list *)0 ) + { + fprintf( stdout, " RESOLV : %s\n", BeTyp->RESOLV->NAME ); + } + else + { + fprintf( stdout, " RESOLV : none\n" ); + } + + if ( BeTyp->DYNAMIC ) + { + fprintf( stdout, " DYNAMIC: %lx %lx ", + (long)BeTyp->DYNAMIC_LEFT, (long)BeTyp->DYNAMIC_RIGHT ); + + viewvexexprbound( BeTyp->DYNAMIC_LEFT ); + if ( BeTyp->DYNAMIC == VBH_DYNAMIC_TO ) fprintf( stdout, " TO " ); + else fprintf( stdout, " DOWNTO " ); + viewvexexprboundln( BeTyp->DYNAMIC_RIGHT ); + } +} + +/*------------------------------------------------------------\ +| | +| View Vbh Instance | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbins( BeIns ) + + vbins_list *BeIns; +{ + vbmap_list *BeMap; + + fprintf( stdout, " > [%ld]", BeIns->LINE ); + fprintf( stdout, " NAME %s ", BeIns->NAME ); + fprintf( stdout, " MODEL %s\n", BeIns->MODEL ); + fprintf( stdout, " PORT_MAP\n" ); + + for ( BeMap = BeIns->PORT_MAP; + BeMap != (vbmap_list *)0; + BeMap = BeMap->NEXT ) + { + fprintf( stdout, " > [%ld] FORMAL: ", BeMap->LINE ); + viewvexexprbound( BeMap->FORMAL ); + fprintf( stdout, " ACTUAL: " ); + viewvexexprboundln( BeMap->ACTUAL ); + } + + fprintf( stdout, "\n" ); + + fprintf( stdout, " GEN_MAP\n" ); + + for ( BeMap = BeIns->GEN_MAP; + BeMap != (vbmap_list *)0; + BeMap = BeMap->NEXT ) + { + fprintf( stdout, " > [%ld] FORMAL: ", BeMap->LINE ); + viewvexexprbound( BeMap->FORMAL ); + fprintf( stdout, " ACTUAL: " ); + viewvexexprboundln( BeMap->ACTUAL ); + } + + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| View Vbh Aux | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbaux( BeAux ) + + vbaux_list *BeAux; +{ + fprintf( stdout, " > [%ld]", BeAux->LINE ); + viewvexexprbound( BeAux->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BeAux->TYPE ) ); + fprintf( stdout, " KIND %d ", (int)BeAux->KIND ); + if ( BeAux->VEX != (vexexpr *)0 ) + { + fprintf( stdout, " := " ); + viewvexexprbound( BeAux->VEX ); + } + fprintf( stdout, "\n" ); +} + +/*------------------------------------------------------------\ +| | +| View Vbh Pcs | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbpcs( BePcs ) + + vbpcs_list *BePcs; +{ + ptype_list *ScanPtype; + vbvar_list *BeVar; + + fprintf( stdout, " > [%ld]\n", BePcs->LINE ); + + if ( BePcs->LABEL != (char *)0 ) + { + fprintf( stdout, "LABEL : %s\n", BePcs->LABEL ); + } + + fprintf( stdout, "TYPE : %x\n", (int)BePcs->TYPE ); + + fprintf( stdout, "VARIABLE\n" ); + + for ( ScanPtype = BePcs->VARIABLE; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + BeVar = (vbvar_list *)ScanPtype->DATA; + + fprintf( stdout, " > [%ld]\n", BeVar->LINE ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BeVar->TYPE ) ); + viewvexexprbound( BeVar->TARGET ); + if ( BeVar->VEX != (vexexpr *)0 ) + { + fprintf( stdout, " := " ); + viewvexexprbound( BeVar->VEX ); + } + fprintf( stdout, "\n" ); + } + + fprintf( stdout, "INSTRUCTION\n" ); + + vbh_viewvbinst( BePcs->INSTRUCTION ); +} + +/*------------------------------------------------------------\ +| | +| View Vbh Gnr | +| | +\------------------------------------------------------------*/ + +static void loc_viewvbgnr( BeGnr ) + + vbgnr_list *BeGnr; +{ + vbins_list *BeIns; + vbpcs_list *BePcs; + + fprintf( stdout, " > [%ld]\n", BeGnr->LINE ); + + if ( BeGnr->LABEL != (char *)0 ) + { + fprintf( stdout, "LABEL : %s\n", BeGnr->LABEL ); + } + + fprintf( stdout, "TYPE : %x\n", (int)BeGnr->TYPE ); + + if ( BeGnr->TYPE == VBH_GENERATE_IF ) + { + fprintf( stdout, "IF (" ); + viewvexexprbound( BeGnr->IF_COND ); + fprintf( stdout, ")" ); + } + else + { + fprintf( stdout, "FOR " ); + viewvexexprbound( BeGnr->FOR_VARIABLE ); + fprintf( stdout, " IN " ); + + viewvexexprbound( BeGnr->FOR_LEFT ); + if ( BeGnr->FOR_UP ) fprintf( stdout, " TO " ); + else fprintf( stdout, " DOWNTO " ); + viewvexexprbound( BeGnr->FOR_RIGHT ); + } + + fprintf( stdout, "\nGENERATE\n" ); + + fprintf( stdout, "BEINS\n" ); + + for ( BeIns = BeGnr->BEINS; + BeIns != (vbins_list *)0; + BeIns = BeIns->NEXT ) + { + loc_viewvbins( BeIns ); + } + + fprintf( stdout, "BEPCS\n" ); + + for ( BePcs = BeGnr->BEPCS; + BePcs != (vbpcs_list *)0; + BePcs = BePcs->NEXT ) + { + loc_viewvbpcs( BePcs ); + } + + fprintf( stdout, "BEGNR\n" ); + + for ( BeGnr = BeGnr->BEGNR; + BeGnr != (vbgnr_list *)0; + BeGnr = BeGnr->NEXT ) + { + loc_viewvbgnr( BeGnr ); + } + + fprintf( stdout, "\nEND GENERATE\n" ); +} + +/*------------------------------------------------------------\ +| | +| View Vbh Figure | +| | +\------------------------------------------------------------*/ + +void vbh_viewvbfig( Figure ) + + vbfig_list *Figure; +{ + vbgnr_list *BeGnr; + vbgen_list *BeGen; + vbins_list *BeIns; + vbmod_list *BeMod; + vbaux_list *BeAux; + vbatr_list *BeAtr; + vbcst_list *BeCst; + vbpor_list *BePor; + vbpcs_list *BePcs; + vbfun_list *BeFun; + vbarg_list *BePar; + vbvar_list *BeVar; + vbtyp_list *BeTyp; + chain_list *ScanPack; + ptype_list *ScanPtype; + + fprintf( stdout, "NAME: %s\n", Figure->NAME ); + fprintf( stdout, "FLAG: %d\n", Figure->FLAG ); + fprintf( stdout, "PACK: %d\n", Figure->PACKAGE ); + + fprintf( stdout, "PACK_LIST\n" ); + + for ( ScanPack = Figure->PACK_LIST; + ScanPack != (chain_list *)0; + ScanPack = ScanPack->NEXT ) + { + fprintf( stdout, "%s\n", (char *)ScanPack->DATA ); + } + + fprintf( stdout, "BETYP\n" ); + + for ( BeTyp = Figure->BETYP; + BeTyp != (vbtyp_list *)0; + BeTyp = BeTyp->NEXT ) + { + vbh_viewvbtyp( BeTyp ); + } + + fprintf( stdout, "BEPOR\n" ); + + for ( BePor = Figure->BEPOR; + BePor != (vbpor_list *)0; + BePor = BePor->NEXT ) + { + loc_viewvbpor( BePor ); + } + + fprintf( stdout, "BEGEN\n" ); + + for ( BeGen = Figure->BEGEN; + BeGen != (vbgen_list *)0; + BeGen = BeGen->NEXT ) + { + loc_viewvbgen( BeGen ); + } + + fprintf( stdout, "BEMOD\n" ); + + for ( BeMod = Figure->BEMOD; + BeMod != (vbmod_list *)0; + BeMod = BeMod->NEXT ) + { + fprintf( stdout, " > [%ld]", BeMod->LINE ); + fprintf( stdout, " NAME %s\n", BeMod->NAME ); + fprintf( stdout, " BEPOR\n" ); + + for ( BePor = BeMod->BEPOR; + BePor != (vbpor_list *)0; + BePor = BePor->NEXT ) + { + loc_viewvbpor( BePor ); + } + + fprintf( stdout, " BEGEN\n" ); + + for ( BeGen = BeMod->BEGEN; + BeGen != (vbgen_list *)0; + BeGen = BeGen->NEXT ) + { + loc_viewvbgen( BeGen ); + } + + fprintf( stdout, "\n" ); + } + + fprintf( stdout, "BEATR\n" ); + + for ( BeAtr = Figure->BEATR; + BeAtr != (vbatr_list *)0; + BeAtr = BeAtr->NEXT ) + { + fprintf( stdout, " > [%ld]", BeAtr->LINE ); + fprintf( stdout, " NAME %s ", BeAtr->NAME ); + fprintf( stdout, " ENTITY %s ", BeAtr->ENTITY ); + fprintf( stdout, " TYPE %d ", BeAtr->TYPE ); + fprintf( stdout, " VALUE %s ", BeAtr->VALUE ); + + fprintf( stdout, "\n" ); + } + + fprintf( stdout, "BECST\n" ); + + for ( BeCst = Figure->BECST; + BeCst != (vbcst_list *)0; + BeCst = BeCst->NEXT ) + { + fprintf( stdout, " > [%ld]", BeCst->LINE ); + viewvexexprbound( BeCst->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BeCst->TYPE ) ); + if ( BeCst->VEX != (vexexpr *)0 ) + { + fprintf( stdout, " := " ); + viewvexexprbound( BeCst->VEX ); + } + fprintf( stdout, "\n" ); + } + + fprintf( stdout, "BEFUN\n" ); + + for ( BeFun = Figure->BEFUN; + BeFun != (vbfun_list *)0; + BeFun = BeFun->NEXT ) + { + fprintf( stdout, " > [%ld]\n", BeFun->LINE ); + fprintf( stdout, " NAME : %s\n", BeFun->NAME ); + fprintf( stdout, " TYPE : %x\n", (int)BeFun->TYPE ); + + fprintf( stdout, "ARGUMENT\n" ); + + for ( BePar = BeFun->ARGUMENT; + BePar != (vbarg_list *)0; + BePar = BePar->NEXT ) + { + fprintf( stdout, " > [%ld]\n", BePar->LINE ); + viewvexexprbound( BePar->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BePar->TYPE ) ); + fprintf( stdout, " DIR %c ", BePar->DIR ); + fprintf( stdout, " CLASS %d ", BePar->CLASS ); + fprintf( stdout, "\n" ); + } + + if ( BeFun->RETURN != (vbarg_list *)0 ) + { + BePar = BeFun->RETURN; + + fprintf( stdout, " > [%ld]\n", BePar->LINE ); + fprintf( stdout, "RETURN\n" ); + + fprintf( stdout, " < " ); + viewvexexprbound( BePar->TARGET ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BePar->TYPE ) ); + fprintf( stdout, "\n" ); + } + + fprintf( stdout, "VARIABLE\n" ); + + for ( ScanPtype = BeFun->VARIABLE; + ScanPtype != (ptype_list *)0; + ScanPtype = ScanPtype->NEXT ) + { + BeVar = (vbvar_list *)ScanPtype->DATA; + + fprintf( stdout, " > [%ld]\n", BeVar->LINE ); + fprintf( stdout, " TYPE %s ", loc_getvbhtypename( BeVar->TYPE ) ); + viewvexexprbound( BeVar->TARGET ); + if ( BeVar->VEX != (vexexpr *)0 ) + { + fprintf( stdout, " := " ); + viewvexexprbound( BeVar->VEX ); + } + fprintf( stdout, "\n" ); + } + + fprintf( stdout, "INSTRUCTION\n" ); + + vbh_viewvbinst( BeFun->INSTRUCTION ); + } + + fprintf( stdout, "BEINS\n" ); + + for ( BeIns = Figure->BEINS; + BeIns != (vbins_list *)0; + BeIns = BeIns->NEXT ) + { + loc_viewvbins( BeIns ); + } + + fprintf( stdout, "BEAUX\n" ); + + for ( BeAux = Figure->BEAUX; + BeAux != (vbaux_list *)0; + BeAux = BeAux->NEXT ) + { + loc_viewvbaux( BeAux ); + } + + fprintf( stdout, "BEPCS\n" ); + + for ( BePcs = Figure->BEPCS; + BePcs != (vbpcs_list *)0; + BePcs = BePcs->NEXT ) + { + loc_viewvbpcs( BePcs ); + } + + fprintf( stdout, "BEGNR\n" ); + + for ( BeGnr = Figure->BEGNR; + BeGnr != (vbgnr_list *)0; + BeGnr = BeGnr->NEXT ) + { + loc_viewvbgnr( BeGnr ); + } +} diff --git a/alliance/src/vpd/Makefile.am b/alliance/src/vpd/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/vpd/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/vpd/configure.in b/alliance/src/vpd/configure.in new file mode 100644 index 00000000..2d3d4e87 --- /dev/null +++ b/alliance/src/vpd/configure.in @@ -0,0 +1,45 @@ +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/21 12:45:09 ludo Exp $ +dnl +dnl +AC_INIT(src/vpd.h) +AM_INIT_AUTOMAKE(vpd, 1.5) +AC_PROG_INSTALL +AC_PROG_CC +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/vpd/src/Makefile.am b/alliance/src/vpd/src/Makefile.am new file mode 100644 index 00000000..1ab537ad --- /dev/null +++ b/alliance/src/vpd/src/Makefile.am @@ -0,0 +1,7 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libVpd.a +include_HEADERS = vpd.h +libVpd_a_SOURCES = \ +vpd.h vpd_drive.h vpd_error.h vpd_parse.h \ +vpd_drive.c vpd_error.c vpd_parse.c diff --git a/alliance/src/vpd/src/vpd.h b/alliance/src/vpd/src/vpd.h new file mode 100644 index 00000000..6b959424 --- /dev/null +++ b/alliance/src/vpd/src/vpd.h @@ -0,0 +1,68 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------\ +| | +| Title : Structures and fonctions for VPD | +| | +| Date : 07.04.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------*/ + +# ifndef VPD_105_H +# define VPD_105_H + +/*------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Structures | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpd/src/vpd_drive.c b/alliance/src/vpd/src/vpd_drive.c new file mode 100644 index 00000000..afd8fd33 --- /dev/null +++ b/alliance/src/vpd/src/vpd_drive.c @@ -0,0 +1,715 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : VPD | +| | +| File : vpd_drive.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include +# include + +# include "vpd_error.h" +# include "vpd_drive.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *VpnFile; + static long VpnExprLength; + static char VpnBuffer[ 128 ]; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| VpnWriteNameFile | +| | +\------------------------------------------------------------*/ + +static void VpnWriteNameFile( Name ) + + char *Name; +{ + int Length; + + Length = strlen( Name ); + + VpnExprLength += Length; + + if ( VpnExprLength > 80 ) + { + fprintf( VpnFile, "\n" ); + VpnExprLength = Length; + } + + fprintf( VpnFile, Name ); +} + +/*------------------------------------------------------------\ +| | +| VpnWriteExprPrefix | +| | +\------------------------------------------------------------*/ + +static void VpnWriteExprPrefix( Expr ) + + vexexpr *Expr; +{ + char *Name; + chain_list *ScanOper; + + if ( IsVexNodeAtom( Expr ) ) + { + sprintf( VpnBuffer, "{%d,%d,%x}%s", + Expr->LEFT, Expr->RIGHT, Expr->TYPE, GetVexAtomValue( Expr ) ); + VpnWriteNameFile( VpnBuffer ); + } + else + { + if ( IsVexNodeOper( Expr ) ) + { + Name = getvexoperuppername( GetVexOperValue( Expr ) ); + } + else + { + Name = GetVexFuncValue( Expr ); + } + + sprintf( VpnBuffer, "({%d,%d,%x}%s", + Expr->LEFT, Expr->RIGHT, Expr->TYPE, Name ); + VpnWriteNameFile( VpnBuffer ); + + for ( ScanOper = Expr->OPERAND; + ScanOper != (chain_list *)0; + ScanOper = ScanOper->NEXT ) + { + VpnWriteNameFile( "~" ); + VpnWriteExprPrefix( GetVexOperand( ScanOper ) ); + } + + VpnWriteNameFile( ")" ); + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteExpr | +| | +\------------------------------------------------------------*/ + +static void VpnWriteExpr( Label, Expr ) + + char *Label; + vexexpr *Expr; +{ + if ( Expr != (vexexpr *)0 ) + { + VpnExprLength = 0; + + fprintf( VpnFile, "%s\t\n", Label ); + VpnWriteExprPrefix( Expr ); + fprintf( VpnFile, "\n" ); + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteLine | +| | +\------------------------------------------------------------*/ + +static void VpnWriteLine( Line ) + + vpnline_list *Line; +{ + while ( Line != (vpnline_list *)0 ) + { + if ( Line->NAME == (char *)0 ) + { + fprintf( VpnFile, "LINE\t%ld\t\n", Line->LINE ); + } + else + { + fprintf( VpnFile, "LINE\t%ld\t%s\n", Line->LINE, Line->NAME ); + } + + Line = Line->NEXT; + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteOneSymbol | +| | +\------------------------------------------------------------*/ + +static void VpnWriteOneSymbol( VpnSymbol ) + + vpnsym *VpnSymbol; +{ + fprintf( VpnFile, "SYMBOL\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld\t%s\n", + (long)VpnSymbol->INDEX, + (long)VpnSymbol->INIT, + (long)VpnSymbol->DRIVE, + (long)VpnSymbol->EFFEC, + (long)VpnSymbol->EVENT, + (long)VpnSymbol->FLAGS, + VpnSymbol->NAME ); +} + +/*------------------------------------------------------------\ +| | +| VpnWriteOneDeclar | +| | +\------------------------------------------------------------*/ + +static void VpnWriteOneDeclar( VpnDeclar ) + + vpndecl_list *VpnDeclar; +{ + int Width; + int Scan; + + fprintf( VpnFile, "DECLAR\t%ld\t%ld\t%ld\t%ld\t%ld\t%ld", + (long)VpnDeclar->DIR, + (long)VpnDeclar->TYPE, + (long)VpnDeclar->KIND, + (long)VpnDeclar->CLASS, + (long)VpnDeclar->BASE, + (long)VpnDeclar->FLAGS ); + + VpnWriteExpr( "", VpnDeclar->VEX_ATOM ); + VpnWriteExpr( "INIT", VpnDeclar->VEX_INIT ); + VpnWriteLine( VpnDeclar->LINE ); + + Width = VpnDeclar->VEX_ATOM->WIDTH; + + for ( Scan = 0; Scan < Width; Scan++ ) + { + VpnWriteOneSymbol( &VpnDeclar->DECL_SYM[ Scan ] ); + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteDeclar | +| | +\------------------------------------------------------------*/ + +static void VpnWriteDeclar( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpndecl_list *ScanDeclar; + chain_list *ScanChain; + int Type; + + for ( Type = 0; Type < VPN_MAX_DECLAR_TYPE; Type++ ) + { + if ( ( Type != VPN_DECLAR_PORT ) && + ( Type != VPN_DECLAR_CONSTANT ) && + ( Type != VPN_DECLAR_SIGNAL ) ) continue; + + for ( ScanDeclar = VpnFigure->DECLAR[ Type ]; + ScanDeclar != (vpndecl_list *)0; + ScanDeclar = ScanDeclar->NEXT ) + { + VpnWriteOneDeclar( ScanDeclar); + } + } + + for ( ScanChain = VpnFigure->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDeclar = (vpndecl_list *)ScanChain->DATA; + VpnWriteOneDeclar( ScanDeclar); + } + + for ( ScanChain = VpnFigure->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDeclar = (vpndecl_list *)ScanChain->DATA; + VpnWriteOneDeclar( ScanDeclar); + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteAttribute | +| | +\------------------------------------------------------------*/ + +static void VpnWriteAttribute( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpnattr_list *ScanAttr; + + for ( ScanAttr = VpnFigure->ATTRIBUTE; + ScanAttr != (vpnattr_list *)0; + ScanAttr = ScanAttr->NEXT ) + { + fprintf( VpnFile, "ATTR\t%ld\t%ld\t%s\n", + (long)ScanAttr->TYPE, + (long)ScanAttr->FLAGS, + ScanAttr->NAME ); + + fprintf( VpnFile, "ATTR_ENT\t%s\t%s\n", + ScanAttr->VALUE, + ScanAttr->ENTITY ); + + VpnWriteLine( ScanAttr->LINE ); + } +} + +/*------------------------------------------------------------\ +| | +| VpnWritePlace | +| | +\------------------------------------------------------------*/ + +static void VpnWritePlace( VpnPlace ) + + vpnplace_list *VpnPlace; +{ + vpnplace_list *ScanPlace; + + for ( ScanPlace = VpnPlace; + ScanPlace != (vpnplace_list *)0; + ScanPlace = ScanPlace->NEXT ) + { + fprintf( VpnFile, "PLACE\t%ld\t%ld\t%ld\t%ld\t%s\n", + (long)ScanPlace->FATHER, + (long)ScanPlace->TYPE, + (long)ScanPlace->TOKEN, + (long)ScanPlace->FLAGS, + ScanPlace->NAME ); + + if ( ScanPlace->LINK != (vpnplace_list *)0 ) + { + fprintf( VpnFile, "LINK\t%s\n", ScanPlace->LINK->NAME ); + } + + VpnWriteLine( ScanPlace->LINE ); + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteTrans | +| | +\------------------------------------------------------------*/ + +static void VpnWriteTrans( VpnTrans ) + + vpntrans_list *VpnTrans; +{ + vpntrans_list *ScanTrans; + vpnplace_list *ScanPlace; + vpnact_list *ScanAct; + vpnsym *ScanSymbol; + vpnarc *ScanArc; + chain_list *ScanChain; + + for ( ScanTrans = VpnTrans; + ScanTrans != (vpntrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + fprintf( VpnFile, "TRANS\t%ld\t%ld\t%ld\t%s\n", + (long)ScanTrans->FATHER, + (long)ScanTrans->TYPE, + (long)ScanTrans->FLAGS, + ScanTrans->NAME ); + + VpnWriteExpr( "GUARD", ScanTrans->VEX_GUARD ); + + for ( ScanChain = ScanTrans->WAIT_SYM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanSymbol = (vpnsym *)ScanChain->DATA; + + fprintf( VpnFile, "WAIT\t%ld\t%s\n", + (long)ScanSymbol->INDEX, + ScanSymbol->NAME ); + } + + for ( ScanAct = ScanTrans->ACT; + ScanAct != (vpnact_list *)0; + ScanAct = ScanAct->NEXT ) + { + fprintf( VpnFile, "ACT\t%ld\t%ld\n", + (long)ScanAct->TYPE, + (long)ScanAct->FLAGS ); + + VpnWriteExpr( "ACT_ATOM", ScanAct->VEX_ATOM ); + VpnWriteExpr( "ACT_EXPR", ScanAct->VEX_EXPR ); + + VpnWriteLine( ScanAct->LINE ); + } + + for ( ScanChain = ScanTrans->PLACE_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + ScanPlace = (vpnplace_list *)ScanArc->TARGET; + + fprintf( VpnFile, "ARC_OUT\t%ld\t%ld\t%s\n", + (long)ScanArc->TYPE, + (long)ScanArc->FLAGS, + ScanPlace->NAME ); + } + + for ( ScanChain = ScanTrans->PLACE_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + ScanPlace = (vpnplace_list *)ScanArc->SOURCE; + + fprintf( VpnFile, "ARC_IN\t%ld\t%ld\t%s\n", + (long)ScanArc->TYPE, + (long)ScanArc->FLAGS, + ScanPlace->NAME ); + } + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteProcess | +| | +\------------------------------------------------------------*/ + +static void VpnWriteProcess( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpnproc_list *ScanProc; + vpndecl_list *ScanDeclar; + chain_list *ScanChain; + + for ( ScanProc = VpnFigure->PROCESS; + ScanProc != (vpnproc_list *)0; + ScanProc = ScanProc->NEXT ) + { + fprintf( VpnFile, "PROCESS\t%ld\t%ld\t%s\n", + (long)ScanProc->TYPE, + (long)ScanProc->FLAGS, + ScanProc->NAME ); + + VpnWriteLine( ScanProc->LINE ); + + for ( ScanChain = ScanProc->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDeclar = (vpndecl_list *)ScanChain->DATA; + VpnWriteOneDeclar( ScanDeclar ); + } + + for ( ScanChain = ScanProc->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDeclar = (vpndecl_list *)ScanChain->DATA; + VpnWriteOneDeclar( ScanDeclar ); + } + + VpnWritePlace( ScanProc->PLACE ); + VpnWriteTrans( ScanProc->TRANS ); + + if ( ScanProc->FIRST != (vpntrans_list *)0 ) + { + fprintf( VpnFile, "FIRST\t%s\n", ScanProc->FIRST->NAME ); + } + + if ( ScanProc->ELABO != (vpntrans_list *)0 ) + { + fprintf( VpnFile, "ELABO\t%s\n", ScanProc->ELABO->NAME ); + } + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteFunction | +| | +\------------------------------------------------------------*/ + +static void VpnWriteFunction( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpnfunc_list *ScanFunc; + vpndecl_list *ScanDeclar; + chain_list *ScanChain; + + for ( ScanFunc = VpnFigure->FUNCTION; + ScanFunc != (vpnfunc_list *)0; + ScanFunc = ScanFunc->NEXT ) + { + fprintf( VpnFile, "FUNCTION\t%ld\t%ld\t%s\n", + (long)ScanFunc->TYPE, + (long)ScanFunc->FLAGS, + ScanFunc->NAME ); + + if ( ScanFunc->VEX_RET != (vexexpr *)0 ) + { + VpnWriteExpr( "RET", ScanFunc->VEX_RET ); + } + + VpnWriteLine( ScanFunc->LINE ); + + for ( ScanChain = ScanFunc->ARG_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDeclar = (vpndecl_list *)ScanChain->DATA; + VpnWriteOneDeclar( ScanDeclar ); + } + + for ( ScanChain = ScanFunc->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDeclar = (vpndecl_list *)ScanChain->DATA; + VpnWriteOneDeclar( ScanDeclar ); + } + + for ( ScanChain = ScanFunc->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDeclar = (vpndecl_list *)ScanChain->DATA; + VpnWriteOneDeclar( ScanDeclar ); + } + + VpnWritePlace( ScanFunc->PLACE ); + VpnWriteTrans( ScanFunc->TRANS ); + + if ( ScanFunc->FIRST != (vpntrans_list *)0 ) + { + fprintf( VpnFile, "FIRST\t%s\n", ScanFunc->FIRST->NAME ); + } + + if ( ScanFunc->ELABO != (vpntrans_list *)0 ) + { + fprintf( VpnFile, "ELABO\t%s\n", ScanFunc->ELABO->NAME ); + } + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteModel | +| | +\------------------------------------------------------------*/ + +static void VpnWriteModel( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpnmod_list *ScanMod; + vpnport_list *ScanPort; + vpngen_list *ScanGen; + + for ( ScanMod = VpnFigure->MODEL; + ScanMod != (vpnmod_list *)0; + ScanMod = ScanMod->NEXT ) + { + fprintf( VpnFile, "MODEL\t%ld\t%s\n", + (long)ScanMod->FLAGS, + ScanMod->NAME ); + + VpnWriteLine( ScanMod->LINE ); + + for ( ScanPort = ScanMod->PORT; + ScanPort != (vpnport_list *)0; + ScanPort = ScanPort->NEXT ) + { + fprintf( VpnFile, "PORT\t%ld\t%ld\t%ld", + (long)ScanPort->DIR, + (long)ScanPort->BASE, + (long)ScanPort->FLAGS ); + + VpnWriteExpr( "", ScanPort->VEX_ATOM ); + VpnWriteLine( ScanPort->LINE ); + } + + for ( ScanGen = ScanMod->GENERIC; + ScanGen != (vpngen_list *)0; + ScanGen = ScanGen->NEXT ) + { + fprintf( VpnFile, "GEN_MOD\t%ld\t%ld\t", + (long)ScanGen->BASE, + (long)ScanGen->FLAGS ); + + VpnWriteExpr( "", ScanGen->VEX_ATOM ); + + VpnWriteExpr( "GEN_EXPR", ScanGen->VEX_EXPR ); + + VpnWriteLine( ScanGen->LINE ); + } + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteInstance | +| | +\------------------------------------------------------------*/ + +static void VpnWriteInstance( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpnins_list *ScanIns; + vpnmap_list *ScanMap; + vpngen_list *ScanGen; + + for ( ScanIns = VpnFigure->INSTANCE; + ScanIns != (vpnins_list *)0; + ScanIns = ScanIns->NEXT ) + { + fprintf( VpnFile, "INSTANCE\t%ld\t%s\n", + (long)ScanIns->FLAGS, + ScanIns->NAME ); + + fprintf( VpnFile, "INS_MOD\t%s\n", ScanIns->MODEL->NAME ); + + VpnWriteLine( ScanIns->LINE ); + + for ( ScanMap = ScanIns->MAP; + ScanMap != (vpnmap_list *)0; + ScanMap = ScanMap->NEXT ) + { + fprintf( VpnFile, "MAP\t%ld\n", (long)ScanMap->FLAGS ); + + VpnWriteExpr( "MAP_FOR", ScanMap->VEX_FORMAL ); + VpnWriteExpr( "MAP_ACT", ScanMap->VEX_ACTUAL ); + + VpnWriteLine( ScanMap->LINE ); + } + + for ( ScanGen = ScanIns->GENERIC; + ScanGen != (vpngen_list *)0; + ScanGen = ScanGen->NEXT ) + { + fprintf( VpnFile, "GEN_MAP\t%ld\t%ld\t", + (long)ScanGen->BASE, + (long)ScanGen->FLAGS ); + + VpnWriteExpr( "", ScanGen->VEX_ATOM ); + + VpnWriteExpr( "GEN_EXPR", ScanGen->VEX_EXPR ); + + VpnWriteLine( ScanGen->LINE ); + } + } +} + +/*------------------------------------------------------------\ +| | +| VpnWriteFigure | +| | +\------------------------------------------------------------*/ + +static void VpnWriteFigure( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + fprintf( VpnFile, "FIGURE\t%ld\t%s\n", + (long)VpnFigure->FLAGS, + VpnFigure->NAME ); + + VpnWriteDeclar( VpnFigure ); + VpnWriteProcess( VpnFigure ); + VpnWriteFunction( VpnFigure ); + VpnWriteAttribute( VpnFigure ); + VpnWriteModel( VpnFigure ); + VpnWriteInstance( VpnFigure ); +} + +/*------------------------------------------------------------\ +| | +| vpnsavevpnfig | +| | +\------------------------------------------------------------*/ + +void vpnsavevpnfig( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + VpnFile = mbkfopen( VpnFigure->NAME, "vpn", "w" ); + + if ( VpnFile == (FILE *)0 ) + { + vpderror( VPD_ERROR_OPEN_FILE, VpnFigure->NAME, 0 ); + } + + VpnWriteFigure( VpnFigure ); + + fclose( VpnFile ); +} diff --git a/alliance/src/vpd/src/vpd_drive.h b/alliance/src/vpd/src/vpd_drive.h new file mode 100644 index 00000000..90415f6b --- /dev/null +++ b/alliance/src/vpd/src/vpd_drive.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : VPD | +| | +| File : vpddrive.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ + +# ifndef VPD_DRIVE_H +# define VPD_DRIVE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpd/src/vpd_error.c b/alliance/src/vpd/src/vpd_error.c new file mode 100644 index 00000000..df34498a --- /dev/null +++ b/alliance/src/vpd/src/vpd_error.c @@ -0,0 +1,124 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : VPD | +| | +| File : vpd_error.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" + +# include "vpd_error.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +void vpd_error( Error, Text, Value, File, Line ) + + int Error; + char *Text; + long Value; + char *File; + int Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%d ", Name, Line ); + + switch( Error ) + { + case VPD_ERROR_OPEN_FILE : + fprintf( stderr, "Unable to open file \"%s\"\n", Text ); + break; + case VPD_ERROR_PARSE_FILE : + fprintf( stderr, "Unable to parse file \"%s\" line %ld\n", Text, Value ); + break; + default : + fprintf( stderr, "Internal error number %d\n", Error ); + } + + autexit( 1 ); +} + +void vpd_warning( Warning, Text, Value, File, Line ) + + int Warning; + char *Text; + long Value; + char *File; + int Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%d ", Name, Line ); + + switch ( Warning ) + { + default : + fprintf( stderr, "Internal warning number %d\n", Warning ); + } +} diff --git a/alliance/src/vpd/src/vpd_error.h b/alliance/src/vpd/src/vpd_error.h new file mode 100644 index 00000000..66754c96 --- /dev/null +++ b/alliance/src/vpd/src/vpd_error.h @@ -0,0 +1,91 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : VPD | +| | +| File : vpderror.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ + +# ifndef VPD_ERROR_H +# define VPD_ERROR_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define VPD_ERROR_OPEN_FILE 1 +# define VPD_ERROR_PARSE_FILE 2 + +/*------------------------------------------------------------\ +| | +| Warnings | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ + +# define vpderror( E, T, V ) (vpd_error ( (E), (T), (V), __FILE__, __LINE__ )) +# define vpdwarning( E, T, V ) (vpd_warning( (E), (T), (V), __FILE__, __LINE__ )) + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void vpd_error __P((int Error, char *Text, long Value, char *File, int Line)); + extern void vpd_warning __P((int Warning, char *Text, long Value, char *File, int Line)); + +# endif diff --git a/alliance/src/vpd/src/vpd_parse.c b/alliance/src/vpd/src/vpd_parse.c new file mode 100644 index 00000000..eb9385ee --- /dev/null +++ b/alliance/src/vpd/src/vpd_parse.c @@ -0,0 +1,1001 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : VPD | +| | +| File : vpd_parse.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include +# include + +# include "vpd_error.h" +# include "vpd_parse.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + static FILE *VpnFile; + static char VpnBuffer[ 512 ]; + static long VpnLine; + + static char *VpnKeyFigure = (char *)0; + static char *VpnKeyDeclar = (char *)0; + static char *VpnKeyAttr = (char *)0; + static char *VpnKeyAttrEnt = (char *)0; + static char *VpnKeyInit = (char *)0; + static char *VpnKeySymbol = (char *)0; + static char *VpnKeyProcess = (char *)0; + static char *VpnKeyFunction = (char *)0; + static char *VpnKeyPlace = (char *)0; + static char *VpnKeyLink = (char *)0; + static char *VpnKeyLine = (char *)0; + static char *VpnKeyTrans = (char *)0; + static char *VpnKeyGuard = (char *)0; + static char *VpnKeyWait = (char *)0; + static char *VpnKeyAct = (char *)0; + static char *VpnKeyActExpr = (char *)0; + static char *VpnKeyActAtom = (char *)0; + static char *VpnKeyRet = (char *)0; + static char *VpnKeyArcOut = (char *)0; + static char *VpnKeyArcIn = (char *)0; + static char *VpnKeyFirst = (char *)0; + static char *VpnKeyElabo = (char *)0; + static char *VpnKeyInstance = (char *)0; + static char *VpnKeyInsMod = (char *)0; + static char *VpnKeyMap = (char *)0; + static char *VpnKeyMapFor = (char *)0; + static char *VpnKeyMapAct = (char *)0; + static char *VpnKeyModel = (char *)0; + static char *VpnKeyPort = (char *)0; + static char *VpnKeyGenMod = (char *)0; + static char *VpnKeyGenMap = (char *)0; + static char *VpnKeyGenExpr = (char *)0; + + static char *VpnScanString = (char *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| VpnInitKeyword | +| | +\------------------------------------------------------------*/ + +static void VpnInitKeyword() +{ + if ( VpnKeyFigure == (char *)0 ) + { + VpnKeyFigure = namealloc( "FIGURE" ); + VpnKeyDeclar = namealloc( "DECLAR" ); + VpnKeyAttr = namealloc( "ATTR" ); + VpnKeyAttrEnt = namealloc( "ATTR_ENT" ); + VpnKeyInit = namealloc( "INIT" ); + VpnKeySymbol = namealloc( "SYMBOL" ); + VpnKeyProcess = namealloc( "PROCESS" ); + VpnKeyFunction = namealloc( "FUNCTION" ); + VpnKeyPlace = namealloc( "PLACE" ); + VpnKeyLink = namealloc( "LINK" ); + VpnKeyLine = namealloc( "LINE" ); + VpnKeyTrans = namealloc( "TRANS" ); + VpnKeyGuard = namealloc( "GUARD" ); + VpnKeyWait = namealloc( "WAIT" ); + VpnKeyAct = namealloc( "ACT" ); + VpnKeyActExpr = namealloc( "ACT_EXPR" ); + VpnKeyActAtom = namealloc( "ACT_ATOM" ); + VpnKeyRet = namealloc( "RET" ); + VpnKeyArcOut = namealloc( "ARC_OUT" ); + VpnKeyArcIn = namealloc( "ARC_IN" ); + VpnKeyFirst = namealloc( "FIRST" ); + VpnKeyElabo = namealloc( "ELABO" ); + VpnKeyInstance = namealloc( "INSTANCE" ); + VpnKeyInsMod = namealloc( "INS_MOD" ); + VpnKeyMap = namealloc( "MAP" ); + VpnKeyMapFor = namealloc( "MAP_FOR" ); + VpnKeyMapAct = namealloc( "MAP_ACT" ); + VpnKeyModel = namealloc( "MODEL" ); + VpnKeyPort = namealloc( "PORT" ); + VpnKeyGenMap = namealloc( "GEN_MAP" ); + VpnKeyGenMod = namealloc( "GEN_MOD" ); + VpnKeyGenExpr = namealloc( "GEN_EXPR" ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Read Name File | +| | +\------------------------------------------------------------*/ + +static char *VpnReadNameFile( Line ) + + long Line; +{ + char *Name; + char SaveChar; + + while ( ( VpnScanString == (char *)0 ) || + ( *VpnScanString == '\0' ) || + ( *VpnScanString == '\n' ) ) + { + if ( fgets( VpnBuffer, 512, VpnFile ) == (char *)0 ) + { + return( (char *)0 ); + } + + VpnScanString = VpnBuffer; + VpnLine = VpnLine + 1; + } + + if ( ( *VpnScanString == '~' ) || + ( *VpnScanString == '(' ) || + ( *VpnScanString == ')' ) ) + { + return( VpnScanString ); + } + + Name = VpnScanString; + + while ( ( *VpnScanString != '~' ) && + ( *VpnScanString != ')' ) && + ( *VpnScanString != '\0' ) && + ( *VpnScanString != '\n' ) ) + { + VpnScanString = VpnScanString + 1; + } + + SaveChar = *VpnScanString; + *VpnScanString = '\0'; + Name = namealloc( Name ); + *VpnScanString = SaveChar; + + return( Name ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Read Prefix Expr | +| | +\------------------------------------------------------------*/ + +static vexexpr *VpnReadPrefixExpr() +{ + vexexpr *Expr; + chain_list **PrevOper; + chain_list *ScanOper; + vexexpr *ExprStr; + char *Name; + char *Scan; + long Oper; + long Left; + long Right; + long Type; + + Scan = VpnReadNameFile(); + + if ( ( Scan == (char *)0 ) || + ( *Scan == '~' ) || + ( *Scan == ')' ) ) + { + return( (vexexpr *)0 ); + } + + if ( *VpnScanString == '(' ) + { + VpnScanString = VpnScanString + 1; + Name = VpnReadNameFile(); + + if ( ( Name == (char *)0 ) || + ( Name[ 0 ] != '{' ) ) + { + return( (vexexpr *)0 ); + } + + Scan = strchr( Name, '}' ); + + if ( Scan == (char *)0 ) + { + return( (vexexpr *)0 ); + } + + sscanf( Name, "{%ld,%ld,%lx}", &Left, &Right, &Type ); + Name = Scan + 1; + + Oper = getvexoperbyname( Name ); + Scan = VpnReadNameFile(); + + if ( Scan == (char *)0 ) + { + return( (vexexpr *)0 ); + } + + if ( *VpnScanString == ')' ) + { + if ( Oper == -1 ) + { + Expr = createvexatomvec( Name, Left, Right ); + Expr->TYPE = Type; + } + else + { + return( (vexexpr *)0 ); + } + } + else + if ( *VpnScanString == '~' ) + { + VpnScanString = VpnScanString + 1; + + if ( Oper == -1 ) + { + Expr = createvexfunc( Name, 0 ); + } + else + { + Expr = createvexoper( Oper, 0 ); + } + + Expr->LEFT = Left; + Expr->RIGHT = Right; + Expr->TYPE = Type; + + if ( Left > Right ) Expr->WIDTH = ( Left - Right ) + 1; + else Expr->WIDTH = ( Right - Left ) + 1; + + PrevOper = &Expr->OPERAND; + + do + { + ExprStr = VpnReadPrefixExpr(); + + if ( ExprStr == (vexexpr *)0 ) + { + freevexexpr( Expr ); + return( (vexexpr *)0 ); + } + + ScanOper = addchain( (chain_list *)0, (void *)ExprStr ); + *PrevOper = ScanOper; + PrevOper = &ScanOper->NEXT; + + Scan = VpnReadNameFile(); + + if ( Scan == (char *)0 ) + { + freevexexpr( Expr ); + return( (vexexpr *)0 ); + } + + if ( *VpnScanString == '~' ) + { + VpnScanString = VpnScanString + 1; + } + } + while ( *VpnScanString != ')'); + } + else + { + return( (vexexpr *)0 ); + } + + if ( *VpnScanString == ')' ) + { + VpnScanString = VpnScanString + 1; + } + else + { + freevexexpr( Expr ); + return( (vexexpr *)0 ); + } + } + else + { + Name = Scan; + + if ( ( Name == (char *)0 ) || + ( Name[ 0 ] != '{' ) ) + { + return( (vexexpr *)0 ); + } + + Scan = strchr( Name, '}' ); + + if ( Scan == (char *)0 ) + { + return( (vexexpr *)0 ); + } + + sscanf( Name, "{%ld,%ld,%lx}", &Left, &Right, &Type ); + Name = Scan + 1; + + Oper = getvexoperbyname( Name ); + + if ( Oper == -1 ) + { + Expr = createvexatomvec( Name, Left, Right ); + Expr->TYPE = Type; + } + else + { + return( (vexexpr *)0 ); + } + } + + return( Expr ); +} + +/*------------------------------------------------------------\ +| | +| VpnReadExpr | +| | +\------------------------------------------------------------*/ + +static vexexpr *VpnReadExpr() +{ + VpnScanString = (char *)0; + + return( VpnReadPrefixExpr() ); +} + +/*------------------------------------------------------------\ +| | +| VpnLoadFigure | +| | +\------------------------------------------------------------*/ + +static int VpnLoadFigure( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpndecl_list *VpnDeclar; + vpnattr_list *VpnAttr; + vpnproc_list *VpnProc; + vpnfunc_list *VpnFunc; + vpntrans_list *VpnTrans; + vpnplace_list *VpnPlace; + vpnplace_list *VpnLink; + vpnact_list *VpnAct; + vpngen_list *VpnGen; + vpnline_list **VpnPrevLine; + vpnsym *VpnSymbol; + vpnarc *VpnArc; + vpnmod_list *VpnModel; + vpnport_list *VpnPort; + vpnins_list *VpnInst; + vpnmap_list *VpnMap; + vexexpr *Expr; + vexexpr *Atom; + char *ScanBuffer; + char *Keyword; + char *Name; + int Index; + int Length; + int Error; + long Value1; + long Value2; + long Value3; + long Value4; + long Value5; + long Value6; + + VpnInitKeyword(); + + VpnDeclar = (vpndecl_list *)0; + VpnAttr = (vpnattr_list *)0; + VpnSymbol = (vpnsym *)0; + VpnProc = (vpnproc_list *)0; + VpnFunc = (vpnfunc_list *)0; + VpnTrans = (vpntrans_list *)0; + VpnPlace = (vpnplace_list *)0; + VpnAct = (vpnact_list *)0; + VpnArc = (vpnarc *)0; + VpnModel = (vpnmod_list *)0; + VpnPort = (vpnport_list *)0; + VpnInst = (vpnins_list *)0; + VpnMap = (vpnmap_list *)0; + VpnGen = (vpngen_list *)0; + + VpnLine = 0; + VpnPrevLine = (vpnline_list **)0; + + while ( fgets( VpnBuffer, 512, VpnFile ) != (char *)0 ) + { + VpnLine = VpnLine + 1; + + if ( ( VpnBuffer[ 0 ] == '#' ) || + ( VpnBuffer[ 0 ] == '\0' ) || + ( VpnBuffer[ 0 ] == '\n' ) ) continue; + + Length = strlen( VpnBuffer ); + if ( VpnBuffer[ Length - 1 ] == '\n' ) + { + Length = Length - 1; + VpnBuffer[ Length ] = '\0'; + } + + for ( Index = Length; Index >= 0; Index-- ) + { + if ( VpnBuffer[ Index ] == '\t' ) break; + } + + if ( Index < 0 ) return( 1 ); + Name = &VpnBuffer[ Index + 1 ]; + + ScanBuffer = strchr( VpnBuffer, '\t' ); + if ( ScanBuffer == (char *)0 ) return( 1 ); + + *ScanBuffer = '\0'; + Keyword = namealloc( VpnBuffer ); + ScanBuffer = ScanBuffer + 1; + + if ( Keyword == VpnKeyPlace ) + { + Error = 4 - sscanf( ScanBuffer, "%ld\t%ld\t%ld\t%ld", + &Value1, &Value2, &Value3, &Value4 ); + + if ( Error ) return( 1 ); + + VpnPlace = searchvpnplace( VpnFigure, Name ); + + if ( VpnPlace == (vpnplace_list *)0 ) + { + if ( VpnFunc == (vpnfunc_list *)0 ) + { + VpnPlace = addvpnprocplace( VpnFigure, VpnProc, Name ); + } + else + { + VpnPlace = addvpnfuncplace( VpnFigure, VpnFunc, Name ); + } + } + + VpnPlace->FATHER = Value1; + VpnPlace->TYPE = Value2; + VpnPlace->TOKEN = Value3; + VpnPlace->FLAGS = Value4; + + VpnPrevLine = &VpnPlace->LINE; + } + else + if ( Keyword == VpnKeyLink ) + { + VpnLink = searchvpnplace( VpnFigure, Name ); + + if ( VpnLink == (vpnplace_list *)0 ) + { + if ( VpnFunc == (vpnfunc_list *)0 ) + { + VpnLink = addvpnprocplace( VpnFigure, VpnProc, Name ); + } + else + { + VpnLink = addvpnfuncplace( VpnFigure, VpnFunc, Name ); + } + } + + VpnPlace->LINK = VpnLink; + } + else + if ( Keyword == VpnKeyLine ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + if ( Name[ 0 ] != '\0' ) + { + addvpnfileline( VpnFigure, VpnPrevLine, Name, Value1 ); + } + else + { + addvpnline( VpnFigure, VpnPrevLine, Value1 ); + } + } + else + if ( Keyword == VpnKeyTrans ) + { + Error = 3 - sscanf( ScanBuffer, "%ld\t%ld\t%ld", + &Value1, &Value2, &Value3 ); + + if ( Error ) return( 1 ); + + if ( VpnFunc == (vpnfunc_list *)0 ) + { + VpnTrans = addvpnproctrans( VpnFigure, VpnProc, Name ); + } + else + { + VpnTrans = addvpnfunctrans( VpnFigure, VpnFunc, Name ); + } + + VpnTrans->FATHER = Value1; + VpnTrans->TYPE = Value2; + VpnTrans->FLAGS = Value3; + } + else + if ( Keyword == VpnKeyAct ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", + &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + VpnAct = addvpnact( VpnFigure, VpnTrans, (vexexpr *)0, (vexexpr *)0, Value1 ); + VpnAct->FLAGS = Value2; + + VpnPrevLine = &VpnAct->LINE; + } + else + if ( Keyword == VpnKeyActExpr ) + { + Expr = VpnReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + VpnAct->VEX_EXPR = Expr; + } + else + if ( Keyword == VpnKeyActAtom ) + { + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + VpnAct->VEX_ATOM = Atom; + } + else + if ( Keyword == VpnKeyArcIn ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", + &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + VpnPlace = searchvpnplace( VpnFigure, Name ); + VpnArc = addvpnarcplace( VpnFigure, VpnPlace, VpnTrans ); + + VpnArc->TYPE = Value1; + VpnArc->FLAGS = Value2; + } + else + if ( Keyword == VpnKeyArcOut ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", + &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + VpnPlace = searchvpnplace( VpnFigure, Name ); + VpnArc = addvpnarctrans( VpnFigure, VpnTrans, VpnPlace ); + + VpnArc->TYPE = Value1; + VpnArc->FLAGS = Value2; + } + else + if ( Keyword == VpnKeyGuard ) + { + Expr = VpnReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + VpnTrans->VEX_GUARD = Expr; + } + else + if ( Keyword == VpnKeyWait ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + VpnSymbol = searchvpnsymall( VpnFigure, Name, Value1 ); + VpnTrans->WAIT_SYM = addchain( VpnTrans->WAIT_SYM, VpnSymbol ); + } + else + if ( Keyword == VpnKeyDeclar ) + { + Error = 6 - sscanf( ScanBuffer, "%ld\t%ld\t%ld\t%ld\t%ld\t%ld", + &Value1, &Value2, &Value3, &Value4, &Value5, &Value6 ); + + if ( Error ) return( 1 ); + + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + if ( ( Value2 == VPN_DECLAR_PORT ) || + ( Value2 == VPN_DECLAR_CONSTANT ) || + ( Value2 == VPN_DECLAR_SIGNAL ) ) + { + VpnDeclar = addvpndecl( VpnFigure, Atom, Value2, Value5 ); + } + else + if ( VpnProc != (vpnproc_list *)0 ) + { + if ( Value2 == VPN_DECLAR_DEFINE ) + { + VpnDeclar = addvpndeclprocdef( VpnFigure, VpnProc, Atom, Value5 ); + } + else + if ( Value2 == VPN_DECLAR_VARIABLE ) + { + VpnDeclar = addvpndeclprocvar( VpnFigure, VpnProc, Atom, Value5 ); + } + } + else + if ( VpnFunc != (vpnfunc_list *)0 ) + { + if ( Value2 == VPN_DECLAR_DEFINE ) + { + VpnDeclar = addvpndeclfuncdef( VpnFigure, VpnFunc, Atom, Value5 ); + } + else + if ( Value2 == VPN_DECLAR_VARIABLE ) + { + VpnDeclar = addvpndeclfuncvar( VpnFigure, VpnFunc, Atom, Value5 ); + } + else + if ( Value2 == VPN_DECLAR_ARGUMENT ) + { + VpnDeclar = addvpndeclfuncarg( VpnFigure, VpnFunc, Atom, Value5, + Value1, Value2 ); + } + } + else + { + if ( Value2 == VPN_DECLAR_DEFINE ) + { + VpnDeclar = addvpndecldef( VpnFigure, Atom, Value5 ); + } + else + if ( Value2 == VPN_DECLAR_VARIABLE ) + { + VpnDeclar = addvpndeclvar( VpnFigure, Atom, Value5 ); + } + } + + VpnDeclar->DIR = Value1; + VpnDeclar->TYPE = Value2; + VpnDeclar->KIND = Value3; + VpnDeclar->CLASS = Value4; + VpnDeclar->BASE = Value5; + VpnDeclar->FLAGS = Value6; + + VpnPrevLine = &VpnDeclar->LINE; + } + else + if ( Keyword == VpnKeyInit ) + { + Expr = VpnReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + VpnDeclar->VEX_INIT = Expr; + } + else + if ( Keyword == VpnKeySymbol ) + { + Error = 6 - sscanf( ScanBuffer, "%ld\t%ld\t%ld\t%ld\t%ld\t%ld", + &Value1, &Value2, &Value3, &Value4, &Value5, &Value6 ); + + if ( Error ) return( 1 ); + + VpnSymbol = searchvpnsymall( VpnFigure, Name, Value1 ); + + VpnSymbol->INIT = Value2; + VpnSymbol->DRIVE = Value3; + VpnSymbol->EFFEC = Value4; + VpnSymbol->EVENT = Value5; + VpnSymbol->FLAGS = Value6; + } + else + if ( Keyword == VpnKeyRet ) + { + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + VpnFunc->VEX_RET = Atom; + } + else + if ( Keyword == VpnKeyProcess ) + { + Error = 2 - sscanf( ScanBuffer, "%ld %ld", &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + VpnProc = addvpnproc( VpnFigure, Name ); + + VpnProc->TYPE = Value1; + VpnProc->FLAGS = Value2; + VpnFunc = (vpnfunc_list *)0; + + VpnPrevLine = &VpnProc->LINE; + } + else + if ( Keyword == VpnKeyFunction ) + { + Error = 2 - sscanf( ScanBuffer, "%ld %ld", &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + VpnFunc = addvpnfunc( VpnFigure, Name ); + + VpnFunc->TYPE = Value1; + VpnFunc->FLAGS = Value2; + VpnProc = (vpnproc_list *)0; + + VpnPrevLine = &VpnFunc->LINE; + } + else + if ( Keyword == VpnKeyFirst ) + { + if ( VpnFunc == (vpnfunc_list *)0 ) + { + VpnProc->FIRST = searchvpntrans( VpnFigure, Name ); + } + else + { + VpnFunc->FIRST = searchvpntrans( VpnFigure, Name ); + } + } + else + if ( Keyword == VpnKeyElabo ) + { + if ( VpnFunc == (vpnfunc_list *)0 ) + { + VpnProc->ELABO = searchvpntrans( VpnFigure, Name ); + } + else + { + VpnFunc->ELABO = searchvpntrans( VpnFigure, Name ); + } + } + else + if ( Keyword == VpnKeyInstance ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + VpnInst = addvpnins( VpnFigure, Name, (vpnmod_list *)0 ); + + VpnInst->FLAGS = Value1; + + VpnPrevLine = &VpnInst->LINE; + } + else + if ( Keyword == VpnKeyInsMod ) + { + VpnModel = searchvpnmod( VpnFigure, Name ); + + if ( VpnModel == (vpnmod_list *)0 ) return( 1 ); + + VpnInst->MODEL = VpnModel; + } + else + if ( Keyword == VpnKeyMap ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + VpnMap = addvpninsmap( VpnFigure, VpnInst, (vexexpr *)0, (vexexpr *)0 ); + + VpnMap->FLAGS = Value1; + + VpnPrevLine = &VpnMap->LINE; + } + else + if ( Keyword == VpnKeyMapFor ) + { + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + VpnMap->VEX_FORMAL = Atom; + } + else + if ( Keyword == VpnKeyMapAct ) + { + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + VpnMap->VEX_ACTUAL = Atom; + } + else + if ( Keyword == VpnKeyModel ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + VpnModel = addvpnmod( VpnFigure, Name ); + + VpnModel->FLAGS = Value1; + + VpnPrevLine = &VpnModel->LINE; + } + else + if ( Keyword == VpnKeyPort ) + { + Error = 3 - sscanf( ScanBuffer, "%ld\t%ld\t%ld", &Value1, &Value2, &Value3 ); + + if ( Error ) return( 1 ); + + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + VpnPort = addvpnmodport( VpnFigure, VpnModel, Atom, Value2, Value1 ); + VpnPort->FLAGS = Value3; + + VpnPrevLine = &VpnPort->LINE; + } + else + if ( Keyword == VpnKeyFigure ) + { + Error = 1 - sscanf( ScanBuffer, "%ld", &Value1 ); + + if ( Error ) return( 1 ); + + VpnFigure->NAME = namealloc( Name ); + VpnFigure->FLAGS = Value1; + } + else + if ( Keyword == VpnKeyAttr ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + VpnAttr = addvpnattr( VpnFigure, Name, Name, Value1, Name ); + + VpnAttr->FLAGS = Value2; + + VpnPrevLine = &VpnAttr->LINE; + } + else + if ( Keyword == VpnKeyAttrEnt ) + { + VpnAttr->ENTITY = namealloc( Name ); + + Name = strchr( ScanBuffer, '\t' ); + if ( ScanBuffer == (char *)0 ) return( 1 ); + + *Name = '\0'; + VpnAttr->VALUE = namealloc( ScanBuffer ); + } + else + if ( Keyword == VpnKeyGenMap ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + VpnGen = addvpninsgen( VpnFigure, VpnInst, Atom, (vexexpr *)0 ); + + VpnGen->BASE = Value1; + VpnGen->FLAGS = Value2; + + VpnPrevLine = &VpnGen->LINE; + } + else + if ( Keyword == VpnKeyGenMod ) + { + Error = 2 - sscanf( ScanBuffer, "%ld\t%ld", &Value1, &Value2 ); + + if ( Error ) return( 1 ); + + Atom = VpnReadExpr(); + + if ( Atom == (vexexpr *)0 ) return( 1 ); + + VpnGen = addvpnmodgen( VpnFigure, VpnModel, Atom, (vexexpr *)0, Value1 ); + + VpnGen->FLAGS = Value2; + + VpnPrevLine = &VpnGen->LINE; + } + else + if ( Keyword == VpnKeyGenExpr ) + { + Expr = VpnReadExpr(); + + if ( Expr == (vexexpr *)0 ) return( 1 ); + + VpnGen->VEX_EXPR = Expr; + } + else return( 1 ); + } + + return( 0 ); +} + +/*------------------------------------------------------------\ +| | +| vpnloadvpnfig | +| | +\------------------------------------------------------------*/ + +void vpnloadvpnfig( VpnFigure, FigureName ) + + vpnfig_list *VpnFigure; + char *FigureName; +{ + int Value; + + VpnFile = mbkfopen( FigureName, "vpn", "r" ); + + if ( VpnFile == (FILE *)0 ) + { + vpderror( VPD_ERROR_OPEN_FILE, FigureName, 0 ); + } + + Value = VpnLoadFigure( VpnFigure ); + + if ( Value ) vpderror( VPD_ERROR_PARSE_FILE, FigureName, VpnLine ); + + fclose( VpnFile ); +} diff --git a/alliance/src/vpd/src/vpd_parse.h b/alliance/src/vpd/src/vpd_parse.h new file mode 100644 index 00000000..d699f378 --- /dev/null +++ b/alliance/src/vpd/src/vpd_parse.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : VPD | +| | +| File : vpdparse.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ + +# ifndef VPD_PARSE_H +# define VPD_PARSE_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/Makefile.am b/alliance/src/vpn/Makefile.am new file mode 100644 index 00000000..af437a64 --- /dev/null +++ b/alliance/src/vpn/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/alliance/src/vpn/configure.in b/alliance/src/vpn/configure.in new file mode 100644 index 00000000..3b87f905 --- /dev/null +++ b/alliance/src/vpn/configure.in @@ -0,0 +1,45 @@ +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/21 12:41:54 ludo Exp $ +dnl +dnl +AC_INIT(src/vpn.h) +AM_INIT_AUTOMAKE(vpn, 1.5) +AC_PROG_INSTALL +AC_PROG_CC +AC_HEADER_STDC +AC_C_CONST +AC_PROG_RANLIB + +AM_ALLIANCE + +AC_OUTPUT([ +Makefile +src/Makefile +]) diff --git a/alliance/src/vpn/src/Makefile.am b/alliance/src/vpn/src/Makefile.am new file mode 100644 index 00000000..3f757341 --- /dev/null +++ b/alliance/src/vpn/src/Makefile.am @@ -0,0 +1,10 @@ +CFLAGS = @CFLAGS@ \ + -DALLIANCE_TOP=\"${ALLIANCE_TOP}\" +lib_LIBRARIES = libVpn.a +include_HEADERS = vpn.h +libVpn_a_SOURCES = \ +vpnalloc.c vpnenv.h vpnget.c vpnsimp.h \ +vpnalloc.h vpnerror.c vpnget.h vpnunion.c \ +vpn.h vpndel.c vpnerror.h vpnsearch.c vpnunion.h \ +vpnadd.c vpndel.h vpnfree.c vpnsearch.h vpnview.c \ +vpnadd.h vpnenv.c vpnfree.h vpnsimp.c vpnview.h diff --git a/alliance/src/vpn/src/main.c b/alliance/src/vpn/src/main.c new file mode 100644 index 00000000..050d78bc --- /dev/null +++ b/alliance/src/vpn/src/main.c @@ -0,0 +1,336 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : main.c | +| | +| Date : 08.02.95 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "vtl.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Usage | +| | +\------------------------------------------------------------*/ + +void VpnUsage() +{ + fprintf( stderr, "\t\tvpntest [Options] Input_name [Output_name]\n\n" ); + fprintf( stdout, "\t\tOptions : -V Sets Verbose mode on\n" ); + fprintf( stdout, "\t\t -P Partial Verbose mode on\n" ); + fprintf( stdout, "\t\t -S Saves Vpn figure\n" ); + fprintf( stdout, "\t\t -I Vpn Input format\n" ); + fprintf( stdout, "\t\t -U Unreduced figure\n" ); + fprintf( stdout, "\t\t -O Vpn Output format\n" ); + fprintf( stdout, "\t\t -E Expand Vpn Figure\n" ); + fprintf( stdout, "\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Expand Vpn Trans | +| | +\------------------------------------------------------------*/ + +static void ExpandVpnTrans( VpnFigure, VpnFather, VpnTrans ) + + vpnfig_list *VpnFigure; + void *VpnFather; + vpntrans_list *VpnTrans; +{ + vpntrans_list *ScanTrans; + vpntrans_list *LastTrans; + vpntrans_list *NewTrans; + vpnplace_list *NewPlace; + vpnact_list *ScanAction; + vpnact_list *FirstAction; + chain_list *LastPlaceOut; + char Buffer[ 512 ]; + char *Name; + int Number; + + for ( ScanTrans = VpnTrans; + ScanTrans != (vpntrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + if ( ( ScanTrans->TYPE != VPN_TRANS_ACT_GUARDED ) && + ( ScanTrans->TYPE != VPN_TRANS_ACT_EXEC ) ) continue; + + if ( ScanTrans->TYPE == VPN_TRANS_ACT_GUARDED ) + { + ScanTrans->TYPE = VPN_TRANS_GUARDED; + ScanAction = ScanTrans->ACT; + + ScanTrans->ACT = (vpnact_list *)0; + ScanTrans->LAST_ACT = &ScanTrans->ACT; + } + else + { + FirstAction = ScanTrans->ACT; + ScanAction = FirstAction->NEXT; + + FirstAction->NEXT = (vpnact_list *)0; + ScanTrans->LAST_ACT = &FirstAction->NEXT; + } + + Number = 0; + LastTrans = ScanTrans; + NewTrans = ScanTrans; + + LastPlaceOut = ScanTrans->PLACE_OUT; + + ScanTrans->NUMBER_OUT = 0; + ScanTrans->PLACE_OUT = (chain_list *)0; + + while ( ScanAction != (vpnact_list *)0 ) + { + sprintf( Buffer, "%s.expand.%d", ScanTrans->NAME, Number++ ); + Name = namealloc( Buffer ); + + if ( ScanTrans->FATHER == VPN_FATHER_PROCESS ) + { + NewTrans = addvpnproctrans( VpnFigure, VpnFather, Name ); + NewPlace = addvpnprocplace( VpnFigure, VpnFather, Name ); + } + else + { + NewTrans = addvpnfunctrans( VpnFigure, VpnFather, Name ); + NewPlace = addvpnfuncplace( VpnFigure, VpnFather, Name ); + } + + addvpnarctrans( VpnFigure, LastTrans, NewPlace ); + addvpnarcplace( VpnFigure, NewPlace , NewTrans ); + + FirstAction = ScanAction; + ScanAction = ScanAction->NEXT; + + NewTrans->TYPE = VPN_TRANS_ACT_EXEC; + NewTrans->ACT = FirstAction; + NewTrans->LAST_ACT = &FirstAction->NEXT; + FirstAction->NEXT = (vpnact_list *)0; + + LastTrans = NewTrans; + } + + NewTrans->PLACE_OUT = LastPlaceOut; + NewTrans->NUMBER_OUT = 1; + } +} + +/*------------------------------------------------------------\ +| | +| Expand Vpn Figure | +| | +\------------------------------------------------------------*/ + +static void ExpandVpnFigure( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpnproc_list *VpnProc; + vpnfunc_list *VpnFunc; + + for ( VpnProc = VpnFigure->PROCESS; + VpnProc != (vpnproc_list *)0; + VpnProc = VpnProc->NEXT ) + { + ExpandVpnTrans( VpnFigure, VpnProc, VpnProc->TRANS ); + } + + for ( VpnFunc = VpnFigure->FUNCTION; + VpnFunc != (vpnfunc_list *)0; + VpnFunc = VpnFunc->NEXT ) + { + ExpandVpnTrans( VpnFigure, VpnFunc, VpnFunc->TRANS ); + } +} + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + vpnfig_list *VpnFigure; + char *InputFileName; + char *OutputFileName; + int Number; + int Index; + char Option; + + int FlagVerbose = 0; + int FlagSave = 0; + int FlagExpand = 0; + int FlagPartial = 0; + int FlagUnreduced = 0; + + mbkenv(); + autenv(); + vexenv(); + vpnenv(); + + InputFileName = (char *)0; + OutputFileName = (char *)0; + + if ( argc < 2 ) VpnUsage(); + + InputFileName = (char *)0; + + for ( Number = 1; Number < argc; Number++ ) + { + if ( argv[ Number ][ 0 ] == '-' ) + { + for ( Index = 1; argv[ Number ][ Index ] != '\0'; Index++ ) + { + Option = argv[ Number ][ Index ]; + + if ( Option == 'I' ) + { + Number = Number + 1; + VPN_IN = namealloc( argv[ Number ] ); + break; + } + else + if ( Option == 'O' ) + { + Number = Number + 1; + VPN_OUT = namealloc( argv[ Number ] ); + break; + } + + switch ( Option ) + { + case 'V' : FlagVerbose = 1; + break; + case 'P' : FlagPartial = 1; + break; + case 'S' : FlagSave = 1; + break; + case 'E' : FlagExpand = 1; + break; + case 'U' : FlagUnreduced = 1; + break; + default : VpnUsage(); + } + } + } + else + if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ]; + else + if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ]; + else + VpnUsage(); + } + + if ( InputFileName == (char *)0 ) VpnUsage(); + if ( OutputFileName == (char *)0 ) OutputFileName = InputFileName; + + if ( ( FlagSave ) && ( InputFileName == OutputFileName ) ) + { + VpnUsage(); + } + + fprintf( stdout, "VPN_IN : %s\n", VPN_IN ); + fprintf( stdout, "VPN_OUT : %s\n", VPN_OUT ); + + if ( FlagUnreduced ) + { + VpnFigure = addvpnfig( InputFileName ); + loadvpnfig( VpnFigure, InputFileName, 0 ); + } + else + { + VpnFigure = getvpnfig( InputFileName ); + } + + if ( FlagExpand ) + { + ExpandVpnFigure( VpnFigure ); + } + + if ( FlagVerbose ) viewvpnfig( VpnFigure ); + + if ( FlagPartial ) + { + fprintf( stdout, " -> Number Process %ld\n", GetVpnNumProc( VpnFigure ) ); + fprintf( stdout, " -> Number Function %ld\n", GetVpnNumFunc( VpnFigure ) ); + fprintf( stdout, " -> Number Place %ld\n", GetVpnNumPlace( VpnFigure ) ); + fprintf( stdout, " -> Number Trans %ld\n", GetVpnNumTrans( VpnFigure ) ); + fprintf( stdout, " -> Number Arc %ld\n", GetVpnNumArc( VpnFigure ) ); + } + + if ( FlagSave ) + { + VpnFigure->NAME = namealloc( OutputFileName ); + savevpnfig( VpnFigure ); + } + + delvpnfig( VpnFigure->NAME ); + + return( 0 ); +} diff --git a/alliance/src/vpn/src/toto.c b/alliance/src/vpn/src/toto.c new file mode 100644 index 00000000..9d0ff672 --- /dev/null +++ b/alliance/src/vpn/src/toto.c @@ -0,0 +1,191 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : main.c | +| | +| Date : 08.02.95 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "vtl.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Usage | +| | +\------------------------------------------------------------*/ + +void VpnUsage() +{ + fprintf( stderr, "\t\tvpntest [Options] Input_name [Output_name]\n\n" ); + fprintf( stdout, "\t\tOptions : -V Sets Verbose mode on\n" ); + fprintf( stdout, "\t\t -S Saves Vpn figure\n" ); + fprintf( stdout, "\t\t -I Vpn Input format\n" ); + fprintf( stdout, "\t\t -O Vpn Output format\n" ); + fprintf( stdout, "\t\t -s Simplifies vex Vpn figure\n" ); + fprintf( stdout, "\n" ); + + exit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +int main( argc, argv ) + + int argc; + char *argv[]; +{ + vpnfig_list *VpnFigure; + char *InputFileName; + char *OutputFileName; + int Number; + int Index; + char Option; + + int FlagVerbose = 0; + int FlagSave = 0; + int FlagSimp = 0; + + mbkenv(); + autenv(); + vexenv(); + vpnenv(); + + InputFileName = (char *)0; + + if ( argc < 2 ) VpnUsage(); + + InputFileName = (char *)0; + + for ( Number = 1; Number < argc; Number++ ) + { + if ( argv[ Number ][ 0 ] == '-' ) + { + for ( Index = 1; argv[ Number ][ Index ] != '\0'; Index++ ) + { + Option = argv[ Number ][ Index ]; + + if ( Option == 'I' ) + { + Number = Number + 1; + VPN_IN = namealloc( argv[ Number ] ); + break; + } + else + if ( Option == 'O' ) + { + Number = Number + 1; + VPN_OUT = namealloc( argv[ Number ] ); + break; + } + + switch ( Option ) + { + case 'V' : FlagVerbose = 1; + break; + case 'S' : FlagSave = 1; + break; + case 's' : FlagSimp = 1; + break; + default : VpnUsage(); + } + } + } + else + if ( InputFileName == (char *)0 ) InputFileName = argv[ Number ]; + else + if ( OutputFileName == (char *)0 ) OutputFileName = argv[ Number ]; + else + VpnUsage(); + } + + if ( InputFileName == (char *)0 ) VpnUsage(); + if ( OutputFileName == (char *)0 ) OutputFileName = InputFileName; + + if ( ( FlagSave ) && ( InputFileName == OutputFileName ) ) + { + VpnUsage(); + } + + fprintf( stdout, "VPN_IN : %s\n", VPN_IN ); + fprintf( stdout, "VPN_OUT : %s\n", VPN_OUT ); + + VpnFigure = getvpnfig( InputFileName ); + + if ( FlagSimp ) + { + simpvpnfig( VpnFigure ); + } + + if ( FlagVerbose ) viewvpnfig( VpnFigure ); + + if ( FlagSave ) + { + VpnFigure->NAME = namealloc( OutputFileName ); + savevpnfig( VpnFigure ); + } + + delvpnfig( VpnFigure->NAME ); + + return( 0 ); +} diff --git a/alliance/src/vpn/src/vpn.h b/alliance/src/vpn/src/vpn.h new file mode 100644 index 00000000..7ec02443 --- /dev/null +++ b/alliance/src/vpn/src/vpn.h @@ -0,0 +1,955 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------\ +| | +| Title : Structures and fonctions for VPN | +| | +| Date : 17.01.2000 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------*/ + +# ifndef VPN_105_H +# define VPN_105_H + +/*------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Vpn Attribute Type | +| | +\------------------------------------------------------*/ + +# define VPN_ATTR_NONE 0 +# define VPN_ATTR_ENTITY 1 +# define VPN_ATTR_ARCHITECTURE 2 +# define VPN_ATTR_PACKAGE 3 +# define VPN_ATTR_FUNCTION 4 +# define VPN_ATTR_PROCEDURE 5 +# define VPN_ATTR_SUBTYPE 6 +# define VPN_ATTR_CONSTANT 7 +# define VPN_ATTR_VARIABLE 8 +# define VPN_ATTR_SIGNAL 9 +# define VPN_ATTR_LABEL 10 +# define VPN_ATTR_TYPE 11 +# define VPN_ATTR_CONFIGURATION 12 +# define VPN_ATTR_COMPONENT 13 +# define VPN_MAX_ATTR_TYPE 14 + +/*------------------------------------------------------\ +| | +| Vpn Father Type | +| | +\------------------------------------------------------*/ + +# define VPN_FATHER_PROCESS 0 +# define VPN_FATHER_FUNCTION 1 +# define VPN_MAX_FATHER_TYPE 2 + +/*------------------------------------------------------\ +| | +| Vpn Trans Type | +| | +\------------------------------------------------------*/ + +# define VPN_TRANS_UNKNOWN 0 +# define VPN_TRANS_ACT_EXEC 1 +# define VPN_TRANS_INF_WAIT 2 +# define VPN_TRANS_SUP_WAIT 3 +# define VPN_TRANS_GUARDED 4 +# define VPN_TRANS_IMMEDIATE 5 +# define VPN_TRANS_ACT_GUARDED 6 +# define VPN_TRANS_ACT_EXEC_CONC 7 +# define VPN_TRANS_ACT_GUARDED_CONC 8 +# define VPN_MAX_TRANS_TYPE 9 + +/*------------------------------------------------------\ +| | +| Vpn Place Type | +| | +\------------------------------------------------------*/ + +# define VPN_PLACE_UNKNOWN 0 +# define VPN_PLACE_ASSIGN 1 +# define VPN_PLACE_IF 2 +# define VPN_PLACE_END_IF 3 +# define VPN_PLACE_CASE 4 +# define VPN_PLACE_END_CASE 5 +# define VPN_PLACE_WAIT 6 +# define VPN_PLACE_UNTIL 7 +# define VPN_PLACE_UNTIL_TEST 8 +# define VPN_PLACE_END_UNTIL 9 +# define VPN_PLACE_WHILE 10 +# define VPN_PLACE_WHILE_TEST 11 +# define VPN_PLACE_END_WHILE 12 +# define VPN_PLACE_FOR 13 +# define VPN_PLACE_FOR_LOOP 14 +# define VPN_PLACE_FOR_TEST 15 +# define VPN_PLACE_FOR_INC 16 +# define VPN_PLACE_END_FOR 17 +# define VPN_PLACE_NEXT 18 +# define VPN_PLACE_EXIT 19 +# define VPN_PLACE_CALL 20 +# define VPN_PLACE_RETURN 21 +# define VPN_PLACE_PROCESS 22 +# define VPN_PLACE_FUNCTION 23 +# define VPN_PLACE_LOOP 24 +# define VPN_PLACE_END_LOOP 25 +# define VPN_PLACE_END_EXIT 26 +# define VPN_PLACE_END_NEXT 27 +# define VPN_PLACE_GOTO 28 +# define VPN_PLACE_LABEL 29 +# define VPN_PLACE_DO 30 +# define VPN_PLACE_DO_TEST 31 +# define VPN_PLACE_DO_WHILE 32 +# define VPN_PLACE_END_DO 33 +# define VPN_PLACE_SWITCH 34 +# define VPN_PLACE_END_SWITCH 35 +# define VPN_PLACE_C_CASE 36 +# define VPN_PLACE_BREAK 37 +# define VPN_PLACE_C_RETURN 38 +# define VPN_MAX_PLACE_TYPE 39 + +/*------------------------------------------------------\ +| | +| Vpn Argument Class | +| | +\------------------------------------------------------*/ + +# define VPN_CLASS_NONE 0 +# define VPN_CLASS_CONSTANT 1 +# define VPN_CLASS_VARIABLE 2 +# define VPN_CLASS_SIGNAL 3 +# define VPN_MAX_CLASS_TYPE 4 + +/*------------------------------------------------------\ +| | +| Vpn Direction | +| | +\------------------------------------------------------*/ + +# define VPN_DIR_IN 0 +# define VPN_DIR_OUT 1 +# define VPN_DIR_INOUT 2 +# define VPN_MAX_DIR_TYPE 3 + +/*------------------------------------------------------\ +| | +| Vpn Kind | +| | +\------------------------------------------------------*/ + +# define VPN_KIND_NONE 0 +# define VPN_KIND_BUS 1 +# define VPN_KIND_REGISTER 2 +# define VPN_MAX_KIND_TYPE 3 + +/*------------------------------------------------------\ +| | +| Vpn Declar Type | +| | +\------------------------------------------------------*/ + +# define VPN_DECLAR_ALL 0 +# define VPN_DECLAR_PORT 1 +# define VPN_DECLAR_SIGNAL 2 +# define VPN_DECLAR_VARIABLE 3 +# define VPN_DECLAR_DEFINE 4 +# define VPN_DECLAR_ARGUMENT 5 +# define VPN_DECLAR_CONSTANT 6 +# define VPN_DECLAR_GENERIC 7 +# define VPN_MAX_DECLAR_TYPE 8 + +/*------------------------------------------------------\ +| | +| Vpn Action Type | +| | +\------------------------------------------------------*/ + +# define VPN_ACT_UNKNOWN 0 +# define VPN_ACT_ASG_PORT 1 +# define VPN_ACT_ASG_SIGNAL 2 +# define VPN_ACT_ASG_VARIABLE 3 +# define VPN_ACT_ASG_DEFINE 4 +# define VPN_ACT_ASG_ARG_SIG 5 +# define VPN_ACT_ASG_ARG_VAR 6 +# define VPN_ACT_CALL 7 +# define VPN_ACT_RETURN 8 +# define VPN_MAX_ACT_TYPE 9 + +/*------------------------------------------------------\ +| | +| Vpn Arc Type | +| | +\------------------------------------------------------*/ + +# define VPN_ARC_PLACE_TRANS 0 +# define VPN_ARC_TRANS_PLACE 1 +# define VPN_MAX_ARC_TYPE 2 + +/*------------------------------------------------------\ +| | +| Vpn Process Type | +| | +\------------------------------------------------------*/ + +# define VPN_PROCESS_SEQUENTIAL_MASK 0x01 +# define VPN_PROCESS_WITHSELECT_MASK 0x02 +# define VPN_PROCESS_GUARDED_MASK 0x04 +# define VPN_PROCESS_CONDITIONNAL_MASK 0x08 + +/*------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Vpn Is Process Type | +| | +\------------------------------------------------------*/ + +# define IsVpnProcSequential( P ) ( (P)->TYPE & VPN_PROCESS_SEQUENTIAL_MASK ) +# define IsVpnProcWithSelect( P ) ( (P)->TYPE & VPN_PROCESS_WITHSELECT_MASK ) +# define IsVpnProcConditionnal( P ) ( (P)->TYPE & VPN_PROCESS_CONDITIONNAL_MASK ) +# define IsVpnProcGuarded( P ) ( (P)->TYPE & VPN_PROCESS_GUARDED_MASK ) + +# define SetVpnProcSequential( P ) ( (P)->TYPE |= VPN_PROCESS_SEQUENTIAL_MASK ) +# define SetVpnProcWithSelect( P ) ( (P)->TYPE |= VPN_PROCESS_WITHSELECT_MASK ) +# define SetVpnProcConditionnal( P ) ( (P)->TYPE |= VPN_PROCESS_CONDITIONNAL_MASK ) +# define SetVpnProcGuarded( P ) ( (P)->TYPE |= VPN_PROCESS_GUARDED_MASK ) + +# define ClearVpnProcSequential( P ) ( (P)->TYPE &= ~VPN_PROCESS_SEQUENTIAL_MASK ) +# define ClearVpnProcWithSelect( P ) ( (P)->TYPE &= ~VPN_PROCESS_WITHSELECT_MASK ) +# define ClearVpnProcConditionnal( P ) ( (P)->TYPE &= ~VPN_PROCESS_CONDITIONNAL_MASK ) +# define ClearVpnProcGuarded( P ) ( (P)->TYPE &= ~VPN_PROCESS_GUARDED_MASK ) + +/*------------------------------------------------------\ +| | +| Vpn Get Symbol | +| | +\------------------------------------------------------*/ + +# define GetVpnSymbol( C ) ((vpnsym *)( (C)->DATA )) +# define GetVpnDeclar( C ) ((vpndecl_list *)( (C)->DATA )) + +/*------------------------------------------------------\ +| | +| Vpn Get Arc | +| | +\------------------------------------------------------*/ + +# define GetVpnArc( C ) \ + ((vpnarc *)( (C)->DATA )) + +# define GetVpnArcTargetPlace( A ) \ + ((vpnplace_list *)( (vpnarc *)(A)->TARGET )) + +# define GetVpnArcSourcePlace( A ) \ + ((vpnplace_list *)( (vpnarc *)(A)->SOURCE )) + +# define GetVpnArcTargetTrans( A ) \ + ((vpntrans_list *)( (vpnarc *)(A)->TARGET )) + +# define GetVpnArcSourceTrans( A ) \ + ((vpntrans_list *)( (vpnarc *)(A)->SOURCE )) + +/*------------------------------------------------------\ +| | +| Vpn Add Arc | +| | +\------------------------------------------------------*/ + +# define addvpnarctrans( F, T, P ) \ + (addvpnarc( (F), (T), (P), VPN_ARC_TRANS_PLACE )) + +# define addvpnarcplace( F, P, T ) \ + (addvpnarc( (F), (P), (T), VPN_ARC_PLACE_TRANS )) + +/*------------------------------------------------------\ +| | +| Vpn Add Action | +| | +\------------------------------------------------------*/ + +# define addvpnactcall( F, T, E ) \ + (addvpnact( (F), (T), (vexexpr *)0, (E), VPN_ACT_CALL )) + +# define addvpnactreturn( F, T, E ) \ + (addvpnact( (F), (T), (vexexpr *)0, (E), VPN_ACT_RETURN )) + +# define addvpnactcallafter( F, T, P, E ) \ + (addvpnactafter( (F), (T), (P), (vexexpr *)0, (E), VPN_ACT_CALL )) + +# define addvpnactreturnafter( F, T, P, E ) \ + (addvpnactafter( (F), (T), (P), (vexexpr *)0, (E), VPN_ACT_RETURN )) + +# define addvpnactcallbefore( F, T, P, E ) \ + (addvpnactbefore( (F), (T), (P), (vexexpr *)0, (E), VPN_ACT_CALL )) + +# define addvpnactreturnbefore( F, T, P, E ) \ + (addvpnactafter( (F), (T), (P), (vexexpr *)0, (E), VPN_ACT_RETURN )) + +# define addvpnactcallfirst( F, T, E ) \ + (addvpnactfirst( (F), (T), (vexexpr *)0, (E), VPN_ACT_CALL )) + +# define addvpnactreturnfirst( F, T, E ) \ + (addvpnactfirst( (F), (T), (vexexpr *)0, (E), VPN_ACT_RETURN )) + + +/*------------------------------------------------------\ +| | +| Vpn Get Number | +| | +\------------------------------------------------------*/ + +# define GetVpnNumProc( F ) ((F)->HASH_PROCESS->NUMBER_ELEM) +# define GetVpnNumFunc( F ) ((F)->HASH_FUNCTION->NUMBER_ELEM) +# define GetVpnNumTrans( F ) ((F)->HASH_TRANS->NUMBER_ELEM) +# define GetVpnNumPlace( F ) ((F)->HASH_PLACE->NUMBER_ELEM) +# define GetVpnNumArc( F ) ((F)->HASH_ARC->NUMBER_ELEM) + +# define GetVpnNumDecl( F ) ((F)->HASH_DECLAR[ VPN_DECLAR_ALL ]->NUMBER_ELEM) +# define GetVpnNumDeclPort( F ) ((F)->HASH_DECLAR[ VPN_DECLAR_PORT ]->NUMBER_ELEM) +# define GetVpnNumDeclSig( F ) ((F)->HASH_DECLAR[ VPN_DECLAR_SIGNAL ]->NUMBER_ELEM) +# define GetVpnNumDeclVar( F ) ((F)->HASH_DECLAR[ VPN_DECLAR_VARIABLE ]->NUMBER_ELEM) +# define GetVpnNumDeclCst( F ) ((F)->HASH_DECLAR[ VPN_DECLAR_CONSTANT ]->NUMBER_ELEM) +# define GetVpnNumDeclDef( F ) ((F)->HASH_DECLAR[ VPN_DECLAR_DEFINE ]->NUMBER_ELEM) +# define GetVpnNumDeclArg( F ) ((F)->HASH_DECLAR[ VPN_DECLAR_ARGUMENT ]->NUMBER_ELEM) + +/*------------------------------------------------------\ +| | +| Vpn Search Symbol | +| | +\------------------------------------------------------*/ + +# define searchvpnsymport( F, N, I ) \ + (searchvpnsym( (F), (N), (I), VPN_DECLAR_PORT )) +# define searchvpnsymsig( F, N, I ) \ + (searchvpnsym( (F), (N), (I), VPN_DECLAR_SIGNAL )) +# define searchvpnsymvar( F, N, I ) \ + (searchvpnsym( (F), (N), (I), VPN_DECLAR_VARIABLE )) +# define searchvpnsymcst( F, N, I ) \ + (searchvpnsym( (F), (N), (I), VPN_DECLAR_CONSTANT )) +# define searchvpnsymdef( F, N, I ) \ + (searchvpnsym( (F), (N), (I), VPN_DECLAR_DEFINE )) +# define searchvpnsymarg( F, N, I ) \ + (searchvpnsym( (F), (N) (I), VPN_DECLAR_ARGUMENT )) +# define searchvpnsymgen( F, N, I ) \ + (searchvpnsym( (F), (N), (I), VPN_DECLAR_GENERIC )) +# define searchvpnsymall( F, N, I ) \ + (searchvpnsym( (F), (N), (I), VPN_DECLAR_ALL )) + +/*------------------------------------------------------\ +| | +| Vpn Search Declar | +| | +\------------------------------------------------------*/ + +# define searchvpndeclport( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_PORT )) +# define searchvpndeclsig( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_SIGNAL )) +# define searchvpndeclvar( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_VARIABLE )) +# define searchvpndeclcst( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_CONSTANT )) +# define searchvpndecldef( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_DEFINE )) +# define searchvpndeclarg( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_ARGUMENT )) +# define searchvpndeclgen( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_GENERIC )) +# define searchvpndeclall( F, N ) \ + (searchvpndecl( (F), (N), VPN_DECLAR_ALL )) + + +/*------------------------------------------------------\ +| | +| Type | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Vpn Line | +| | +\------------------------------------------------------*/ + + typedef struct vpnline_list + { + struct vpnline_list *NEXT; + char *NAME; + long LINE; + + } vpnline_list; + +/*------------------------------------------------------\ +| | +| Vpn Attribute | +| | +\------------------------------------------------------*/ + + typedef struct vpnattr + { + struct vpnattr *NEXT; + char *NAME; + char *ENTITY; + char *VALUE; + unsigned char TYPE; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnattr_list; + +/*------------------------------------------------------\ +| | +| Vpn Symbol | +| | +\------------------------------------------------------*/ + + typedef struct vpnsym + { + char *NAME; + struct vpndecl_list *DECL; + short INDEX; + unsigned char INIT; + unsigned char DRIVE; + unsigned char EFFEC; + unsigned char EVENT; + long FLAGS; + void *USER; + + } vpnsym; + +/*------------------------------------------------------\ +| | +| Vpn Declaration | +| | +\------------------------------------------------------*/ + + typedef struct vpndecl_list + { + struct vpndecl_list *NEXT; + struct vpndecl_list **PREV; + vexexpr *VEX_ATOM; + void *BDD_ATOM; + vexexpr *VEX_INIT; + void *BDD_INIT; + vpnsym *DECL_SYM; + unsigned char DIR; + unsigned char TYPE; + unsigned char KIND; + unsigned char CLASS; + unsigned char BASE; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpndecl_list; + +/*------------------------------------------------------\ +| | +| Vpn Action | +| | +\------------------------------------------------------*/ + + typedef struct vpnact_list + { + struct vpnact_list *NEXT; + struct vpnact_list **PREV; + vexexpr *VEX_ATOM; + void *BDD_ATOM; + vexexpr *VEX_EXPR; + void *BDD_EXPR; + unsigned char TYPE; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnact_list; + +/*------------------------------------------------------\ +| | +| Vpn Arc | +| | +\------------------------------------------------------*/ + + typedef struct vpnarc + { + void *SOURCE; + void *TARGET; + unsigned char TYPE; + long FLAGS; + void *USER; + + } vpnarc; + +/*------------------------------------------------------\ +| | +| Vpn Place | +| | +\------------------------------------------------------*/ + + typedef struct vpnplace_list + { + struct vpnplace_list *NEXT; + struct vpnplace_list **PREV; + char *NAME; + unsigned char FATHER; + unsigned char TYPE; + unsigned short TOKEN; + unsigned short NUMBER_IN; + unsigned short NUMBER_OUT; + chain_list *TRANS_IN; + chain_list *TRANS_OUT; + struct vpnplace_list *LINK; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnplace_list; + +/*------------------------------------------------------\ +| | +| Vpn Trans | +| | +\------------------------------------------------------*/ + + typedef struct vpntrans_list + { + struct vpntrans_list *NEXT; + struct vpntrans_list **PREV; + char *NAME; + unsigned char FATHER; + unsigned char TYPE; + chain_list *WAIT_SYM; + unsigned short NUMBER_IN; + unsigned short NUMBER_OUT; + chain_list *PLACE_IN; + chain_list *PLACE_OUT; + vpnact_list *ACT; + vpnact_list **LAST_ACT; + vexexpr *VEX_GUARD; + void *BDD_GUARD; + long FLAGS; + void *USER; + + } vpntrans_list; + +/*------------------------------------------------------\ +| | +| Vpn Process | +| | +\------------------------------------------------------*/ + + typedef struct vpnproc_list + { + struct vpnproc_list *NEXT; + struct vpnproc_list **PREV; + char *NAME; + unsigned char TYPE; + vpntrans_list *FIRST; + vpntrans_list *ELABO; + vpnplace_list *PLACE; + vpntrans_list *TRANS; + chain_list *VAR_DECL; + chain_list *DEF_DECL; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnproc_list; + +/*------------------------------------------------------\ +| | +| Vpn Function | +| | +\------------------------------------------------------*/ + + typedef struct vpnfunc_list + { + struct vpnfunc_list *NEXT; + struct vpnfunc_list **PREV; + char *NAME; + unsigned char TYPE; + vpntrans_list *FIRST; + vpntrans_list *ELABO; + vpnplace_list *PLACE; + vpntrans_list *TRANS; + vexexpr *VEX_RET; + chain_list *ARG_DECL; + chain_list **LAST_ARG; + chain_list *VAR_DECL; + chain_list *DEF_DECL; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnfunc_list; + +/*------------------------------------------------------\ +| | +| Vpn Instance | +| | +\------------------------------------------------------*/ + + typedef struct vpnmap_list + { + struct vpnmap_list *NEXT; + vexexpr *VEX_FORMAL; + vexexpr *VEX_ACTUAL; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnmap_list; + + typedef struct vpngen_list + { + struct vpngen_list *NEXT; + vexexpr *VEX_ATOM; + vexexpr *VEX_EXPR; + vpnline_list *LINE; + unsigned char BASE; + long FLAGS; + void *USER; + + } vpngen_list; + + + typedef struct vpnins_list + { + struct vpnins_list *NEXT; + char *NAME; + struct vpnmod_list *MODEL; + vpnmap_list *MAP; + vpngen_list *GENERIC; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnins_list; + +/*------------------------------------------------------\ +| | +| Vpn Model | +| | +\------------------------------------------------------*/ + + typedef struct vpnport_list + { + struct vpnport_list *NEXT; + vexexpr *VEX_ATOM; + unsigned char DIR; + unsigned char BASE; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnport_list; + + typedef struct vpnmod_list + { + struct vpnmod_list *NEXT; + char *NAME; + vpnport_list *PORT; + vpngen_list *GENERIC; + vpnline_list *LINE; + long FLAGS; + void *USER; + + } vpnmod_list; + +/*------------------------------------------------------\ +| | +| Vpn Figure | +| | +\------------------------------------------------------*/ + + typedef struct vpnfig_list + { + struct vpnfig_list *NEXT; + char *NAME; + vpnproc_list *PROCESS; + vpnfunc_list *FUNCTION; + vpnmod_list *MODEL; + vpnins_list *INSTANCE; + chain_list *VAR_DECL; + chain_list *DEF_DECL; + vpndecl_list *DECLAR[ VPN_MAX_DECLAR_TYPE ]; + vpnattr_list *ATTRIBUTE; + authtable *HASH_DECLAR[ VPN_MAX_DECLAR_TYPE ]; + authtable *HASH_PROCESS; + authtable *HASH_FUNCTION; + authtable *HASH_TRANS; + authtable *HASH_PLACE; + authtable *HASH_MODEL; + authtable *HASH_INSTANCE; + auth2table *HASH_ARC; + void *CIRCUIT; + long FLAGS; + void *USER; + + } vpnfig_list; + +/*------------------------------------------------------\ +| | +| Global Variables | +| | +\------------------------------------------------------*/ + + extern vpnfig_list *HEAD_VPNFIG; + + extern char *VPN_FATHER_TYPE [ VPN_MAX_FATHER_TYPE ]; + extern char *VPN_ACT_TYPE [ VPN_MAX_ACT_TYPE ]; + extern char *VPN_TRANS_TYPE [ VPN_MAX_TRANS_TYPE ]; + extern char *VPN_PLACE_TYPE [ VPN_MAX_PLACE_TYPE ]; + extern char *VPN_DECLAR_TYPE [ VPN_MAX_DECLAR_TYPE ]; + extern char *VPN_ARC_TYPE [ VPN_MAX_ARC_TYPE ]; + extern char *VPN_DIR_TYPE [ VPN_MAX_DIR_TYPE ]; + extern char *VPN_CLASS_TYPE [ VPN_MAX_CLASS_TYPE ]; + extern char *VPN_KIND_TYPE [ VPN_MAX_KIND_TYPE ]; + extern char *VPN_ATTRIBUTE_TYPE[ VPN_MAX_ATTR_TYPE ]; + + extern char *VPN_IN; + extern char *VPN_OUT; + + extern char *VPN_VHDL_FORMAT; + extern char *VPN_VPN_FORMAT; + extern char *VPN_VBE_FORMAT; + extern char *VPN_VST_FORMAT; + extern char *VPN_SYN_FORMAT; + extern char *VPN_FSM_FORMAT; + +/*------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------*/ +/*------------------------------------------------------\ +| | +| Env Functions | +| | +\------------------------------------------------------*/ + + extern void vpnenv __P(()); + +/*------------------------------------------------------\ +| | +| Alloc Functions | +| | +\------------------------------------------------------*/ + + extern vpnfig_list *allocvpnfig __P(()); + extern vpnproc_list *allocvpnproc __P(()); + extern vpnfunc_list *allocvpnfunc __P(()); + extern vpnplace_list *allocvpnplace __P(()); + extern vpntrans_list *allocvpntrans __P(()); + extern vpnarc *allocvpnarc __P(()); + extern vpndecl_list *allocvpndecl __P(()); + extern vpnsym *allocvpnsym __P((unsigned int Width)); + extern vpnact_list *allocvpnact __P(()); + extern vpnattr_list *allocvpnattr __P(()); + extern vpnline_list *allocvpnline __P(()); + + extern vpnmod_list *allocvpnmod __P(()); + extern vpnins_list *allocvpnins __P(()); + extern vpnport_list *allocvpnport __P(()); + extern vpnmap_list *allocvpnmap __P(()); + extern vpngen_list *allocvpngen __P(()); + +/*------------------------------------------------------\ +| | +| Free Functions | +| | +\------------------------------------------------------*/ + + extern void freevpnfig __P((vpnfig_list *Figure)); + extern void freevpnproc __P((vpnproc_list *Process)); + extern void freevpnfunc __P((vpnfunc_list *Function)); + extern void freevpnplace __P((vpnplace_list *Place)); + extern void freevpntrans __P((vpntrans_list *Trans)); + extern void freevpnarc __P((vpnarc *Arc)); + extern void freevpndecl __P((vpndecl_list *Decl)); + extern void freevpnsym __P((vpnsym *Sym)); + extern void freevpnact __P((vpnact_list *Act)); + extern void freevpnattr __P((vpnattr_list *Attr)); + extern void freevpnline __P((vpnline_list *Line)); + + extern void freevpnmod __P((vpnmod_list *Model)); + extern void freevpnins __P((vpnins_list *Instance)); + extern void freevpnport __P((vpnport_list *Port)); + extern void freevpnmap __P((vpnmap_list *Map)); + extern void freevpngen __P((vpngen_list *Generic)); + +/*------------------------------------------------------\ +| | +| Add Functions | +| | +\------------------------------------------------------*/ + + extern vpnfig_list *addvpnfig __P((char *Name)); + extern vpnproc_list *addvpnproc __P((vpnfig_list *Figure, char *Name)); + extern vpnfunc_list *addvpnfunc __P((vpnfig_list *Figure, char *Name)); + extern vpnarc *addvpnarc __P((vpnfig_list *Figure, void *Source, void *Target, unsigned char ArcType)); + extern vpnact_list *addvpnact __P((vpnfig_list *Figure, vpntrans_list *Trans, vexexpr *Atom, vexexpr *Expr, unsigned char Type)); + extern vpnact_list *addvpnactasg __P((vpnfig_list *Figure, vpntrans_list *Trans, vexexpr *Atom, vexexpr *Expr)); + extern vpnact_list *addvpnactafter __P((vpnfig_list *Figure, vpntrans_list *Trans, vpnact_list *PrevAction, vexexpr *Atom, vexexpr *Expr, unsigned char Type)); + extern vpnact_list *addvpnactasgafter __P((vpnfig_list *Figure, vpntrans_list *Trans, vpnact_list *PrevAction, vexexpr *Atom, vexexpr *Expr)); + extern vpnact_list *addvpnactbefore __P((vpnfig_list *Figure, vpntrans_list *Trans, vpnact_list *NextAction, vexexpr *Atom, vexexpr *Expr, unsigned char Type)); + extern vpnact_list *addvpnactasgbefore __P((vpnfig_list *Figure, vpntrans_list *Trans, vpnact_list *NextAction, vexexpr *Atom, vexexpr *Expr)); + extern vpnact_list *addvpnactfirst __P((vpnfig_list *Figure, vpntrans_list *Trans, vexexpr *Atom, vexexpr *Expr, unsigned char Type)); + extern vpnact_list *addvpnactasgfirst __P((vpnfig_list *Figure, vpntrans_list *Trans, vexexpr *Atom, vexexpr *Expr)); + + extern vpndecl_list *addvpndecl __P((vpnfig_list *Figure, vexexpr *Atom, unsigned char Type, unsigned char Base)); + extern vpndecl_list *addvpndeclport __P((vpnfig_list *Figure, vexexpr *Atom, unsigned char Base, unsigned char Dir, unsigned char Kind)); + extern vpndecl_list *addvpndeclsig __P((vpnfig_list *Figure, vexexpr *Atom, unsigned char Base, unsigned char Kind)); + extern vpndecl_list *addvpndeclcst __P((vpnfig_list *Figure, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndeclgen __P((vpnfig_list *Figure, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndeclvar __P((vpnfig_list *Figure, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndecldef __P((vpnfig_list *Figure, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndeclfuncvar __P((vpnfig_list *Figure, vpnfunc_list *Function, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndeclprocvar __P((vpnfig_list *Figure, vpnproc_list *Process, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndeclfuncdef __P((vpnfig_list *Figure, vpnfunc_list *Function, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndeclprocdef __P((vpnfig_list *Figure, vpnproc_list *Process, vexexpr *Atom, unsigned char Base)); + extern vpndecl_list *addvpndeclfuncarg __P((vpnfig_list *Figure, vpnfunc_list *Function, vexexpr *Atom, unsigned char Base, unsigned char Dir, unsigned char Class)); + + extern vpnplace_list *addvpnprocplace __P((vpnfig_list *Figure, vpnproc_list *Process, char *Name)); + extern vpntrans_list *addvpnproctrans __P((vpnfig_list *Figure, vpnproc_list *Process, char *Name)); + + extern vpnplace_list *addvpnfuncplace __P((vpnfig_list *Figure, vpnfunc_list *Function, char *Name)); + extern vpntrans_list *addvpnfunctrans __P((vpnfig_list *Figure, vpnfunc_list *Function, char *Name)); + + extern vpnattr_list *addvpnattr __P((vpnfig_list *Figure, char *Name, char *Entity, unsigned char Type, char *Value )); + extern vpnline_list *addvpnline __P((vpnfig_list *Figure, vpnline_list **HeadLine, long Line)); + extern vpnline_list *addvpnfileline __P((vpnfig_list *Figure, vpnline_list **HeadLine, char *File, long Line)); + + extern vpnmod_list *addvpnmod __P((vpnfig_list *Figure, char *Name)); + extern vpnport_list *addvpnmodport __P((vpnfig_list *Figure, vpnmod_list *Model, vexexpr *Atom, unsigned char Base, unsigned char Dir )); + extern vpngen_list *addvpnmodgen __P((vpnfig_list *Figure, vpnmod_list *Model, vexexpr *Atom, vexexpr *Expr, unsigned char Base )); + extern vpnins_list *addvpnins __P((vpnfig_list *Figure, char *Name, vpnmod_list *Model)); + extern vpnmap_list *addvpninsmap __P((vpnfig_list *Figure, vpnins_list *Instance, vexexpr *Formal, vexexpr *Actual )); + extern vpngen_list *addvpninsgen __P((vpnfig_list *Figure, vpnins_list *Instance, vexexpr *Atom, vexexpr *Expr)); + +/*------------------------------------------------------\ +| | +| Union Functions | +| | +\------------------------------------------------------*/ + + extern vpnline_list *unionvpnline __P((vpnfig_list *VpnFigure, vpnline_list **HeadLine, vpnline_list *SourceLine)); + extern vpnline_list *unionvpnfileline __P((vpnfig_list *VpnFigure, vpnline_list **HeadLine, vpnline_list *SourceLine)); + +/*------------------------------------------------------\ +| | +| Simplify Functions | +| | +\------------------------------------------------------*/ + + extern void simpvpnact __P((vpnact_list *VpnAct)); + extern void simpvpntrans __P((vpntrans_list *VpnTrans)); + extern void simpvpnproc __P((vpnproc_list *VpnProc)); + extern void simpvpnfunc __P((vpnfunc_list *VpnFunc)); + extern void simpvpnfig __P((vpnfig_list *VpnFigure)); + +/*------------------------------------------------------\ +| | +| Get Functions | +| | +\------------------------------------------------------*/ + + extern vpnsym *getvpnsymdecl __P((vpndecl_list *Declar, short Index)); + extern vpnsym *getvpnsymdeclpos __P((vpndecl_list *Declar, int Position)); + +/*------------------------------------------------------\ +| | +| Search Functions | +| | +\------------------------------------------------------*/ + + extern vpnfig_list *searchvpnfig __P((char *Name)); + extern vpnproc_list *searchvpnproc __P((vpnfig_list *Figure, char *Name)); + extern vpnfunc_list *searchvpnfunc __P((vpnfig_list *Figure, char *Name)); + extern vpnplace_list *searchvpnplace __P((vpnfig_list *Figure, char *Name)); + extern vpntrans_list *searchvpntrans __P((vpnfig_list *Figure, char *Name)); + extern vpnarc *searchvpnarc __P((vpnfig_list *Figure, void *Source, void *Target)); + extern vpnsym *searchvpnsym __P((vpnfig_list *Figure, char *Name, short Index, unsigned char Type)); + extern vpndecl_list *searchvpndecl __P((vpnfig_list *Figure, char *Name, unsigned char Type)); + + extern vpnmod_list *searchvpnmod __P((vpnfig_list *Figure, char *Name)); + extern vpnins_list *searchvpnins __P((vpnfig_list *Figure, char *Name)); + +/*------------------------------------------------------\ +| | +| Delete Functions | +| | +\------------------------------------------------------*/ + + extern int delvpnfig __P((char *Name)); + extern int delvpnplace __P((vpnfig_list *Figure, vpnplace_list *Place)); + extern int delvpntrans __P((vpnfig_list *Figure, vpntrans_list *Trans)); + extern int delvpnarc __P((vpnfig_list *Figure, vpnarc *Arc)); + extern int delvpnact __P((vpnfig_list *Figure, vpntrans_list *Trans, vpnact_list *Action)); + extern int delvpnline __P((vpnfig_list *Figure, vpnline_list **PrevLine, vpnline_list *Line)); + extern int delvpnproc __P((vpnfig_list *Figure, vpnproc_list *Process)); + extern int delvpnfunc __P((vpnfig_list *Figure, vpnfunc_list *Function)); + +/*------------------------------------------------------\ +| | +| View Functions | +| | +\------------------------------------------------------*/ + + extern void viewvpnfig __P((vpnfig_list *Figure)); + extern void viewvpnsym __P((vpnsym *Symbol)); + extern void viewvpndecl __P((vpndecl_list *Decl)); + extern void viewvpnact __P((vpnact_list *Action)); + extern void viewvpnplace __P((vpnplace_list *Place)); + extern void viewvpntrans __P((vpntrans_list *Trans)); + extern void viewvpnproc __P((vpnproc_list *Process)); + extern void viewvpnfunc __P((vpnfunc_list *Function)); + extern void viewvpnline __P((vpnline_list *Line)); + + extern void viewvpnins __P((vpnins_list *Instance)); + extern void viewvpnmod __P((vpnmod_list *Model)); + extern void viewvpnport __P((vpnport_list *Port)); + extern void viewvpnmap __P((vpnmap_list *Map)); + extern void viewvpngen __P((vpngen_list *Generic)); + +# endif diff --git a/alliance/src/vpn/src/vpnadd.c b/alliance/src/vpn/src/vpnadd.c new file mode 100644 index 00000000..d66b3db3 --- /dev/null +++ b/alliance/src/vpn/src/vpnadd.c @@ -0,0 +1,1675 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnadd.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include "vpnadd.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + vpnfig_list *HEAD_VPNFIG = (vpnfig_list *)0; + + char *VPN_FATHER_TYPE[ VPN_MAX_FATHER_TYPE ] = + { + "PROCESS", + "FUNCTION" + }; + + char *VPN_ACT_TYPE[ VPN_MAX_ACT_TYPE ] = + { + "UNKNOWN", + "ASG_PORT", + "ASG_SIGNAL", + "ASG_VARIABLE", + "ASG_DEFINE", + "ASG_ARG_SIG", + "ASG_ARG_VAR", + "CALL", + "RETURN" + }; + + char *VPN_TRANS_TYPE[ VPN_MAX_TRANS_TYPE ] = + { + "UNKNOWN", + "ACT_EXEC", + "INF_WAIT", + "SUP_WAIT", + "GUARDED", + "IMMEDIATE", + "ACT_GUARDED", + "ACT_EXEC_CONC", + "ACT_GUARDED_CONC" + }; + + char *VPN_PLACE_TYPE[ VPN_MAX_PLACE_TYPE ] = + { + "UNKNOWN", + "ASSIGN", + "IF", + "END_IF", + "CASE", + "END_CASE", + "WAIT", + "UNTIL", + "UNTIL_TEST", + "END_UNTIL", + "WHILE", + "WHILE_TEST", + "END_WHILE", + "FOR", + "FOR_LOOP", + "FOR_TEST", + "FOR_INC", + "END_FOR", + "NEXT", + "EXIT", + "CALL", + "RETURN", + "PROCESS", + "FUNCTION", + "LOOP", + "END_LOOP", + "END_EXIT", + "END_NEXT", + "GOTO", + "LABEL", + "DO", + "DO_TEST", + "DO_WHILE", + "END_DO", + "SWITCH", + "END_SWITCH", + "C_CASE", + "BREAK", + "C_RETURN" + }; + + char *VPN_DECLAR_TYPE[ VPN_MAX_DECLAR_TYPE ] = + { + "ALL", + "PORT", + "SIGNAL", + "VARIABLE", + "DEFINE", + "ARGUMENT", + "CONSTANT", + "GENERIC" + }; + + char *VPN_ARC_TYPE[ VPN_MAX_ARC_TYPE ] = + { + "PLACE_TRANS", + "TRANS_PLACE" + }; + + char *VPN_KIND_TYPE[ VPN_MAX_KIND_TYPE ] = + { + "NONE", + "BUS", + "REGISTER" + }; + + char *VPN_CLASS_TYPE[ VPN_MAX_CLASS_TYPE ] = + { + "NONE", + "CONSTANT", + "VARIABLE", + "SIGNAL" + }; + + char *VPN_DIR_TYPE[ VPN_MAX_DIR_TYPE ] = + { + "IN", + "OUT", + "INOUT" + }; + + char *VPN_ATTRIBUTE_TYPE[ VPN_MAX_ATTR_TYPE ] = + { + "NONE", + "ENTITY", + "ARCHITECTURE", + "PACKAGE", + "FUNCTION", + "PROCEDURE", + "SUBTYPE", + "CONSTANT", + "VARIABLE", + "SIGNAL", + "LABEL", + "TYPE", + "CONFIGURATION", + "COMPONENT" + }; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Add Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Add Figure | +| | +\------------------------------------------------------------*/ + +vpnfig_list *addvpnfig( Name ) + + char *Name; +{ + vpnfig_list *Figure; + int Type; + + Figure = allocvpnfig(); + + Figure->NAME = namealloc( Name ); + Figure->NEXT = HEAD_VPNFIG; + HEAD_VPNFIG = Figure; + + Figure->HASH_PROCESS = createauthtable( 50 ); + Figure->HASH_FUNCTION = createauthtable( 50 ); + Figure->HASH_MODEL = createauthtable( 50 ); + Figure->HASH_INSTANCE = createauthtable( 50 ); + Figure->HASH_TRANS = createauthtable( 50 ); + Figure->HASH_PLACE = createauthtable( 50 ); + Figure->HASH_ARC = createauth2table( 50 ); + + for ( Type = 0; Type < VPN_MAX_DECLAR_TYPE; Type++ ) + { + Figure->HASH_DECLAR[ Type ] = createauthtable( 50 ); + } + + return( Figure ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Attribute | +| | +\------------------------------------------------------------*/ + +vpnattr_list *addvpnattr( Figure, Name, Entity, Type, Value ) + + vpnfig_list *Figure; + char *Name; + char *Entity; + unsigned char Type; + char *Value; +{ + vpnattr_list *Attr; + + Name = namealloc( Name ); + Entity = namealloc( Entity ); + Value = namealloc( Value ); + + Attr = allocvpnattr(); + + Attr->NAME = Name; + Attr->ENTITY = Entity; + Attr->TYPE = Type; + Attr->VALUE = Value; + + Attr->NEXT = Figure->ATTRIBUTE; + Figure->ATTRIBUTE = Attr; + + return( Attr ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Process Place | +| | +\------------------------------------------------------------*/ + +vpnplace_list *addvpnprocplace( Figure, Process, Name ) + + vpnfig_list *Figure; + vpnproc_list *Process; + char *Name; +{ + vpnplace_list *Place; + + Name = namealloc( Name ); + Place = searchvpnplace( Figure, Name ); + + if ( Place != (vpnplace_list *)0 ) + { + vpnerror( VPN_PLACE_EXIST_ERROR, Name, 0 ); + } + + Place = allocvpnplace(); + + Place->NAME = Name; + Place->FATHER = VPN_FATHER_PROCESS; + Place->NEXT = Process->PLACE; + Place->PREV = &Process->PLACE; + + if ( Process->PLACE != (vpnplace_list *)0 ) + { + Process->PLACE->PREV = &Place->NEXT; + } + + Process->PLACE = Place; + + addauthelem( Figure->HASH_PLACE, Name, (long)Place ); + + return( Place ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Function Place | +| | +\------------------------------------------------------------*/ + +vpnplace_list *addvpnfuncplace( Figure, Function, Name ) + + vpnfig_list *Figure; + vpnfunc_list *Function; + char *Name; +{ + vpnplace_list *Place; + + Name = namealloc( Name ); + Place = searchvpnplace( Figure, Name ); + + if ( Place != (vpnplace_list *)0 ) + { + vpnerror( VPN_PLACE_EXIST_ERROR, Name, 0 ); + } + + Place = allocvpnplace(); + + Place->NAME = Name; + Place->FATHER = VPN_FATHER_FUNCTION; + Place->NEXT = Function->PLACE; + Place->PREV = &Function->PLACE; + + if ( Function->PLACE != (vpnplace_list *)0 ) + { + Function->PLACE->PREV = &Place->NEXT; + } + + Function->PLACE = Place; + + addauthelem( Figure->HASH_PLACE, Name, (long)Place ); + + return( Place ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Process Trans | +| | +\------------------------------------------------------------*/ + +vpntrans_list *addvpnproctrans( Figure, Process, Name ) + + vpnfig_list *Figure; + vpnproc_list *Process; + char *Name; +{ + vpntrans_list *Trans; + + Name = namealloc( Name ); + Trans = searchvpntrans( Figure, Name ); + + if ( Trans != (vpntrans_list *)0 ) + { + vpnerror( VPN_TRANS_EXIST_ERROR, Name, 0 ); + } + + Trans = allocvpntrans(); + + Trans->NAME = Name; + Trans->FATHER = VPN_FATHER_PROCESS; + Trans->LAST_ACT = &Trans->ACT; + Trans->NEXT = Process->TRANS; + Trans->PREV = &Process->TRANS; + + if ( Process->TRANS != (vpntrans_list *)0 ) + { + Process->TRANS->PREV = &Trans->NEXT; + } + + Process->TRANS = Trans; + + addauthelem( Figure->HASH_TRANS, Name, (long)Trans ); + + return( Trans ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Function Trans | +| | +\------------------------------------------------------------*/ + +vpntrans_list *addvpnfunctrans( Figure, Function, Name ) + + vpnfig_list *Figure; + vpnfunc_list *Function; + char *Name; +{ + vpntrans_list *Trans; + + Name = namealloc( Name ); + Trans = searchvpntrans( Figure, Name ); + + if ( Trans != (vpntrans_list *)0 ) + { + vpnerror( VPN_TRANS_EXIST_ERROR, Name, 0 ); + } + + Trans = allocvpntrans(); + + Trans->NAME = Name; + Trans->FATHER = VPN_FATHER_FUNCTION; + Trans->LAST_ACT = &Trans->ACT; + Trans->NEXT = Function->TRANS; + Trans->PREV = &Function->TRANS; + + if ( Function->TRANS != (vpntrans_list *)0 ) + { + Function->TRANS->PREV = &Trans->NEXT; + } + + Function->TRANS = Trans; + + addauthelem( Figure->HASH_TRANS, Name, (long)Trans ); + + return( Trans ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Arc | +| | +\------------------------------------------------------------*/ + +vpnarc *addvpnarc( Figure, Source, Target, ArcType ) + + vpnfig_list *Figure; + void *Source; + void *Target; + unsigned char ArcType; +{ + vpnplace_list *Place; + vpntrans_list *Trans; + vpnarc *Arc; + + if ( ArcType == VPN_ARC_PLACE_TRANS ) + { + Place = (vpnplace_list *)Source; + Trans = (vpntrans_list *)Target; + } + else + { + Place = (vpnplace_list *)Target; + Trans = (vpntrans_list *)Source; + } + + Arc = searchvpnarc( Figure, Source, Target ); + + if ( Arc != (vpnarc *)0 ) + { + if ( ArcType == VPN_ARC_PLACE_TRANS ) + { + vpnerror( VPN_ARC_PLACE_EXIST_ERROR, Place->NAME, Trans->NAME ); + } + else + { + vpnerror( VPN_ARC_TRANS_EXIST_ERROR, Trans->NAME, Place->NAME ); + } + } + + Arc = allocvpnarc(); + + if ( ArcType == VPN_ARC_PLACE_TRANS ) + { + Place->NUMBER_OUT++; + Place->TRANS_OUT = addchain( Place->TRANS_OUT, (void *)Arc ); + Trans->NUMBER_IN++; + Trans->PLACE_IN = addchain( Trans->PLACE_IN, (void *)Arc ); + } + else + { + Trans->NUMBER_OUT++; + Trans->PLACE_OUT = addchain( Trans->PLACE_OUT, (void *)Arc ); + Place->NUMBER_IN++; + Place->TRANS_IN = addchain( Place->TRANS_IN, (void *)Arc ); + } + + Arc->SOURCE = Source; + Arc->TARGET = Target; + Arc->TYPE = ArcType; + + addauth2elem( Figure->HASH_ARC, Source, Target, (long)Arc ); + + return( Arc ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration | +| | +\------------------------------------------------------------*/ + +static vpndecl_list *loc_addvpndecl( Figure, Expr, Type, Base ) + + vpnfig_list *Figure; + vexexpr *Expr; + unsigned char Type; + unsigned char Base; +{ + vpndecl_list *Decl; + vpndecl_list **PrevDecl; + vexexpr *Atom; + vpnsym *Sym; + char *Name; + int Width; + int Index; + int IndexStep; + int Scan; + + if ( ! IsVexNodeAtom( Expr ) ) + { + Atom = getvexarrayatom( Expr ); + } + else + { + Atom = Expr; + } + + Name = GetVexAtomValue( Atom ); + + if ( ( Type <= VPN_DECLAR_ALL ) || + ( Type >= VPN_MAX_DECLAR_TYPE ) ) + { + vpnerror( VPN_UNKNOWN_DECLAR_TYPE, Type, Name ); + } + + Decl = allocvpndecl(); + + Width = Atom->WIDTH; + Sym = allocvpnsym( Width ); + + if ( ( ! IsVexNodeVarWidth( Atom ) ) && + ( IsVexAtomVector( Atom ) ) ) + { + Index = Atom->LEFT; + IndexStep = IsVexAtomDown( Atom ) ? -1 : 1; + } + else + { + Index = -1; + IndexStep = 0; + } + + for ( Scan = 0; Scan < Width; Scan++ ) + { + Sym[ Scan ].NAME = Name; + Sym[ Scan ].INDEX = Index; + Sym[ Scan ].DECL = Decl; + + Index += IndexStep; + } + + PrevDecl = &Figure->DECLAR[ Type ]; + + Decl->VEX_ATOM = Expr; + Decl->DECL_SYM = Sym; + Decl->TYPE = Type; + Decl->BASE = Base; + Decl->PREV = &Figure->DECLAR[ Type ]; + Decl->NEXT = *(Decl->PREV); + + if ( Decl->NEXT != (vpndecl_list *)0 ) + { + Decl->NEXT->PREV = &Decl->NEXT; + } + + *(Decl->PREV) = Decl; + + addauthelem( Figure->HASH_DECLAR[ Type ], Name, (long)Decl ); + addauthelem( Figure->HASH_DECLAR[ VPN_DECLAR_ALL ], Name, (long)Decl ); + + return( Decl ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndecl( Figure, Atom, Type, Base ) + + vpnfig_list *Figure; + vexexpr *Atom; + unsigned char Type; + unsigned char Base; +{ + vpndecl_list *Decl; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Decl = searchvpndeclall( Figure, Name ); + + if ( Decl != (vpndecl_list *)0 ) + { + vpnerror( VPN_DECLAR_EXIST_ERROR, Name, 0 ); + } + + Decl = loc_addvpndecl( Figure, Atom, Type, Base ); + + return( Decl ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Port | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclport( Figure, Atom, Base, Dir, Kind ) + + vpnfig_list *Figure; + vexexpr *Atom; + unsigned char Base; + unsigned char Dir; + unsigned char Kind; +{ + vpndecl_list *Port; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Port = searchvpndeclall( Figure, Name ); + + if ( Port != (vpndecl_list *)0 ) + { + vpnerror( VPN_PORT_EXIST_ERROR, Name, 0 ); + } + + Port = loc_addvpndecl( Figure, Atom, VPN_DECLAR_PORT, Base ); + Port->DIR = Dir; + Port->KIND = Kind; + + return( Port ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Signal | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclsig( Figure, Atom, Base, Kind ) + + vpnfig_list *Figure; + vexexpr *Atom; + unsigned char Base; + unsigned char Kind; +{ + vpndecl_list *Signal; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Signal = searchvpndeclall( Figure, Name ); + + if ( Signal != (vpndecl_list *)0 ) + { + vpnerror( VPN_SIGNAL_EXIST_ERROR, Name, 0 ); + } + + Signal = loc_addvpndecl( Figure, Atom, VPN_DECLAR_SIGNAL, Base ); + Signal->DIR = VPN_DIR_INOUT; + Signal->KIND = Kind; + + return( Signal ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Constant | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclcst( Figure, Atom, Base ) + + vpnfig_list *Figure; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Constant; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Constant = searchvpndeclall( Figure, Name ); + + if ( Constant != (vpndecl_list *)0 ) + { + vpnerror( VPN_CONSTANT_EXIST_ERROR, Name, 0 ); + } + + Constant = loc_addvpndecl( Figure, Atom, VPN_DECLAR_CONSTANT, Base ); + Constant->DIR = VPN_DIR_IN; + + return( Constant ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Generic | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclgen( Figure, Atom, Base ) + + vpnfig_list *Figure; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Generic; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Generic = searchvpndeclall( Figure, Name ); + + if ( Generic != (vpndecl_list *)0 ) + { + vpnerror( VPN_GENERIC_EXIST_ERROR, Name, 0 ); + } + + Generic = loc_addvpndecl( Figure, Atom, VPN_DECLAR_GENERIC, Base ); + Generic->DIR = VPN_DIR_IN; + + return( Generic ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declar Variable | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclvar( Figure, Atom, Base ) + + vpnfig_list *Figure; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Variable; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Variable = searchvpndeclall( Figure, Name ); + + if ( Variable != (vpndecl_list *)0 ) + { + vpnerror( VPN_VARIABLE_EXIST_ERROR, Name, 0 ); + } + + Variable = loc_addvpndecl( Figure, Atom, VPN_DECLAR_VARIABLE, Base ); + Variable->DIR = VPN_DIR_INOUT; + + Figure->VAR_DECL = addchain( Figure->VAR_DECL, Variable ); + + return( Variable ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declar Process Variable | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclprocvar( Figure, Process, Atom, Base ) + + vpnfig_list *Figure; + vpnproc_list *Process; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Variable; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Variable = searchvpndeclall( Figure, Name ); + + if ( Variable != (vpndecl_list *)0 ) + { + vpnerror( VPN_VARIABLE_EXIST_ERROR, Name, 0 ); + } + + Variable = loc_addvpndecl( Figure, Atom, VPN_DECLAR_VARIABLE, Base ); + Variable->DIR = VPN_DIR_INOUT; + + Process->VAR_DECL = addchain( Process->VAR_DECL, Variable ); + + return( Variable ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declar Function Variable | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclfuncvar( Figure, Function, Atom, Base ) + + vpnfig_list *Figure; + vpnfunc_list *Function; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Variable; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Variable = searchvpndeclall( Figure, Name ); + + if ( Variable != (vpndecl_list *)0 ) + { + vpnerror( VPN_VARIABLE_EXIST_ERROR, Name, 0 ); + } + + Variable = loc_addvpndecl( Figure, Atom, VPN_DECLAR_VARIABLE, Base ); + Variable->DIR = VPN_DIR_INOUT; + + Function->VAR_DECL = addchain( Function->VAR_DECL, Variable ); + + return( Variable ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Define | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndecldef( Figure, Atom, Base ) + + vpnfig_list *Figure; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Define; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Define = searchvpndeclall( Figure, Name ); + + if ( Define != (vpndecl_list *)0 ) + { + vpnerror( VPN_DEFINE_EXIST_ERROR, Name, 0 ); + } + + Define = loc_addvpndecl( Figure, Atom, VPN_DECLAR_DEFINE, Base ); + Define->DIR = VPN_DIR_INOUT; + + Figure->DEF_DECL = addchain( Figure->DEF_DECL, Define ); + + return( Define ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Process Define | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclprocdef( Figure, Process, Atom, Base ) + + vpnfig_list *Figure; + vpnproc_list *Process; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Define; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Define = searchvpndeclall( Figure, Name ); + + if ( Define != (vpndecl_list *)0 ) + { + vpnerror( VPN_DEFINE_EXIST_ERROR, Name, 0 ); + } + + Define = loc_addvpndecl( Figure, Atom, VPN_DECLAR_DEFINE, Base ); + Define->DIR = VPN_DIR_INOUT; + + Process->DEF_DECL = addchain( Process->DEF_DECL, Define ); + + return( Define ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Function Define | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclfuncdef( Figure, Function, Atom, Base ) + + vpnfig_list *Figure; + vpnfunc_list *Function; + vexexpr *Atom; + unsigned char Base; +{ + vpndecl_list *Define; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Define = searchvpndeclall( Figure, Name ); + + if ( Define != (vpndecl_list *)0 ) + { + vpnerror( VPN_DEFINE_EXIST_ERROR, Name, 0 ); + } + + Define = loc_addvpndecl( Figure, Atom, VPN_DECLAR_DEFINE, Base ); + Define->DIR = VPN_DIR_INOUT; + + Function->DEF_DECL = addchain( Function->DEF_DECL, Define ); + + return( Define ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Declaration Argument | +| | +\------------------------------------------------------------*/ + +vpndecl_list *addvpndeclfuncarg( Figure, Function, Atom, Base, Dir, Class ) + + vpnfig_list *Figure; + vpnfunc_list *Function; + vexexpr *Atom; + unsigned char Base; + unsigned char Dir; + unsigned char Class; +{ + vpndecl_list *Argument; + chain_list *NewChain; + char *Name; + + if ( ! IsVexNodeAtom( Atom ) ) Name = getvexarrayname( Atom ); + else Name = GetVexAtomValue( Atom ); + + Argument = searchvpndeclall( Figure, Name ); + + if ( Argument != (vpndecl_list *)0 ) + { + vpnerror( VPN_ARGUMENT_EXIST_ERROR, Name, 0 ); + } + + Argument = loc_addvpndecl( Figure, Atom, VPN_DECLAR_ARGUMENT, Base ); + Argument->DIR = Dir; + Argument->CLASS = Class; + + NewChain = addchain( (chain_list *)0, Argument ); + + *Function->LAST_ARG = NewChain; + Function->LAST_ARG = &NewChain->NEXT; + + return( Argument ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Process | +| | +\------------------------------------------------------------*/ + +vpnproc_list *addvpnproc( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + vpnproc_list *Process; + + Name = namealloc( Name ); + Process = searchvpnproc( Figure, Name ); + + if ( Process != (vpnproc_list *)0 ) + { + vpnerror( VPN_PROC_EXIST_ERROR, Name, 0 ); + } + + Process = allocvpnproc(); + + Process->NAME = Name; + Process->PREV = &Figure->PROCESS; + Process->NEXT = Figure->PROCESS; + + if ( Figure->PROCESS != (vpnproc_list *)0 ) + { + Figure->PROCESS->PREV = &Process->NEXT; + } + + Figure->PROCESS = Process; + + addauthelem( Figure->HASH_PROCESS, Name, (long)Process ); + + return( Process ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Function | +| | +\------------------------------------------------------------*/ + +vpnfunc_list *addvpnfunc( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + vpnfunc_list *Function; + + Name = namealloc( Name ); + Function = searchvpnfunc( Figure, Name ); + + if ( Function != (vpnfunc_list *)0 ) + { + vpnerror( VPN_FUNC_EXIST_ERROR, Name, 0 ); + } + + Function = allocvpnfunc(); + + Function->NAME = Name; + Function->LAST_ARG = &Function->ARG_DECL; + Function->PREV = &Figure->FUNCTION; + Function->NEXT = Figure->FUNCTION; + + if ( Figure->FUNCTION != (vpnfunc_list *)0 ) + { + Figure->FUNCTION->PREV = &Function->NEXT; + } + + Figure->FUNCTION = Function; + + addauthelem( Figure->HASH_FUNCTION, Name, (long)Function ); + + return( Function ); +} + +/*------------------------------------------------------------\ +| | +| Local Vpn Add Action | +| | +\------------------------------------------------------------*/ + +static vpnact_list *loc_addvpnact( Atom, Expr, Type ) + + vexexpr *Atom; + vexexpr *Expr; + unsigned char Type; +{ + vpnact_list *Action; + + Action = allocvpnact(); + + Action->VEX_ATOM = Atom; + Action->VEX_EXPR = Expr; + Action->TYPE = Type; + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Action | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnact( Figure, Trans, Atom, Expr, Type ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vexexpr *Atom; + vexexpr *Expr; + unsigned char Type; +{ + vpnact_list *Action; + + Action = loc_addvpnact( Atom, Expr, Type ); + + *Trans->LAST_ACT = Action; + Action->PREV = Trans->LAST_ACT; + Trans->LAST_ACT = &Action->NEXT; + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add After Action | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnactafter( Figure, Trans, PrevAction, Atom, Expr, Type ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vpnact_list *PrevAction; + vexexpr *Atom; + vexexpr *Expr; + unsigned char Type; +{ + vpnact_list *Action; + vpnact_list *NextAction; + + Action = loc_addvpnact( Atom, Expr, Type ); + + if ( PrevAction == (vpnact_list *)0 ) + { + NextAction = Trans->ACT; + Trans->ACT = Action; + Action->PREV = &Trans->ACT; + } + else + { + NextAction = PrevAction->NEXT; + PrevAction->NEXT = Action; + Action->PREV = &PrevAction->NEXT; + } + + Action->NEXT = NextAction; + + if ( NextAction != (vpnact_list *)0 ) + { + NextAction->PREV = &Action->NEXT; + } + else + { + Trans->LAST_ACT = &Action->NEXT; + } + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Before Action | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnactbefore( Figure, Trans, NextAction, Atom, Expr, Type ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vpnact_list *NextAction; + vexexpr *Atom; + vexexpr *Expr; + unsigned char Type; +{ + vpnact_list *Action; + + Action = loc_addvpnact( Atom, Expr, Type ); + + if ( NextAction == (vpnact_list *)0 ) + { + *Trans->LAST_ACT = Action; + Action->PREV = Trans->LAST_ACT; + Trans->LAST_ACT = &Action->NEXT; + } + else + { + *NextAction->PREV = Action; + Action->PREV = NextAction->PREV; + Action->NEXT = NextAction; + NextAction->PREV = &Action->NEXT; + } + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add First Action | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnactfirst( Figure, Trans, Atom, Expr, Type ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vexexpr *Atom; + vexexpr *Expr; + unsigned char Type; +{ + vpnact_list *Action; + + Action = loc_addvpnact( Atom, Expr, Type ); + + Action->NEXT = Trans->ACT; + Action->PREV = &Trans->ACT; + Trans->ACT = Action; + + if ( Action->NEXT != (vpnact_list *)0 ) + { + Action->NEXT->PREV = &Action->NEXT; + } + else + { + Trans->LAST_ACT = &Action->NEXT; + } + + return( Action ); +} + + +/*------------------------------------------------------------\ +| | +| Local Vpn Add Action Assign | +| | +\------------------------------------------------------------*/ + +static vpnact_list *loc_addvpnactasg( Figure, Atom, Expr ) + + vpnfig_list *Figure; + vexexpr *Atom; + vexexpr *Expr; +{ + vpnact_list *Action; + vpndecl_list *Declar; + char *Name; + unsigned char Type; + + Name = getvexatomname( Atom ); + Declar = searchvpndeclall( Figure, Name ); + + if ( Declar == (vpndecl_list *)0 ) + { + vpnerror( VPN_UNDECLARED_SYMBOL, Name, 0 ); + } + + Type = -1; + + switch ( Declar->TYPE ) + { + case VPN_DECLAR_PORT : + Type = VPN_ACT_ASG_PORT; + break; + case VPN_DECLAR_SIGNAL : + Type = VPN_ACT_ASG_SIGNAL; + break; + case VPN_DECLAR_VARIABLE : + Type = VPN_ACT_ASG_VARIABLE; + break; + case VPN_DECLAR_DEFINE : + Type = VPN_ACT_ASG_DEFINE; + break; + case VPN_DECLAR_ARGUMENT : + if ( Declar->CLASS == VPN_CLASS_SIGNAL ) Type = VPN_ACT_ASG_ARG_SIG; + else Type = VPN_ACT_ASG_ARG_VAR; + break; + default : + vpnerror( VPN_BAD_ASSIGN_TYPE, Name, Type ); + } + + Action = loc_addvpnact( Atom, Expr, Type ); + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn add after Action Assign | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnactasgafter( Figure, Trans, PrevAction, Atom, Expr ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vpnact_list *PrevAction; + vexexpr *Atom; + vexexpr *Expr; +{ + vpnact_list *Action; + vpnact_list *NextAction; + + Action = loc_addvpnactasg( Figure, Atom, Expr ); + + if ( PrevAction == (vpnact_list *)0 ) + { + NextAction = Trans->ACT; + Trans->ACT = Action; + Action->PREV = &Trans->ACT; + } + else + { + NextAction = PrevAction->NEXT; + PrevAction->NEXT = Action; + Action->PREV = &PrevAction->NEXT; + } + + Action->NEXT = NextAction; + + if ( NextAction != (vpnact_list *)0 ) + { + NextAction->PREV = &Action->NEXT; + } + else + { + Trans->LAST_ACT = &Action->NEXT; + } + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn add before Action Assign | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnactasgbefore( Figure, Trans, NextAction, Atom, Expr ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vpnact_list *NextAction; + vexexpr *Atom; + vexexpr *Expr; +{ + vpnact_list *Action; + + Action = loc_addvpnactasg( Figure, Atom, Expr ); + + if ( NextAction == (vpnact_list *)0 ) + { + *Trans->LAST_ACT = Action; + Action->PREV = Trans->LAST_ACT; + Trans->LAST_ACT = &Action->NEXT; + } + else + { + *NextAction->PREV = Action; + Action->PREV = NextAction->PREV; + Action->NEXT = NextAction; + NextAction->PREV = &Action->NEXT; + } + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add First Action Assign | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnactasgfirst( Figure, Trans, Atom, Expr ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vexexpr *Atom; + vexexpr *Expr; +{ + vpnact_list *Action; + + Action = loc_addvpnactasg( Figure, Atom, Expr ); + + Action->NEXT = Trans->ACT; + Action->PREV = &Trans->ACT; + Trans->ACT = Action; + + if ( Action->NEXT != (vpnact_list *)0 ) + { + Action->NEXT->PREV = &Action->NEXT; + } + else + { + Trans->LAST_ACT = &Action->NEXT; + } + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Action Assign | +| | +\------------------------------------------------------------*/ + +vpnact_list *addvpnactasg( Figure, Trans, Atom, Expr ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vexexpr *Atom; + vexexpr *Expr; +{ + vpnact_list *Action; + + Action = loc_addvpnactasg( Figure, Atom, Expr ); + + *Trans->LAST_ACT = Action; + Action->PREV = Trans->LAST_ACT; + Trans->LAST_ACT = &Action->NEXT; + + return( Action ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add File Line | +| | +\------------------------------------------------------------*/ + +vpnline_list *addvpnfileline( Figure, HeadLine, File, Line ) + + vpnfig_list *Figure; + vpnline_list **HeadLine; + char *File; + long Line; +{ + vpnline_list **PrevLine; + vpnline_list *VpnLine; + + File = autnamealloc( File ); + + PrevLine = HeadLine; + + for ( VpnLine = *PrevLine; + VpnLine != (vpnline_list *)0; + VpnLine = VpnLine->NEXT ) + { + if ( VpnLine->NAME == File ) + { + if ( VpnLine->LINE == Line ) return( VpnLine ); + if ( VpnLine->LINE < Line ) PrevLine = &VpnLine->NEXT; + } + } + + VpnLine = allocvpnline(); + + VpnLine->LINE = Line; + VpnLine->NAME = File; + VpnLine->NEXT = *PrevLine; + *PrevLine = VpnLine; + + return( VpnLine ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Line | +| | +\------------------------------------------------------------*/ + +vpnline_list *addvpnline( Figure, HeadLine, Line ) + + vpnfig_list *Figure; + vpnline_list **HeadLine; + long Line; +{ + return( addvpnfileline( Figure, HeadLine, (char *)0, Line ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Model | +| | +\------------------------------------------------------------*/ + +vpnmod_list *addvpnmod( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + vpnmod_list *Model; + + Name = namealloc( Name ); + Model = searchvpnmod( Figure, Name ); + + if ( Model != (vpnmod_list *)0 ) + { + vpnerror( VPN_MOD_EXIST_ERROR, Name, 0 ); + } + + Model = allocvpnmod(); + + Model->NAME = Name; + + Model->NEXT = Figure->MODEL; + Figure->MODEL = Model; + + addauthelem( Figure->HASH_MODEL, Name, (long)Model ); + + return( Model ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Model Port | +| | +\------------------------------------------------------------*/ + +vpnport_list *addvpnmodport( Figure, Model, Atom, Base, Dir ) + + vpnfig_list *Figure; + vpnmod_list *Model; + vexexpr *Atom; + unsigned char Base; + unsigned char Dir; +{ + vpnport_list *Port; + + Port = allocvpnport(); + + Port->VEX_ATOM = Atom; + Port->DIR = Dir; + Port->BASE = Base; + + + Port->NEXT = Model->PORT; + Model->PORT = Port; + + return( Port ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Model Generic | +| | +\------------------------------------------------------------*/ + +vpngen_list *addvpnmodgen( Figure, Model, Atom, Expr, Base ) + + vpnfig_list *Figure; + vpnmod_list *Model; + vexexpr *Atom; + vexexpr *Expr; + unsigned char Base; +{ + vpngen_list *Generic; + + Generic = allocvpngen(); + + Generic->VEX_ATOM = Atom; + Generic->VEX_EXPR = Expr; + Generic->BASE = Base; + + Generic->NEXT = Model->GENERIC; + Model->GENERIC = Generic; + + return( Generic ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Instance | +| | +\------------------------------------------------------------*/ + +vpnins_list *addvpnins( Figure, Name, Model ) + + vpnfig_list *Figure; + char *Name; + vpnmod_list *Model; +{ + vpnins_list *Instance; + + Name = namealloc( Name ); + Instance = searchvpnins( Figure, Name ); + + if ( Instance != (vpnins_list *)0 ) + { + vpnerror( VPN_INS_EXIST_ERROR, Name, 0 ); + } + + Instance = allocvpnins(); + + Instance->NAME = Name; + Instance->MODEL = Model; + + Instance->NEXT = Figure->INSTANCE; + Figure->INSTANCE = Instance; + + addauthelem( Figure->HASH_INSTANCE, Name, (long)Instance ); + + return( Instance ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Instance Map | +| | +\------------------------------------------------------------*/ + +vpnmap_list *addvpninsmap( Figure, Instance, Formal, Actual ) + + vpnfig_list *Figure; + vpnins_list *Instance; + vexexpr *Formal; + vexexpr *Actual; +{ + vpnmap_list *Map; + + Map = allocvpnmap(); + + Map->VEX_FORMAL = Formal; + Map->VEX_ACTUAL = Actual; + + Map->NEXT = Instance->MAP; + Instance->MAP = Map; + + return( Map ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Add Instance Generic | +| | +\------------------------------------------------------------*/ + +vpngen_list *addvpninsgen( Figure, Instance, Atom, Expr ) + + vpnfig_list *Figure; + vpnins_list *Instance; + vexexpr *Atom; + vexexpr *Expr; +{ + vpngen_list *Generic; + + Generic = allocvpngen(); + + Generic->VEX_ATOM = Atom; + Generic->VEX_EXPR = Expr; + + Generic->NEXT = Instance->GENERIC; + Instance->GENERIC = Generic; + + return( Generic ); +} diff --git a/alliance/src/vpn/src/vpnadd.h b/alliance/src/vpn/src/vpnadd.h new file mode 100644 index 00000000..824987ff --- /dev/null +++ b/alliance/src/vpn/src/vpnadd.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnadd.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_ADD_H +# define VPN_ADD_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnalloc.c b/alliance/src/vpn/src/vpnalloc.c new file mode 100644 index 00000000..db6a7d65 --- /dev/null +++ b/alliance/src/vpn/src/vpnalloc.c @@ -0,0 +1,249 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnalloc.c | +| | +| Date : 04.07.96 | +| | +| Vpnhor : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include "vpnalloc.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Alloc Figure | +| | +\------------------------------------------------------------*/ + +vpnfig_list *allocvpnfig() +{ + return( (vpnfig_list *)autallocblock( sizeof( vpnfig_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Process | +| | +\------------------------------------------------------------*/ + +vpnproc_list *allocvpnproc() +{ + return( (vpnproc_list *)autallocheap( sizeof( vpnproc_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Function | +| | +\------------------------------------------------------------*/ + +vpnfunc_list *allocvpnfunc() +{ + return( (vpnfunc_list *)autallocheap( sizeof( vpnfunc_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Trans | +| | +\------------------------------------------------------------*/ + +vpntrans_list *allocvpntrans() +{ + return( (vpntrans_list *)autallocheap( sizeof( vpntrans_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Place | +| | +\------------------------------------------------------------*/ + +vpnplace_list *allocvpnplace() +{ + return( (vpnplace_list *)autallocheap( sizeof( vpnplace_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Arc | +| | +\------------------------------------------------------------*/ + +vpnarc *allocvpnarc() +{ + return( (vpnarc *)autallocheap( sizeof( vpnarc ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Symbol | +| | +\------------------------------------------------------------*/ + +vpnsym *allocvpnsym( Width ) + + unsigned int Width; +{ + return( (vpnsym *)autallocblock( sizeof( vpnsym ) * Width ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Declaration | +| | +\------------------------------------------------------------*/ + +vpndecl_list *allocvpndecl() +{ + return( (vpndecl_list *)autallocheap( sizeof( vpndecl_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Action | +| | +\------------------------------------------------------------*/ + +vpnact_list *allocvpnact() +{ + return( (vpnact_list *)autallocheap( sizeof( vpnact_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Attribute | +| | +\------------------------------------------------------------*/ + +vpnattr_list *allocvpnattr() +{ + return( (vpnattr_list *)autallocheap( sizeof( vpnattr_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Line | +| | +\------------------------------------------------------------*/ + +vpnline_list *allocvpnline() +{ + return( (vpnline_list *)autallocheap( sizeof( vpnline_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Model | +| | +\------------------------------------------------------------*/ + +vpnmod_list *allocvpnmod() +{ + return( (vpnmod_list *)autallocheap( sizeof( vpnmod_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Instance | +| | +\------------------------------------------------------------*/ + +vpnins_list *allocvpnins() +{ + return( (vpnins_list *)autallocheap( sizeof( vpnins_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Port | +| | +\------------------------------------------------------------*/ + +vpnport_list *allocvpnport() +{ + return( (vpnport_list *)autallocheap( sizeof( vpnport_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Map | +| | +\------------------------------------------------------------*/ + +vpnmap_list *allocvpnmap() +{ + return( (vpnmap_list *)autallocheap( sizeof( vpnmap_list ) ) ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Alloc Generic | +| | +\------------------------------------------------------------*/ + +vpngen_list *allocvpngen() +{ + return( (vpngen_list *)autallocheap( sizeof( vpngen_list ) ) ); +} diff --git a/alliance/src/vpn/src/vpnalloc.h b/alliance/src/vpn/src/vpnalloc.h new file mode 100644 index 00000000..129dbcf3 --- /dev/null +++ b/alliance/src/vpn/src/vpnalloc.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnalloc.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_ALLOC_H +# define VPN_ALLOC_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpndel.c b/alliance/src/vpn/src/vpndel.c new file mode 100644 index 00000000..f17f91c8 --- /dev/null +++ b/alliance/src/vpn/src/vpndel.c @@ -0,0 +1,1084 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpndel.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include "vpndel.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Del Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Del All Line | +| | +\------------------------------------------------------------*/ + +static void loc_delallvpnline( ScanLine ) + + vpnline_list *ScanLine; +{ + vpnline_list *Delete; + + while ( ScanLine != (vpnline_list *)0 ) + { + Delete = ScanLine; + ScanLine = ScanLine->NEXT; + + freevpnline( Delete ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Del All Port | +| | +\------------------------------------------------------------*/ + +static void loc_delallvpnport( ScanPort ) + + vpnport_list *ScanPort; +{ + vpnport_list *Delete; + + while ( ScanPort != (vpnport_list *)0 ) + { + Delete = ScanPort; + ScanPort = ScanPort->NEXT; + + loc_delallvpnline( Delete->LINE ); + freevexexpr( Delete->VEX_ATOM ); + + freevpnport( Delete ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Del All Map | +| | +\------------------------------------------------------------*/ + +static void loc_delallvpnmap( ScanMap ) + + vpnmap_list *ScanMap; +{ + vpnmap_list *Delete; + + while ( ScanMap != (vpnmap_list *)0 ) + { + Delete = ScanMap; + ScanMap = ScanMap->NEXT; + + loc_delallvpnline( Delete->LINE ); + freevexexpr( Delete->VEX_FORMAL ); + freevexexpr( Delete->VEX_ACTUAL ); + + freevpnmap( Delete ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Del All Generic | +| | +\------------------------------------------------------------*/ + +static void loc_delallvpngen( ScanGeneric ) + + vpngen_list *ScanGeneric; +{ + vpngen_list *Delete; + + while ( ScanGeneric != (vpngen_list *)0 ) + { + Delete = ScanGeneric; + ScanGeneric = ScanGeneric->NEXT; + + loc_delallvpnline( Delete->LINE ); + freevexexpr( Delete->VEX_ATOM ); + freevexexpr( Delete->VEX_EXPR ); + + freevpngen( Delete ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Del All Action | +| | +\------------------------------------------------------------*/ + +static void loc_delallvpnact( ScanAct ) + + vpnact_list *ScanAct; +{ + vpnact_list *Delete; + + while ( ScanAct != (vpnact_list *)0 ) + { + Delete = ScanAct; + ScanAct = ScanAct->NEXT; + + loc_delallvpnline( Delete->LINE ); + freevexexpr( Delete->VEX_EXPR ); + freevexexpr( Delete->VEX_ATOM ); + + freevpnact( Delete ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Del All Place | +| | +\------------------------------------------------------------*/ + +static void loc_delallvpnplace( ScanPlace ) + + vpnplace_list *ScanPlace; +{ + vpnplace_list *Delete; + vpnarc *ScanArc; + chain_list *ScanChain; + + while ( ScanPlace != (vpnplace_list *)0 ) + { + Delete = ScanPlace; + ScanPlace = ScanPlace->NEXT; + + for ( ScanChain = Delete->TRANS_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + freevpnarc( ScanArc ); + } + + for ( ScanChain = Delete->TRANS_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + freevpnarc( ScanArc ); + } + + freechain( Delete->TRANS_IN ); + freechain( Delete->TRANS_OUT ); + + loc_delallvpnline( Delete->LINE ); + + freevpnplace( Delete ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Del All Trans | +| | +\------------------------------------------------------------*/ + +static void loc_delallvpntrans( ScanTrans ) + + vpntrans_list *ScanTrans; +{ + vpntrans_list *Delete; + + while ( ScanTrans != (vpntrans_list *)0 ) + { + Delete = ScanTrans; + ScanTrans = ScanTrans->NEXT; + + freechain( Delete->PLACE_IN ); + freechain( Delete->PLACE_OUT ); + freechain( Delete->WAIT_SYM ); + + loc_delallvpnact( Delete->ACT ); + + freevexexpr( Delete->VEX_GUARD ); + + freevpntrans( Delete ); + } +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Declar | +| | +\------------------------------------------------------------*/ + +static void loc_delvpndecl( Figure, Declar ) + + vpnfig_list *Figure; + vpndecl_list *Declar; +{ + char *Name; + + *Declar->PREV = Declar->NEXT; + + if ( Declar->NEXT != (vpndecl_list *)0 ) + { + Declar->NEXT->PREV = Declar->PREV; + } + + Name = Declar->DECL_SYM->NAME; + delauthelem( Figure->HASH_DECLAR[ Declar->TYPE ], Name ); + delauthelem( Figure->HASH_DECLAR[ VPN_DECLAR_ALL ], Name ); + + freevpnsym( Declar->DECL_SYM ); + freevexexpr( Declar->VEX_ATOM ); + freevexexpr( Declar->VEX_INIT ); + freevpndecl( Declar ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Function | +| | +\------------------------------------------------------------*/ + +int delvpnfunc( Figure, Function ) + + vpnfig_list *Figure; + vpnfunc_list *Function; +{ + vpnplace_list *DelPlace; + vpnplace_list *ScanPlace; + vpntrans_list *DelTrans; + vpntrans_list *ScanTrans; + vpndecl_list *ScanDecl; + vpnarc *ScanArc; + chain_list *ScanChain; + + if ( Function != searchvpnfunc( Figure, Function->NAME ) ) + { + return( 0 ); + } + + *Function->PREV = Function->NEXT; + + if ( Function->NEXT != (vpnfunc_list *)0 ) + { + Function->NEXT->PREV = Function->PREV; + } + + ScanPlace = Function->PLACE; + + while ( ScanPlace != (vpnplace_list *)0 ) + { + DelPlace = ScanPlace; + ScanPlace = ScanPlace->NEXT; + + for ( ScanChain = DelPlace->TRANS_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + for ( ScanChain = DelPlace->TRANS_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + freechain( DelPlace->TRANS_IN ); + freechain( DelPlace->TRANS_OUT ); + + loc_delallvpnline( DelPlace->LINE ); + + delauthelem( Figure->HASH_PLACE, DelPlace->NAME ); + freevpnplace( DelPlace ); + } + + ScanTrans = Function->TRANS; + + while ( ScanTrans != (vpntrans_list *)0 ) + { + DelTrans = ScanTrans; + ScanTrans = ScanTrans->NEXT; + + freechain( DelTrans->PLACE_IN ); + freechain( DelTrans->PLACE_OUT ); + freechain( DelTrans->WAIT_SYM ); + + loc_delallvpnact( DelTrans->ACT ); + + freevexexpr( DelTrans->VEX_GUARD ); + + delauthelem( Figure->HASH_TRANS, DelTrans->NAME ); + freevpntrans( DelTrans ); + } + + loc_delallvpnline( Function->LINE ); + + for ( ScanChain = Function->ARG_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDecl = (vpndecl_list *)ScanChain->DATA ; + loc_delvpndecl( Figure, ScanDecl ); + } + + for ( ScanChain = Function->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDecl = (vpndecl_list *)ScanChain->DATA ; + loc_delvpndecl( Figure, ScanDecl ); + } + + for ( ScanChain = Function->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDecl = (vpndecl_list *)ScanChain->DATA ; + loc_delvpndecl( Figure, ScanDecl ); + } + + freechain( Function->VAR_DECL ); + freechain( Function->DEF_DECL ); + freechain( Function->ARG_DECL ); + + freevexexpr( Function->VEX_RET ); + + delauthelem( Figure->HASH_FUNCTION, Function->NAME ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Process | +| | +\------------------------------------------------------------*/ + +int delvpnproc( Figure, Process ) + + vpnfig_list *Figure; + vpnproc_list *Process; +{ + vpnplace_list *DelPlace; + vpnplace_list *ScanPlace; + vpntrans_list *DelTrans; + vpntrans_list *ScanTrans; + vpnarc *ScanArc; + vpndecl_list *ScanDecl; + chain_list *ScanChain; + + if ( Process != searchvpnproc( Figure, Process->NAME ) ) + { + return( 0 ); + } + + *Process->PREV = Process->NEXT; + + if ( Process->NEXT != (vpnproc_list *)0 ) + { + Process->NEXT->PREV = Process->PREV; + } + + ScanPlace = Process->PLACE; + + while ( ScanPlace != (vpnplace_list *)0 ) + { + DelPlace = ScanPlace; + ScanPlace = ScanPlace->NEXT; + + for ( ScanChain = DelPlace->TRANS_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + for ( ScanChain = DelPlace->TRANS_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + freechain( DelPlace->TRANS_IN ); + freechain( DelPlace->TRANS_OUT ); + + loc_delallvpnline( DelPlace->LINE ); + + delauthelem( Figure->HASH_PLACE, DelPlace->NAME ); + freevpnplace( DelPlace ); + } + + ScanTrans = Process->TRANS; + + while ( ScanTrans != (vpntrans_list *)0 ) + { + DelTrans = ScanTrans; + ScanTrans = ScanTrans->NEXT; + + freechain( DelTrans->PLACE_IN ); + freechain( DelTrans->PLACE_OUT ); + freechain( DelTrans->WAIT_SYM ); + + loc_delallvpnact( DelTrans->ACT ); + + freevexexpr( DelTrans->VEX_GUARD ); + + delauthelem( Figure->HASH_TRANS, DelTrans->NAME ); + freevpntrans( DelTrans ); + } + + loc_delallvpnline( Process->LINE ); + + for ( ScanChain = Process->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDecl = (vpndecl_list *)ScanChain->DATA ; + loc_delvpndecl( Figure, ScanDecl ); + } + + for ( ScanChain = Process->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanDecl = (vpndecl_list *)ScanChain->DATA ; + loc_delvpndecl( Figure, ScanDecl ); + } + + freechain( Process->VAR_DECL ); + freechain( Process->DEF_DECL ); + + delauthelem( Figure->HASH_PROCESS, Process->NAME ); + + freevpnproc( Process ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Figure | +| | +\------------------------------------------------------------*/ + +int delvpnfig( Name ) + + char *Name; +{ + vpnfig_list *Figure; + vpnfig_list **Previous; + vpnproc_list *ScanProc; + vpnmod_list *ScanModel; + vpnins_list *ScanInstance; + vpnattr_list *ScanAttr; + vpndecl_list *ScanDecl; + vpnfunc_list *ScanFunc; + void *Delete; + int Type; + + Name = namealloc( Name ); + Previous = &HEAD_VPNFIG; + + for ( Figure = HEAD_VPNFIG; + Figure != (vpnfig_list *)0; + Figure = Figure->NEXT ) + { + if ( Figure->NAME == Name ) break; + + Previous = &Figure->NEXT; + } + + if ( Figure == (vpnfig_list *)0 ) return( 0 ); + + *Previous = Figure->NEXT; + + destroyauthtable( Figure->HASH_PROCESS ); + destroyauthtable( Figure->HASH_FUNCTION ); + destroyauthtable( Figure->HASH_MODEL ); + destroyauthtable( Figure->HASH_INSTANCE ); + destroyauthtable( Figure->HASH_TRANS ); + destroyauthtable( Figure->HASH_PLACE ); + destroyauth2table( Figure->HASH_ARC ); + + for ( Type = 0; Type < VPN_MAX_DECLAR_TYPE; Type++ ) + { + destroyauthtable( Figure->HASH_DECLAR[ Type ] ); + } + + ScanModel = Figure->MODEL; + + while ( ScanModel != (vpnmod_list *)0 ) + { + loc_delallvpnline( ScanModel->LINE ); + loc_delallvpnport( ScanModel->PORT ); + loc_delallvpngen( ScanModel->GENERIC ); + + Delete = (void *)( ScanModel ); + ScanModel = ScanModel->NEXT; + + freevpnmod( Delete ); + } + + ScanInstance = Figure->INSTANCE; + + while ( ScanInstance != (vpnins_list *)0 ) + { + loc_delallvpnline( ScanInstance->LINE ); + loc_delallvpnmap( ScanInstance->MAP ); + loc_delallvpngen( ScanInstance->GENERIC ); + + Delete = (void *)( ScanInstance ); + ScanInstance = ScanInstance->NEXT; + + freevpnins( Delete ); + } + + ScanAttr = Figure->ATTRIBUTE; + + while ( ScanAttr != (vpnattr_list *)0 ) + { + loc_delallvpnline( ScanAttr->LINE ); + + Delete = (void *)( ScanAttr ); + ScanAttr = ScanAttr->NEXT; + + freevpnattr( Delete ); + } + + ScanProc = Figure->PROCESS; + + while ( ScanProc != (vpnproc_list *)0 ) + { + loc_delallvpnplace( ScanProc->PLACE ); + loc_delallvpntrans( ScanProc->TRANS ); + loc_delallvpnline( ScanProc->LINE ); + + freechain( ScanProc->VAR_DECL ); + freechain( ScanProc->DEF_DECL ); + + Delete = (void *)( ScanProc ); + ScanProc = ScanProc->NEXT; + + freevpnproc( Delete ); + } + + ScanFunc = Figure->FUNCTION; + + while ( ScanFunc != (vpnfunc_list *)0 ) + { + loc_delallvpnplace( ScanFunc->PLACE ); + loc_delallvpntrans( ScanFunc->TRANS ); + loc_delallvpnline( ScanFunc->LINE ); + + freevexexpr( ScanFunc->VEX_RET ); + + freechain( ScanFunc->VAR_DECL ); + freechain( ScanFunc->DEF_DECL ); + freechain( ScanFunc->ARG_DECL ); + + Delete = (void *)( ScanFunc ); + ScanFunc = ScanFunc->NEXT; + + freevpnfunc( Delete ); + } + + for ( Type = 0; Type < VPN_MAX_DECLAR_TYPE; Type++ ) + { + ScanDecl = Figure->DECLAR[ Type ]; + + while ( ScanDecl != (vpndecl_list *)0 ) + { + loc_delallvpnline( ScanDecl->LINE ); + + freevexexpr( ScanDecl->VEX_ATOM ); + freevexexpr( ScanDecl->VEX_INIT ); + freevpnsym( ScanDecl->DECL_SYM ); + + Delete = (void *)( ScanDecl ); + ScanDecl = ScanDecl->NEXT; + + freevpndecl( Delete ); + } + } + + freechain( Figure->VAR_DECL ); + freechain( Figure->DEF_DECL ); + + freevpnfig( Figure ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Place | +| | +\------------------------------------------------------------*/ + +int delvpnplace( Figure, Place ) + + vpnfig_list *Figure; + vpnplace_list *Place; +{ + vpntrans_list *Trans; + vpnarc *ScanArc; + chain_list *ChainTrans; + chain_list *ChainPlace; + chain_list **PrevChain; + + if ( Place != searchvpnplace( Figure, Place->NAME ) ) + { + return( 0 ); + } + + *Place->PREV = Place->NEXT; + + if ( Place->NEXT != (vpnplace_list *)0 ) + { + Place->NEXT->PREV = Place->PREV; + } + + for ( ChainTrans = Place->TRANS_IN; + ChainTrans != (chain_list *)0; + ChainTrans = ChainTrans->NEXT ) + { + ScanArc = (vpnarc *)ChainTrans->DATA; + Trans = (vpntrans_list *)ScanArc->SOURCE; + + ChainPlace = Trans->PLACE_OUT; + PrevChain = &Trans->PLACE_OUT; + + while ( ChainPlace != (chain_list *)0 ) + { + if ( ChainPlace->DATA == (void *)ScanArc ) break; + + PrevChain = &ChainPlace->NEXT; + ChainPlace = ChainPlace->NEXT; + } + + if ( ChainPlace != (chain_list *)0 ) + { + *PrevChain = ChainPlace->NEXT; + + ChainPlace->NEXT = (chain_list *)0; + freechain( ChainPlace ); + + Trans->NUMBER_OUT--; + } + else + { + vpnerror( VPN_DEL_ARC_TRANS_ERROR, Trans->NAME, 0 ); + } + + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + for ( ChainTrans = Place->TRANS_OUT; + ChainTrans != (chain_list *)0; + ChainTrans = ChainTrans->NEXT ) + { + ScanArc = (vpnarc *)ChainTrans->DATA; + Trans = (vpntrans_list *)ScanArc->TARGET; + + ChainPlace = Trans->PLACE_IN; + PrevChain = &Trans->PLACE_IN; + + while ( ChainPlace != (chain_list *)0 ) + { + if ( ChainPlace->DATA == (void *)ScanArc ) break; + + PrevChain = &ChainPlace->NEXT; + ChainPlace = ChainPlace->NEXT; + } + + if ( ChainPlace != (chain_list *)0 ) + { + *PrevChain = ChainPlace->NEXT; + + ChainPlace->NEXT = (chain_list *)0; + freechain( ChainPlace ); + + Trans->NUMBER_IN--; + } + else + { + vpnerror( VPN_DEL_ARC_PLACE_ERROR, Place->NAME, 0 ); + } + + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + loc_delallvpnline( Place->LINE ); + + freechain( Place->TRANS_IN ); + freechain( Place->TRANS_OUT ); + + delauthelem( Figure->HASH_PLACE, Place->NAME ); + + freevpnplace( Place ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Trans | +| | +\------------------------------------------------------------*/ + +int delvpntrans( Figure, Trans ) + + vpnfig_list *Figure; + vpntrans_list *Trans; +{ + vpnplace_list *Place; + vpnarc *ScanArc; + vpnact_list *ScanAct; + vpnact_list *DelAct; + chain_list *ChainPlace; + chain_list *ChainTrans; + chain_list **PrevChain; + + if ( Trans != searchvpntrans( Figure, Trans->NAME ) ) + { + return( 0 ); + } + + *Trans->PREV = Trans->NEXT; + + if ( Trans->NEXT != (vpntrans_list *)0 ) + { + Trans->NEXT->PREV = Trans->PREV; + } + + for ( ChainPlace = Trans->PLACE_IN; + ChainPlace != (chain_list *)0; + ChainPlace = ChainPlace->NEXT ) + { + ScanArc = (vpnarc *)ChainPlace->DATA; + Place = (vpnplace_list *)ScanArc->SOURCE; + + ChainTrans = Place->TRANS_OUT; + PrevChain = &Place->TRANS_OUT; + + while ( ChainTrans != (chain_list *)0 ) + { + if ( ChainTrans->DATA == (void *)ScanArc ) break; + + PrevChain = &ChainTrans->NEXT; + ChainTrans = ChainTrans->NEXT; + } + + if ( ChainTrans != (chain_list *)0 ) + { + *PrevChain = ChainTrans->NEXT; + + ChainTrans->NEXT = (chain_list *)0; + freechain( ChainTrans ); + + Place->NUMBER_OUT--; + } + else + { + vpnerror( VPN_DEL_ARC_PLACE_ERROR, Place->NAME, 0 ); + } + + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + for ( ChainPlace = Trans->PLACE_OUT; + ChainPlace != (chain_list *)0; + ChainPlace = ChainPlace->NEXT ) + { + ScanArc = (vpnarc *)ChainPlace->DATA; + Place = (vpnplace_list *)ScanArc->TARGET; + + ChainTrans = Place->TRANS_IN; + PrevChain = &Place->TRANS_IN; + + while ( ChainTrans != (chain_list *)0 ) + { + if ( ChainTrans->DATA == (void *)ScanArc ) break; + + PrevChain = &ChainTrans->NEXT; + ChainTrans = ChainTrans->NEXT; + } + + if ( ChainTrans != (chain_list *)0 ) + { + *PrevChain = ChainTrans->NEXT; + + ChainTrans->NEXT = (chain_list *)0; + freechain( ChainTrans ); + + Place->NUMBER_IN--; + } + else + { + vpnerror( VPN_DEL_ARC_TRANS_ERROR, Trans->NAME, 0 ); + } + + + delauth2elem( Figure->HASH_ARC, ScanArc->SOURCE, ScanArc->TARGET ); + freevpnarc( ScanArc ); + } + + freechain( Trans->PLACE_IN ); + freechain( Trans->PLACE_OUT ); + + delauthelem( Figure->HASH_TRANS, Trans->NAME ); + + ScanAct = Trans->ACT; + + while ( ScanAct != (vpnact_list *)0 ) + { + loc_delallvpnline( ScanAct->LINE ); + + freevexexpr( ScanAct->VEX_EXPR ); + freevexexpr( ScanAct->VEX_ATOM ); + + DelAct = ScanAct; + ScanAct = ScanAct->NEXT; + + freevpnact( DelAct ); + } + + freevpntrans( Trans ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Arc | +| | +\------------------------------------------------------------*/ + +int delvpnarc( Figure, Arc ) + + vpnfig_list *Figure; + vpnarc *Arc; +{ + vpnplace_list *VpnPlace; + vpntrans_list *VpnTrans; + chain_list *ScanChain; + chain_list **PrevChain; + chain_list **PrevChainTrans; + chain_list **PrevChainPlace; + + if ( Arc != searchvpnarc( Figure, Arc->SOURCE, Arc->TARGET ) ) + { + return( 0 ); + } + + if ( Arc->TYPE == VPN_ARC_PLACE_TRANS ) + { + VpnPlace = (vpnplace_list *)( Arc->SOURCE ); + VpnTrans = (vpntrans_list *)( Arc->TARGET ); + + PrevChainTrans = &VpnPlace->TRANS_OUT; + PrevChainPlace = &VpnTrans->PLACE_IN; + + VpnPlace->NUMBER_OUT--; + VpnTrans->NUMBER_IN--; + } + else + { + VpnPlace = (vpnplace_list *)( Arc->TARGET ); + VpnTrans = (vpntrans_list *)( Arc->SOURCE ); + + PrevChainTrans = &VpnPlace->TRANS_IN; + PrevChainPlace = &VpnTrans->PLACE_OUT; + + VpnPlace->NUMBER_IN--; + VpnTrans->NUMBER_OUT--; + } + + PrevChain = PrevChainPlace; + ScanChain = *PrevChain; + + while ( ScanChain != (chain_list *)0 ) + { + if ( ScanChain->DATA == (void *)Arc ) break; + + PrevChain = &ScanChain->NEXT; + ScanChain = ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + + PrevChain = PrevChainTrans; + ScanChain = *PrevChain; + + while ( ScanChain != (chain_list *)0 ) + { + if ( ScanChain->DATA == (void *)Arc ) break; + + PrevChain = &ScanChain->NEXT; + ScanChain = ScanChain->NEXT; + } + + if ( ScanChain != (chain_list *)0 ) + { + *PrevChain = ScanChain->NEXT; + ScanChain->NEXT = (chain_list *)0; + freechain( ScanChain ); + } + + delauth2elem( Figure->HASH_ARC, Arc->SOURCE, Arc->TARGET ); + freevpnarc( Arc ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Action | +| | +\------------------------------------------------------------*/ + +int delvpnact( Figure, Trans, Action ) + + vpnfig_list *Figure; + vpntrans_list *Trans; + vpnact_list *Action; +{ + vpnact_list *NextAction; + + NextAction = Action->NEXT; + *Action->PREV = NextAction; + + if ( NextAction != (vpnact_list *)0 ) + { + NextAction->PREV = Action->PREV; + } + else + { + Trans->LAST_ACT = Action->PREV; + } + + loc_delallvpnline( Action->LINE ); + + freevexexpr( Action->VEX_ATOM ); + freevexexpr( Action->VEX_EXPR ); + + freevpnact( Action ); + + return( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Del Line | +| | +\------------------------------------------------------------*/ + +int delvpnline( Figure, PrevLine, Line ) + + vpnfig_list *Figure; + vpnline_list **PrevLine; + vpnline_list *Line; +{ + vpnline_list *ScanLine; + + for ( ScanLine = *PrevLine; + ScanLine != (vpnline_list *)0; + ScanLine = Line->NEXT ) + { + if ( ScanLine == Line ) + { + *PrevLine = Line->NEXT; + freevpnline( Line ); + + return( 1 ); + } + + PrevLine = &ScanLine->NEXT; + } + + return( 0 ); +} diff --git a/alliance/src/vpn/src/vpndel.h b/alliance/src/vpn/src/vpndel.h new file mode 100644 index 00000000..d2336f69 --- /dev/null +++ b/alliance/src/vpn/src/vpndel.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpndel.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_DEL_H +# define VPN_DEL_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnenv.c b/alliance/src/vpn/src/vpnenv.c new file mode 100644 index 00000000..15cc6698 --- /dev/null +++ b/alliance/src/vpn/src/vpnenv.c @@ -0,0 +1,119 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnenv.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include +# include +# include "vpnenv.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ + + char *VPN_IN; + char *VPN_OUT; + + char *VPN_VHDL_FORMAT = (char *)0; + char *VPN_VPN_FORMAT = (char *)0; + char *VPN_VBE_FORMAT = (char *)0; + char *VPN_VST_FORMAT = (char *)0; + char *VPN_SYN_FORMAT = (char *)0; + char *VPN_FSM_FORMAT = (char *)0; + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| vpnenv | +| | +\------------------------------------------------------------*/ + +void vpnenv() +{ + VPN_IN = namealloc( mbkgetenv( "VPN_IN") ); + + if ( VPN_IN == (char *)0 ) + { + VPN_IN = namealloc( VPN_DEFAULT_IN ); + } + + VPN_OUT = namealloc( mbkgetenv( "VPN_OUT") ); + + if ( VPN_OUT == (char *)0 ) + { + VPN_OUT = namealloc( VPN_DEFAULT_OUT ); + } + + VPN_VHDL_FORMAT = namealloc( "vhdl" ); + VPN_VPN_FORMAT = namealloc( "vpn" ); + VPN_SYN_FORMAT = namealloc( "vhd" ); + VPN_VBE_FORMAT = namealloc( "vbe" ); + VPN_VST_FORMAT = namealloc( "vst" ); + VPN_FSM_FORMAT = namealloc( "fsm" ); +} diff --git a/alliance/src/vpn/src/vpnenv.h b/alliance/src/vpn/src/vpnenv.h new file mode 100644 index 00000000..50402e13 --- /dev/null +++ b/alliance/src/vpn/src/vpnenv.h @@ -0,0 +1,79 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnenv.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_ENV_H +# define VPN_ENV_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define VPN_DEFAULT_IN "vhdl" +# define VPN_DEFAULT_OUT "vhdl" + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnerror.c b/alliance/src/vpn/src/vpnerror.c new file mode 100644 index 00000000..c38b116e --- /dev/null +++ b/alliance/src/vpn/src/vpnerror.c @@ -0,0 +1,207 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : Vpn Errors | +| | +| Vpnhors : Jacomme Ludovic | +| | +| Date : 04.07.96 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include +# include +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Error Function | +| | +\------------------------------------------------------------*/ + +void vpn_error( Error, Text1, Text2, File, Line ) + + int Error; + char *Text1; + char *Text2; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%ld ", Name, Line ); + + switch( Error ) + { + case VPN_PROC_EXIST_ERROR : + fprintf( stderr, "process %s exists already\n", Text1 ); + break; + case VPN_FUNC_EXIST_ERROR : + fprintf( stderr, "function %s exists already\n", Text1 ); + break; + case VPN_PLACE_EXIST_ERROR : + fprintf( stderr, "place %s exists already\n", Text1 ); + break; + case VPN_TRANS_EXIST_ERROR : + fprintf( stderr, "transition %s exists already\n", Text1 ); + break; + case VPN_PORT_EXIST_ERROR : + fprintf( stderr, "port %s exists already\n", Text1 ); + break; + case VPN_ARC_PLACE_EXIST_ERROR : + fprintf( stderr, "arc place %s to %s exists already\n", Text1, Text2 ); + break; + case VPN_ARC_TRANS_EXIST_ERROR : + fprintf( stderr, "arc trans %s to %s exists already\n", Text1, Text2 ); + break; + case VPN_UNKNOWN_DECLAR_TYPE : + fprintf( stderr, "unknown declar type %ld for %s\n", (long)Text1, Text2 ); + break; + case VPN_SIGNAL_EXIST_ERROR : + fprintf( stderr, "signal %s exists already\n", Text1 ); + break; + case VPN_VARIABLE_EXIST_ERROR : + fprintf( stderr, "variable %s exists already\n", Text1 ); + break; + case VPN_DEFINE_EXIST_ERROR : + fprintf( stderr, "define %s exists already\n", Text1 ); + break; + case VPN_ARGUMENT_EXIST_ERROR : + fprintf( stderr, "argument %s exists already\n", Text1 ); + break; + case VPN_CONSTANT_EXIST_ERROR : + fprintf( stderr, "constant %s exists already\n", Text1 ); + break; + case VPN_DEL_ARC_PLACE_ERROR : + fprintf( stderr, "unable to delete arc from place %s\n", Text1 ); + break; + case VPN_DEL_ARC_TRANS_ERROR : + fprintf( stderr, "unable to delete arc from trans %s\n", Text1 ); + break; + case VPN_TRANS_FATHER_UNKNOWN : + fprintf( stderr, "unknown father type %ld for transition %s\n", (long)Text1, Text2 ); + break; + case VPN_DECLAR_EXIST_ERROR : + fprintf( stderr, "symbol %s already declared\n", Text1 ); + break; + case VPN_BAD_DECLAR_TYPE : + fprintf( stderr, "bad declaration type %ld\n", (long)Text1 ); + break; + case VPN_BAD_ASSIGN_TYPE : + fprintf( stderr, "bad assign %s, type %ld\n", Text1, (long)Text2 ); + break; + case VPN_UNDECLARED_SYMBOL : + fprintf( stderr, "undeclared symbol %s\n", Text1 ); + break; + case VPN_ILLEGAL_POSITION_ERROR : + fprintf( stderr, "illegal position for symbol %s %ld\n", Text1, (long)Text2 ); + break; + case VPN_ILLEGAL_INDEX_ERROR : + fprintf( stderr, "illegal index for symbol %s %ld\n", Text1, (long)Text2 ); + break; + case VPN_MOD_EXIST_ERROR : + fprintf( stderr, "model %s exists already\n", Text1 ); + break; + case VPN_INS_EXIST_ERROR : + fprintf( stderr, "instance %s exists already\n", Text1 ); + break; + case VPN_GENERIC_EXIST_ERROR : + fprintf( stderr, "generic %s exists already\n", Text1 ); + break; + default : + + fprintf( stderr, "unknown internal error %d !\n", Error ); + } + + autexit( 1 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Warning Function | +| | +\------------------------------------------------------------*/ + +void vpn_warning( Warning, Text1, Text2, File, Line ) + + int Warning; + char *Text1; + char *Text2; + char *File; + long Line; +{ + char *Name; + + Name = mbkstrdup( File ); + Name[ strlen( File ) - 1 ] = '\0'; + + fprintf( stderr, "%s%ld ", Name, Line ); + + switch ( Warning ) + { + default : + + fprintf( stderr, "unknown internal warning %d !\n", Warning ); + } +} diff --git a/alliance/src/vpn/src/vpnerror.h b/alliance/src/vpn/src/vpnerror.h new file mode 100644 index 00000000..08f5cf4f --- /dev/null +++ b/alliance/src/vpn/src/vpnerror.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : Vpn Errors | +| | +| Vpnhors : Jacomme Ludovic | +| | +| Date : 04.07.96 | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_ERROR_H +# define VPN_ERROR_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# define VPN_PLACE_EXIST_ERROR 0 +# define VPN_TRANS_EXIST_ERROR 1 +# define VPN_PORT_EXIST_ERROR 2 +# define VPN_ARC_PLACE_EXIST_ERROR 3 +# define VPN_ARC_TRANS_EXIST_ERROR 4 +# define VPN_SIGNAL_EXIST_ERROR 6 +# define VPN_VARIABLE_EXIST_ERROR 7 +# define VPN_DEFINE_EXIST_ERROR 8 +# define VPN_CONSTANT_EXIST_ERROR 9 +# define VPN_TRANS_FATHER_UNKNOWN 10 +# define VPN_PROC_EXIST_ERROR 11 +# define VPN_DEL_ARC_PLACE_ERROR 12 +# define VPN_DEL_ARC_TRANS_ERROR 13 +# define VPN_FUNC_EXIST_ERROR 14 +# define VPN_UNKNOWN_DECLAR_TYPE 15 +# define VPN_ARGUMENT_EXIST_ERROR 16 +# define VPN_UNDECLARED_SYMBOL 17 +# define VPN_DECLAR_EXIST_ERROR 18 +# define VPN_BAD_DECLAR_TYPE 19 +# define VPN_BAD_ASSIGN_TYPE 20 +# define VPN_ILLEGAL_INDEX_ERROR 21 +# define VPN_ILLEGAL_POSITION_ERROR 22 +# define VPN_INS_EXIST_ERROR 23 +# define VPN_MOD_EXIST_ERROR 24 +# define VPN_GENERIC_EXIST_ERROR 25 + +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macros | +| | +\------------------------------------------------------------*/ + +# define vpnerror( E, V1, V2 ) \ + (vpn_error((int)(E),(char*)(long)(V1),(char*)(long)(V2),__FILE__,__LINE__)) + +# define vpnwarning( E, V1, V2 ) \ + (vpn_warning( (int)(E),(char*)(long)(V1),(char*)(long)(V2),__FILE__,__LINE__)) + +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + + extern void vpn_error __P((int Error, char *Text1, char *Text2, char *File, long Line)); + extern void vpn_warning __P((int Warning, char *Text1, char *Text2, char *File, long Line)); + +# endif diff --git a/alliance/src/vpn/src/vpnfree.c b/alliance/src/vpn/src/vpnfree.c new file mode 100644 index 00000000..bdc4781f --- /dev/null +++ b/alliance/src/vpn/src/vpnfree.c @@ -0,0 +1,286 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnfree.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include +# include "vpnfree.h" +# include "vpnalloc.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Free Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Free Figure | +| | +\------------------------------------------------------------*/ + +void freevpnfig( Figure ) + + vpnfig_list *Figure; +{ + autfreeblock( (char *)Figure ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Process | +| | +\------------------------------------------------------------*/ + +void freevpnproc( Process ) + + vpnproc_list *Process; +{ + autfreeheap( (char *)Process, sizeof( vpnproc_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Function | +| | +\------------------------------------------------------------*/ + +void freevpnfunc( Function ) + + vpnfunc_list *Function; +{ + autfreeheap( (char *)Function, sizeof( vpnfunc_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Place | +| | +\------------------------------------------------------------*/ + +void freevpnplace( Place ) + + vpnplace_list *Place; +{ + autfreeheap( (char *)Place, sizeof( vpnplace_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Arc | +| | +\------------------------------------------------------------*/ + +void freevpnarc( Arc ) + + vpnarc *Arc; +{ + autfreeheap( (char *)Arc, sizeof( vpnarc )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Action | +| | +\------------------------------------------------------------*/ + +void freevpnact( Act ) + + vpnact_list *Act; +{ + autfreeheap( (char *)Act, sizeof( vpnact_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Symbol | +| | +\------------------------------------------------------------*/ + +void freevpnsym( Sym ) + + vpnsym *Sym; +{ + autfreeblock( (char *)Sym ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Declaration | +| | +\------------------------------------------------------------*/ + +void freevpndecl( Decl ) + + vpndecl_list *Decl; +{ + autfreeheap( (char *)Decl, sizeof( vpndecl_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Trans | +| | +\------------------------------------------------------------*/ + +void freevpntrans( Trans ) + + vpntrans_list *Trans; +{ + autfreeheap( (char *)Trans, sizeof( vpntrans_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Attr | +| | +\------------------------------------------------------------*/ + +void freevpnattr( Attr ) + + vpnattr_list *Attr; +{ + autfreeheap( (char *)Attr, sizeof( vpnattr_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Line | +| | +\------------------------------------------------------------*/ + +void freevpnline( Line ) + + vpnline_list *Line; +{ + autfreeheap( (char *)Line, sizeof( vpnline_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Model | +| | +\------------------------------------------------------------*/ + +void freevpnmod( Model ) + + vpnmod_list *Model; +{ + autfreeheap( (char *)Model, sizeof( vpnmod_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Instance | +| | +\------------------------------------------------------------*/ + +void freevpnins( Instance ) + + vpnins_list *Instance; +{ + autfreeheap( (char *)Instance, sizeof( vpnins_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Port | +| | +\------------------------------------------------------------*/ + +void freevpnport( Port ) + + vpnport_list *Port; +{ + autfreeheap( (char *)Port, sizeof( vpnport_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Map | +| | +\------------------------------------------------------------*/ + +void freevpnmap( Map ) + + vpnmap_list *Map; +{ + autfreeheap( (char *)Map, sizeof( vpnmap_list )); +} + +/*------------------------------------------------------------\ +| | +| Vpn Free Generic | +| | +\------------------------------------------------------------*/ + +void freevpngen( Generic ) + + vpngen_list *Generic; +{ + autfreeheap( (char *)Generic, sizeof( vpngen_list )); +} diff --git a/alliance/src/vpn/src/vpnfree.h b/alliance/src/vpn/src/vpnfree.h new file mode 100644 index 00000000..da9b88b5 --- /dev/null +++ b/alliance/src/vpn/src/vpnfree.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnfree.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_FREE_H +# define VPN_FREE_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnget.c b/alliance/src/vpn/src/vpnget.c new file mode 100644 index 00000000..f345c69c --- /dev/null +++ b/alliance/src/vpn/src/vpnget.c @@ -0,0 +1,126 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnget.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include "vpnget.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Get Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Get Vpn Symbol From Declaration | +| | +\------------------------------------------------------------*/ + +vpnsym *getvpnsymdecl( Declar, Index ) + + vpndecl_list *Declar; + short Index; +{ + vexexpr *Atom; + int Position; + + Atom = Declar->VEX_ATOM; + Position = getvexvectorpos( Atom, Index ); + + if ( Position < 0 ) + { + vpnerror( VPN_ILLEGAL_INDEX_ERROR, GetVexAtomValue( Atom ), Index ); + } + + + return( &Declar->DECL_SYM[ Position ] ); +} + +/*------------------------------------------------------------\ +| | +| Get Vpn Symbol From Declaration | +| | +\------------------------------------------------------------*/ + +vpnsym *getvpnsymdeclpos( Declar, Position ) + + vpndecl_list *Declar; + int Position; +{ + vexexpr *Atom; + + Atom = Declar->VEX_ATOM; + + if ( ( Position >= Atom->WIDTH ) || + ( Position < 0 ) ) + { + vpnerror( VPN_ILLEGAL_POSITION_ERROR, GetVexAtomValue( Atom ), Position ); + } + + return( &Declar->DECL_SYM[ Position ] ); +} diff --git a/alliance/src/vpn/src/vpnget.h b/alliance/src/vpn/src/vpnget.h new file mode 100644 index 00000000..5b738f17 --- /dev/null +++ b/alliance/src/vpn/src/vpnget.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnget.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_GET_H +# define VPN_GET_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnsearch.c b/alliance/src/vpn/src/vpnsearch.c new file mode 100644 index 00000000..a6a809a1 --- /dev/null +++ b/alliance/src/vpn/src/vpnsearch.c @@ -0,0 +1,369 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnsearch.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include "vpnsearch.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Search Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Search Figure | +| | +\------------------------------------------------------------*/ + +vpnfig_list *searchvpnfig( Name ) + + char *Name; +{ + vpnfig_list *Figure; + + Name = namealloc( Name ); + + for ( Figure = HEAD_VPNFIG; + Figure != (vpnfig_list *)0; + Figure = Figure->NEXT ) + { + if ( Figure->NAME == Name ) break; + } + + return( Figure ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Search Process | +| | +\------------------------------------------------------------*/ + +vpnproc_list *searchvpnproc( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_PROCESS, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vpnproc_list *)( Element->VALUE ) ); + } + + return( (vpnproc_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Search Function | +| | +\------------------------------------------------------------*/ + +vpnfunc_list *searchvpnfunc( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_FUNCTION, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vpnfunc_list *)( Element->VALUE ) ); + } + + return( (vpnfunc_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Search Model | +| | +\------------------------------------------------------------*/ + +vpnmod_list *searchvpnmod( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_MODEL, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vpnmod_list *)( Element->VALUE ) ); + } + + return( (vpnmod_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Search Instance | +| | +\------------------------------------------------------------*/ + +vpnins_list *searchvpnins( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_INSTANCE, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vpnins_list *)( Element->VALUE ) ); + } + + return( (vpnins_list *)0 ); +} + + +/*------------------------------------------------------------\ +| | +| Vpn Search Place | +| | +\------------------------------------------------------------*/ + +vpnplace_list *searchvpnplace( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_PLACE, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vpnplace_list *)( Element->VALUE ) ); + } + + return( (vpnplace_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Search Trans | +| | +\------------------------------------------------------------*/ + +vpntrans_list *searchvpntrans( Figure, Name ) + + vpnfig_list *Figure; + char *Name; +{ + authelem *Element; + + Name = namealloc( Name ); + Element = searchauthelem( Figure->HASH_TRANS, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vpntrans_list *)( Element->VALUE ) ); + } + + return( (vpntrans_list *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Local Vpn Search Symbol | +| | +\------------------------------------------------------------*/ + +vpnsym *searchvpnsym( Figure, Name, Index, Type ) + + vpnfig_list *Figure; + char *Name; + short Index; + unsigned char Type; +{ + authtable *HashTable; + authelem *Element; + vexexpr *Atom; + vpndecl_list *Decl; + short Bound; + + if ( Type >= VPN_MAX_DECLAR_TYPE ) + { + vpnerror( VPN_UNKNOWN_DECLAR_TYPE, Type, Name ); + } + + Name = namealloc( Name ); + HashTable = Figure->HASH_DECLAR[ Type ]; + Element = searchauthelem( HashTable, Name ); + + if ( Element != (authelem *)0 ) + { + Decl = (vpndecl_list *)( Element->VALUE ); + Atom = Decl->VEX_ATOM; + + if ( ! IsVexNodeAtom( Atom ) ) + { + Atom = getvexarrayatom( Atom ); + } + + Bound = Atom->WIDTH - 1; + + if ( Index == -1 ) + { + if ( Bound == 0 ) return( Decl->DECL_SYM ); + } + else + { + if ( IsVexAtomDown( Atom ) ) + { + if ( ( Index <= Atom->LEFT ) && + ( Index >= Atom->RIGHT ) ) + { + Index -= Atom->RIGHT; + + return( &Decl->DECL_SYM[ Bound - Index ] ); + } + } + else + { + if ( ( Index >= Atom->LEFT ) && + ( Index <= Atom->RIGHT ) ) + { + Index -= Atom->LEFT; + + return( &Decl->DECL_SYM[ Index ] ); + } + } + } + } + + return( (vpnsym *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Search Arc | +| | +\------------------------------------------------------------*/ + +vpnarc *searchvpnarc( Figure, Source, Target ) + + vpnfig_list *Figure; + void *Source; + void *Target; +{ + auth2elem *Element; + + Element = searchauth2elem( Figure->HASH_ARC, Source, Target ); + + if ( Element != (auth2elem *)0 ) + { + return( (vpnarc *)( Element->VALUE ) ); + } + + return( (vpnarc *)0 ); +} + +/*------------------------------------------------------------\ +| | +| Vpn Search Declaration | +| | +\------------------------------------------------------------*/ + +vpndecl_list *searchvpndecl( Figure, Name, Type ) + + vpnfig_list *Figure; + char *Name; + unsigned char Type; +{ + authtable *HashTable; + authelem *Element; + + HashTable = Figure->HASH_DECLAR[ Type ]; + + Name = namealloc( Name ); + Element = searchauthelem( HashTable, Name ); + + if ( Element != (authelem *)0 ) + { + return( (vpndecl_list *)( Element->VALUE ) ); + } + + return( (vpndecl_list *)0 ); +} diff --git a/alliance/src/vpn/src/vpnsearch.h b/alliance/src/vpn/src/vpnsearch.h new file mode 100644 index 00000000..1bdbdce4 --- /dev/null +++ b/alliance/src/vpn/src/vpnsearch.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnsearch.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_SEARCH_H +# define VPN_SEARCH_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnsimp.c b/alliance/src/vpn/src/vpnsimp.c new file mode 100644 index 00000000..53bb0175 --- /dev/null +++ b/alliance/src/vpn/src/vpnsimp.c @@ -0,0 +1,178 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : VPN | +| | +| File : vpnsimp.c | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.01.95 | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include +# include +# include + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include "vpnerror.h" +# include "vpnsimp.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Private Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| simpvpnact | +| | +\------------------------------------------------------------*/ + +void simpvpnact( VpnAct ) + + vpnact_list *VpnAct; +{ + VpnAct->VEX_ATOM = simpvexexpr( VpnAct->VEX_ATOM ); + VpnAct->VEX_EXPR = simpvexexpr( VpnAct->VEX_EXPR ); +} + +/*------------------------------------------------------------\ +| | +| simpvpntrans | +| | +\------------------------------------------------------------*/ + +void simpvpntrans( VpnTrans ) + + vpntrans_list *VpnTrans; +{ + vpnact_list *VpnAct; + + VpnTrans->VEX_GUARD = simpvexexpr( VpnTrans->VEX_GUARD ); + + for ( VpnAct = VpnTrans->ACT; + VpnAct != (vpnact_list *)0; + VpnAct = VpnAct->NEXT ) + { + simpvpnact( VpnAct ); + } +} + +/*------------------------------------------------------------\ +| | +| simpvpnfunc | +| | +\------------------------------------------------------------*/ + +void simpvpnfunc( VpnFunc ) + + vpnfunc_list *VpnFunc; +{ + vpntrans_list *VpnTrans; + + for ( VpnTrans = VpnFunc->TRANS; + VpnTrans != (vpntrans_list *)0; + VpnTrans = VpnTrans->NEXT ) + { + simpvpntrans( VpnTrans ); + } +} + +/*------------------------------------------------------------\ +| | +| simpvpnproc | +| | +\------------------------------------------------------------*/ + +void simpvpnproc( VpnProc ) + + vpnproc_list *VpnProc; +{ + vpntrans_list *VpnTrans; + + for ( VpnTrans = VpnProc->TRANS; + VpnTrans != (vpntrans_list *)0; + VpnTrans = VpnTrans->NEXT ) + { + simpvpntrans( VpnTrans ); + } +} + +/*------------------------------------------------------------\ +| | +| simpvpnfig | +| | +\------------------------------------------------------------*/ + +void simpvpnfig( VpnFigure ) + + vpnfig_list *VpnFigure; +{ + vpnproc_list *VpnProc; + vpnfunc_list *VpnFunc; + + for ( VpnProc = VpnFigure->PROCESS; + VpnProc != (vpnproc_list *)0; + VpnProc = VpnProc->NEXT ) + { + simpvpnproc( VpnProc ); + } + + for ( VpnFunc = VpnFigure->FUNCTION; + VpnFunc != (vpnfunc_list *)0; + VpnFunc = VpnFunc->NEXT ) + { + simpvpnfunc( VpnFunc ); + } +} diff --git a/alliance/src/vpn/src/vpnsimp.h b/alliance/src/vpn/src/vpnsimp.h new file mode 100644 index 00000000..f8a6c298 --- /dev/null +++ b/alliance/src/vpn/src/vpnsimp.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : VPN | +| | +| File : vpnsimp.h | +| | +| Author : Jacomme Ludovic | +| | +| Date : 01.11.94 | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_SIMP_H +# define VPN_SIMP_H + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnunion.c b/alliance/src/vpn/src/vpnunion.c new file mode 100644 index 00000000..f77859e6 --- /dev/null +++ b/alliance/src/vpn/src/vpnunion.c @@ -0,0 +1,100 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnunion.c | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include "vpnunion.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Union Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn Union Line | +| | +\------------------------------------------------------------*/ + +vpnline_list *unionvpnline( VpnFigure, HeadLine, SourceLine ) + + vpnfig_list *VpnFigure; + vpnline_list **HeadLine; + vpnline_list *SourceLine; +{ + vpnline_list *VpnLine; + + for ( VpnLine = SourceLine; + VpnLine != (vpnline_list *)0; + VpnLine = VpnLine->NEXT ) + { + addvpnfileline( VpnFigure, HeadLine, VpnLine->NAME, VpnLine->LINE ); + } + + return( *HeadLine ); +} diff --git a/alliance/src/vpn/src/vpnunion.h b/alliance/src/vpn/src/vpnunion.h new file mode 100644 index 00000000..1035164e --- /dev/null +++ b/alliance/src/vpn/src/vpnunion.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpndup.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_DUP_H +# define VPN_DUP_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif diff --git a/alliance/src/vpn/src/vpnview.c b/alliance/src/vpn/src/vpnview.c new file mode 100644 index 00000000..5b5fa80a --- /dev/null +++ b/alliance/src/vpn/src/vpnview.c @@ -0,0 +1,896 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnview.c | +| | +| Date : 28.08.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Include Files | +| | +\------------------------------------------------------------*/ + +# include "mut.h" +# include "aut.h" +# include "vex.h" +# include "vpn.h" + +# include +# include "vpnview.h" +# include "vpnerror.h" + +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn View Functions | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Vpn View Line | +| | +\------------------------------------------------------------*/ + +void viewvpnline( Line ) + + vpnline_list *Line; +{ + char *File; + + fprintf( stdout, "\n--> Line" ); + fprintf( stdout, "\n\t\tLINE : " ); + + File = (char *)0; + + while ( Line != (vpnline_list *)0 ) + { + if ( Line->NAME != File ) + { + File = Line->NAME; + fprintf( stdout, " %s [%ld]", Line->NAME, Line->LINE ); + } + else + { + fprintf( stdout, " [%ld]", Line->LINE ); + } + + Line = Line->NEXT; + } + + fprintf( stdout, "\n<-- Line" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Attribute | +| | +\------------------------------------------------------------*/ + +void viewvpnattr( Attr ) + + vpnattr_list *Attr; +{ + fprintf( stdout, "\n--> Attribute" ); + fprintf( stdout, "\n\t\tNAME : %s" , Attr->NAME ); + fprintf( stdout, "\n\t\tENTITY: %s" , Attr->ENTITY ); + + if ( Attr->TYPE >= VPN_MAX_ATTR_TYPE ) + { + fprintf( stdout, "\n\t\tTYPE : %d", (int)Attr->TYPE ); + } + else + { + fprintf( stdout, "\n\t\tTYPE : %s", VPN_ATTRIBUTE_TYPE[ Attr->TYPE ] ); + } + + fprintf( stdout, "\n\t\tVALUE : %s" , Attr->VALUE ); + fprintf( stdout, "\n\t\tFLAGS : %lx", Attr->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Attr->USER ); + fprintf( stdout, "\n<-- Symbol" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Port | +| | +\------------------------------------------------------------*/ + +void viewvpnport( Port ) + + vpnport_list *Port; +{ + fprintf( stdout, "\n--> Port" ); + + viewvpnline( Port->LINE ); + + fprintf( stdout, "\n\t\tVEX_ATOM : " ); + viewvexexprbound( Port->VEX_ATOM ); + + if ( Port->DIR >= VPN_MAX_DIR_TYPE ) + { + fprintf( stdout, "\n\t\tDIR : %d", (int)Port->DIR ); + } + else + { + fprintf( stdout, "\n\t\tDIR : %s", VPN_DIR_TYPE[ Port->DIR ] ); + } + + if ( Port->BASE >= VEX_MAX_TYPE ) + { + fprintf( stdout, "\n\t\tBASE : %d", Port->BASE ); + } + else + { + fprintf( stdout, "\n\t\tBASE : %s", VEX_TYPE_NAME[ Port->BASE ] ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Port->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Port->USER ); + fprintf( stdout, "\n<-- Port" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Map | +| | +\------------------------------------------------------------*/ + +void viewvpnmap( Map ) + + vpnmap_list *Map; +{ + fprintf( stdout, "\n--> Map" ); + + viewvpnline( Map->LINE ); + + fprintf( stdout, "\n\t\tFORMAL : " ); + + viewvexexprbound( Map->VEX_FORMAL ); + + fprintf( stdout, "\n\t\tACTUAL : " ); + + viewvexexprbound( Map->VEX_ACTUAL ); + + fprintf( stdout, "\n\t\tFLAGS : %lx", Map->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Map->USER ); + fprintf( stdout, "\n<-- Map" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Generic | +| | +\------------------------------------------------------------*/ + +void viewvpngen( Generic ) + + vpngen_list *Generic; +{ + fprintf( stdout, "\n--> Generic" ); + + viewvpnline( Generic->LINE ); + + fprintf( stdout, "\n\t\tATOM : " ); + + viewvexexprbound( Generic->VEX_ATOM ); + + fprintf( stdout, "\n\t\tEXPR : " ); + + viewvexexprbound( Generic->VEX_EXPR ); + + if ( Generic->BASE >= VEX_MAX_TYPE ) + { + fprintf( stdout, "\n\t\tBASE : %d", Generic->BASE ); + } + else + { + fprintf( stdout, "\n\t\tBASE : %s", VEX_TYPE_NAME[ Generic->BASE ] ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Generic->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Generic->USER ); + fprintf( stdout, "\n<-- Generic" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Symbol | +| | +\------------------------------------------------------------*/ + +void viewvpnsym( Symbol ) + + vpnsym *Symbol; +{ + fprintf( stdout, "\n--> Symbol" ); + fprintf( stdout, "\n\t\tNAME : %s", Symbol->NAME ); + + fprintf( stdout, "\n\t\tDECL : " ); + viewvexexprbound( Symbol->DECL->VEX_ATOM ); + + fprintf( stdout, "\n\t\tINDEX : %d", (int)Symbol->INDEX ); + fprintf( stdout, "\n\t\tINIT : '%c'", VEX_LITERAL_BY_ID[ Symbol->INIT ] ); + fprintf( stdout, "\n\t\tEFFEC : '%c'", VEX_LITERAL_BY_ID[ Symbol->EFFEC ] ); + fprintf( stdout, "\n\t\tDRIVE : '%c'", VEX_LITERAL_BY_ID[ Symbol->DRIVE ] ); + fprintf( stdout, "\n\t\tEVENT : %d" , Symbol->EVENT ); + + fprintf( stdout, "\n\t\tFLAGS : %lx", Symbol->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Symbol->USER ); + fprintf( stdout, "\n<-- Symbol" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Declaration | +| | +\------------------------------------------------------------*/ + +void viewvpndecl( Decl ) + + vpndecl_list *Decl; +{ + vpnsym *DeclSym; + int Scan; + int Width; + + fprintf( stdout, "\n--> Declaration" ); + + viewvpnline( Decl->LINE ); + + if ( *Decl->PREV != Decl ) + { + fprintf( stdout, "\n\t\tPREV : ERROR" ); + } + + fprintf( stdout, "\n\t\tVEX_ATOM : " ); + viewvexexprbound( Decl->VEX_ATOM ); + + fprintf( stdout, "\n\t\tVEX_INIT : " ); + viewvexexprbound( Decl->VEX_INIT ); + + fprintf( stdout, "\n\t\tDECL_SYM :\n" ); + + DeclSym = Decl->DECL_SYM; + Width = Decl->VEX_ATOM->WIDTH; + + for ( Scan = 0; Scan < Width; Scan++ ) + { + viewvpnsym( &DeclSym[ Scan ] ); + } + + if ( Decl->DIR >= VPN_MAX_DIR_TYPE ) + { + fprintf( stdout, "\n\t\tDIR : %d", (int)Decl->DIR ); + } + else + { + fprintf( stdout, "\n\t\tDIR : %s", VPN_DIR_TYPE[ Decl->DIR ] ); + } + + if ( Decl->TYPE >= VPN_MAX_DECLAR_TYPE ) + { + fprintf( stdout, "\n\t\tTYPE : %d", Decl->TYPE ); + } + else + { + fprintf( stdout, "\n\t\tTYPE : %s", VPN_DECLAR_TYPE[ Decl->TYPE ] ); + } + + if ( Decl->BASE >= VEX_MAX_TYPE ) + { + fprintf( stdout, "\n\t\tBASE : %d", Decl->BASE ); + } + else + { + fprintf( stdout, "\n\t\tBASE : %s", VEX_TYPE_NAME[ Decl->BASE ] ); + } + + if ( Decl->KIND >= VPN_MAX_KIND_TYPE ) + { + fprintf( stdout, "\n\t\tKIND : %d", Decl->KIND ); + } + else + { + fprintf( stdout, "\n\t\tKIND : %s", VPN_KIND_TYPE[ Decl->KIND ] ); + } + + if ( Decl->CLASS >= VPN_MAX_CLASS_TYPE ) + { + fprintf( stdout, "\n\t\tCLASS : %d", Decl->CLASS ); + } + else + { + fprintf( stdout, "\n\t\tCLASS : %s", VPN_CLASS_TYPE[ Decl->CLASS ] ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Decl->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Decl->USER ); + fprintf( stdout, "\n<-- Declaration" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Action | +| | +\------------------------------------------------------------*/ + +void viewvpnact( Action ) + + vpnact_list *Action; +{ + fprintf( stdout, "\n--> Action" ); + + viewvpnline( Action->LINE ); + + if ( *Action->PREV != Action ) + { + fprintf( stdout, "\n\t\tPREV : ERROR" ); + } + + fprintf( stdout, "\n\t\tVEX_ATOM : " ); + + viewvexexprbound( Action->VEX_ATOM ); + + fprintf( stdout, "\n\t\tVEX_EXPR : \n" ); + + viewvexexprbound( Action->VEX_EXPR ); + + if ( Action->TYPE >= VPN_MAX_ACT_TYPE ) + { + fprintf( stdout, "\n\t\tTYPE : %d", Action->TYPE ); + } + else + { + fprintf( stdout, "\n\t\tTYPE : %s", VPN_ACT_TYPE[ Action->TYPE ] ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Action->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Action->USER ); + fprintf( stdout, "\n<-- Action" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Transition | +| | +\------------------------------------------------------------*/ + +void viewvpntrans( Trans ) + + vpntrans_list *Trans; +{ + chain_list *ScanChain; + vpnact_list *ScanAsg; + vpnplace_list *ScanPlace; + vpnarc *ScanArc; + + fprintf( stdout, "\n--> Transition" ); + + if ( *Trans->PREV != Trans ) + { + fprintf( stdout, "\n\t\tPREV : ERROR" ); + } + + fprintf( stdout, "\n\t\tNAME : %s", Trans->NAME ); + + if ( Trans->FATHER < VPN_MAX_FATHER_TYPE ) + { + fprintf( stdout, "\n\t\tFATHER : %s", VPN_FATHER_TYPE[ Trans->FATHER ] ); + } + else + { + fprintf( stdout, "\n\t\tFATHER : %d", Trans->FATHER ); + } + + if ( Trans->TYPE >= VPN_MAX_TRANS_TYPE ) + { + fprintf( stdout, "\n\t\tTYPE : %d", Trans->TYPE ); + } + else + { + fprintf( stdout, "\n\t\tTYPE : %s", VPN_TRANS_TYPE[ Trans->TYPE ] ); + } + + for ( ScanChain = Trans->WAIT_SYM; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + fprintf( stdout, "\n\t\tWAIT_SYM : %s\n", ((vpnsym *)ScanChain->DATA)->NAME ); + } + + fprintf( stdout, "\n\t\tACT :\n" ); + + for ( ScanAsg = Trans->ACT; + ScanAsg != (vpnact_list *)0; + ScanAsg = ScanAsg->NEXT ) + { + viewvpnact( ScanAsg ); + } + + fprintf( stdout, "\n\t\tVEX_GUARD : " ); + + viewvexexprbound( Trans->VEX_GUARD ); + + fprintf( stdout, "\n" ); + + fprintf( stdout, "\n\t\tNUMBER_IN : %d", Trans->NUMBER_IN ); + + for ( ScanChain = Trans->PLACE_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + ScanPlace = (vpnplace_list *)ScanArc->SOURCE; + fprintf( stdout, "\n\t\tPLACE_IN : %s", ScanPlace->NAME ); + } + + fprintf( stdout, "\n\t\tNUMBER_OUT : %d", Trans->NUMBER_OUT ); + + for ( ScanChain = Trans->PLACE_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + ScanPlace = (vpnplace_list *)ScanArc->TARGET; + fprintf( stdout, "\n\t\tPLACE_OUT : %s", ScanPlace->NAME ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Trans->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Trans->USER ); + + fprintf( stdout, "\n<-- Transition" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Place | +| | +\------------------------------------------------------------*/ + +void viewvpnplace( Place ) + + vpnplace_list *Place; +{ + chain_list *ScanChain; + vpntrans_list *ScanTrans; + vpnarc *ScanArc; + + fprintf( stdout, "\n--> Place " ); + + viewvpnline( Place->LINE ); + + if ( *Place->PREV != Place ) + { + fprintf( stdout, "\n\t\tPREV : ERROR" ); + } + + fprintf( stdout, "\n\t\tNAME : %s", Place->NAME ); + + if ( Place->FATHER < VPN_MAX_FATHER_TYPE ) + { + fprintf( stdout, "\n\t\tFATHER : %s", VPN_FATHER_TYPE[ Place->FATHER ] ); + } + else + { + fprintf( stdout, "\n\t\tFATHER : %d", Place->FATHER ); + } + + if ( Place->TYPE >= VPN_MAX_PLACE_TYPE ) + { + fprintf( stdout, "\n\t\tTYPE : %d", Place->TYPE ); + } + else + { + fprintf( stdout, "\n\t\tTYPE : %s", VPN_PLACE_TYPE[ Place->TYPE ] ); + } + + if ( Place->LINK != (vpnplace_list *)0 ) + { + fprintf( stdout, "\n\t\tLINK : %s", Place->LINK->NAME ); + } + + fprintf( stdout, "\n\t\tTOKEN : %d", Place->TOKEN ); + fprintf( stdout, "\n\t\tNUMBER_IN : %d", Place->NUMBER_IN ); + + for ( ScanChain = Place->TRANS_IN; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + ScanTrans = (vpntrans_list *)ScanArc->SOURCE; + fprintf( stdout, "\n\t\tTRANS_IN : %s", ScanTrans->NAME ); + } + + fprintf( stdout, "\n\t\tNUMBER_OUT : %d", Place->NUMBER_OUT ); + + for ( ScanChain = Place->TRANS_OUT; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + ScanArc = (vpnarc *)ScanChain->DATA; + ScanTrans = (vpntrans_list *)ScanArc->TARGET; + fprintf( stdout, "\n\t\tTRANS_OUT : %s", ScanTrans->NAME ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Place->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Place->USER ); + fprintf( stdout, "\n<-- Place" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Function | +| | +\------------------------------------------------------------*/ + +void viewvpnfunc( Function ) + + vpnfunc_list *Function; +{ + vpnplace_list *ScanPlace; + vpntrans_list *ScanTrans; + chain_list *ScanChain; + + fprintf( stdout, "\n--> Function" ); + + viewvpnline( Function->LINE ); + + fprintf( stdout, "\n\t\tNAME : %s", Function->NAME ); + fprintf( stdout, "\n\t\tTYPE : %x", (int)Function->TYPE ); + + if ( Function->VEX_RET != (vexexpr *)0 ) + { + fprintf( stdout, "\n\t\tVEX_RET :\n" ); + viewvexexprbound( Function->VEX_RET ); + } + + fprintf( stdout, "\n\t\tARG_DECL :\n" ); + + for ( ScanChain = Function->ARG_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewvpndecl( (vpndecl_list *)ScanChain->DATA ); + } + + fprintf( stdout, "\n\t\tVAR_DECL :\n" ); + + for ( ScanChain = Function->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewvpndecl( (vpndecl_list *)ScanChain->DATA ); + } + + fprintf( stdout, "\n\t\tDEF_DECL :\n" ); + + for ( ScanChain = Function->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewvpndecl( (vpndecl_list *)ScanChain->DATA ); + } + + if ( Function->ELABO != (vpntrans_list *)0 ) + { + fprintf( stdout, "\n\t\tELABO : %s", Function->ELABO->NAME ); + } + + if ( Function->FIRST != (vpntrans_list *)0 ) + { + fprintf( stdout, "\n\t\tFIRST : %s", Function->FIRST->NAME ); + } + + fprintf( stdout, "\n\t\tPLACE :" ); + + for ( ScanPlace = Function->PLACE; + ScanPlace != (vpnplace_list *)0; + ScanPlace = ScanPlace->NEXT ) + { + viewvpnplace( ScanPlace ); + } + + fprintf( stdout, "\n\t\tTRANS :" ); + + for ( ScanTrans = Function->TRANS; + ScanTrans != (vpntrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + viewvpntrans( ScanTrans ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Function->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Function->USER ); + fprintf( stdout, "\n<-- Function" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Process | +| | +\------------------------------------------------------------*/ + +void viewvpnproc( Process ) + + vpnproc_list *Process; +{ + vpnplace_list *ScanPlace; + vpntrans_list *ScanTrans; + chain_list *ScanChain; + + fprintf( stdout, "\n--> Process" ); + + viewvpnline( Process->LINE ); + + fprintf( stdout, "\n\t\tNAME : %s", Process->NAME ); + fprintf( stdout, "\n\t\tTYPE : %x", (int)Process->TYPE ); + + fprintf( stdout, "\n\t\tVAR_DECL :\n" ); + + for ( ScanChain = Process->VAR_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewvpndecl( (vpndecl_list *)ScanChain->DATA ); + } + + fprintf( stdout, "\n\t\tDEF_DECL :\n" ); + + for ( ScanChain = Process->DEF_DECL; + ScanChain != (chain_list *)0; + ScanChain = ScanChain->NEXT ) + { + viewvpndecl( (vpndecl_list *)ScanChain->DATA ); + } + + if ( Process->ELABO != (vpntrans_list *)0 ) + { + fprintf( stdout, "\n\t\tELABO : %s", Process->ELABO->NAME ); + } + + if ( Process->FIRST != (vpntrans_list *)0 ) + { + fprintf( stdout, "\n\t\tFIRST : %s", Process->FIRST->NAME ); + } + + fprintf( stdout, "\n\t\tPLACE :" ); + + for ( ScanPlace = Process->PLACE; + ScanPlace != (vpnplace_list *)0; + ScanPlace = ScanPlace->NEXT ) + { + viewvpnplace( ScanPlace ); + } + + fprintf( stdout, "\n\t\tTRANS :" ); + + for ( ScanTrans = Process->TRANS; + ScanTrans != (vpntrans_list *)0; + ScanTrans = ScanTrans->NEXT ) + { + viewvpntrans( ScanTrans ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Process->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Process->USER ); + fprintf( stdout, "\n<-- Process" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Model | +| | +\------------------------------------------------------------*/ + +void viewvpnmod( Model ) + + vpnmod_list *Model; +{ + vpnport_list *ScanPort; + vpngen_list *ScanGen; + + fprintf( stdout, "\n--> Model" ); + + viewvpnline( Model->LINE ); + + fprintf( stdout, "\n\t\tNAME : %s", Model->NAME ); + + fprintf( stdout, "\n\t\tPORT :" ); + + for ( ScanPort = Model->PORT; + ScanPort != (vpnport_list *)0; + ScanPort = ScanPort->NEXT ) + { + viewvpnport( ScanPort ); + } + + fprintf( stdout, "\n\t\tGENERIC:" ); + + for ( ScanGen = Model->GENERIC; + ScanGen != (vpngen_list *)0; + ScanGen = ScanGen->NEXT ) + { + viewvpngen( ScanGen ); + } + + + fprintf( stdout, "\n\t\tFLAGS : %lx", Model->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Model->USER ); + fprintf( stdout, "\n<-- Model" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Instance | +| | +\------------------------------------------------------------*/ + +void viewvpnins( Instance ) + + vpnins_list *Instance; +{ + vpnmap_list *ScanMap; + vpngen_list *ScanGeneric; + + fprintf( stdout, "\n--> Instance" ); + + viewvpnline( Instance->LINE ); + + fprintf( stdout, "\n\t\tNAME : %s", Instance->NAME ); + fprintf( stdout, "\n\t\tMODEL : %s", Instance->MODEL->NAME ); + + fprintf( stdout, "\n\t\tMAP :" ); + + for ( ScanMap = Instance->MAP; + ScanMap != (vpnmap_list *)0; + ScanMap = ScanMap->NEXT ) + { + viewvpnmap( ScanMap ); + } + + fprintf( stdout, "\n\t\tGENERIC :" ); + + for ( ScanGeneric = Instance->GENERIC; + ScanGeneric != (vpngen_list *)0; + ScanGeneric = ScanGeneric->NEXT ) + { + viewvpngen( ScanGeneric ); + } + + fprintf( stdout, "\n\t\tFLAGS : %lx", Instance->FLAGS ); + fprintf( stdout, "\n\t\tUSER : %lx", (long)Instance->USER ); + fprintf( stdout, "\n<-- Model" ); +} + +/*------------------------------------------------------------\ +| | +| Vpn View Figure | +| | +\------------------------------------------------------------*/ + +void viewvpnfig( Figure ) + + vpnfig_list *Figure; +{ + vpnmod_list *Model; + vpnins_list *Instance; + vpnproc_list *Process; + vpnfunc_list *Function; + vpndecl_list *Decl; + vpnattr_list *Attr; + int Type; + + fprintf( stdout, "\n--> Figure" ); + fprintf( stdout, "\n\tNAME : %s", Figure->NAME ); + + for ( Type = 0; Type < VPN_MAX_DECLAR_TYPE; Type++ ) + { + fprintf( stdout, "\n\tDECLARATION %s : ", VPN_DECLAR_TYPE[ Type ] ); + + for ( Decl = Figure->DECLAR[ Type ]; + Decl != (vpndecl_list *)0; + Decl = Decl->NEXT ) + { + viewvpndecl( Decl ); + } + } + + fprintf( stdout, "\n\tATTRIBUTE :" ); + + for ( Attr = Figure->ATTRIBUTE; + Attr != (vpnattr_list *)0; + Attr = Attr->NEXT ) + { + viewvpnattr( Attr ); + } + + fprintf( stdout, "\n\tMODEL :" ); + + for ( Model = Figure->MODEL; + Model != (vpnmod_list *)0; + Model = Model->NEXT ) + { + viewvpnmod( Model ); + } + + fprintf( stdout, "\n\tINSTANCE :" ); + + for ( Instance = Figure->INSTANCE; + Instance != (vpnins_list *)0; + Instance = Instance->NEXT ) + { + viewvpnins( Instance ); + } + + fprintf( stdout, "\n\tPROCESS : " ); + + for ( Process = Figure->PROCESS; + Process != (vpnproc_list *)0; + Process = Process->NEXT ) + { + viewvpnproc( Process ); + } + + fprintf( stdout, "\n\tFUNCTION : " ); + + for ( Function = Figure->FUNCTION; + Function != (vpnfunc_list *)0; + Function = Function->NEXT ) + { + viewvpnfunc( Function ); + } + + fprintf( stdout, "\n\tFLAGS : %lx", Figure->FLAGS ); + fprintf( stdout, "\n\tUSER : %lx", (long)Figure->USER ); + fprintf( stdout, "\n<-- Figure\n" ); +} diff --git a/alliance/src/vpn/src/vpnview.h b/alliance/src/vpn/src/vpnview.h new file mode 100644 index 00000000..de7f2162 --- /dev/null +++ b/alliance/src/vpn/src/vpnview.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------\ +| | +| This file is part of the Alliance CAD System Copyright | +| (C) Laboratoire LIP6 - Département ASIM Universite P&M Curie| +| | +| Home page : http://www-asim.lip6.fr/alliance/ | +| E-mail support : mailto:alliance-support@asim.lip6.fr | +| | +| This progam 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. | +| | +\------------------------------------------------------------*/ +#ifndef __P +# if defined(__STDC__) || defined(__GNUC__) +# define __P(x) x +# else +# define __P(x) () +# endif +#endif +/*------------------------------------------------------------\ +| | +| Tool : Vpn | +| | +| File : vpnview.h | +| | +| Date : 04.07.96 | +| | +| Author : Jacomme Ludovic | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Constants | +| | +\------------------------------------------------------------*/ + +# ifndef VPN_VIEW_H +# define VPN_VIEW_H + +/*------------------------------------------------------------\ +| | +| Macro | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Types | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Variables | +| | +\------------------------------------------------------------*/ +/*------------------------------------------------------------\ +| | +| Functions | +| | +\------------------------------------------------------------*/ + +# endif