abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
timBox.c File Reference
#include "timInt.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Tim_ManCreateBox (Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
 DECLARATIONS ///. More...
 
int Tim_ManBoxForCi (Tim_Man_t *p, int iCi)
 
int Tim_ManBoxForCo (Tim_Man_t *p, int iCo)
 
int Tim_ManBoxInputFirst (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxInputLast (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxOutputFirst (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxOutputLast (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxInputNum (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxOutputNum (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxDelayTableId (Tim_Man_t *p, int iBox)
 
float * Tim_ManBoxDelayTable (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxIsBlack (Tim_Man_t *p, int iBox)
 
int Tim_ManBoxCopy (Tim_Man_t *p, int iBox)
 
void Tim_ManBoxSetCopy (Tim_Man_t *p, int iBox, int iCopy)
 
int Tim_ManBoxFindFromCiNum (Tim_Man_t *p, int iCiNum)
 

Function Documentation

int Tim_ManBoxCopy ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Returns the copy of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 274 of file timBox.c.

275 {
276  return Tim_ManBox(p, iBox)->iCopy;
277 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
float* Tim_ManBoxDelayTable ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Return the delay table.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file timBox.c.

235 {
236  float * pTable;
237  Tim_Box_t * pBox = Tim_ManBox(p, iBox);
238  if ( pBox->iDelayTable < 0 )
239  return NULL;
240  pTable = (float *)Vec_PtrEntry( p->vDelayTables, pBox->iDelayTable );
241  assert( (int)pTable[1] == pBox->nInputs );
242  assert( (int)pTable[2] == pBox->nOutputs );
243  return pTable;
244 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManBoxDelayTableId ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Return the delay table id.]

Description []

SideEffects []

SeeAlso []

Definition at line 218 of file timBox.c.

219 {
220  return Tim_ManBox(p, iBox)->iDelayTable;
221 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxFindFromCiNum ( Tim_Man_t p,
int  iCiNum 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 306 of file timBox.c.

307 {
308  Tim_Box_t * pBox;
309  int i;
310  assert( iCiNum >= 0 && iCiNum < Tim_ManCiNum(p) );
311  if ( iCiNum < Tim_ManPiNum(p) )
312  return -1;
313  Tim_ManForEachBox( p, pBox, i )
314  if ( iCiNum < Tim_ManBoxOutputFirst(p, i) )
315  return i - 1;
316  return -2;
317 }
int Tim_ManBoxOutputFirst(Tim_Man_t *p, int iBox)
Definition: timBox.c:154
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
if(last==0)
Definition: sparse_int.h:34
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManBoxForCi ( Tim_Man_t p,
int  iCi 
)

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

Synopsis [Returns the box number for the given input.]

Description []

SideEffects []

SeeAlso []

Definition at line 86 of file timBox.c.

87 {
88  if ( iCi >= p->nCis )
89  return -1;
90  return p->pCis[iCi].iObj2Box;
91 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxForCo ( Tim_Man_t p,
int  iCo 
)

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

Synopsis [Returns the box number for the given output.]

Description []

SideEffects []

SeeAlso []

Definition at line 104 of file timBox.c.

105 {
106  if ( iCo >= p->nCos )
107  return -1;
108  return p->pCos[iCo].iObj2Box;
109 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxInputFirst ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Returns the first input of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 122 of file timBox.c.

123 {
124  return Tim_ManBox(p, iBox)->Inouts[0];
125 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxInputLast ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Returns the last input of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 138 of file timBox.c.

139 {
140  return Tim_ManBox(p, iBox)->Inouts[0] + Tim_ManBoxInputNum(p, iBox) - 1;
141 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxInputNum ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Returns the number of box inputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 186 of file timBox.c.

187 {
188  return Tim_ManBox(p, iBox)->nInputs;
189 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxIsBlack ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Return 1 if the box is black.]

Description []

SideEffects []

SeeAlso []

Definition at line 257 of file timBox.c.

258 {
259  return Tim_ManBox(p, iBox)->fBlack;
260 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxOutputFirst ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Returns the first output of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 154 of file timBox.c.

155 {
156  return Tim_ManBox(p, iBox)->Inouts[Tim_ManBox(p, iBox)->nInputs];
157 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxOutputLast ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Returns the last output of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file timBox.c.

171 {
172  return Tim_ManBox(p, iBox)->Inouts[Tim_ManBox(p, iBox)->nInputs] + Tim_ManBoxOutputNum(p, iBox) - 1;
173 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Tim_ManBoxOutputNum ( Tim_Man_t p,
int  iBox 
)

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

Synopsis [Returns the number of box outputs.]

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file timBox.c.

203 {
204  return Tim_ManBox(p, iBox)->nOutputs;
205 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
void Tim_ManBoxSetCopy ( Tim_Man_t p,
int  iBox,
int  iCopy 
)

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

Synopsis [Sets the copy of the box.]

Description []

SideEffects []

SeeAlso []

Definition at line 290 of file timBox.c.

291 {
292  Tim_ManBox(p, iBox)->iCopy = iCopy;
293 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
ABC_NAMESPACE_IMPL_START void Tim_ManCreateBox ( Tim_Man_t p,
int  firstIn,
int  nIns,
int  firstOut,
int  nOuts,
int  iDelayTable 
)

DECLARATIONS ///.

ITERATORS ///.

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

FileName [timBox.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchy/timing manager.]

Synopsis [Manipulation of timing boxes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
timBox.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

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

Synopsis [Creates the new timing box.]

Description []

SideEffects []

SeeAlso []

Definition at line 44 of file timBox.c.

45 {
46  Tim_Box_t * pBox;
47  int i;
48  if ( p->vBoxes == NULL )
49  p->vBoxes = Vec_PtrAlloc( 100 );
50  pBox = (Tim_Box_t *)Mem_FlexEntryFetch( p->pMemObj, sizeof(Tim_Box_t) + sizeof(int) * (nIns+nOuts) );
51  memset( pBox, 0, sizeof(Tim_Box_t) );
52  pBox->iBox = Vec_PtrSize( p->vBoxes );
53  Vec_PtrPush( p->vBoxes, pBox );
54  pBox->iDelayTable = iDelayTable;
55  pBox->nInputs = nIns;
56  pBox->nOutputs = nOuts;
57  for ( i = 0; i < nIns; i++ )
58  {
59  assert( firstIn+i < p->nCos );
60  pBox->Inouts[i] = firstIn+i;
61  p->pCos[firstIn+i].iObj2Box = pBox->iBox;
62  p->pCos[firstIn+i].iObj2Num = i;
63  }
64  for ( i = 0; i < nOuts; i++ )
65  {
66  assert( firstOut+i < p->nCis );
67  pBox->Inouts[nIns+i] = firstOut+i;
68  p->pCis[firstOut+i].iObj2Box = pBox->iBox;
69  p->pCis[firstOut+i].iObj2Num = i;
70  }
71 // if ( pBox->iBox < 20 )
72 // printf( "%4d %4d %4d %4d \n", firstIn, nIns, firstOut, nOuts );
73 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
char * Mem_FlexEntryFetch(Mem_Flex_t *p, int nBytes)
Definition: mem.c:372
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48