From 07d72b1f3bb02d032b01e71185aacd313fed1f16 Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Sat, 5 Jul 2014 11:43:14 +0200 Subject: [PATCH] Support for wiring rules in RDS. Rounding error in rprparse (second try). * New: In RDS tables, add rules describing the wiring for the router and the cell gauge. This do not scritly respect the fact that RDS deals only with the symbolic to real translation and programs that are purely symbolic should not access it. But is is the simplest way to provides them with default configuration, whithout using environement variables. So now, ocp and nero do read the rds configuration file, but only for the symbolic wiring rules informations. Modification contributed by N. Shimizu. * Change: In , in mbk_utils.c, nowadays all C libraries supplies the tolower() function, so no longer use our own. And besides it was causing problems in the static initialization when both rds and mbk environement where loaded together. Modification contributed by N. Shimizu. * Bug: In , In rprparse.c in RprTranslateParam() there was a rounding error again. We cannot simply adds 0.5 as this function could be called for *negative* values. Instead, use lround() C function (round in opposite directions for positive or negatives integers). --- alliance/src/mbk/src/mbk_util.c | 2 +- alliance/src/nero/src/MMBK.cpp | 6 + alliance/src/nero/src/Makefile.am | 5 +- alliance/src/ocp/src/placer/Makefile.am | 12 +- alliance/src/ocp/src/placer/Ocp.cpp | 8 ++ alliance/src/rds/src/rprparse.c | 140 +++++++++++++++++++++++- alliance/src/rds/src/rprparse.h | 6 +- 7 files changed, 172 insertions(+), 7 deletions(-) diff --git a/alliance/src/mbk/src/mbk_util.c b/alliance/src/mbk/src/mbk_util.c index 872b9bba..88ccfde3 100644 --- a/alliance/src/mbk/src/mbk_util.c +++ b/alliance/src/mbk/src/mbk_util.c @@ -761,7 +761,7 @@ chain_list *pt; #define HASH_FUNC(inputname, name, code) \ do { \ while (*inputname) { \ - *name = tolowertable[(int)*inputname++]; \ + *name = tolower((int)*inputname++); \ code += (code ^ (code >> 1)) + HASH_MULT * (unsigned char) *name++; \ while (code >= HASH_PRIME) \ code -= HASH_PRIME; \ diff --git a/alliance/src/nero/src/MMBK.cpp b/alliance/src/nero/src/MMBK.cpp index 4a7aa34b..2ac13e0e 100644 --- a/alliance/src/nero/src/MMBK.cpp +++ b/alliance/src/nero/src/MMBK.cpp @@ -185,6 +185,10 @@ ostream &operator<< (ostream &o, const CXRect *rect) } +extern "C" { + void rdsenv(); + void loadrdsparam(); +} // ------------------------------------------------------------------- @@ -193,6 +197,8 @@ ostream &operator<< (ostream &o, const CXRect *rect) CEnv::CEnv (void) { // Load the UNIX environmment for MBK. + rdsenv (); + loadrdsparam(); mbkenv (); // Copy constants values from constants namespace ("D::"). diff --git a/alliance/src/nero/src/Makefile.am b/alliance/src/nero/src/Makefile.am index 32874c66..71e28100 100644 --- a/alliance/src/nero/src/Makefile.am +++ b/alliance/src/nero/src/Makefile.am @@ -8,12 +8,14 @@ AM_CXXFLAGS = @ALLIANCE_CFLAGS@ \ -I$(top_srcdir)/aut/src \ -I$(top_srcdir)/beh/src \ -I$(top_srcdir)/genlib/src \ + -I$(top_srcdir)/rds/src \ -I$(top_srcdir)/mbk/src AM_CFLAGS = @ALLIANCE_CFLAGS@ \ -I$(top_srcdir)/abl/src \ -I$(top_srcdir)/aut/src \ -I$(top_srcdir)/beh/src \ -I$(top_srcdir)/genlib/src \ + -I$(top_srcdir)/rds/src \ -I$(top_srcdir)/mbk/src bin_PROGRAMS = nero pdv @@ -23,7 +25,8 @@ nero_LDADD = -L$(libdir) @ALLIANCE_LIBS@ \ ./libU.a \ -L$(top_builddir)/aut/src/.libs \ -L$(top_builddir)/mbk/src/.libs \ - -lMpu -lMlu -lMlo -lMph -lMut -lRcn -lAut + -L$(top_builddir)/rds/src/.libs \ + -lMpu -lRds -lMlu -lMlo -lMph -lMut -lRcn -lAut noinst_LIBRARIES = libU.a diff --git a/alliance/src/ocp/src/placer/Makefile.am b/alliance/src/ocp/src/placer/Makefile.am index b010b667..49093f6f 100644 --- a/alliance/src/ocp/src/placer/Makefile.am +++ b/alliance/src/ocp/src/placer/Makefile.am @@ -4,8 +4,13 @@ YACC = @YACC@ -d INCLUDES = -I$(srcdir)/../common -AM_CXXFLAGS = @ALLIANCE_CFLAGS@ -I$(top_srcdir)/mbk/src -std=gnu++0x -AM_CFLAGS = @ALLIANCE_CFLAGS@ -I$(top_srcdir)/mbk/src +AM_CXXFLAGS = @ALLIANCE_CFLAGS@ \ + -I$(top_srcdir)/rds/src \ + -I$(top_srcdir)/mbk/src \ + -std=gnu++0x +AM_CFLAGS = @ALLIANCE_CFLAGS@ \ + -I$(top_srcdir)/rds/src \ + -I$(top_srcdir)/mbk/src bin_PROGRAMS = ocp @@ -17,7 +22,8 @@ libOcp_a_SOURCES = PElem.cpp PIns.cpp PNet.cpp \ ocp_LDADD = @ALLIANCE_LIBS@ \ ../common/libPCommon.a \ -L$(top_builddir)/mbk/src/.libs \ - -lMpu -lMlu -lMlo -lMph -lMut -lRcn + -L$(top_builddir)/rds/src/.libs \ + -lMpu -lRds -lMlu -lMlo -lMph -lMut -lRcn ocp_SOURCES = Ocp.cpp PBin.cpp PCon.cpp \ PIns.cpp PMove.cpp PNet.cpp PONet.cpp \ diff --git a/alliance/src/ocp/src/placer/Ocp.cpp b/alliance/src/ocp/src/placer/Ocp.cpp index 836cd351..4a56437c 100644 --- a/alliance/src/ocp/src/placer/Ocp.cpp +++ b/alliance/src/ocp/src/placer/Ocp.cpp @@ -33,6 +33,11 @@ using namespace std; #include "mut.h" #include "mph.h" #include "mlo.h" +extern "C" { +#include "rds.h" +#include "rtl.h" +#include "rpr.h" +} #include "PPlacement.h" @@ -161,6 +166,9 @@ main(int argc, char **argv) /* first file in the argument list */ /* ###------------------------------------------------------### */ + //mbkenv(); + rdsenv(); + loadrdsparam (); mbkenv(); alliancebanner ("OCP", VERSION, "Placer for Standards Cells", "2001", ALLIANCE_VERSION); diff --git a/alliance/src/rds/src/rprparse.c b/alliance/src/rds/src/rprparse.c index 55009086..d6ebee95 100644 --- a/alliance/src/rds/src/rprparse.c +++ b/alliance/src/rds/src/rprparse.c @@ -88,6 +88,29 @@ unsigned char RDS_LYNX_TRANSISTOR_TABLE [ MBK_MAX_LAYER ][ RDS_LYNX_TRANSISTOR_FIELD ]; unsigned char RDS_LYNX_DIFFUSION_TABLE [ RDS_ALL_LAYER ][ RDS_LYNX_DIFFUSION_FIELD ]; +extern long MBK_X_GRID, MBK_Y_GRID, MBK_Y_SLICE, MBK_WIDTH_VSS, MBK_WIDTH_VDD, + MBK_TRACK_WIDTH_ALU1, MBK_TRACK_WIDTH_ALU2, + MBK_TRACK_WIDTH_ALU3, MBK_TRACK_WIDTH_ALU4, + MBK_TRACK_WIDTH_ALU5, MBK_TRACK_WIDTH_ALU6, + MBK_TRACK_WIDTH_ALU7, MBK_TRACK_WIDTH_ALU8, + MBK_TRACK_SPACING_ALU1, MBK_TRACK_SPACING_ALU2, + MBK_TRACK_SPACING_ALU3, MBK_TRACK_SPACING_ALU4, + MBK_TRACK_SPACING_ALU5, MBK_TRACK_SPACING_ALU6, + MBK_TRACK_SPACING_ALU7, MBK_TRACK_SPACING_ALU8; + long *RDS_WIRESETTING_TABLE [ MBK_MAX_WIRESETTING ] = +{ + &MBK_TRACK_SPACING_ALU1, &MBK_TRACK_SPACING_ALU2, + &MBK_TRACK_SPACING_ALU3, &MBK_TRACK_SPACING_ALU4, + &MBK_TRACK_SPACING_ALU5, &MBK_TRACK_SPACING_ALU6, + &MBK_TRACK_SPACING_ALU7, &MBK_TRACK_SPACING_ALU8, + &MBK_TRACK_WIDTH_ALU1, &MBK_TRACK_WIDTH_ALU2, + &MBK_TRACK_WIDTH_ALU3, &MBK_TRACK_WIDTH_ALU4, + &MBK_TRACK_WIDTH_ALU5, &MBK_TRACK_WIDTH_ALU6, + &MBK_TRACK_WIDTH_ALU7, &MBK_TRACK_WIDTH_ALU8, + &MBK_WIDTH_VDD, + &MBK_WIDTH_VSS, + &MBK_X_GRID, &MBK_Y_GRID, &MBK_Y_SLICE +}; /*------------------------------------------------------------\ | | | Keywords variables | @@ -123,6 +146,7 @@ static char *TurnViaKeyword; static char *DrcRulesKeword; + static char *WireSettingKeyword; static keyword KeywordDefine [ RPR_MAX_KEYWORD ] = @@ -380,6 +404,33 @@ "CALU9 " }; +#define MBK_MAX_WIRESETTING_TLEN 23 + char MBK_WIRESETTING_NAME [ MBK_MAX_WIRESETTING ][ MBK_MAX_WIRESETTING_TLEN ] = + + { + "track_spacing_alu1", + "track_spacing_alu2", + "track_spacing_alu3", + "track_spacing_alu4", + "track_spacing_alu5", + "track_spacing_alu6", + "track_spacing_alu7", + "track_spacing_alu8", + "track_width_alu1", + "track_width_alu2", + "track_width_alu3", + "track_width_alu4", + "track_width_alu5", + "track_width_alu6", + "track_width_alu7", + "track_width_alu8", + "width_vdd", + "width_vss", + "x_grid", + "y_grid", + "y_slice" + }; + /*------------------------------------------------------------\ | | | File variables | @@ -653,7 +704,11 @@ long RprTranslateParam( Param ) rprerror( RPR_MULTIPLE_GRID, RprBuffer, RprCurrentLine ); } - return( ( long )(Param + 0.5) ); +/* + *fprintf( stderr, "RprTranslateParam() - Param:%.18g rouding:%ld truncated:%ld\n" + * , (Param), lround(Param), (long)(Param) ); + */ + return( lround(Param) ); } /*------------------------------------------------------------\ @@ -1545,6 +1600,80 @@ void RprReadGdsLayer() } } + + +/*------------------------------------------------------------\ +| | +| Rpr Read Wire Settings | +| | +\------------------------------------------------------------*/ + +int RprReadWireComp(const void *x , const void *y) { + return strncmp((char*)x, (char*)y,MBK_MAX_WIRESETTING_TLEN); +} + +void RprReadWireSetting() + +{ + int Layer; + int LayerCount; + int EndTable; + int EndRecord; + char *FirstWord; + void *res; + + EndTable = 0; + LayerCount = 0; + + while ( ( EndTable != 1 ) && + ( LayerCount <= MBK_MAX_WIRESETTING ) ) + { + RprGetLine( RprBuffer ); + + FirstWord = RprGetFirstWord( RprBuffer, 1 ); + Layer = (char (*)[MBK_MAX_WIRESETTING_TLEN])bsearch(FirstWord, MBK_WIRESETTING_NAME[0], + MBK_MAX_WIRESETTING, MBK_MAX_WIRESETTING_TLEN, RprReadWireComp) - MBK_WIRESETTING_NAME; + + if ( FirstWord == EndTableKeyword ) + { + EndTable = 1; + } + else + if ( LayerCount < MBK_MAX_WIRESETTING ) + { + EndRecord = 0; + + FirstWord = RprGetNextWord( 1 ); + + if ( FirstWord == EndRecordKeyword || Layer > MBK_MAX_WIRESETTING || Layer < 0) + { + rprerror( RPR_MISSING_VALUE, (char *)NULL, RprCurrentLine ); + + EndRecord = 1; + } + else + { + *RDS_WIRESETTING_TABLE[ Layer ] = atol( FirstWord ); + + } + + FirstWord = RprGetNextWord( 0 ); + + if ( FirstWord != EndRecordKeyword ) + { + rprerror( RPR_TOO_MANY_WORDS, FirstWord, RprCurrentLine ); + } + } + + LayerCount = LayerCount + 1; + } + + if ( EndTable == 0 ) + { + rprerror( RPR_LINE_EXPECTED, EndTableKeyword, RprCurrentLine); + } +} + /*------------------------------------------------------------\ | | | Rpr Read Post Treat | @@ -2554,6 +2683,13 @@ void RprReadParam() Continue |= RPR_TURNVIA_MASK; } + else + if ( FirstWord == WireSettingKeyword ) + { + RprReadWireSetting(); + + Continue |= RPR_WIRESETTING_MASK; + } else RprSkipTable(); } else @@ -2564,6 +2700,7 @@ void RprReadParam() } else { + if ( (Continue & RPR_ALL_REQUIRED_MASK) == RPR_ALL_REQUIRED_MASK ) return; rprerror( RPR_UNEXPECTED_EOF, (char *)0, RprCurrentLine ); } } @@ -2877,6 +3014,7 @@ void loadrdsparam() TurnViaKeyword = namealloc( TURNVIA_KEYWORD ); DrcRulesKeword = namealloc( DRC_RULES_KEYWORD ); + WireSettingKeyword = namealloc( WIRESETTING_KEYWORD ); KeywordDefined = 1; } diff --git a/alliance/src/rds/src/rprparse.h b/alliance/src/rds/src/rprparse.h index 78984935..03f35e3b 100644 --- a/alliance/src/rds/src/rprparse.h +++ b/alliance/src/rds/src/rprparse.h @@ -33,6 +33,7 @@ # define RPR_MAX_BUFFER 512 # define RPR_MAX_KEYWORD 151 +# define MBK_MAX_WIRESETTING 21 # define RPR_SEPARATORS_STRING " \t\n" # define RPR_COMMENT_CHAR '#' @@ -55,6 +56,7 @@ # define TURNVIA_KEYWORD "MBK_TO_RDS_TURNVIA" # define CONNECTOR_KEYWORD "MBK_TO_RDS_CONNECTOR" # define REFERENCE_KEYWORD "MBK_TO_RDS_REFERENCE" +# define WIRESETTING_KEYWORD "MBK_WIRESETTING" # define CIF_LAYER_KEYWORD "CIF_LAYER" # define GDS_LAYER_KEYWORD "GDS_LAYER" # define S2R_POST_TREAT_KEYWORD "S2R_POST_TREAT" @@ -98,8 +100,10 @@ # define RPR_BIGVIA_HOLE_MASK 0x040000 # define RPR_BIGVIA_METAL_MASK 0x080000 # define RPR_TURNVIA_MASK 0x100000 +# define RPR_WIRESETTING_MASK 0x200000 -# define RPR_ALL_DEFINED_MASK 0x1FFFFF +# define RPR_ALL_DEFINED_MASK 0x3FFFFF +# define RPR_ALL_REQUIRED_MASK 0x1FFFFF /*------------------------------------------------------------\