ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
giaTtopt.cpp File Reference
#include <vector>
#include <algorithm>
#include <cassert>
#include <bitset>
#include "gia.h"
#include "misc/vec/vecHash.h"
Include dependency graph for giaTtopt.cpp:

Go to the source code of this file.

Classes

class  Ttopt::TruthTable
 
class  Ttopt::TruthTableReo
 
class  Ttopt::TruthTableRewrite
 
class  Ttopt::TruthTableCare
 
class  Ttopt::TruthTableLevelTSM
 

Namespaces

namespace  Ttopt
 

Functions

Gia_Man_tGia_ManTtopt (Gia_Man_t *p, int nIns, int nOuts, int nRounds)
 
Gia_Man_tGia_ManTtoptCare (Gia_Man_t *p, int nIns, int nOuts, int nRounds, char *pFileName, int nRarity)
 

Function Documentation

◆ Gia_ManTtopt()

Gia_Man_t * Gia_ManTtopt ( Gia_Man_t * p,
int nIns,
int nOuts,
int nRounds )

Definition at line 1109 of file giaTtopt.cpp.

1110{
1111 Gia_Man_t * pNew;
1112 Gia_Obj_t * pObj;
1113 Vec_Int_t * vSupp;
1114 word v;
1115 word * pTruth;
1116 int i, g, k, nInputs;
1117 Gia_ManLevelNum( p );
1118 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1119 pNew->pName = Abc_UtilStrsav( p->pName );
1120 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1121 Gia_ManForEachCi( p, pObj, k )
1122 Gia_ManAppendCi( pNew );
1124 Gia_ManHashStart( pNew );
1125 for ( g = 0; g < Gia_ManCoNum(p); g += nOuts )
1126 {
1127 vSupp = Gia_ManCollectSuppNew( p, g, nOuts );
1128 nInputs = Vec_IntSize( vSupp );
1129 Ttopt::TruthTableReo tt( nInputs, nOuts );
1130 for ( k = 0; k < nOuts; k++ )
1131 {
1132 pObj = Gia_ManCo( p, g+k );
1133 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ObjFanin0(pObj), vSupp );
1134 if ( nInputs >= 6 )
1135 for ( i = 0; i < tt.nSize; i++ )
1136 tt.t[i + tt.nSize * k] = Gia_ObjFaninC0(pObj)? ~pTruth[i]: pTruth[i];
1137 else
1138 {
1139 i = k * (1 << nInputs);
1140 v = (Gia_ObjFaninC0(pObj)? ~pTruth[0]: pTruth[0]) & tt.ones[nInputs];
1141 tt.t[i / tt.ww] |= v << (i % tt.ww);
1142 }
1143 }
1144 tt.RandomSiftReo( nRounds );
1145 Ttopt::TruthTable tt2( nInputs, nOuts );
1146 tt2.t = tt.t;
1147 tt2.Reo( tt.vLevels );
1148 tt2.BDDGenerateAig( pNew, vSupp );
1149 Vec_IntFree( vSupp );
1150 }
1152 Gia_ManHashStop( pNew );
1153 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1154 return pNew;
1155}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Cube * p
Definition exorList.c:222
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
Definition giaTruth.c:628
void Gia_ManHashStart(Gia_Man_t *p)
Definition giaHash.c:125
void Gia_ManSetRegNum(Gia_Man_t *p, int nRegs)
Definition giaMan.c:764
Gia_Man_t * Gia_ManStart(int nObjsMax)
FUNCTION DEFINITIONS ///.
Definition giaMan.c:57
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
struct Gia_Man_t_ Gia_Man_t
Definition gia.h:96
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition giaTruth.c:552
Vec_Int_t * Gia_ManCollectSuppNew(Gia_Man_t *p, int iOut, int nOuts)
Definition giaMinLut.c:632
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition giaTruth.c:568
#define Gia_ManForEachCi(p, pObj, i)
Definition gia.h:1228
void Gia_ManHashStop(Gia_Man_t *p)
Definition giaHash.c:149
int Gia_ManLevelNum(Gia_Man_t *p)
Definition giaUtil.c:546
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
char * pSpec
Definition gia.h:100
char * pName
Definition gia.h:99
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManTtoptCare()

Gia_Man_t * Gia_ManTtoptCare ( Gia_Man_t * p,
int nIns,
int nOuts,
int nRounds,
char * pFileName,
int nRarity )

Definition at line 1157 of file giaTtopt.cpp.

1158{
1159 int fVerbose = 0;
1160 Gia_Man_t * pNew;
1161 Gia_Obj_t * pObj;
1162 Vec_Int_t * vSupp;
1163 word v;
1164 word * pTruth, * pCare;
1165 int i, g, k, nInputs;
1166 Vec_Wrd_t * vSimI = Vec_WrdReadBin( pFileName, fVerbose );
1167 Gia_ManLevelNum( p );
1168 pNew = Gia_ManStart( Gia_ManObjNum(p) );
1169 pNew->pName = Abc_UtilStrsav( p->pName );
1170 pNew->pSpec = Abc_UtilStrsav( p->pSpec );
1171 Gia_ManForEachCi( p, pObj, k )
1172 Gia_ManAppendCi( pNew );
1174 Gia_ManHashStart( pNew );
1175 for ( g = 0; g < Gia_ManCoNum(p); g += nOuts )
1176 {
1177 vSupp = Gia_ManCollectSuppNew( p, g, nOuts );
1178 nInputs = Vec_IntSize( vSupp );
1179 if ( nInputs == 0 )
1180 {
1181 for ( k = 0; k < nOuts; k++ )
1182 {
1183 pObj = Gia_ManCo( p, g+k );
1184 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ObjFanin0(pObj), vSupp );
1185 Gia_ManAppendCo( pNew, pTruth[0] & 1 );
1186 }
1187 Vec_IntFree( vSupp );
1188 continue;
1189 }
1190 Ttopt::TruthTableLevelTSM tt( nInputs, nOuts );
1191 for ( k = 0; k < nOuts; k++ )
1192 {
1193 pObj = Gia_ManCo( p, g+k );
1194 pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ObjFanin0(pObj), vSupp );
1195 if ( nInputs >= 6 )
1196 for ( i = 0; i < tt.nSize; i++ )
1197 tt.t[i + tt.nSize * k] = Gia_ObjFaninC0(pObj)? ~pTruth[i]: pTruth[i];
1198 else
1199 {
1200 i = k * (1 << nInputs);
1201 v = (Gia_ObjFaninC0(pObj)? ~pTruth[0]: pTruth[0]) & tt.ones[nInputs];
1202 tt.t[i / tt.ww] |= v << (i % tt.ww);
1203 }
1204 }
1205 i = 1 << Vec_IntSize( vSupp );
1206 pCare = Gia_ManCountFraction( p, vSimI, vSupp, nRarity, fVerbose, &i );
1207 tt.care[0] = pCare[0];
1208 for ( i = 1; i < tt.nSize; i++ )
1209 tt.care[i] = pCare[i];
1210 ABC_FREE( pCare );
1211 tt.RandomSiftReo( nRounds );
1212 tt.Optimize();
1213 tt.BDDGenerateAig( pNew, vSupp );
1214 Vec_IntFree( vSupp );
1215 }
1217 Gia_ManHashStop( pNew );
1218 Gia_ManSetRegNum( pNew, Gia_ManRegNum(p) );
1219 Vec_WrdFreeP( &vSimI );
1220 return pNew;
1221}
#define ABC_FREE(obj)
Definition abc_global.h:267
word * Gia_ManCountFraction(Gia_Man_t *p, Vec_Wrd_t *vSimI, Vec_Int_t *vSupp, int Thresh, int fVerbose, int *pCare)
Definition giaMinLut.c:531
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition vecWrd.h:42
Here is the call graph for this function: