ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
dec.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Dec_Edge_t_
 
struct  Dec_Node_t_
 
struct  Dec_Graph_t_
 
struct  Dec_Man_t_
 

Macros

#define Dec_GraphForEachLeaf(pGraph, pLeaf, i)
 ITERATORS ///.
 
#define Dec_GraphForEachNode(pGraph, pAnd, i)
 

Typedefs

typedef typedefABC_NAMESPACE_HEADER_START struct Dec_Edge_t_ Dec_Edge_t
 INCLUDES ///.
 
typedef struct Dec_Node_t_ Dec_Node_t
 
typedef struct Dec_Graph_t_ Dec_Graph_t
 
typedef struct Dec_Man_t_ Dec_Man_t
 

Functions

Dec_Graph_tDec_Factor (char *pSop)
 FUNCTION DECLARATIONS ///.
 
Dec_Man_tDec_ManStart ()
 DECLARATIONS ///.
 
void Dec_ManStop (Dec_Man_t *p)
 
void Dec_GraphPrint (FILE *pFile, Dec_Graph_t *pGraph, char *pNamesIn[], char *pNameOut)
 FUNCTION DEFINITIONS ///.
 
unsigned Dec_GraphDeriveTruth (Dec_Graph_t *pGraph)
 DECLARATIONS ///.
 

Macro Definition Documentation

◆ Dec_GraphForEachLeaf

#define Dec_GraphForEachLeaf ( pGraph,
pLeaf,
i )
Value:
for ( i = 0; (i < (pGraph)->nLeaves) && (((pLeaf) = Dec_GraphNode(pGraph, i)), 1); i++ )

ITERATORS ///.

Definition at line 98 of file dec.h.

98#define Dec_GraphForEachLeaf( pGraph, pLeaf, i ) \
99 for ( i = 0; (i < (pGraph)->nLeaves) && (((pLeaf) = Dec_GraphNode(pGraph, i)), 1); i++ )

◆ Dec_GraphForEachNode

#define Dec_GraphForEachNode ( pGraph,
pAnd,
i )
Value:
for ( i = (pGraph)->nLeaves; (i < (pGraph)->nSize) && (((pAnd) = Dec_GraphNode(pGraph, i)), 1); i++ )

Definition at line 101 of file dec.h.

101#define Dec_GraphForEachNode( pGraph, pAnd, i ) \
102 for ( i = (pGraph)->nLeaves; (i < (pGraph)->nSize) && (((pAnd) = Dec_GraphNode(pGraph, i)), 1); i++ )

Typedef Documentation

◆ Dec_Edge_t

typedef typedefABC_NAMESPACE_HEADER_START struct Dec_Edge_t_ Dec_Edge_t

INCLUDES ///.

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

FileName [dec.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [A simple decomposition tree/node data structure and its APIs.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id
dec.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

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

FileName [deco.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [A simple decomposition tree/node data structure and its APIs.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id
deco.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

] PARAMETERS /// BASIC TYPES ///

Definition at line 42 of file dec.h.

◆ Dec_Graph_t

typedef struct Dec_Graph_t_ Dec_Graph_t

Definition at line 68 of file dec.h.

◆ Dec_Man_t

typedef struct Dec_Man_t_ Dec_Man_t

Definition at line 79 of file dec.h.

◆ Dec_Node_t

typedef struct Dec_Node_t_ Dec_Node_t

Definition at line 49 of file dec.h.

Function Documentation

◆ Dec_Factor()

Dec_Graph_t * Dec_Factor ( char * pSop)
extern

FUNCTION DECLARATIONS ///.

FUNCTION DECLARATIONS ///.

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

Synopsis [Factors the cover.]

Description []

SideEffects []

SeeAlso []

Definition at line 58 of file decFactor.c.

59{
60 Mvc_Cover_t * pCover;
61 Dec_Graph_t * pFForm;
62 Dec_Edge_t eRoot;
63 if ( Abc_SopIsConst0(pSop) )
64 return Dec_GraphCreateConst0();
65 if ( Abc_SopIsConst1(pSop) )
66 return Dec_GraphCreateConst1();
67
68 // derive the cover from the SOP representation
69 pCover = Dec_ConvertSopToMvc( pSop );
70
71 // make sure the cover is CCS free (should be done before CST)
72 Mvc_CoverContain( pCover );
73
74 // check for trivial functions
75 assert( !Mvc_CoverIsEmpty(pCover) );
76 assert( !Mvc_CoverIsTautology(pCover) );
77
78 // perform CST
79 Mvc_CoverInverse( pCover ); // CST
80 // start the factored form
81 pFForm = Dec_GraphCreate( Abc_SopGetVarNum(pSop) );
82 // factor the cover
83 eRoot = Dec_Factor_rec( pFForm, pCover );
84 // finalize the factored form
85 Dec_GraphSetRoot( pFForm, eRoot );
86 // complement the factored form if SOP is complemented
87 if ( Abc_SopIsComplement(pSop) )
88 Dec_GraphComplement( pFForm );
89 // verify the factored form
90// if ( !Dec_FactorVerify( pSop, pFForm ) )
91// printf( "Verification has failed.\n" );
92// Mvc_CoverInverse( pCover ); // undo CST
93 Mvc_CoverFree( pCover );
94 return pFForm;
95}
ABC_DLL int Abc_SopIsConst0(char *pSop)
Definition abcSop.c:724
ABC_DLL int Abc_SopGetVarNum(char *pSop)
Definition abcSop.c:584
ABC_DLL int Abc_SopIsComplement(char *pSop)
Definition abcSop.c:703
ABC_DLL int Abc_SopIsConst1(char *pSop)
Definition abcSop.c:740
typedefABC_NAMESPACE_HEADER_START struct Dec_Edge_t_ Dec_Edge_t
INCLUDES ///.
Definition dec.h:42
struct Dec_Graph_t_ Dec_Graph_t
Definition dec.h:68
void Mvc_CoverFree(Mvc_Cover_t *pCover)
Definition mvcCover.c:138
int Mvc_CoverContain(Mvc_Cover_t *pCover)
FUNCTION DEFINITIONS ///.
Definition mvcContain.c:47
int Mvc_CoverIsEmpty(Mvc_Cover_t *pCover)
Definition mvcApi.c:93
int Mvc_CoverIsTautology(Mvc_Cover_t *pCover)
Definition mvcApi.c:109
struct MvcCoverStruct Mvc_Cover_t
Definition mvc.h:58
void Mvc_CoverInverse(Mvc_Cover_t *pCover)
Definition mvcUtils.c:481
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dec_GraphDeriveTruth()

unsigned Dec_GraphDeriveTruth ( Dec_Graph_t * pGraph)
extern

DECLARATIONS ///.

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

FileName [decUtil.c]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Decomposition unitilies.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id
decUtil.c,v 1.1 2003/05/22 19:20:05 alanmi Exp

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

Synopsis [Derives the truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 102 of file decUtil.c.

103{
104 unsigned uTruths[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
105 unsigned uTruth = 0; // Suppress "might be used uninitialized"
106 unsigned uTruth0, uTruth1;
107 Dec_Node_t * pNode;
108 int i;
109
110 // sanity checks
111 assert( Dec_GraphLeaveNum(pGraph) >= 0 );
112 assert( Dec_GraphLeaveNum(pGraph) <= pGraph->nSize );
113 assert( Dec_GraphLeaveNum(pGraph) <= 5 );
114
115 // check for constant function
116 if ( Dec_GraphIsConst(pGraph) )
117 return Dec_GraphIsComplement(pGraph)? 0 : ~((unsigned)0);
118 // check for a literal
119 if ( Dec_GraphIsVar(pGraph) )
120 return Dec_GraphIsComplement(pGraph)? ~uTruths[Dec_GraphVarInt(pGraph)] : uTruths[Dec_GraphVarInt(pGraph)];
121
122 // assign the elementary variables
123 Dec_GraphForEachLeaf( pGraph, pNode, i )
124 pNode->pFunc = (void *)(ABC_PTRUINT_T)uTruths[i];
125
126 // compute the function for each internal node
127 Dec_GraphForEachNode( pGraph, pNode, i )
128 {
129 uTruth0 = (unsigned)(ABC_PTRUINT_T)Dec_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc;
130 uTruth1 = (unsigned)(ABC_PTRUINT_T)Dec_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc;
131 uTruth0 = pNode->eEdge0.fCompl? ~uTruth0 : uTruth0;
132 uTruth1 = pNode->eEdge1.fCompl? ~uTruth1 : uTruth1;
133 uTruth = uTruth0 & uTruth1;
134 pNode->pFunc = (void *)(ABC_PTRUINT_T)uTruth;
135 }
136
137 // complement the result if necessary
138 return Dec_GraphIsComplement(pGraph)? ~uTruth : uTruth;
139}
struct Dec_Node_t_ Dec_Node_t
Definition dec.h:49
#define Dec_GraphForEachLeaf(pGraph, pLeaf, i)
ITERATORS ///.
Definition dec.h:98
#define Dec_GraphForEachNode(pGraph, pAnd, i)
Definition dec.h:101
int nSize
Definition dec.h:73
Dec_Edge_t eEdge1
Definition dec.h:53
void * pFunc
Definition dec.h:56
Dec_Edge_t eEdge0
Definition dec.h:52
Here is the caller graph for this function:

◆ Dec_GraphPrint()

void Dec_GraphPrint ( FILE * pFile,
Dec_Graph_t * pGraph,
char * pNamesIn[],
char * pNameOut )
extern

FUNCTION DEFINITIONS ///.

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

Synopsis [Prints the decomposition graph.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file decPrint.c.

50{
51 Vec_Ptr_t * vNamesIn = NULL;
52 int LitSizeMax, LitSizeCur, Pos, i;
53
54 // create the names if not given by the user
55 if ( pNamesIn == NULL )
56 {
57 vNamesIn = Abc_NodeGetFakeNames( Dec_GraphLeaveNum(pGraph) );
58 pNamesIn = (char **)vNamesIn->pArray;
59 }
60 if ( pNameOut == NULL )
61 pNameOut = "F";
62
63 // get the size of the longest literal
64 LitSizeMax = 0;
65 for ( i = 0; i < Dec_GraphLeaveNum(pGraph); i++ )
66 {
67 LitSizeCur = strlen(pNamesIn[i]);
68 if ( LitSizeMax < LitSizeCur )
69 LitSizeMax = LitSizeCur;
70 }
71 if ( LitSizeMax > 50 )
72 LitSizeMax = 20;
73
74 // write the decomposition graph (factored form)
75 if ( Dec_GraphIsConst(pGraph) ) // constant
76 {
77 Pos = Dec_GraphPrintOutputName( pFile, pNameOut );
78 fprintf( pFile, "Constant %d", !Dec_GraphIsComplement(pGraph) );
79 }
80 else if ( Dec_GraphIsVar(pGraph) ) // literal
81 {
82 Pos = Dec_GraphPrintOutputName( pFile, pNameOut );
83 Dec_GraphPrintGetLeafName( pFile, Dec_GraphVarInt(pGraph), Dec_GraphIsComplement(pGraph), pNamesIn );
84 }
85 else
86 {
87 Pos = Dec_GraphPrintOutputName( pFile, pNameOut );
88 Dec_GraphPrint_rec( pFile, pGraph, Dec_GraphNodeLast(pGraph), Dec_GraphIsComplement(pGraph), pNamesIn, &Pos, LitSizeMax );
89 }
90 fprintf( pFile, "\n" );
91
92 if ( vNamesIn )
93 Abc_NodeFreeNames( vNamesIn );
94}
ABC_DLL void Abc_NodeFreeNames(Vec_Ptr_t *vNames)
Definition abcNames.c:264
ABC_DLL Vec_Ptr_t * Abc_NodeGetFakeNames(int nNames)
Definition abcNames.c:228
ush Pos
Definition deflate.h:88
int strlen()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dec_ManStart()

Dec_Man_t * Dec_ManStart ( )
extern

DECLARATIONS ///.

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

FileName [decMan.c]

PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

Synopsis [Decomposition manager.]

Author [MVSIS Group]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - February 1, 2003.]

Revision [

Id
decMan.c,v 1.1 2003/05/22 19:20:05 alanmi Exp

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

Synopsis [Start the MVC manager used in the factoring package.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file decMan.c.

46{
47 Dec_Man_t * p;
48// abctime clk = Abc_Clock();
49 p = ABC_ALLOC( Dec_Man_t, 1 );
50 p->pMvcMem = Mvc_ManagerStart();
51 p->vCubes = Vec_IntAlloc( 8 );
52 p->vLits = Vec_IntAlloc( 8 );
53 // canonical forms, phases, perms
54 Extra_Truth4VarNPN( &p->puCanons, &p->pPhases, &p->pPerms, &p->pMap );
55//ABC_PRT( "NPN classes precomputation time", Abc_Clock() - clk );
56 return p;
57}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
struct Dec_Man_t_ Dec_Man_t
Definition dec.h:79
Cube * p
Definition exorList.c:222
void Extra_Truth4VarNPN(unsigned short **puCanons, char **puPhases, char **puPerms, unsigned char **puMap)
Mvc_Manager_t * Mvc_ManagerStart()
DECLARATIONS ///.
Definition mvcMan.c:44
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dec_ManStop()

void Dec_ManStop ( Dec_Man_t * p)
extern

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

Synopsis [Stops the MVC maanager used in the factoring package.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file decMan.c.

71{
72 Mvc_ManagerFree( (Mvc_Manager_t *)p->pMvcMem );
73 Vec_IntFree( p->vCubes );
74 Vec_IntFree( p->vLits );
75 ABC_FREE( p->puCanons );
76 ABC_FREE( p->pPhases );
77 ABC_FREE( p->pPerms );
78 ABC_FREE( p->pMap );
79 ABC_FREE( p );
80}
#define ABC_FREE(obj)
Definition abc_global.h:267
struct MvcManagerStruct Mvc_Manager_t
Definition mvc.h:60
void Mvc_ManagerFree(Mvc_Manager_t *p)
Definition mvcMan.c:67
Here is the call graph for this function:
Here is the caller graph for this function: