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

Go to the source code of this file.

Macros

#define TIM_DUMP_VER_NUM   1
 DECLARATIONS ///. More...
 

Functions

Vec_Str_tTim_ManSave (Tim_Man_t *p, int fHieOnly)
 FUNCTION DEFINITIONS ///. More...
 
Tim_Man_tTim_ManLoad (Vec_Str_t *p, int fHieOnly)
 

Macro Definition Documentation

#define TIM_DUMP_VER_NUM   1

DECLARATIONS ///.

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

FileName [timDump.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchy/timing manager.]

Synopsis [Saving and loading the hierarchy timing manager.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

]

Definition at line 29 of file timDump.c.

Function Documentation

Tim_Man_t* Tim_ManLoad ( Vec_Str_t p,
int  fHieOnly 
)

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

Synopsis [Restores the timing manager from the char stream.]

Description []

SideEffects []

SeeAlso []

Definition at line 112 of file timDump.c.

113 {
114  Tim_Man_t * pMan;
115  Tim_Obj_t * pObj;
116  int VerNum, nCis, nCos, nPis, nPos;
117  int nBoxes, nBoxIns, nBoxOuts, CopyBox;
118  int TableId, nTables, TableSize, TableX, TableY;
119  int i, k, curPi, curPo, iStr = 0;
120  float * pDelayTable;
121  // get version number
122  VerNum = Vec_StrGetI_ne( p, &iStr );
123  assert( VerNum == TIM_DUMP_VER_NUM );
124  // get the number of CIs/COs
125  nCis = Vec_StrGetI_ne( p, &iStr );
126  nCos = Vec_StrGetI_ne( p, &iStr );
127  // get the number of PIs/POs
128  nPis = Vec_StrGetI_ne( p, &iStr );
129  nPos = Vec_StrGetI_ne( p, &iStr );
130  // start the timing manager
131  pMan = Tim_ManStart( nCis, nCos );
132  // start boxes
133  nBoxes = Vec_StrGetI_ne( p, &iStr );
134  assert( pMan->vBoxes == NULL );
135  if ( nBoxes > 0 )
136  pMan->vBoxes = Vec_PtrAlloc( nBoxes );
137  // create boxes
138  curPi = nPis;
139  curPo = 0;
140  for ( i = 0; i < nBoxes; i++ )
141  {
142  nBoxIns = Vec_StrGetI_ne( p, &iStr );
143  nBoxOuts = Vec_StrGetI_ne( p, &iStr );
144  TableId = Vec_StrGetI_ne( p, &iStr );
145  CopyBox = Vec_StrGetI_ne( p, &iStr );
146  Tim_ManCreateBox( pMan, curPo, nBoxIns, curPi, nBoxOuts, TableId );
147  Tim_ManBoxSetCopy( pMan, i, CopyBox );
148  curPi += nBoxOuts;
149  curPo += nBoxIns;
150  }
151  curPo += nPos;
152  assert( curPi == nCis );
153  assert( curPo == nCos );
154  if ( fHieOnly )
155  return pMan;
156  // create delay tables
157  nTables = Vec_StrGetI_ne( p, &iStr );
158  assert( pMan->vDelayTables == NULL );
159  if ( nTables > 0 )
160  pMan->vDelayTables = Vec_PtrAlloc( nTables );
161  // read delay tables
162  for ( i = 0; i < nTables; i++ )
163  {
164  // read table ID and dimensions
165  TableId = Vec_StrGetI_ne( p, &iStr );
166  TableX = Vec_StrGetI_ne( p, &iStr );
167  TableY = Vec_StrGetI_ne( p, &iStr );
168  assert( TableId == i );
169  // create new table
170  TableSize = TableX * TableY;
171  pDelayTable = ABC_ALLOC( float, TableSize + 3 );
172  pDelayTable[0] = TableId;
173  pDelayTable[1] = TableX;
174  pDelayTable[2] = TableY;
175  // read table contents
176  for ( k = 0; k < TableSize; k++ )
177  pDelayTable[k+3] = Vec_StrGetF( p, &iStr );
178  assert( Vec_PtrSize(pMan->vDelayTables) == TableId );
179  Vec_PtrPush( pMan->vDelayTables, pDelayTable );
180  }
181  assert( Tim_ManDelayTableNum(pMan) == nTables );
182  // read PI arrival times
183  Tim_ManForEachPi( pMan, pObj, i )
184  Tim_ManInitPiArrival( pMan, i, Vec_StrGetF(p, &iStr) );
185  // read PO required times
186  Tim_ManForEachPo( pMan, pObj, i )
187  Tim_ManInitPoRequired( pMan, i, Vec_StrGetF(p, &iStr) );
188  assert( Vec_StrSize(p) == iStr );
189 // Tim_ManPrint( pMan );
190  return pMan;
191 }
static int Vec_StrGetI_ne(Vec_Str_t *vOut, int *pPos)
Definition: vecStr.h:821
static float Vec_StrGetF(Vec_Str_t *vOut, int *pPos)
Definition: vecStr.h:870
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
void Tim_ManCreateBox(Tim_Man_t *p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable)
ITERATORS ///.
Definition: timBox.c:44
void Tim_ManInitPoRequired(Tim_Man_t *p, int iPo, float Delay)
Definition: timTime.c:61
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
void Tim_ManInitPiArrival(Tim_Man_t *p, int iPi, float Delay)
DECLARATIONS ///.
Definition: timTime.c:44
Tim_Man_t * Tim_ManStart(int nCis, int nCos)
DECLARATIONS ///.
Definition: timMan.c:45
static int Vec_StrSize(Vec_Str_t *p)
Definition: bblif.c:600
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
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_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
void Tim_ManBoxSetCopy(Tim_Man_t *p, int iBox, int iCopy)
Definition: timBox.c:290
#define TIM_DUMP_VER_NUM
DECLARATIONS ///.
Definition: timDump.c:29
Vec_Str_t* Tim_ManSave ( Tim_Man_t p,
int  fHieOnly 
)

FUNCTION DEFINITIONS ///.

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

Synopsis [Transform the timing manager into the char stream.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file timDump.c.

47 {
48  Tim_Box_t * pBox;
49  Tim_Obj_t * pObj;
50  Vec_Str_t * vStr;
51  float * pDelayTable;
52  int i, k, TableSize;
53  // create output stream
54  vStr = Vec_StrAlloc( 10000 );
55  // dump version number
57  // save CI/CO counts
58  Vec_StrPutI_ne( vStr, Tim_ManCiNum(p) );
59  Vec_StrPutI_ne( vStr, Tim_ManCoNum(p) );
60  // save PI/PO counts
61  Vec_StrPutI_ne( vStr, Tim_ManPiNum(p) );
62  Vec_StrPutI_ne( vStr, Tim_ManPoNum(p) );
63  // save number of boxes
64  Vec_StrPutI_ne( vStr, Tim_ManBoxNum(p) );
65  // for each box, save num_inputs, num_outputs, delay table ID, and copy field
66  if ( Tim_ManBoxNum(p) > 0 )
67  Tim_ManForEachBox( p, pBox, i )
68  {
69  Vec_StrPutI_ne( vStr, Tim_ManBoxInputNum(p, pBox->iBox) );
70  Vec_StrPutI_ne( vStr, Tim_ManBoxOutputNum(p, pBox->iBox) );
71  Vec_StrPutI_ne( vStr, Tim_ManBoxDelayTableId(p, pBox->iBox) ); // can be -1 if delay table is not given
72  Vec_StrPutI_ne( vStr, Tim_ManBoxCopy(p, pBox->iBox) ); // can be -1 if the copy is node defined
73  }
74  if ( fHieOnly )
75  return vStr;
76  // save the number of delay tables
78  // save the delay tables
79  if ( Tim_ManDelayTableNum(p) > 0 )
80  Tim_ManForEachTable( p, pDelayTable, i )
81  {
82  assert( (int)pDelayTable[0] == i );
83  // save table ID and dimensions (inputs x outputs)
84  Vec_StrPutI_ne( vStr, (int)pDelayTable[0] );
85  Vec_StrPutI_ne( vStr, (int)pDelayTable[1] );
86  Vec_StrPutI_ne( vStr, (int)pDelayTable[2] );
87  // save table contents
88  TableSize = (int)pDelayTable[1] * (int)pDelayTable[2];
89  for ( k = 0; k < TableSize; k++ )
90  Vec_StrPutF( vStr, pDelayTable[k+3] );
91  }
92  // save PI arrival times
93  Tim_ManForEachPi( p, pObj, i )
94  Vec_StrPutF( vStr, Tim_ManGetCiArrival(p, pObj->Id) );
95  // save PO required times
96  Tim_ManForEachPo( p, pObj, i )
97  Vec_StrPutF( vStr, Tim_ManGetCoRequired(p, pObj->Id) );
98  return vStr;
99 }
int Tim_ManCoNum(Tim_Man_t *p)
Definition: timMan.c:684
#define Tim_ManForEachTable(p, pTable, i)
Definition: timInt.h:125
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define Tim_ManForEachBox(p, pBox, i)
Definition: timInt.h:117
#define Tim_ManForEachPo(p, pObj, i)
Definition: timInt.h:114
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Tim_ManBoxDelayTableId(Tim_Man_t *p, int iBox)
Definition: timBox.c:218
static Vec_Str_t * Vec_StrAlloc(int nCap)
Definition: bblif.c:495
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
int Tim_ManDelayTableNum(Tim_Man_t *p)
Definition: timMan.c:715
static void Vec_StrPutI_ne(Vec_Str_t *vOut, int Val)
Definition: vecStr.h:814
int Tim_ManCiNum(Tim_Man_t *p)
Definition: timMan.c:680
int Tim_ManBoxNum(Tim_Man_t *p)
Definition: timMan.c:702
static void Vec_StrPutF(Vec_Str_t *vOut, float Val)
Definition: vecStr.h:861
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
#define Tim_ManForEachPi(p, pObj, i)
Definition: timInt.h:112
int Tim_ManBoxCopy(Tim_Man_t *p, int iBox)
Definition: timBox.c:274
float Tim_ManGetCoRequired(Tim_Man_t *p, int iCo)
Definition: timTime.c:222
#define assert(ex)
Definition: util_old.h:213
float Tim_ManGetCiArrival(Tim_Man_t *p, int iCi)
Definition: timTime.c:174
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
#define TIM_DUMP_VER_NUM
DECLARATIONS ///.
Definition: timDump.c:29