LEF/DEF: Fixed placement of FOREIGN cell

This commit is contained in:
Matthias Koefferlein 2020-05-01 15:16:08 +02:00
parent 9f17a819b2
commit 751340c963
9 changed files with 34 additions and 62 deletions

View File

@ -827,17 +827,19 @@ LEFImporter::read_macro (Layout &layout)
layout.cell (ci).set_ghost_cell (true);
}
db::Point origin;
db::Point vec;
db::FTrans ft;
if (! peek (";")) {
origin = get_point (1.0 / layout.dbu ());
vec = get_point (1.0 / layout.dbu ());
ft = get_orient (true);
}
expect (";");
foreign_cell = &layout.cell (ci);
foreign_trans = (db::Trans (origin - db::Point ()) * db::Trans (ft)).inverted ();
// What is the definition of the FOREIGN transformation?
// Guessing: this transformation moves the lower-left origin to 0,0
foreign_trans = db::Trans (db::Point () - vec) * db::Trans (ft);
foreign_name = cn;
} else if (test ("OBS")) {
@ -899,7 +901,7 @@ LEFImporter::read_macro (Layout &layout)
cell.clear_insts ();
cell.insert (db::CellInstArray (db::CellInst (foreign_cell->cell_index ()), foreign_trans));
cell.insert (db::CellInstArray (db::CellInst (foreign_cell->cell_index ()), db::Trans (db::Point () - origin) * foreign_trans));
m_macros_by_name.insert (std::make_pair (mn, std::make_pair (&cell, db::Trans ())));
} else {
@ -907,7 +909,7 @@ LEFImporter::read_macro (Layout &layout)
// use FOREIGN cell instead of new one
layout.delete_cell (cell.cell_index ());
m_macros_by_name.insert (std::make_pair (mn, std::make_pair (foreign_cell, foreign_trans)));
m_macros_by_name.insert (std::make_pair (mn, std::make_pair (foreign_cell, db::Trans (db::Point () - origin) * foreign_trans)));
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,7 @@ DIEAREA ( 0 0 ) ( 1000 2000 ) ;
COMPONENTS 3 ;
- macro1 macro1 + PLACED ( 0 0 ) N ;
- macro2 macro2 + PLACED ( 0 500 ) N ;
- macro2 macro2 + PLACED ( 0 500 ) E ;
- macro3 macro3 + PLACED ( 0 1000 ) N ;
END COMPONENTS

View File

@ -1,48 +1,21 @@
MACRO macro1
CLASS CORE ;
FOREIGN foreign1 0.5 -0.2 W ;
ORIGIN 0.000 0.000 ;
SIZE 0.384 BY 0.480 ;
PIN Z
PORT
LAYER M1 ;
RECT 0.306 0.357 0.318 0.403 ;
RECT 0.318 0.115 0.352 0.403 ;
VIA 0.336 0.167 square ;
VIA 0.336 0.351 square ;
END
END Z
FOREIGN foreign1 0.13 0.5 W ;
ORIGIN 0.035 0.235 ;
SIZE 0.07 BY 0.47 ;
END macro1
MACRO macro2
CLASS CORE ;
FOREIGN foreign2 -0.15 0.25 ;
ORIGIN 0.000 0.000 ;
SIZE 0.384 BY 0.480 ;
PIN Z
PORT
LAYER M1 ;
RECT 0.306 0.357 0.318 0.403 ;
RECT 0.318 0.115 0.352 0.403 ;
VIA 0.336 0.167 square ;
VIA 0.336 0.351 square ;
END
END Z
FOREIGN foreign2 -0.15 0.25 ;
ORIGIN 0.235 0.035 ;
SIZE 0.47 BY 0.07 ;
END macro2
MACRO macro3
CLASS CORE ;
FOREIGN macro3 ;
ORIGIN 0.000 0.000 ;
SIZE 0.384 BY 0.480 ;
PIN Z
PORT
LAYER M1 ;
RECT 0.306 0.357 0.318 0.403 ;
RECT 0.318 0.115 0.352 0.403 ;
VIA 0.336 0.167 square ;
VIA 0.336 0.351 square ;
END
END Z
FOREIGN macro3 -1.0 1.0 ;
ORIGIN 0.0 0.0 ;
SIZE 1.0 BY 0.4 ;
END macro3

View File

@ -1,46 +1,43 @@
MACRO macro1
CLASS CORE ;
ORIGIN 0.000 0.000 ;
SIZE 0.384 BY 0.480 ;
ORIGIN 0.035 0.235 ;
SIZE 0.07 BY 0.47 ;
PIN Z
PORT
LAYER M1 ;
RECT 0.306 0.357 0.318 0.403 ;
RECT 0.318 0.115 0.352 0.403 ;
VIA 0.336 0.167 square ;
VIA 0.336 0.351 square ;
RECT -0.02 0 0.02 0.2 ;
RECT -0.03 -0.2 0.01 -0.1 ;
VIA 0.0 0.2 square ;
VIA 0.01 -0.2 square ;
END
END Z
END macro1
MACRO macro2
CLASS CORE ;
FOREIGN foreign2 -0.15 0.25 ;
ORIGIN 0.000 0.000 ;
SIZE 0.384 BY 0.480 ;
FOREIGN foreign2 -0.15 0.25 ;
ORIGIN 0.235 0.035 ;
SIZE 0.47 BY 0.07 ;
PIN Z
PORT
LAYER M1 ;
RECT 0.306 0.357 0.318 0.403 ;
RECT 0.318 0.115 0.352 0.403 ;
VIA 0.336 0.167 square ;
VIA 0.336 0.351 square ;
RECT 0 -0.02 -0.2 0.02 ;
RECT 0.2 -0.03 0.1 0.01 ;
VIA -0.2 0.0 square ;
VIA 0.2 0.01 square ;
END
END Z
END macro2
MACRO macro3
CLASS CORE ;
FOREIGN macro3 ;
ORIGIN 0.000 0.000 ;
SIZE 0.384 BY 0.480 ;
FOREIGN macro3 -1.0 1.0 ;
ORIGIN 0.0 0.0 ;
SIZE 1.0 BY 1.0 ;
PIN Z
PORT
LAYER M1 ;
RECT 0.306 0.357 0.318 0.403 ;
RECT 0.318 0.115 0.352 0.403 ;
VIA 0.336 0.167 square ;
VIA 0.336 0.351 square ;
RECT 0.2 0.2 0.3 0.5 ;
END
END Z
END macro3