torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::architecture::WireUsage Class Reference

Encapsulation the design wire usage. More...

#include <WireUsage.hpp>

+ Collaboration diagram for torc::architecture::WireUsage:

Public Member Functions

 WireUsage (const Tiles &inTiles)
 Public constructor. More...
 
 ~WireUsage (void)
 Non-virtual destructor. More...
 
void autosize (void)
 Size the wire usage according to the number of device tiles. More...
 
void use (const Tilewire &inTilewire)
 Marks the specified tilewire as being used. More...
 
void release (const Tilewire &inTilewire)
 Marks the specified tilewire as being unused. More...
 
void clear (void)
 Marks all wires as being unused, without releasing the bitset objects. More...
 
bool isUsed (const Tilewire &inTilewire)
 Determines whether the specified tilewire is in use. More...
 
uint32_t getWireUsageCount (void) const
 Returns the number of wires in use. More...
 
TileCount getTileUsageCount (void) const
 Returns the number of tiles that have been touched. More...
 
uint32_t getBitCount (void) const
 Returns the number of bits allocated. More...
 

Protected Types

typedef boost::dynamic_bitset dynamic_bitset
 Imported type name. More...
 
typedef xilinx::TileIndex TileIndex
 Imported type name. More...
 
typedef xilinx::TileCount TileCount
 Imported type name. More...
 
typedef xilinx::TileTypeIndex TileTypeIndex
 Imported type name. More...
 
typedef xilinx::WireIndex WireIndex
 Imported type name. More...
 

Protected Attributes

const TilesmTiles
 Reference to the database Tiles object. More...
 
TileCount mTileUsageCount
 The number of tiles for which bitsets are allocated. More...
 
Array< dynamic_bitset * > mBitsets
 The wire usage bitset array. More...
 
uint32_t mBitCount
 The number of bits allocated by the usage bitsets. More...
 
dynamic_bitset mTileDirty
 The mask of tile bitsets that contain changes. More...
 

Detailed Description

Encapsulation the design wire usage.

This class uses a compact bitset representation to very efficiently track the wire usage of a design in an entire device. Internal bitset objects are maintained on a per-tile basis, and are not allocated until at least one wire in the tile has been marked used.

Definition at line 35 of file WireUsage.hpp.

Member Typedef Documentation

typedef boost::dynamic_bitset torc::architecture::WireUsage::dynamic_bitset
protected

Imported type name.

Definition at line 38 of file WireUsage.hpp.

Imported type name.

Definition at line 40 of file WireUsage.hpp.

Imported type name.

Definition at line 39 of file WireUsage.hpp.

Imported type name.

Definition at line 41 of file WireUsage.hpp.

Imported type name.

Definition at line 42 of file WireUsage.hpp.

Constructor & Destructor Documentation

torc::architecture::WireUsage::WireUsage ( const Tiles inTiles)
inline

Public constructor.

Definition at line 57 of file WireUsage.hpp.

57  : mTiles(inTiles), mTileUsageCount(), mBitsets(0),
58  mBitCount(0), mTileDirty(0) {}
const Tiles & mTiles
Reference to the database Tiles object.
Definition: WireUsage.hpp:45
dynamic_bitset mTileDirty
The mask of tile bitsets that contain changes.
Definition: WireUsage.hpp:53
TileCount mTileUsageCount
The number of tiles for which bitsets are allocated.
Definition: WireUsage.hpp:47
uint32_t mBitCount
The number of bits allocated by the usage bitsets.
Definition: WireUsage.hpp:51
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49
torc::architecture::WireUsage::~WireUsage ( void  )
inline

Non-virtual destructor.

Definition at line 60 of file WireUsage.hpp.

60  {
61  size_t tileCount = mBitsets.getSize();
62  for(TileIndex i; i < tileCount; i++) {
63  if(mBitsets[i] != 0) { delete mBitsets[i]; mBitsets[i] = 0; }
64  }
65  }
xilinx::TileIndex TileIndex
Imported type name.
Definition: WireUsage.hpp:39
uint32_t getSize(void) const
Returns the array size.
Definition: Array.hpp:104
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49

+ Here is the call graph for this function:

Member Function Documentation

void torc::architecture::WireUsage::autosize ( void  )
inline

Size the wire usage according to the number of device tiles.

Definition at line 68 of file WireUsage.hpp.

