Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odb: gds structure improvements #6459

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
123 changes: 47 additions & 76 deletions src/odb/include/odb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ class dbAccessPoint;
class dbBusPort;
class dbDft;
class dbGCellGrid;
class dbGDSARef;
class dbGDSBoundary;
class dbGDSBox;
class dbGDSNode;
class dbGDSPath;
class dbGDSSRef;
class dbGDSStructure;
Expand Down Expand Up @@ -5827,22 +5827,6 @@ class dbGDSLib : public dbObject

std::string getLibname() const;

void set_lastAccessed(std::tm lastAccessed);

std::tm get_lastAccessed() const;

void set_lastModified(std::tm lastModified);

std::tm get_lastModified() const;

void set_libDirSize(int16_t libDirSize);

int16_t get_libDirSize() const;

void set_srfName(std::string srfName);

std::string get_srfName() const;

void setUnits(double uu_per_dbu, double dbu_per_meter);

std::pair<double, double> getUnits() const;
Expand Down Expand Up @@ -7457,31 +7441,43 @@ class dbGCellGrid : public dbObject
// User Code End dbGCellGrid
};

class dbGDSBoundary : public dbObject
class dbGDSARef : public dbObject
{
public:
void setLayer(int16_t layer);
void setOrigin(Point origin);

int16_t getLayer() const;
Point getOrigin() const;

void setDatatype(int16_t datatype);
void setLr(Point lr);

int16_t getDatatype() const;
Point getLr() const;

void setXy(const std::vector<Point>& xy);
void setUl(Point ul);

void getXy(std::vector<Point>& tbl) const;
Point getUl() const;

// User Code Begin dbGDSBoundary
const std::vector<Point>& getXY();
void setTransform(dbGDSSTrans transform);

dbGDSSTrans getTransform() const;

void setNumRows(int16_t num_rows);

int16_t getNumRows() const;

void setNumColumns(int16_t num_columns);

int16_t getNumColumns() const;

// User Code Begin dbGDSARef
dbGDSStructure* getStructure() const;
std::vector<std::pair<std::int16_t, std::string>>& getPropattr();

static dbGDSBoundary* create(dbGDSStructure* structure);
static void destroy(dbGDSBoundary* boundary);
// User Code End dbGDSBoundary
static dbGDSARef* create(dbGDSStructure* parent, dbGDSStructure* child);
static void destroy(dbGDSARef* aref);
// User Code End dbGDSARef
};

class dbGDSBox : public dbObject
class dbGDSBoundary : public dbObject
{
public:
void setLayer(int16_t layer);
Expand All @@ -7496,16 +7492,16 @@ class dbGDSBox : public dbObject

void getXy(std::vector<Point>& tbl) const;

// User Code Begin dbGDSBox
// User Code Begin dbGDSBoundary
const std::vector<Point>& getXY();
std::vector<std::pair<std::int16_t, std::string>>& getPropattr();

static dbGDSBox* create(dbGDSStructure* structure);
static void destroy(dbGDSBox* box);
// User Code End dbGDSBox
static dbGDSBoundary* create(dbGDSStructure* structure);
static void destroy(dbGDSBoundary* boundary);
// User Code End dbGDSBoundary
};

class dbGDSNode : public dbObject
class dbGDSBox : public dbObject
{
public:
void setLayer(int16_t layer);
Expand All @@ -7516,17 +7512,16 @@ class dbGDSNode : public dbObject

int16_t getDatatype() const;

void setXy(const std::vector<Point>& xy);
void setBounds(Rect bounds);

void getXy(std::vector<Point>& tbl) const;
Rect getBounds() const;

// User Code Begin dbGDSNode
const std::vector<Point>& getXY();
// User Code Begin dbGDSBox
std::vector<std::pair<std::int16_t, std::string>>& getPropattr();

static dbGDSNode* create(dbGDSStructure* structure);
static void destroy(dbGDSNode* node);
// User Code End dbGDSNode
static dbGDSBox* create(dbGDSStructure* structure);
static void destroy(dbGDSBox* box);
// User Code End dbGDSBox
};

class dbGDSPath : public dbObject
Expand All @@ -7548,9 +7543,9 @@ class dbGDSPath : public dbObject

int getWidth() const;

void set_pathType(int16_t pathType);
void setPathType(int16_t path_type);

int16_t get_pathType() const;
int16_t getPathType() const;

// User Code Begin dbGDSPath
const std::vector<Point>& getXY();
Expand All @@ -7564,38 +7559,19 @@ class dbGDSPath : public dbObject
class dbGDSSRef : public dbObject
{
public:
void setLayer(int16_t layer);
void setOrigin(Point origin);

int16_t getLayer() const;

void setDatatype(int16_t datatype);

int16_t getDatatype() const;

void setXy(const std::vector<Point>& xy);

void getXy(std::vector<Point>& tbl) const;

void set_sName(const std::string& sName);

std::string get_sName() const;
Point getOrigin() const;

void setTransform(dbGDSSTrans transform);

dbGDSSTrans getTransform() const;

void set_colRow(const std::pair<int16_t, int16_t>& colRow);

std::pair<int16_t, int16_t> get_colRow() const;

// User Code Begin dbGDSSRef
const std::vector<Point>& getXY();
std::vector<std::pair<std::int16_t, std::string>>& getPropattr();

dbGDSStructure* getStructure() const;
void setStructure(dbGDSStructure* structure) const;
std::vector<std::pair<std::int16_t, std::string>>& getPropattr();

static dbGDSSRef* create(dbGDSStructure* structure);
static dbGDSSRef* create(dbGDSStructure* parent, dbGDSStructure* child);
static void destroy(dbGDSSRef* sref);
// User Code End dbGDSSRef
};
Expand All @@ -7609,12 +7585,12 @@ class dbGDSStructure : public dbObject

dbSet<dbGDSBox> getGDSBoxs() const;

dbSet<dbGDSNode> getGDSNodes() const;

dbSet<dbGDSPath> getGDSPaths() const;

dbSet<dbGDSSRef> getGDSSRefs() const;

dbSet<dbGDSARef> getGDSARefs() const;

dbSet<dbGDSText> getGDSTexts() const;

// User Code Begin dbGDSStructure
Expand All @@ -7638,18 +7614,14 @@ class dbGDSText : public dbObject

int16_t getDatatype() const;

void setXy(const std::vector<Point>& xy);
void setOrigin(Point origin);

void getXy(std::vector<Point>& tbl) const;
Point getOrigin() const;

void setPresentation(dbGDSTextPres presentation);

dbGDSTextPres getPresentation() const;

void setWidth(int width);

int getWidth() const;

void setTransform(dbGDSSTrans transform);

dbGDSSTrans getTransform() const;
Expand All @@ -7659,7 +7631,6 @@ class dbGDSText : public dbObject
std::string getText() const;

// User Code Begin dbGDSText
const std::vector<Point>& getXY();
std::vector<std::pair<std::int16_t, std::string>>& getPropattr();

static dbGDSText* create(dbGDSStructure* structure);
Expand Down
14 changes: 7 additions & 7 deletions src/odb/include/odb/dbCompare.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,28 +527,28 @@ struct less<odb::dbGCellGrid*>
};

template <>
struct less<odb::dbGDSBoundary*>
struct less<odb::dbGDSARef*>
{
bool operator()(const odb::dbGDSBoundary* lhs,
const odb::dbGDSBoundary* rhs) const
bool operator()(const odb::dbGDSARef* lhs, const odb::dbGDSARef* rhs) const
{
return odb::compare_by_id(lhs, rhs);
}
};

template <>
struct less<odb::dbGDSBox*>
struct less<odb::dbGDSBoundary*>
{
bool operator()(const odb::dbGDSBox* lhs, const odb::dbGDSBox* rhs) const
bool operator()(const odb::dbGDSBoundary* lhs,
const odb::dbGDSBoundary* rhs) const
{
return odb::compare_by_id(lhs, rhs);
}
};

template <>
struct less<odb::dbGDSNode*>
struct less<odb::dbGDSBox*>
{
bool operator()(const odb::dbGDSNode* lhs, const odb::dbGDSNode* rhs) const
bool operator()(const odb::dbGDSBox* lhs, const odb::dbGDSBox* rhs) const
{
return odb::compare_by_id(lhs, rhs);
}
Expand Down
2 changes: 1 addition & 1 deletion src/odb/include/odb/dbObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ enum dbObjectType
dbBusPortObj,
dbDftObj,
dbGCellGridObj,
dbGDSARefObj,
dbGDSBoundaryObj,
dbGDSBoxObj,
dbGDSNodeObj,
dbGDSPathObj,
dbGDSSRefObj,
dbGDSStructureObj,
Expand Down
3 changes: 1 addition & 2 deletions src/odb/include/odb/dbTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,11 @@ class dbGDSSTrans
{
public:
bool _flipX;
bool _absMag, _absAngle;
double _mag, _angle;

dbGDSSTrans();

dbGDSSTrans(bool flipX, bool absMag, bool absAngle, double mag, double angle);
dbGDSSTrans(bool flipX, double mag, double angle);

bool operator==(const dbGDSSTrans& rhs) const;

Expand Down
5 changes: 0 additions & 5 deletions src/odb/include/odb/gdsUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,5 @@ std::map<std::pair<int16_t, int16_t>, std::string> getLayerMap(
*/
dbGDSLib* createEmptyGDSLib(dbDatabase* db, const std::string& libname);

/**
* Sets timestamp on a GDSII library object to the current time
*/
void stampGDSLib(dbGDSLib* lib, bool modified = true);

} // namespace gds
} // namespace odb
20 changes: 9 additions & 11 deletions src/odb/include/odb/gdsin.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ class GDSReader
dbGDSBoundary* processBoundary(dbGDSStructure* structure);
dbGDSPath* processPath(dbGDSStructure* structure);
dbGDSSRef* processSRef(dbGDSStructure* structure);
dbGDSARef* processARef(dbGDSStructure* structure);
dbGDSText* processText(dbGDSStructure* structure);
dbGDSBox* processBox(dbGDSStructure* structure);
dbGDSNode* processNode(dbGDSStructure* structure);
void processNode();

/**
* Parses special attributes of a GDS Element
Expand All @@ -142,11 +143,9 @@ class GDSReader
/**
* Parses the XY data of a GDS Element
*
* @param elem The GDS Element to add the XY data to
* @return true if the XY data was successfully read
* @return The XY data
*/
template <typename T>
bool processXY(T* elem);
std::vector<Point> processXY();

/**
* Parses a GDS STrans from the GDS file
Expand All @@ -160,12 +159,6 @@ class GDSReader
*/
dbGDSTextPres processTextPres();

/**
* This function is called after the entire GDS file has been read to bind all
* SRefs with the pointers to the referenced structures.
*/
void bindAllSRefs();

/** Current filestream */
std::ifstream _file;
/** Most recently read record */
Expand All @@ -174,6 +167,11 @@ class GDSReader
dbDatabase* _db = nullptr;
/** Current GDS Lib object */
dbGDSLib* _lib = nullptr;
/** An sref may refer to a structure that isn't yet built while
reading the gds. We will make an empty structure but it isn't
yet defined. We keep track of defined structures to catch any
duplicates.*/
std::set<dbGDSStructure*> _defined;

utl::Logger* _logger{nullptr};
};
Expand Down
2 changes: 1 addition & 1 deletion src/odb/include/odb/gdsout.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ class GDSWriter
void writeBoundary(dbGDSBoundary* bnd);
void writePath(dbGDSPath* path);
void writeSRef(dbGDSSRef* sref);
void writeARef(dbGDSARef* aref);
void writeText(dbGDSText* text);
void writeBox(dbGDSBox* box);
void writeNode(dbGDSNode* node);

/** Writes a Transform to _file */
void writeSTrans(const dbGDSSTrans& strans);
Expand Down
12 changes: 6 additions & 6 deletions src/odb/src/codeGenerator/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,6 @@
"type": "1_n",
"tbl_name": "boxes_"
},
{
"first": "dbGDSStructure",
"second": "dbGDSNode",
"type": "1_n",
"tbl_name": "nodes_"
},
{
"first": "dbGDSStructure",
"second": "dbGDSPath",
Expand All @@ -342,6 +336,12 @@
"type": "1_n",
"tbl_name": "srefs_"
},
{
"first": "dbGDSStructure",
"second": "dbGDSARef",
"type": "1_n",
"tbl_name": "arefs_"
},
{
"first": "dbGDSStructure",
"second": "dbGDSText",
Expand Down
Loading
Loading