Importing MBKVTI sources into the new CVS tree

This commit is contained in:
Frederic Petrot 2002-03-08 14:17:47 +00:00
parent 6cab6aab32
commit cf5f566744
11 changed files with 4393 additions and 0 deletions

View File

@ -0,0 +1 @@
SUBDIRS = src

View File

@ -0,0 +1,52 @@
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 <Frederic.Petrot@lip6.fr>
dnl $Id: configure.in,v 1.1 2002/03/08 14:17:47 fred Exp $
dnl
dnl
AC_INIT(src/parse_vti_p.c)
AM_INIT_AUTOMAKE(mbkvti, 4.9)
AC_PROG_INSTALL
AC_PROG_CC
AC_HEADER_STDC
AC_CHECK_HEADERS(strings.h unistd.h)
AC_C_CONST
AC_PROG_RANLIB
changequote(,)dnl
INCLUDES=-I${ALLIANCE_INCLUDE}
LDFLAGS=-L${ALLIANCE_LIB}
changequote([,])dnl
AC_SUBST(INCLUDES)
AC_SUBST(LDFLAGS)
AC_OUTPUT([
Makefile
src/Makefile
])

View File

@ -0,0 +1,3 @@
lib_LIBRARIES = libMcp.a libMcl.a
libMcp_a_SOURCES = drive_vti_p.c drive_vti_p.h parse_vti_p.c mcp.h
libMcl_a_SOURCES = drive_vti_l.c drive_vti_l.h parse_vti_l.c mcl.h

View File

