ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
acecBo.c File Reference
#include "acecInt.h"
#include "misc/vec/vecWec.h"
#include "misc/extra/extra.h"
#include "misc/util/utilTruth.h"
Include dependency graph for acecBo.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START int Acec_DetectBoothXorMux (Gia_Man_t *p, Gia_Obj_t *pMux, Gia_Obj_t *pXor, int pIns[3])
 DECLARATIONS ///.
 
int Acec_DetectBoothXorFanin (Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
 
int Acec_DetectBoothOne (Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
 
int Acec_DetectBoothTwoXor (Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
 
int Acec_DetectBoothTwo (Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
 
void Acec_DetectBoothTest (Gia_Man_t *p)
 
void Gia_ManResubTest4 ()
 
void Gia_ManResubTest5 ()
 

Function Documentation

◆ Acec_DetectBoothOne()

int Acec_DetectBoothOne ( Gia_Man_t * p,
Gia_Obj_t * pObj,
int pIns[5] )

Definition at line 116 of file acecBo.c.

117{
118 Gia_Obj_t * pFan0, * pFan1;
119 if ( !Gia_ObjRecognizeExor( pObj, &pFan0, &pFan1 ) )
120 return 0;
121 pFan0 = Gia_Regular(pFan0);
122 pFan1 = Gia_Regular(pFan1);
123 if ( Acec_DetectBoothXorFanin( p, pFan0, pIns ) && pIns[2] == Gia_ObjId(p, pFan1) )
124 return 1;
125 if ( Acec_DetectBoothXorFanin( p, pFan1, pIns ) && pIns[2] == Gia_ObjId(p, pFan0) )
126 return 1;
127 return 0;
128}
int Acec_DetectBoothXorFanin(Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
Definition acecBo.c:78
Cube * p
Definition exorList.c:222
struct Gia_Obj_t_ Gia_Obj_t
Definition gia.h:76
int Gia_ObjRecognizeExor(Gia_Obj_t *pObj, Gia_Obj_t **ppFan0, Gia_Obj_t **ppFan1)
Definition giaUtil.c:1018
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Acec_DetectBoothTest()

void Acec_DetectBoothTest ( Gia_Man_t * p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 198 of file acecBo.c.

199{
200 Gia_Obj_t * pObj;
201 int i, pIns[5];
202 Gia_ManForEachAnd( p, pObj, i )
203 {
204 if ( !Acec_DetectBoothOne(p, pObj, pIns) && !Acec_DetectBoothTwo(p, pObj, pIns) )
205 continue;
206 printf( "obj = %4d : b0 = %4d b1 = %4d b2 = %4d a0 = %4d a1 = %4d\n",
207 i, pIns[0], pIns[1], pIns[2], pIns[3], pIns[4] );
208 }
209}
int Acec_DetectBoothTwo(Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
Definition acecBo.c:167
int Acec_DetectBoothOne(Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
Definition acecBo.c:116
#define Gia_ManForEachAnd(p, pObj, i)
Definition gia.h:1214
Here is the call graph for this function:

◆ Acec_DetectBoothTwo()

int Acec_DetectBoothTwo ( Gia_Man_t * p,
Gia_Obj_t * pObj,
int pIns[5] )

Definition at line 167 of file acecBo.c.

168{
169 Gia_Obj_t * pFan0, * pFan1;
170 if ( !Gia_ObjRecognizeExor( pObj, &pFan0, &pFan1 ) )
171 return 0;
172 pFan0 = Gia_Regular(pFan0);
173 pFan1 = Gia_Regular(pFan1);
174 if ( Acec_DetectBoothTwoXor( p, pFan0, pIns ) )
175 {
176 pIns[2] = Gia_ObjId(p, pFan1);
177 return 1;
178 }
179 if ( Acec_DetectBoothTwoXor( p, pFan1, pIns ) )
180 {
181 pIns[2] = Gia_ObjId(p, pFan0);
182 return 1;
183 }
184 return 0;
185}
int Acec_DetectBoothTwoXor(Gia_Man_t *p, Gia_Obj_t *pObj, int pIns[5])
Definition acecBo.c:142
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Acec_DetectBoothTwoXor()

int Acec_DetectBoothTwoXor ( Gia_Man_t * p,
Gia_Obj_t * pObj,
int pIns[5] )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 142 of file acecBo.c.

143{
144 Gia_Obj_t * pFan0, * pFan1;
145 if ( !Gia_ObjIsAnd(pObj) )
146 return 0;
147 if ( Gia_ObjRecognizeExor( Gia_ObjFanin0(pObj), &pFan0, &pFan1 ) )
148 {
149 pIns[0] = Gia_ObjId(p, Gia_Regular(pFan0));
150 pIns[1] = Gia_ObjId(p, Gia_Regular(pFan1));
151 pIns[2] = -1;
152 pIns[3] = 0;
153 pIns[4] = Gia_ObjId(p, Gia_ObjFanin1(pObj));
154 return 1;
155 }
156 if ( Gia_ObjRecognizeExor( Gia_ObjFanin1(pObj), &pFan0, &pFan1 ) )
157 {
158 pIns[0] = Gia_ObjId(p, Gia_Regular(pFan0));
159 pIns[1] = Gia_ObjId(p, Gia_Regular(pFan1));
160 pIns[2] = -1;
161 pIns[3] = 0;
162 pIns[4] = Gia_ObjId(p, Gia_ObjFanin0(pObj));
163 return 1;
164 }
165 return 0;
166}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Acec_DetectBoothXorFanin()

int Acec_DetectBoothXorFanin ( Gia_Man_t * p,
Gia_Obj_t * pObj,
int pIns[5] )

Definition at line 78 of file acecBo.c.

79{
80 Gia_Obj_t * pFan0, * pFan1;
81 //int Id = Gia_ObjId(p, pObj);
82 if ( !Gia_ObjIsAnd(pObj) )
83 return 0;
84 if ( !Gia_ObjFaninC0(pObj) || !Gia_ObjFaninC1(pObj) )
85 return 0;
86 pFan0 = Gia_ObjFanin0(pObj);
87 pFan1 = Gia_ObjFanin1(pObj);
88 if ( !Gia_ObjIsAnd(pFan0) || !Gia_ObjIsAnd(pFan1) )
89 return 0;
90 if ( Acec_DetectBoothXorMux(p, Gia_ObjFanin0(pFan0), Gia_ObjFanin0(pFan1), pIns) )
91 {
92 pIns[3] = Gia_ObjId(p, Gia_ObjFanin1(pFan0));
93 pIns[4] = Gia_ObjId(p, Gia_ObjFanin1(pFan1));
94 return 1;
95 }
96 if ( Acec_DetectBoothXorMux(p, Gia_ObjFanin0(pFan0), Gia_ObjFanin1(pFan1), pIns) )
97 {
98 pIns[3] = Gia_ObjId(p, Gia_ObjFanin1(pFan0));
99 pIns[4] = Gia_ObjId(p, Gia_ObjFanin0(pFan1));
100 return 1;
101 }
102 if ( Acec_DetectBoothXorMux(p, Gia_ObjFanin1(pFan0), Gia_ObjFanin0(pFan1), pIns) )
103 {
104 pIns[3] = Gia_ObjId(p, Gia_ObjFanin0(pFan0));
105 pIns[4] = Gia_ObjId(p, Gia_ObjFanin1(pFan1));
106 return 1;
107 }
108 if ( Acec_DetectBoothXorMux(p, Gia_ObjFanin1(pFan0), Gia_ObjFanin1(pFan1), pIns) )
109 {
110 pIns[3] = Gia_ObjId(p, Gia_ObjFanin0(pFan0));
111 pIns[4] = Gia_ObjId(p, Gia_ObjFanin0(pFan1));
112 return 1;
113 }
114 return 0;
115}
ABC_NAMESPACE_IMPL_START int Acec_DetectBoothXorMux(Gia_Man_t *p, Gia_Obj_t *pMux, Gia_Obj_t *pXor, int pIns[3])
DECLARATIONS ///.
Definition acecBo.c:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Acec_DetectBoothXorMux()

ABC_NAMESPACE_IMPL_START int Acec_DetectBoothXorMux ( Gia_Man_t * p,
Gia_Obj_t * pMux,
Gia_Obj_t * pXor,
int pIns[3] )

DECLARATIONS ///.

CFile****************************************************************

FileName [acecBo.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [CEC for arithmetic circuits.]

Synopsis [Core procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id
acecBo.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

] FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 48 of file acecBo.c.

49{
50 Gia_Obj_t * pFan0, * pFan1;
51 Gia_Obj_t * pDat0, * pDat1, * pCtrl;
52 if ( !Gia_ObjIsMuxType(pMux) || !Gia_ObjIsMuxType(pXor) )
53 return 0;
54 if ( !Gia_ObjRecognizeExor( pXor, &pFan0, &pFan1 ) )
55 return 0;
56 pFan0 = Gia_Regular(pFan0);
57 pFan1 = Gia_Regular(pFan1);
58 if ( Gia_ObjId(p, pFan0) > Gia_ObjId(p, pFan1) )
59 ABC_SWAP( Gia_Obj_t *, pFan0, pFan1 );
60 if ( !(pCtrl = Gia_ObjRecognizeMux( pMux, &pDat0, &pDat1 )) )
61 return 0;
62 pDat0 = Gia_Regular(pDat0);
63 pDat1 = Gia_Regular(pDat1);
64 pCtrl = Gia_Regular(pCtrl);
65 if ( !Gia_ObjIsAnd(pDat0) || !Gia_ObjIsAnd(pDat1) )
66 return 0;
67 if ( Gia_ObjFaninId0p(p, pDat0) != Gia_ObjFaninId0p(p, pDat1) ||
68 Gia_ObjFaninId1p(p, pDat0) != Gia_ObjFaninId1p(p, pDat1) )
69 return 0;
70 if ( Gia_ObjFaninId0p(p, pDat0) != Gia_ObjId(p, pFan0) ||
71 Gia_ObjFaninId1p(p, pDat0) != Gia_ObjId(p, pFan1) )
72 return 0;
73 pIns[0] = Gia_ObjId(p, pFan0);
74 pIns[1] = Gia_ObjId(p, pFan1);
75 pIns[2] = Gia_ObjId(p, pCtrl);
76 return 1;
77}
#define ABC_SWAP(Type, a, b)
Definition abc_global.h:253
Gia_Obj_t * Gia_ObjRecognizeMux(Gia_Obj_t *pNode, Gia_Obj_t **ppNodeT, Gia_Obj_t **ppNodeE)
Definition giaUtil.c:1056
int Gia_ObjIsMuxType(Gia_Obj_t *pNode)
Definition giaUtil.c:982
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Gia_ManResubTest4()

void Gia_ManResubTest4 ( )

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 222 of file acecBo.c.

223{
224 Vec_Int_t * vRes = Vec_IntAlloc( 100 );
225 unsigned T = 0xF335ACC0;
226 int a, b, c;
227 int i, k, f, y;
228 int Count = 0;
229 for ( a = 0; a < 2; a++ )
230 {
231 unsigned A = s_Truths5[a];
232 for ( b = 0; b < 3; b++ )
233 {
234 unsigned B = s_Truths5[2+b];
235 for ( c = 0; c < 3; c++ ) if ( c != b )
236 {
237 unsigned C = s_Truths5[2+c];
238 Vec_IntPush( vRes, A & B & C );
239 Vec_IntPush( vRes, A & B & ~C );
240 }
241 }
242 }
243 printf( "Size = %d.\n", Vec_IntSize(vRes) );
244 for ( i = 0; i < (1 << Vec_IntSize(vRes)); i++ )
245 {
246 unsigned F[7] = {0};
247 unsigned Y[3] = {0};
248 if ( Abc_TtCountOnes( (word)i ) >= 8 )
249 continue;
250 for ( f = k = 0; k < Vec_IntSize(vRes); k++ )
251 if ( ((i >> k) & 1) )
252 F[f++] = Vec_IntEntry(vRes, k);
253 {
254 unsigned S1 = (F[0] & F[1]) | (F[0] & F[2]) | (F[1] & F[2]);
255 unsigned C1 = F[0] ^ F[1] ^ F[2];
256 unsigned S2 = (F[3] & F[4]) | (F[3] & F[5]) | (F[4] & F[5]);
257 unsigned C2 = F[3] ^ F[4] ^ F[5];
258 unsigned S3 = (F[6] & S1) | (F[6] & S2) | (S1 & S2);
259 unsigned C3 = F[6] ^ S1 ^ S2;
260 unsigned S4 = (C1 & C2) | (C1 & C3) | (C2 & C3);
261 unsigned C4 = C1 ^ C2 ^ C3;
262 Y[0] = S3;
263 Y[1] = S4;
264 Y[2] = C4;
265 }
266 for ( y = 0; y < 3; y++ )
267 if ( Y[y] == T )
268 printf( "Found!\n" );
269 Count++;
270 }
271 printf( "Tried = %d.\n", Count );
272 Vec_IntFree( vRes );
273}
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36

◆ Gia_ManResubTest5()

void Gia_ManResubTest5 ( )

Definition at line 274 of file acecBo.c.

275{
276 unsigned T = 0xF335ACC0;
277 int i;
278 for ( i = 0; i < 4; i++ )
279 {
280 unsigned x = i%2 ? Abc_Tt5Cofactor1(T, 0) : Abc_Tt5Cofactor0(T, 0);
281 unsigned y = i/2 ? Abc_Tt5Cofactor1(x, 1) : Abc_Tt5Cofactor0(x, 1);
282 word F = y;
283 F |= F << 32;
284 //Dau_DsdPrintFromTruth2( &F, 6 ); printf( "\n" );
285 }
286}