ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
cbaReadVer.c File Reference
#include "cba.h"
#include "cbaPrs.h"
Include dependency graph for cbaReadVer.c:

Go to the source code of this file.

Classes

struct  Prs_VerPrim_t_
 
struct  Prs_VerInfo_t_
 

Typedefs

typedef struct Prs_VerPrim_t_ Prs_VerPrim_t
 FUNCTION DEFINITIONS ///.
 
typedef struct Prs_VerInfo_t_ Prs_VerInfo_t
 

Functions

void Prs_NtkAddVerilogDirectives (Prs_Man_t *p)
 ITERATORS ///.
 
int Prs_ManReadSignalList (Prs_Man_t *p, Vec_Int_t *vTemp, char LastSymb, int fAddForm)
 
void Prs_ManPrintModules (Prs_Man_t *p)
 
Vec_Ptr_tPrs_ManReadVerilog (char *pFileName)
 
void Prs_ManReadVerilogTest (char *pFileName)
 
int Prs_CreateVerilogFindFon (Cba_Ntk_t *p, int NameId)
 
int Prs_CreateSlice (Cba_Ntk_t *p, int iFon, Prs_Ntk_t *pNtk, int Range)
 
int Prs_CreateCatIn (Cba_Ntk_t *p, Prs_Ntk_t *pNtk, int Con)
 
int Prs_CreateSignalIn (Cba_Ntk_t *p, Prs_Ntk_t *pNtk, int Sig)
 
int Prs_CreateRange (Cba_Ntk_t *p, int iFon, int NameId)
 
void Prs_CreateSignalOut (Cba_Ntk_t *p, int iFon, Prs_Ntk_t *pNtk, int Sig)
 
void Prs_CreateOutConcat (Cba_Ntk_t *p, int *pSlices, int nSlices)
 
int Prs_CreateBitSignal (Prs_Ntk_t *pNtk, int Sig)
 
int Prs_CreateFlopSetReset (Cba_Ntk_t *p, Prs_Ntk_t *pNtk, Vec_Int_t *vBox, int *pIndexSet, int *pIndexRst, int *pBitSet, int *pBitRst)
 
char * Prs_CreateDetectRamPort (Prs_Ntk_t *pNtk, Vec_Int_t *vBox, int NameRamId)
 
int Prs_CreateGetMemSize (char *pName)
 
Vec_Ptr_tPrs_CreateDetectRams (Prs_Ntk_t *pNtk)
 
void Prs_CreateVerilogPio (Cba_Ntk_t *p, Prs_Ntk_t *pNtk)
 
int Prs_CreateVerilogNtk (Cba_Ntk_t *p, Prs_Ntk_t *pNtk)
 
Cba_Man_tPrs_ManBuildCbaVerilog (char *pFileName, Vec_Ptr_t *vDes)
 
Cba_Man_tCba_ManReadVerilog (char *pFileName)
 

Typedef Documentation

◆ Prs_VerInfo_t

typedef struct Prs_VerInfo_t_ Prs_VerInfo_t

Definition at line 171 of file cbaReadVer.c.

◆ Prs_VerPrim_t

typedef struct Prs_VerPrim_t_ Prs_VerPrim_t

FUNCTION DEFINITIONS ///.

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 90 of file cbaReadVer.c.

Function Documentation

◆ Cba_ManReadVerilog()

Cba_Man_t * Cba_ManReadVerilog ( char * pFileName)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 2165 of file cbaReadVer.c.

2166{
2167 Cba_Man_t * p = NULL;
2168 Vec_Ptr_t * vDes = Prs_ManReadVerilog( pFileName );
2169 if ( vDes && Vec_PtrSize(vDes) )
2170 p = Prs_ManBuildCbaVerilog( pFileName, vDes );
2171 if ( vDes )
2172 Prs_ManVecFree( vDes );
2173 return p;
2174}
Vec_Ptr_t * Prs_ManReadVerilog(char *pFileName)
Cba_Man_t * Prs_ManBuildCbaVerilog(char *pFileName, Vec_Ptr_t *vDes)
struct Cba_Man_t_ Cba_Man_t
Definition cba.h:46
Cube * p
Definition exorList.c:222
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:

◆ Prs_CreateBitSignal()

int Prs_CreateBitSignal ( Prs_Ntk_t * pNtk,
int Sig )

Definition at line 1645 of file cbaReadVer.c.

1646{
1647 Vec_Int_t * vSigs;
1648 int i, SigTemp, SigOne = -1, Value = Abc_Lit2Var2( Sig );
1649 Prs_ManType_t Type = (Prs_ManType_t)Abc_Lit2Att2( Sig );
1650 if ( Type == CBA_PRS_NAME || Type == CBA_PRS_SLICE )
1651 return -1;
1652 if ( Type == CBA_PRS_CONST )
1653 {
1654 int fOnly0 = 1, fOnly1 = 1;
1655 char * pConst = Prs_NtkConst(pNtk, Value);
1656 pConst = strchr( pConst, '\'' ) + 1;
1657 assert( *pConst == 'b' );
1658 while ( *++pConst )
1659 if ( *pConst == '0' )
1660 fOnly1 = 0;
1661 else if ( *pConst == '1' )
1662 fOnly0 = 0;
1663 if ( fOnly0 )
1664 return Abc_Var2Lit2( 1, CBA_PRS_CONST ); // const0
1665 if ( fOnly1 )
1666 return Abc_Var2Lit2( 2, CBA_PRS_CONST ); // const1
1667 return -1;
1668 }
1669 assert( Type == CBA_PRS_CONCAT );
1670 vSigs = Prs_CatSignals( pNtk, Value );
1671 Vec_IntForEachEntry( vSigs, SigTemp, i )
1672 {
1673 Value = Abc_Lit2Var2( SigTemp );
1674 Type = (Prs_ManType_t)Abc_Lit2Att2( SigTemp );
1675 if ( Type != CBA_PRS_NAME )
1676 return -1;
1677 if ( SigOne == -1 )
1678 SigOne = Value;
1679 else if ( SigOne != Value )
1680 return -1;
1681 }
1682 assert( SigOne >= 0 );
1683 return Abc_Var2Lit2( SigOne, CBA_PRS_NAME );
1684}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Prs_ManType_t
Definition cbaPrs.h:61
@ CBA_PRS_SLICE
Definition cbaPrs.h:63
@ CBA_PRS_CONST
Definition cbaPrs.h:64
@ CBA_PRS_CONCAT
Definition cbaPrs.h:65
@ CBA_PRS_NAME
Definition cbaPrs.h:62
#define assert(ex)
Definition util_old.h:213
char * strchr()
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateCatIn()

int Prs_CreateCatIn ( Cba_Ntk_t * p,
Prs_Ntk_t * pNtk,
int Con )

Definition at line 1446 of file cbaReadVer.c.

