6
CDBA Input and Output Functions
This chapter covers the following topics on input and output functions:
- UNIX Directory Paths
- Routines Returning Directory Paths
- Initialization and Exit Functions
- Input and Output Functions
- Hierarchy Traversal Functions
- Operations on Cellviews
- Counter Functions
- Database I/O Functions
UNIX Directory Paths
The UNIX file system is based on a hierarchical directory structure. The base of the directory hierarchy is known as the root and is represented by the slash character ( / ) as the first character in a directory or file name. In UNIX terminology, the traversal from the root directory, through descendent directories, to a particular file in the hierarchy, is called a path. Thus, a directory path is equivalent to a UNIX filename.
In the UNIX environment, there are two ways to refer to a file name: “full directory path” and “relative directory path.” The full directory path specifies the means of traversal from the root directory to the target file. An example is
/cds/etc/cdslib/schema/nand2/schematic/sch.oa
The relative directory path does not begin with a slash ( / ). For example, if /usr/me/mylib is the current directory, the directory under which you started the program, you can also use the directory path nand2/schematic/sch.oa to refer to the following file:
/usr/me/mylib/nand2/schematic/sch.oa
CDBA recognizes the following directory naming conventions:
Routines Returning Directory Paths
Certain routines return a UNIX directory path, or file name, to the calling routine. For example, dbGetCellViewFullDirPath(cellViewId) returns the full directory path for the file containing the database representation corresponding to cellViewId. The string returned is called a cellview string, because it is contained in the cellview in virtual memory. When the cellview is closed, the cellview string becomes invalid.
Initialization and Exit Functions
The following functions initialize and exit CDBA.
dbInit
Boolean
dbInit( int argc, char argv );
Description
Starts all applications. You must call the dbInit function in the first executable statement of the main routine for the applications to initialize the CDBA functions. dbInit might fail if your system does not have adequate virtual memory or has not been properly configured.
The argc and argv variables are the same variables used by the C language to pass command line arguments to the main program. Notice the first argument to dbInit is a pointer to argc rather than the argc variable itself. This is because dbInit scans the command line arguments searching for special switches intended for CDBA.
If such switches are found, dbInit modifies the command line arguments, stored in argc and argv, to remove the switches intended for CDBA. All command line switches used by CDBA begin with the prefix db and follow the standard CDBA naming conventions.
dbExit
Boolean
dbExit( );
Description
Exits CDBA. You call dbExit after all database work is complete (usually just before calling exit). The dbExit function releases all libraries locked when CDBA is run, and purges any libraries opened within CDBA. The dbExit function always returns TRUE.
ilInitClients
void
ilInitClients( int *, char *[], void *, int );
Description
Initializes SKILL within the itkDB environment. This function is called after the dbInit() call. Without a call to this function:
- SKILL PCells are not evaluated within itkDB.
-
SKILL startup files, such as
libInit.ilassociated with techLibs are not loaded properly.
Additionally, to use this function for itkDB applications, set the third argument to NULL and the fourth argument to 0.
Example
if ( !dbInit(&argc, argv) )
{
(void) fprintf(stderr, "dbInit failed.\n");
exit( 1 );
}
ilInitClients(&argc, argv, NULL, 0); /*initializes SKILL within itkDB environment */
Input and Output Functions
The following are input and output functions for libraries and cellviews.
Libraries
The following functions retrieve information about libraries.
dbCreateLib
ddId
dbCreateLib( String libName, String libPath );
Given the name of a library and a path to a library component directory, the system searches for the named library in the cds.lib. If the named library exists, DDPI (Design Data Procedural Interface) returns the ID of the library. If the named library does not exist, DDPI creates the corresponding directory and adds the DEFINE command to the nearest library list file (such as the one the DDPI found first searching with ddUpdateLibList). If you call dbCreateLib and there is no visible cds.lib file, DDPI creates one in the current working directory (/cwd).
If you specify a NULL library path, then DDPI uses cwd and the libName to make a path (cwd/libName). If you specify a leaf name (for example, without embedded separators), DDPI makes a path out of that name and cwd (cwd/libPath). If you specify a period (.), DDPI does the same as for NULL.
dbCreateLib calls back trigger functions registered on the hooks: PreCreateLib and PostCreateLib.
dbGetLibName
String
dbGetLibName( ddId libId );
Returns the name of the specified library.
Cellviews
The following functions retrieve information about and act on cellviews.
dbOpenCellViewByType
dbCellViewId
dbOpenCellViewByType( String libName, String cellName, String viewList, String viewTypeName, String mode, dbId contextId );
Description
Opens the cellview in the read, append, or write mode. For the newly created cellview, the cellViewType is set by mapping the viewTypeName to dbCellViewType, which is an enumerator. If the mapping fails, the cellViewType is set to stranger.
If the cellview is opened in the read mode, it must already exist. If the cellview is opened in the other modes, it is created if it does not exist.
Arguments
dbReOpen
dbCellViewId
dbReOpen( dbCellViewId cellViewId, String modeString );
Changes the input/output mode of the cellview specified by cellViewId. dbOpen already brought cellViewId into virtual memory to the mode specified by modeString. Reference count is not changed. dbReOpen returns NULL if it cannot open the cellview.
-
dbReOpenopens the library in a mode that lets the cellview be reopened in the mode specified bymodeString. - The user has enough access privileges to reopen the cellview in the specified mode.
- The cellview can be reopened without violating concurrency control rules.
dbReOpen automatically checks out the designated cellview from the library if the requested mode is either write or append, and the designated cellview is not checked out. The user must check in the cellview after modification is completed and verified.
modeString is in read mode, and the cellview has been modified and not saved, dbReOpen reopens the cellview without any warning.dbOpenDerivedCellView
dbCellViewId
dbOpenDerivedCellView( dbCellViewId cellViewId, String viewName );
Opens a new view for the same cell with w (write) mode. dbOpenDerivedCellView calls dmMakeViewClone to ensure that the new view exists and has the proper type.
dbClose
Boolean
dbClose( dbCellViewId cellViewId );
Closes the cellview and decrements the reference count by one. If the reference count is zero, CDBA might automatically purge the cellview from virtual memory. (CDBA can cache frequently used cellviews in virtual memory to minimize disk I/O.) To force removing a cellview from virtual memory, use dbPurge.
dbFindOpenCellView
dbCellViewId
dbFindOpenCellView( ddId libId, String cellName, String viewName, String versionName );
Returns the cellview of the specified cell, view, and version name, if found and opened. Otherwise, it returns NULL. If versionName is a NULL string, dbFindOpenCellView uses the default version defined by the current configuration of the library.
dbGetCellView
dbCellViewId
dbGetCellView( dbId id );
Returns the cellview containing the database object identified by id.
dbPurge
Boolean
dbPurge( dbCellViewId cellViewId );
Purges the cellview from virtual memory, regardless of the reference count. This function is useful because it might be impossible to match the number of times dbClose and dbOpen are called.
dbPurge, undo checkpoints for all edit actions before the purge operation are cleared. To avoid losing the undo checkpoint information when purging a cellview, set the dbUndoAcrossPurge cdsenv variable value to t.dbCheck
Boolean
dbCheck( dbCellViewId cellViewId );
Checks the integrity of the database. If you specify a NULL cellview ID, then all opened cellviews are checked. The function returns TRUE if the database is OK. Otherwise, it prints warnings and returns FALSE. If you are experiencing corrupted databases, you can call this function to help determine where the corruption is occurring.
dbSave
Boolean
dbSave( dbCellViewId cellViewId );
Saves the given cellview on disk if the cellview was modified but not saved.
dbSave, undo checkpoints for all edit actions before the save operation are cleared. To avoid losing the undo checkpoint information while saving a cellview, set the dbUndoAcrossSave cdsenv variable value to t.dbSaveAll
Boolean
dbSaveAll( );
Saves all cellviews that were modified but not saved on disk in virtual memory.
dbRegSaveTrigger
Boolean
dbRegSaveTrigger( dbCVTriggerFunc triggerFunc, unsigned int priority, const char *name );
Registers a preSave trigger. The trigger function does not need to exist at the time of register, a warning will be issued though. If the function is bound, it is called before the cellview is saved.
dbUnregSaveTrigger
Boolean
dbUnregSaveTrigger( dbCVTriggerFunc triggerFunc );
Un-registers the pre-save trigger function.
dbSearchCDF
Boolean
dbSearchCDF( );
Sets and un-sets a flag that will cause CDF to be searched for parameter values. t sets, nil un-sets the flag. There is no return value.
dbStartGenCellView
dbGenStateId
dbStartGenCellView( );
Starts the generator for all cellviews currently open and in virtual memory. dbStartGenCellView returns NULL if there are no cellviews in virtual memory.
dbGenCellView
Boolean
dbGenCellView( dbGenStateId pState, dbCellViewId pCellViewId );/* modifies CellViewId */
Generates all cellviews currently open and in virtual memory. dbStartGenCellView returns NULL if there are no cellviews in virtual memory.
dbGetLibDataCompressionLevel
unsigned int
dbGetLibDataCompressionLevel( ddId );
Returns the data compression level set on the specified library ID.
dbSetLibDataCompressionLevel
Boolean
dbSetLibDataCompressionLevel( ddId, unsigned int );
Sets the data compression level for designs that are saved to the specified library ID.
A compression level indicates the amount of effort the compression algorithm uses when compressing data. A higher level does not necessarily correspond to better compression efficiency. The supported levels range from 1 to 9. Level 1 provides an optimized balance between efficiency and performance.
dbUnsetLibDataCompressionLevel
Boolean
dbUnsetLibDataCompressionLevel( ddId, );
Removes the data compression level of the specified library.
dbRefreshLibDataCompressionLevel
Boolean
dbRefreshLibDataCompressionLevel( ddId, );
Refreshes the data compression level for the specified library ID from the disk.
Refreshing the compression level of a library only affects the designs that are saved to the library after the refresh has occurred.
dbIsNonSKILLPcell
Boolean
dbIsNonSKILLPcell(
dbCellViewId cellViewId
);
Description
Checks whether a Pcell is not a SKILL Pcell.
Arguments
Return Value
dbErrorFlushWarn
void
dbErrorFlushWarn( void );
Description
Ensures that all warnings that were produced by database functions are written to the output.
Arguments
Return Values
Example
dbCellViewId cvId = dbOpenCellViewByType(argv[1], argv[2], argv[3], NULL, (char*)"r", (dbCellViewId)NULL);
if (!cvId) {
dbErrorFlushWarn();
return false;
}
dbHasAutoSavedFile
Boolean
dbHasAutoSavedFile( const char *libName, const char *cellName,const char *viewName);
Description
Determines whether the specified cellview has an auto-saved file.
Arguments
Return Value
|
|
|
|
|
Example
Boolean result = dbHasAutoSavedFile("designLib", "testing1", "layout1");
dbHasPanicFile
Boolean
dbHasPanicFile( const char *libName, const char *cellName, const char *viewName);
Description
Determines whether the specified cellview has a panic file.
Arguments
Return Value
|
|
|
|
|
Example
Boolean result = dbHasPanicFile("designLib", "testing1", "layout1");
dbRestoreAndOpenAutoSavedFile
dbCellViewId
dbRestoreAndOpenAutoSavedFile( const char *libName, const char *cellName, const char *viewName);
Description
Restores and opens the auto-saved file for the specified cellview.
Arguments
Return Value
|
Database ID of the cellview that opens. Otherwise, returns NULL. |
Example
dbCellViewId cvId = RestoreAndOpenAutoSavedFile ("designLib", "testing1", "layout1");
Returns the database ID of the cellview that opens, or returns NULL on error.
dbRestoreAndOpenPanicFile
dbCellViewId
dbRestoreAndOpenPanicFile( const char *libName, const char *cellName, const char *viewName);
Description
Restores and opens the panic file for the specified cellview.
Arguments
Return Value
|
Database ID of the cellview that opens. Otherwise, returns NULL. |
Example
dbCellViewId cvId = RestoreAndOpenPanicFile ("designLib", "testing1", "layout1");
Returns database ID of the cellview that opens or returns NULL on error.
Hierarchy Traversal Functions
The following functions traverse the hierarchy to retrieve information about it.
dbOpenHier
void
dbOpenHier( dbCellViewId cellViewId, unsigned int nLevels, FuncBooleanPtr msgConsumer );
Opens nLevels of descendants of cellViewId, and brings them into core. If it cannot bring a descendant into core, it calls msgConsumer and checks the returned value. If the returned value from msgConsumer is FALSE, then dbOpenHier stops immediately. The msgConsumer function is defined as follows:
Boolean
msgConsumer(instHeader, errorMessage dbInstHeaderId instHeader; String errorMessage;
dbOpenAllMaster
Boolean
dbOpenAllMaster( dbCellViewId cellViewId );
Opens all master cellviews referred to by this cellview and binds them to the corresponding instance headers. This is equivalent to
dbOpenHier(cellViewId, dbcMaxHier, NULL)
Operations on Cellviews
A cellview is a database object despite its special function as a container of all other objects. It has attributes, properties, and relationships. The one-to-many relationships associated with a cellview let you traverse the entire cellview and visit every object in the database. The relationships and the generators are documented separately in this manual.
Cellview Attributes Functions
The following functions return information on cellview attributes.
dbGetCellViewLibId
ddId
dbGetCellViewLibId( dbCellViewId cellViewId );
Returns the library containing the given cellview.
dbGetCellId
ddId
dbGetCellId( dbCellViewId cellViewId );
Returns the ddId of the cell for the specified cellview.
dbGetViewId
ddId
dbGetViewId( dbCellViewId cellViewId );
Returns the ddId of the view for the specified cellview.
dbGetCellViewView
ddId
dbGetCellViewView( dbCellViewId cellViewId );
Returns the ddId of the view for the specified cellview.
dbGetCellViewCellName
String
dbGetCellViewCellName( dbCellViewId cellViewId );
Returns the cell name of the cellview.
dbGetCellViewViewName
String
dbGetCellViewViewName( dbCellViewId cellViewId );
Returns the view name of the cellview.
dbGetCellViewMode
String
dbGetCellViewMode( dbCellViewId cellViewId );
Returns the mode of the cellview as a string. Valid modes are w (write), r (read), and a (append).
dbGetCellViewFullDirPath
String
dbGetCellViewFullDirPath( dbCellViewId cellViewId );
Returns the full path name of the cellview as a string.
dbGetCellViewBBox
dbBBox *
dbGetCellViewBBox( dbCellViewId cellViewId );
Returns the bounding box for the cellview. This bounding box is derived by taking the union of the bounding boxes of all objects in the cellview (that is, a bounding box just big enough to contain the bounding boxes of all the objects).
Refer to “Bounding Boxes” for an explanation of the bounding box concept.
dbGetCellViewCellType
Boolean
dbGetCellViewCellType( dbCellViewIdcvId, dbCellType*cellType);
Description
Returns the cell type for the specified cellview.
Arguments
|
|
|
Example
// This program will print "The cellType is core"
dbCellViewId cvId;
bool result = true;
if (!(cvId = dbOpenCellViewByType(argv[1], argv[2], argv[3], "maskLayout", (char*)"w", (dbCellViewId)NULL))) {
fprintf(stderr, "ERROR: Unable to open %s/%s/%s\n", argv[1], argv[2], argv[3]);
dbErrorFlushWarn();
return false;
}
dbCellType cellType = dbcCellTypeUnknown;
if (dbSetCellViewCellType(cvId, dbcCellTypeCore)) {
if (dbGetCellViewCellType(cvId, &cellType)) {
fprintf(stdout, "The cellType is %s\n", dbCellTypeToString(cellType));
} else {
fprintf(stderr, "ERROR: Unable to get the cellType of the cellView\n");
result = false;
}
} else {
fprintf(stderr, "ERROR: Failed to set the cellType of the cellView\n");
result = false;
}
Cellview Voltage Range Functions
dbGetCellViewNetVoltageRange
Boolean
dbGetCellViewNetVoltageRange(
dbCellViewId cvId,
float *minVoltage,
float *maxVoltage
);
Returns the default minimum and maximum net voltages from the specified cellview ID.
Arguments
|
The database cellview ID whose minimum and maximum default net |
|
Return Value
|
Returns TRUE if the command is successful; otherwise returns FALSE. |
dbIsCellViewNetVoltageRangeSet
Boolean
dbIsCellViewNetVoltageRangeSet(
dbCellViewId cellViewId
);
Description
Ensures that the voltage range has been set on a cellview.
Arguments
Return Value
|
Returns TRUE if the voltage range has been set on the specified cellview; otherwise returns FALSE. |
dbSetCellViewNetVoltageRange
Boolean
dbSetCellViewNetVoltageRange(
dbCellViewId cvId,
float minVoltage,
float maxVoltage
);
Description
Sets the default minimum and maximum net voltages on a cellview ID.
Arguments
|
The database cellview ID whose minimum and maximum default net voltages must be returned. |
|
Return Value
|
Returns TRUE if the command is successful; otherwise returns FALSE. |
dbUnsetCellViewNetVoltageRange
Boolean
dbUnsetCellViewNetVoltageRange(
dbCellViewId cellViewId
);
Description
Resets the voltage range on a cellview to its default value.
Arguments
Return Value
|
Returns TRUE if the voltage range is reset; otherwise returns FALSE. |
Predicate Function for Cellviews
The following function returns predicate (Boolean) information on cellviews.
dbIsCellViewModified
Boolean
dbIsCellViewModified( dbCellViewId cellViewId );
Returns TRUE if the cellview was modified but not yet saved on disk. Otherwise, returns FALSE.
Cellview Attributes of Purpose, Type, and Status
Each cellview object has three other attributes associated with it: cellViewType, cellViewStatus, and cellViewPurpose. These attributes describe how CDBA uses the information in the cellview.
Although the entire spectrum of enumerated constant values for these attributes is presented in the tables that follow, only a few values are currently defined and supported in Cadence® application programs. These attributes are of primary interest to placement and routing applications and can be ignored by other application programs.
| Name | Enumerated constants in type dbCellViewPurpose |
|---|---|
| Enumerated constants in type dbCellviewType | Explanation |
|---|---|
| Enumerated constants in type dbCellviewStatus |
|---|
When a cellview is created, all of its cellview attributes are initialized from the corresponding template cellview.
Cellview Type and Status Functions
The following functions retrieve and set information about the cellview type and status.
dbGetCellViewType
dbCellViewType
dbGetCellViewType( dbCellViewId cellViewId );
Returns the type of the cellview.
dbGetCellViewStatus
dbCellViewStatus
dbGetCellViewStatus( dbCellViewId cellViewId );
Returns the status of the cellview.
dbSetCellViewStatus
Boolean
dbSetCellViewStatus( dbCellViewId cellViewId, dbCellViewStatus status );
Sets the status of the cellview.
dbIsCellViewPhysicalOnly
Boolean
dbIsCellViewPhysicalOnly(
dbCellViewId cvId
);
Description
Checks whether the connectivity detail of a cellveiw is visible only to the block domain or to both the block domain and the OpenAccess module domain.
Arguments
Return Value
|
|
dbUnsetCellViewPhysicalOnly
Boolean
dbUnsetCellViewPhysicalOnly(
dbCellViewId cvId
);
Description
Unsets the physical-only attribute of the specified cellview, allowing connectivity to be visible in the OpenAccess module domain.
Arguments
Return Value
|
|
|
Counter Functions
In OpenAccess, the scheme to designate that the database has been edited is through updating integer counters (unsigned). Counters in are OpenAccess are termed time stamps, but their values are unsigned integers.
In addition to maintaining a counter for the cellview, OpenAccess maintains counters for many other objects in the database. Whenever an edit is made, any existing counter for the object plus the counter for the cellview are increased by 1.
dbIsConnCurrent
Boolean
dbIsConnCurrent( dbCellViewId cellViewId )
Description
Tests whether the value of the connectivity current property is equal to the cellview timestamp counter value.
Arguments
Return Value
dbDisableCellViewCounter
void
dbDisableCellViewCounter( dbCellViewId cellViewId )
Description
Disables updating of the cellview timestamp counter.
Arguments
Return Value
dbGetCellViewCounter
Boolean
dbGetCellViewCounter( dbCellViewId cellViewId )
Description
Gets the last saved time for the cellview timestamp counter.
Arguments
Return Value
|
Returns TRUE if the last saved time for the cellview timestamp counter was successfully retrieved. Returns FALSE otherwise. |
dbEnableCellViewCounter
void
dbEnableCellViewCounter( dbCellViewId cellViewId )
Description
Enables updating of the cellview timestamp counter.
Arguments
Return Value
dbSetConnCurrent
void
dbSetConnCurrent( dbCellViewId cellViewId )
Description
Sets the value of the connectivity current property to the cellview timestamp counter value.
Arguments
Return Values
dbGetFileTimeStamp
time
dbGetFileTimeStamp( dbCellViewId cellViewId )
Description
Gets the last saved time for the cellview file.
Arguments
Return Values
dbSetInstHeadersCounter
Boolean
dbSetInstHeadersCounter( dbCellViewId cellViewId )
Description
Sets the value of the cellview instHeaders counter.
Arguments
Return Values
|
Returns TRUE if the cellview counter value was successfully set in the instHeaders counter. Returns FALSE otherwise. |
Database I/O Functions
The following functions retrieve cellview information from the database and modify cellview information in the database.
dbRefreshCellView
Boolean
dbRefreshCellView( dbCellViewID cellViewId );
Refreshes the cellview in virtual memory with the copy from disk. Any unsaved changes to the cellview are lost. The function purges the cellview from virtual memory and reopens the cellview append mode. If any errors occur, the function returns FALSE.
dbWriteCellView
Boolean
dbWriteCellView( dbCellViewId cellViewId, String libName, String cellName, String viewName, String version, dbCellViewId contextCellViewId );
Writes cellview cellViewId to disk under the specified cell and view names. The version requirement is for backward compatibility and must always be specified as NULL.
dbCopyCellView
dbCellViewId
dbCopyCellView( dbCellViewId cellViewId, String libName, String cellName, String viewName, String version, dbCellViewId contextCellViewId, Boolean overwrite );
Copies cellview cellViewId to a destination cellview of the specified cell, view, and version names. The function modifies both the disk version and the virtual memory version of the destination cellview. If the copy succeeds, the function returns TRUE. The version requirement is for backward compatibility and must always be specified as NULL.
dbCopyCellView and dbWriteCellView will copy all the files defined in the masterSet part in the data registry file. For example, if the file virtuoso.reg for maskLayout is like:
DataFormat MaskLayout {
Pattern=layout.oa;
Default_Editor=Virtuoso;
dfII_ViewType=maskLayout;
Co_Managed= layout.oa master.tag data.dm pc.db *.att verilog.v verilog.vams
ams_direct.dat amsAPT.apt es.db esb.db *.conf *.ctstch *.mode
enc.pref.tcl SiFix.option *.fp *.fp.pg *.rcdb.gz *.ymp;
Master_Set= layout.oa master.tag pc.db;
updaterProg=ccpDFIIUpdtr;
checkerProg=ccpDFIIChecker
}
Then dbCopyCellView and dbWriteCellView will copy "layout.oa master.tag pc.db" all together.
Return to top