Skip to content

Commit d31c420

Browse files
lansergejpc-lip6
authored andcommitted
Fixed gds parse to use type in the textbody as datatype for the gds layer
Fixed aref parsing bug: previously first dx, dy were calculated from xy points and then transformed, also the first point(origin) was not transformed and all these resulted in wrong coordinates(in case of 90, 270 degrees when axis swap) and one of dx or dy been zero, now change to transform xy points first and then calcualte dx, dy.
1 parent d495254 commit d31c420

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

crlcore/src/ccore/gds/GdsParser.cpp

+30-28
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ namespace {
362362
case COLROW: readColrow(); break;
363363
case TEXTNODE: readDummy( false ); break;
364364
case NODE: readDummy( false ); break;
365-
case TEXTTYPE: readDummy( false ); break;
365+
case TEXTTYPE: readDatatype(); break;
366366
case PRESENTATION: readDummy( false ); break;
367367
case SPACING: readDummy( false ); break;
368368
case STRING: readString(); break;
@@ -674,7 +674,7 @@ namespace {
674674
bool readNode ();
675675
bool readBox ();
676676
bool readText ();
677-
bool readTextbody ( const Layer* );
677+
bool readTextbody ( uint16_t gdsLayer );
678678
bool readStrans ();
679679
bool readProperty ();
680680
void xyToAbutmentBox ();
@@ -1038,41 +1038,47 @@ namespace {
10381038

10391039
bool GdsStream::readText ()
10401040
{
1041-
const Layer* layer = NULL;
1041+
uint16_t gdsLayer = 0;
10421042

10431043
cdebug_log(101,1) << "GdsStream::readText()" << endl;
10441044
if (_record.isELFLAGS()) { _stream >> _record; }
10451045
if (_record.isPLEX ()) { _stream >> _record; }
10461046
if (_record.isLAYER ()) {
1047-
layer = gdsToLayer( (uint16_t)_record.getInt16s()[0], 0 );
1048-
if (not layer) {
1049-
cerr << Error( "GdsStream::readText(): No BasicLayer id:%d in GDS conversion table (skipped)."
1050-
, _record.getInt16s()[0]
1051-
) << endl;
1052-
}
1047+
gdsLayer = (uint16_t)_record.getInt16s()[0];
10531048
_stream >> _record;
10541049
} else {
10551050
_validSyntax = false;
10561051
cdebug_tabw(101,-1);
10571052
return _validSyntax;
10581053
}
10591054

1060-
readTextbody( layer );
1055+
readTextbody( gdsLayer );
10611056

10621057
//cdebug(101,0) << "GdsStream::readText() - return:" << _validSyntax << endl;
10631058
cdebug_tabw(101,-1);
10641059
return _validSyntax;
10651060
}
10661061

10671062

1068-
bool GdsStream::readTextbody ( const Layer* layer )
1063+
bool GdsStream::readTextbody ( uint16_t gdsLayer )
10691064
{
1065+
const Layer* layer = NULL;
10701066
cdebug_log(101,1) << "GdsStream::readTextbody()" << endl;
10711067

10721068
DbU::Unit xpos = 0;
10731069
DbU::Unit ypos = 0;
10741070

1075-
if (_record.isTEXTTYPE()) { _stream >> _record; }
1071+
if (_record.isTEXTTYPE()) {
1072+
uint16_t texttype = (uint16_t)_record.getInt16s()[0];
1073+
layer = gdsToLayer( gdsLayer, texttype );
1074+
if (not layer) {
1075+
cerr << Error( "GdsStream::readText(): No BasicLayer %d:%d in GDS conversion table (skipped)."
1076+
, gdsLayer
1077+
, texttype
1078+
) << endl;
1079+
}
1080+
_stream >> _record;
1081+
}
10761082
else {
10771083
_validSyntax = false;
10781084
cdebug_tabw(101,-1);
@@ -1416,20 +1422,10 @@ namespace {
14161422
, m.str().c_str() ) << endl;
14171423
}
14181424
}
1419-
dx = (arrayArea[1].getX() - arrayArea[0].getX()) / columns;
1420-
dy = (arrayArea[2].getY() - arrayArea[0].getY()) / rows;
1421-
if (not dx and (columns > 1))
1422-
cerr << Error( "GdsStream::readAref(): Null dx, but more than one column (%d)."
1423-
, columns ) << endl;
1424-
if (not dy and (rows > 1))
1425-
cerr << Error( "GdsStream::readAref(): Null dy, but more than one row (%d)."
1426-
, rows ) << endl;
14271425
cdebug_log(101,0) << "arrayArea:" << endl;
14281426
cdebug_log(101,0) << "[0] " << arrayArea[0] << endl;
14291427
cdebug_log(101,0) << "[1] " << arrayArea[1] << endl;
14301428
cdebug_log(101,0) << "[2] " << arrayArea[2] << endl;
1431-
cdebug_log(101,0) << "dx=" << DbU::getValueString(dx) << endl;
1432-
cdebug_log(101,0) << "dy=" << DbU::getValueString(dy) << endl;
14331429
_stream >> _record;
14341430
} else {
14351431
_validSyntax = false;
@@ -1441,22 +1437,16 @@ namespace {
14411437
Transformation::Orientation orient = Transformation::Orientation::ID;
14421438
if (_angle == 90.0) {
14431439
orient = Transformation::Orientation::R1;
1444-
std::swap( dx, dy );
1445-
dx = -dx;
14461440
} else if (_angle == 180.0) {
14471441
orient = Transformation::Orientation::R2;
1448-
dy = -dy;
14491442
} else if (_angle == 270.0) {
14501443
orient = Transformation::Orientation::R3;
1451-
std::swap( dx, dy );
1452-
dy = -dy;
14531444
} else if (_angle != 0.0) {
14541445
cerr << Warning( "GdsStream::readAref(): Unsupported angle %d.2 for AREF (Instance) of \"%s\""
14551446
, _angle, masterName.c_str() ) << endl;
14561447
}
14571448

14581449
if (_xReflection) {
1459-
dy = -dy;
14601450
switch ( orient ) {
14611451
case Transformation::Orientation::ID: orient = Transformation::Orientation::MY; break;
14621452
case Transformation::Orientation::R1: orient = Transformation::Orientation::YR; break;
@@ -1468,6 +1458,18 @@ namespace {
14681458
}
14691459
}
14701460
Transformation arrayTransf ( 0, 0, orient );
1461+
for( auto &pt: arrayArea)
1462+
pt = arrayTransf.getPoint(pt);
1463+
dx = (arrayArea[1].getX() - arrayArea[0].getX()) / columns;
1464+
dy = (arrayArea[2].getY() - arrayArea[0].getY()) / rows;
1465+
cdebug_log(101,0) << "dx=" << DbU::getValueString(dx) << endl;
1466+
cdebug_log(101,0) << "dy=" << DbU::getValueString(dy) << endl;
1467+
if (not dx and (columns > 1))
1468+
cerr << Error( "GdsStream::readAref(): Null dx, but more than one column (%d)."
1469+
, columns ) << endl;
1470+
if (not dy and (rows > 1))
1471+
cerr << Error( "GdsStream::readAref(): Null dy, but more than one row (%d)."
1472+
, rows ) << endl;
14711473
for ( uint32_t column=0 ; column < (uint32_t)columns ; ++column ) {
14721474
for ( uint32_t row=0 ; row < (uint32_t)rows ; ++row ) {
14731475
DbU::Unit xpos = arrayArea[0].getX() + column*dx;

0 commit comments

Comments
 (0)