ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
fpgaSwitch.c
Go to the documentation of this file.
1
18
19#include "fpgaInt.h"
20
22
23
27
31
44{
45 float aResult, aResult2;
46 aResult2 = Fpga_CutRefSwitch( pMan, pNode, pCut, 0 );
47 aResult = Fpga_CutDerefSwitch( pMan, pNode, pCut, 0 );
48// assert( aResult == aResult2 );
49 return aResult;
50}
51
63float Fpga_CutRefSwitch( Fpga_Man_t * pMan, Fpga_Node_t * pNode, Fpga_Cut_t * pCut, int fFanouts )
64{
65 Fpga_Node_t * pNodeChild;
66 float aArea;
67 int i;
68 // start the area of this cut
69 aArea = pNode->Switching;
70 if ( pCut->nLeaves == 1 )
71 return aArea;
72 // go through the children
73 for ( i = 0; i < pCut->nLeaves; i++ )
74 {
75 pNodeChild = pCut->ppLeaves[i];
76 assert( pNodeChild->nRefs >= 0 );
77 if ( pNodeChild->nRefs++ > 0 )
78 continue;
79 aArea += Fpga_CutRefSwitch( pMan, pNodeChild, pNodeChild->pCutBest, fFanouts );
80 }
81 return aArea;
82}
83
95float Fpga_CutDerefSwitch( Fpga_Man_t * pMan, Fpga_Node_t * pNode, Fpga_Cut_t * pCut, int fFanouts )
96{
97 Fpga_Node_t * pNodeChild;
98 float aArea;
99 int i;
100 // start the area of this cut
101 aArea = pNode->Switching;
102 if ( pCut->nLeaves == 1 )
103 return aArea;
104 // go through the children
105 for ( i = 0; i < pCut->nLeaves; i++ )
106 {
107 pNodeChild = pCut->ppLeaves[i];
108 assert( pNodeChild->nRefs > 0 );
109 if ( --pNodeChild->nRefs > 0 )
110 continue;
111 aArea += Fpga_CutDerefSwitch( pMan, pNodeChild, pNodeChild->pCutBest, fFanouts );
112 }
113 return aArea;
114}
115
128{
129 Fpga_Node_t * pNode;
130 float Switch;
131 int i;
132 Switch = 0.0;
133 for ( i = 0; i < vMapping->nSize; i++ )
134 {
135 pNode = vMapping->pArray[i];
136 // at least one phase has the best cut assigned
137 assert( !Fpga_NodeIsAnd(pNode) || pNode->pCutBest != NULL );
138 // at least one phase is used in the mapping
139 assert( pNode->nRefs > 0 );
140 // compute the array due to the supergate
141 Switch += pNode->Switching;
142 }
143 // add buffer for each CO driven by a CI
144 for ( i = 0; i < pMan->nOutputs; i++ )
145 if ( Fpga_NodeIsVar(Fpga_Regular(pMan->pOutputs[i])) && !Fpga_IsComplement(pMan->pOutputs[i]) )
146 Switch += Fpga_Regular(pMan->pOutputs[i])->Switching;
147 return Switch;
148}
149
153
154
156
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
float Fpga_CutRefSwitch(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
Definition fpgaSwitch.c:63
float Fpga_CutDerefSwitch(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut, int fFanouts)
Definition fpgaSwitch.c:95
ABC_NAMESPACE_IMPL_START float Fpga_CutGetSwitchDerefed(Fpga_Man_t *pMan, Fpga_Node_t *pNode, Fpga_Cut_t *pCut)
DECLARATIONS ///.
Definition fpgaSwitch.c:43
float Fpga_MappingGetSwitching(Fpga_Man_t *pMan, Fpga_NodeVec_t *vMapping)
Definition fpgaSwitch.c:127
struct Fpga_NodeStruct_t_ Fpga_Node_t
Definition fpga.h:44
struct Fpga_NodeVecStruct_t_ Fpga_NodeVec_t
Definition fpga.h:45
struct Fpga_ManStruct_t_ Fpga_Man_t
STRUCTURE DEFINITIONS ///.
Definition fpga.h:43
struct Fpga_CutStruct_t_ Fpga_Cut_t
Definition fpga.h:46
#define Fpga_IsComplement(p)
GLOBAL VARIABLES ///.
Definition fpga.h:57
int Fpga_NodeIsAnd(Fpga_Node_t *p)
Definition fpgaCreate.c:127
int Fpga_NodeIsVar(Fpga_Node_t *p)
Definition fpgaCreate.c:126
#define Fpga_Regular(p)
Definition fpga.h:58
Fpga_Node_t * ppLeaves[FPGA_MAX_LEAVES+1]
Definition fpgaInt.h:237
Fpga_Node_t ** pOutputs
Definition fpgaInt.h:106
Fpga_Cut_t * pCutBest
Definition fpgaInt.h:222
Fpga_Node_t ** pArray
Definition fpgaInt.h:252
#define assert(ex)
Definition util_old.h:213