@ -0,0 +1,462 @@
/*
* This file is part of the Alliance CAD System
* Copyright (C) Laboratoire LIP6 - Département ASIM
* Universite Pierre et Marie Curie
*
* Home page : http://www-asim.lip6.fr/alliance/
* E-mail support : mailto:alliance-support@asim.lip6.fr
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Alliance VLSI CAD System is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with the GNU C Library; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*******************************************************************************
* mbk : logical vti v4r11 driver (hns, fne, hdn, fdn formats) *
* *
* version : 4.11 *
* date : 12/06/1998 *
* *
* Modified, rewritten and maintained by Frederic Petrot since september 1990 *
* Modified by Gregoire Avot : RC wire support. *
*******************************************************************************/
#define RCN_FLAG_USER_27 ((unsigned char) 0x00000020)
#ident "@(#)vti logical views driver version 8.00"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "drive_vti_l.h"
#include MUT_H
#include MLO_H
#include MLU_H
#include RCN_H
/*******************************************************************************
* needed to allow edition with vi on big interfaces instances *
*******************************************************************************/
#define LINEBREAK if (linelength > 70) { \
(void)fputs("-\n", ptfile); \
linelength = 0; \
}
/*******************************************************************************
* function getdate() *
*******************************************************************************/
static void vtigetdate(date)
char *date;
{
time_t timer;
char day[4], month[4];
int year, nday, hour, minute, second;
(void)time(&timer);
(void)strcpy(date, ctime(&timer));
(void)sscanf(date, "%s %s %d %d:%d:%d 19%d",
day, month, &nday, &hour, &minute, &second, &year);
(void)sprintf(date, "%02d-%s-%02d %02d:%02d",
nday, month, year, hour, minute);
}
/*******************************************************************************
* function busname *
*******************************************************************************/
static char *busname(name)
char *name;
{
static char buffer[255];
static int sigindex=0;
char *s, *t;
char one = 1;
if (!name) {
sprintf(buffer,"SIG_%d",sigindex++);
return buffer;
}
s = name;
t = buffer;
while (*s) {
if (*s == ' ')
if (one) {
*t++ = '[';
s++;
one = 0;
} else {
*t++ = ']';
*t++ = '[';
s++;
}
if (*s == SEPAR && !one) {
*t++ = ']';
one = 1;
}
*t++ = *s++;
}
if (!one)
*t++ = ']';
*t = '\0';
return buffer;
}
/*******************************************************************************
* function env() *
*******************************************************************************/
static void env(tn, tp)
char *tn, *tp;
{
char *s, *mbkgetenv(); /* what include is needed? stdlib.h but no on pc */
s = mbkgetenv("MBK_VTI_TN");
*tn = s ? *s : 'e';
if (islower(*tn))
*tn = toupper(*tn);
s = mbkgetenv("MBK_VTI_TP");
*tp = s ? *s : 'p';
if (islower(*tp))
*tp = toupper(*tp);
}
void wire_point(ptsig,node,ptfile)
losig_list *ptsig;
int node;
FILE *ptfile;
{
lonode_list *ptnode;
ptype_list *ptl;
struct rcnhns *org;
ptnode=getlonode(ptsig, node);
ptl=getptype(ptnode->USER,HNSRCN_X);
if(ptl) {
fprintf(ptfile,"X %d ",(int)ptl->DATA);
return;
}
ptl=getptype(ptnode->USER,HNSRCN_I);
if(ptl) {
org=(struct rcnhns*)(((chain_list*)(ptl->DATA))->DATA);
fprintf(ptfile,"I %s %d ",org->insname,org->position);
return;
}
fprintf(ptfile,"P %ld ",ptnode->INDEX);
}
/*******************************************************************************
* function savelofig() *
*******************************************************************************/
void vtisavelofig(ptfig)
lofig_list *ptfig;
{
loins_list *ptins;
lotrs_list *pttrs;
locon_list *ptcon;
losig_list *ptsig;
chain_list *ptscan, *ptlist, *scanchain;
FILE *ptfile;
long nbio;
long con_id;
float f1, f2;
char date[30];
long sig_vdd = -1, sig_vss = -1;
int linelength;
char *s;
int *old_index; /* table indexed by the file indexes giving mbk's one */
static char tn, tp;
int idx_rcn=1;
lorcnet_list *ptrcnet;
num_list *scannum;
lonode_list *ptnode;
ptype_list *ptptype;
struct rcnhns *elem_rcnhns, *org;
lowire_list *scanwire;
lofigchain( ptfig );
if (!tn) /* either one, don't matter */
env(&tn, &tp);
if ((ptfile = mbkfopen(ptfig->NAME, OUT_LO, WRITE_TEXT)) == NULL) {
(void)fflush(stdout);
(void)fprintf(stderr, "*** mbk error ***\n");
(void)fprintf(stderr, "vtisavelofig can't open file %s.%s\n",
ptfig->NAME, OUT_LO);
EXIT(1);
} else if (TRACE_MODE == YES)
(void)printf("--- mbk --- writing the file : %s.%s\n",
ptfig->NAME, OUT_LO);
/* reverse instances, connectors and parameters order */
ptfig->LOCON = (locon_list *)reverse((chain_list *)ptfig->LOCON);
ptfig->LOINS = (loins_list *)reverse((chain_list *)ptfig->LOINS);
ptfig->LOTRS = (lotrs_list *)reverse((chain_list *)ptfig->LOTRS);
for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT)
ptins->LOCON = (locon_list *)reverse((chain_list *)ptins->LOCON);
/* space for old indexes to be restored at the end */
con_id = 1;
for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT)
con_id++;
old_index = (int *)mbkalloc((unsigned int)(con_id * sizeof(int)));
/* changing signals indexes : externals signals must be first for vti */
con_id = 0;
for (ptcon = ptfig->LOCON; ptcon; ptcon = ptcon->NEXT) {
old_index[++con_id] = ptcon->SIG->INDEX;
ptcon->SIG->INDEX = con_id;
ptcon->SIG->TYPE = EXTERNAL;
if (isvdd(ptcon->NAME))
sig_vdd = con_id;
else if (isvss(ptcon->NAME))
sig_vss = con_id;
ptrcnet=ptcon->SIG->PRCN;
if(ptrcnet)
if(!gettabnode(ptrcnet))
buildtable(ptcon->SIG);
}
nbio = con_id;
for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT) {
if (ptsig->TYPE != EXTERNAL) {
old_index[++con_id] = ptsig->INDEX;
ptsig->INDEX = con_id;
s = getsigname(ptsig);
if (isvdd(s))
sig_vdd = con_id;
else if (isvss(s))
sig_vss = con_id;
ptrcnet=ptsig->PRCN;
if(ptrcnet)
if(!gettabnode(ptrcnet))
buildtable(ptsig);
}
}
if (sig_vdd == -1) {
sig_vdd = ++con_id;
(void)fprintf(stderr, "*** mbk warning ***\n vti %s driver detected",
OUT_LO);
(void)fprintf(stderr, " no '*vdd*' signal in figure %s (assigned to %ld)\n",
ptfig->NAME, sig_vdd);
}
if (sig_vss == -1) {
sig_vss = ++con_id;
(void)fprintf(stderr, "*** mbk warning ***\n vti %s driver detected",
OUT_LO);
(void)fprintf(stderr, " no '*vss*' signal in figure %s (assigned to %ld)\n",
ptfig->NAME, sig_vss);
}
/* header */
vtigetdate(date);
if (strcmp(OUT_LO, "hns") == 0) {
(void)fprintf(ptfile, "#cell1 %s %s hnSchematic 0 v7r5.6\n",
ptfig->NAME, TECHNO);
(void)fprintf(ptfile, "# %s %s mbkvti400 * .\n", date, date);
(void)fprintf(ptfile, "H 1 ;\n");
} else {
(void)fprintf(ptfile, "#cell1 %s %s fnExtracted 4096 v7r5.6\n",
ptfig->NAME, TECHNO);
(void)fprintf(ptfile, "# %s %s mbkvti400 * .\n", date, date);
(void)fprintf(ptfile, "H 3 ;\n");
}
(void)fprintf(ptfile, "B 0 %ld ;\n", nbio);
/* connectors */
for (ptcon = ptfig->LOCON; ptcon; ptcon = ptcon->NEXT) {
if( (scannum = ptcon->PNODE) ) {
for( ; scannum ; scannum=scannum->NEXT ) {
(void)fprintf(ptfile, "X "); /* unable to represent direction in hns */
(void)fprintf(ptfile, "%ld ", ptcon->SIG->INDEX);
(void)fprintf(ptfile, "%d ", idx_rcn);
ptnode=getlonode(ptcon->SIG,scannum->DATA);
ptnode->USER=addptype(ptnode->USER,HNSRCN_X,(void*)idx_rcn);
(void)fprintf(ptfile, "%s;\n", busname(ptcon->NAME));
idx_rcn++;
}
}
else {
(void)fprintf(ptfile, "X "); /* unable to represent direction in hns */
(void)fprintf(ptfile, "%ld ", ptcon->SIG->INDEX);
(void)fprintf(ptfile, "%d ", idx_rcn++);
(void)fprintf(ptfile, "%s;\n", busname(ptcon->NAME));
}
}
/* local models derived from the first instances */
ptlist = NULL;
for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT) {
idx_rcn=1;
for (ptscan = ptlist; ptscan; ptscan = ptscan->NEXT)
if (ptins->FIGNAME == (char *)ptscan->DATA)
break;
if (ptscan == NULL) {
ptlist = addchain(ptlist, (void *)ptins->FIGNAME);
linelength = fprintf(ptfile, "M HNS ");
linelength += fprintf(ptfile, "%s ", ptins->FIGNAME);
linelength += fprintf(ptfile, "| ");
linelength += fprintf(ptfile, "| ");
for (ptcon = ptins->LOCON; ptcon; ptcon = ptcon->NEXT) {
if( (scannum = ptcon->PNODE) ) {
for( ; scannum ; scannum=scannum->NEXT ) {
linelength += fprintf(ptfile, "%s ", busname(ptcon->NAME));
}
}
else {
linelength += fprintf(ptfile, "%s ", busname(ptcon->NAME));
}
LINEBREAK;
}
linelength += fprintf(ptfile, "| ");
LINEBREAK;
for (ptcon = ptins->LOCON; ptcon != NULL; ptcon = ptcon->NEXT) {
if( (scannum = ptcon->PNODE) ) {
for( ; scannum ; scannum=scannum->NEXT ) {
(void)fprintf(ptfile, "%d ", idx_rcn++);
}
}
else {
(void)fprintf(ptfile, "%d ", idx_rcn++);
}
LINEBREAK;
}
(void)fprintf(ptfile, ";\n");
}
}
freechain(ptlist);
/* instances */
for (ptins = ptfig->LOINS; ptins != NULL; ptins = ptins->NEXT) {
idx_rcn=1;
linelength = fprintf(ptfile, "I HNS ");
linelength += fprintf(ptfile, "%s ", ptins->FIGNAME);
linelength += fprintf(ptfile, "%s ", ptins->INSNAME);
linelength += fprintf(ptfile, "| ");
linelength += fprintf(ptfile, "| ");
for (ptcon = ptins->LOCON; ptcon; ptcon = ptcon->NEXT) {
if( (scannum = ptcon->PNODE) ) {
for( ; scannum ; scannum=scannum->NEXT ) {
linelength += fprintf(ptfile, "%ld ", ptcon->SIG->INDEX);
ptnode=getlonode(ptcon->SIG,scannum->DATA);
if( !(ptptype=getptype(ptnode->USER,HNSRCN_I)) ) {
ptnode->USER=addptype(ptnode->USER,HNSRCN_I,NULL);
ptptype=ptnode->USER;
}
elem_rcnhns=mbkalloc(sizeof(struct rcnhns));
ptptype->DATA=addchain(((chain_list*)(ptptype->DATA)),elem_rcnhns);
elem_rcnhns->insname=ptins->INSNAME;
elem_rcnhns->position=idx_rcn;
RCN_CLEARFLAG(ptnode->FLAG,RCN_FLAG_USER_27);
idx_rcn++;
}
}
else {
linelength += fprintf(ptfile, "%ld ", ptcon->SIG->INDEX);
}
LINEBREAK;
}
(void)fprintf(ptfile, ";\n");
}
/* transistors */
for (pttrs = ptfig->LOTRS; pttrs; pttrs = pttrs->NEXT) {
(void)fprintf(ptfile, "T ");
(void)fprintf(ptfile, "%c ", pttrs->TYPE == TRANSN ? tn : tp);
(void)fprintf(ptfile, "* ");
f1 = (float)pttrs->X / SCALE_X;
f2 = (float)pttrs->Y / SCALE_X;
(void)fprintf(ptfile, "[%.2f,%.2f] ", f1, f2);
f1 = (float)pttrs->WIDTH / SCALE_X;
f2 = (float)pttrs->LENGTH / SCALE_X;
(void)fprintf(ptfile, "%.2f %.2f ", f1, f2);
(void)fprintf(ptfile, "0 ");
(void)fprintf(ptfile, "%ld ", pttrs->GRID->SIG->INDEX);
(void)fprintf(ptfile, "%ld ", pttrs->SOURCE->SIG->INDEX);
(void)fprintf(ptfile, "%ld ", pttrs->DRAIN->SIG->INDEX);
(void)fprintf(ptfile, "%ld ", pttrs->TYPE == TRANSN ? sig_vss : sig_vdd);
(void)fprintf(ptfile, ";\n");
}
/* signals */
for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT) {
ptrcnet=ptsig->PRCN;
if ((ptsig->TYPE == INTERNAL && ptsig->NAMECHAIN != NULL) || ptrcnet) {
s=getsigname(ptsig);
(void)fprintf(ptfile, "N ");
(void)fprintf(ptfile, "%ld ", ptsig->INDEX);
(void)fprintf(ptfile, "%s ", busname(s));
(void)fprintf(ptfile, ";\n");
if (ptsig->PRCN && ptsig->PRCN->CAPA && strcmp(OUT_LO, "hns")) {
(void)fprintf(ptfile, "C 0 * * "); /* type */
(void)fprintf(ptfile, "%.3e ", ptsig->PRCN->CAPA); /* val */
(void)fprintf(ptfile, "%ld ", ptsig->INDEX); /* equi */
(void)fprintf(ptfile, "%ld ", sig_vss); /* bulk */
(void)fprintf(ptfile, ";\n");
}
if(ptrcnet) {
for(scanwire=ptrcnet->PWIRE;scanwire;scanwire=scanwire->NEXT) {
(void)fprintf(ptfile, "W ");
wire_point(ptsig,scanwire->NODE1,ptfile);
wire_point(ptsig,scanwire->NODE2,ptfile);
(void)fprintf(ptfile,"%.3e %.3e\n",scanwire->RESI,scanwire->CAPA);
}
for(scanchain=getptype(ptsig->USER,LOFIGCHAIN)->DATA;scanchain;scanchain=scanchain->NEXT) {
ptcon=(locon_list*)(scanchain->DATA);
for(scannum=ptcon->PNODE;scannum;scannum=scannum->NEXT) {
ptnode=getlonode(ptsig,scannum->DATA);
if( !RCN_GETFLAG(ptnode->FLAG,RCN_FLAG_USER_27) ) {
if( (ptptype=getptype(ptnode->USER,HNSRCN_I)) ) {
org=((struct rcnhns*)(((chain_list*)(ptptype->DATA))->DATA));
for(ptscan=((chain_list*)(ptptype->DATA))->NEXT;ptscan;ptscan=ptscan->NEXT) {
elem_rcnhns=(struct rcnhns*)(ptscan->DATA);
fprintf(ptfile,"W I %s %d I %s %d 0.0 0.0\n",elem_rcnhns->insname,elem_rcnhns->position,org->insname,org->position);
}
}
RCN_SETFLAG(ptnode->FLAG,RCN_FLAG_USER_27);
}
}
}
}
}
}
(void)fprintf(ptfile, "E ;\n");
/* put back indexes in their place */
for (ptsig = ptfig->LOSIG; ptsig; ptsig = ptsig->NEXT)
ptsig->INDEX = old_index[ptsig->INDEX];
mbkfree(old_index);
/* reverse instances, connectors and transistor order */
ptfig->LOCON = (locon_list *)reverse((chain_list *)ptfig->LOCON);
ptfig->LOTRS = (lotrs_list *)reverse((chain_list *)ptfig->LOTRS);
ptfig->LOINS = (loins_list *)reverse((chain_list *)ptfig->LOINS);
for (ptins = ptfig->LOINS; ptins; ptins = ptins->NEXT)
ptins->LOCON = (locon_list *)reverse((chain_list *)ptins->LOCON);
if (fclose(ptfile)) {
(void)fflush(stdout);
(void)fprintf(stderr, "*** mbk error ***\n");
(void)fprintf(stderr, "vtisavelofig can't close file %s.%s\n",
ptfig->NAME, OUT_LO);
EXIT(1);
}
}

