Package com.ohrasys.cad.gds Description
Provides a set of objects that can be used to import, create and export
GDSII database records. GDSII is the primary format used to transfer
physical data representing circuit layout generated from EDA/CAD tools .
The GDSII stream format is originally based on the CALMA format which is now
obsolete. Below is a Bachus Naur representation of the GDSII stream syntax.
<stream> ::
HEADER BGNLIB [LIBDIRSIZE] [SRFNAME] [LIBSECUR]
LIBNAME [REFLIBS] [FONTS] [ATTRTABLE]
[GENERATIONS] [<formattype>] UNITS {<structure>}*
ENDLIB
<formattype> ::
FORMAT | FORMAT {MASK}+ ENDMASKS
<structure> ::
BGNSTR STRNAME [STRCLASS] {<element>}* ENDSTR
<element> ::
{<boundary> | <path> | <sref> | <aref> |
<text> | <node> | <box>} {<property>}*
<boundary> ::
BOUNDARY [ELFLAGS] [PLEX] LAYER DATATYPE XY
<path> ::
PATH [ELFLAGS] [PLEX] LAYER DATATYPE [PATHTYPE] [WIDTH] [BGNEXTN]
[ENDEXTN] XY
<sref> ::
SREF [ELFLAGS] [PLEX] SNAME [<strans>] XY
<aref> ::
AREF [ELFLAGS] [PLEX] SNAME [<strans>] COLROW XY
<text> ::
TEXT [ELFLAGS] [PLEX] LAYER <textbody>
<node> ::
NODE [ELFLAGS] [PLEX] LAYER NODETYPE XY
<box> ::
BOX [ELFLAGS] [PLEX] LAYER BOXTYPE XY
<textbody> ::
TEXTTYPE [PRESENTATION] [PATHTYPE] [WIDTH] [<strans>] XY STRING
<strans> ::
STRANS [MAG] [ANGLE]
<property> ::
PROPATTR PROPVALUE
Please see
The GDSII techincal reference for a more complete discussion of
the GDSII stream syntax.
|
Example Code Snippet
This example shows how to parse a GDSII stream using the GDSParser object.
public List parseDesign(InputStream in, OutputStream out) {
GDSStatistics stats = new GDSStatistics();
DatabaseValidator isValid = new DatabaseValidator();
boolean resultVld = true;
List records = new ArrayList(estimateSize(in));
stats.clear();
isValid.reset();
GDSRecord record = null;
GDSInputStream gdsin = new GDSInputStream(in);
try {
while((record = gdsin.readRecord()) != null) {
try {
if(isValid.test(record.getRectype()) == isValid.FAILED)
throw new GDSRecordException("Test failed");
} catch(BNFTestException e) {
throw new GDSRecordException(e.getMessage());
}
stats.record(record);
records.add(record);
if(record.getRectype() != GDSRecord.NULL)
write(record.toString(), out);
}
} catch(GDSRecordException e) {
write(e.getMessage(), out);
resultVld = false;
}
close();
if(resultVld)
{return records;} else
{return null;}
}
|