Importing SEA

This commit is contained in:
Jean-Paul Chaput 2002-04-25 16:16:20 +00:00
parent 930a17fd08
commit e78b08526d
35 changed files with 17369 additions and 0 deletions

View File

@ -0,0 +1,3 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = src

View File

@ -0,0 +1,36 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/DEF2a.c)
SEA_MAJOR_VERSION=1
SEA_MINOR_VERSION=0
SEA_VERSION=$SEA_MAJOR_VERSION.$SEA_MINOR_VERSION
AC_SUBST(SEA_MAJOR_VERSION)
AC_SUBST(SEA_MINOR_VERSION)
AC_SUBST(SEA_VERSION)
# For automake.
VERSION=$SEA_VERSION
PACKAGE=sea
dnl Initialize automake stuff
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
dnl Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AM_PROG_LEX
AC_PROG_YACC
AC_PROG_MAKE_SET
AC_CHECK_LIB(m, pow)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AM_ALLIANCE
AC_OUTPUT([
Makefile
src/Makefile
])

View File

@ -0,0 +1,241 @@
/*
* $Id: DEF2a.c,v 1.1 2002/04/25 16:16:19 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Mael Nagat |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./DEF2a.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "DEF_grammar.h"
/* ------------------------------------------------------------------
* Local constants.
*/
# define F_PHFIG 0x00000001
# define F_LOFIG 0x00000002
# define F_SPLIT_POWER 0x00000004
# define F_SHRINK 0x00000008
# define F_NO_IOS 0x00000010
# define F_NO_INTERF 0x00000020
# define F_MERGE_TERM 0x00000040
# define M_OUTPUT (F_PHFIG | F_LOFIG)
/* ------------------------------------------------------------------
* Local variables.
*/
static long LV_VL; /* Verbose level. */
static long LV_flags;
/* ----------------------------------------------------------------------
* Internal functions declarations.
*/
static void printHelp __FP((void));
static void getlophfig __FP((lofig_list **appLoFig,
phfig_list **appPhFig,
char *aDefName,
char *aNetlayName,
char aMode,
long aVL,
long aFlags));
/*
* /--------------------------------------------------------------------\
* | Functions Definitions |
* \--------------------------------------------------------------------/
*/
/* ----------------------------------------------------------------------
* Function : "printHelp()".
*/
static void printHelp()
{
printf (" o Usage := \"DEF2a <-l|-p|-l -p>");
printf ( " [-v] [-V] [-h] [-s] [-b] [-i] [-r]\n");
printf (" <def> [<net_lay>]\"\n\n");
printf (" o Options :\n");
printf (" [-v] := Be verbose.\n");
printf (" [-V] := Be very verbose.\n");
printf (" [-h] := Print this message.\n");
printf (" [-l] := Drive the logical figure.\n");
printf (" [-p] := Drive the physical figure.\n");
printf (" [-b] := Suppress AB terminals.\n");
printf (" [-s] := Split the power nets.\n");
printf (" [-S] := Shrink the abutment box.\n");
printf (" [-i] := Do not build physical interface.\n");
printf (" [-r] := Merge power terminals for ring.\n");
printf (" <def> := Name of the input DEF file (mandatory).\n");
printf (" <net_lay> := Name of the output netlist and/or layout.\n");
printf ("\n" );
}
/* ----------------------------------------------------------------------
* Function : "getlophfig()".
*/
static void getlophfig (appLoFig,
appPhFig,
aDefName,
aNetlayName,
aMode,
aVL,
aFlags)
lofig_list **appLoFig;
phfig_list **appPhFig;
char *aDefName;
char *aNetlayName;
char aMode;
long aVL;
long aFlags;
{
(*appLoFig) = addlofig (aNetlayName);
(*appPhFig) = addphfig (aNetlayName);
defloadlophfig ((*appLoFig), (*appPhFig), aDefName, aMode, aVL, aFlags);
}
/* ----------------------------------------------------------------------
* Function : "main()".
*/
extern int main (argc, argv)
int argc;
char *argv[];
{
struct phfig *pPhFig;
struct lofig *pLoFig;
char *defName;
char *netlayName;
long defFlags;
int argC, i;
/* Read MBK environment. */
mbkenv();
argC = argc;
/* Default options. */
defFlags = 0L;
LV_flags = 0L;
/* Initialise the "Ut" module. */
util_init (C_VerboseLevel0, F_DUMPCORE, "DEF2a");
/* Read the options. */
for (i = 1; i < argc; i++) {
if (!strcmp (argv[i], "-h")) { printHelp (); exit (0); }
if (!strcmp (argv[i], "-v")) { LV_VL = C_VerboseLevel1; continue; }
if (!strcmp (argv[i], "-V")) { LV_VL = C_VerboseLevel2; continue; }
if (!strcmp (argv[i], "-p")) { defFlags |= F_PHFIG; continue; }
if (!strcmp (argv[i], "-l")) { defFlags |= F_LOFIG; continue; }
if (!strcmp (argv[i], "-s")) { defFlags |= F_SPLIT_POWER; continue; }
if (!strcmp (argv[i], "-S")) { defFlags |= F_SHRINK;
LV_flags |= F_DEF_SHRINK;continue; }
if (!strcmp (argv[i], "-b")) { defFlags |= F_NO_IOS;
LV_flags |= F_DEF_NO_IOS; continue; }
if (!strcmp (argv[i], "-i")) { defFlags |= F_NO_INTERF;
LV_flags |= F_DEF_NO_INTERF; continue; }
if (!strcmp (argv[i], "-r")) { defFlags |= F_MERGE_TERM;
LV_flags |= F_DEF_MERGE_TERM; continue; }
if ((argC - i) > 2) {
eprinth (NULL);
eprintf ("Unknown argument \"%s\"\n\n", argv[argC - 1]);
printHelp ();
exit (1);
}
else
break;
}
if ((argC - i) < 1) {
eprinth (NULL);
eprintf ("Missing DEF file name <def>.\n\n");
printHelp ();
exit (1);
} else {
defName = namealloc (argv[i]);
if ((argC - i) >= 2)
netlayName = namealloc (argv[i + 1]);
else
netlayName = defName;
}
if (!(defFlags & M_OUTPUT)) {
eprinth ("DEF2a");
eprints ("Neither <-p> nor <-l> is present.\n\n");
printHelp ();
exit (1);
}
setVL (LV_VL);
if (LV_VL > 0) {
alliancebanner(
"DEF2a", "V.RR", "Alliance to DEF converter",
"2000", ALLIANCE_VERSION);
}
printMBKEnv ();
if (defFlags & F_PHFIG) mprintf1 (" o Extract physical datas.\n");
if (defFlags & F_LOFIG) mprintf1 (" o Extract logical datas.\n");
if (defFlags & F_SPLIT_POWER) {
mprintf1 (" o Split the power nets.\n");
LV_flags |= F_DEF_SPLIT_POWER;
}
mprintf1 (" o Parsing \"%s\".\n", defName);
getlophfig (&pLoFig, &pPhFig, defName, netlayName, 'A', LV_VL, LV_flags);
if ((defFlags & F_SHRINK) && (defFlags & F_PHFIG)) {
mprintf1 (" o Shrinking abutment-box.\n");
shrinkFloorplan (pPhFig);
}
mprintf1 (" o Building obstacles.\n");
rtu (pPhFig);
if (defFlags & F_PHFIG) {
mprintf1 (" o Driving \"%s\" (physical).\n", netlayName);
savephfig (pPhFig);
}
if (defFlags & F_LOFIG) {
mprintf1 (" o Driving \"%s\" (logical).\n", netlayName);
savelofig (pLoFig);
}
exit(0);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
/*
* $Author: jpc $
* $Id: DEF_actions.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
* $Date: 2002/04/25 16:16:20 $
*/
#ifndef __deffunc_h
#define __deffunc_h
#ifdef __cplusplus
extern "C" {
#endif
#define DEF_NOSYM 0x0000
#define DEF_SYM_X 0x0001
#define DEF_SYM_Y 0x0002
#define DEF_ROT_P 0x0004
#define DEF_ROT_M 0x0008
#define DEF_N (DEF_NOSYM)
#define DEF_S (DEF_SYM_X | DEF_SYM_Y)
#define DEF_W (DEF_ROT_P)
#define DEF_E (DEF_ROT_M)
#define DEF_FN (DEF_SYM_X)
#define DEF_FS (DEF_SYM_Y)
#define DEF_FW (DEF_SYM_Y | DEF_ROT_M)
#define DEF_FE (DEF_SYM_Y | DEF_ROT_P)
#define DEF_INPUT 10
#define DEF_OUTPUT 11
#define DEF_INOUT 12
#define DEF_FEEDTHRU 13
struct pt { double x, y; };
extern void def_design_name(char *name);
extern void def_tech_name(char *name);
extern void def_end_design(void);
extern void def_units(double number);
extern void def_die_area(struct pt *ab1, struct pt *ab2);
extern void def_row_rule(char *row_name,
char *row_type,
double x,
double y,
double orient,
double do_number,
double by_number,
double step_x,
double step_y);
extern void def_track_rule(char *axis_name,
double start,
double do_number,
double step,
char *layer_list);
extern char *def_track_layers(char *layer_name, char *layer_list);
extern void def_start_pins(double number);
extern void def_end_pins(void);
extern void def_pin_start(char *pin_name, char *net_name);
extern void def_pin_options(void);
extern void def_pin_option_direction(double dir);
extern void def_pin_option_place(struct pt *pt, double orient);
extern void def_pin_option_layer(char *layer_name, struct pt *pt1, struct pt *pt2);
extern void def_start_vias(double number);
extern void def_end_vias(void);
extern void def_via_start(char *via_name);
extern void def_via_stmt_rect(char *layer_name, struct pt *pt1, struct pt *pt2);
extern void def_via_stmt_pattern(char *pattern_name);
extern void def_via_end(void);
extern void def_start_comps(double number);
extern void def_end_comps(void);
extern void def_comp_start(char *ins_name, char *cell_name);
extern void def_comp_net_list(char *name);
extern void def_comp_type(struct pt* pt, double orient);
extern void def_start_nets(double number);
extern void def_end_nets(void);
extern void def_net_start(char *name);
extern void def_net_conn_start(char *ins_name, char *pin_name);
extern void def_net_conn_opt_synthesized(void);
extern void def_path_start(char *layer_name);
extern void def_path_item_via(char *via_name);
extern void def_path_item_pt(struct pt *pt1);
extern void def_opt_width(double number);
extern void def_start_snets(double number);
extern void def_end_snets(void);
extern void def_snet_start(char *name);
extern void def_snet_conn_start(char *ins_name, char *pin_name);
extern void def_snet_conn_opt_synthesized(void);
extern struct pt *def_alloc_pt(double x, double y);
extern void def_free_pt(struct pt *pt);
extern void def_parse_error(char *str);
#ifdef __cplusplus
}
#endif
#endif /* __deffunc_h */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
/*
* $Id: DEF_drive.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./DEF_drive.h" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifndef __DEF_drive__
# define __DEF_drive__
# define F_PHFIG 0x00000001
# define F_FIXED_PINS 0x00000002
# define F_PAD 0x00000004
# define F_LAYERS_3 0x00000008
# define F_LAYERS_4 0x00000010
# define F_LAYERS_6 0x00000020
# define F_EXPAND_PLACE 0x00000040
# define F_EXPAND_ROUTE 0x00000080
# define F_TRUST_ORIENT 0x00000100
extern long hasROW (struct phfig *apPhfig);
extern long buildROWS (struct phfig *apPhfig);
extern long buildTRACKS (struct phfig *apPhfig, long aFlags);
extern void defsavelophfig (struct lofig *apLofig,
struct phfig *apPhfig,
char *aDefName,
long aFlags);
# endif

View File

@ -0,0 +1,37 @@
/*
* $Id: DEF_grammar.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Mael Nagat |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./DEF_grammar.h" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifndef __DEF_grammar__
# define __DEF_grammar__
# define F_DEF_SPLIT_POWER 0x00000001
# define F_DEF_NO_IOS 0x00000002
# define F_DEF_NO_INTERF 0x00000004
# define F_DEF_MERGE_TERM 0x00000008
# define F_DEF_SHRINK 0x00000010
extern void defloadlophfig (lofig_list *apLoFig,
phfig_list *apPhFig,
char *aName,
char aMode,
long aVL,
long aFlags);
# endif

View File

@ -0,0 +1,268 @@
%{
/*
* $Author: jpc $
* $Id: DEF_grammar_lex.l,v 1.1 2002/04/25 16:16:20 jpc Exp $
* $Date: 2002/04/25 16:16:20 $
*/
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "util_Defs.h"
#include "DEF_grammar_yacc.h"
# define YY_NO_UNPUT
# define yylval DEF_grammarlval
# define yylineno DEF_grammarlineno
int yylineno = 1;
static int yywrap(void);
static int string(void);
static int history(void);
%}
L [_A-Za-z]
D [0-9]
S [\-\+]
E [eE]
X [\.\-\<\>\[\]\(\)]
%%
[ \t\f] { }
\n { ++yylineno; }
#.* { }
"VERSION" { return T_VERSION; }
"NAMESCASESENSITIVE" { return T_NAMESCASESENSITIVE; }
"NAMEMAPSTRING" { return T_NAMEMAPSTRING; }
"HISTORY" { history (); }
"DESIGN" { return T_DESIGN; }
"VIAS" { return T_VIAS; }
"TECHNOLOGY" { return T_TECH; }
"UNITS" { return T_UNITS; }
"BUSBITCHARS" { return T_BUSBITCHARS; }
"DIVIDERCHAR" { return T_DIVIDERCHAR; }
"DISTANCE" { return T_DISTANCE; }
"MICRONS" { return T_MICRONS; }
"RECT" { return T_RECT; }
"REENTRANTPATHS" { return T_REENTRANTPATHS; }
"SITE" { return T_SITE; }
"CANPLACE" { return T_CANPLACE; }
"CANNOTOCCUPY" { return T_CANNOTOCCUPY; }
"DIEAREA" { return T_DIE_AREA; }
"PINS" { return T_PINS; }
"DEFAULTCAP" { return T_DEFAULTCAP; }
"MINPINS" { return T_MINPINS; }
"WIRECAP" { return T_WIRECAP; }
"TRACKS" { return T_TRACKS; }
"GCELLGRID" { return T_GCELLGRID; }
"DO" { return T_DO; }
"BY" { return T_BY; }
"STEP" { return T_STEP; }
"LAYER" { return T_LAYER; }
"COMPONENTS" { return T_COMPS; }
"GENERATE" { return T_COMP_GEN; }
"SOURCE" { return T_SOURCE; }
"WEIGHT" { return T_WEIGHT; }
"FIXED" { return T_FIXED; }
"COVER" { return T_COVER; }
"PLACED" { return T_PLACED; }
"UNPLACED" { return T_UNPLACED; }
"FOREIGN" { return T_FOREIGN; }
"EEQMASTER" { return T_EEQMASTER; }
"REGION" { return T_REGION; }
"REGIONS" { return T_REGIONS; }
"NETS" { return T_NETS; }
"MUSTJOIN" { return T_MUSTJOIN; }
"ORIGINAL" { return T_ORIGINAL; }
"USE" { return T_USE; }
"STYLE" { return T_STYLE; }
"PATTERN" { return T_PATTERN; }
"PATTERNNAME" { return T_PATTERNNAME; }
"NONDEFAULTRULE" { return T_NONDEFAULTRULE; }
"ESTCAP" { return T_ESTCAP; }
"ROUTED" { return T_ROUTED; }
"ROW" { return T_ROW; }
"TAPER" { return T_TAPER; }
"TAPERRULE" { return T_TAPERRULE; }
"NEW" { return T_NEW; }
"SHAPE" { return T_SHAPE; }
"SPECIALNETS" { return T_SNETS; }
"SPECIALNET" { return T_SNET; }
"WIDTH" { return T_WIDTH; }
"VOLTAGE" { return T_VOLTAGE; }
"SPACING" { return T_SPACING; }
"N" { return T_N; }
"S" { return T_S; }
"E" { return T_E; }
"W" { return T_W; }
"FN" { return T_FN; }
"FS" { return T_FS; }
"FE" { return T_FE; }
"FW" { return T_FW; }
"INPUT" { return T_INPUT; }
"OUTPUT" { return T_OUTPUT; }
"INOUT" { return T_INOUT; }
"FEEDTHRU" { return T_FEEDTHRU; }
"GROUPS" { return T_GROUPS; }
"GROUP" { return T_GROUP; }
"COMPONENT" { return T_COMPONENT; }
"SOFT" { return T_SOFT; }
"MAXX" { return T_MAXX; }
"MAXY" { return T_MAXY; }
"MAXHALFPERIMETER" { return T_MAXHALFPERIMETER; }
"CONSTRAINTS" { return T_CONSTRAINTS; }
"NET" { return T_NET; }
"PATH" { return T_PATH; }
"SUM" { return T_SUM; }
"DIFF" { return T_DIFF; }
"RISEMIN" { return T_RISEMIN; }
"RISEMAX" { return T_RISEMAX; }
"FALLMIN" { return T_FALLMIN; }
"FALLMAX" { return T_FALLMAX; }
"WIREDLOGIC" { return T_WIREDLOGIC; }
"MAXDIST" { return T_MAXDIST; }
"ASSERTIONS" { return T_ASSERTIONS; }
"END" { return T_END; }
"ARRAY" { return T_ARRAY; }
"FLOORPLAN" { return T_FLOORPLAN; }
"SCANCHAINS" { return T_SCANCHAINS; }
"START" { return T_START; }
"FLOATING" { return T_FLOATING; }
"ORDERED" { return T_ORDERED; }
"STOP" { return T_STOP; }
"TIMINGDISABLES" { return T_TIMINGDISABLES; }
"IOTIMINGS" { return T_IOTIMINGS; }
"RISE" { return T_RISE; }
"FALL" { return T_FALL; }
"VARIABLE" { return T_VARIABLE; }
"SLEWRATE" { return T_SLEWRATE; }
"CAPACITANCE" { return T_CAPACITANCE; }
"DRIVECELL" { return T_DRIVECELL; }
"FROMPIN" { return T_FROMPIN; }
"TOPIN" { return T_TOPIN; }
"PARALLEL" { return T_PARALLEL; }
"PARTITIONS" { return T_PARTITIONS; }
"TURNOFF" { return T_TURNOFF; }
"FROMCLOCKPIN" { return T_FROMCLOCKPIN; }
"FROMCOMPPIN" { return T_FROMCOMPPIN; }
"FROMIOPIN" { return T_FROMIOPIN; }
"TOCLOCKPIN" { return T_TOCLOCKPIN; }
"TOCOMPPIN" { return T_TOCOMPPIN; }
"TOIOPIN" { return T_TOIOPIN; }
"SETUPRISE" { return T_SETUPRISE; }
"SETUPFALL" { return T_SETUPFALL; }
"HOLDRISE" { return T_HOLDRISE; }
"HOLDFALL" { return T_HOLDFALL; }
"VPIN" { return T_VPIN; }
"SUBNET" { return T_SUBNET; }
"XTALK" { return T_XTALK; }
"PIN" { return T_PIN; }
"SYNTHESIZED" { return T_SYNTHESIZED; }
"SPECIAL" { return T_SPECIAL; }
"DIRECTION" { return T_DIRECTION; }
"RANGE" { return T_RANGE; }
"FLOORPLANCONSTRAINTS" { return T_FPC; }
"HORIZONTAL" { return T_HORIZONTAL; }
"VERTICAL" { return T_VERTICAL; }
"ALIGN" { return T_ALIGN; }
"MIN" { return T_MIN; }
"MAX" { return T_MAX; }
"EQUAL" { return T_EQUAL; }
"BOTTOMLEFT" { return T_BOTTOMLEFT; }
"TOPRIGHT" { return T_TOPRIGHT; }
"ROWS" { return T_ROWS; }
"PROPERTYDEFINITIONS" { return T_PROPERTYDEFINITIONS; }
"PROPERTY" { return T_PROPERTY; }
"REAL" { return T_REAL; }
"INTEGER" { return T_INTEGER; }
"BEGINEXT" { return T_BEGINEXT; }
"PINPROPERTIES" { return T_PINPROPERTIES; }
"COMMONSCANPINS" { return T_COMMONSCANPINS; }
"COMPONENTPIN" { return T_COMPONENTPIN; }
"SHIELD" { return T_SHIELD; }
"SHIELDNET" { return T_SHIELDNET; }
"NOSHIELD" { return T_NOSHIELD; }
{L}({L}|{D}|{X})* { yylval.s = strdup(yytext); return T_Ident; }
{S}?{D}+ { yylval.n = atof(yytext); return T_Number; }
{S}?{D}+\.{D}* { yylval.n = atof(yytext); return T_Number; }
{S}?{D}*\.{D}+ { yylval.n = atof(yytext); return T_Number; }
{S}?{D}+{E}{S}?{D}+ { yylval.n = atof(yytext); return T_Number; }
{S}?{D}+\.{D}*{E}{S}?{D}+ { yylval.n = atof(yytext); return T_Number; }
{S}?{D}*\.{D}+{E}{S}?{D}+ { yylval.n = atof(yytext); return T_Number; }
"\"" { return string(); }
. { return *yytext; }
%%
static int yywrap() { return (1); }
static int
string()
{
char *str;
size_t max;
int c;
size_t len;
if ((str = (char *)malloc(max = 64)) == NULL)
{ perror("string"); exit (1); }
len = 0;
while ((c = input()) >= 0 && c != '"') {
if (len + 1 == max)
if ((str = (char *)realloc(str, max *= 2)) == NULL)
{ perror ("string"); exit (1); }
str[len++] = (char)c;
if (c == '\n') yylineno++;
}
str[len] = '\0';
if (c == EOF) {
fflush (stdout);
fprintf (stderr, "unterminated string constant");
exit (1);
}
yylval.s = str;
return T_String;
}
static int
history()
{
char *str;
size_t max;
int c;
size_t len;
if ((str = (char *)malloc(max = 64)) == NULL)
{ perror("history"); exit (1); }
len = 0;
while ((c = input()) >= 0 && c != ';') {
if (len + 1 == max)
if ((str = (char *)realloc(str, max *= 2)) == NULL)
{ perror ("history"); exit (1); }
str[len++] = (char)c;
if (c == '\n') yylineno++;
}
str[len] = '\0';
if (c == EOF) {
fflush (stdout);
fprintf (stderr, "unterminated history line");
exit (1);
}
yylval.s = str;
return T_HISTORY;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,100 @@
/*
* $Id: GNU_Defs.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./GNU_Defs.h" |
* | ************************************************************** |
* | |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifdef __GNUC__
# if defined(__sparc__) && !defined(__svr4__)
# define __MISS_GNU_PROTO__ 1
# else
# define __MISS_GNU_PROTO__ 0
# endif
/* ----------------------------------------------------------------------
* Functions from "<errno.h>".
*/
# ifdef _ERRNO_H
# define _errno_h 1
# endif
# ifdef _errno_h
# if __MISS_GNU_PROTO__
extern void perror __FP(( char* ));
# endif
# endif
/* ----------------------------------------------------------------------
* Functions from "<signal.h>".
*/
# ifdef _SIGNAL_H
# define __signal_h 1
# endif
# ifdef __signal_h
# if __MISS_GNU_PROTO__
extern void (*ssignal())();
extern int gsignal __FP(( int ));
# endif
# endif
/* ----------------------------------------------------------------------
* Functions from "<unistd.h>".
*/
# ifdef _SYS_UNISTD_H
# define __sys_unistd_h 1
# endif
# ifdef __sys_unistd_h
# if __MISS_GNU_PROTO__
extern int read __FP(( int, void*, __SIZE_TYPE__ ));
# endif
# endif
/* ----------------------------------------------------------------------
* Functions from "<stdio.h>".
*/
# ifdef _STDIO_H
# define __stdio_h 1
# endif
# ifdef FILE
# define __stdio_h 1
# endif
# ifdef __stdio_h
# if __MISS_GNU_PROTO__
extern int fclose __FP(( FILE* ));
extern int fflush __FP(( FILE* ));
extern int printf __FP(( char*, ... ));
extern int fprintf __FP(( FILE*, char*, ... ));
extern int vfprintf __FP(( FILE*, char*, va_list ));
extern int vsprintf __FP(( char*, char*, va_list ));
extern int fputs __FP(( char*, FILE* ));
# endif
# endif
# endif

View File

@ -0,0 +1,640 @@
/*
* $Id: LEF_drive.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./LEF_drive.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "LEF_drive.h"
/* ------------------------------------------------------------------
* Global variables (declared `extern' in "UtDefs.h").
*/
eMACRO_t *LEF_lMACRO = (eMACRO_t*)NULL;
/* ------------------------------------------------------------------
* Internal functions declarations.
*/
static char *CLASStoa __FP((char acCLASS));
static char *DIRtoa __FP((char acDIR));
static char *USEtoa __FP((char acUSE));
static char *SHAPEtoa __FP((char acSHAPE));
static char *LAYERtoa __FP((char acLAYER));
static char *SYMMETRYtoa __FP((char acSYMMETRY));
static char *pttoa __FP((XY_t *apXY));
static char *SIZEtoa __FP((XY_t *apXY));
static void fprintPATH __FP((FILE *LEF, ePATH_t *alPATH));
static void fprintPORT __FP((FILE *LEF, ePORT_t *alPORT));
static void fprintPIN __FP((FILE *LEF, ePIN_t *apPIN));
static void fprintOBS __FP((FILE *LEF, eOBS_t *alOBS));
/*
* /----------------------------------------------------------------\
* | Functions Definitions |
* \----------------------------------------------------------------/
*/
/* ------------------------------------------------------------------
* Function : "allocRECT()".
*/
extern RECT_t *allocRECT(aX0, aY0, aX1, aY1)
long aX0, aY0, aX1, aY1;
{
RECT_t *pRECT;
pRECT = (RECT_t*)malloc(sizeof(RECT_t));
pRECT->pt0.x = MBK2DEF_length (aX0);
pRECT->pt0.y = MBK2DEF_length (aY0);
pRECT->pt1.x = MBK2DEF_length (aX1);
pRECT->pt1.y = MBK2DEF_length (aY1);
return(pRECT);
}
/* ------------------------------------------------------------------
* Function : "allocPATH()".
*/
extern ePATH_t *allocPATH(alPATH, aX, aY)
ePATH_t *alPATH;
long aX, aY;
{
ePATH_t *pPATH;
pPATH = (ePATH_t*)malloc(sizeof(ePATH_t));
pPATH->pt.x = MBK2DEF_length (aX);
pPATH->pt.y = MBK2DEF_length (aY);
/* Add the new element in head of list. */
pPATH->Next = alPATH;
return(pPATH);
}
/* ------------------------------------------------------------------
* Function : "revPATH()".
*/
extern ePATH_t *revPATH(apPATH)
ePATH_t *apPATH;
{
ePATH_t *pPATH, *lRevPATH, *pTmp;
lRevPATH = (ePATH_t *)NULL;
for(pPATH = apPATH; pPATH != (ePATH_t*)NULL;) {
pTmp = pPATH;
pPATH = pPATH->Next;
pTmp->Next = lRevPATH;
lRevPATH = pTmp;
} /* End of "pPATH" loop. */
return(lRevPATH);
}
/* ------------------------------------------------------------------
* Function : "allocOBS()".
*/
extern eOBS_t *allocOBS(alOBS, aType, apData)
eOBS_t *alOBS;
char aType;
void *apData;
{
eOBS_t *pOBS;
pOBS = (eOBS_t*)malloc(sizeof(eOBS_t));
pOBS->Type = aType;
if (aType == C_OBSITEM_WIDTH)
pOBS->Data = (void*)(MBK2DEF_length ((long)apData));
else
pOBS->Data = apData;
/* Add the new element in head of list. */
pOBS->Next = alOBS;
return(pOBS);
}
/* ------------------------------------------------------------------
* Function : "revOBS()".
*/
extern eOBS_t *revOBS(apOBS)
eOBS_t *apOBS;
{
eOBS_t *pOBS, *lRevOBS, *pTmp;
lRevOBS = (eOBS_t *)NULL;
for(pOBS = apOBS; pOBS != (eOBS_t*)NULL;) {
pTmp = pOBS;
pOBS = pOBS->Next;
pTmp->Next = lRevOBS;
lRevOBS = pTmp;
} /* End of "pOBS" loop. */
return(lRevOBS);
}
/* ------------------------------------------------------------------
* Function : "allocPORT()".
*/
extern ePORT_t *allocPORT(alPORT, aType, apData)
ePORT_t *alPORT;
char aType;
void *apData;
{
ePORT_t *pPORT;
pPORT = (ePORT_t*)malloc(sizeof(ePORT_t));
pPORT->Type = aType;
if (aType == C_PORTITEM_WIDTH)
pPORT->Data = (void*)(MBK2DEF_length ((long)apData));
else
pPORT->Data = apData;
/* Add the new element in head of list. */
pPORT->Next = alPORT;
return(pPORT);
}
/* ------------------------------------------------------------------
* Function : "revPORT()".
*/
extern ePORT_t *revPORT(apPORT)
ePORT_t *apPORT;
{
ePORT_t *pPORT, *lRevPORT, *pTmp;
lRevPORT = (ePORT_t *)NULL;
for(pPORT = apPORT; pPORT != (ePORT_t*)NULL;) {
pTmp = pPORT;
pPORT = pPORT->Next;
pTmp->Next = lRevPORT;
lRevPORT = pTmp;
} /* End of "pPORT" loop. */
return(lRevPORT);
}
/* ------------------------------------------------------------------
* Function : "allocPIN()".
*/
extern ePIN_t *allocPIN(alPin, asName)
ePIN_t *alPin;
char *asName;
{
ePIN_t *pPIN;
/* Allocate, and for security'sake, blank all the fields. */
pPIN = (ePIN_t*)malloc(sizeof(ePIN_t));
pPIN->pinName = namealloc(asName);
pPIN->DIRECTION = C_DIRECTION_NONE;
pPIN->USE = C_USE_NONE;
pPIN->SHAPE = C_SHAPE_NONE;
pPIN->lPORT = (ePORT_t*)NULL;
/* Add the new element in head of list. */
pPIN->Next = alPin;
return(pPIN);
}
/* ------------------------------------------------------------------
* Function : "getPIN()".
*/
extern ePIN_t *getPIN(apMACRO, asName)
eMACRO_t *apMACRO;
char *asName;
{
ePIN_t *pPIN;
for(pPIN = apMACRO->lPIN; pPIN != (ePIN_t*)NULL; pPIN = pPIN->Next) {
if (pPIN->pinName == asName) return(pPIN);
} /* End of "pPIN" loop. */
return((ePIN_t*)NULL);
}
/* ------------------------------------------------------------------
* Function : "allocMACRO()".
*/
extern eMACRO_t *allocMACRO(asName)
char *asName;
{
eMACRO_t *pMACRO;
/* Allocate, and for security'sake, blank all the fields. */
pMACRO = (eMACRO_t*)malloc(sizeof(eMACRO_t));
pMACRO->macroName = namealloc(asName);
pMACRO->CLASS = C_CLASS_NONE;
pMACRO->ORIGIN.x = 0L;
pMACRO->ORIGIN.y = 0L;
pMACRO->SIZE.x = 0L;
pMACRO->SIZE.y = 0L;
pMACRO->SYMMETRY = F_SYMMETRY_NONE;
pMACRO->SITE = (char*)NULL;
pMACRO->lPIN = (ePIN_t*)NULL;
pMACRO->lOBS = (eOBS_t*)NULL;
/* Add the new element in head of list. */
pMACRO->Next = LEF_lMACRO;
LEF_lMACRO = pMACRO;
return(pMACRO);
}
/* ------------------------------------------------------------------
* Function : "CLASStoa()".
*/
static char *CLASStoa(acCLASS)
char acCLASS;
{
switch(acCLASS) {
case C_CLASS_NONE: return((char*)NULL);
case C_CLASS_COVER: return("COVER");
case C_CLASS_RING: return("RING");
case C_CLASS_PAD: return("PAD");
case C_CLASS_CORE: return("CORE");
case C_CLASS_FEEDTHRU: return("CORE FEEDTHRU");
case C_CLASS_ENDCAP: return("ENDCAP");
case C_CLASS_TOPRIGHT: return("ENDCAP TOPRIGHT");
case C_CLASS_TOPLEFT: return("ENDCAP TOPLEFT");
}
return((char*)NULL);
}
/* ------------------------------------------------------------------
* Function : "DIRtoa()".
*/
static char *DIRtoa(acDIR)
char acDIR;
{
switch(acDIR) {
case C_DIRECTION_NONE: return((char*)NULL);
case C_DIRECTION_INPUT: return("INPUT");
case C_DIRECTION_OUTPUT: return("OUTPUT");
case C_DIRECTION_TRISTATE: return("OUTPUT TRISTATE");
case C_DIRECTION_INOUT: return("INOUT");
case C_DIRECTION_FEEDTHRU: return("FEEDTHRU");
}
return((char*)NULL);
}
/* ------------------------------------------------------------------
* Function : "USEtoa()".
*/
static char *USEtoa(acUSE)
char acUSE;
{
switch(acUSE) {
case C_USE_NONE: return((char*)NULL);
case C_USE_SIGNAL: return("signal");
case C_USE_ANALOG: return("analog");
case C_USE_POWER: return("power");
case C_USE_GROUND: return("ground");
case C_USE_CLOCK: return("clock");
}
return((char*)NULL);
}
/* ------------------------------------------------------------------
* Function : "SHAPEtoa()".
*/
static char *SHAPEtoa(acSHAPE)
char acSHAPE;
{
switch(acSHAPE) {
case C_SHAPE_NONE: return((char*)NULL);
case C_SHAPE_ABUTMENT: return("ABUTMENT");
case C_SHAPE_RING: return("RING");
case C_SHAPE_FEEDTHRU: return("FEEDTHRU");
}
return((char*)NULL);
}
/* ------------------------------------------------------------------
* Function : "LAYERtoa()".
*/
static char *LAYERtoa(acLAYER)
char acLAYER;
{
switch(acLAYER) {
case ALU1: return("L_ALU1");
case ALU2: return("L_ALU2");
case ALU3: return("L_ALU3");
case ALU4: return("L_ALU4");
case ALU5: return("L_ALU5");
case ALU6: return("L_ALU6");
case CALU1: return("L_ALU1");
case CALU2: return("L_ALU2");
case CALU3: return("L_ALU3");
case CALU4: return("L_ALU4");
case CALU5: return("L_ALU5");
case CALU6: return("L_ALU6");
}
return((char*)NULL);
}
/* ------------------------------------------------------------------
* Function : "SYMMETRYtoa()".
*/
static char *SYMMETRYtoa(acSYMMETRY)
char acSYMMETRY;
{
static char sSYMMETRY[32];
int iSYMMETRY;
iSYMMETRY = 0;
if (acSYMMETRY & F_SYMMETRY_X) {
sSYMMETRY[iSYMMETRY++] = 'X'; sSYMMETRY[iSYMMETRY++] = ' '; }
if (acSYMMETRY & F_SYMMETRY_Y) {
sSYMMETRY[iSYMMETRY++] = 'Y'; sSYMMETRY[iSYMMETRY++] = ' '; }
if (acSYMMETRY & F_SYMMETRY_R90) {
strncpy(sSYMMETRY + iSYMMETRY, "r90 ", 4);
iSYMMETRY += 4;
}
sSYMMETRY[iSYMMETRY - 1] = (char)0;
return(sSYMMETRY);
}
/* ------------------------------------------------------------------
* Function : "pttoa()".
*/
static char *pttoa(apXY)
XY_t *apXY;
{
static char sXY[32];
sprintf(sXY, "%.2f %.2f", MICRONS(apXY->x), MICRONS(apXY->y));
return(sXY);
}
/* ------------------------------------------------------------------
* Function : "SIZEtoa()".
*/
static char *SIZEtoa(apXY)
XY_t *apXY;
{
static char sXY[32];
sprintf(sXY, "%.2f BY %.2f", MICRONS(apXY->x), MICRONS(apXY->y));
return(sXY);
}
/* ------------------------------------------------------------------
* Function : "fprintPATH()".
*/
static void fprintPATH(LEF, alPATH)
FILE *LEF;
ePATH_t *alPATH;
{
ePATH_t *pPATH;
fprintf(LEF, " PATH ");
for(pPATH = alPATH; pPATH != (ePATH_t*)NULL; pPATH = pPATH->Next) {
fprintf(LEF, "%s ", pttoa(&(pPATH->pt)));
} /* End of "pPATH" loop. */
fprintf(LEF, ";\n");
}
/* ------------------------------------------------------------------
* Function : "fprintPORT()".
*/
static void fprintPORT(LEF, alPORT)
FILE *LEF;
ePORT_t *alPORT;
{
ePORT_t *pPORT;
fprintf(LEF, " PORT\n");
for(pPORT = alPORT; pPORT != (ePORT_t*)NULL; pPORT = pPORT->Next) {
switch(pPORT->Type) {
case C_PORTITEM_LAYER:
fprintf(LEF, " LAYER %s ;\n",
LAYERtoa((char)(long)((pPORT->Data))));
break;
case C_PORTITEM_WIDTH:
fprintf(LEF, " WIDTH %.2f ;\n",
MICRONS((long)(pPORT->Data)));
break;
case C_PORTITEM_RECT:
fprintf(LEF, " RECT %s ",
pttoa(&((RECT_t*)pPORT->Data)->pt0));
fprintf(LEF, "%s ;\n", pttoa(&((RECT_t*)pPORT->Data)->pt1));
break;
case C_PORTITEM_PATH:
fprintPATH(LEF, (ePATH_t *)pPORT->Data);
break;
} /* End of "pPORT->Type" switch. */
} /* End of "pPORT" loop. */
fprintf(LEF, " END\n");
}
/* ------------------------------------------------------------------
* Function : "fprintPIN()".
*/
static void fprintPIN(LEF, apPIN)
FILE *LEF;
ePIN_t *apPIN;
{
char *sPin, sPinLEF[80];
sPin = MBK2DEF_name(sPinLEF, apPIN->pinName);
fprintf(LEF, " PIN %s\n", sPin);
if (apPIN->DIRECTION != C_DIRECTION_NONE) {
fprintf(LEF, " DIRECTION %s ;\n", DIRtoa(apPIN->DIRECTION)); }
if (apPIN->USE != C_USE_NONE) {
fprintf(LEF, " USE %s ;\n", USEtoa(apPIN->USE)); }
if (apPIN->SHAPE != C_SHAPE_NONE) {
fprintf(LEF, " SHAPE %s ;\n", SHAPEtoa(apPIN->SHAPE)); }
if (apPIN->lPORT != (ePORT_t*)NULL)
fprintPORT(LEF, apPIN->lPORT);
fprintf(LEF, " END %s\n", sPin);
}
/* ------------------------------------------------------------------
* Function : "fprintOBS()".
*/
static void fprintOBS(LEF, alOBS)
FILE *LEF;
eOBS_t *alOBS;
{
eOBS_t *pOBS;
if (alOBS != (eOBS_t*)NULL) fprintf(LEF, " OBS\n");
for(pOBS = alOBS; pOBS != (eOBS_t*)NULL; pOBS = pOBS->Next) {
switch(pOBS->Type) {
case C_OBSITEM_LAYER:
fprintf(LEF, " LAYER %s ;\n",
LAYERtoa((char)(long)((pOBS->Data))));
break;
case C_OBSITEM_WIDTH:
fprintf(LEF, " WIDTH %.2f ;\n",
MICRONS((long)(pOBS->Data)));
break;
case C_OBSITEM_RECT:
fprintf(LEF, " RECT %s ",
pttoa(&((RECT_t*)pOBS->Data)->pt0));
fprintf(LEF, "%s ;\n", pttoa(&((RECT_t*)pOBS->Data)->pt1));
break;
case C_OBSITEM_PATH:
fprintPATH(LEF, (ePATH_t *)pOBS->Data);
break;
} /* End of "pOBS->Type" switch. */
} /* End of "pOBS" loop. */
if (alOBS != (eOBS_t*)NULL) fprintf(LEF, " END\n");
}
/* ------------------------------------------------------------------
* Function : "fprintMACRO()".
*/
extern void fprintMACRO(LEF, apMACRO)
FILE *LEF;
eMACRO_t *apMACRO;
{
ePIN_t *pPIN;
fprintf(LEF, "MACRO %s\n", apMACRO->macroName);
if (apMACRO->CLASS != C_CLASS_NONE) {
fprintf(LEF, " CLASS %s ;\n", CLASStoa(apMACRO->CLASS)); }
fprintf(LEF, " ORIGIN %s ;\n", pttoa(&(apMACRO->ORIGIN)));
fprintf(LEF, " SIZE %s ;\n", SIZEtoa(&(apMACRO->SIZE )));
if (apMACRO->SYMMETRY != F_SYMMETRY_NONE) {
fprintf(LEF, " SYMMETRY %s ;\n", SYMMETRYtoa(apMACRO->SYMMETRY)); }
if (apMACRO->SITE != (char*)NULL) {
fprintf(LEF, " SITE %s ;\n", apMACRO->SITE); }
for(pPIN = apMACRO->lPIN; pPIN != (ePIN_t *)NULL; pPIN = pPIN->Next)
fprintPIN(LEF, pPIN);
fprintOBS(LEF, apMACRO->lOBS);
fprintf(LEF, "END %s\n\n", apMACRO->macroName);
}

View File

@ -0,0 +1,146 @@
/*
* $Id: LEF_drive.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./LEF_drive.h" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifndef __LEF_drive__
# define __LEF_drive__
# define C_CLASS_NONE ((char)0)
# define C_CLASS_COVER ((char)1)
# define C_CLASS_RING ((char)2)
# define C_CLASS_PAD ((char)3)
# define C_CLASS_CORE ((char)4)
# define C_CLASS_FEEDTHRU ((char)5)
# define C_CLASS_ENDCAP ((char)6)
# define C_CLASS_TOPRIGHT ((char)7)
# define C_CLASS_TOPLEFT ((char)8)
# define F_SYMMETRY_NONE ((char)0)
# define F_SYMMETRY_X ((char)1)
# define F_SYMMETRY_Y ((char)2)
# define F_SYMMETRY_R90 ((char)4)
# define F_SYMMETRY_XY ((char)( F_SYMMETRY_X \
| F_SYMMETRY_Y ))
# define F_SYMMETRY_XYR90 ((char)( F_SYMMETRY_X \
| F_SYMMETRY_Y \
| F_SYMMETRY_R90 ))
# define C_USE_NONE ((char)0)
# define C_USE_SIGNAL ((char)1)
# define C_USE_ANALOG ((char)2)
# define C_USE_POWER ((char)3)
# define C_USE_GROUND ((char)4)
# define C_USE_CLOCK ((char)5)
# define C_SHAPE_NONE ((char)0)
# define C_SHAPE_ABUTMENT ((char)1)
# define C_SHAPE_RING ((char)2)
# define C_SHAPE_FEEDTHRU ((char)3)
# define C_PORTITEM_LAYER ((char)1)
# define C_PORTITEM_WIDTH ((char)2)
# define C_PORTITEM_PATH ((char)3)
# define C_PORTITEM_RECT ((char)4)
# define C_OBSITEM_LAYER C_PORTITEM_LAYER
# define C_OBSITEM_WIDTH C_PORTITEM_WIDTH
# define C_OBSITEM_PATH C_PORTITEM_PATH
# define C_OBSITEM_RECT C_PORTITEM_RECT
typedef struct XY_s { long x; long y; } XY_t;
typedef struct ePATH_s {
struct XY_s pt;
struct ePATH_s *Next;
} ePATH_t;
typedef struct RECT_s {
struct XY_s pt0;
struct XY_s pt1;
} RECT_t;
typedef struct ePORT_s {
char Type;
void *Data;
struct ePORT_s *Next;
} ePORT_t;
typedef struct eOBS_s {
char Type;
void *Data;
struct eOBS_s *Next;
} eOBS_t;
typedef struct ePIN_s {
char *pinName;
char DIRECTION;
char USE;
char SHAPE;
struct ePORT_s *lPORT;
struct ePIN_s *Next;
} ePIN_t;
typedef struct eMACRO_s {
char *macroName;
char CLASS;
struct XY_s ORIGIN;
struct XY_s SIZE;
char SYMMETRY;
char *SITE;
struct ePIN_s *lPIN;
struct eOBS_s *lOBS;
struct eMACRO_s *Next; /* The next element... */
} eMACRO_t;
# define MICRONS(m) (((float)(m)) / DEF_UNITS_MICRONS)
# define m_AddPin(p,n) ((p) = allocPIN((p), (n)))
# define m_AddPort(p,t,d) ((p) = allocPORT((p), (t), (void*)(d)))
# define m_RevPort(p) ((p) = revPORT((p)))
# define m_AddObs(p,t,d) ((p) = allocOBS((p), (t), (void*)(d)))
# define m_RevObs(p) ((p) = revOBS((p)))
# define m_AddRect(x0,y0,x1,y1) (allocRECT(x0, y0, x1, y1))
# define m_AddPath(p,x,y) ((p) = allocPATH((p), x, y))
# define m_RevPath(p) ((p) = revPATH((p)))
extern RECT_t *allocRECT __FP((long aX0, long aY0, long aX1, long aY1));
extern ePATH_t *allocPATH __FP((ePATH_t *alPATH, long aX, long aY));
extern ePATH_t *revPATH __FP((ePATH_t *apPATH));
extern eOBS_t *allocOBS __FP((eOBS_t *alOBS, char aType, void *apData));
extern eOBS_t *revOBS __FP((eOBS_t *apOBS));
extern ePORT_t *allocPORT __FP((ePORT_t *alPORT, char aType, void *apData));
extern ePORT_t *revPORT __FP((ePORT_t *apPORT));
extern ePIN_t *allocPIN __FP((ePIN_t *alPin, char *asName));
extern ePIN_t *getPIN __FP((eMACRO_t *apMACRO, char *asName));
extern eMACRO_t *allocMACRO __FP((char *asName));
extern void fprintMACRO __FP((FILE *LEF, eMACRO_t *apMACRO));
# endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
/*
* $Id: LEF_drive_sxlib.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./LEF_drive_sxlib.h" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifndef __LEF_drive_sxlib__
# define __LEF_drive_sxlib__
/* SxLib to LEF conversion options. */
# define F_ALLOW_OFFGRID 0x00000001
# define F_NO_POWER_GEOM 0x00000002
# define F_POWER_ABUTMENT 0x00000004
# define F_POWER_FEEDTHRU 0x00000008
extern void lefsavesxlophfig (struct lofig *apLofig,
struct phfig *apPhfig,
long aFlags);
# endif

View File

@ -0,0 +1,319 @@
/*
* $Id: MAC_drive.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./MAC_drive.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "MAC_drive.h"
# define SIZE_SNAME 1024
/* ------------------------------------------------------------------
* Local variables.
*/
static FILE *MAC_FILE;
/* ------------------------------------------------------------------
* Local functions.
*/
static void fillTie __FP((struct phfig *apPhfig));
/*
* /----------------------------------------------------------------\
* | Functions Definitions |
* \----------------------------------------------------------------/
*/
/* ------------------------------------------------------------------
* Function : "fillTie()".
*/
static void fillTie(apPhfig)
struct phfig *apPhfig;
{
/* Fill with spare space with "tie_x0", two pitchs wide with polarization
* contacts for P bulk and N bulk.
*/
fprintf (MAC_FILE, " SROUTE ADDCELL\n");
fprintf (MAC_FILE, " MODEL tie_x0 PREFIX tiex0\n");
fprintf (MAC_FILE, " SPIN vdd NET vdd\n");
fprintf (MAC_FILE, " SPIN vss NET vss\n");
fprintf (MAC_FILE, " AREA (%ld %ld) (%ld %ld)\n",
MBK2DEF_length (apPhfig->XAB1),
MBK2DEF_length (apPhfig->YAB1),
MBK2DEF_length (apPhfig->XAB2),
MBK2DEF_length (apPhfig->YAB2));
fprintf (MAC_FILE, " ;\n\n");
/* Fill with the one pitch cell "rowend_x0". */
fprintf (MAC_FILE, " SROUTE ADDCELL\n");
fprintf (MAC_FILE, " MODEL rowend_x0 PREFIX rowendx0\n");
fprintf (MAC_FILE, " SPIN vdd NET vdd\n");
fprintf (MAC_FILE, " SPIN vss NET vss\n");
fprintf (MAC_FILE, " AREA (%ld %ld) (%ld %ld)\n",
MBK2DEF_length (apPhfig->XAB1),
MBK2DEF_length (apPhfig->YAB1),
MBK2DEF_length (apPhfig->XAB2),
MBK2DEF_length (apPhfig->YAB2));
fprintf (MAC_FILE, " ;\n\n");
}
/* ------------------------------------------------------------------
* Function : "macPlace()".
*/
extern void macPlace(apPhfig, apLofig, macName, aPower, aFlags)
struct phfig *apPhfig;
struct lofig *apLofig;
char *macName;
long aPower;
long aFlags;
{
MAC_FILE = mbkfopen (macName, "mac", "w+");
if (!MAC_FILE) {
errMBK (NULL);
eprintf ("Can't open SE mac file \"%s.mac\".", macName);
EXIT (1);
}
/* Set a nice viewport. */
fprintf (MAC_FILE, " WINDOW FIT ;\n\n");
if (aFlags & F_MAC_FIXED_PINS) {
fprintf (MAC_FILE, " IOPLACE\n");
if (aFlags & F_MAC_IOC) {
fprintf (MAC_FILE, " FILENAME %s.ioc\n", apLofig->NAME);
}
fprintf (MAC_FILE, " TOPBOTTOMLAYER L_ALU2\n");
fprintf (MAC_FILE, " RIGHTLEFTLAYER L_ALU2\n");
fprintf (MAC_FILE, " ;\n\n");
}
/* Power stripes made of "powmid_x0". */
if (aPower > 0) {
fprintf (MAC_FILE, " SROUTE ADDCELL\n");
fprintf (MAC_FILE, " MODEL powmid_x0 PREFIX powmidx0\n");
fprintf (MAC_FILE, " SPIN vdd NET vdd\n");
fprintf (MAC_FILE, " SPIN vss NET vss\n");
fprintf (MAC_FILE, " AREA (%ld %ld) (%ld %ld)\n",
MBK2DEF_length (apPhfig->XAB1),
MBK2DEF_length (apPhfig->YAB1),
MBK2DEF_length (apPhfig->XAB2),
MBK2DEF_length (apPhfig->YAB2));
fprintf (MAC_FILE, " XNUM %ld\n", aPower);
fprintf (MAC_FILE, " ;\n\n");
}
/* Placement itself. */
fprintf (MAC_FILE, " SET VARIABLE Qplace.Place.Pin \"concurrent\" ;\n" );
fprintf (MAC_FILE, " QPLACE NOCONFIG ;\n\n");
/* Fill with tie cells. */
if (aFlags & F_MAC_FILL_TIE) fillTie (apPhfig);
/* Save the placement file. */
fprintf (MAC_FILE, " OUTPUT DEF FILENAME %s_p.def ;\n\n", apLofig->NAME);
/* Fast QUIT : do not save the internal SE data-base. */
fprintf (MAC_FILE, " FQUIT ;\n");
fclose (MAC_FILE);
}
/* ------------------------------------------------------------------
* Function : "macRoute()".
*/
extern void macRoute(apPhfig, apLofig, macName, aPower, aFlags)
struct phfig *apPhfig;
struct lofig *apLofig;
char *macName;
long aPower;
long aFlags;
{
struct eLoseg_s *pLoseg;
struct losig *pLosig;
struct phseg *pPhseg;
long isRouted, isFirst /*, dx */;
char *sigName;
char defSigName[SIZE_SNAME];
MAC_FILE = mbkfopen (macName, "mac", "w+");
if (!MAC_FILE) {
errMBK (NULL);
eprintf ("Can't open SE mac file \"%s.mac\".", macName);
EXIT (1);
}
/* Set a nice viewport. */
fprintf (MAC_FILE, " WINDOW FIT ;\n\n");
/* Fill with tie cells. */
if (aFlags & F_MAC_FILL_TIE) fillTie (apPhfig);
if (aFlags & F_MAC_FIXED_PINS) {
fprintf (MAC_FILE, " IOPLACE\n");
if (aFlags & F_MAC_IOC) {
fprintf (MAC_FILE, " FILENAME %s.ioc\n", apLofig->NAME);
}
fprintf (MAC_FILE, " TOPBOTTOMLAYER L_ALU2\n");
fprintf (MAC_FILE, " RIGHTLEFTLAYER L_ALU2\n");
fprintf (MAC_FILE, " ;\n\n");
}
if (! (aFlags & F_MAC_NO_POWER)) {
/* Special routing : ALU1 horizontal stripes. */
fprintf (MAC_FILE, " SROUTE FOLLOWPINS\n");
fprintf (MAC_FILE, " NET vdd NET vss\n");
fprintf (MAC_FILE, " LAYER L_ALU1 WIDTH 600 FILL DIRECTION HORIZONTAL\n");
fprintf (MAC_FILE, " AREA (%ld %ld) (%ld %ld)\n",
MBK2DEF_length (apPhfig->XAB1),
MBK2DEF_length (apPhfig->YAB1),
MBK2DEF_length (apPhfig->XAB2),
MBK2DEF_length (apPhfig->YAB2));
fprintf (MAC_FILE, " ;\n\n");
/* Special routing : ALU3 vertical stripes. */
if (findphmodel (apPhfig, namealloc ("powmid_x0"))) {
fprintf (MAC_FILE, " SROUTE FOLLOWPINS\n");
fprintf (MAC_FILE, " NET vdd NET vss\n");
fprintf (MAC_FILE, " LAYER L_ALU3 WIDTH 1200 FILL DIRECTION VERTICAL\n");
fprintf (MAC_FILE, " AREA (%ld %ld) (%ld %ld)\n",
MBK2DEF_length (apPhfig->XAB1),
MBK2DEF_length (apPhfig->YAB1),
MBK2DEF_length (apPhfig->XAB2),
MBK2DEF_length (apPhfig->YAB2));
fprintf (MAC_FILE, " ;\n\n");
}
}
/* Global routing of regular nets. */
fprintf (MAC_FILE, " GROUTE ;\n\n");
/* Final routing of regular nets. */
fprintf (MAC_FILE, " FROUTE ");
isFirst = TRUE;
for(pLosig = apLofig->LOSIG;
pLosig != (losig_list*)NULL; pLosig = pLosig->NEXT) {
sigName = getsigname (pLosig);
if (isvdd (sigName) || isvss (sigName)) continue;
if (apPhfig) {
isRouted = FALSE;
pLoseg = getloseglist (apPhfig, getsigname (pLosig));
for (; pLoseg != NULL; pLoseg = pLoseg->next) {
if (pLoseg->type == LOSEG_SEG) {
pPhseg = (struct phseg*)(pLoseg->MBKobj);
/* Is this segment touching the AB. */
/*if ( ( (pPhseg->X1 == apPhfig->XAB1)
* && (pPhseg->Y1 > apPhfig->YAB1)
* && (pPhseg->Y1 < apPhfig->YAB2))
* || ( (pPhseg->X2 == apPhfig->XAB1)
* && (pPhseg->Y1 > apPhfig->YAB1)
* && (pPhseg->Y1 < apPhfig->YAB2))
* || ( (pPhseg->X1 == apPhfig->XAB2)
* && (pPhseg->Y1 > apPhfig->YAB1)
* && (pPhseg->Y1 < apPhfig->YAB2))
* || ( (pPhseg->X2 == apPhfig->XAB2)
* && (pPhseg->Y1 > apPhfig->YAB1)
* && (pPhseg->Y1 < apPhfig->YAB2))
*
* || ( (pPhseg->Y1 == apPhfig->YAB1)
* && (pPhseg->X1 > apPhfig->XAB1)
* && (pPhseg->X1 < apPhfig->XAB2))
* || ( (pPhseg->Y2 == apPhfig->YAB1)
* && (pPhseg->X1 > apPhfig->XAB1)
* && (pPhseg->X1 < apPhfig->XAB2))
* || ( (pPhseg->Y1 == apPhfig->YAB2)
* && (pPhseg->X1 > apPhfig->XAB1)
* && (pPhseg->X1 < apPhfig->XAB2))
* || ( (pPhseg->Y2 == apPhfig->YAB2)
* && (pPhseg->X1 > apPhfig->XAB1)
* && (pPhseg->X1 < apPhfig->XAB2))) {
* continue;
*/
/*
* dx = 0;
*
* switch (pPhseg->TYPE) {
* case UP:
* case DOWN: dx = pPhseg->Y2 - pPhseg->Y1; break;
* case LEFT:
* case RIGHT: dx = pPhseg->X2 - pPhseg->X1; break;
* }
*
* if (dx == MBKSCALE (5)) continue;
*/
/*} */
isRouted = TRUE; break;
}
}
if (isRouted) {
if (!isFirst) {
fprintf (MAC_FILE, " ");
}
isFirst = FALSE;
fprintf (MAC_FILE, "NONETS \"%s\"\n",
MBK2DEF_name (defSigName, sigName));
}
}
}
fprintf (MAC_FILE, " ;\n\n");
/* Save the routed file. */
fprintf (MAC_FILE, " OUTPUT DEF FILENAME %s_r.def ;\n\n", apLofig->NAME);
/* Fast QUIT : do not save the internal SE data-base. */
fprintf (MAC_FILE, " FQUIT ;\n");
fclose (MAC_FILE);
}

View File

@ -0,0 +1,42 @@
/*
* $Id: MAC_drive.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./MAC_drive.h" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifndef __MAC_drive__
# define __MAC_drive__
# define F_MAC_IOC 0x00000001
# define F_MAC_NO_POWER 0x00000002
# define F_MAC_FIXED_PINS 0x00000004
# define F_MAC_FILL_TIE 0x00000008
extern void macPlace __FP((struct phfig *apPhfig,
struct lofig *apLofig,
char *macName,
long aPower,
long aFlags));
extern void macRoute __FP((struct phfig *apPhfig,
struct lofig *apLofig,
char *macName,
long aPower,
long aFlags));
# endif

View File

@ -0,0 +1,107 @@
## Process this file with automake to produce Makefile.in
AM_YFLAGS = -d -v -p DEF_grammar
AM_LFLAGS = -s -f -8 -pp -PDEF_grammar -olex.yy.c
AM_CFLAGS = @ALLIANCE_CFLAGS@
bin_PROGRAMS = a2def def2a sxlib2lef
bin_SCRIPTS = sea seroute seplace a2lef
a2def_LDADD = @ALLIANCE_LIBS@ \
$(top_builddir)/src/libUtil.a \
-lMpu -lMlu \
-lMcl -lMcp \
-lMal -lMap \
-lMsl \
-lMel -lMgl \
-lMhl \
-lMvl \
-lMmg \
-lMlo \
-lMph -lMut \
-lRcn \
-lAut
def2a_LDADD = @ALLIANCE_LIBS@ \
$(top_builddir)/src/libUtil.a \
-lMpu -lMlu \
-lMcl -lMcp \
-lMal -lMap \
-lMsl \
-lMel -lMgl \
-lMhl \
-lMvl \
-lMmg \
-lMlo \
-lMph -lMut \
-lRcn \
-lAut
sxlib2lef_LDADD = @ALLIANCE_LIBS@ \
$(top_builddir)/src/libUtil.a \
-lMpu -lMlu \
-lMcl -lMcp \
-lMal -lMap \
-lMsl \
-lMel -lMgl \
-lMhl \
-lMvl \
-lMmg \
-lMlo \
-lMph -lMut \
-lRcn \
-lAut
noinst_LIBRARIES = libUtil.a
libUtil_a_SOURCES = util_Floorplan.c \
util_Inter.c \
util_LEFDEF.c \
util_MBK.c \
util_Power.c \
util_RTU.c \
util_Sys.c \
util_Defs.h \
GNU_Defs.h
a2def_SOURCES = DEF_drive.c \
DEF_drive.h \
MAC_drive.c \
MAC_drive.h \
a2DEF.c
def2a_SOURCES = DEF_actions.c \
DEF_actions.h \
DEF_grammar.h \
DEF_grammar_yacc.y \
DEF_grammar_lex.l \
DEF2a.c
sxlib2lef_SOURCES = LEF_drive.h \
LEF_drive.c \
LEF_drive_sxlib.c \
LEF_drive_sxlib.h \
sxlib2LEF.c
sea: $(srcdir)/sea.sh
cp $< $@
chmod a+x $@
seplace: $(srcdir)/seplace.sh
cp $< $@
chmod a+x $@
seroute: $(srcdir)/seroute.sh
cp $< $@
chmod a+x $@
a2lef: $(srcdir)/a2lef.sh
cp $< $@
chmod a+x $@
EXTRA_DIST = debug.c debugon.h debugoff.h
CLEANFILES =DEF_grammar_lex.c DEF_grammar_yacc.c \
y.output DEF_grammar_yacc.h \
seplace seroute sea a2lef

View File

@ -0,0 +1,639 @@
/*
* $Id: a2DEF.c,v 1.1 2002/04/25 16:16:19 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./a2DEF.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "DEF_drive.h"
# include "MAC_drive.h"
/* ------------------------------------------------------------------
* Local constants.
*/
# define A_PHFIG 0x00000001 /* 1 */
# define A_FIXED_PINS 0x00000002 /* 2 */
# define A_PAD 0x00000004 /* 4 */
# define A_LAYERS_3 0x00000008 /* 8 */
# define A_LAYERS_4 0x00000010 /* 8 */
# define A_LAYERS_6 0x00000020 /* 16 */
# define A_FLOORPLAN 0x00000040 /* 32 */
# define A_MARGIN 0x00000080 /* 64 */
# define A_ROW_NUMBER 0x00000100 /* 128 */
# define A_X_SIZE 0x00000200 /* 256 */
# define A_Y_SIZE 0x00000400 /* 512 */
# define A_ASPECT_RATIO 0x00000800 /* 1024 */
# define A_POWER 0x00001000 /* 2048 */
# define A_EXPAND_PLACE 0x00002000 /* 4096 */
# define A_EXPAND_ROUTE 0x00004000 /* 4096 */
# define A_MAC_PLACE 0x00008000 /* 8192 */
# define A_MAC_ROUTE 0x00010000 /* 16384 */
# define A_MAC_IOC 0x00020000 /* 16384 */
# define A_MAC_NO_POWER 0x00040000 /* 16384 */
# define A_MAC_FILL_TIE 0x00080000 /* 16384 */
# define A_TRUST_ORIENT 0x00100000 /* 16384 */
/* ----------------------------------------------------------------------
* Local functions.
*/
static void printHelp __FP((void));
/*
* /--------------------------------------------------------------------\
* | Functions Definitions |
* \--------------------------------------------------------------------/
*/
/* ----------------------------------------------------------------------
* Function : "printHelp()".
*/
static void printHelp()
{
printf (" o Usage := \"a2def [-h] [-v] [-V]\n");
printf (" [-b] [-c] [-P] [-3] [-6] [-e] [-E]\n");
printf (" [--mac-place=<MACPLACE>]\n");
printf (" [--mac-route=<MACROUTE>]\n");
printf (" [--ioc] [-n] [-t]\n");
printf (" [-F [--margin=<MARGIN> |\n");
printf (" --row-number=<NR> |\n");
printf (" --x-size=<XSIZE> |\n");
printf (" --y-size=<YSIZE> |\n");
printf (" --aspect-ratio=<FF>|\n");
printf (" --power=<NP> ]]\n");
printf (" [--place=<LAYOUT>]\n");
printf (" <netlist> [<def>]\"\n\n");
printf (" o Options :\n");
printf (" [-v] := Be verbose.\n");
printf (" [-V] := Be very verbose.\n");
printf (" [-h] := Print this message.\n");
printf (" [-b] := Do not put terminals on the abutment box.\n");
printf (" [-c] := Put terminals on the abutment box.\n");
printf (" [-P] := The design have pads.\n");
printf (" [-3] := Uses only 3 levels of metal.\n");
printf (" [-6] := Uses all 6 levels of metal.\n");
printf (" [-e] := Expand AB of the physical figure (place).\n");
printf (" [-E] := Expand AB of the physical figure (route).\n");
printf (" [-F] := Generate a floorplan.\n");
printf (" [-n] := Do not route power supplies (in .mac).\n");
printf (" [-T] := Trust MBK instance orientations.\n");
printf (" [-t] := Fill the remaining space with tie (in .mac).\n");
printf (" [--ioc] := Terminal placement file, used by the mac\n");
printf (" generator.\n");
printf (" [--mac-place=<MACPLACE>] :=\n");
printf (" Generate a Silicon Ensemble script (.mac)\n");
printf (" for the placement step.\n");
printf (" [--mac-route=<MACROUTE>] :=\n");
printf (" Generate a Silicon Ensemble script (.mac)\n");
printf (" for the routing step.\n");
printf (" [--margin=<MARGIN>] :=\n");
printf (" Set the free area in percentage of the\n");
printf (" cell area. The resulting area will be\n");
printf (" equal to CELL_AREA * (1 + <MARGIN>/100).\n");
printf (" Default value 10.\n");
printf (" [--row-number=<NR>] :=\n");
printf (" Set the preferred number of rows of the\n");
printf (" design to <NR>. The width is computed.\n");
printf (" [--x-size=<XSIZE>] :=\n");
printf (" Set the preferred width of the design to\n");
printf (" <XSIZE>. <XSIZE> is rounded to the pitch\n");
printf (" (currently 5 lambdas). The height is\n");
printf (" computed.\n");
printf (" [--y-size=<YSIZE>] :=\n");
printf (" Set the preferred height of the design to\n");
printf (" <YSIZE>. <YSIZE> is rounded to the pitch\n");
printf (" (currently 50 lambdas). The width is\n");
printf (" computed.\n");
printf (" [--aspect-ratio=<FF>] :=\n");
printf (" Set the preferred form factor of the design\n");
printf (" to <FF>.\n");
printf (" [--power=<NP>] :=\n");
printf (" Set the number of vertical power rail to <NR>\n");
printf (" (default : 1).\n");
printf (" [--place=<LAYOUT>] :=\n");
printf (" The Design is preplaced/prerouted.\n");
printf (" <netlist> := The input netlist (mandatory).\n");
printf (" <def> := The output DEF file.\n");
printf ("\n" );
}
/* ----------------------------------------------------------------------
* Function : "main()".
*/
extern int main(argc, argv)
int argc;
char *argv[];
{
struct lofig *pLofig;
struct phfig *pPhfig;
struct loins *pLoins;
char *netlistName, *layoutName, *defName;
int argC, i, optCount;
long VL, argFlags, defFlags, floFlags, macFlags;
long margin, xSize, ySize, power;
double formFactor;
char macPlaceName[1024], macRouteName[1024];
/* Read MBK environment. */
mbkenv ();
autenv ();
/* Initialise the "util" module. */
util_init (C_VerboseLevel2, F_DUMPCORE, "a2DEF");
optCount = 0;
argC = argc;
pPhfig = NULL;
/* Default options. */
layoutName = NULL;
defName = NULL;
VL = C_VerboseLevel0;
defFlags = F_LAYERS_6;
floFlags = F_FLOOR_ASPECT_RATIO;
argFlags = 0L;
macFlags = 0L;
margin = 10L;
xSize = 0L;
ySize = 0L;
formFactor = 1.0;
power = 1;
/* Read the options. */
for(i = 1; i < argc; i++) {
/*
* fflush (stdout);
* fprintf (stderr, "argFlags := %ld (%s)\n", argFlags, argv[i]);
*/
if (!strcmp (argv[i], "-h")) { printHelp (); exit (0); }
if (!strcmp (argv[i], "-v")) { VL = C_VerboseLevel1; continue; }
if (!strcmp (argv[i], "-V")) { VL = C_VerboseLevel2; continue; }
if (!strcmp (argv[i], "-e")) { argFlags |= A_EXPAND_PLACE;
defFlags |= F_EXPAND_PLACE;
continue; }
if (!strcmp (argv[i], "-E")) { argFlags |= A_EXPAND_ROUTE;
defFlags |= F_EXPAND_ROUTE;
continue; }
/* Short options. */
if (!strcmp (argv[i], "-c")) {
argFlags |= A_FIXED_PINS;
defFlags |= F_FIXED_PINS;
/*macFlags |= F_MAC_FIXED_PINS;*/
continue;
}
if (!strcmp (argv[i], "-b")) {
argFlags &= ~A_FIXED_PINS;
defFlags &= ~F_FIXED_PINS;
continue;
}
if (!strcmp (argv[i], "-p")) {
continue;
}
if (!strncmp (argv[i], "--place=", 8)) {
argFlags |= A_PHFIG;
defFlags |= F_PHFIG;
power = 0;
layoutName = namealloc (argv[i] + 8);
continue;
}
if (!strcmp (argv[i], "-P")) {
argFlags |= A_PAD;
argFlags &= ~A_FIXED_PINS;
defFlags |= F_PAD;
defFlags &= ~F_FIXED_PINS;
continue;
}
if (!strcmp (argv[i], "-3")) {
argFlags |= A_LAYERS_3;
argFlags &= ~A_LAYERS_4;
argFlags &= ~A_LAYERS_6;
defFlags |= F_LAYERS_3;
defFlags &= ~F_LAYERS_4;
defFlags &= ~F_LAYERS_6;
floFlags |= F_FLOOR_LAYERS_3;
floFlags &= ~F_FLOOR_LAYERS_4;
floFlags &= ~F_FLOOR_LAYERS_6;
continue;
}
if (!strcmp (argv[i], "-4")) {
argFlags |= A_LAYERS_4;
argFlags &= ~A_LAYERS_3;
argFlags &= ~A_LAYERS_6;
defFlags |= F_LAYERS_4;
defFlags &= ~F_LAYERS_3;
defFlags &= ~F_LAYERS_6;
floFlags |= F_FLOOR_LAYERS_4;
floFlags &= ~F_FLOOR_LAYERS_3;
floFlags &= ~F_FLOOR_LAYERS_6;
continue;
}
if (!strcmp (argv[i], "-6")) {
argFlags |= A_LAYERS_6;
argFlags &= ~A_LAYERS_3;
defFlags |= F_LAYERS_6;
defFlags &= ~F_LAYERS_3;
floFlags |= F_FLOOR_LAYERS_6;
floFlags &= ~F_FLOOR_LAYERS_3;
continue;
}
if (!strcmp (argv[i], "--ioc")) {
argFlags |= A_MAC_IOC;
macFlags |= F_MAC_IOC;
continue;
}
if (!strcmp (argv[i], "-n")) {
argFlags |= A_MAC_NO_POWER;
macFlags |= F_MAC_NO_POWER;
continue;
}
if (!strcmp (argv[i], "-t")) {
argFlags |= A_MAC_FILL_TIE;
macFlags |= F_MAC_FILL_TIE;
continue;
}
if (!strcmp (argv[i], "-T")) {
argFlags |= A_TRUST_ORIENT;
defFlags |= F_TRUST_ORIENT;
continue;
}
if (!strncmp (argv[i], "--mac-place=", 12)) {
argFlags |= A_MAC_PLACE;
strcpy (macPlaceName, argv[i] + 12);
continue;
}
if (!strncmp (argv[i], "--mac-route=", 12)) {
argFlags |= A_MAC_ROUTE;
strcpy (macRouteName, argv[i] + 12);
continue;
}
if (!strcmp (argv[i], "-F")) { argFlags |= A_FLOORPLAN; continue; }
/* Long options : associated with floorplan. */
if (!strncmp (argv[i], "--margin=", 9)) {
argFlags |= A_MARGIN;
if (1 != sscanf (argv[i] + 9, "%ld", &margin)) {
eprinth (NULL);
eprintf ("Invalid <MARGIN> value.\n");
printHelp ();
exit (2);
}
if (margin < 0) {
eprinth (NULL);
eprintf ("Negative <MARGIN> value (%ld).\n", margin);
printHelp ();
exit (2);
}
continue;
}
if (!strncmp (argv[i], "--row-number=", 13)) {
optCount += 1;
argFlags |= A_ROW_NUMBER;
floFlags |= F_FLOOR_Y_SIZE;
floFlags &= ~F_FLOOR_ASPECT_RATIO;
if (1 != sscanf (argv[i] + 13, "%ld", &ySize)) {
eprinth (NULL);
eprintf ("Invalid <NR> value.\n\n");
printHelp ();
exit (2);
}
if (ySize <= 0) {
eprinth (NULL);
eprintf ("Negative or null <NR> value (%ld).\n", margin);
printHelp ();
exit (2);
}
continue;
}
if (!strncmp (argv[i], "--y-size=", 9)) {
optCount += 1;
argFlags |= A_Y_SIZE;
floFlags |= F_FLOOR_Y_SIZE;
floFlags &= ~F_FLOOR_ASPECT_RATIO;
if (1 != sscanf (argv[i] + 9, "%ld", &ySize)) {
eprinth (NULL);
eprintf ("Invalid <YSIZE> value.\n\n");
printHelp ();
exit (2);
}
if (ySize <= 0) {
eprinth (NULL);
eprintf ("Negative or null <YSIZE> value (%ld).\n", ySize);
printHelp ();
exit (2);
}
ySize /= Y_SLICE;
continue;
}
if (!strncmp (argv[i], "--x-size=", 9)) {
optCount += 1;
argFlags |= A_X_SIZE;
floFlags |= F_FLOOR_X_SIZE;
floFlags &= ~F_FLOOR_ASPECT_RATIO;
if (1 != sscanf (argv[i] + 9, "%ld", &xSize)) {
eprinth (NULL);
eprintf ("Invalid <XSIZE> value.\n\n");
printHelp ();
exit (2);
}
if (xSize <= 0) {
eprinth (NULL);
eprintf ("Negative or null <XSIZE> value (%ld).\n", xSize);
printHelp ();
exit (2);
}
xSize /= X_GRID;
continue;
}
if (!strncmp (argv[i], "--aspect-ratio=", 15)) {
optCount += 1;
argFlags |= A_ASPECT_RATIO;
floFlags |= F_FLOOR_ASPECT_RATIO;
if (1 != sscanf (argv[i] + 15, "%lf", &formFactor)) {
eprinth (NULL);
eprintf ("Invalid <FF> value.\n\n");
printHelp ();
exit (2);
}
if (formFactor <= 0.0) {
eprinth (NULL);
eprintf ("Negative or null <FF> value (%f).\n", formFactor);
printHelp ();
exit (2);
}
continue;
}
if (!strncmp (argv[i], "--power=", 8)) {
argFlags |= A_POWER;
if (1 != sscanf (argv[i] + 8, "%ld", &power)) {
eprinth (NULL);
eprintf ("Invalid <NP> value.\n\n");
printHelp ();
exit (2);
}
if (power < 0) {
eprinth (NULL);
eprintf ("Negative <NP> value (%ld).\n", power);
printHelp ();
exit (2);
}
continue;
}
if ((argC - i) > 2) {
eprinth (NULL);
eprintf ("Unknown argument \"%s\"\n\n", argv[argC - 1]);
printHelp ();
exit (1);
}
else
break;
}
if ((argC - i) < 1) {
eprinth (NULL);
eprintf ("Missing netlist name <netlist>.\n\n");
printHelp ();
exit (1);
} else {
netlistName = namealloc (argv[i]);
if ((argC - i) == 2)
defName = namealloc (argv[i + 1]);
else
defName = netlistName;
}
if (argFlags & A_FLOORPLAN) {
if (argFlags & A_PHFIG) {
eprinth (NULL);
eprintf ("\n Options -F and -p are mutually exclusive : either you");
eprintf (" want to make\n a floorplan or you supply a placement file.");
eprintf ("\n");
exit (1);
}
if (optCount > 1) {
eprinth (NULL);
eprintf ("\n Options --row-number, --x-size, --y-size and");
eprintf (" --aspect-ratio\n");
eprintf ( " are mutually exclusive.\n)");
exit (1);
}
if (!optCount) argFlags |= A_ASPECT_RATIO;
} else {
if (argFlags & A_MARGIN) {
wprinth (NULL);
wprintf (" ignored --margin argument, must be used with -F\n");
}
if (argFlags & A_X_SIZE) {
wprinth (NULL);
wprintf (" ignored --x-size argument, must be used with -F\n");
}
if (argFlags & A_Y_SIZE) {
wprinth (NULL);
wprintf (" ignored --y-size argument, must be used with -F\n");
}
if (argFlags & A_ASPECT_RATIO) {
wprinth (NULL);
wprintf (" ignored --aspect-ratio argument, must be used with -F\n");
}
if ((argFlags & A_EXPAND_PLACE) && !(argFlags & A_PHFIG)) {
wprinth (NULL);
wprintf (" ignored -e argument, no physical layout.\n");
}
if ((argFlags & A_EXPAND_ROUTE) && !(argFlags & A_PHFIG)) {
wprinth (NULL);
wprintf (" ignored -E argument, no physical layout.\n");
}
}
setVL (VL);
if (VL > C_VerboseLevel0)
alliancebanner(
"a2DEF", "V.RR", "Alliance to DEF converter",
"2000", ALLIANCE_VERSION );
printMBKEnv ();
if (argFlags & A_PAD) mprintf1 (" o Forced pad design.\n");
if (argFlags & A_PHFIG) mprintf1 (" o Preplaced/prerouted design.\n");
mprintf2 (" o Loading \"%s\" (logical).\n", netlistName);
pLofig = getlofig (netlistName, 'A');
if (defFlags & F_PHFIG) {
mprintf2 (" o Loading \"%s\" (physical).\n", layoutName);
pPhfig = getphfig (layoutName, 'A');
} else
pPhfig = (phfig_list *)NULL;
mprintf2 (" o Flattening \"%s\" to the catalog.\n", netlistName);
mprintf2 (" (using MBK_SEPAR := \'%c\' as separator)\n", SEPAR);
if (defFlags & F_PHFIG)
rflattenphfig (pPhfig, YES, YES);
rflattenlofig (pLofig, YES, YES);
/* Build a floorplan. */
if (argFlags & A_FLOORPLAN) {
mprintf2 (" o Making floorplan.\n");
pPhfig = makeFloorplan (pLofig,
margin,
xSize,
ySize,
formFactor,
power,
floFlags);
if (layoutName) pPhfig->NAME = layoutName;
/*savephfig (pPhfig);*/
}
/* Add ROWS & TRACKS references, if needed. */
if ((argFlags & A_PHFIG) && (!hasROW (pPhfig))) {
mprintf2 (" o Building default ROWS and TRACKS.\n");
buildROWS (pPhfig);
buildTRACKS (pPhfig, defFlags);
}
/* Place terminals. */
mprintf2 (" o Placing terminals.\n");
/* placeTerms (pLofig, pPhfig); */
if (( (argFlags & A_PHFIG)
|| (argFlags & A_FLOORPLAN)) && ( (argFlags & A_EXPAND_PLACE)
|| (argFlags & A_EXPAND_ROUTE))) {
mprintf2 (" o Expanding the abutment box.\n");
expandFloorplan (pPhfig);
/* savephfig (pPhfig); */
}
/* Try to guess if the design have pads. */
for (pLoins = pLofig->LOINS; pLoins != NULL; pLoins = pLoins->NEXT) {
if (isPad (pLoins->FIGNAME)) {
defFlags |= F_PAD;
defFlags &= ~F_FIXED_PINS;
mprintf1 (" o Pads found in this design (%s).\n",
pLoins->FIGNAME);
break;
}
}
/* Generate a separate "vdd/vss" for the core and the pads. */
lofigchain (pLofig);
initSigIndex (pLofig->LOSIG);
if (defFlags & F_PAD) {
splitPowerNet (pLofig, namealloc("vdd"));
splitPowerNet (pLofig, namealloc("vss"));
lofigchain (pLofig);
}
/* Build the loseg list. */
if (defFlags & F_PHFIG) {
phsegchain (pLofig, pPhfig);
}
/* Prevent SE to put terminal on power cells. */
if (pPhfig) protectPowmid (pPhfig);
/* Drive the DEF file. */
defsavelophfig (pLofig, pPhfig, defName, defFlags);
/* Drive ".mac" files, if any. */
if (argFlags & A_MAC_PLACE) {
if (pPhfig)
macPlace (pPhfig, pLofig, macPlaceName, power, macFlags);
else {
eprinth (NULL);
eprintf (" --mac-place=<MACPLACE> option must be given with");
eprintf (" [--place] or [-F].\n");
exit (2);
}
}
if (argFlags & A_MAC_ROUTE) {
if (pPhfig)
macRoute (pPhfig, pLofig, macRouteName, power, macFlags);
else {
eprinth (NULL);
eprintf (" --mac-route=<MACPLACE> option must be given with");
eprintf (" [-place] or [-F].\n");
exit (2);
}
}
/* free the loseg list. */
if (defFlags & F_PHFIG) {
freeloseg (pPhfig);
}
exit(0);
}