View File

@ -0,0 +1,43 @@
/*
* This file is part of the Alliance CAD System
* Copyright (C) Laboratoire LIP6 - Département ASIM
* Universite Pierre et Marie Curie
*
* Home page : http://www-asim.lip6.fr/alliance/
* E-mail support : mailto:alliance-support@asim.lip6.fr
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Alliance VLSI CAD System is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with the GNU C Library; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*******************************************************************************
* drive_vti_l.h : header file for the hns and fne driver *
* *
* version : 4.11 *
* date : 12/06/1998 *
* *
* Modified, rewritten and maintained by Frederic Petrot since september 1990 *
* Modified by Gregoire Avot for RCN support. *
*******************************************************************************/
static void vtigetdate();
void vtisavelofig();
#define HNSRCN_X 543345
#define HNSRCN_I 543346
struct rcnhns {
char *insname;
int position;
};
void wire_point();

View File

@ -0,0 +1,497 @@
/*
* This file is part of the Alliance CAD System
* Copyright (C) Laboratoire LIP6 - Département ASIM
* Universite Pierre et Marie Curie
*
* Home page : http://www-asim.lip6.fr/alliance/
* E-mail support : mailto:alliance-support@asim.lip6.fr
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Alliance VLSI CAD System is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with the GNU C Library; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*******************************************************************************
* mbk : physical vti v7r5 & v8 driver (cp format) *
* *
* version : 3.05 *
* date : 13/05/92 *
* *
* Modified, rewritten and maintained by Frederic Petrot since september 1990 *
* *
*******************************************************************************/
#ident "@(#)vti symbolic layout view driver version 4.00"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include MUT_H
#include MPH_H
#include MPU_H
#include "drive_vti_p.h"
/*******************************************************************************
* function getdate() *
*******************************************************************************/
static void vtigetdate(date)
char *date;
{
time_t timer;
char day[4], month[4];
int year, nday, hour, minute, second;
(void)time(&timer);
(void)strcpy(date, ctime(&timer));
(void)sscanf(date, "%s %s %d %d:%d:%d 19%d",
day, month, &nday, &hour, &minute, &second, &year);
(void)sprintf(date, "%02d-%s-%02d %02d:%02d",
nday, month, year, hour, minute);
}
/*******************************************************************************
* function busname *
*******************************************************************************/
static char *busname(name)
char *name;
{
static char buffer[255];
char *s, *t;
char one = 1;
if (!name)
return NULL;
s = name;
t = buffer;
while (*s) {
if (*s == ' ')
if (one) {
*t++ = '[';
s++;
one = 0;
} else {
*t++ = ']';
*t++ = '[';
s++;
}
if (*s == '_' && !one) { /* was SEPAR and not / */
*t++ = ']';
one = 1;
}
*t++ = *s++;
}
if (!one)
*t++ = ']';
*t = '\0';
return buffer;
}
/*******************************************************************************
* function vtisavephfig() *
*******************************************************************************/
void vtisavephfig(ptfig)
phfig_list *ptfig;
{
chain_list *ptchain;
phcon_list *ptcon;
phins_list *ptins;
phseg_list *ptseg;
phvia_list *ptvia;
phref_list *ptref;
int npoint = 0;
int vix[LAST_CONTACT];
int conindex = 0; /* connector index */
char symm;
char type; /* connector orient */
char *filename = ptfig->NAME; /* namealloc unnecessary */
char figname[10];
char insname[10];
FILE *ptfile;
float f1, f2, f3, f4, f5;
char date[30];
/* open file */
if ((ptfile = mbkfopen(filename, OUT_PH, WRITE_TEXT)) == (FILE *)NULL) {
(void)fflush(stdout);
(void)fprintf(stderr, "*** mbk error ***\n");
(void)fprintf(stderr, "vtisavephfig can't open file %s.%s\n",
filename, OUT_PH);
EXIT(1);
} else if (TRACE_MODE == 'Y')
(void)printf("--- mbk --- writing file %s.%s\n", filename, OUT_PH);
(void)memset(vix, (char)0, sizeof(vix));
/* header */
vtigetdate(date);
(void)fprintf(ptfile, "#cell1 %s %s compose *\n", ptfig->NAME, TECHNO);
(void)fprintf(ptfile, "# %s %s mbkvti400 * .cp\n", date, date);
for (ptchain = ptfig->MODELCHAIN; ptchain; ptchain = ptchain->NEXT)
(void)fprintf(ptfile, "# %s\n", (char *)ptchain->DATA);
(void)fprintf(ptfile, "# .\n");
(void)fprintf(ptfile, "V 4 VTIcompose 1.1\n");
/* boxes */
f1 = (float)ptfig->XAB1 / SCALE_X;
f2 = (float)ptfig->YAB1 / SCALE_X;
f3 = (float)ptfig->XAB2 / SCALE_X;
f4 = (float)ptfig->YAB2 / SCALE_X;
(void)fprintf(ptfile, "A %g %g %g %g\n", f1, f2, f3, f4);
(void)fprintf(ptfile, "B %g %g %g %g\n", f1, f2, f3, f4);
(void)fprintf(ptfile, "F F\n");
/* connectors */
for (ptcon = ptfig->PHCON; ptcon; ptcon = ptcon->NEXT) {
switch (ptcon->ORIENT) {
case NORTH :
type = 'N';
break;
case EAST :
type = 'E';
break;
case SOUTH :
type = 'S';
break;
case WEST :
type = 'W';
break;
default :
break;
}
#if 0
if (ptcon->XCON != ptfig->XAB1 && ptcon->XCON != ptfig->XAB2
&& ptcon->YCON != ptfig->YAB1 && ptcon->YCON != ptfig->YAB2) {
(void)fprintf(stderr, "*** mbk warning ***\n");
(void)fprintf(stderr, "vti connector not on abutment box : ");
(void)fprintf(stderr, "x = %d , y = %d , name = %s , orient = %c\n",
ptcon->XCON, ptcon->YCON,
ptcon->NAME, ptcon->ORIENT);
(void)fprintf(stderr, "writing the file %s.%s\n", filename, OUT_PH);
}
#endif
f1 = (float)ptcon->XCON / SCALE_X;
f2 = (float)ptcon->YCON / SCALE_X;
f3 = (float)ptcon->WIDTH / SCALE_X;
(void)fprintf(ptfile, "C %s %g %g %s %g %d *",
busname(ptcon->NAME), f1, f2, decodelayer(ptcon->LAYER),
f3, ++conindex);
(void)fprintf(ptfile, " * %c %s\n", type, busname(ptcon->NAME));
}
/* instances */
for (ptins = ptfig->PHINS; ptins; ptins = ptins->NEXT) {
switch (ptins->TRANSF) {
case NOSYM :
symm = 0;
break;
case SYM_Y :
symm = 6;
break;
case SYM_X :
symm = 4;
break;
case SYMXY :
symm = 2;
break;
case ROT_P :
symm = 1;
break;
case ROT_M :
symm = 3;
break;
case SY_RM :
symm = 5;
break;
case SY_RP :
symm = 7;
break;
default :
symm = -15;
}
f1 = (float)ptins->XINS / SCALE_X;
f2 = (float)ptins->YINS / SCALE_X;
(void)fprintf(ptfile, "I %s %g %g %d \"%s\" cp * *\n",
busname(ptins->INSNAME), f1, f2, symm, ptins->FIGNAME);
}
/* contacts */
for (ptvia = ptfig->PHVIA; ptvia; ptvia = ptvia->NEXT) {
switch (ptvia->TYPE) {
case CONT_VIA :
(void)strcpy(figname, "VIA12");
(void)sprintf(insname, "via12x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_VIA2 :
(void)strcpy(figname, "VIA23");
(void)sprintf(insname, "via23x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_VIA3 :
(void)strcpy(figname, "VIA34");
(void)sprintf(insname, "via34x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_VIA4 :
(void)strcpy(figname, "VIA45");
(void)sprintf(insname, "via45x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_VIA5 :
(void)strcpy(figname, "VIA56");
(void)sprintf(insname, "via56x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_VIA6 :
(void)strcpy(figname, "VIA67");
(void)sprintf(insname, "via67x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_VIA7 :
(void)strcpy(figname, "VIA78");
(void)sprintf(insname, "via78x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_VIA8 :
(void)strcpy(figname, "VIA89");
(void)sprintf(insname, "via89x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_POLY :
(void)strcpy(figname, "CPF");
(void)sprintf(insname, "cpf%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_POLY2 :
(void)strcpy(figname, "CPF2");
(void)sprintf(insname, "cpf2%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_DIF_N :
(void)strcpy(figname, "CDN");
(void)sprintf(insname, "cdn%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_DIF_P :
(void)strcpy(figname, "CDP");
(void)sprintf(insname, "cdp%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_BODY_N :
(void)strcpy(figname, "CBN");
(void)sprintf(insname, "cbn%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_BODY_P :
(void)strcpy(figname, "CBP");
(void)sprintf(insname, "cbp%d", ++vix[(int)ptvia->TYPE]);
break;
case C_X_N :
(void)strcpy(figname, "CXN");
(void)sprintf(insname, "cxn%d", ++vix[(int)ptvia->TYPE]);
break;
case C_X_P :
(void)strcpy(figname, "CXP");
(void)sprintf(insname, "cxp%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN1 :
(void)strcpy(figname, "TURN1");
(void)sprintf(insname, "turn1x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN2 :
(void)strcpy(figname, "TURN2");
(void)sprintf(insname, "turn2x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN3 :
(void)strcpy(figname, "TURN3");
(void)sprintf(insname, "turn3x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN4 :
(void)strcpy(figname, "TURN4");
(void)sprintf(insname, "turn4x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN5 :
(void)strcpy(figname, "TURN5");
(void)sprintf(insname, "turn5x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN6 :
(void)strcpy(figname, "TURN6");
(void)sprintf(insname, "turn6x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN7 :
(void)strcpy(figname, "TURN7");
(void)sprintf(insname, "turn7x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN8 :
(void)strcpy(figname, "TURN8");
(void)sprintf(insname, "turn8x%d", ++vix[(int)ptvia->TYPE]);
break;
case CONT_TURN9 :
(void)strcpy(figname, "TURN9");
(void)sprintf(insname, "turn9x%d", ++vix[(int)ptvia->TYPE]);
break;
}
f1 = (float)ptvia->XVIA / SCALE_X;
f2 = (float)ptvia->YVIA / SCALE_X;
if ( ( ptvia->DX == 0 ) &&
( ptvia->DY == 0 ) )
{
(void)fprintf(ptfile, "I %s %g %g %d \"%s\" ly * *\n",
insname, f1, f2, NOSYM, namealloc( figname ) );
}
else
{
f3 = (float)ptvia->DX / SCALE_X;
f4 = (float)ptvia->DY / SCALE_X;
(void)fprintf(ptfile, "D %g %g * %s 0 %g %g\n", f1, f2, figname, f3, f4 );
++npoint;
}
}
/* references */
for (ptref = ptfig->PHREF; ptref; ptref = ptref->NEXT) {
f1 = (float)ptref->XREF / SCALE_X;
f2 = (float)ptref->YREF / SCALE_X;
(void)fprintf(ptfile, "I %s %g %g %d \"%s\" ly * *\n",
busname(ptref->NAME), f1, f2, NOSYM, ptref->FIGNAME);
}
/* segments */
for (ptseg = ptfig->PHSEG; ptseg; ptseg = ptseg->NEXT) {
f1 = (float)ptseg->X1 / SCALE_X;
f2 = (float)ptseg->Y1 / SCALE_X;
f3 = (float)ptseg->X2 / SCALE_X;
f4 = (float)ptseg->Y2 / SCALE_X;
f5 = (float)ptseg->WIDTH / SCALE_X;
if (ptseg->TYPE == UP || ptseg->TYPE == RIGHT ) {
(void)fprintf(ptfile, "P %g %g * %s\n", f1, f2,
decodelayer(ptseg->LAYER));
(void)fprintf(ptfile, "P %g %g * %s\n", f3, f4,
decodelayer(ptseg->LAYER));
} else {
(void)fprintf(ptfile, "P %g %g * %s\n", f3, f4,
decodelayer(ptseg->LAYER));
(void)fprintf(ptfile, "P %g %g * %s\n", f1, f2,
decodelayer(ptseg->LAYER));
}
if (ptseg->NAME == NULL || *ptseg->NAME == '*')
(void)fprintf(ptfile, "W %g %g %g %g\n",
f1 - f5, f2 - f5, f3 + f5, f4 + f5);
else
(void)fprintf(ptfile, "W %g %g %g %g %s\n",
f1 - f5, f2 - f5, f3 + f5, f4 + f5,
busname(ptseg->NAME));
++npoint;
(void)fprintf(ptfile, "S %g %s %s P %d P %d\n", f5,
(ptseg->TYPE == UP || ptseg->TYPE == DOWN) ? "V" : "H",
decodelayer(ptseg->LAYER), npoint, npoint + 1);
++npoint;
}
/* end */
(void)fprintf(ptfile, "E\n");
/* close file */
if (fclose(ptfile)) {
(void)fflush(stdout);
(void)fprintf(stderr, "*** mbk error ***\n");
(void)fprintf(stderr, "vtisavephfig can't close file %s.%s\n",
filename, OUT_PH);
EXIT(1);
}
}
/*******************************************************************************
* function decodelayer() *
*******************************************************************************/
static char *decodelayer(index)
char index;
{
switch(index) {
case NWELL:
return "nwell";
case PWELL:
return "pwell";
case NTIE:
return "ntie";
case PTIE:
return "ptie";
case NDIF:
return "ndif";
case PDIF:
return "pdif";
case NTRANS:
return "ntrans";
case PTRANS:
return "ptrans";
case NTRANS_FAST:
return "ntrans_fast";
case PTRANS_FAST:
return "ptrans_fast";
case NTRANS_HVIO:
return "ntrans_hvio";
case PTRANS_HVIO:
return "ptrans_hvio";
case POLY:
return "poly";
case POLY2:
return "poly2";
case ALU1:
return "metal";
case ALU2:
return "metal2";
case ALU3:
return "metal3";
case ALU4:
return "metal4";
case ALU5:
return "metal5";
case ALU6:
return "metal6";
case ALU7:
return "metal7";
case ALU8:
return "metal8";
case ALU9:
return "metal9";
case TALU1:
return "allowM";
case TALU2:
return "allowM2";
case TALU3:
return "allowM3";
case TALU4:
return "allowM4";
case TALU5:
return "allowM5";
case TALU6:
return "allowM6";
case TALU7:
return "allowM7";
case TALU8:
return "allowM8";
case TALU9:
return "allowM9";
case CALU1:
return "conM";
case CALU2:
return "conM2";
case CALU3:
return "conM3";
case CALU4:
return "conM4";
case CALU5:
return "conM5";
case CALU6:
return "conM6";
case CALU7:
return "conM7";
case CALU8:
return "conM8";
case CALU9:
return "conM9";
default:
return "unknown";
}
}

View File

@ -0,0 +1,35 @@
/*
* This file is part of the Alliance CAD System
* Copyright (C) Laboratoire LIP6 - Département ASIM
* Universite Pierre et Marie Curie
*
* Home page : http://www-asim.lip6.fr/alliance/
* E-mail support : mailto:alliance-support@asim.lip6.fr
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Alliance VLSI CAD System is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with the GNU C Library; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*******************************************************************************
* driv_vti_p.h : header file for vti cp driver *
* *
* version : 3.00 *
* date : 07/11/91 *
* *
* Modified, rewritten and maintained by Frederic Petrot since september 1990 *
* *
*******************************************************************************/
static char *decodelayer();
static void vtigetdate();
void vtisavephfig();

View File

@ -0,0 +1,33 @@
/*
* This file is part of the Alliance CAD System
* Copyright (C) Laboratoire LIP6 - Département ASIM
* Universite Pierre et Marie Curie
*
* Home page : http://www-asim.lip6.fr/alliance/
* E-mail support : mailto:alliance-support@asim.lip6.fr
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Alliance VLSI CAD System is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with the GNU C Library; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _MCL_H
#define _MCL_H
#ifdef __STDC__
extern void vtiloadlofig(lofig_list *, char *, char);
extern void vtisavelofig(lofig_list *);
#else
extern void vtiloadlofig();
extern void vtisavelofig();
#endif
#endif

View File

@ -0,0 +1,33 @@
/*
* This file is part of the Alliance CAD System
* Copyright (C) Laboratoire LIP6 - Département ASIM
* Universite Pierre et Marie Curie
*
* Home page : http://www-asim.lip6.fr/alliance/
* E-mail support : mailto:alliance-support@asim.lip6.fr
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published
* by the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* Alliance VLSI CAD System is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with the GNU C Library; see the file COPYING. If not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _MCP_H
#define _MCP_H
#ifdef __STDC__
extern void vtiloadphfig(phfig_list *ptfig, char *figname, char mode);
extern void vtisavephfig(phfig_list *ptfig);
#else
extern void vtiloadphfig();
extern void vtisavephfig();
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff