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 <mbk>, 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 <rds>, 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).
This commit is contained in:
Jean-Paul Chaput 2014-07-05 11:43:14 +02:00
parent 95df9fdef1
commit 07d72b1f3b
7 changed files with 172 additions and 7 deletions

View File

@ -761,7 +761,7 @@ chain_list *pt;
#define HASH_FUNC(inputname, name, code) \ #define HASH_FUNC(inputname, name, code) \
do { \ do { \
while (*inputname) { \ while (*inputname) { \
*name = tolowertable[(int)*inputname++]; \ *name = tolower((int)*inputname++); \
code += (code ^ (code >> 1)) + HASH_MULT * (unsigned char) *name++; \ code += (code ^ (code >> 1)) + HASH_MULT * (unsigned char) *name++; \
while (code >= HASH_PRIME) \ while (code >= HASH_PRIME) \
code -= HASH_PRIME; \ code -= HASH_PRIME; \

View File

@ -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) CEnv::CEnv (void)
{ {
// Load the UNIX environmment for MBK. // Load the UNIX environmment for MBK.
rdsenv ();
loadrdsparam();
mbkenv (); mbkenv ();
// Copy constants values from constants namespace ("D::"). // Copy constants values from constants namespace ("D::").

View File

@ -8,12 +8,14 @@ AM_CXXFLAGS = @ALLIANCE_CFLAGS@ \
-I$(top_srcdir)/aut/src \ -I$(top_srcdir)/aut/src \
-I$(top_srcdir)/beh/src \ -I$(top_srcdir)/beh/src \
-I$(top_srcdir)/genlib/src \ -I$(top_srcdir)/genlib/src \
-I$(top_srcdir)/rds/src \
-I$(top_srcdir)/mbk/src -I$(top_srcdir)/mbk/src
AM_CFLAGS = @ALLIANCE_CFLAGS@ \ AM_CFLAGS = @ALLIANCE_CFLAGS@ \
-I$(top_srcdir)/abl/src \ -I$(top_srcdir)/abl/src \
-I$(top_srcdir)/aut/src \ -I$(top_srcdir)/aut/src \
-I$(top_srcdir)/beh/src \ -I$(top_srcdir)/beh/src \
-I$(top_srcdir)/genlib/src \ -I$(top_srcdir)/genlib/src \
-I$(top_srcdir)/rds/src \
-I$(top_srcdir)/mbk/src -I$(top_srcdir)/mbk/src
bin_PROGRAMS = nero pdv bin_PROGRAMS = nero pdv
@ -23,7 +25,8 @@ nero_LDADD = -L$(libdir) @ALLIANCE_LIBS@ \
./libU.a \ ./libU.a \
-L$(top_builddir)/aut/src/.libs \ -L$(top_builddir)/aut/src/.libs \
-L$(top_builddir)/mbk/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 noinst_LIBRARIES = libU.a

View File

@ -4,8 +4,13 @@ YACC = @YACC@ -d
INCLUDES = -I$(srcdir)/../common INCLUDES = -I$(srcdir)/../common
AM_CXXFLAGS = @ALLIANCE_CFLAGS@ -I$(top_srcdir)/mbk/src -std=gnu++0x AM_CXXFLAGS = @ALLIANCE_CFLAGS@ \
AM_CFLAGS = @ALLIANCE_CFLAGS@ -I$(top_srcdir)/mbk/src -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 bin_PROGRAMS = ocp
@ -17,7 +22,8 @@ libOcp_a_SOURCES = PElem.cpp PIns.cpp PNet.cpp \
ocp_LDADD = @ALLIANCE_LIBS@ \ ocp_LDADD = @ALLIANCE_LIBS@ \
../common/libPCommon.a \ ../common/libPCommon.a \
-L$(top_builddir)/mbk/src/.libs \ -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 \ ocp_SOURCES = Ocp.cpp PBin.cpp PCon.cpp \
PIns.cpp PMove.cpp PNet.cpp PONet.cpp \ PIns.cpp PMove.cpp PNet.cpp PONet.cpp \

View File

@ -33,6 +33,11 @@ using namespace std;
#include "mut.h" #include "mut.h"
#include "mph.h" #include "mph.h"
#include "mlo.h" #include "mlo.h"
extern "C" {
#include "rds.h"
#include "rtl.h"
#include "rpr.h"
}
#include "PPlacement.h" #include "PPlacement.h"
@ -161,6 +166,9 @@ main(int argc, char **argv)
/* first file in the argument list */ /* first file in the argument list */
/* ###------------------------------------------------------### */ /* ###------------------------------------------------------### */
//mbkenv();
rdsenv();
loadrdsparam ();
mbkenv(); mbkenv();
alliancebanner ("OCP", VERSION, "Placer for Standards Cells", "2001", ALLIANCE_VERSION); alliancebanner ("OCP", VERSION, "Placer for Standards Cells", "2001", ALLIANCE_VERSION);

View File

@ -88,6 +88,29 @@
unsigned char RDS_LYNX_TRANSISTOR_TABLE [ MBK_MAX_LAYER ][ RDS_LYNX_TRANSISTOR_FIELD ]; 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 ]; 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 | | Keywords variables |
@ -123,6 +146,7 @@
static char *TurnViaKeyword; static char *TurnViaKeyword;
static char *DrcRulesKeword; static char *DrcRulesKeword;
static char *WireSettingKeyword;
static keyword KeywordDefine [ RPR_MAX_KEYWORD ] = static keyword KeywordDefine [ RPR_MAX_KEYWORD ] =
@ -380,6 +404,33 @@
"CALU9 " "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 | | File variables |
@ -653,7 +704,11 @@ long RprTranslateParam( Param )
rprerror( RPR_MULTIPLE_GRID, RprBuffer, RprCurrentLine ); 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 | | Rpr Read Post Treat |
@ -2554,6 +2683,13 @@ void RprReadParam()
Continue |= RPR_TURNVIA_MASK; Continue |= RPR_TURNVIA_MASK;
} }
else
if ( FirstWord == WireSettingKeyword )
{
RprReadWireSetting();
Continue |= RPR_WIRESETTING_MASK;
}
else RprSkipTable(); else RprSkipTable();
} }
else else
@ -2564,6 +2700,7 @@ void RprReadParam()
} }
else else
{ {
if ( (Continue & RPR_ALL_REQUIRED_MASK) == RPR_ALL_REQUIRED_MASK ) return;
rprerror( RPR_UNEXPECTED_EOF, (char *)0, RprCurrentLine ); rprerror( RPR_UNEXPECTED_EOF, (char *)0, RprCurrentLine );
} }
} }
@ -2877,6 +3014,7 @@ void loadrdsparam()
TurnViaKeyword = namealloc( TURNVIA_KEYWORD ); TurnViaKeyword = namealloc( TURNVIA_KEYWORD );
DrcRulesKeword = namealloc( DRC_RULES_KEYWORD ); DrcRulesKeword = namealloc( DRC_RULES_KEYWORD );
WireSettingKeyword = namealloc( WIRESETTING_KEYWORD );
KeywordDefined = 1; KeywordDefined = 1;
} }

View File

@ -33,6 +33,7 @@
# define RPR_MAX_BUFFER 512 # define RPR_MAX_BUFFER 512
# define RPR_MAX_KEYWORD 151 # define RPR_MAX_KEYWORD 151
# define MBK_MAX_WIRESETTING 21
# define RPR_SEPARATORS_STRING " \t\n" # define RPR_SEPARATORS_STRING " \t\n"
# define RPR_COMMENT_CHAR '#' # define RPR_COMMENT_CHAR '#'
@ -55,6 +56,7 @@
# define TURNVIA_KEYWORD "MBK_TO_RDS_TURNVIA" # define TURNVIA_KEYWORD "MBK_TO_RDS_TURNVIA"
# define CONNECTOR_KEYWORD "MBK_TO_RDS_CONNECTOR" # define CONNECTOR_KEYWORD "MBK_TO_RDS_CONNECTOR"
# define REFERENCE_KEYWORD "MBK_TO_RDS_REFERENCE" # define REFERENCE_KEYWORD "MBK_TO_RDS_REFERENCE"
# define WIRESETTING_KEYWORD "MBK_WIRESETTING"
# define CIF_LAYER_KEYWORD "CIF_LAYER" # define CIF_LAYER_KEYWORD "CIF_LAYER"
# define GDS_LAYER_KEYWORD "GDS_LAYER" # define GDS_LAYER_KEYWORD "GDS_LAYER"
# define S2R_POST_TREAT_KEYWORD "S2R_POST_TREAT" # define S2R_POST_TREAT_KEYWORD "S2R_POST_TREAT"
@ -98,8 +100,10 @@
# define RPR_BIGVIA_HOLE_MASK 0x040000 # define RPR_BIGVIA_HOLE_MASK 0x040000
# define RPR_BIGVIA_METAL_MASK 0x080000 # define RPR_BIGVIA_METAL_MASK 0x080000
# define RPR_TURNVIA_MASK 0x100000 # 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
/*------------------------------------------------------------\ /*------------------------------------------------------------\