2015-02-16 22:15:12 +01:00
|
|
|
/**CFile****************************************************************
|
|
|
|
|
|
2015-07-22 02:51:28 +02:00
|
|
|
FileName [bacOper.c]
|
2015-02-16 22:15:12 +01:00
|
|
|
|
|
|
|
|
SystemName [ABC: Logic synthesis and verification system.]
|
|
|
|
|
|
|
|
|
|
PackageName [Hierarchical word-level netlist.]
|
|
|
|
|
|
|
|
|
|
Synopsis [Operator procedures.]
|
|
|
|
|
|
|
|
|
|
Author [Alan Mishchenko]
|
|
|
|
|
|
|
|
|
|
Affiliation [UC Berkeley]
|
|
|
|
|
|
|
|
|
|
Date [Ver. 1.0. Started - November 29, 2014.]
|
|
|
|
|
|
2015-07-22 02:51:28 +02:00
|
|
|
Revision [$Id: bacOper.c,v 1.00 2014/11/29 00:00:00 alanmi Exp $]
|
2015-02-16 22:15:12 +01:00
|
|
|
|
|
|
|
|
***********************************************************************/
|
|
|
|
|
|
2015-07-22 02:51:28 +02:00
|
|
|
#include "bac.h"
|
2015-02-16 22:15:12 +01:00
|
|
|
|
|
|
|
|
ABC_NAMESPACE_IMPL_START
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/// DECLARATIONS ///
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/// FUNCTION DEFINITIONS ///
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
2015-07-22 02:51:28 +02:00
|
|
|
int Bac_BoxCreate( Bac_Ntk_t * p, Bac_ObjType_t Type, Vec_Int_t * vFanins, int nInA, int nInB, int nOuts )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char pName[100]; int i, iObj, iFanin;
|
2015-07-22 02:51:28 +02:00
|
|
|
assert( BAC_OBJ_BOX < Type && Type < BAC_BOX_UNKNOWN );
|
|
|
|
|
if ( BAC_BOX_CF <= Type && Type <= BAC_BOX_CZ )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
sprintf( pName, "ABCCTo%d", nOuts );
|
|
|
|
|
assert( 0 == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
iObj = Bac_BoxAlloc( p, Type, 0, nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( BAC_BOX_BUF <= Type && Type <= BAC_BOX_INV )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char * pPref[2] = { "ABCBUF", "ABCINV" };
|
|
|
|
|
assert( nInA == nOuts );
|
|
|
|
|
assert( nInA == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
sprintf( pName, "%sa%do%d", pPref[Type - BAC_BOX_BUF], nInA, nOuts );
|
|
|
|
|
iObj = Bac_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( BAC_BOX_AND <= Type && Type <= BAC_BOX_XNOR )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char * pPref[6] = { "ABCAND", "ABCNAND", "ABCOR", "ABCNOR", "ABCXOR", "ABCXNOR" };
|
|
|
|
|
assert( nInA == nOuts && nInB == nOuts );
|
|
|
|
|
assert( nInA + nInB == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
sprintf( pName, "%sa%db%do%d", pPref[Type - BAC_BOX_AND], nInA, nInB, nOuts );
|
|
|
|
|
iObj = Bac_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_MUX )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char * pPref[1] = { "ABCMUX" };
|
|
|
|
|
assert( nInA == nOuts && nInB == nOuts );
|
|
|
|
|
assert( 1 + nInA + nInB == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
sprintf( pName, "%sc%da%db%do%d", pPref[Type - BAC_BOX_MUX], 1, nInA, nInB, nOuts );
|
|
|
|
|
iObj = Bac_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_MAJ )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char * pPref[1] = { "ABCMAJ" };
|
|
|
|
|
assert( nInA == 1 && nInB == 1 && nOuts == 1 );
|
|
|
|
|
assert( 3 == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
sprintf( pName, "%sa%db%dc%do%d", pPref[Type - BAC_BOX_MAJ], 1, 1, 1, 1 );
|
|
|
|
|
iObj = Bac_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( BAC_BOX_RAND <= Type && Type <= BAC_BOX_RXNOR )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char * pPref[6] = { "ABCRAND", "ABCRNAND", "ABCROR", "ABCRNOR", "ABCRXOR", "ABCRXNOR" };
|
|
|
|
|
assert( nInA == nInB && 1 == nOuts );
|
|
|
|
|
assert( nInA + nInB == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
sprintf( pName, "%sa%db%do%d", pPref[Type - BAC_BOX_RAND], nInA, nInB, nOuts );
|
|
|
|
|
iObj = Bac_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_SEL )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char * pPref[1] = { "ABCSEL" };
|
|
|
|
|
assert( nInA * nOuts == nInB );
|
|
|
|
|
assert( nInA + nInB == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
sprintf( pName, "%sa%db%do%d", pPref[Type - BAC_BOX_SEL], nInA, nInB, nOuts );
|
|
|
|
|
iObj = Bac_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_PSEL )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
char * pPref[1] = { "ABCPSEL" };
|
|
|
|
|
assert( nInA * nOuts == nInB );
|
|
|
|
|
assert( 1 + nInA + nInB == Vec_IntSize(vFanins) );
|
2015-07-22 02:51:28 +02:00
|
|
|
sprintf( pName, "%si%da%db%do%d", pPref[Type - BAC_BOX_SEL], 1, nInA, nInB, nOuts );
|
|
|
|
|
iObj = Bac_BoxAlloc( p, Type, Vec_IntSize(vFanins), nOuts, Abc_NamStrFindOrAdd(p->pDesign->pMods, pName, NULL) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
// add fanins
|
|
|
|
|
Vec_IntForEachEntry( vFanins, iFanin, i )
|
2015-07-22 02:51:28 +02:00
|
|
|
Bac_ObjSetFanin( p, Bac_BoxBi(p, iObj, i), iFanin );
|
2015-02-16 22:15:12 +01:00
|
|
|
return iObj;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
2015-07-22 02:51:28 +02:00
|
|
|
int Bac_ObjClpWide( Bac_Ntk_t * p, int iBox )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
Bac_ObjType_t Type = Bac_ObjType( p, iBox );
|
|
|
|
|
int nBis = Bac_BoxBiNum(p, iBox);
|
|
|
|
|
int nBos = Bac_BoxBoNum(p, iBox);
|
2015-02-16 22:15:12 +01:00
|
|
|
int i, k, iObj;
|
|
|
|
|
assert( nBos > 1 );
|
|
|
|
|
Vec_IntClear( &p->vArray );
|
2015-07-22 02:51:28 +02:00
|
|
|
if ( BAC_BOX_BUF <= Type && Type <= BAC_BOX_INV )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
for ( i = 0; i < nBos; i++ )
|
|
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntFill( &p->vArray2, 1, Bac_BoxFanin(p, iBox, i) );
|
|
|
|
|
iObj = Bac_BoxCreate( p, Type, &p->vArray2, 1, -1, 1 );
|
|
|
|
|
Vec_IntPush( &p->vArray, Bac_BoxBo(p, iObj, 0) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( BAC_BOX_AND <= Type && Type <= BAC_BOX_XNOR )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
assert( nBis == 2 * nBos );
|
|
|
|
|
for ( i = 0; i < nBos; i++ )
|
|
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntFillTwo( &p->vArray2, 2, Bac_BoxFanin(p, iBox, i), Bac_BoxFanin(p, iBox, nBos+i) );
|
|
|
|
|
iObj = Bac_BoxCreate( p, Type, &p->vArray2, 1, 1, 1 );
|
|
|
|
|
Vec_IntPush( &p->vArray, Bac_BoxBo(p, iObj, 0) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_MUX )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
assert( nBis - 1 == 2 * nBos );
|
|
|
|
|
for ( i = 0; i < nBos; i++ )
|
|
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntFill( &p->vArray2, 1, Bac_BoxFanin(p, iBox, 0) );
|
|
|
|
|
Vec_IntPushTwo( &p->vArray2, Bac_BoxFanin(p, iBox, 1+i), Bac_BoxFanin(p, iBox, 1+nBos+i) );
|
|
|
|
|
iObj = Bac_BoxCreate( p, Type, &p->vArray2, 1, 1, 1 );
|
|
|
|
|
Vec_IntPush( &p->vArray, Bac_BoxBo(p, iObj, 0) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_NMUX )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
int n, nIns = nBis / nBos;
|
|
|
|
|
assert( nBis % nBos == 0 );
|
|
|
|
|
for ( n = 1; n < 32; n++ )
|
|
|
|
|
if ( n + (1 << n) == nIns )
|
|
|
|
|
break;
|
|
|
|
|
assert( n > 1 && n < 32 );
|
|
|
|
|
for ( i = 0; i < nBos; i++ )
|
|
|
|
|
{
|
|
|
|
|
Vec_IntClear( &p->vArray2 );
|
|
|
|
|
for ( k = 0; k < n; k++ )
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntPush( &p->vArray2, Bac_BoxFanin(p, iBox, k) );
|
2015-02-16 22:15:12 +01:00
|
|
|
for ( k = 0; k < (1 << n); k++ )
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntPush( &p->vArray2, Bac_BoxFanin(p, iBox, n + (1 << n) * i + k) );
|
|
|
|
|
iObj = Bac_BoxCreate( p, Type, &p->vArray2, n, (1 << n), 1 );
|
|
|
|
|
Vec_IntPush( &p->vArray, Bac_BoxBo(p, iObj, 0) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_SEL )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_PSEL )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_DFF || Type == BAC_BOX_LATCH )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_DFFRS || Type == BAC_BOX_LATCHRS )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else assert( 0 );
|
2015-07-22 02:51:28 +02:00
|
|
|
Bac_BoxReplace( p, iBox, Vec_IntArray(&p->vArray), Vec_IntSize(&p->vArray) );
|
2015-02-16 22:15:12 +01:00
|
|
|
return iBox;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
2015-07-22 02:51:28 +02:00
|
|
|
int Bac_ObjClpArith( Bac_Ntk_t * p, int iBox )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
Bac_ObjType_t Type = Bac_ObjType( p, iBox );
|
2015-02-16 22:15:12 +01:00
|
|
|
int i, iObj = -1;
|
2015-07-22 02:51:28 +02:00
|
|
|
int nBis = 0;//Bac_NtkReadRangesPrim( Bac_BoxNtkName(p, iObj), &p->vArray, 0 );
|
|
|
|
|
assert( nBis == Bac_BoxBiNum(p, iBox) );
|
|
|
|
|
if ( Type == BAC_BOX_ADD )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
int Carry = Bac_BoxFanin(p, iBox, 0);
|
2015-02-16 22:15:12 +01:00
|
|
|
int nBits = Vec_IntEntry(&p->vArray, 1);
|
|
|
|
|
assert( Vec_IntSize(&p->vArray) == 3 );
|
|
|
|
|
assert( Vec_IntEntry(&p->vArray, 0) == 1 );
|
|
|
|
|
assert( Vec_IntEntry(&p->vArray, 2) == nBits );
|
|
|
|
|
Vec_IntClear( &p->vArray );
|
|
|
|
|
for ( i = 0; i < nBits; i++ )
|
|
|
|
|
{
|
|
|
|
|
Vec_IntFill( &p->vArray2, 1, Carry );
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntPushTwo( &p->vArray2, Bac_BoxFanin(p, iBox, 1+i), Bac_BoxFanin(p, iBox, 1+nBits+i) );
|
|
|
|
|
iObj = Bac_BoxCreate( p, BAC_BOX_ADD, &p->vArray2, 1, 1, 1 );
|
|
|
|
|
Carry = Bac_BoxBo(p, iObj, 1);
|
|
|
|
|
Vec_IntPush( &p->vArray, Bac_BoxBo(p, iObj, 0) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
|
|
|
|
Vec_IntPush( &p->vArray, Carry );
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_SUB )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
int iConst, nBits = Vec_IntEntry(&p->vArray, 0);
|
|
|
|
|
assert( Vec_IntSize(&p->vArray) == 2 );
|
|
|
|
|
assert( Vec_IntEntry(&p->vArray, 1) == nBits );
|
|
|
|
|
// create inverter
|
|
|
|
|
Vec_IntClear( &p->vArray2 );
|
|
|
|
|
for ( i = 0; i < nBits; i++ )
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntPush( &p->vArray2, Bac_BoxFanin(p, iBox, nBits+i) );
|
|
|
|
|
iObj = Bac_BoxCreate( p, BAC_BOX_INV, &p->vArray2, nBits, -1, nBits );
|
2015-02-16 22:15:12 +01:00
|
|
|
// create constant
|
|
|
|
|
Vec_IntClear( &p->vArray2 );
|
2015-07-22 02:51:28 +02:00
|
|
|
iConst = Bac_BoxCreate( p, BAC_BOX_CT, &p->vArray2, -1, -1, 1 );
|
2015-02-16 22:15:12 +01:00
|
|
|
// collect fanins
|
|
|
|
|
Vec_IntFill( &p->vArray2, 1, iConst+1 );
|
|
|
|
|
for ( i = 0; i < nBits; i++ )
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntPush( &p->vArray2, Bac_BoxFanin(p, iBox, i) );
|
2015-02-16 22:15:12 +01:00
|
|
|
for ( i = 0; i < nBits; i++ )
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntPush( &p->vArray2, Bac_BoxBo(p, iObj, i) );
|
2015-02-16 22:15:12 +01:00
|
|
|
// create adder
|
2015-07-22 02:51:28 +02:00
|
|
|
iObj = Bac_BoxCreate( p, BAC_BOX_ADD, &p->vArray2, nBits, nBits, nBits );
|
2015-02-16 22:15:12 +01:00
|
|
|
// collect fanins
|
|
|
|
|
Vec_IntClear( &p->vArray );
|
|
|
|
|
for ( i = 0; i < nBits; i++ )
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntPush( &p->vArray, Bac_BoxBo(p, iObj, i) );
|
2015-02-16 22:15:12 +01:00
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_MUL )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_DIV )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_MOD )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_REM )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_POW )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_MIN )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_ABS )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_LTHAN )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_LETHAN )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_METHAN )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_MTHAN )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_EQU )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_NEQU )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_SHIL )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_SHIR )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_ROTL )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
else if ( Type == BAC_BOX_ROTR )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
|
|
|
|
}
|
2015-07-22 02:51:28 +02:00
|
|
|
Bac_BoxReplace( p, iBox, Vec_IntArray(&p->vArray), Vec_IntSize(&p->vArray) );
|
2015-02-16 22:15:12 +01:00
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**Function*************************************************************
|
|
|
|
|
|
|
|
|
|
Synopsis []
|
|
|
|
|
|
|
|
|
|
Description []
|
|
|
|
|
|
|
|
|
|
SideEffects []
|
|
|
|
|
|
|
|
|
|
SeeAlso []
|
|
|
|
|
|
|
|
|
|
***********************************************************************/
|
2015-07-22 02:51:28 +02:00
|
|
|
int Bac_ObjClpMemory( Bac_Ntk_t * p, int iBox )
|
2015-02-16 22:15:12 +01:00
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
int i, En, iNext, nItems = Bac_BoxBiNum(p, iBox);
|
|
|
|
|
assert( Bac_ObjType(p, iBox) == BAC_BOX_RAMBOX );
|
|
|
|
|
assert( Bac_BoxBiNum(p, iBox) == Bac_BoxBoNum(p, iBox) );
|
2015-02-16 22:15:12 +01:00
|
|
|
// for each fanin of RAMBOX, make sure address width is the same
|
2015-07-22 02:51:28 +02:00
|
|
|
Bac_BoxForEachFaninBox( p, iBox, iNext, i )
|
|
|
|
|
assert( Bac_ObjType(p, iNext) == BAC_BOX_RAMWC );
|
2015-02-16 22:15:12 +01:00
|
|
|
|
|
|
|
|
// create decoders, selectors and flops
|
|
|
|
|
for ( i = 0; i < nItems; i++ )
|
|
|
|
|
{
|
2015-07-22 02:51:28 +02:00
|
|
|
int BoxW = Bac_ObjFanin(p, Bac_BoxBi(p, iBox, i));
|
|
|
|
|
int BoxR = Bac_ObjFanout(p, Bac_BoxBo(p, iBox, 0));
|
|
|
|
|
assert( Bac_ObjType(p, BoxW) == BAC_BOX_RAMWC );
|
|
|
|
|
assert( Bac_ObjType(p, BoxR) == BAC_BOX_RAMR );
|
2015-02-16 22:15:12 +01:00
|
|
|
// create enable
|
2015-07-22 02:51:28 +02:00
|
|
|
Vec_IntFillTwo( &p->vArray2, 2, Bac_BoxFanin(p, BoxW, 1), Bac_BoxFanin(p, BoxR, 0) );
|
|
|
|
|
En = Bac_BoxCreate( p, BAC_BOX_AND, &p->vArray2, 1, 1, 1 );
|
|
|
|
|
En = Bac_BoxBo( p, En, 0 );
|
2015-02-16 22:15:12 +01:00
|
|
|
// collect address
|
|
|
|
|
}
|
|
|
|
|
// for each fanout of RAMBOX, makes ure address width is the same
|
2015-07-22 02:51:28 +02:00
|
|
|
// Bac_BoxForEachFanoutBox( p, iBox, iNext, i )
|
|
|
|
|
// assert( Bac_ObjType(p, iNext) == BAC_BOX_RAMR );
|
2015-02-16 22:15:12 +01:00
|
|
|
// create selectors and connect them
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
/// END OF FILE ///
|
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ABC_NAMESPACE_IMPL_END
|
|
|
|
|
|