View File

@ -0,0 +1,427 @@
#!/bin/sh
#
# $Id: a2lef.sh,v 1.1 2002/04/25 16:16:19 jpc Exp $
#
# /------------------------------------------------------------------\
# | |
# | A l l i a n c e C A D S y s t e m |
# | S i l i c o n E n s e m b l e / A l l i a n c e |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : alliance-support@asim.lip6.fr |
# | ================================================================ |
# | Script : "./a2LEF.sh" |
# | **************************************************************** |
# | U p d a t e s |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Constants definitions.
VL=0
techFile=""
lLibDir=""
lefFile=""
sx2lef_args=""
cellName=""
# /------------------------------------------------------------------\
# | |
# | Functions Definitions |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Function : "vecho()".
vecho()
{
if [ $1 -le $VL ]; then
if [ "$2" = "-n" ]; then
printf "$3"
else
echo "$2"
fi
fi
}
# --------------------------------------------------------------------
# Function : "title()".
title()
{
if [ $VL -ge 1 ]; then
echo ""
alcbanner "a2LEF" "V.RR" "Alliance Library to LEF converter" "2000"
echo ""
fi
}
# --------------------------------------------------------------------
# Function : `print_usage()'.
print_usage()
{
echo ""
echo ""
echo "Usage: a2LEF.sh [--verbose] [--very-verbose] [--help] \\"
echo " [--allow-offgrid] [--fake-power] \\"
echo " <--techno <tech_file> > \\"
echo " <--library <lib_dir> [--library <lib_dir>]> \\"
echo " <--lef <lef_file> > \\"
echo " <--cell <cell_name> >"
echo " a2LEF.sh [-vVhop] <-t <tech_file> > \\"
echo " <-l <lib_dir> [-l <lib_dir>]> \\"
echo " <-L <lef_file> > \\"
echo " <-c <cell_name> > "
echo ""
echo "Options:"
echo " o [--help|-h] : print this help."
echo " o [--verbose|-v] : be verbose."
echo " o [--very-verbose|-V] : be very verbose :-)."
echo " o [--allow-offgrid|-o] : allow terminals to be offgrid."
echo " o [--fake-power|-p] : do not attempt to generate"
echo " PORT geometries for power pins."
echo " o <--techno|-t <tech_file> > : location of the LEF techno header."
echo " o <--library|-l <lib_dir> > : Alliance library directory."
echo " o <--lef|-L <lef_file> > : output LEF file."
echo " o <--cell|-c <cell_name> > : process a single (macro) cell."
echo ""
echo ""
}
# --------------------------------------------------------------------
# Function : `setTechno()'.
setTechno()
{
aTechFile="$1"
aLEF="$2"
rm -f $aLEF > /dev/null 2>&1
cp $aTechFile $aLEF
}
# --------------------------------------------------------------------
# Function : `buildLib()'.
buildLib()
{
aLibDir="$1"
aLEF="$2"
if [ ! -d $aLibDir ]; then
echo "a2LEF:error: Library \"$aLibDir\" doesn't exist."
exit 1
fi
MBK_CATA_LIB="$aLibDir"; export MBK_CATA_LIB
lCellAp=`(cd $aLibDir; \ls *.vbe)`
if [ "$lCellAp" = "" ]; then
echo "a2LEF:error: Library \"$aLibDir\" is empty."
exit 1
fi
libName="`echo $aLibDir | sed 's,.*/,,'`"
vecho 1 ""
vecho 1 " o Processing library \"$libName\"."
success="$libName.success"
failed="$libName.failed"
log="$libName.log"
failedNB=0
successNB=0
rm -f $success $failed $log > /dev/null 2>&1
for cellAp in $lCellAp; do
cell=`echo $cellAp | sed 's,\.vbe$,,'`
vecho 2 -n " - \"$cell\"... "
case $cell in
*_sp) pxlib2lef -V $cell >> $log 2>&1; RV=$?;;
*) sxlib2lef -V $sx2lef_args $cell >> $log 2>&1; RV=$?;;
esac
if [ $RV -ne 0 ]; then
failedNB=`expr $failedNB + 1`
echo "$cell" >> $failed
vecho 2 "KO."
else
echo "" >> $aLEF
cat $cell.lef >> $aLEF
rm -f $cell.lef
successNB=`expr $successNB + 1`
echo "$cell" >> $success
vecho 2 "OK."
fi
done
vecho 1 " o $successNB successful cells."
if [ $failedNB -gt 0 ]; then
echo ""
echo "a2LEF:error:"
echo " $failedNB failed cells in library \"$libName\"."
echo " Please read \"$log\" for detailed explanations."
exit 1
fi
}
# --------------------------------------------------------------------
# Function : `closeLib()'.
closeLib()
{
aLEF="$1"
echo "" >> $aLEF
echo "END LIBRARY" >> $aLEF
}
# /------------------------------------------------------------------\
# | |
# | Main Part of the Shell Script |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Process the command line.
while [ $# -gt 0 ]; do
case $1 in
--help) print_usage; exit 0;;
--verbose) VL=1;;
--very-verbose) VL=2;;
--allow-offgrid) sx2lef_args="$sx2lef_args -o";;
--fake-power) sx2lef_args="$sx2lef_args -p";;
--techno)
if [ $# -ge 2 ]; then
techFile="$2"
shift
else
echo "a2LEF.sh:error: Missing <tech_file> argument."
print_usage; exit 1
fi;;
--library)
if [ $# -ge 2 ]; then
lLibDir="$lLibDir $2"
shift
else
echo "a2LEF.sh:error: Missing <libDir> argument."
print_usage; exit 1
fi
if [ ! -z "$cellName" ]; then
echo -n "a2LEF.sh:error: --library and --cell options are"
echo " mutually exclusive."
print_usage; exit 1
fi;;
--lef)
if [ $# -ge 2 ]; then
lefFile="$2"
shift
else
echo "a2LEF.sh:error: Missing <lef_file> argument."
print_usage; exit 1
fi;;
--cell)
if [ $# -ge 2 ]; then
cellName="$2"
shift
else
echo "a2LEF.sh:error: Missing <cell_name> argument."
print_usage; exit 1
fi
if [ ! -z "$lLibDir" ]; then
echo -n "a2LEF.sh:error: --library and --cell options are"
echo " mutually exclusive."
print_usage; exit 1
fi;;
--*) echo "a2LEF.sh:error: Invalid argument \`$1'."
print_usage; exit 1;;
-*) lSwitch="$1"; NB=2; CH=`echo $lSwitch | cut -c$NB`
while [ "$CH" != "" ]; do
case $CH in
h) print_usage; exit 0;;
v) VL=1;;
V) VL=2;;
o) sx2lef_args="$sx2lef_args -o";;
p) sx2lef_args="$sx2lef_args -p";;
t) if [ $# -ge 2 ]; then
techFile="$2"
shift
else
echo "a2LEF.sh:error: Missing <tech_file> argument."
print_usage; exit 1
fi;;
l) if [ $# -ge 2 ]; then
lLibDir="$lLibDir $2"
shift
else
echo "a2LEF.sh:error: Missing <libDir> argument."
print_usage; exit 1
fi
if [ ! -z "$cellName" ]; then
echo -n "a2LEF.sh:error: --library and --cell options are"
echo " mutually exclusive."
print_usage; exit 1
fi;;
L)
if [ $# -ge 2 ]; then
lefFile="$2"
shift
else
echo "a2LEF.sh:error: Missing <lef_file> argument."
print_usage; exit 1
fi;;
c)
if [ $# -ge 2 ]; then
cellName="$2"
shift
else
echo "a2LEF.sh:error: Missing <cell_name> argument."
print_usage; exit 1
fi
if [ ! -z "$lLibDir" ]; then
echo -n "a2LEF.sh:error: --library and --cell options are"
echo " mutually exclusive."
print_usage; exit 1
fi;;
*) echo "a2LEF:error: Invalid option \`$CH'."
print_usage; exit 1;;
esac
NB=`expr $NB + 1`
CH=`echo $lSwitch | cut -c$NB`
done;;
*) echo "a2LEF:error: Invalid option \`$1'."
print_usage; exit 1;;
esac
shift
done
title
MBK_IN_PH=ap ; export MBK_IN_PH
MBK_IN_LO=vst ; export MBK_IN_LO
MBK_OUT_PH=ap ; export MBK_OUT_PH
MBK_OUT_LO=vst; export MBK_OUT_LO
if [ "$techFile" != "" ]; then
if [ ! -f $techFile ]; then
echo "a2LEF:error: Technological file \"$techFile\" doesn't exist."
exit 1
fi
setTechno $techFile $lefFile
fi
if [ -z "$cellName" ]; then
if [ "$lLibDir" = "" ]; then
echo "a2LEF:error: Missing mandatory argument <--library <lib_dir> >."
print_usage; exit 1
fi
if [ "$lefFile" = "" ]; then
echo "a2LEF:error: Missing mandatory argument <--lef <lef_file> >."
print_usage; exit 1
fi
# ------------------------------------------------------------------
# Library Generation.
rm -f $lefFile > /dev/null 2>&1
for libDir in $lLibDir; do
buildLib $libDir $lefFile
done
closeLib $lefFile
else
if [ ! -f ${cellName}.ap ]; then
echo "a2LEF:error: Can't find layout file \"${cellName}.ap\"."
print_usage; exit 1
fi
if [ ! -f ${cellName}.vbe -a ! -f ${cellName}.vst ]; then
echo "a2LEF:error: Can't find netlist/behavioral file :"
echo " \"${cellName}.vst or \"${cellName}.vbe\"."
print_usage; exit 1
fi
log="$cellName.log"
rm -f $log
vecho 2 -n " - \"$cellName\"... "
sxlib2lef -V $sx2lef_args $cellName >> $log 2>&1; RV=$?
if [ $RV -ne 0 ]; then
vecho 2 "KO."
else
vecho 2 "OK."
fi
closeLib ${cellName}.lef
fi
# --------------------------------------------------------------------
# That's all Folks.
vecho 2 ""
vecho 2 ""
exit 0

View File

@ -0,0 +1,73 @@
/*
* $Id: debug.c,v 1.1 2002/04/25 16:16:19 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./debug.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
/*
* /--------------------------------------------------------------------\
* | Functions Definitions |
* \--------------------------------------------------------------------/
*/
/* ----------------------------------------------------------------------
* Function : "main()".
*/
extern int main(argc, argv)
int argc;
char *argv[];
{
struct lInter_s *pInter;
pInter = NULL;
/* Add the "B" segments. */
pInter = addinter (pInter, 1, 3);
pInter = addinter (pInter, 5, 7);
pInter = addinter (pInter, 9, 11);
pInter = addinter (pInter, 13, 15);
pInter = addinter (pInter, 17, 19);
# if 0
# endif
/* See if the B segments are OK. */
printinter (pInter);
/* Add the "A" interval. */
pInter = addinter (pInter, 4, 16);
# if 0
pInter = addinter (pInter, 6, 14);
pInter = addinter (pInter, 2, 6);
# endif
/* See if the "A" segments has been correctly merged. */
printinter (pInter);
/* Free all intervals. */
freeinter (pInter);
exit(0);
}

View File

@ -0,0 +1,28 @@
/*
* $Id: debugoff.h,v 1.1 2002/04/25 16:16:19 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | D p G e n |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./debugoff.h" |
* | ************************************************************** |
* | Compile without debug specific code. |
* | |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifdef __DBG__
# undef __DBG__
# endif
# ifdef __DBG
# undef __DBG
# endif
# define __DBG(code)

View File

@ -0,0 +1,28 @@
/*
* $Id: debugon.h,v 1.1 2002/04/25 16:16:19 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | D p G e n |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./debugon.h" |
* | ************************************************************** |
* | Compile with debug specific code. |
* | |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifndef __DBG__
# define __DBG__
# endif
# ifdef __DBG
# undef __DBG
# endif
# define __DBG(code) code

466
alliance/src/sea/src/sea.sh Normal file
View File

@ -0,0 +1,466 @@
#!/bin/sh
#
# $Id: sea.sh,v 1.1 2002/04/25 16:16:20 jpc Exp $
#
# /------------------------------------------------------------------\
# | |
# | A l l i a n c e C A D S y s t e m |
# | S i l i c o n E n s e m b l e / A l l i a n c e |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : alliance-support@asim.lip6.fr |
# | ================================================================ |
# | Script : "./sea.sh" |
# | **************************************************************** |
# | U p d a t e s |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Constants definitions.
VL=0
script_SE_init="./se_script_init.mac"
script_SE_load="./se_script_load.mac"
# /------------------------------------------------------------------\
# | |
# | Functions Definitions |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Function : "vecho()".
vecho()
{
if [ $1 -le $VL ]; then
if [ "$2" = "-n" ]; then
printf "$3"
else
echo "$2"
fi
fi
}
# --------------------------------------------------------------------
# Function : "title()".
title()
{
if [ $VL -ge 1 ]; then
echo ""
alcbanner "Sissi" "1.00" "Alliance Silicon Ensemble Front End" "2000"
echo ""
fi
}
# --------------------------------------------------------------------
# Function : `print_usage()'.
print_usage()
{
echo ""
echo ""
echo "Usage: sea.sh [--verbose] [--very-verbose] [--help] \\"
echo " [--keep-se] [--keep-tmp] [--no-deflib] \\"
echo " [--memory <SIZE>] [--ansi] [--batch] \\"
echo " [lef_def_file [lef_def_file]] \\"
echo " sea.sh [-vVhkKNb] [-m <SIZE>] \\"
echo ""
echo "Options:"
echo " o [--help|-h] : print this help."
echo " o [--verbose|-v] : be verbose."
echo " o [--very-verbose|-V] : be very verbose :-)."
echo " o [--batch|-b] : batch mode."
echo " o [--memory|-m <SIZE>] : uses <SIZE> Mo for memory. Legal"
echo " memory sizes are 12, 24, 36, 48, 60, 72, 84, 96, 108, 120,"
echo " 150, 200, 250, 300, 400, 500, 800, 1200, 1600, 1900."
echo " o [--ansi] :"
echo " run in text mode only (do not start the graphic interface)."
echo " o [--keep-se|-K] : keep SE temporary files."
echo " o [--keep-tmp|-k] : keep SEA temporary files."
echo " o [--no-deflib|-N] :"
echo " Do not load defaults technology, libraries and settings"
echo " (i.e. sxlib & cmos_12)."
echo " o [lef_def_file] :"
echo " LEF or DEF file to load. The files should be given with"
echo " their extention (.lef or .def)."
echo ""
echo ""
}
# --------------------------------------------------------------------
# Function : `set_SE_env()'.
set_SE_env()
{
OPUS_DIR=/users/soft6/opus/DSM_SE5.2; export OPUS_DIR
PATH=${PATH}:${OPUS_DIR}/tools/bin
PATH=${PATH}:${OPUS_DIR}/tools.sun4v/bin
PATH=${PATH}:${OPUS_DIR}/tools.sun4v/dfII/bin
PATH=${PATH}:${OPUS_DIR}/tools.sun4v/dsm/bin
PATH=${PATH}:${OPUS_DIR}/frame/bin
PATH=${PATH}:${OPUS_DIR}/bin
export PATH; hash -r
}
# --------------------------------------------------------------------
# Function : `load_LEF_TECHNO_NAME()'.
load_LEF_TECHNO_NAME()
{
if [ "$LEF_TECHNO_NAME" != "" ]; then
vecho 2 " o Loading LEF_TECHNO_NAME."
else
vecho 2 " o Loading default LEF_TECHNO_NAME."
LEF_TECHNO_NAME=$ALLIANCE_TOP/etc/cmos_12.lef
fi
vecho 2 " - $LEF_TECHNO_NAME"
vecho 2 ""
add_script_SE_load lef $LEF_TECHNO_NAME \
$script_SE_init > /dev/null 2>&1
}
# --------------------------------------------------------------------
# Function : `norm_CATA_DIR()'.
norm_CATA_DIR()
{
aDir="$1"
echo `echo $aDir | sed 's,//,/,g
s,/$,,'`
}
# --------------------------------------------------------------------
# Function : `load_MBK_CATA_LIB()'.
load_MBK_CATA_LIB()
{
vecho 1 " o Loading MBK_CATA_LIB."
NDIR=1
CATA_dir=`echo ${MBK_CATA_LIB}:END | cut -d ':' -f $NDIR`
while [ "$CATA_dir" != "END" ]; do
CATA_dir=`norm_CATA_DIR $CATA_dir`
if [ "$CATA_dir" != "." ]; then
CATA_name=`echo $CATA_dir | sed 's,.*/,,'`.lef
vecho 2 " - $CATA_dir/${CATA_name}"
if [ ! -f "$CATA_dir/${CATA_name}" ]; then
echo "sea:warning: LEF file not found \"$CATA_dir/${CATA_name}\"."
else
add_script_SE_load lef "$CATA_dir/${CATA_name}" \
$script_SE_init > /dev/null 2>&1
fi
fi
NDIR=`expr $NDIR + 1`
CATA_dir=`echo ${MBK_CATA_LIB}:END | cut -d ':' -f $NDIR`
done
vecho 2 ""
}
# --------------------------------------------------------------------
# Function : `rm_SE_db()'.
rm_SE_db()
{
rm -f LBRARY.* *.dtp *.rpt *.opt.def *.opt.lef '&1'
}
# --------------------------------------------------------------------
# Function : `rm_SEA_tmp()'.
rm_SEA_tmp()
{
rm -f $script_SE_init $script_SE_load
}
# --------------------------------------------------------------------
# Function : `clean_sea()'.
clean_sea()
{
if [ "$TAIL_pid" != "" ]; then kill -KILL $TAIL_pid; fi
if [ "$keepSE" = "n" ]; then rm_SE_db; fi
if [ "$keepTmp" = "n" ]; then rm_SEA_tmp; fi
}
# --------------------------------------------------------------------
# Function : `abort_sea()'.
abort_sea()
{
clean_sea
exit 1
}
# --------------------------------------------------------------------
# Function : `add_script_SE_init()'.
add_script_SE_init()
{
aScript="$1"
aMAC="$2"
if [ ! -f "$aScript" ]; then
echo "sea.sh:error: Script not found: \"$aScript\"."
exit 1
fi
echo " EXEC $aScript ;" >> $aMAC
}
# --------------------------------------------------------------------
# Function : `add_script_SE_load()'.
add_script_SE_load()
{
aType="$1"
aFile="$2"
aMAC="$3"
vecho 2 " - LEF/DEF/mac to load : \"$aFile\"."
if [ ! -f "$aFile" ]; then
echo "sea.sh:error: LEF/DEF/mac not found: \"$aFile\"."
exit 1
fi
case $aType in
"lef") echo " INPUT LEF FILENAME \"$aFile\" ;" >> $aMAC;;
"def") echo " INPUT DEF FILENAME \"$aFile\" ;" >> $aMAC;;
"mac") echo " EXEC \"$aFile\" ;" >> $aMAC;;
*) echo "sea.sh(add_script_SE_load):error:"
echo " Invalid type \"$aType\"."
exit 1;;
esac
}
# /------------------------------------------------------------------\
# | |
# | Main Part of the Shell Script |
# | |
# \------------------------------------------------------------------/
#
# SIGINT : 2 (^C).
# SIGQUIT : 3
# SIGTERM : 15 (sent from a kill).
trap abort_sea 2 3 15
# --------------------------------------------------------------------
# Process the command line.
devel="n"
keepSE="n"
keepTmp="n"
defLib="y"
argMemory=""
argJNL="-j=sea.jnl"
argGD=""
argBatch=""
rm -f $script_SE_init
rm -f $script_SE_load
while [ $# -gt 0 ]; do
case $1 in
--devel) devel="y";;
--help) print_usage; exit 0;;
--verbose) VL=1;;
--very-verbose) VL=2;;
--keep-se) keepSE="y";;
--keep-tmp) keepTmp="y";;
--no-deflib) defLib="n";;
--ansi) argGD="-gd=ansi";;
--batch) argBatch="-b";;
--memory)
if [ $# -ge 2 ]; then
argMemory="-m=$2"
shift
else
echo "sea.sh:error: Missing <SIZE> argument."
print_usage; exit 1
fi;;
--*) echo "sea.sh:error: Invalid option \`$1'."
print_usage; exit 1;;
-*) lSwitch="$1"; NB=2; CH=`echo $lSwitch | cut -c$NB`
while [ "$CH" != "" ]; do
case $CH in
D) devel="y";;
h) print_usage; exit 0;;
v) VL=1;;
V) VL=2;;
K) keepSE="y";;
k) keepTmp="y";;
N) defLib="n";;
a) argGD="-gd=ansi";;
b) argBatch="-b";;
m) if [ $# -ge 2 ]; then
argMemory="-m=$2"
shift
else
echo "sea.sh:error: Missing <SIZE> argument."
print_usage; exit 1
fi;;
*) echo "sea.sh:error: Invalid option \`$CH'."
print_usage; exit 1;;
esac
NB=`expr $NB + 1`
CH=`echo $lSwitch | cut -c$NB`
done;;
*) # Unmatched argument, find if this is a LEF, DEF or mac file.
if echo "$1" | grep '\.lef$' > /dev/null 2>&1; then
add_script_SE_load lef "$1" $script_SE_load
else if echo "$1" | grep '\.def$' > /dev/null 2>&1; then
add_script_SE_load def "$1" $script_SE_load
else if echo "$1" | grep '\.mac$' > /dev/null 2>&1; then
add_script_SE_load mac "$1" $script_SE_load
else
echo "sea.sh:error: Invalid argument: \"$1\"."
print_usage; exit 1
fi; fi; fi
;;
esac
shift
done
title
# --------------------------------------------------------------------
# Consistency checks.
if [ -z "$ALLIANCE_TOP" ]; then
echo "sea.sh:error: \$ALLIANCE_TOP is not set, please set your Alliance"
echo " environment."
exit 1
fi
if [ -z "$ALLIANCE_OS" ]; then
echo "sea.sh:error: \$ALLIANCE_OS is not set, please set your Alliance"
echo " environment."
exit 1
fi
if [ "$ALLIANCE_OS" != "Solaris" ]; then
echo "sea.sh:error: Must be run only under Solaris OS."
echo " (current OS : \"$ALLIANCE_OS\")"
exit 1
fi
if [ "$devel" = "y" ]; then
ALLIANCE_TOP="/users/cao/jpc/alliance/archi/$ALLIANCE_OS"
echo "WARNING:"
echo "WARNING: You are using the developement version."
echo "WARNING: Resetting \$ALLIANCE_TOP to \"$ALLIANCE_TOP\"."
echo "WARNING:"
echo ""
echo ""
fi
# --------------------------------------------------------------------
# Script at work.
rm_SE_db
set_SE_env
if [ "$defLib" = "y" ]; then
vecho 2 " o Loading defaults settings."
vecho 2 ""
add_script_SE_init $ALLIANCE_TOP/etc/se_defaults.mac $script_SE_init
load_LEF_TECHNO_NAME
load_MBK_CATA_LIB
fi
if [ -f "$script_SE_load" ]; then
cat "$script_SE_load" >> "$script_SE_init"
fi
vecho 1 " o Running Silicon Ensemble."
if [ ! -f "$script_SE_init" ]; then
sedsm $argMemory $argJNL $argGD $argBatch &
SE_pid="$!"
if [ $VL -ge 2 ]; then
sleep 2; tail -f sea.jnl &
TAIL_pid="$!"
fi
wait $SE_pid
else
if [ "$argBatch" != "" ]; then
if [ $VL -ge 2 ]; then
echo " o Silicon Ensemble output follow (in 2s)."
(sleep 5; exec tail -f sea.jnl) &
TAIL_pid="$!"
fi
SE_pid=`sedsm $argMemory \
$argJNL \
$argGD \
$argBatch \
"EXEC $script_SE_init ;" 2>&1 > /dev/null |\
sed '1d
s,.*\[\([0-9]*\)\] Forking.*,\1,'`
else
sedsm $argMemory $argJNL $argGD "EXEC $script_SE_init ;"
fi
#echo "$SE_pid" > SE_pid
#echo " o SE has forked."
fi
clean_sea
# --------------------------------------------------------------------
# That's all Folks.
vecho 2 ""
vecho 2 ""
exit 0

463
alliance/src/sea/src/seplace.sh Executable file
View File

@ -0,0 +1,463 @@
#!/bin/sh
#
# $Id: seplace.sh,v 1.1 2002/04/25 16:16:20 jpc Exp $
#
# /------------------------------------------------------------------\
# | |
# | A l l i a n c e C A D S y s t e m |
# | S i l i c o n E n s e m b l e / A l l i a n c e |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : alliance-support@asim.lip6.fr |
# | ================================================================ |
# | Script : "./seplace.sh" |
# | **************************************************************** |
# | U p d a t e s |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Constants definitions.
VL=0
LOG="./seplace.log"
DEF_UNITS=100
# /------------------------------------------------------------------\
# | |
# | Functions Definitions |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Function : "vecho()".
vecho()
{
if [ $1 -le $VL ]; then
if [ "$2" = "-n" ]; then
printf "$3"
else
echo "$2"
fi
fi
}
# --------------------------------------------------------------------
# Function : "title()".
title()
{
#if [ $VL -ge 1 ]; then
# echo ""
alcbanner "SEplace" "1.00" \
"Alliance Silicon Ensemble Placer Front End" "2000"
echo ""
#fi
}
# --------------------------------------------------------------------
# Function : `print_usage()'.
print_usage()
{
echo ""
echo ""
echo "Usage: sea.sh [--verbose|-v] [--very-verbose|-V] [--help|-h] \\"
echo " [--memory=<MEM_SIZE>] \\"
echo " [--ioc] [--4] [--all] [--partial-place=<partial>] \\"
echo " [--rows=<NR>] [--power=<NP>] [--margin=<MARGIN>] \\"
echo " <netlist> <placement>"
echo ""
echo "Options:"
echo " o [--help] : Print this help."
echo " o [--verbose] : Be verbose."
echo " o [--very-verbose] : Be very verbose :-)."
echo " o [--all] : Sets the number of routing layers avalai-"
echo " bles to the router to 6. By default only 3 will be used."
echo " o [--4] : Uses ALU2, ALU3 & ALU4."
echo " o [--memory=<MEM_SIZE>] : Sets the amount of memory used by"
echo " Silicon Ensemble. Avalaible <MEM_SIZE> are : "
echo " 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 150, 200, 250,"
echo " 300, 400, 500, 800, 1200, 1600, 1900."
echo " o [--partial-place=<partial>] :"
echo " The design is already partially placed (there must be a"
echo " physical view describing this partial placement)."
echo " o [--ioc] : Load a terminal placement file."
echo " (named <netlist>.ioc)."
echo " o [--rows=<NR>] : The placement will have <NR> rows."
echo " (by default the layout will have an aspect ratio of 1)"
echo " o [--power=<NP>] : The design will have <NP> vertical power"
echo " stripes (each stripe have a width of 35l)."
echo " o [--margin=<MARGIN>] :"
echo " The amount of free area added, in percentage of the cells"
echo " area. The resulting area will be equal to"
echo " CELL_AREA * (1 + <MARGIN>/100). Default value : 10."
echo " o <netlist> : The netlist name (mandatory)."
echo " o <placement> : The resulting layout name (mandatory)."
echo " By default the same as the netlist name, will erase any"
echo " pre-placement."
echo ""
echo ""
}
# --------------------------------------------------------------------
# Function : `log_exec()'.
log_exec()
{
eval "$1" >> $LOG 2>&1
value="$?"
if [ $value -ne 0 ]; then
echo "seplace.sh: \"$1\"."
echo "seplace.sh:error: command failed."
exit 1
fi
return $value
}
# --------------------------------------------------------------------
# Function : `MBK_env()'.
MBK_env()
{
vecho 1 " o Current Alliance environment:"
vecho 1 " - ALLIANCE_TOP : ${ALLIANCE_TOP-not set}"
vecho 1 " - ALLIANCE_OS : ${ALLIANCE_OS-not set}"
vecho 1 " o Current MBK environment:"
vecho 1 " - MBK_IN_LO : ${MBK_IN_LO-not set}"
vecho 1 " - MBK_OUT_LO : ${MBK_OUT_LO-not set}"
vecho 1 " - MBK_IN_PH : ${MBK_IN_PH-not set}"
vecho 1 " - MBK_OUT_PH : ${MBK_OUT_PH-not set}"
vecho 1 " - MBK_WORK_LIB : ${MBK_WORK_LIB-not set}"
vecho 1 -n " - MBK_CATA_LIB : "
if [ -z "$MBK_CATA_LIB" ]; then
vecho 1 "not set"
else
STRING=`echo ${MBK_CATA_LIB} | \
awk 'BEGIN { FS=":"; } \
{ for( i=1; i<=NF; i++) { \
printf("%s\n", $i); \
if (i < NF) \
printf(" "); \
} \
}' -`
vecho 1 "$STRING"
fi
vecho 1 " - MBK_CATAL_NAME : ${MBK_CATAL_NAME-not set}"
vecho 1 " - MBK_VDD : ${MBK_VDD-not set}"
vecho 1 " - MBK_VSS : ${MBK_VSS-not set}"
vecho 1 " - RDS_TECHNO_NAME : ${RDS_TECHNO_NAME-not set}"
vecho 1 ""
vecho 1 ""
}
# --------------------------------------------------------------------
# Function : `get_number()'.
get_number()
{
number=`echo $1 | cut -d '=' -f 2`
#notDigit=`echo $number | sed 's,[0-9],,'`
#if [ "$notDigit" != "" ]; then echo $noDigit >&2; exit 1; fi
echo $number
}
# --------------------------------------------------------------------
# Function : `get_string()'.
get_string()
{
string=`echo $1 | cut -d '=' -f 2`
echo $string
}
# --------------------------------------------------------------------
# Function : `rm_SEplace_tmp()'.
rm_SEplace_tmp()
{
RM_PREV_RUN="n"
while [ $# -gt 0 ]; do
case $1 in
"--previous-run") RM_PREV_RUN="y";;
esac
shift
done
rm -f ${netlistName}_p.mac
rm -f ${netlistName}.def
rm -f ${netlistName}_p.def
if [ "$RM_PREV_RUN" = "y" ]; then
rm -f ${placementName}_p.$MBK_IN_PH
fi
}
# /------------------------------------------------------------------\
# | |
# | Main Part of the Shell Script |
# | |
# \------------------------------------------------------------------/
#
rm -f $LOG
title
if [ "`uname`" != "SunOS" ]; then
echo "seplace.sh:error: This progam must be run under Solaris."
exit 1
fi
# --------------------------------------------------------------------
# Process the command line.
keepTmp="n"
margin="10"
powerNumber="1"
rowNumber=""
argRows=""
memNumber="150"
netlistName=""
partialName=""
placementName=""
ioc="n"
argVL=""
argLayers="-3"
argsA2DEF="-V -t -c -e"
argsDEF2A="-V -p -S -i -b"
argsSEA="--batch --ansi"
# argsSEA="-V"
if [ $# -eq 0 ]; then
print_usage
exit 0
fi
while [ $# -gt 0 ]; do
case $1 in
--keep-tmp) keepTmp="y";;
--devel) argsSEA="$argsSEA --devel";;
--help) print_usage; exit 0;;
--verbose) VL=1; argVL="-v";;
--very-verbose) VL=2; argVL="-V";;
--ioc) ioc="y";;
--all) argLayers="-6";;
--4) argLayers="-4";;
--partial-place=*) partialName=`get_string $1`;;
--rows=*) rowNumber=`get_number $1`
if [ $? -ne 0 ]; then
echo -n "seplace.sh:error: Bad number `get_number $1`"
echo " in argument \"$1\"."
print_usage
exit 1
fi;;
--margin=*) margin=`get_number $1`
if [ $? -ne 0 ]; then
echo -n "seplace.sh:error: Bad number"
echo " in argument \"$1\"."
print_usage
exit 1
fi;;
--power=*) powerNumber=`get_number $1`
if [ $? -ne 0 ]; then
echo -n "seplace.sh:error: Bad number"
echo " in argument \"$1\"."
print_usage
exit 1
fi;;
--memory=*) memNumber=`get_number $1`
if [ $? -ne 0 ]; then
echo -n "seplace.sh:error: Bad number"
echo " in argument \"$1\"."
print_usage
exit 1
fi;;
--*) echo "seplace.sh:error: Invalid option \`$1'."
print_usage; exit 1;;
-*) lSwitch="$1"; NB=2; CH=`echo $lSwitch | cut -c$NB`
while [ "$CH" != "" ]; do
case $CH in
h) print_usage; exit 0;;
v) VL=1; argVL="-v";;
V) VL=2; argVL="-V";;
k) keepTmp="y";;
*) echo "sea.sh:error: Invalid option \`$CH'."
print_usage; exit 1;;
esac
NB=`expr $NB + 1`
CH=`echo $lSwitch | cut -c$NB`
done;;
*) # Unmatched argument, this is the netlist name.
if [ "$netlistName" = "" ]; then
netlistName=$1
else if [ "$placementName" = "" ]; then
placementName=$1
else
echo "seplace.sh:warning: Ignored extra argument \`$1'."
fi; fi
;;
esac
shift
done
# --------------------------------------------------------------------
# Consistency checks.
if [ "$netlistName" = "" ]; then
echo "seplace.sh:error: Missing <netlist> argument."
print_usage
exit 1
else
if [ ! -f "$netlistName".$MBK_IN_LO ]; then
echo -n "seplace.sh:error: Can't find netlist file"
echo " \"$netlistName.$MBK_IN_LO\"."
print_usage; exit 1
fi
fi
if [ "$placementName" = "" ]; then
echo "seplace.sh:error: Missing <placement> argument."
print_usage
exit 1
fi
if [ "$partialName" != "" -a ! -f "$partialName".$MBK_IN_PH ]; then
echo -n "seplace.sh:error: Can't find pre-placement file"
echo " \"$partialName.$MBK_IN_PH\"."
print_usage; exit 1
fi
if [ "$ioc" = "y" -a ! -f "$netlistName.ioc" ]; then
echo -n "seplace.sh:error: Can't find terminal placement file"
echo " \"$netlistName.ioc\"."
print_usage; exit 1
fi
if [ "$partialName" != "" -a "$rowNumber" != "" ]; then
echo "seplace.sh:warning: As a partial placement is supplied, the row"
echo " number will be ignored."
print_usage; exit 1
fi
# --------------------------------------------------------------------
# Script at work.
MBK_env
rm_SEplace_tmp --previous-run
argsA2DEF="$argsA2DEF $argLayers"
vecho 1 " o Netlist file is := \"$netlistName.$MBK_IN_LO\"."
argsA2DEF="$argsA2DEF --mac-place=${netlistName}_p"
if [ "$partialName" != "" ]; then
vecho 1 " o Partial placement file is := \"$partialName.$MBK_IN_PH\"."
argsA2DEF="$argsA2DEF --place=$partialName"
rowNumber=""
margin="0"
else
vecho 1 " o Automatic floorplan generation."
argsA2DEF="$argsA2DEF -F"
fi
if [ "$rowNumber" != "" ]; then
vecho 2 " - placement will have $rowNumber rows."
argsA2DEF="$argsA2DEF --row-number=$rowNumber"
fi
if [ "$margin" != "0" ]; then
vecho 2 " - Increasing cell area by $margin percent."
argsA2DEF="$argsA2DEF --margin=$margin"
fi
if [ "$powerNumber" != "1" ]; then
vecho 2 " - placement will have $powerNumber power."
argsA2DEF="$argsA2DEF --power=$powerNumber"
fi
if [ "$ioc" = "y" ]; then
vecho 1 " o IO placement file is := \"$netlistName.ioc\"."
argsA2DEF="$argsA2DEF --ioc"
fi
vecho 1 " o Silicon ensemble memory used := $memNumber."
argsSEA="$argsSEA --memory $memNumber"
vecho 2 ""
vecho 2 " o Translating \"$netlistName\" into DEF format."
log_exec "a2def $argsA2DEF $netlistName"
vecho 2 ""
vecho 2 " o Silicon Ensemble."
vecho 2 " - Running SEA/SE..."
sea $argVL $argsSEA $netlistName.def ${netlistName}_p.mac
cat sea.jnl >> $LOG
rm sea.jnl
vecho 2 ""
vecho 2 " o Translating \"$netlistName\" back into Alliance format."
log_exec "def2a $argsDEF2A ${netlistName}_p ${placementName}"
if [ "$keepTmp" = "n" ]; then
rm_SEplace_tmp
fi
exit 0

430
alliance/src/sea/src/seroute.sh Executable file
View File

@ -0,0 +1,430 @@
#!/bin/sh
#
# $Id: seroute.sh,v 1.1 2002/04/25 16:16:20 jpc Exp $
#
# /------------------------------------------------------------------\
# | |
# | A l l i a n c e C A D S y s t e m |
# | S i l i c o n E n s e m b l e / A l l i a n c e |
# | |
# | Author : Jean-Paul CHAPUT |
# | E-mail : alliance-support@asim.lip6.fr |
# | ================================================================ |
# | Script : "./seroute.sh" |
# | **************************************************************** |
# | U p d a t e s |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Constants definitions.
VL=0
LOG="./seroute.log"
DEF_UNITS=100
# /------------------------------------------------------------------\
# | |
# | Functions Definitions |
# | |
# \------------------------------------------------------------------/
#
# --------------------------------------------------------------------
# Function : "vecho()".
vecho()
{
if [ $1 -le $VL ]; then
if [ "$2" = "-n" ]; then
printf "$3"
else
echo "$2"
fi
fi
}
# --------------------------------------------------------------------
# Function : "title()".
title()
{
#if [ $VL -ge 1 ]; then
# echo ""
alcbanner "SEroute" "1.00" \
"Alliance Silicon Ensemble Router Front End" "2000"
echo ""
#fi
}
# --------------------------------------------------------------------
# Function : `print_usage()'.
print_usage()
{
echo ""
echo ""
echo "Usage: seroute [--verbose|-v] [--very-verbose|-V] [--help|-h] \\"
echo " [--memory=<MEM_SIZE>] \\"
echo " [--core] [--ring] [--ioc] [--all] [--4] \\"
echo " [--trust-orient] [--no-power] [--generator] \\"
echo " [--place=<placement>] \\"
echo " <netlist> <layout>"
echo ""
echo "Options:"
echo " o [--help] : Print this help."
echo " o [--verbose] : Be verbose."
echo " o [--very-verbose] : Be very verbose :-)."
echo " o [--memory=<MEM_SIZE>] : Sets the amount of memory used by"
echo " Silicon Ensemble. Avalaible <MEM_SIZE> are : "
echo " 12, 24, 36, 48, 60, 72, 84, 96, 108, 120, 150, 200, 250,"
echo " 300, 400, 500, 800, 1200, 1600, 1900."
echo " o [--ioc] : Load a terminal placement file."
echo " (named <netlist>.ioc)."
echo " o [--all] : Use all 6 layers for routing."
echo " o [--4] : Use only ALU2 to ALU4 for routing."
echo " o [--core] : Route terminals to the edge of the"
echo " abutment-box."
echo " o [--ring] : Produce a layout suitable for ring."
echo " This option implies \"--core\"."
echo " o [--trust-orient] : Trust MBK orientation, i.e. allow cells"
echo " without regular vdd/vss power rails."
echo " o [--no-power] : Do not route power rails, this implies"
echo " that they must be pre-routed by the user."
echo " o [--generator] : Route a user build block like a RAM"
echo " or a ROM. This allow the generator leaf cells not to"
echo " comply strictly to the SxLib requirements. This option is"
echo " equivalent to --no-power --trust-orient."
echo " o [--place=<placement>] : The name of the placement file,"
echo " (if different from the netlist)."
echo " o <netlist> : The netlist name (mandatory)."
echo " o <layout> : The resulting layout name (mandatory)."
echo ""
echo ""
}
# --------------------------------------------------------------------
# Function : `get_number()'.
get_number()
{
number=`echo $1 | cut -d '=' -f 2`
#notDigit=`echo $number | sed 's,[0-9],,'`
#if [ "$notDigit" != "" ]; then echo $noDigit >&2; exit 1; fi
echo $number
}
# --------------------------------------------------------------------
# Function : `log_exec()'.
log_exec()
{
eval "$1" >> $LOG 2>&1
value="$?"
if [ $value -ne 0 ]; then
echo "seroute.sh: \"$1\"."
echo "seroute.sh:error: command failed."
exit 1
fi
return $value
}
# --------------------------------------------------------------------
# Function : `MBK_env()'.
MBK_env()
{
vecho 1 " o Current Alliance environment:"
vecho 1 " - ALLIANCE_TOP : ${ALLIANCE_TOP-not set}"
vecho 1 " - ALLIANCE_OS : ${ALLIANCE_OS-not set}"
vecho 1 " o Current MBK environment:"
vecho 1 " - MBK_IN_LO : ${MBK_IN_LO-not set}"
vecho 1 " - MBK_OUT_LO : ${MBK_OUT_LO-not set}"
vecho 1 " - MBK_IN_PH : ${MBK_IN_PH-not set}"
vecho 1 " - MBK_OUT_PH : ${MBK_OUT_PH-not set}"
vecho 1 " - MBK_WORK_LIB : ${MBK_WORK_LIB-not set}"
vecho 1 -n " - MBK_CATA_LIB : "
if [ -z "$MBK_CATA_LIB" ]; then
vecho 1 "not set"
else
STRING=`echo ${MBK_CATA_LIB} | \
awk 'BEGIN { FS=":"; } \
{ for( i=1; i<=NF; i++) { \
printf("%s\n", $i); \
if (i < NF) \
printf(" "); \
} \
}' -`
vecho 1 "$STRING"
fi
vecho 1 " - MBK_CATAL_NAME : ${MBK_CATAL_NAME-not set}"
vecho 1 " - MBK_VDD : ${MBK_VDD-not set}"
vecho 1 " - MBK_VSS : ${MBK_VSS-not set}"
vecho 1 " - RDS_TECHNO_NAME : ${RDS_TECHNO_NAME-not set}"
vecho 1 ""
vecho 1 ""
}
# --------------------------------------------------------------------
# Function : `rm_SEroute_tmp()'.
rm_SEroute_tmp()
{
RM_PREV_RUN="n"
while [ $# -gt 0 ]; do
case $1 in
"--previous-run") RM_PREV_RUN="y";;
esac
shift
done
rm -f ${netlistName}_r.mac
rm -f ${netlistName}.def
rm -f ${netlistName}_r.def
if [ "$RM_PREV_RUN" = "y" ]; then
rm -f ${layoutName}_r.$MBK_IN_PH
fi
}
# --------------------------------------------------------------------
# Function : `get_string()'.
get_string()
{
string=`echo $1 | cut -d '=' -f 2`
echo $string
}
# /------------------------------------------------------------------\
# | |
# | Main Part of the Shell Script |
# | |
# \------------------------------------------------------------------/
#
rm -f $LOG
title
if [ "`uname`" != "SunOS" ]; then
echo "seplace.sh:error: This progam must be run under Solaris."
exit 1
fi
# --------------------------------------------------------------------
# Process the command line.
keepTmp="n"
memNumber="150"
netlistName=""
placementName=""
layoutName=""
ioc="n"
core="n"
ring="n"
argVL=""
argLayers="-3"
argFillTie=""
argsA2DEF="-V -p"
argsDEF2A="-V -p"
# argsA2DEF="-V -p -E"
# argsDEF2A="-V -p -S"
argsSEA="--batch --ansi"
# argsSEA="-V"
if [ $# -eq 0 ]; then
print_usage
exit 0
fi
while [ $# -gt 0 ]; do
case $1 in
--devel) argsSEA="$argsSEA --devel";;
--help) print_usage; exit 0;;
--verbose) VL=1; argVL="-v";;
--very-verbose) VL=2; argVL="-V";;
--keep-tmp) keepTmp="y";;
--ioc) ioc="y";;
--core) core="y";;
--ring) ring="y"; core="y";;
--all) argLayers="-6";;
--4) argLayers="-4";;
--fill-tie) argFillTie="-t";;
--trust-orient) argsA2DEF="$argsA2DEF -T";;
--no-power) argsA2DEF="$argsA2DEF -n";;
--generator) argsA2DEF="$argsA2DEF -T -n";;
--place=*) placementName=`get_string $1`;;
--memory=*) memNumber=`get_number $1`
if [ $? -ne 0 ]; then
echo -n "seplace.sh:error: Bad number"
echo " in argument \"$1\"."
print_usage
exit 1
fi;;
--*) echo "seroute.sh:error: Invalid option \`$1'."
print_usage; exit 1;;
-*) lSwitch="$1"; NB=2; CH=`echo $lSwitch | cut -c$NB`
while [ "$CH" != "" ]; do
case $CH in
h) print_usage; exit 0;;
k) keepTmp="y";;
v) VL=1; argVL="-v";;
V) VL=2; argVL="-V";;
*) echo "sea.sh:error: Invalid option \`$CH'."
print_usage; exit 1;;
esac
NB=`expr $NB + 1`
CH=`echo $lSwitch | cut -c$NB`
done;;
*) # Unmatched argument, this is the netlist name.
if [ "$netlistName" = "" ]; then
netlistName=$1
else if [ "$layoutName" = "" ]; then
layoutName=$1
else
echo "seroute.sh:warning: Ignored extra argument \`$1'."
fi; fi
;;
esac
shift
done
# --------------------------------------------------------------------
# Consistency checks.
if [ "$netlistName" = "" ]; then
echo "seplace.sh:error: Missing <netlist> argument."
print_usage
exit 1
else
if [ ! -f "$netlistName.$MBK_IN_LO" ]; then
echo -n "seroute.sh:error: Can't find netlist file"
echo " \"$netlistName.$MBK_IN_LO\"."
print_usage; exit 1
fi
fi
if [ "$placementName" = "" ]; then placementName=$netlistName; fi
if [ ! -f "$placementName".$MBK_IN_PH ]; then
echo -n "seroute.sh:error: Can't find placement file"
echo " \"$placementName.$MBK_IN_PH\"."
print_usage; exit 1
fi
argsA2DEF="$argsA2DEF --place=$placementName"
if [ "$layoutName" = "" ]; then
echo "seplace.sh:error: Missing <layout> argument."
print_usage
exit 1
fi
if [ "$ioc" = "y" -a ! -f "$netlistName.ioc" ]; then
echo -n "seroute.sh:error: Can't find terminal placement file"
echo " \"$netlistName.ioc\"."
print_usage; exit 1
fi
# --------------------------------------------------------------------
# Script at work.
MBK_env
rm_SEroute_tmp --previous-run
argsA2DEF="$argsA2DEF $argLayers $argFillTie"
vecho 1 " o Netlist file is := \"$netlistName.$MBK_IN_LO\"."
argsA2DEF="$argsA2DEF --mac-route=${netlistName}_r"
if [ "$ioc" = "y" ]; then
vecho 1 " o IO placement file is := \"$netlistName.ioc\"."
argsA2DEF="$argsA2DEF --ioc"
fi
if [ "$core" = "y" ]; then
vecho 1 " o The design will have pins."
argsA2DEF="$argsA2DEF -c"
fi
if [ "$ring" = "y" ]; then
vecho 1 " o Merge power terminals for ring."
argsDEF2A="$argsDEF2A -r"
fi
vecho 1 " o Silicon ensemble memory used := $memNumber."
argsSEA="$argsSEA --memory $memNumber"
vecho 2 ""
vecho 2 " o Translating \"$netlistName\" into DEF format."
log_exec "a2def $argsA2DEF $netlistName"
vecho 2 ""
vecho 2 " o Silicon Ensemble."
vecho 2 " - Running SEA/SE..."
sea $argVL $argsSEA $netlistName.def ${netlistName}_r.mac
cat sea.jnl >> $LOG
rm sea.jnl
vecho 2 ""
vecho 2 " o Translating \"$netlistName\" back into Alliance format."
log_exec "def2a $argsDEF2A ${netlistName}_r ${layoutName}"
if [ "$keepTmp" = "n" ]; then
rm_SEroute_tmp
fi
exit 0

View File

@ -0,0 +1,114 @@
/*
* $Id: sxlib2LEF.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./LEF_drive_sxlib.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "LEF_drive_sxlib.h"
/* ----------------------------------------------------------------------
* Internal functions declarations.
*/
static void printHelp __FP((void));
/*
* /--------------------------------------------------------------------\
* | Functions Definitions |
* \--------------------------------------------------------------------/
*/
/* ----------------------------------------------------------------------
* Function : "printHelp()".
*/
static void printHelp()
{
printf(" o Usage := \"sxlib2lef [options] <source>\"\n\n");
printf(" o Options :\n");
printf(" -v := Be verbose.\n");
printf(" -V := Be very verbose.\n");
printf(" -h := Print this message.\n");
printf(" -o := Allow offgrid terminals.\n");
printf(" -p := Do not generate power PORT geometries.\n");
printf("\n" );
}
/* ----------------------------------------------------------------------
* Function : "main()".
*/
extern int main(argc, argv)
int argc;
char *argv[];
{
struct lofig *pLofig;
struct phfig *pPhfig;
long VL, sxFlags;
int argC, i;
/* Read MBK environment. */
mbkenv();
/* Initialise the "Ut" module. */
util_init(C_VerboseLevel2, F_DUMPCORE, "sx2LEF");
argC = argc;
/* Default options. */
VL = C_VerboseLevel0;
sxFlags = FALSE;
/* Read the options. */
for(i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-h")) { printHelp(); exit(0); }
if (!strcmp(argv[i], "-v")) { VL = C_VerboseLevel1; continue; }
if (!strcmp(argv[i], "-V")) { VL = C_VerboseLevel2; continue; }
if (!strcmp(argv[i], "-o")) { sxFlags |= F_ALLOW_OFFGRID; continue; }
if (!strcmp(argv[i], "-p")) { sxFlags |= F_NO_POWER_GEOM; continue; }
break;
}
if ((argC - i) != 1) { printHelp(); exit(1); }
setVL(VL);
if (VL > C_VerboseLevel0)
alliancebanner(
"sx2LEF", "V.RR", "SxLib to LEF MACRO converter",
"2000", ALLIANCE_VERSION );
printMBKEnv();
mprintf1 (" o Processing cell \"%s\".\n", argv[i]);
pPhfig = getphfig(argv[i], 'A');
pLofig = getlofig(argv[i], 'P');
lefsavesxlophfig (pLofig, pPhfig, sxFlags);
exit(0);
}

View File

@ -0,0 +1,544 @@
/*
* $Id: util_Defs.h,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Header : "./util_Defs.h" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# ifndef __util_Defs__
# define __util_Defs__
# include <unistd.h>
# include <stdlib.h>
# include <stdio.h>
# include <signal.h>
# include <ctype.h>
# include <string.h>
# include <strings.h>
# include <malloc.h>
# include <math.h>
/* ----------------------------------------------------------------------
* Looks if functions prototypes are availables.
*/
# ifndef __FP
# ifdef __STDC__
/* Compiler is ANSI C compliant. */
# include <unistd.h>
# include <stdarg.h>
# define __FP( arguments ) arguments
# define __FPV( arguments ) arguments
# define __KR_C( code )
# define __ANSI_C( code ) code
# else
/* Compiler is K&R C. */
# include <unistd.h>
# include <varargs.h>
# define __FP( arguments ) ()
# define __FPV( arguments ) (va_alist) va_dcl
# define __KR_C( code ) code
# define __ANSI_C( code )
# endif
# endif
/* ----------------------------------------------------------------------
* Missing GNU functions prototypes under GCC/SunOS 4.1.4.
*/
# include "GNU_Defs.h"
/* ----------------------------------------------------------------------
* Miscellaneous.
*/
# define TRUE 1
# define FALSE 0
# define m_Max(a,b) (((a) > (b)) ? (a) : (b))
# define m_Min(a,b) (((a) > (b)) ? (b) : (a))
# define ABS(a) (((a) > 0 ) ? (a) : -(a))
/* Usual types shortcut. */
/* ----------------------------------------------------------------------
* Alliance Includes.
*/
# include <mut.h>
# include <mlo.h>
# include <mph.h>
# include <mut.h>
# include <mlu.h>
# include <aut.h>
/* ----------------------------------------------------------------------
* Module : "util_Sys.c"
*/
# define F_DUMPCORE 0
# define F_NOCORE 1
# define C_SIGTFLT ((int)1)
# define C_SIGERR ((int)2)
# define C_VerboseLevel0 (0L)
# define C_VerboseLevel1 (1L)
# define C_VerboseLevel2 (2L)
# define SIZE_S64 2048
/* External variables from the various modules. */
extern long util_VL;
extern long util_flags;
extern char util_binName[1024];
/* Interruptions handling functions. */
extern void trapInit __FP((void));
extern void sendGSignal __FP((int aSig));
extern void setBinName __FP((char *asName));
/* Errors printing functions. */
extern void stdflush __FP((void));
extern void errMBK __FP((char *asName));
extern void eprinth __FP((char *asName));
extern int eprintf __FPV((char *aFormat, ...));
extern int eprints __FP((char *aS));
/* Warnings printing functions. */
extern void warnMBK __FP((char *asName));
extern void wprinth __FP((char *asName));
extern int wprintf __FPV((char *aFormat, ...));
extern int wprints __FP((char *aS));
/* Messages printing functions. */
extern void setVL __FP((long aVL));
extern long getVL __FP((void));
extern int vmprintf __FP((long aVL, char *aFormat, va_list aArgList));
extern int mprintf __FPV((long aVL, char *aFormat, ...));
extern int mprints __FP((long aVL, char *aS));
extern int mprintf0 __FPV((char *aFormat, ...));
extern int mprintf1 __FPV((char *aFormat, ...));
extern int mprintf2 __FPV((char *aFormat, ...));
/* "util_init" global initialisation function. */
extern void util_init __FP((long aVL, long aFlags, char *asName));
/* Persistent strings printing function (up to 64 strings). */
extern char *s64printf __FPV((char *aFormat, ...));
/* Miscellaneous. */
extern char *strtoup __FP((char *aS));
/* ----------------------------------------------------------------------
* Module : "util_Inter.c"
*/
/* Interval list element. */
typedef struct eInter_s {
long min;
long max;
struct eInter_s *next;
} eInter_t;
/* Interval list head. */
typedef struct lInter_s {
long min;
long max;
long len;
struct eInter_s *l;
} lInter_t;
extern void printinter __FP((struct lInter_s *apInter));
extern struct lInter_s *addinter __FP((struct lInter_s *apInter,
long aMin,
long aMax));
extern void freeinter __FP((struct lInter_s *apInter));
/* ----------------------------------------------------------------------
* Module : "util_MBK.c"
*/
# define F_EQUAL (1L)
# define F_CALU (2L)
# define F_TALU (4L)
# define F_EQUAL_M (F_EQUAL)
# define F_EQUAL_C (F_EQUAL | F_CALU)
# define F_EQUAL_T (F_EQUAL | F_TALU)
# define PTYPE_LOSEG 512
# define PTYPE_TLOSEG 513
# define PTYPE_ULOCON 514
# define LOSEG_VIA 1
# define LOSEG_SEG 2
# define LOSEG_CON 3
# define LOSEG_SEGCON 4
# define F_HAS_SUBNET (1L<<0)
# define F_NET_ROUTED (1L<<1)
# define F_SUBNET_ROUTED (1L<<2)
# define MBKSCALE(l) ((l) * SCALE_X)
# define MBKUNSCALE(l) ((l) / SCALE_X)
# define NEWSIGINDEX (++MBK_sigIndex)
/* Model of physical VIA. */
typedef struct eMVIA_s {
char type;
long width;
long height;
struct eMVIA_s *next;
} eMVIA_t;
/* Added to each segment (USER pointer). */
typedef struct eLoseg_s {
long type;
void *MBKobj;
struct eLoseg_s *next;
} eLoseg_t;
/* Added to the phfig (USER pointer). */
typedef struct tLoseg_s {
long sigNB; /* Number of signals. */
long tSize; /* Real table size. */
struct authtable *tHT; /* Sig name --> tLoseg index. */
long *tAccess; /* Number of signal accesses. */
long *tFlags; /* Some flags... */
struct eLoseg_s **tLoseg; /* Head of signal seg list. */
struct eMVIA_s *tMVIA; /* list of model VIAS. */
} tLoseg_t;
extern long MBK_sigIndex;
extern long isobs __FP((struct phseg *apSeg));
extern long getsigaliasnumber __FP((struct losig *apLosig));
extern long signamecmp __FP((char *aLoname, char *aPhname));
extern char **makesegnamelist __FP((char *aName));
extern void printMBKEnv __FP((void));
extern char getAltVIALayer __FP((char aVIA, char aLayer));
extern char getTopVIALayer __FP((char aVIA));
extern char getBottomVIALayer __FP((char aVIA));
extern char getTurnVIA __FP((char aLayer));
extern long isVIALayer __FP((char aVIA, char aLayer));
extern long getUpVIALayer __FP((char aVIA, char aLayer));
extern char getUpLayer __FP((char aLayer));
extern long cmpALU __FP((char aLayer1, char aLayer2));
extern char getALU __FP((char aLayer));
extern char getCALU __FP((char aLayer));
extern long isCALU __FP((char aLayer));
extern char getTALU __FP((char aLayer));
extern long getLayerTrackWidth __FP((char aLayer));
extern void xyflatseg __FP((struct phseg *apFlatSeg,
struct phseg *apSeg,
long aXINS, long aYINS,
long aXAB1, long aYAB1,
long aXAB2, long aYAB2,
char aTransf));
extern void xyflatvia __FP((struct phvia *apFlatVIA,
struct phvia *apVIA,
long aXINS, long aYINS,
long aXAB1, long aYAB1,
long aXAB2, long aYAB2,
char aTransf));
/* Utilities for pad power splitting. */
extern long isPad __FP((char *asCell));
extern long initSigIndex __FP((struct losig *apLoSig));
extern long cmpSigName __FP((struct losig *apLoSig, char *asName));
extern struct locon *addInsLoCon __FP((struct loins *apIns,
char *asName,
struct losig *apSig,
char aDir));
extern void splitPowerNet __FP((struct lofig *apLoFig,
char *asPower));
extern struct phins *findphins __FP((struct phfig *apPhfig,
char *insName));
extern struct phins *findphmodel __FP((struct phfig *apPhfig,
char *modelName));
extern struct locon *findlocon __FP((struct lofig *apLofig,
char *conName));
extern loins_list *addloins_noSig __FP((lofig_list *apFig,
char *asIns,
lofig_list *apModel));
extern locon_list *addlosig_insCon __FP((loins_list *apIns,
char *asCon,
losig_list *apSig));
extern void checkLofig __FP((struct lofig *apLofig));
extern void addfeed __FP((struct lofig *apLofig,
struct phfig *apPhfig));
extern void delfeed __FP((struct lofig *apLofig));
extern void copyUpCALU __FP((struct lofig *apLofig,
struct phfig *apPhfig,
long aExit));
extern struct eMVIA_s *addmvia __FP((struct eMVIA_s *apHead,
struct phvia *apVIA));
extern struct eMVIA_s *getmvia __FP((struct eMVIA_s *apHead,
struct phvia *apVIA));
extern struct eLoseg_s *addloseg __FP((struct eLoseg_s *apHead,
long aType,
void *apSegvia));
extern struct eLoseg_s *delloseg __FP((struct eLoseg_s *apLoseg));
extern struct tLoseg_s *gettloseg __FP((struct phfig *apPhfig));
extern struct tLoseg_s *addtloseg __FP((struct phfig *apPhfig));
extern struct authelem *gettlosegitem __FP((struct tLoseg_s *apTLoseg,
char *asKey));
extern void freeloseg __FP((struct phfig *apPhfig));
extern void phsegchain __FP((struct lofig *apLofig,
struct phfig *apPhfig));
extern struct eLoseg_s *getloseglist __FP((struct phfig *apPhfig,
char *aName));
extern void checklosegaccess __FP((struct phfig *apPhfig));
extern void shiftphfig __FP((struct phfig *apPhfig,
long DX,
long DY));
/* ----------------------------------------------------------------------
* Module : "util_Power.c"
*/
# define F_POWER_COMPLETE 0x00000001
# define C_POWER_ISNONE ((char)0)
# define C_POWER_ISVDD ((char)1)
# define C_POWER_ISVSS ((char)2)
# define C_POWER_VERTICAL ((char)1)
# define C_POWER_HORIZONTAL ((char)2)
# define F_POWER_MERGE 0x00000001
typedef struct ePow_s {
long flags;
long y;
long w;
long xMin;
long xMax;
long min;
long max;
char *Name;
char Type;
struct lInter_s *inter;
struct ePow_s *Next;
} ePow_t;
extern struct ePow_s *addPow __FP((struct ePow_s **applPow,
long aY,
long aW,
char *aName,
char aType,
char aDir));
extern void freePow __FP((struct ePow_s *aplPow));
extern struct ePow_s *getPow __FP((struct ePow_s *aplPow, long aY));
extern void mergeXPow __FP((struct ePow_s *apPow,
long axMin,
long axMax,
long aW));
extern struct ePow_s *buildPow __FP((struct phfig *apPhfig,
char aLayer,
char aDir,
char *asSuffix));
extern void powToCon __FP(( struct phfig *apPhfig,
char aLayer,
char aDir,
struct ePow_s *aplPow,
long aFlags));
/* ----------------------------------------------------------------------
* Module : "util_RTU.c"
*/
extern void rtu __FP((struct phfig *aPhfig));
/* ----------------------------------------------------------------------
* Module : "util_Floorplan.c"
*/
# define F_FLOOR_LAYERS_3 0x00000010 /* 16. */
# define F_FLOOR_LAYERS_4 0x00000020 /* 16. */
# define F_FLOOR_LAYERS_6 0x00000040 /* 32. */
# define F_FLOOR_MARGIN 0x00000080 /* 64. */
# define F_FLOOR_ROW_NUMBER 0x00000100 /* 128. */
# define F_FLOOR_X_SIZE 0x00000200 /* 256. */
# define F_FLOOR_Y_SIZE 0x00000400 /* 512. */
# define F_FLOOR_ASPECT_RATIO 0x00000800 /* 1024. */
# define FLOOR_XY_EXPAND MBKSCALE(50)
extern void placeTerms __FP((struct lofig *apLofig,
struct phfig *apPhfig));
extern struct phfig *makeFloorplan __FP((struct lofig *apLofig,
long aMargin,
long aXSize,
long aYSize,
double aAspectRatio,
long aPower,
long aFlags));
extern void expandFloorplan __FP((struct phfig *apPhfig));
extern void shrinkFloorplan __FP((struct phfig *apPhfig));
extern void protectPowmid __FP((struct phfig *apPhfig));
/* ----------------------------------------------------------------------
* Module : "util_LEFDEF.c"
*/
# include "DEF_actions.h"
/* LEF/DEF terminal direction. */
# define C_DIRECTION_NONE ((char)0)
# define C_DIRECTION_INPUT ((char)1)
# define C_DIRECTION_OUTPUT ((char)2)
# define C_DIRECTION_TRISTATE ((char)3)
# define C_DIRECTION_INOUT ((char)4)
# define C_DIRECTION_FEEDTHRU ((char)5)
# define X_GRID 5
# define Y_SLICE 50
# define WIDTH_VDD 6
# define WIDTH_VSS 6
# define VIA_SIDE 2
# define ALU1_SPACING 3
# define MBK_X_GRID (X_GRID * SCALE_X)
# define MBK_Y_SLICE (Y_SLICE * SCALE_X)
# define MBK_WIDTH_VDD (WIDTH_VDD * SCALE_X)
# define MBK_WIDTH_VSS (WIDTH_VSS * SCALE_X)
# define MBK_VIA_SIDE (MBKSCALE (VIA_SIDE))
# define MBK_ALU1_SPACING (MBKSCALE (ALU1_SPACING))
# define DEF_X_GRID (X_GRID * DEF_UNITS_MICRONS)
# define DEF_Y_SLICE (Y_SLICE * DEF_UNITS_MICRONS)
extern long DEF_UNITS_MICRONS;
extern long DEF2MBK_length __FP((long aL));
extern char *DEF2MBK_name __FP((char *aS));
extern char DEF2MBK_transf __FP((double aO));
extern char DEF2MBK_direction __FP((double aDEFdir));
extern struct phref *DEF2MBK_row __FP((struct phfig *apPhfig,
char *aRowName,
char *aRowType,
long aOrient,
long aDoNumber,
long aByNumber,
long aStepX,
long aStepY,
long aX,
long aY));
extern struct phref *DEF2MBK_track __FP((struct phfig *apPhfig,
char *aAxisName,
long aStart,
long aDoNumber,
long aStep,
char *asLayers,
long aX,
long aY));
extern struct phref *DEF2MBK_blockage __FP((struct phfig *apPhfig,
long aXB1,
long aYB1,
long aWidth,
long aHeight));
extern long MBK2DEF_length __FP((long aL));
extern char *MBK2DEF_name __FP((char *asLEF, char *asMBK));
extern char MBK2DEF_direction __FP((char acDir));
extern char MBK2DEF_transf __FP((char aO));
extern void MBK2DEF_row __FP((struct phref *apPhref,
char **appRowName,
char **appRowType,
long *apOrient,
long *apDoNumber,
long *apByNumber,
long *apStepX,
long *apStepY,
long *apX,
long *apY));
extern void MBK2DEF_track __FP((struct phref *apPhref,
char *apAxisName,
long *apStart,
long *apDoNumber,
long *apStep,
char **apsLayers,
long *apX,
long *apY));
extern void MBK2DEF_blockage __FP((struct phref *apPhref,
long *apXB1,
long *apYB1,
long *apWidth,
long *apHeight));
extern char MBK2DEF_locondir __FP((struct locon *apLocon));
extern char *DEF_orient2a __FP((long aT));
extern long DEF_a2orient __FP((char *aT));
extern char *DEF_side2a __FP((char aSide));
extern char *DEF_layer2a __FP((char aLayer));
extern char *DEF_via2a __FP((char aType,
long aDX,
long aDY,
char *aViaName));
extern char BEH2DEF_direction __FP((char acDir));
# endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,296 @@
/*
* $Id: util_Inter.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./util_Inter.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "debugoff.h"
/* ------------------------------------------------------------------
* Local constants.
*/
# define SHIFT_MAX 8
# define F_MIN_IN 0x00000001
# define F_MIN_LOWER 0x00000002
# define F_MIN_GREATER 0x00000004
# define F_MAX_IN ((F_MIN_IN) << SHIFT_MAX)
# define F_MAX_LOWER ((F_MIN_LOWER) << SHIFT_MAX)
# define F_MAX_GREATER ((F_MIN_GREATER) << SHIFT_MAX)
# define C_INTER_LOWER (F_MIN_LOWER | F_MAX_LOWER )
# define C_INTER_CROSS_MIN (F_MIN_LOWER | F_MAX_IN )
# define C_INTER_IN (F_MIN_IN | F_MAX_IN )
# define C_INTER_CROSS_MAX (F_MIN_IN | F_MAX_GREATER)
# define C_INTER_GREATER (F_MIN_GREATER | F_MAX_GREATER)
# define C_INTER_OUT (F_MIN_LOWER | F_MAX_GREATER)
# define INBOUNDS_INTER(i,v) (inbounds ((i)->min, (i)->max, (v)))
/* ------------------------------------------------------------------
* Local functions declarations.
*/
static long inbounds __FP((long aMin, long aMax, long aValue));
static struct eInter_s *alloceinter __FP((long aMin, long aMax));
static void freeeinter __FP((struct eInter_s *apInter));
static long cmpeinter __FP((struct eInter_s *apInterA,
struct eInter_s *apInterB));
/*
* /----------------------------------------------------------------\
* | Functions Definitions |
* \----------------------------------------------------------------/
*/
/* ------------------------------------------------------------------
* Function : "inbounds()".
*/
static long inbounds (aMin, aMax, aValue)
long aMin, aMax, aValue;
{
if ((aValue >= aMin) && (aValue <= aMax)) return (F_MIN_IN);
if (aValue < aMin) return (F_MIN_LOWER);
return (F_MIN_GREATER);
}
/* ------------------------------------------------------------------
* Function : "alloceinter()".
*/
static struct eInter_s *alloceinter (aMin, aMax)
long aMin, aMax;
{
struct eInter_s *newInter;
if (!(newInter = (struct eInter_s*)mbkalloc(sizeof (struct eInter_s)))) {
eprinth ("util_Inter.c");
eprintf ("Not enough memory to allcate an interval element.\n");
EXIT (1);
}
newInter->min = aMin;
newInter->max = aMax;
newInter->next = NULL;
return (newInter);
}
/* ------------------------------------------------------------------
* Function : "freeeinter()".
*/
static void freeeinter (apInter)
struct eInter_s *apInter;
{
mbkfree ((void*)apInter);
}
/* ------------------------------------------------------------------
* Function : "cmpeinter()".
*/
static long cmpeinter (apInterA, apInterB)
struct eInter_s *apInterA, *apInterB;
{
long state;
state = INBOUNDS_INTER(apInterA, apInterB->min);
state |= INBOUNDS_INTER(apInterA, apInterB->max) << SHIFT_MAX;
return (state);
}
/* ------------------------------------------------------------------
* Function : "allocinter()".
*/
static struct lInter_s *allocinter ()
{
struct lInter_s *newInter;
if (!(newInter = (struct lInter_s*)mbkalloc(sizeof (struct lInter_s)))) {
eprinth ("util_Inter.c");
eprintf ("Not enough memory to allocate an interval object.\n");
EXIT (1);
}
newInter->min = 0;
newInter->max = 0;
newInter->len = 0;
newInter->l = NULL;
return (newInter);
}
/* ------------------------------------------------------------------
* Function : "printinter()".
*/
extern void printinter (apInter)
struct lInter_s *apInter;
{
struct eInter_s *pInter;
fflush (stderr);
fprintf (stdout, " o Interval set : (min = %ld, max = %ld, len = %ld)\n",
apInter->min,
apInter->max,
apInter->len);
fflush (stdout);
for (pInter = apInter->l; pInter != NULL; pInter = pInter->next) {
fprintf (stdout, " [%6ld,%6ld]\n", pInter->min, pInter->max);
fflush (stdout);
}
}
/* ------------------------------------------------------------------
* Function : "addinter()".
*/
extern struct lInter_s *addinter (apInter, aMin, aMax)
struct lInter_s *apInter;
long aMin;
long aMax;
{
struct eInter_s *currInter;
struct eInter_s *newInter;
struct eInter_s mergeInter;
struct eInter_s **ppInter;
/* Case of the first interval. */
if (apInter == NULL) apInter = allocinter ();
/* Update the interval list bounds. */
apInter->max = m_Max(apInter->max, aMax);
apInter->min = m_Min(apInter->min, aMin);
mergeInter.min = aMin;
mergeInter.max = aMax;
newInter = NULL;
ppInter = &(apInter->l);
for (; *ppInter != NULL;) {
switch (cmpeinter (&mergeInter, *ppInter)) {
case C_INTER_LOWER: break;
case C_INTER_OUT: break;
case C_INTER_CROSS_MIN:
(*ppInter)->max = mergeInter.max;
newInter = *ppInter;
break;
case C_INTER_IN:
if (!newInter) {
(*ppInter)->min = mergeInter.min;
(*ppInter)->max = mergeInter.max;
newInter = *ppInter;
} else {
currInter = *ppInter;
*ppInter = (*ppInter)->next;
freeeinter (currInter);
apInter->len -= 1;
continue;
}
break;
case C_INTER_CROSS_MAX:
if (!newInter) {
(*ppInter)->min = mergeInter.min;
newInter = *ppInter;
} else {
newInter->max = (*ppInter)->max;
mergeInter.max = (*ppInter)->max;
currInter = *ppInter;
*ppInter = (*ppInter)->next;
freeeinter (currInter);
apInter->len -= 1;
continue;
}
break;
case C_INTER_GREATER:
if (!newInter) {
newInter = alloceinter (mergeInter.min, mergeInter.max);
newInter->next = *ppInter;
*ppInter = newInter;
apInter->len += 1;
}
break;
}
ppInter = &((*ppInter)->next);
}
/* Tail of first added interval. */
if (!newInter) {
*ppInter = alloceinter (aMin, aMax);
apInter->len += 1;
}
return (apInter);
}
/* ------------------------------------------------------------------
* Function : "freeinter()".
*/
extern void freeinter (apInter)
struct lInter_s *apInter;
{
struct eInter_s *pNextInter;
struct eInter_s *pInter;
for (pInter = apInter->l; pInter != NULL; ) {
pNextInter = pInter->next;
freeeinter (pInter);
pInter = pNextInter;
}
mbkfree ((void*)apInter);
}

View File

@ -0,0 +1,643 @@
/*
* $Id: util_LEFDEF.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./util_LEFDEF.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "debugoff.h"
# include "util_Defs.h"
/* ------------------------------------------------------------------
* Global variables (declared `extern' in "util_Defs.h").
*/
long DEF_UNITS_MICRONS = 100L;
static char *getRowToken __FP((char *aS, char *aSepar, char *aRefName));
/*
* /----------------------------------------------------------------\
* | Functions Definitions |
* \----------------------------------------------------------------/
*/
/* ------------------------------------------------------------------
* Function : "DEF2MBK_length()".
*/
extern long DEF2MBK_length(aL)
long aL;
{
return ((aL * SCALE_X) / DEF_UNITS_MICRONS);
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_length()".
*/
extern long MBK2DEF_length(aL)
long aL;
{
return ((aL * DEF_UNITS_MICRONS) / SCALE_X);
}
/* ------------------------------------------------------------------
* Function : "DEF2MBK_name()".
*/
extern char *DEF2MBK_name(aS)
char *aS;
{
int iS;
char *sTmp, *sAlloc, *pDelim;
iS = 0; if (aS[0] == '|') iS++;
sTmp = strdup (&aS[iS]);
/* Translate '|' (hierarchical separator) to SEPAR. */
for (iS = 0; sTmp[iS] != '\0'; iS++)
if (sTmp[iS] == '|') sTmp[iS] = SEPAR;
/* Translate vectorisation : "name<2>" --> "name 2". */
if ((pDelim = strchr (sTmp, '<'))) *pDelim = ' ';
if ((pDelim = strchr (sTmp, '>'))) *pDelim = '\0';
if ((pDelim = strchr (sTmp, '('))) *pDelim = ' ';
if ((pDelim = strchr (sTmp, ')'))) *pDelim = '\0';
sAlloc = namealloc (sTmp);
free (sTmp);
return (sAlloc);
}
/* ------------------------------------------------------------------
* Function : "DEF2MBK_row()".
*/
extern struct phref *DEF2MBK_row(apPhfig,
aRowName, aRowType,
aOrient,
aDoNumber, aByNumber,
aStepX, aStepY,
aX, aY)
struct phfig *apPhfig;
char *aRowName, *aRowType;
long aOrient;
long aDoNumber, aByNumber;
long aStepX, aStepY;
long aX, aY;
{
static char ref_name[16384];
sprintf (ref_name,
"%s.%s.%s_do_%ld_by_%ld_step_%ld_%ld",
aRowName,
aRowType,
DEF_orient2a(aOrient),
aDoNumber,
aByNumber,
aStepX,
aStepY);
return (addphref(apPhfig,
"ref_ref",
ref_name,
aX,
aY));
}
/* ------------------------------------------------------------------
* Function : "DEF2MBK_track()".
*/
extern struct phref *DEF2MBK_track(apPhfig,
aAxisName,
aStart,
aDoNumber,
aStep,
asLayers,
aX, aY)
struct phfig *apPhfig;
char *aAxisName;
long aStart;
long aDoNumber;
long aStep;
char *asLayers;
long aX, aY;
{
static char ref_name[16384];
sprintf (ref_name,
"tracks.%s_%ld_do_%ld_step_%ld.%s",
aAxisName,
aStart,
aDoNumber,
aStep,
asLayers);
return (addphref(apPhfig,
"ref_ref",
ref_name,
aX,
aY));
}
/* ------------------------------------------------------------------
* Function : "DEF2MBK_blockage()".
*/
extern struct phref *DEF2MBK_blockage(apPhfig, aX, aY, aWidth, aHeight)
struct phfig *apPhfig;
long aX, aY, aWidth, aHeight;
{
static char ref_name[16384];
sprintf (ref_name,
"blockage.%ld_%ld",
aWidth,
aHeight);
return (addphref(apPhfig,
"ref_ref",
ref_name,
aX,
aY));
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_name()".
*/
extern char *MBK2DEF_name(asLEF, asMBK)
char *asLEF, *asMBK;
{
char sTmp[1024], *pS, *pI;
strncpy (sTmp, asMBK, 1023);
/* Find the signal index separator ' '. */
pI = (char*)NULL;
for(pS = sTmp; (*pS) != (char)0; pS++) if ((*pS) == ' ') pI = pS;
if (pI != (char*)NULL) {
*pI = (char)0; pI += 1;
sprintf (asLEF, "%s(%s)", sTmp, pI);
} else {
sprintf (asLEF, sTmp);
}
return (asLEF);
}
/* ------------------------------------------------------------------
* Function : "DEF2MBK_transf()".
*/
extern char DEF2MBK_transf(aO)
double aO;
{
switch ((long)aO) {
case DEF_N: return (NOSYM);
case DEF_S: return (SYMXY);
case DEF_W: return (ROT_P);
case DEF_E: return (ROT_M);
case DEF_FN: return (SYM_X);
case DEF_FS: return (SYM_Y);
case DEF_FW: return (SY_RM);
case DEF_FE: return (SY_RP);
}
return (NOSYM);
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_direction()".
*/
extern char MBK2DEF_direction(acDir)
char acDir;
{
switch(acDir) {
case IN: return (C_DIRECTION_INPUT);
case OUT: return (C_DIRECTION_OUTPUT);
case INOUT: return (C_DIRECTION_INOUT);
case TRANSCV:
case TRISTATE: return (C_DIRECTION_TRISTATE);
}
return (C_DIRECTION_NONE);
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_locondir()".
*/
extern char MBK2DEF_locondir (apLocon)
locon_list *apLocon;
{
char dir;
dir = MBK2DEF_direction (apLocon->DIRECTION);
if (dir == C_DIRECTION_NONE) {
dir = C_DIRECTION_INPUT;
wprinth (NULL);
wprintf ("Unknown direction for terminal \"%s\" (forced \"INPUT\").\n",
apLocon->NAME);
}
return (dir);
}
/* ------------------------------------------------------------------
* Function : "BEH2DEF_direction()".
*/
extern char BEH2DEF_direction(acDir)
char acDir;
{
switch (acDir) {
case 'I': return (C_DIRECTION_INPUT);
case 'O': return (C_DIRECTION_OUTPUT);
case 'B': return (C_DIRECTION_INOUT);
case 'Z':
case 'T': return (C_DIRECTION_TRISTATE);
}
return (C_DIRECTION_NONE);
}
/* ------------------------------------------------------------------
* Function : "DEF2MBK_direction()".
*/
extern char DEF2MBK_direction(aDEFdir)
double aDEFdir;
{
switch ((long)aDEFdir) {
case DEF_INPUT: return (IN);
case DEF_OUTPUT: return (OUT);
case DEF_INOUT: return (INOUT);
case DEF_FEEDTHRU: return (INOUT);
}
return (UNKNOWN);
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_transf()".
*/
extern char MBK2DEF_transf(aO)
char aO;
{
switch (aO) {
case NOSYM: return (DEF_N);
case SYMXY: return (DEF_S);
case ROT_P: return (DEF_W);
case ROT_M: return (DEF_E);
case SYM_X: return (DEF_FN);
case SYM_Y: return (DEF_FS);
case SY_RP: return (DEF_FW);
case SY_RM: return (DEF_FE);
}
return (DEF_N);
}
/* ------------------------------------------------------------------
* Function : "getRowToken()".
*/
static char *getRowToken(aS, aSepar, aRefName)
char *aS, *aSepar, *aRefName;
{
char *token;
if ((token = strtok (aS, aSepar)) == NULL) {
errMBK ("defsavelophfig");
eprintf ("Malformed row reference name :\n \"%s\"\n",
aRefName);
EXIT (1);
}
return (token);
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_row()".
*/
extern void MBK2DEF_row(apPhref,
appRowName, appRowType,
apOrient,
apDoNumber, apByNumber,
apStepX, apStepY,
apX, apY)
struct phref *apPhref;
char **appRowName, **appRowType;
long *apOrient;
long *apDoNumber, *apByNumber;
long *apStepX, *apStepY;
long *apX, *apY;
{
static char ref_name[16384];
char *token;
strcpy (ref_name, apPhref->NAME);
token = getRowToken (ref_name, ".", apPhref->NAME);
*appRowName = (char*)mbkalloc (sizeof (char) * strlen (token));
strcpy (*appRowName, token);
strtoup (*appRowName);
token = getRowToken (NULL, ".", apPhref->NAME);
*appRowType = (char*)mbkalloc (sizeof (char) * strlen (token));
strcpy (*appRowType, token);
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
*apOrient = DEF_a2orient (token);
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
*apDoNumber = atol (token);
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
*apByNumber = atol (token);
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
*apStepX = atol (token);
token = strtoup (getRowToken (NULL, "_", apPhref->NAME));
*apStepY = atol (token);
*apX = apPhref->XREF;
*apY = apPhref->YREF;
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_track()".
*/
extern void MBK2DEF_track(apPhref,
apAxisName,
apStart,
apDoNumber,
apStep,
apsLayers,
apX, apY)
struct phref *apPhref;
char *apAxisName;
long *apStart;
long *apDoNumber;
long *apStep;
char **apsLayers;
long *apX, *apY;
{
static char ref_name[16384];
char *token;
strcpy (ref_name, apPhref->NAME);
token = getRowToken (ref_name, ".", apPhref->NAME);
token = getRowToken (NULL, "_", apPhref->NAME);
*apAxisName = (char)toupper ((int)*token);
token = getRowToken (NULL, "_", apPhref->NAME);
*apStart = atol (token);
token = getRowToken (NULL, "_", apPhref->NAME);
token = getRowToken (NULL, "_", apPhref->NAME);
*apDoNumber = atol (token);
token = getRowToken (NULL, "_", apPhref->NAME);
token = getRowToken (NULL, ".", apPhref->NAME);
*apStep = atol (token);
token = getRowToken (NULL, ";", apPhref->NAME);
*apsLayers = (char*)mbkalloc (sizeof (char) * strlen (token));
strcpy (*apsLayers, token);
strtoup (*apsLayers);
for (token = *apsLayers; *token != '\0'; token++)
if (*token == '.') *token = ' ';
*apX = apPhref->XREF;
*apY = apPhref->YREF;
}
/* ------------------------------------------------------------------
* Function : "MBK2DEF_blockage()".
*/
extern void MBK2DEF_blockage(apPhref, apXB1, apYB1, apWidth, apHeight)
struct phref *apPhref;
long *apXB1, *apYB1, *apWidth, *apHeight;
{
static char ref_name[16384];
char *token;
strcpy (ref_name, apPhref->NAME);
token = getRowToken (ref_name, ".", apPhref->NAME);
token = getRowToken (NULL, "_", apPhref->NAME);
*apWidth = atol (token);
token = getRowToken (NULL, "_", apPhref->NAME);
*apHeight = atol (token);
*apXB1 = apPhref->XREF;
*apYB1 = apPhref->YREF;
}
/* ------------------------------------------------------------------
* Function : "DEF_orient2a()".
*/
extern char *DEF_orient2a(aT)
long aT;
{
static char *tTransf[] = { "N", "S", "W", "E", "FN", "FS", "FW", "FE" };
switch (aT) {
case DEF_N: return (tTransf[0]);
case DEF_S: return (tTransf[1]);
case DEF_W: return (tTransf[2]);
case DEF_E: return (tTransf[3]);
case DEF_FN: return (tTransf[4]);
case DEF_FS: return (tTransf[5]);
case DEF_FW: return (tTransf[6]);
case DEF_FE: return (tTransf[7]);
}
return (tTransf[0]);
}
/* ------------------------------------------------------------------
* Function : "DEF_a2orient()".
*/
extern long DEF_a2orient(aT)
char *aT;
{
if (!strcmp (aT, "N")) return (DEF_N);
if (!strcmp (aT, "S")) return (DEF_S);
if (!strcmp (aT, "W")) return (DEF_W);
if (!strcmp (aT, "E")) return (DEF_E);
if (!strcmp (aT, "FN")) return (DEF_FN);
if (!strcmp (aT, "FS")) return (DEF_FS);
if (!strcmp (aT, "FW")) return (DEF_FW);
if (!strcmp (aT, "FE")) return (DEF_FE);
return (DEF_N);
}
/* ------------------------------------------------------------------
* Function : "DEF_side2a()".
*/
extern char *DEF_side2a(aSide)
char aSide;
{
static char *tTransf[] = { "N", "S", "W", "E" };
switch (aSide) {
case SOUTH: return (tTransf[0]);
case NORTH: return (tTransf[1]);
case EAST: return (tTransf[2]);
case WEST: return (tTransf[3]);
}
return (tTransf[0]);
}
/* ------------------------------------------------------------------
* Function : "DEF_layer2a()".
*/
extern char *DEF_layer2a(aLayer)
char aLayer;
{
char *layerName;
__DBG (fprintf (stderr, "layer id %d\n", (int)aLayer); )
switch (aLayer) {
case ALU1: layerName = "L_ALU1"; break;
case ALU2: layerName = "L_ALU2"; break;
case ALU3: layerName = "L_ALU3"; break;
case ALU4: layerName = "L_ALU4"; break;
case ALU5: layerName = "L_ALU5"; break;
case ALU6: layerName = "L_ALU6"; break;
case ALU7: layerName = "L_ALU7"; break;
case ALU8: layerName = "L_ALU8"; break;
case CALU1: layerName = "L_ALU1"; break;
case CALU2: layerName = "L_ALU2"; break;
case CALU3: layerName = "L_ALU3"; break;
case CALU4: layerName = "L_ALU4"; break;
case CALU5: layerName = "L_ALU5"; break;
case CALU6: layerName = "L_ALU6"; break;
case CALU7: layerName = "L_ALU7"; break;
case CALU8: layerName = "L_ALU8"; break;
case CONT_VIA: layerName = "L_VIA1"; break;
case CONT_VIA2: layerName = "L_VIA2"; break;
case CONT_VIA3: layerName = "L_VIA3"; break;
case CONT_VIA4: layerName = "L_VIA4"; break;
case CONT_VIA5: layerName = "L_VIA5"; break;
case CONT_VIA6: layerName = "L_VIA6"; break;
case CONT_VIA7: layerName = "L_VIA7"; break;
default: layerName = "L_MBK_ERROR"; break;
}
return (layerName);
}
/* ------------------------------------------------------------------
* Function : "DEF_via2a()".
*/
extern char *DEF_via2a(aType, aDX, aDY, aViaName)
char aType;
long aDX, aDY;
char *aViaName;
{
long flagDefault, length;
switch (aType) {
case CONT_VIA: strcpy (aViaName, "CONT_VIA"); break;
case CONT_VIA2: strcpy (aViaName, "CONT_VIA2"); break;
case CONT_VIA3: strcpy (aViaName, "CONT_VIA3"); break;
case CONT_VIA4: strcpy (aViaName, "CONT_VIA4"); break;
case CONT_VIA5: strcpy (aViaName, "CONT_VIA5"); break;
case CONT_VIA6: strcpy (aViaName, "CONT_VIA6"); break;
case CONT_VIA7: strcpy (aViaName, "CONT_VIA7"); break;
default: strcpy (aViaName, "MBK_ERROR"); break;
}
length = strlen (aViaName);
flagDefault = (aDX <= MBKSCALE(2))
&& (aDY <= MBKSCALE(2));
if (!flagDefault) {
sprintf (aViaName + length, "_%ld_%ld",
MBK2DEF_length (aDX),
MBK2DEF_length (aDY));
}
return (aViaName);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,498 @@
/*
* $Id: util_Power.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./util_Power.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "debugoff.h"
/* ------------------------------------------------------------------
* Local variables (prefix 'LV_').
*/
static long LV_XAB1;
static long LV_YAB1;
static long LV_XAB2;
static long LV_YAB2;
/* ----------------------------------------------------------------------
* Local functions declarations.
*/
static int onSlice __FP((long aY));
static void setPowerAB __FP((long XAB1, long YAB1,
long XAB2, long YAB2));
/*
* /--------------------------------------------------------------------\
* | Functions Definitions |
* \--------------------------------------------------------------------/
*/
/* ----------------------------------------------------------------------
* Function : "setPowerAB()".
*/
static void setPowerAB(XAB1, YAB1, XAB2, YAB2)
long XAB1, YAB1, XAB2, YAB2;
{
LV_XAB1 = XAB1;
LV_YAB1 = YAB1;
LV_XAB2 = XAB2;
LV_YAB2 = YAB2;
}
/* ----------------------------------------------------------------------
* Function : "onSlice()".
*/
static int onSlice(aY)
long aY;
{
if (aY < LV_YAB1) return (FALSE);
if (aY > LV_YAB2) return (FALSE);
if (!(((aY - MBK_WIDTH_VDD / 2) - LV_YAB1) % MBK_Y_SLICE)) return (TRUE);
if (!(((aY + MBK_WIDTH_VDD / 2) - LV_YAB1) % MBK_Y_SLICE)) return (TRUE);
if (!(((aY - MBK_WIDTH_VSS / 2) - LV_YAB1) % MBK_Y_SLICE)) return (TRUE);
if (!(((aY + MBK_WIDTH_VSS / 2) - LV_YAB1) % MBK_Y_SLICE)) return (TRUE);
return (FALSE);
}
/* ----------------------------------------------------------------------
* Function : "addPow()".
*/
extern ePow_t *addPow(applPow, aY, aW, aName, aType, aDir)
ePow_t **applPow;
long aY;
long aW;
char *aName;
char aType;
char aDir;
{
ePow_t *pPow, **ppPow;
pPow = (ePow_t*)mbkalloc(sizeof(ePow_t));
pPow->y = aY;
pPow->w = aW;
pPow->flags = 0;
pPow->inter = NULL;
switch(aDir) {
case C_POWER_VERTICAL:
pPow->xMin = LV_YAB1;
pPow->xMax = LV_YAB2;
pPow->min = LV_YAB2;
pPow->max = LV_YAB1;
break;
default:
case C_POWER_HORIZONTAL:
pPow->xMin = LV_XAB1;
pPow->xMax = LV_XAB2;
pPow->min = LV_XAB2;
pPow->max = LV_XAB1;
break;
}
pPow->Name = namealloc(aName);
pPow->Type = aType;
/* Insert in the ordered list. */
for(ppPow = applPow ; *ppPow != NULL ; ppPow = &((*ppPow)->Next)) {
if ((*ppPow)->y >= pPow->y) {
pPow->Next = *ppPow;
*ppPow = pPow;
break;
}
}
/* The list is empty or the element is the last one. */
if (*ppPow == (ePow_t*)NULL) {
pPow->Next = *ppPow;
*ppPow = pPow;
}
return(pPow);
}
/* ----------------------------------------------------------------------
* Function : "freePow()".
*/
extern void freePow(aplPow)
struct ePow_s *aplPow;
{
struct ePow_s *pDel, *pNext;
for (pDel = aplPow; pDel != NULL; ) {
pNext = pDel->Next;
freeinter (pDel->inter);
mbkfree (pDel);
pDel = pNext;
}
}
/* ----------------------------------------------------------------------
* Function : "getPow()".
*/
extern ePow_t *getPow(aplPow, aY)
ePow_t *aplPow;
long aY;
{
ePow_t *pPow;
for( pPow = aplPow ; pPow != NULL ; pPow = pPow->Next )
if (pPow->y == aY) return( pPow );
return( NULL );
}
/* ----------------------------------------------------------------------
* Function : "mergeXPow()".
*/
extern void mergeXPow(apPow, axMin, axMax, aW)
ePow_t *apPow;
long axMin, axMax, aW;
{
if (aW == apPow->w)
apPow->inter = addinter (apPow->inter, axMin, axMax);
apPow->min = m_Min(apPow->min, axMin);
apPow->max = m_Max(apPow->max, axMax);
}
/* ----------------------------------------------------------------------
* Function : "buildPow()".
*/
extern ePow_t *buildPow(apPhfig, aLayer, aDir, asSuffix)
struct phfig *apPhfig;
char aLayer;
char aDir;
char *asSuffix;
{
ePow_t **pplPow, *plPow, *pPow;
phseg_list *pPhseg;
phcon_list *pPhcon;
char type;
char ORIENT1, ORIENT2, *sDir1, *sDir2;
long X1, X2, Y1, Y2;
setPowerAB (apPhfig->XAB1, apPhfig->YAB1,
apPhfig->XAB2, apPhfig->YAB2);
switch(aDir) {
case C_POWER_VERTICAL:
sDir1 = "vertical";
sDir2 = "NORTH/SOUTH";
ORIENT1 = NORTH;
ORIENT2 = SOUTH;
break;
default:
case C_POWER_HORIZONTAL:
sDir1 = "horizontal";
sDir2 = "EAST/WEST";
ORIENT1 = EAST;
ORIENT2 = WEST;
break;
}
pplPow = &plPow;
*pplPow = NULL;
/* Find power terminals among CALUx segments (new convention). */
for(pPhseg = apPhfig->PHSEG ; pPhseg != NULL ; pPhseg = pPhseg->NEXT) {
type = C_POWER_ISNONE;
if (isvdd(pPhseg->NAME)) type = C_POWER_ISVDD;
if (isvss(pPhseg->NAME)) type = C_POWER_ISVSS;
switch(aDir) {
case C_POWER_VERTICAL:
Y1 = pPhseg->X1;
Y2 = pPhseg->X2;
X1 = pPhseg->Y1;
X2 = pPhseg->Y2;
break;
default:
case C_POWER_HORIZONTAL:
Y1 = pPhseg->Y1;
Y2 = pPhseg->Y2;
X1 = pPhseg->X1;
X2 = pPhseg->X2;
break;
}
if (type != C_POWER_ISNONE) {
if (cmpALU(aLayer, pPhseg->LAYER) & F_CALU) {
if (Y1 != Y2) {
wprinth(NULL);
wprintf("\n In figure \"%s\" :", apPhfig->NAME);
wprintf("\n CALU1 Power segment \"%s\" at (%d,%d)",
pPhseg->NAME,
MBKUNSCALE (pPhseg->X1),
MBKUNSCALE (pPhseg->Y1));
wprintf(" is not %s.\n", sDir1);
continue;
}
if (aDir == C_POWER_HORIZONTAL) {
if (!onSlice(Y1)) {
wprinth(NULL);
wprintf("\n In figure \"%s\" :", apPhfig->NAME);
wprintf("\n CALU1 Power segment \"%s\" at (%d,%d)",
pPhseg->NAME,
MBKUNSCALE (pPhseg->X1),
MBKUNSCALE (pPhseg->Y1));
wprintf(" is not on a slice boundary.");
wprintf("\n (valide slices boundaries are");
wprintf(" ((n * %ld) - %ld) or" , Y_SLICE, WIDTH_VSS / 2);
wprintf(" ((n * %ld) + %ld) )\n" , Y_SLICE, WIDTH_VSS / 2);
continue;
}
}
if ((pPow = getPow(plPow, Y1)) == NULL) {
pPow = addPow(pplPow ,
Y1 ,
pPhseg->WIDTH,
pPhseg->NAME ,
type ,
aDir );
}
if (pPhseg->NAME != pPow->Name) {
eprinth(NULL);
eprintf("\n In figure \"%s\" :", apPhfig->NAME);
eprintf("\n CALU1 Power segment \"%s\" at (%d,%d)\n",
pPhseg->NAME,
MBKUNSCALE (pPhseg->X1),
MBKUNSCALE (pPhseg->Y1));
eprintf(" conflict with \"%s\" power line at %d.\n",
pPow->Name,
pPow->y );
EXIT(1);
}
mergeXPow(pPow, X1, X2, pPhseg->WIDTH);
}
}
} /* End of "pPhseg" loop. */
/* Find power terminals among terminals (for backward compatibility). */
for(pPhcon = apPhfig->PHCON ; pPhcon != NULL ; pPhcon = pPhcon->NEXT) {
type = C_POWER_ISNONE;
if (isvdd(pPhcon->NAME)) type = C_POWER_ISVDD;
if (isvss(pPhcon->NAME)) type = C_POWER_ISVSS;
switch(aDir) {
case C_POWER_VERTICAL:
Y1 = pPhcon->XCON;
X1 = pPhcon->YCON;
break;
default:
case C_POWER_HORIZONTAL:
Y1 = pPhcon->YCON;
X1 = pPhcon->XCON;
break;
}
if (type != C_POWER_ISNONE) {
if (cmpALU(aLayer, pPhcon->LAYER)) {
if ( (pPhcon->ORIENT != ORIENT1)
&& (pPhcon->ORIENT != ORIENT2)) {
eprinth(NULL);
eprintf("\n In figure \"%s\" :", apPhfig->NAME);
eprintf("\n ALU1 Power terminal \"%s\" at (%d,%d)",
pPhcon->NAME,
MBKUNSCALE (pPhcon->XCON),
MBKUNSCALE (pPhcon->YCON));
eprintf(" is not on %s side.\n", sDir2);
EXIT(1);
}
if (aDir == C_POWER_HORIZONTAL) {
if (!onSlice(pPhcon->YCON)) {
eprinth(NULL);
eprintf("\n In figure \"%s\" :", apPhfig->NAME);
eprintf("\n ALU1 Power terminal \"%s\" at (%d,%d)",
pPhcon->NAME,
MBKUNSCALE (pPhcon->XCON),
MBKUNSCALE (pPhcon->YCON));
eprintf(" is not on a slice boundary.");
eprintf("\n (valide slices boundaries are");
eprintf(" ((n * %ld) - %ld) or" , Y_SLICE, WIDTH_VSS / 2);
eprintf(" ((n * %ld) + %ld) )\n" , Y_SLICE, WIDTH_VSS / 2);
EXIT(1);
}
}
if ((pPow = getPow(plPow, Y1)) == NULL) {
pPow = addPow(pplPow ,
Y1 ,
pPhcon->WIDTH,
pPhcon->NAME ,
type ,
aDir );
}
if (pPhcon->NAME != pPow->Name) {
eprinth(NULL);
eprintf("\n In figure \"%s\" :", apPhfig->NAME);
eprintf("\n ALU1 Power terminal \"%s\" at (%d,%d)\n",
pPhcon->NAME,
MBKUNSCALE (pPhcon->XCON),
MBKUNSCALE (pPhcon->YCON));
eprintf(" conflict with \"%s\" power line at %d.\n",
pPow->Name,
pPow->y );
EXIT(1);
}
mergeXPow(pPow, X1, X1, pPhcon->WIDTH);
}
}
} /* End of "pPhcon" loop. */
/* Look if the power lines are complete. */
for (pPow = plPow; pPow != NULL; pPow = pPow->Next) {
if ( (pPow->inter->len == 1)
&& (pPow->inter->min == pPow->xMin)
&& (pPow->inter->max == pPow->xMax)) {
pPow->flags |= F_POWER_COMPLETE;
__DBG( printf ("powerline at %ld is complete.\n", pPow->y); )
}
}
return (plPow);
}
/* ----------------------------------------------------------------------
* Function : "powToCon()".
*/
extern void powToCon(apPhfig, aLayer, aDir, aplPow, aFlags)
struct phfig *apPhfig;
char aLayer;
char aDir;
struct ePow_s *aplPow;
long aFlags;
{
struct ePow_s *pPow;
char *conName;
long w, y, skipFlag;
for (pPow = aplPow; pPow != NULL; pPow = pPow->Next) {
skipFlag = FALSE;
switch (pPow->Type) {
default:
case C_POWER_ISVSS: conName = "vss"; break;
case C_POWER_ISVDD: conName = "vdd"; break;
}
w = pPow->w;
y = pPow->y;
if (aFlags & F_POWER_MERGE) {
if ( (pPow->Next != NULL)
&& (pPow->Next->y == pPow->y + MBKSCALE(6))) {
skipFlag = TRUE;
w = MBKSCALE(12);
y += MBKSCALE(3);
}
}
if (aDir == C_POWER_HORIZONTAL) {
if (pPow->flags & F_POWER_COMPLETE) {
addphcon (apPhfig,
WEST,
conName,
pPow->xMin,
y,
aLayer,
w);
}
if (pPow->flags & F_POWER_COMPLETE) {
addphcon (apPhfig,
EAST,
conName,
pPow->xMax,
y,
aLayer,
w);
}
} else {
if (pPow->flags & F_POWER_COMPLETE) {
addphcon (apPhfig,
SOUTH,
conName,
y,
pPow->xMin,
aLayer,
w);
}
if (pPow->flags & F_POWER_COMPLETE) {
addphcon (apPhfig,
NORTH,
conName,
y,
pPow->xMax,
aLayer,
w);
}
}
if (skipFlag) pPow = pPow->Next;
}
}

View File

@ -0,0 +1,593 @@
/*
* $Id: util_RTU.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./util_RTU.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
# include "debugoff.h"
# define LAYERS_NUMBER 6
# define LAYERS_ALIAS 3
# define TRACK_PITCH MBKSCALE(5)
# define F_PITCH_INF 0x00000001
# define F_PITCH_SUP 0x00000002
# define HT_TERM_SIZE 1024
# define STRING_OBSTACLE "obs"
/* ------------------------------------------------------------------
* Internal types.
*/
typedef struct obsTrack_s {
long min;
long max;
} obsTrack_t;
/* ------------------------------------------------------------------
* Local variables (prefix 'LV_').
*/
static struct phfig *LV_phfig;
static struct obsTrack_s *LV_ttObs[LAYERS_NUMBER];
static char LV_tLayersNames[LAYERS_NUMBER][LAYERS_ALIAS];
static long LV_hTracksNumber;
static long LV_vTracksNumber;
static long LV_hTracksMax;
static long LV_vTracksMax;
static authtable *LV_htTerm;
/* ------------------------------------------------------------------
* Internal functions.
*/
# define SETMIN(v,m) ((v) = m_Min((v),(m)))
# define SETMAX(v,m) ((v) = m_Max((v),(m)))
# define LAMBDA2TRACKS(l) (lambda2pitch((l), F_PITCH_INF))
# define TRACKS2LAMBDA(t) ((t) * TRACK_PITCH)
# define NORMVIASIDE(s) (((s) > MBK_VIA_SIDE) ? (s) : 0L)
static void buildHTTerm __FP((struct phseg *apSeg));
static void delHTTerm __FP((void));
static long lambda2pitch __FP((long aLength, long aFlags));
static long getLayerTable __FP((char aLayer));
static void allocTableLayers __FP((void));
static void allocTableObs __FP((void));
static void addObs __FP((long aiTable,
long aX1,
long aY1,
long aX2,
long aY2));
static void seg2obs __FP((struct phseg *apSeg));
static void via2obs __FP((struct phvia *apVIA));
static void instance2obs __FP((struct phins *pIns));
extern void instances2obs __FP((void));
static void wiring2obs __FP((void));
static void obs2layers __FP((void));
/*
* /----------------------------------------------------------------\
* | Functions Definitions |
* \----------------------------------------------------------------/
*/
/* ------------------------------------------------------------------
* Function : "buildHTTerm()".
*/
static void buildHTTerm(apSeg)
struct phseg *apSeg;
{
struct phseg *pSeg;
LV_htTerm = createauthtable (HT_TERM_SIZE);
for (pSeg = apSeg; pSeg != NULL; pSeg = pSeg->NEXT) {
if (pSeg->NAME == NULL) {
eprinth ("rtu");
eprintf ("\n Segment (%ld,%ld) (%ld,%ld) width %ld layer id %d",
pSeg->X1,
pSeg->Y1,
pSeg->X2,
pSeg->Y2,
pSeg->WIDTH,
(int)pSeg->LAYER);
eprintf ("\n doesn't have a name.\n");
EXIT (1);
}
if (!isCALU (pSeg->LAYER)) continue;
if (searchauthelem (LV_htTerm, pSeg->NAME)) continue;
addauthelem (LV_htTerm, pSeg->NAME, 0);
}
}
/* ------------------------------------------------------------------
* Function : "delHTTerm()".
*/
static void delHTTerm()
{
destroyauthtable (LV_htTerm);
}
/* ------------------------------------------------------------------
* Function : "lambda2pitch()".
*/
static long lambda2pitch(aLength, aFlags)
long aLength;
long aFlags;
{
long pitch;
pitch = aLength / TRACK_PITCH;
if (aFlags & F_PITCH_SUP)
pitch += (aLength % TRACK_PITCH) ? 1 : 0;
return (pitch);
}
/* ------------------------------------------------------------------
* Function : "getLayerTable()".
*/
static long getLayerTable(aLayer)
char aLayer;
{
long iTable, iAlias;
for (iTable = 1; iTable < LAYERS_NUMBER; iTable++) {
for (iAlias = 0; iAlias < LAYERS_ALIAS; iAlias++) {
if (LV_tLayersNames[iTable][iAlias] == aLayer) {
return (iTable);
}
}
}
/* No table found : return LAYERS_NUMBER. */
return (LAYERS_NUMBER);
}
/* ------------------------------------------------------------------
* Function : "allocTableLayers()".
*/
static void allocTableLayers()
{
/* Base layer. */
LV_tLayersNames[0][0] = ALU1;
LV_tLayersNames[1][0] = ALU2;
LV_tLayersNames[2][0] = ALU3;
LV_tLayersNames[3][0] = ALU4;
LV_tLayersNames[4][0] = ALU5;
LV_tLayersNames[5][0] = ALU6;
/* Associated obstacles layer. */
LV_tLayersNames[0][1] = TALU1;
LV_tLayersNames[1][1] = TALU2;
LV_tLayersNames[2][1] = TALU3;
LV_tLayersNames[3][1] = TALU4;
LV_tLayersNames[4][1] = TALU5;
LV_tLayersNames[5][1] = TALU6;
/* Associated terminal layer. */
LV_tLayersNames[0][2] = CALU1;
LV_tLayersNames[1][2] = CALU2;
LV_tLayersNames[2][2] = CALU3;
LV_tLayersNames[3][2] = CALU4;
LV_tLayersNames[4][2] = CALU5;
LV_tLayersNames[5][2] = CALU6;
}
/* ------------------------------------------------------------------
* Function : "allocTableObs()".
*/
static void allocTableObs()
{
long iTable, iTrack;
long tracksNumber, trackMax;
LV_hTracksNumber = LAMBDA2TRACKS (LV_phfig->YAB2 - LV_phfig->YAB1) + 1;
LV_hTracksMax = LAMBDA2TRACKS (LV_phfig->XAB2 - LV_phfig->XAB1) + 1;
LV_vTracksNumber = LAMBDA2TRACKS (LV_phfig->XAB2 - LV_phfig->XAB1) + 1;
LV_vTracksMax = LAMBDA2TRACKS (LV_phfig->YAB2 - LV_phfig->YAB1) + 1;
for (iTable = 0; iTable < LAYERS_NUMBER; iTable++) {
if (!(iTable % 2)) {
/* i.e. ALU1, ALU3 & ALU5 : vertical tracks. */
tracksNumber = LV_vTracksNumber;
trackMax = LV_vTracksMax;
} else {
/* i.e. ALU2, ALU4 & ALU6 : horizontal tracks. */
tracksNumber = LV_hTracksNumber;
trackMax = LV_hTracksMax;
}
LV_ttObs[iTable] = (struct obsTrack_s*)mbkalloc (
sizeof (struct obsTrack_s) * tracksNumber);
/* Initialize table boundaries. */
for (iTrack = 0; iTrack < tracksNumber; iTrack++) {
LV_ttObs[iTable][iTrack].min = trackMax;
LV_ttObs[iTable][iTrack].max = 0L;
}
}
}
/* ------------------------------------------------------------------
* Function : "addObs()".
*/
static void addObs(aiTable, aX1, aY1, aX2, aY2)
long aiTable;
long aX1, aY1, aX2, aY2;
{
long iTrack, ivTrackMin, ivTrackMax;
long hTrackMin, hTrackMax;
if (!(aiTable % 2)) {
/* i.e. ALU1, ALU3 & ALU5 : vertical tracks. */
hTrackMin = lambda2pitch (aY1 - LV_phfig->YAB1, F_PITCH_INF);
hTrackMax = lambda2pitch (aY2 - LV_phfig->YAB1, F_PITCH_SUP);
ivTrackMin = lambda2pitch (aX1 - LV_phfig->XAB1, F_PITCH_INF);
ivTrackMax = lambda2pitch (aX2 - LV_phfig->XAB1, F_PITCH_SUP);
} else {
/* i.e. ALU2, ALU4 & ALU6 : horizontal tracks. */
hTrackMin = lambda2pitch (aX1 - LV_phfig->XAB1, F_PITCH_INF);
hTrackMax = lambda2pitch (aX2 - LV_phfig->XAB1, F_PITCH_SUP);
ivTrackMin = lambda2pitch (aY1 - LV_phfig->YAB1, F_PITCH_INF);
ivTrackMax = lambda2pitch (aY2 - LV_phfig->YAB1, F_PITCH_SUP);
}
for (iTrack = ivTrackMin; iTrack <= ivTrackMax; iTrack++) {
SETMIN (LV_ttObs[aiTable][iTrack].min, hTrackMin);
SETMAX (LV_ttObs[aiTable][iTrack].max, hTrackMax);
}
}
/* ------------------------------------------------------------------
* Function : "seg2obs()".
*/
static void seg2obs(apSeg)
struct phseg *apSeg;
{
long iTable, X1, Y1, X2, Y2, trackWidth;
/* Special policy for xALU1 layers : segments are all passed "as is"
* in TALU1.
*/
switch (apSeg->LAYER) {
case ALU1:
case CALU1:
case TALU1:
/* Do nothing.
*addphseg (LV_phfig,
* TALU1,
* apSeg->WIDTH,
* apSeg->X1,
* apSeg->Y1,
* apSeg->X2,
* apSeg->Y2,
* STRING_OBSTACLE
* );
*/
return;
}
iTable = getLayerTable (apSeg->LAYER);
if (iTable == LAYERS_NUMBER) return;
trackWidth = getLayerTrackWidth (apSeg->LAYER);
switch (apSeg->TYPE) {
case UP:
case DOWN:
X1 = apSeg->X1 - (apSeg->WIDTH - trackWidth) / 2;
X2 = apSeg->X2 + (apSeg->WIDTH - trackWidth) / 2;
Y1 = apSeg->Y1;
Y2 = apSeg->Y2;
break;
case LEFT:
case RIGHT:
default:
X1 = apSeg->X1;
X2 = apSeg->X2;
Y1 = apSeg->Y1 - (apSeg->WIDTH - trackWidth) / 2;
Y2 = apSeg->Y2 + (apSeg->WIDTH - trackWidth) / 2;
break;
}
addObs (iTable, X1, Y1, X2, Y2);
}
/* ------------------------------------------------------------------
* Function : "via2obs()".
*/
static void via2obs(apVIA)
struct phvia *apVIA;
{
long iTable, X1, Y1, X2, Y2, trackWidth;
char layer;
# if 0
char topLayer;
# endif
if (apVIA->NAME == NULL) {
eprinth ("rtu");
eprintf ("\n VIA (%ld,%ld) size (%ld,%ld) type id %d",
MBKUNSCALE (apVIA->XVIA),
MBKUNSCALE (apVIA->YVIA),
MBKUNSCALE (apVIA->DX),
MBKUNSCALE (apVIA->DY),
(int)apVIA->TYPE);
eprintf ("\n doesn't have a name.\n");
EXIT (1);
}
__DBG( fprintf (stderr, "via2obs(): VIA at %ld %ld.\n",
apVIA->XVIA, apVIA->YVIA); )
/* Check if this VIA belongs to an terminal net. */
/* if (searchauthelem (LV_htTerm, apVIA->NAME)) return; */
for (layer = getBottomVIALayer (apVIA->TYPE); TRUE;
layer = getUpVIALayer (apVIA->TYPE, layer)) {
iTable = getLayerTable (layer);
if ((!isvdd (apVIA->NAME) && !isvss (apVIA->NAME)) || (iTable % 2)) {
if (iTable != LAYERS_NUMBER) {
__DBG (fprintf (stderr, " OBS Layer %d\n", (int)layer); )
trackWidth = getLayerTrackWidth (layer);
X1 = apVIA->XVIA - (NORMVIASIDE(apVIA->DX) - trackWidth) / 2;
X2 = apVIA->XVIA + (NORMVIASIDE(apVIA->DX) - trackWidth) / 2;
Y1 = apVIA->YVIA - (NORMVIASIDE(apVIA->DY) - trackWidth) / 2;
Y2 = apVIA->YVIA + (NORMVIASIDE(apVIA->DY) - trackWidth) / 2;
addObs (iTable, X1, Y1, X2, Y2);
}
}
if (layer == getTopVIALayer (apVIA->TYPE)) break;
}
# if 0
fprintf (stderr, " Intermediate layers :\n");
layer = getUpVIALayer (apVIA->TYPE, getBottomVIALayer (apVIA->TYPE));
topLayer = getTopVIALayer (apVIA->TYPE);
while (layer != topLayer) {
iTable = getLayerTable (layer);
if (iTable != LAYERS_NUMBER) {
fprintf (stderr, " OBS Layer %d\n", (int)layer);
trackWidth = getLayerTrackWidth (layer);
X1 = apVIA->XVIA - (NORMVIASIDE(apVIA->DX) - trackWidth) / 2;
X2 = apVIA->XVIA + (NORMVIASIDE(apVIA->DX) - trackWidth) / 2;
Y1 = apVIA->YVIA - (NORMVIASIDE(apVIA->DY) - trackWidth) / 2;
Y2 = apVIA->YVIA + (NORMVIASIDE(apVIA->DY) - trackWidth) / 2;
addObs (iTable, X1, Y1, X2, Y2);
}
layer = getUpVIALayer (apVIA->TYPE, layer);
}
# endif
}
/* ------------------------------------------------------------------
* Function : "instance2obs()".
*/
static void instance2obs(apIns)
struct phins *apIns;
{
struct phfig *pFig;
struct phseg *pSeg, flatSeg;
# if 0
struct phvia *pVIA, flatVIA;
char *viaName = STRING_OBSTACLE;
# endif
pFig = getphfig (apIns->FIGNAME, 'A');
for (pSeg = pFig->PHSEG; pSeg != NULL; pSeg = pSeg->NEXT) {
if ( isvdd (pSeg->NAME ) || isvss (pSeg->NAME )) continue;
if (!isCALU (pSeg->LAYER) && !isobs (pSeg)) continue;
/*if (isCALU (pSeg->LAYER) || !isobs (pSeg)) continue;*/
xyflatseg (&flatSeg, pSeg,
apIns->XINS, apIns->YINS,
pFig->XAB1, pFig->YAB1,
pFig->XAB2, pFig->YAB2,
apIns->TRANSF);
seg2obs (&flatSeg);
}
# if 0
for (pVIA = pFig->PHVIA; pVIA != NULL; pVIA = pVIA->NEXT) {
if (isvdd (pVIA->NAME) || isvss (pVIA->NAME)) continue;
xyflatvia (&flatVIA, pVIA,
apIns->XINS, apIns->YINS,
pFig->XAB1, pFig->YAB1,
pFig->XAB2, pFig->YAB2,
apIns->TRANSF);
flatVIA.NAME = (pVIA->NAME != NULL) ? pVIA->NAME : viaName;
via2obs (&flatVIA);
}
# endif
}
/* ------------------------------------------------------------------
* Function : "wiring2obs()".
*/
static void wiring2obs()
{
struct phseg *pSeg;
struct phvia *pVIA;
for (pSeg = LV_phfig->PHSEG; pSeg != NULL; pSeg = pSeg->NEXT) {
/* Terminals (i.e. segments in CALUx layers) are not to be
* considered as obstacles.
*/
/*if (!isCALU (pSeg->LAYER)) seg2obs (pSeg);*/
if (!isvdd (pSeg->NAME) && !isvss (pSeg->NAME)) seg2obs (pSeg);
}
for (pVIA = LV_phfig->PHVIA; pVIA != NULL; pVIA = pVIA->NEXT) {
/* Skip default VIA, as they belongs to regular wiring. */
if (pVIA->DX || pVIA->DY) via2obs (pVIA);
}
}
/* ------------------------------------------------------------------
* Function : "instances2obs()".
*/
extern void instances2obs()
{
struct phins *pIns;
for (pIns = LV_phfig->PHINS; pIns != NULL; pIns = pIns->NEXT) {
instance2obs (pIns);
}
}
/* ------------------------------------------------------------------
* Function : "obs2layers()".
*/
static void obs2layers()
{
long iTable, iTrack, tracksNumber;
long X1, Y1, X2, Y2, width;
char layer;
for (iTable = 0; iTable < LAYERS_NUMBER; iTable++) {
layer = getTALU (LV_tLayersNames[iTable][0]);
width = getLayerTrackWidth (layer);
if (!(iTable % 2)) {
/* i.e. ALU1, ALU3 & ALU5 : vertical tracks. */
tracksNumber = LV_vTracksNumber;
} else {
/* i.e. ALU2, ALU4 & ALU6 : horizontal tracks. */
tracksNumber = LV_hTracksNumber;
}
for (iTrack = 0; iTrack < tracksNumber; iTrack++) {
/* Skip empty tracks. */
if (LV_ttObs[iTable][iTrack].min >= LV_ttObs[iTable][iTrack].max)
continue;
if (!(iTable % 2)) {
/* i.e. ALU1, ALU3 & ALU5 : vertical tracks. */
X1 = X2 = LV_phfig->XAB1 + TRACKS2LAMBDA (iTrack);
Y1 = LV_phfig->YAB1 + TRACKS2LAMBDA (LV_ttObs[iTable][iTrack].min);
Y2 = LV_phfig->YAB1 + TRACKS2LAMBDA (LV_ttObs[iTable][iTrack].max);
} else {
/* i.e. ALU2, ALU4 & ALU6 : horizontal tracks. */
Y1 = Y2 = LV_phfig->YAB1 + TRACKS2LAMBDA (iTrack);
X1 = LV_phfig->XAB1 + TRACKS2LAMBDA (LV_ttObs[iTable][iTrack].min);
X2 = LV_phfig->XAB1 + TRACKS2LAMBDA (LV_ttObs[iTable][iTrack].max);
}
addphseg (LV_phfig, layer, width, X1, Y1, X2, Y2, STRING_OBSTACLE);
} /* End of "for (iTrack ...)". */
} /* End of "for (iTable ...)". */
}
/* ------------------------------------------------------------------
* Function : "rtu()".
*/
extern void rtu(aPhfig)
struct phfig *aPhfig;
{
LV_phfig = aPhfig;
allocTableLayers ();
allocTableObs ();
buildHTTerm (aPhfig->PHSEG);
instances2obs ();
wiring2obs ();
obs2layers ();
delHTTerm ();
}

View File

@ -0,0 +1,520 @@
/*
* $Id: util_Sys.c,v 1.1 2002/04/25 16:16:20 jpc Exp $
*
* /----------------------------------------------------------------\
* | |
* | A l l i a n c e C A D S y s t e m |
* | S i l i c o n E n s e m b l e / A l l i a n c e |
* | |
* | Author : Jean-Paul CHAPUT |
* | E-mail : alliance-support@asim.lip6.fr |
* | ============================================================== |
* | C Module : "./util_Sys.c" |
* | ************************************************************** |
* | U p d a t e s |
* | |
* \----------------------------------------------------------------/
*/
# include "util_Defs.h"
/* ------------------------------------------------------------------
* Global variables (declared `extern' in "util_Defs.h").
*/
long util_VL = 1L;
long util_flags = 0L;
char util_binName[1024] = "noname";
/* ------------------------------------------------------------------
* Internal functions declarations.
*/
static void trapSig __FP((int aSig));
/*
* /----------------------------------------------------------------\
* | Functions Definitions |
* \----------------------------------------------------------------/
*/
/* ------------------------------------------------------------------
* Function : "trapSig()".
*/
static void trapSig(aSig)
int aSig;
{
switch (aSig)
{
case C_SIGERR:
/* A "normal" error occurs (produced by 'esignal'). */
break;
case C_SIGTFLT:
/* "util_init" was unable to setup 'trapSig'. */
eprinth ("util_Sys");
eprints ("\n Unable to trap SOFTSIG|SIGSEGV|SIGTERM.\n");
break;
case SIGTERM:
/* This occurs on MBK errors. */
eprinth ((char *)NULL);
eprints ("\n An error have occur in the MBK data-base.");
eprints ("\n Please check your Alliance environment.");
eprints ("\n\n");
eprintf ("\n %s terminated.", util_binName);
eprints ("\n" );
break;
case SIGFPE:
case SIGBUS:
case SIGSEGV:
/* Ouch !! This may result from a program bug. */
eprinth ((char *)NULL);
eprintf ("\n An %s internal bug have occur ", util_binName);
if (aSig == SIGFPE ) eprints ("(SIGFPE)." );
if (aSig == SIGBUS ) eprints ("(SIGBUS)." );
if (aSig == SIGSEGV) eprints ("(SIGSEGV).");
eprints ("\n Please e-mail to \"alliance-support@asim.lip6.fr\".");
eprints ("\n\n");
eprintf ("\n %s terminated ", util_binName);
if (util_flags & F_NOCORE) {
eprints ("(core not dumped).\n");
exit (1);
}
else {
eprints( "(core will be dumped).\n");
if ( (signal(SIGFPE , SIG_DFL) == SIG_ERR)
|| (signal(SIGBUS , SIG_DFL) == SIG_ERR)
|| (signal(SIGSEGV, SIG_DFL) == SIG_ERR))
exit (1);
else {
kill (getpid(), aSig);
return;
}
}
break;
default:
/* Unexpected signal. */
eprinth ("util_Sys");
eprintf ("\n Unexpected signal \'%d\' in trap function.\n", aSig);
break;
}
exit (1);
}
/* ------------------------------------------------------------------
* Function : "trapInit()".
*/
extern void trapInit()
{
/* Set the trap function for the ERROR signal. */
if (ssignal (C_SIGERR, trapSig) == SIG_ERR) { trapSig (C_SIGTFLT); }
/* Set the trap function for SIGTERM signal. */
if (signal(SIGTERM, trapSig) == SIG_ERR) { trapSig (C_SIGTFLT); }
/* Set the trap function for SIGFPE, SIGBUS and SIGSEGV signals. */
if ( (signal(SIGFPE , trapSig) == SIG_ERR)
|| (signal(SIGBUS , trapSig) == SIG_ERR)
|| (signal(SIGSEGV, trapSig) == SIG_ERR)) trapSig (C_SIGTFLT);
}
/* ------------------------------------------------------------------
* Function : "sendGSignal()".
*/
extern void sendGSignal(aSig)
int aSig;
{
gsignal (aSig);
}
/* ------------------------------------------------------------------
* Function : "setBinName()".
*/
extern void setBinName (asName)
char *asName;
{
strncpy (util_binName, asName, 1023);
}
/* ------------------------------------------------------------------
* Function : "stdflush()".
*/
extern void stdflush()
{
fflush(stdout);
fflush(stderr);
}
/* ------------------------------------------------------------------
* Function : "errMBK()".
*/
extern void errMBK(asName)
char *asName;
{
stdflush();
fprintf(stderr, "\n*** MBK error ***:");
if (asName != (char *)NULL) {
fprintf(stderr, "%s:", asName);
}
}
/* ------------------------------------------------------------------
* Function : "eprinth()".
*/
extern void eprinth(asName)
char *asName;
{
stdflush();
fprintf(stderr, "\n*** Error ***:");
if (asName != (char *)NULL) {
fprintf(stderr, "%s:", asName);
}
}
/* ------------------------------------------------------------------
* Function : "eprintf()".
*/
extern int eprintf __FPV((char *aFormat, ...))
{
va_list ArgList;
__KR_C( char *aFormat; )
int retVal;
__ANSI_C( va_start(ArgList, aFormat); )
__KR_C( va_start(ArgList); )
__KR_C( aFormat = va_arg(ArgList, char*); )
retVal = vfprintf(stderr, aFormat, ArgList);
va_end(ArgList);
return(retVal);
}
/* ------------------------------------------------------------------
* Function : "eprints()".
*/
extern int eprints(aS)
char *aS;
{
return(fputs(aS, stderr));
}
/* ------------------------------------------------------------------
* Function : "warnMBK()".
*/
extern void warnMBK(asName)
char *asName;
{
stdflush();
fprintf(stderr, "*** MBK warning ***:");
if (asName != (char *)NULL) {
fprintf(stderr, "%s:", asName);
}
}
/* ------------------------------------------------------------------
* Function : "wprinth()".
*/
extern void wprinth(asName)
char *asName;
{
stdflush();
fprintf(stderr, "*** Warning ***:");
if (asName != (char *)NULL) {
fprintf(stderr, "%s:", asName);
}
}
/* ------------------------------------------------------------------
* Function : "wprintf()".
*/
extern int wprintf __FPV((char *aFormat, ...))
{
va_list AL;
__KR_C( char *aFormat; )
int RV;
__ANSI_C( va_start(AL, aFormat); )
__KR_C( va_start(AL); )
__KR_C( aFormat = va_arg(AL, char*); )
RV = vfprintf(stderr, aFormat, AL);
va_end(AL);
return(RV);
}
/* ------------------------------------------------------------------
* Function : "wprints()".
*/
extern int wprints(aS)
char *aS;
{
return(fputs(aS, stderr));
}
/* ------------------------------------------------------------------
* Function : "setVL()".
*/
extern void setVL(aVL)
long aVL;
{
switch (aVL) {
case C_VerboseLevel0:
case C_VerboseLevel1:
case C_VerboseLevel2: util_VL = aVL; break;
default: util_VL = C_VerboseLevel2; break;
}
}
/* ------------------------------------------------------------------
* Function : "getVL()".
*/
extern long getVL()
{
return (util_VL);
}
/* ------------------------------------------------------------------
* Function : "vmprintf()".
*/
extern int vmprintf(aVL, aFormat, aArgList)
va_list aArgList;
long aVL;
char *aFormat;
{
int retVal;
if (aVL <= util_VL) {
retVal = vfprintf (stdout, aFormat, aArgList);
} else {
retVal = 0;
}
return (retVal);
}
/* ------------------------------------------------------------------
* Function : "mprintf()".
*/
extern int mprintf __FPV((long aVL, char *aFormat, ...))
{
va_list ArgList;
__KR_C( char aVL; )
__KR_C( char *aFormat; )
int retVal;
__ANSI_C( va_start (ArgList, aFormat); )
__KR_C( va_start (ArgList); )
__KR_C( aVL = va_arg (ArgList, long ); )
__KR_C( aFormat = va_arg (ArgList, char*); )
retVal = vmprintf (aVL, aFormat, ArgList);
va_end(ArgList);
return(retVal);
}
/* ------------------------------------------------------------------
* Function : "mprints()".
*/
extern int mprints(aVL, aS)
long aVL;
char *aS;
{
int retVal;
if (aVL <= util_VL) {
retVal = fputs (aS, stdout);
} else {
retVal = 0;
}
return (retVal);
}
/* ------------------------------------------------------------------
* Function : "mprintf0()".
*/
extern int mprintf0 __FPV((char *aFormat, ...))
{
va_list ArgList;
__KR_C( char *aFormat; )
int retVal;
__ANSI_C( va_start (ArgList, aFormat); )
__KR_C( va_start (ArgList); )
__KR_C( aFormat = va_arg (ArgList, char*); )
retVal = vmprintf (C_VerboseLevel0, aFormat, ArgList);
va_end (ArgList);
return (retVal);
}
/* ------------------------------------------------------------------
* Function : "mprintf1()".
*/
extern int mprintf1 __FPV((char *aFormat, ...))
{
va_list ArgList;
__KR_C( char *aFormat; )
int retVal;
__ANSI_C( va_start (ArgList, aFormat); )
__KR_C( va_start (ArgList); )
__KR_C( aFormat = va_arg (ArgList, char*); )
retVal = vmprintf (C_VerboseLevel1, aFormat, ArgList);
va_end (ArgList);
return (retVal);
}
/* ------------------------------------------------------------------
* Function : "mprintf2()".
*/
extern int mprintf2 __FPV((char *aFormat, ...))
{
va_list ArgList;
__KR_C( char *aFormat; )
int retVal;
__ANSI_C( va_start (ArgList, aFormat); )
__KR_C( va_start (ArgList); )
__KR_C( aFormat = va_arg (ArgList, char*); )
retVal = vmprintf (C_VerboseLevel2, aFormat, ArgList);
va_end (ArgList);
return (retVal);
}
/* ------------------------------------------------------------------
* Function : "util_init()".
*/
extern void util_init(aVL, aFlags, asName)
long aVL;
long aFlags;
char *asName;
{
util_flags = aFlags;
trapInit ();
setVL (aVL);
setBinName (asName);
}
/* ------------------------------------------------------------------
* Function : "s64printf()".
*/
extern char *s64printf __FPV((char *aFormat, ...))
{
va_list aAL;
__KR_C( char *aFormat; )
static char s64[64][SIZE_S64];
static long iS = 0;
__ANSI_C( va_start(aAL, aFormat); )
__KR_C( va_start(aAL); )
__KR_C( aFormat = va_arg(aAL, char*); )
vsprintf(s64[(++iS) % 64] , aFormat, aAL);
va_end(aAL);
return(s64[iS % 64]);
}
/* ------------------------------------------------------------------
* Function : "strtoup()".
*/
extern char *strtoup (aS)
char *aS;
{
char *p;
for (p = aS; *p != '\0'; p++) *p = (char)toupper ((int)*p);
return (aS);
}