68  {
69  // release any existing bitsets
70  for(TileCount i; i < mBitsets.getSize(); i++) {
71  if(mBitsets[i] != 0) { delete mBitsets[i]; mBitsets[i] = 0; }
72  mTileDirty.reset(i);
73  }
74  // resize for the new dimensions
75  TileCount tileCount = mTiles.getTileCount();
76  mBitsets.setSize(tileCount);
77  for(TileCount i; i < tileCount; i++) mBitsets[i] = 0;
78  mTileDirty.resize(tileCount);
79  }
xilinx::TileCount TileCount
Imported type name.
Definition: WireUsage.hpp:40
const Tiles & mTiles
Reference to the database Tiles object.
Definition: WireUsage.hpp:45
TileCount getTileCount(void) const
Returns the tile count for this device.
Definition: Tiles.hpp:149
dynamic_bitset mTileDirty
The mask of tile bitsets that contain changes.
Definition: WireUsage.hpp:53
void setSize(uint32_t inSize)
Discards all contents and resizes the array.
Definition: Array.hpp:107
uint32_t getSize(void) const
Returns the array size.
Definition: Array.hpp:104
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::architecture::WireUsage::clear ( void  )
inline

Marks all wires as being unused, without releasing the bitset objects.

This capability allows the tracer to track the wires that it has visited while processing a particular net, and then to start again from scratch without incurring allocation and construction overheads.

Definition at line 121 of file WireUsage.hpp.

121  {
122  // iterate over all of the tiles
123  size_t tileCount = mBitsets.getSize();
124  for(TileIndex i; i < tileCount; i++) {
125  // skip this tile if it isn't dirty
126  if(!mTileDirty[i]) continue;
127  // mark the tile clean
128  mTileDirty.reset(i);
129  // look up the bitset for this tile
130  dynamic_bitset* bitset = mBitsets[i];
131  // skip tiles without an associated bitset (should never happen for dirty tiles)
132  if(bitset == 0) continue;
133  // clear the entire bitset
134  bitset->reset();
135  }
136  }
boost::dynamic_bitset dynamic_bitset
Imported type name.
Definition: WireUsage.hpp:38
xilinx::TileIndex TileIndex
Imported type name.
Definition: WireUsage.hpp:39
dynamic_bitset mTileDirty
The mask of tile bitsets that contain changes.
Definition: WireUsage.hpp:53
uint32_t getSize(void) const
Returns the array size.
Definition: Array.hpp:104
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t torc::architecture::WireUsage::getBitCount ( void  ) const
inline

Returns the number of bits allocated.

Definition at line 171 of file WireUsage.hpp.

171 { return mBitCount; }
uint32_t mBitCount
The number of bits allocated by the usage bitsets.
Definition: WireUsage.hpp:51
TileCount torc::architecture::WireUsage::getTileUsageCount ( void  ) const
inline

Returns the number of tiles that have been touched.

Definition at line 169 of file WireUsage.hpp.

169 { return mTileUsageCount; }
TileCount mTileUsageCount
The number of tiles for which bitsets are allocated.
Definition: WireUsage.hpp:47
uint32_t torc::architecture::WireUsage::getWireUsageCount ( void  ) const
inline

Returns the number of wires in use.

Todo:
Question: can we get away with only checking dirty bitsets? / skip this tile if it isn't dirty

Definition at line 151 of file WireUsage.hpp.

151  {
152  uint32_t usageCount = 0;
153  size_t tileCount = mBitsets.getSize();
154  for(TileIndex i; i < tileCount; i++) {
155  /// \todo Question: can we get away with only checking dirty bitsets?
156  //// skip this tile if it isn't dirty
157  //if(!mTileDirty[i]) continue;
158  // look up the bitset for this tile
159  dynamic_bitset* bitset = mBitsets[i];
160  // skip tiles without an associated bitset
161  if(bitset == 0) continue;
162  // clear the entire bitset
163  usageCount += bitset->count();
164  }
165  return usageCount;
166  }
boost::dynamic_bitset dynamic_bitset
Imported type name.
Definition: WireUsage.hpp:38
xilinx::TileIndex TileIndex
Imported type name.
Definition: WireUsage.hpp:39
uint32_t getSize(void) const
Returns the array size.
Definition: Array.hpp:104
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool torc::architecture::WireUsage::isUsed ( const Tilewire inTilewire)
inline

Determines whether the specified tilewire is in use.

Definition at line 138 of file WireUsage.hpp.