1447{
1448 extern int Prs_CreateSignalIn( Cba_Ntk_t * p, Prs_Ntk_t * pNtk, int Sig );
1449 int i, Sig, iObj, iFon, NameId, nBits = 0;
1450 Vec_Int_t * vSigs = Prs_CatSignals(pNtk, Con);
1451 // create input concatenation
1452 iObj = Cba_ObjAlloc( p, CBA_BOX_CONCAT, Vec_IntSize(vSigs), 1 );
1453 iFon = Cba_ObjFon0(p, iObj);
1454 //sprintf( Buffer, "_icc%d_", iObj );
1455 //NameId = Cba_NtkNewStrId( p, Buffer );
1456 NameId = Cba_NtkNewStrId( p, "_icc%d_", iObj );
1457 Cba_FonSetName( p, iFon, NameId );
1458 Cba_NtkSetMap( p, NameId, iFon );
1459 // set inputs
1460 Vec_IntForEachEntry( vSigs, Sig, i )
1461 {
1462 iFon = Prs_CreateSignalIn( p, pNtk, Sig );
1463 if ( iFon )
1464 Cba_ObjSetFinFon( p, iObj, i, iFon );
1465 if ( iFon )
1466 nBits += Cba_FonRangeSize( p, iFon );
1467 }
1468 iFon = Cba_ObjFon0(p, iObj);
1469 Cba_FonSetRange( p, iFon, Cba_NtkHashRange(p, nBits-1, 0) );
1470 return Cba_ObjFon0(p, iObj);
1471}
struct Prs_Ntk_t_ Prs_Ntk_t
BASIC TYPES ///.
Definition cbaPrs.h:73
int Prs_CreateSignalIn(Cba_Ntk_t *p, Prs_Ntk_t *pNtk, int Sig)
@ CBA_BOX_CONCAT
Definition cbaTypes.h:142
typedefABC_NAMESPACE_HEADER_START struct Cba_Ntk_t_ Cba_Ntk_t
INCLUDES ///.
Definition cba.h:45
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateDetectRamPort()

char * Prs_CreateDetectRamPort ( Prs_Ntk_t * pNtk,
Vec_Int_t * vBox,
int NameRamId )

Definition at line 1718 of file cbaReadVer.c.

1719{
1720 int i, FormId, ActId;
1721 Vec_IntForEachEntryDouble( vBox, FormId, ActId, i )
1722 if ( FormId == NameRamId )
1723 return Abc_NamStr(pNtk->pStrs, Abc_Lit2Var2(ActId));
1724 return NULL;
1725}
Abc_Nam_t * pStrs
Definition cbaPrs.h:84
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition utilNam.c:555
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition vecInt.h:72
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateDetectRams()

Vec_Ptr_t * Prs_CreateDetectRams ( Prs_Ntk_t * pNtk)

Definition at line 1735 of file cbaReadVer.c.

1736{
1737 Vec_Ptr_t * vAllRams = NULL, * vRam;
1738 Vec_Int_t * vBox, * vBoxCopy;
1739 char * pNtkName, * pRamName;
1740 int NameRamId = Abc_NamStrFind( pNtk->pStrs, "Ram" );
1741 int i, k, fWrite;
1742 Prs_NtkForEachBox( pNtk, vBox, i )
1743 {
1744 if ( Prs_BoxIsNode(pNtk, i) ) // node
1745 continue;
1746 pNtkName = Prs_NtkStr(pNtk, Prs_BoxNtk(pNtk, i));
1747 fWrite = !strncmp(pNtkName, "ClockedWritePort_", strlen("ClockedWritePort_"));
1748 if ( fWrite || !strncmp(pNtkName, "ReadPort_", strlen("ReadPort_")) )
1749 {
1750 pRamName = Prs_CreateDetectRamPort( pNtk, vBox, NameRamId ); assert( pRamName );
1751 if ( vAllRams == NULL )
1752 vAllRams = Vec_PtrAlloc( 4 );
1753 Vec_PtrForEachEntry( Vec_Ptr_t *, vAllRams, vRam, k )
1754 if ( pRamName == (char *)Vec_PtrEntry(vRam, 0) )
1755 {
1756 if ( fWrite )
1757 {
1758 vBoxCopy = Vec_IntDup(vBox);
1759 Vec_IntPush( vBoxCopy, i );
1760 Vec_PtrPush( vRam, vBoxCopy );
1761 }
1762 break;
1763 }
1764 if ( k < Vec_PtrSize(vAllRams) )
1765 continue;
1766 vRam = Vec_PtrAlloc( 4 );
1767 Vec_PtrPush( vRam, pRamName );
1768 Vec_PtrPush( vRam, Abc_Int2Ptr(Prs_CreateGetMemSize(pNtkName)) );
1769 if ( fWrite )
1770 {
1771 vBoxCopy = Vec_IntDup(vBox);
1772 Vec_IntPush( vBoxCopy, i );
1773 Vec_PtrPush( vRam, vBoxCopy );
1774 }
1775 Vec_PtrPush( vAllRams, vRam );
1776 }
1777 }
1778 return vAllRams;
1779}
#define Prs_NtkForEachBox(p, vVec, i)
Definition cbaPrs.h:182
char * Prs_CreateDetectRamPort(Prs_Ntk_t *pNtk, Vec_Int_t *vBox, int NameRamId)
int Prs_CreateGetMemSize(char *pName)
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
Definition utilNam.c:433
int strncmp()
int strlen()
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateFlopSetReset()

int Prs_CreateFlopSetReset ( Cba_Ntk_t * p,
Prs_Ntk_t * pNtk,
Vec_Int_t * vBox,
int * pIndexSet,
int * pIndexRst,
int * pBitSet,
int * pBitRst )

Definition at line 1686 of file cbaReadVer.c.

1687{
1688 int iSigSet = -1, iSigRst = -1;
1689 int IndexSet = -1, IndexRst = -1;
1690 int FormId, ActId, k;
1691 // mark set and reset
1692 Cba_NtkCleanMap2( p );
1693 Cba_NtkSetMap2( p, Cba_NtkStrId(p, "set"), 1 );
1694 Cba_NtkSetMap2( p, Cba_NtkStrId(p, "reset"), 2 );
1695 // check the inputs
1696 Vec_IntForEachEntryDouble( vBox, FormId, ActId, k )
1697 if ( Cba_NtkGetMap2(p, FormId) == 1 ) // set
1698 iSigSet = ActId, IndexSet = k+1;
1699 else if ( Cba_NtkGetMap2(p, FormId) == 2 ) // reset
1700 iSigRst = ActId, IndexRst = k+1;
1701 assert( iSigSet >= 0 && iSigRst >= 0 );
1702 if ( pIndexSet ) *pBitSet = 0;
1703 if ( pIndexRst ) *pBitRst = 0;
1704 if ( pBitSet ) *pBitSet = 0;
1705 if ( pBitRst ) *pBitRst = 0;
1706 if ( iSigSet == -1 || iSigRst == -1 )
1707 return 0;
1708 iSigSet = Prs_CreateBitSignal(pNtk, iSigSet);
1709 iSigRst = Prs_CreateBitSignal(pNtk, iSigRst);
1710 if ( iSigSet == -1 || iSigRst == -1 )
1711 return 0;
1712 if ( pIndexSet ) *pIndexSet = IndexSet;
1713 if ( pIndexRst ) *pIndexRst = IndexRst;
1714 if ( pBitSet ) *pBitSet = iSigSet;
1715 if ( pBitRst ) *pBitRst = iSigRst;
1716 return 1;
1717}
int Prs_CreateBitSignal(Prs_Ntk_t *pNtk, int Sig)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateGetMemSize()

int Prs_CreateGetMemSize ( char * pName)

Definition at line 1726 of file cbaReadVer.c.

1727{
1728 char * pPtr1 = strchr( pName, '_' );
1729 char * pPtr2 = strchr( pPtr1+1, '_' );
1730 int Num1 = atoi( pPtr1 + 1 );
1731 int Num2 = atoi( pPtr2 + 1 );
1732 assert( Num1 + Abc_Base2Log(Num2) < 32 );
1733 return (1 << Num1) * Num2;
1734}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateOutConcat()

void Prs_CreateOutConcat ( Cba_Ntk_t * p,
int * pSlices,
int nSlices )

Definition at line 1581 of file cbaReadVer.c.

1582{
1583 Vec_Int_t * vBits = &p->vArray1;
1584 int NameId = pSlices[0];
1585 int RangeId = -Cba_NtkGetMap(p, NameId);
1586 int LeftId = Cba_NtkRangeLeft( p, RangeId );
1587 int RightId = Cba_NtkRangeRight( p, RangeId );
1588 int BotId = Abc_MinInt( LeftId, RightId );
1589 int TopId = Abc_MaxInt( LeftId, RightId );
1590 int i, k, iObj, iFon, nParts, Prev, nBits;
1591 assert( RangeId > 0 );
1592 Vec_IntFill( vBits, Abc_MaxInt(LeftId, RightId) + 1, 0 );
1593 // fill up with slices
1594 for ( i = 0; i < nSlices; i++ )
1595 {
1596 int Range = pSlices[3*i+1];
1597 int iFon = pSlices[3*i+2];
1598 int Left = Cba_NtkRangeLeft( p, Range );
1599 int Right = Cba_NtkRangeRight( p, Range );
1600 int Bot = Abc_MinInt( Left, Right );
1601 int Top = Abc_MaxInt( Left, Right );
1602 assert( NameId == pSlices[3*i+0] && iFon > 0 );
1603 assert( BotId <= Bot && Top <= TopId );
1604 for ( k = Bot; k <= Top; k++ )
1605 {
1606 assert( Vec_IntEntry(vBits, k) == 0 );
1607 Vec_IntWriteEntry( vBits, k, iFon );
1608 }
1609 }
1610 // check how many parts we have
1611 Prev = -1; nParts = 0;
1612 Vec_IntForEachEntryStartStop( vBits, iFon, i, BotId, TopId+1 )
1613 {
1614 if ( Prev != iFon )
1615 nParts++;
1616 Prev = iFon;
1617 }
1618 // create new concatenation
1619 iObj = Cba_ObjAlloc( p, CBA_BOX_CONCAT, nParts, 1 );
1620 iFon = Cba_ObjFon0(p, iObj);
1621 Cba_FonSetName( p, iFon, NameId );
1622 Prs_CreateRange( p, iFon, NameId );
1623 // set inputs
1624 k = 0; Prev = -1; nBits = 0;
1625 Vec_IntForEachEntryStartStop( vBits, iFon, i, BotId, TopId+1 )
1626 {
1627 if ( Prev == -1 || Prev == iFon )
1628 nBits++;
1629 else
1630 {
1631 if ( Prev == 0 ) // create constant
1632 Prev = Cba_ManNewConstZero( p, nBits );
1633 assert( nBits == Cba_FonRangeSize(p, Prev) );
1634 Cba_ObjSetFinFon( p, iObj, nParts-1-k++, Prev );
1635 nBits = 1;
1636 }
1637 Prev = iFon;
1638 }
1639 assert( nBits == Cba_FonRangeSize(p, Prev) );
1640 Cba_ObjSetFinFon( p, iObj, nParts-1-k++, Prev );
1641 assert( k == nParts );
1642}
int Prs_CreateRange(Cba_Ntk_t *p, int iFon, int NameId)
#define Vec_IntForEachEntryStartStop(vVec, Entry, i, Start, Stop)
Definition vecInt.h:60
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateRange()

int Prs_CreateRange ( Cba_Ntk_t * p,
int iFon,
int NameId )

Definition at line 1491 of file cbaReadVer.c.

1492{
1493 int RangeId = -Cba_NtkGetMap(p, NameId);
1494 if ( RangeId < 0 ) // this variable is already created
1495 return Cba_FonRangeSize( p, -RangeId );
1496 Cba_NtkUnsetMap( p, NameId );
1497 Cba_NtkSetMap( p, NameId, iFon );
1498 if ( RangeId == 0 )
1499 return 1;
1500 assert( RangeId > 0 );
1501 Cba_FonSetRangeSign( p, iFon, RangeId );
1502 return Cba_FonRangeSize( p, iFon );
1503}
Here is the caller graph for this function:

◆ Prs_CreateSignalIn()

int Prs_CreateSignalIn ( Cba_Ntk_t * p,
Prs_Ntk_t * pNtk,
int Sig )

Definition at line 1472 of file cbaReadVer.c.

1473{
1474 int iFon, Value = Abc_Lit2Var2( Sig );
1475 Prs_ManType_t Type = (Prs_ManType_t)Abc_Lit2Att2( Sig );
1476 if ( !Sig ) return 0;
1477 if ( Type == CBA_PRS_NAME )
1478 return Prs_CreateVerilogFindFon( p, Cba_NtkNewStrId(p, Prs_NtkStr(pNtk, Value)) );
1479 if ( Type == CBA_PRS_CONST )
1480 return Cba_FonFromConst( Value );
1481 if ( Type == CBA_PRS_SLICE )
1482 {
1483 iFon = Prs_CreateVerilogFindFon( p, Cba_NtkNewStrId(p, Prs_NtkStr(pNtk, Prs_SliceName(pNtk, Value))) );
1484 if ( !iFon )
1485 return 0;
1486 return Prs_CreateSlice( p, iFon, pNtk, Prs_SliceRange(pNtk, Value) );
1487 }
1488 assert( Type == CBA_PRS_CONCAT );
1489 return Prs_CreateCatIn( p, pNtk, Value );
1490}
int Prs_CreateSlice(Cba_Ntk_t *p, int iFon, Prs_Ntk_t *pNtk, int Range)
int Prs_CreateCatIn(Cba_Ntk_t *p, Prs_Ntk_t *pNtk, int Con)
int Prs_CreateVerilogFindFon(Cba_Ntk_t *p, int NameId)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateSignalOut()

void Prs_CreateSignalOut ( Cba_Ntk_t * p,
int iFon,
Prs_Ntk_t * pNtk,
int Sig )

Definition at line 1504 of file cbaReadVer.c.

1505{
1506 int i, iFonNew, NameOut, RangeOut, NameId, RangeId, RangeSize, nBits = 0;
1507 Prs_ManType_t SigType = (Prs_ManType_t)Abc_Lit2Att2( Sig );
1508 int SigValue = Abc_Lit2Var2( Sig );
1509 if ( !Sig ) return;
1510 if ( SigType == CBA_PRS_NAME )
1511 {
1512 NameId = SigValue;
1513 if ( !strncmp(Cba_NtkStr(p, NameId), "Open_", 5) )
1514 return;
1515 Cba_FonSetName( p, iFon, NameId );
1516 Prs_CreateRange( p, iFon, NameId );
1517 return;
1518 }
1519 // create name for this fan
1520 NameOut = Cba_NtkNewStrId( p, "_occ%d_", iFon );
1521 Cba_FonSetName( p, iFon, NameOut );
1522 Cba_NtkSetMap( p, NameOut, iFon );
1523 // consider special cases
1524 if ( SigType == CBA_PRS_SLICE )
1525 {
1526 NameId = Prs_SliceName(pNtk, SigValue);
1527 RangeId = Prs_SliceRange(pNtk, SigValue);
1528 nBits = Cba_NtkRangeSize(p, RangeId);
1529 // save this slice
1530 Vec_IntPushThree( &p->vArray0, NameId, RangeId, iFon );
1531 }
1532 else if ( SigType == CBA_PRS_CONCAT )
1533 {
1534 Vec_Int_t * vSigs = Prs_CatSignals(pNtk, SigValue);
1535 Vec_IntReverseOrder( vSigs );
1536 Vec_IntForEachEntry( vSigs, Sig, i )
1537 {
1538 SigType = (Prs_ManType_t)Abc_Lit2Att2( Sig );
1539 SigValue = Abc_Lit2Var2( Sig );
1540 if ( SigType == CBA_PRS_NAME )
1541 {
1542 int iObjBuf, iFonBuf;
1543 // create buffer
1544 NameId = SigValue;
1545 if ( !strncmp(Cba_NtkStr(p, NameId), "Open_", 5) )
1546 {
1547 nBits++;
1548 continue;
1549 }
1550 iObjBuf = Cba_ObjAlloc( p, CBA_BOX_BUF, 1, 1 );
1551 iFonBuf = Cba_ObjFon0(p, iObjBuf);
1552 Cba_FonSetName( p, iFonBuf, NameId );
1553 RangeSize = Prs_CreateRange( p, iFonBuf, NameId );
1554 RangeOut = Cba_NtkHashRange(p, nBits+RangeSize-1, nBits);
1555 // create slice
1556 iFonNew = Prs_CreateSlice( p, iFon, pNtk, RangeOut );
1557 Cba_ObjSetFinFon( p, iObjBuf, 0, iFonNew );
1558 }
1559 else if ( SigType == CBA_PRS_SLICE )
1560 {
1561 NameId = Prs_SliceName(pNtk, SigValue);
1562 RangeId = Prs_SliceRange(pNtk, SigValue);
1563 RangeSize = Cba_NtkRangeSize(p, RangeId);
1564 RangeOut = Cba_NtkHashRange(p, nBits+RangeSize-1, nBits);
1565 // create slice
1566 iFonNew = Prs_CreateSlice( p, iFon, pNtk, RangeOut );
1567 // save this slice
1568 Vec_IntPushThree( &p->vArray0, NameId, RangeId, iFonNew );
1569 }
1570 else assert( 0 );
1571 // increment complete range
1572 nBits += RangeSize;
1573 }
1574 Vec_IntReverseOrder( vSigs );
1575 }
1576 else assert( 0 );
1577 // set the range for the output
1578 Cba_FonHashRange( p, iFon, nBits-1, 0 );
1579}
@ CBA_BOX_BUF
Definition cbaTypes.h:50
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateSlice()

int Prs_CreateSlice ( Cba_Ntk_t * p,
int iFon,
Prs_Ntk_t * pNtk,
int Range )

Definition at line 1427 of file cbaReadVer.c.

1428{
1429 int iObj, iFonNew, NameId;
1430 assert( Cba_FonIsReal(iFon) );
1431 // check existing slice
1432 NameId = Cba_NtkNewStrId( p, Cba_ManGetSliceName(p, iFon, Range) );
1433 iFonNew = Cba_NtkGetMap( p, NameId );
1434 if ( iFonNew )
1435 return iFonNew;
1436 // create slice
1437 iObj = Cba_ObjAlloc( p, CBA_BOX_SLICE, 1, 1 );
1438 Cba_ObjSetName( p, iObj, NameId );
1439 Cba_ObjSetFinFon( p, iObj, 0, iFon );
1440 iFonNew = Cba_ObjFon0(p, iObj);
1441 Cba_FonSetRange( p, iFonNew, Range );
1442 Cba_FonSetName( p, iFonNew, NameId );
1443 Cba_NtkSetMap( p, NameId, iFonNew );
1444 return iFonNew;
1445}
@ CBA_BOX_SLICE
Definition cbaTypes.h:141
char * Cba_ManGetSliceName(Cba_Ntk_t *p, int iFon, int RangeId)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateVerilogFindFon()

int Prs_CreateVerilogFindFon ( Cba_Ntk_t * p,
int NameId )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1419 of file cbaReadVer.c.

1420{
1421 int iFon = Cba_NtkGetMap( p, NameId );
1422 if ( iFon )
1423 return iFon;
1424 printf( "Network \"%s\": Signal \"%s\" is not driven.\n", Cba_NtkName(p), Cba_NtkStr(p, NameId) );
1425 return 0;
1426}
Here is the caller graph for this function:

◆ Prs_CreateVerilogNtk()

int Prs_CreateVerilogNtk ( Cba_Ntk_t * p,
Prs_Ntk_t * pNtk )

Definition at line 1814 of file cbaReadVer.c.

1815{
1816 Vec_Int_t * vBox2Obj = Vec_IntStart( Prs_NtkBoxNum(pNtk) );
1817 Vec_Int_t * vBox; Vec_Ptr_t * vAllRams, * vRam;
1818 int i, k, iObj, iTerm, iFon, FormId, ActId, RangeId, NameId, Type;
1819 // map inputs
1820 Cba_NtkCleanMap( p );
1821 Cba_NtkForEachPi( p, iObj, i )
1822 Cba_NtkSetMap( p, Cba_ObjName(p, iObj), Cba_ObjFon0(p, iObj) );
1823
1824 // map wire names into their rangeID
1825 Vec_IntForEachEntryTwo( &pNtk->vWires, &pNtk->vWiresR, NameId, RangeId, i )
1826 Cba_NtkSetMap( p, NameId, -RangeId );
1827 Vec_IntForEachEntryTwo( &pNtk->vOutputs, &pNtk->vOutputsR, NameId, RangeId, i )
1828 Cba_NtkSetMap( p, NameId, -RangeId );
1829
1830 // collect RAMs and create boxes
1831 vAllRams = Prs_CreateDetectRams( pNtk );
1832 if ( vAllRams )
1833 Vec_PtrForEachEntry( Vec_Ptr_t *, vAllRams, vRam, i )
1834 {
1835 char * pRamName = (char *)Vec_PtrEntry( vRam, 0 );
1836 int MemSize = Abc_Ptr2Int( (char *)Vec_PtrEntry( vRam, 1 ) );
1837 //char Buffer[1000]; sprintf( Buffer, "%s_box", pRamName );
1838 //NameId = Cba_NtkNewStrId( p, Buffer );
1839 NameId = Cba_NtkNewStrId( p, "%s_box", pRamName );
1840 // create RAM object
1841 iObj = Cba_ObjAlloc( p, CBA_BOX_RAMBOX, Vec_PtrSize(vRam)-2, 1 );
1842 Cba_ObjSetName( p, iObj, NameId );
1843 iFon = Cba_ObjFon0(p, iObj);
1844 NameId = Cba_NtkNewStrId( p, pRamName );
1845 Cba_FonSetName( p, iFon, NameId );
1846 Prs_CreateRange( p, iFon, NameId );
1847 assert( Cba_FonLeft(p, iFon) <= MemSize-1 );
1848 assert( Cba_FonRight(p, iFon) == 0 );
1849 //Cba_VerificSaveLineFile( p, iObj, pNet->Linefile() );
1850 // create write ports feeding into this object
1851 Vec_PtrForEachEntryStart( Vec_Int_t *, vRam, vBox, k, 2 )
1852 {
1853 int iObjNew = Cba_ObjAlloc( p, CBA_BOX_RAMWC, 4, 1 );
1854 int Line = Vec_IntPop( vBox );
1855 Vec_IntWriteEntry( vBox2Obj, Line, iObjNew );
1856 if ( Prs_BoxName(pNtk, Line) )
1857 Cba_ObjSetName( p, iObjNew, Prs_BoxName(pNtk, Line) );
1858 //Cba_VerificSaveLineFile( p, iObjNew, pInst->Linefile() );
1859 // connect output
1860 iFon = Cba_ObjFon0(p, iObjNew);
1861 Cba_FonSetRange( p, iFon, Cba_NtkHashRange(p, MemSize-1, 0) );
1862 //sprintf( Buffer, "%s_wp%d", pRamName, k-2 );
1863 //NameId = Cba_NtkNewStrId( p, Buffer );
1864 NameId = Cba_NtkNewStrId( p, "%s_wp%d", pRamName, k-2 );
1865 Cba_FonSetName( p, iFon, NameId );
1866 Cba_NtkSetMap( p, NameId, iFon );
1867 // connet to RAM object
1868 Cba_ObjSetFinFon( p, iObj, (k++)-2, iFon );
1869 Vec_IntFree( vBox );
1870 }
1871 Vec_PtrFree( vRam );
1872 }
1873 Vec_PtrFreeP( &vAllRams );
1874
1875 // create objects
1876 Vec_IntClear( &p->vArray0 );
1877 Prs_NtkForEachBox( pNtk, vBox, i )
1878 {
1879 if ( Prs_BoxIsNode(pNtk, i) ) // node
1880 {
1881 Type = Prs_BoxNtk(pNtk, i);
1882 iObj = Cba_ObjAlloc( p, (Cba_ObjType_t)Type, Prs_BoxIONum(pNtk, i)-1, Type == CBA_BOX_ADD ? 2 : 1 );
1883 Prs_CreateSignalOut( p, Cba_ObjFon0(p, iObj), pNtk, Vec_IntEntry(vBox, 1) ); // node output
1884 }
1885 else // box
1886 {
1887 Cba_Ntk_t * pBox = NULL; int nInputs, nOutputs = 1;
1888 char ** pOutNames = NULL, * pNtkName = Prs_NtkStr(pNtk, Prs_BoxNtk(pNtk, i));
1889 Type = Prs_ManFindType( pNtkName, &nInputs, 1, &pOutNames );
1890 if ( Type == CBA_BOX_RAMWC )
1891 continue;
1892 if ( Type == CBA_OBJ_BOX )
1893 {
1894 pBox = Cba_ManNtkFind( p->pDesign, pNtkName );
1895 if ( pBox == NULL )
1896 {
1897 printf( "Fatal error: Cannot find module \"%s\".\n", pNtkName );
1898 continue;
1899 }
1900 nInputs = Cba_NtkPiNum(pBox);
1901 nOutputs = Cba_NtkPoNum(pBox);
1902 }
1903 else if ( Type == CBA_BOX_ADD || Type == CBA_BOX_DFFCPL )
1904 nOutputs = 2;
1905 else if ( Type == CBA_BOX_NMUX )
1906 {
1907 if ( !strncmp(pNtkName, "wide_mux_", strlen("wide_mux_")) )
1908 nInputs = 1 + (1 << atoi(pNtkName+strlen("wide_mux_")));
1909 else if ( !strncmp(pNtkName, "Mux_", strlen("Mux_")) )
1910 nInputs = 1 + (1 << atoi(pNtkName+strlen("Mux_")));
1911 else assert( 0 );
1912 }
1913 else if ( Type == CBA_BOX_SEL )
1914 {
1915 if ( !strncmp(pNtkName, "wide_select_", strlen("wide_select_")) )
1916 nInputs = 1 + atoi(pNtkName+strlen("wide_select_"));
1917 else if ( !strncmp(pNtkName, "Select_", strlen("Select_")) )
1918 nInputs = 1 + atoi(pNtkName+strlen("Select_"));
1919 else assert( 0 );
1920 }
1921 else if ( (Type == CBA_BOX_DFFRS || Type == CBA_BOX_LATCHRS) && !strncmp(pNtkName, "wide_", strlen("wide_")) && !Prs_CreateFlopSetReset(p, pNtk, vBox, NULL, NULL, NULL, NULL) )
1922 nInputs = atoi(pNtkName+strlen(Type == CBA_BOX_DFFRS ? "wide_dffrs_" : "wide_latchrs_")), nOutputs = 1, Type = CBA_BOX_CONCAT;
1923 // create object
1924 iObj = Cba_ObjAlloc( p, (Cba_ObjType_t)Type, nInputs, nOutputs );
1925 if ( pBox ) Cba_ObjSetFunc( p, iObj, Cba_NtkId(pBox) );
1926 // mark PO objects
1927 Cba_NtkCleanMap2( p );
1928 if ( pBox )
1929 Cba_NtkForEachPo( pBox, iTerm, k )
1930 Cba_NtkSetMap2( p, Cba_ObjName(pBox, iTerm), k+1 );
1931 else
1932 for ( k = 0; k < nOutputs; k++ )
1933 Cba_NtkSetMap2( p, Cba_NtkStrId(p, pOutNames[k]), k+1 );
1934 // map box fons
1935 Vec_IntForEachEntryDouble( vBox, FormId, ActId, k )
1936 if ( Cba_NtkGetMap2(p, FormId) )
1937 {
1938 iFon = Cba_ObjFon(p, iObj, Cba_NtkGetMap2(p, FormId)-1);
1939 Prs_CreateSignalOut( p, iFon, pNtk, ActId );
1940 }
1941 }
1942 Vec_IntWriteEntry( vBox2Obj, i, iObj );
1943 if ( Prs_BoxName(pNtk, i) )
1944 Cba_ObjSetName( p, iObj, Prs_BoxName(pNtk, i) );
1945 //Cba_VerificSaveLineFile( p, iObj, pInst->Linefile() );
1946 }
1947
1948 // create concatenations for split signals
1949 if ( Vec_IntSize(&p->vArray0) )
1950 {
1951 int Prev = -1, Index = 0;
1952 Vec_IntSortMulti( &p->vArray0, 3, 0 );
1953 Vec_IntForEachEntryTriple( &p->vArray0, NameId, RangeId, iFon, i )
1954 {
1955 if ( Prev != -1 && Prev != NameId )
1956 Prs_CreateOutConcat( p, Vec_IntArray(&p->vArray0) + Index, (i - Index)/3 ), Index = i;
1957 Prev = NameId;
1958 }
1959 Prs_CreateOutConcat( p, Vec_IntArray(&p->vArray0) + Index, (i - Index)/3 ), Index = i;
1960 //Cba_VerificSaveLineFile( p, iObj, pInst->Linefile() );
1961 }
1962
1963 // connect objects
1964 Prs_NtkForEachBox( pNtk, vBox, i )
1965 {
1966 iObj = Vec_IntEntry( vBox2Obj, i );
1967 if ( Prs_BoxIsNode(pNtk, i) ) // node
1968 {
1969 Type = Prs_BoxNtk(pNtk, i);
1970 Vec_IntForEachEntryDoubleStart( vBox, FormId, ActId, k, 2 )
1971 {
1972 iFon = Prs_CreateSignalIn( p, pNtk, ActId );
1973 if ( iFon )
1974 Cba_ObjSetFinFon( p, iObj, k/2-1, iFon );
1975 }
1976 }
1977 else // box
1978 {
1979 int nInputs = -1;
1980 char ** pInNames = NULL, * pNtkName = Prs_NtkStr(pNtk, Prs_BoxNtk(pNtk, i));
1981 Type = Prs_ManFindType( pNtkName, &nInputs, 0, &pInNames );
1982 if ( (Type == CBA_BOX_DFFRS || Type == CBA_BOX_LATCHRS) && !strncmp(pNtkName, "wide_", strlen("wide_")) )
1983 {
1984 int IndexSet = -1, IndexRst = -1, iBitSet = -1, iBitRst = -1;
1985 int Status = Prs_CreateFlopSetReset( p, pNtk, vBox, &IndexSet, &IndexRst, &iBitSet, &iBitRst );
1986 if ( Status )
1987 {
1988 Vec_IntWriteEntry( vBox, IndexSet, iBitSet );
1989 Vec_IntWriteEntry( vBox, IndexRst, iBitRst );
1990 // updated box should be fine
1991 }
1992 else
1993 {
1994 int w, Width = atoi( pNtkName + strlen(Type == CBA_BOX_DFFRS ? "wide_dffrs_" : "wide_latchrs_") );
1995 assert( Cba_ObjType(p, iObj) == CBA_BOX_CONCAT );
1996 // prepare inputs
1997 assert( nInputs >= 0 );
1998 Cba_NtkCleanMap2( p );
1999 for ( k = 0; k < nInputs; k++ )
2000 Cba_NtkSetMap2( p, Cba_NtkStrId(p, pInNames[k]), k+1 );
2001 // create bit-level objects
2002 for ( w = 0; w < Width; w++ )
2003 {
2004 // create bit-level flop
2005 int iObjNew = Cba_ObjAlloc( p, (Cba_ObjType_t)Type, 4, 1 );
2006 if ( Prs_BoxName(pNtk, i) )
2007 {
2008 NameId = Cba_NtkNewStrId( p, "%s[%d]", Prs_NtkStr(pNtk, Prs_BoxName(pNtk, i)), w );
2009 Cba_ObjSetName( p, iObjNew, NameId );
2010 }
2011 //Cba_VerificSaveLineFile( p, iObjNew, pInst->Linefile() );
2012 // set output fon
2013 iFon = Cba_ObjFon0(p, iObjNew);
2014 {
2015 NameId = Cba_NtkNewStrId( p, "%s[%d]", Cba_FonNameStr(p, Cba_ObjFon0(p, iObj)), w );
2016 Cba_FonSetName( p, iFon, NameId );
2017 }
2018 // no need to map this name because it may be produced elsewhere
2019 //Cba_NtkSetMap( p, NameId, iFon );
2020 // add the flop
2021 Cba_ObjSetFinFon( p, iObj, Width-1-w, iFon );
2022 // create bit-level flops
2023 Vec_IntForEachEntryDouble( vBox, FormId, ActId, k )
2024 if ( Cba_NtkGetMap2(p, FormId) )
2025 {
2026 int Index = Cba_NtkGetMap2(p, FormId)-1;
2027 iFon = Prs_CreateSignalIn( p, pNtk, ActId ); assert( iFon );
2028 // create bit-select node for data/set/reset (but not for clock)
2029 if ( Index < 3 ) // not clock
2030 iFon = Prs_CreateSlice( p, iFon, pNtk, 0 );
2031 Cba_ObjSetFinFon( p, iObjNew, Index, iFon );
2032 }
2033 }
2034 continue;
2035 }
2036 }
2037 assert( Type == Cba_ObjType(p, iObj) );
2038 //assert( nInputs == -1 || nInputs == Cba_ObjFinNum(p, iObj) );
2039 // mark PI objects
2040 Cba_NtkCleanMap2( p );
2041 if ( Type == CBA_OBJ_BOX )
2042 {
2043 Cba_Ntk_t * pBox = Cba_ObjNtk(p, iObj);
2044 assert( Cba_NtkPiNum(pBox) == Cba_ObjFinNum(p, iObj) );
2045 assert( Cba_NtkPoNum(pBox) == Cba_ObjFonNum(p, iObj) );
2046 Cba_NtkForEachPi( pBox, iTerm, k )
2047 Cba_NtkSetMap2( p, Cba_ObjName(pBox, iTerm), k+1 );
2048 }
2049 else
2050 {
2051 assert( nInputs >= 0 );
2052 for ( k = 0; k < nInputs; k++ )
2053 Cba_NtkSetMap2( p, Cba_NtkStrId(p, pInNames[k]), k+1 );
2054 }
2055 // connect box fins
2056 Vec_IntForEachEntryDouble( vBox, FormId, ActId, k )
2057 if ( Cba_NtkGetMap2(p, FormId) )
2058 {
2059 int Index = Cba_NtkGetMap2(p, FormId)-1;
2060 int nBits = Cba_ObjFinNum(p, iObj);
2061 assert( Index < nBits );
2062 iFon = Prs_CreateSignalIn( p, pNtk, ActId );
2063 if ( iFon )
2064 Cba_ObjSetFinFon( p, iObj, Index, iFon );
2065 }
2066 // special cases
2067 if ( Type == CBA_BOX_NMUX || Type == CBA_BOX_SEL )
2068 {
2069 int FonCat = Cba_ObjFinFon( p, iObj, 1 );
2070 int nBits = Cba_FonRangeSize( p, FonCat );
2071 int nParts = Cba_ObjFinNum(p, iObj) - 1;
2072 int Slice = nBits / nParts;
2073 int nFins = Cba_ObjFinNum(p, iObj);
2074 assert( Cba_ObjFinNum(p, iObj) >= 2 );
2075 assert( Slice * nParts == nBits );
2076 assert( nFins == 1 + nParts );
2077 Cba_ObjCleanFinFon( p, iObj, 1 );
2078 // create buffer for the constant
2079 if ( FonCat < 0 )
2080 {
2081 int iObjNew = Cba_ObjAlloc( p, CBA_BOX_BUF, 1, 1 );
2082 Cba_ObjSetFinFon( p, iObjNew, 0, FonCat );
2083 FonCat = Cba_ObjFon0( p, iObjNew );
2084 NameId = Cba_NtkNewStrId( p, "_buf_const_%d", iObjNew );
2085 Cba_FonSetName( p, FonCat, NameId );
2086 Cba_FonSetRange( p, FonCat, Cba_NtkHashRange(p, nBits-1, 0) );
2087 }
2088 for ( k = 0; k < nParts; k++ )
2089 {
2090// iFon = Prs_CreateSlice( p, FonCat, pNtk, Cba_NtkHashRange(p, (nParts-1-k)*Slice+Slice-1, (nParts-1-k)*Slice) );
2091 iFon = Prs_CreateSlice( p, FonCat, pNtk, Cba_NtkHashRange(p, k*Slice+Slice-1, k*Slice) );
2092 Cba_ObjSetFinFon( p, iObj, k+1, iFon );
2093 }
2094 }
2095 }
2096 // if carry-in is not supplied, use constant 0
2097 if ( Type == CBA_BOX_ADD && Cba_ObjFinFon(p, iObj, 0) == 0 )
2098 Cba_ObjSetFinFon( p, iObj, 0, Cba_FonFromConst(1) );
2099 // if set or reset are not supplied, use constant 0
2100 if ( Type == CBA_BOX_DFFRS && Cba_ObjFinFon(p, iObj, 1) == 0 )
2101 Cba_ObjSetFinFon( p, iObj, 1, Cba_FonFromConst(1) );
2102 if ( Type == CBA_BOX_DFFRS && Cba_ObjFinFon(p, iObj, 2) == 0 )
2103 Cba_ObjSetFinFon( p, iObj, 2, Cba_FonFromConst(1) );
2104 }
2105 Vec_IntFree( vBox2Obj );
2106 // connect outputs
2107 Vec_IntForEachEntryTwo( &pNtk->vOutputs, &pNtk->vOutputsR, NameId, RangeId, i )
2108 {
2109 iObj = Cba_NtkPo( p, i );
2110 assert( NameId == Cba_ObjName(p, iObj) ); // direct name
2111 iFon = Prs_CreateVerilogFindFon( p, NameId );
2112 if ( !iFon )
2113 continue;
2114 Cba_ObjSetFinFon( p, iObj, 0, iFon );
2115 if ( RangeId )
2116 {
2117 assert( Cba_NtkRangeLeft(p, Abc_Lit2Var(RangeId)) == Cba_FonLeft(p, iFon) );
2118 assert( Cba_NtkRangeRight(p, Abc_Lit2Var(RangeId)) == Cba_FonRight(p, iFon) );
2119 }
2120 }
2121 return 0;
2122}
int Prs_CreateFlopSetReset(Cba_Ntk_t *p, Prs_Ntk_t *pNtk, Vec_Int_t *vBox, int *pIndexSet, int *pIndexRst, int *pBitSet, int *pBitRst)
Vec_Ptr_t * Prs_CreateDetectRams(Prs_Ntk_t *pNtk)
void Prs_CreateOutConcat(Cba_Ntk_t *p, int *pSlices, int nSlices)
void Prs_CreateSignalOut(Cba_Ntk_t *p, int iFon, Prs_Ntk_t *pNtk, int Sig)
Cba_ObjType_t
INCLUDES ///.
Definition cbaTypes.h:39
@ CBA_OBJ_BOX
Definition cbaTypes.h:43
@ CBA_BOX_RAMBOX
Definition cbaTypes.h:133
@ CBA_BOX_NMUX
Definition cbaTypes.h:86
@ CBA_BOX_LATCHRS
Definition cbaTypes.h:136
@ CBA_BOX_SEL
Definition cbaTypes.h:87
@ CBA_BOX_RAMWC
Definition cbaTypes.h:130
@ CBA_BOX_ADD
Definition cbaTypes.h:94
@ CBA_BOX_DFFCPL
Definition cbaTypes.h:138
@ CBA_BOX_DFFRS
Definition cbaTypes.h:139
#define Cba_NtkForEachPo(p, iObj, i)
Definition cba.h:310
#define Cba_NtkForEachPi(p, iObj, i)
Definition cba.h:308
Vec_Int_t vWires
Definition cbaPrs.h:93
Vec_Int_t vOutputs
Definition cbaPrs.h:92
Vec_Int_t vWiresR
Definition cbaPrs.h:98
Vec_Int_t vOutputsR
Definition cbaPrs.h:97
#define Vec_IntForEachEntryTwo(vVec1, vVec2, Entry1, Entry2, i)
Definition vecInt.h:66
#define Vec_IntForEachEntryTriple(vVec, Entry1, Entry2, Entry3, i)
Definition vecInt.h:76
#define Vec_IntForEachEntryDoubleStart(vVec, Entry1, Entry2, i, Start)
Definition vecInt.h:74
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition vecPtr.h:57
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_CreateVerilogPio()

void Prs_CreateVerilogPio ( Cba_Ntk_t * p,
Prs_Ntk_t * pNtk )

Definition at line 1780 of file cbaReadVer.c.

1781{
1782 int i, NameId, RangeId, iObj, iFon;
1783 Cba_NtkCleanObjFuncs( p );
1784 Cba_NtkCleanObjNames( p );
1785 Cba_NtkCleanFonNames( p );
1786 Cba_NtkCleanFonRanges( p );
1787 // create inputs
1788 Cba_NtkCleanMap( p );
1789 assert( Vec_IntSize(&pNtk->vInouts) == 0 );
1790 Vec_IntForEachEntryTwo( &pNtk->vInputs, &pNtk->vInputsR, NameId, RangeId, i )
1791 {
1792 iObj = Cba_ObjAlloc( p, CBA_OBJ_PI, 0, 1 );
1793 Cba_ObjSetName( p, iObj, NameId ); // direct name
1794 iFon = Cba_ObjFon0(p, iObj);
1795 Cba_FonSetRangeSign( p, iFon, RangeId );
1796 Cba_FonSetName( p, iFon, NameId );
1797 Cba_NtkSetMap( p, NameId, iObj );
1798 }
1799 // create outputs
1800 Vec_IntForEachEntryTwo( &pNtk->vOutputs, &pNtk->vOutputsR, NameId, RangeId, i )
1801 {
1802 iObj = Cba_ObjAlloc( p, CBA_OBJ_PO, 1, 0 );
1803 Cba_ObjSetName( p, iObj, NameId ); // direct name
1804 Cba_NtkSetMap( p, NameId, iObj );
1805 }
1806 // create order
1807 Vec_IntForEachEntry( &pNtk->vOrder, NameId, i )
1808 {
1809 iObj = Prs_CreateVerilogFindFon( p, Abc_Lit2Var2(NameId) ); // labeled name
1810 if ( iObj )
1811 Vec_IntPush( &p->vOrder, iObj );
1812 }
1813}
@ CBA_OBJ_PI
Definition cbaTypes.h:41
@ CBA_OBJ_PO
Definition cbaTypes.h:42
Vec_Int_t vInputsR
Definition cbaPrs.h:96
Vec_Int_t vOrder
Definition cbaPrs.h:88
Vec_Int_t vInouts
Definition cbaPrs.h:90
Vec_Int_t vInputs
Definition cbaPrs.h:91
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_ManBuildCbaVerilog()

Cba_Man_t * Prs_ManBuildCbaVerilog ( char * pFileName,
Vec_Ptr_t * vDes )

Definition at line 2123 of file cbaReadVer.c.

2124{
2125 Prs_Ntk_t * pPrsNtk; int i, fError = 0;
2126 Prs_Ntk_t * pPrsRoot = Prs_ManRoot(vDes);
2127 // start the manager
2128 Abc_Nam_t * pStrs = Abc_NamRef(pPrsRoot->pStrs);
2129 Abc_Nam_t * pFuns = Abc_NamRef(pPrsRoot->pFuns);
2130 Abc_Nam_t * pMods = Abc_NamStart( 100, 24 );
2131 Cba_Man_t * p = Cba_ManAlloc( pFileName, Vec_PtrSize(vDes), pStrs, pFuns, pMods, Hash_IntManRef(pPrsRoot->vHash) );
2132 // initialize networks
2133 Vec_PtrForEachEntry( Prs_Ntk_t *, vDes, pPrsNtk, i )
2134 {
2135 Cba_Ntk_t * pNtk = Cba_NtkAlloc( p, Prs_NtkId(pPrsNtk), Prs_NtkPiNum(pPrsNtk), Prs_NtkPoNum(pPrsNtk), Prs_NtkObjNum(pPrsNtk), 100, 100 );
2136 Prs_CreateVerilogPio( pNtk, pPrsNtk );
2137 Cba_NtkAdd( p, pNtk );
2138 }
2139 // create networks
2140 Vec_PtrForEachEntry( Prs_Ntk_t *, vDes, pPrsNtk, i )
2141 {
2142 printf( "Building module \"%s\"...\n", Prs_NtkName(pPrsNtk) );
2143 fError = Prs_CreateVerilogNtk( Cba_ManNtk(p, i+1), pPrsNtk );
2144 if ( fError )
2145 break;
2146 }
2147 if ( fError )
2148 printf( "Quitting because of errors.\n" );
2149 else
2150 Cba_ManPrepareSeq( p );
2151 return p;
2152}
void Prs_CreateVerilogPio(Cba_Ntk_t *p, Prs_Ntk_t *pNtk)
int Prs_CreateVerilogNtk(Cba_Ntk_t *p, Prs_Ntk_t *pNtk)
Abc_Nam_t * pFuns
Definition cbaPrs.h:85
Hash_IntMan_t * vHash
Definition cbaPrs.h:86
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
Definition utilNam.c:80
Abc_Nam_t * Abc_NamRef(Abc_Nam_t *p)
Definition utilNam.c:195
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
Definition utilNam.h:39
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_ManPrintModules()

void Prs_ManPrintModules ( Prs_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1347 of file cbaReadVer.c.

1348{
1349 char * pName; int i;
1350 printf( "Succeeded parsing %d models:\n", Vec_IntSize(&p->vSucceeded) );
1351 Prs_ManForEachNameVec( &p->vSucceeded, p, pName, i )
1352 printf( " %s", pName );
1353 printf( "\n" );
1354 printf( "Skipped %d known models:\n", Vec_IntSize(&p->vKnown) );
1355 Prs_ManForEachNameVec( &p->vKnown, p, pName, i )
1356 printf( " %s", pName );
1357 printf( "\n" );
1358 printf( "Skipped %d failed models:\n", Vec_IntSize(&p->vFailed) );
1359 Prs_ManForEachNameVec( &p->vFailed, p, pName, i )
1360 printf( " %s", pName );
1361 printf( "\n" );
1362}
#define Prs_ManForEachNameVec(vVec, p, pName, i)
Definition cbaPrs.h:173
Here is the caller graph for this function:

◆ Prs_ManReadSignalList()

int Prs_ManReadSignalList ( Prs_Man_t * p,
Vec_Int_t * vTemp,
char LastSymb,
int fAddForm )

Definition at line 624 of file cbaReadVer.c.

625{
626 Vec_IntClear( vTemp );
627 while ( 1 )
628 {
629 int Item = Prs_ManReadSignal(p);
630 if ( Item == 0 ) return Prs_ManErrorSet(p, "Cannot read signal in the list.", 0);
631 if ( fAddForm )
632 Vec_IntPush( vTemp, 0 );
633 Vec_IntPush( vTemp, Item );
634 if ( Prs_ManIsChar(p, LastSymb) ) break;
635 if ( !Prs_ManIsChar(p, ',') ) return Prs_ManErrorSet(p, "Expecting comma in the list.", 0);
636 p->pCur++;
637 }
638 return 1;
639}

◆ Prs_ManReadVerilog()

Vec_Ptr_t * Prs_ManReadVerilog ( char * pFileName)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 1375 of file cbaReadVer.c.

1376{
1377 Vec_Ptr_t * vPrs = NULL;
1378 Prs_Man_t * p = Prs_ManAlloc( pFileName );
1379 if ( p == NULL )
1380 return NULL;
1381 Abc_NamStrFindOrAdd( p->pFuns, "1\'b0", NULL );
1382 Abc_NamStrFindOrAdd( p->pFuns, "1\'b1", NULL );
1383 Abc_NamStrFindOrAdd( p->pFuns, "1\'bx", NULL );
1384 Abc_NamStrFindOrAdd( p->pFuns, "1\'bz", NULL );
1386 Prs_ManReadDesign( p );
1388 if ( Prs_ManErrorPrint(p) )
1389 ABC_SWAP( Vec_Ptr_t *, vPrs, p->vNtks );
1390 Prs_ManFree( p );
1391 return vPrs;
1392}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
struct Prs_Man_t_ Prs_Man_t
Definition cbaPrs.h:107
void Prs_ManPrintModules(Prs_Man_t *p)
void Prs_NtkAddVerilogDirectives(Prs_Man_t *p)
ITERATORS ///.
Definition cbaReadVer.c:51
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Prs_ManReadVerilogTest()

void Prs_ManReadVerilogTest ( char * pFileName)

Definition at line 1394 of file cbaReadVer.c.

1395{
1396 abctime clk = Abc_Clock();
1397 Vec_Ptr_t * vPrs = Prs_ManReadVerilog( pFileName );
1398 if ( !vPrs ) return;
1399 printf( "Finished reading %d networks. ", Vec_PtrSize(vPrs) );
1400 printf( "NameIDs = %d. ", Abc_NamObjNumMax(Prs_ManNameMan(vPrs)) );
1401 printf( "Memory = %.2f MB. ", 1.0*Prs_ManMemory(vPrs)/(1<<20) );
1402 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
1403 Prs_ManWriteVerilog( Extra_FileNameGenericAppend(pFileName, "_out.v"), vPrs );
1404// Abc_NamPrint( Prs_ManNameMan(vPrs) );
1405 Prs_ManVecFree( vPrs );
1406}
ABC_INT64_T abctime
Definition abc_global.h:332
void Prs_ManWriteVerilog(char *pFileName, Vec_Ptr_t *p)
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
int Abc_NamObjNumMax(Abc_Nam_t *p)
Definition utilNam.c:231
Here is the call graph for this function:

◆ Prs_NtkAddVerilogDirectives()

void Prs_NtkAddVerilogDirectives ( Prs_Man_t * p)

ITERATORS ///.

FUNCTION DECLARATIONS ///

Definition at line 51 of file cbaReadVer.c.

52{
53 int i;
54 for ( i = 1; s_VerTypes[i]; i++ )
55 Abc_NamStrFindOrAdd( p->pStrs, (char *)s_VerTypes[i], NULL );
56 assert( Abc_NamObjNumMax(p->pStrs) == i );
57}
Here is the call graph for this function:
Here is the caller graph for this function: