ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
sclLibScl.c File Reference
#include "sclLib.h"
#include "misc/st/st.h"
#include "map/mio/mio.h"
#include "bool/kit/kit.h"
#include "misc/extra/extra.h"
#include "misc/util/utilNam.h"
#include "map/scl/sclCon.h"
Include dependency graph for sclLibScl.c:

Go to the source code of this file.

Functions

SC_LibAbc_SclReadFromGenlib (void *pLib0)
 
SC_LibAbc_SclReadFromStr (Vec_Str_t *vOut)
 
SC_LibAbc_SclReadFromFile (char *pFileName)
 
int Abc_SclCountValidCells (SC_Lib *p)
 
void Abc_SclWriteScl (char *pFileName, SC_Lib *p)
 
void Abc_SclWriteLiberty (char *pFileName, SC_Lib *p)
 
SC_LibAbc_SclMergeLibraries (SC_Lib *pLib1, SC_Lib *pLib2, int fUsePrefix)
 

Function Documentation

◆ Abc_SclCountValidCells()

int Abc_SclCountValidCells ( SC_Lib * p)

Definition at line 564 of file sclLibScl.c.

565{
566 SC_Cell * pCell;
567 int i, n_valid_cells = 0;
568 SC_LibForEachCell( p, pCell, i )
569 if ( !(pCell->seq || pCell->unsupp) )
570 n_valid_cells++;
571 return n_valid_cells;
572}
Cube * p
Definition exorList.c:222
#define SC_LibForEachCell(p, pCell, i)
Definition sclLib.h:269
struct SC_Cell_ SC_Cell
Definition sclLib.h:127
int seq
Definition sclLib.h:205
int unsupp
Definition sclLib.h:206
Here is the caller graph for this function:

◆ Abc_SclMergeLibraries()

SC_Lib * Abc_SclMergeLibraries ( SC_Lib * pLib1,
SC_Lib * pLib2,
int fUsePrefix )

Function*************************************************************

Synopsis [Appends cells of pLib2 to those of pLib1.]

Description []

SideEffects []

SeeAlso []

Definition at line 869 of file sclLibScl.c.

870{
871 Vec_Str_t * vOut = Vec_StrAlloc( 10000 );
872 int n_valid_cells2 = Abc_SclCountValidCells( pLib2 );
873 Abc_SclWriteLibrary( vOut, pLib1, n_valid_cells2, fUsePrefix );
874 Abc_SclWriteLibraryCellsOnly( vOut, pLib2, fUsePrefix ? 2 : 0 );
875 SC_Lib * p = Abc_SclReadFromStr( vOut );
876 p->pFileName = Abc_UtilStrsav( pLib1->pFileName );
877 p->pName = ABC_ALLOC( char, strlen(pLib1->pName) + strlen(pLib2->pName) + 10 );
878 sprintf( p->pName, "%s__and__%s", pLib1->pName, pLib2->pName );
879 Vec_StrFree( vOut );
880 printf( "Updated library \"%s\" with additional %d cells from library \"%s\".\n", pLib1->pName, n_valid_cells2, pLib2->pName );
881 return p;
882}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
int Abc_SclCountValidCells(SC_Lib *p)
Definition sclLibScl.c:564
SC_Lib * Abc_SclReadFromStr(Vec_Str_t *vOut)
Definition sclLibScl.c:403
struct SC_Lib_ SC_Lib
Definition sclLib.h:128
char * pFileName
Definition sclLib.h:226
char * pName
Definition sclLib.h:225
int strlen()
char * sprintf()
Here is the call graph for this function:

◆ Abc_SclReadFromFile()

SC_Lib * Abc_SclReadFromFile ( char * pFileName)

Definition at line 417 of file sclLibScl.c.

418{
419 SC_Lib * p;
420 FILE * pFile;
421 Vec_Str_t * vOut;
422 int nFileSize;
423 pFile = fopen( pFileName, "rb" );
424 if ( pFile == NULL )
425 {
426 printf( "Cannot open file \"%s\" for reading.\n", pFileName );
427 return NULL;
428 }
429 // get the file size, in bytes
430 fseek( pFile, 0, SEEK_END );
431 nFileSize = ftell( pFile );
432 rewind( pFile );
433 // load the contents
434 vOut = Vec_StrAlloc( nFileSize );
435 vOut->nSize = vOut->nCap;
436 assert( nFileSize == Vec_StrSize(vOut) );
437 nFileSize = fread( Vec_StrArray(vOut), 1, Vec_StrSize(vOut), pFile );
438 assert( nFileSize == Vec_StrSize(vOut) );
439 fclose( pFile );
440 // read the library
441 p = Abc_SclReadFromStr( vOut );
442 if ( p != NULL )
443 p->pFileName = Abc_UtilStrsav( pFileName );
444 if ( p != NULL )
446 Vec_StrFree( vOut );
447 return p;
448}
void Abc_SclLibNormalize(SC_Lib *p)
Definition sclLibUtil.c:750
int nCap
Definition bblif.c:49
int nSize
Definition bblif.c:50
#define assert(ex)
Definition util_old.h:213
VOID_HACK rewind()
#define SEEK_END
Definition zconf.h:392
Here is the call graph for this function:

◆ Abc_SclReadFromGenlib()

SC_Lib * Abc_SclReadFromGenlib ( void * pLib0)

Definition at line 169 of file sclLibScl.c.

170{
171 Mio_Library_t * pLib = (Mio_Library_t *)pLib0;
172 SC_Lib * p = Abc_SclLibAlloc();
173 if ( !Abc_SclReadLibraryGenlib( p, pLib ) )
174 return NULL;
175 // hash gates by name
178 return p;
179}
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
void Abc_SclHashCells(SC_Lib *p)
Definition sclLibUtil.c:65
void Abc_SclLinkCells(SC_Lib *p)
Definition sclLibUtil.c:264
Here is the call graph for this function:

◆ Abc_SclReadFromStr()

SC_Lib * Abc_SclReadFromStr ( Vec_Str_t * vOut)

Definition at line 403 of file sclLibScl.c.

404{
405 SC_Lib * p;
406 int Pos = 0;
407 // read the library
408 p = Abc_SclLibAlloc();
409 if ( !Abc_SclReadLibrary( vOut, &Pos, p ) )
410 return NULL;
411 assert( Pos == Vec_StrSize(vOut) );
412 // hash gates by name
415 return p;
416}
ush Pos
Definition deflate.h:88
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_SclWriteLiberty()

void Abc_SclWriteLiberty ( char * pFileName,
SC_Lib * p )

Definition at line 845 of file sclLibScl.c.

846{
847 FILE * pFile = fopen( pFileName, "wb" );
848 if ( pFile == NULL )
849 printf( "Cannot open text file \"%s\" for writing.\n", pFileName );
850 else
851 {
852 Abc_SclWriteLibraryText( pFile, p );
853 fclose( pFile );
854 printf( "Dumped internal library with %d cells into Liberty file \"%s\".\n", SC_LibCellNum(p), pFileName );
855 }
856}

◆ Abc_SclWriteScl()

void Abc_SclWriteScl ( char * pFileName,
SC_Lib * p )

Definition at line 629 of file sclLibScl.c.

630{
631 Vec_Str_t * vOut;
632 vOut = Vec_StrAlloc( 10000 );
633 Abc_SclWriteLibrary( vOut, p, 0, 0 );
634 if ( Vec_StrSize(vOut) > 0 )
635 {
636 FILE * pFile = fopen( pFileName, "wb" );
637 if ( pFile == NULL )
638 printf( "Cannot open file \"%s\" for writing.\n", pFileName );
639 else
640 {
641 fwrite( Vec_StrArray(vOut), 1, Vec_StrSize(vOut), pFile );
642 fclose( pFile );
643 }
644 }
645 Vec_StrFree( vOut );
646}