138  {
139  // extract the tile and wire indexes
140  TileIndex tileIndex = inTilewire.getTileIndex();
141  WireIndex wireIndex = inTilewire.getWireIndex();
142 
143  // if there is no entry for the tile, the tilewire is already implicitly unused.
144  dynamic_bitset* bitset = mBitsets[tileIndex];
145  if(bitset == 0) return false;
146 
147  // otherwise, interrogate the bit
148  return bitset->test(wireIndex);
149  }
boost::dynamic_bitset dynamic_bitset
Imported type name.
Definition: WireUsage.hpp:38
xilinx::TileIndex TileIndex
Imported type name.
Definition: WireUsage.hpp:39
xilinx::WireIndex WireIndex
Imported type name.
Definition: WireUsage.hpp:42
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::architecture::WireUsage::release ( const Tilewire inTilewire)
inline

Marks the specified tilewire as being unused.

Definition at line 104 of file WireUsage.hpp.

104  {
105  // extract the tile and wire indexes
106  TileIndex tileIndex = inTilewire.getTileIndex();
107  WireIndex wireIndex = inTilewire.getWireIndex();
108 
109  // if there is no entry for the tile, the tilewire is already implicitly unused.
110  dynamic_bitset* bitset = mBitsets[tileIndex];
111  if(bitset == 0) return;
112 
113  // otherwise clear the bit and mark the tile dirty
114  bitset->set(wireIndex, false);
115  mTileDirty.set(tileIndex, true);
116  }
boost::dynamic_bitset dynamic_bitset
Imported type name.
Definition: WireUsage.hpp:38
xilinx::TileIndex TileIndex
Imported type name.
Definition: WireUsage.hpp:39
dynamic_bitset mTileDirty
The mask of tile bitsets that contain changes.
Definition: WireUsage.hpp:53
xilinx::WireIndex WireIndex
Imported type name.
Definition: WireUsage.hpp:42
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::architecture::WireUsage::use ( const Tilewire inTilewire)
inline

Marks the specified tilewire as being used.

Definition at line 81 of file WireUsage.hpp.

81  {
82  // extract the tile and wire indexes
83  TileIndex tileIndex = inTilewire.getTileIndex();
84  WireIndex wireIndex = inTilewire.getWireIndex();
85 
86  // look up the appropriate bitset, allocating it if necessary
87  dynamic_bitset* bitset = mBitsets[tileIndex];
88  if(bitset == 0) {
89  // determine how many wires are in this tile
90  const TileInfo& tileInfo = mTiles.getTileInfo(tileIndex);
91  TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
92  size_t size = mTiles.getWireInfo(tileTypeIndex).getSize();
93  bitset = mBitsets[tileIndex] = new dynamic_bitset(size);
94  // track the statistics
96  mBitCount += size;
97  }
98 
99  // set the bit and mark the tile dirty
100  bitset->set(wireIndex, true);
101  mTileDirty.set(tileIndex, true);
102  }
boost::dynamic_bitset dynamic_bitset
Imported type name.
Definition: WireUsage.hpp:38
const Tiles & mTiles
Reference to the database Tiles object.
Definition: WireUsage.hpp:45
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
xilinx::TileIndex TileIndex
Imported type name.
Definition: WireUsage.hpp:39
const Array< const WireInfo > & getWireInfo(TileTypeIndex inTileTypeIndex) const
Returns the WireInfo array for the specified tile type.
Definition: Tiles.hpp:140
xilinx::TileTypeIndex TileTypeIndex
Imported type name.
Definition: WireUsage.hpp:41
dynamic_bitset mTileDirty
The mask of tile bitsets that contain changes.
Definition: WireUsage.hpp:53
TileCount mTileUsageCount
The number of tiles for which bitsets are allocated.
Definition: WireUsage.hpp:47
uint32_t mBitCount
The number of bits allocated by the usage bitsets.
Definition: WireUsage.hpp:51
xilinx::WireIndex WireIndex
Imported type name.
Definition: WireUsage.hpp:42
Array< dynamic_bitset * > mBitsets
The wire usage bitset array.
Definition: WireUsage.hpp:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

uint32_t torc::architecture::WireUsage::mBitCount
protected

The number of bits allocated by the usage bitsets.

Definition at line 51 of file WireUsage.hpp.

Array<dynamic_bitset*> torc::architecture::WireUsage::mBitsets
protected

The wire usage bitset array.

Definition at line 49 of file WireUsage.hpp.

dynamic_bitset torc::architecture::WireUsage::mTileDirty
protected

The mask of tile bitsets that contain changes.

Definition at line 53 of file WireUsage.hpp.

const Tiles& torc::architecture::WireUsage::mTiles
protected

Reference to the database Tiles object.

Definition at line 45 of file WireUsage.hpp.

TileCount torc::architecture::WireUsage::mTileUsageCount
protected

The number of tiles for which bitsets are allocated.

Definition at line 47 of file WireUsage.hpp.


The documentation for this class was generated from the following file: