torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WireXdlGenerator.cpp File Reference

Open a device, go over all the pips of some tile types. More...

#include <iostream>
#include <fstream>
#include <sstream>
#include "torc/Architecture.hpp"
#include "torc/Physical.hpp"
#include "torc/Common.hpp"
#include "SharedFunctions.hpp"
+ Include dependency graph for WireXdlGenerator.cpp:

Go to the source code of this file.

Functions

void exportSink (DDB &inDDB, Tilewire &inSource, Tilewire &inSink)
 Export a single pip. More...
 
void exportTileSinks (DDB &inDDB, TileIndex inTileIndex)
 Export all pips within the specified tile. More...
 
int main (int argc, char *argv[])
 Export pips from arbitrary tiles for the given device. More...
 

Variables

const std::string dummyInstName = "dummyInst"
 
const std::string dummyInstSiteType = "SLICEL"
 
const std::string dummyInstSiteLcoation = "SLICE_X1Y1"
 
static boost::filesystem::path gXDLGenerationFolder
 
static const std::string kSupportedTiles []
 

Detailed Description

Open a device, go over all the pips of some tile types.

Definition in file WireXdlGenerator.cpp.

Function Documentation

void exportSink ( DDB inDDB,
Tilewire inSource,
Tilewire inSink 
)

Export a single pip.

Definition at line 84 of file WireXdlGenerator.cpp.

84  {
85 
86  ExtendedWireInfo source(inDDB, inSource);
87  ExtendedWireInfo sink(inDDB, inSink);
88 
89  std::stringstream ss;
90  ss << kFamily << kNameSeparator << source.mTileTypeName << kNameSeparator << source.mWireName << kNameSeparator << sink.mWireName;
91  std::string designName(ss.str());
92 
94  "xc5vfx130t", "ff1738", "-2", "v3.2");
95 
98 
99  designPtr->addInstance(instancePtr);
100 
101  NetSharedPtr net = Factory::newNetPtr(dummyInstName);
102  Pip pip = Factory::newPip(source.mTileName, source.mWireName, sink.mWireName,
104  net->addPip(pip);
105 
106  torc::physical::InstancePinSharedPtr sourcePin = Factory::newInstancePinPtr(instancePtr,
107  "BQ");
108  torc::physical::InstancePinSharedPtr sinkPin = Factory::newInstancePinPtr(instancePtr,
109  "B4");
110  net->addSource(sourcePin);
111  net->addSink(sinkPin);
112 
113  designPtr->addNet(net);
114 
115  // export the created design
116  boost::filesystem::path xdlFilePath = gXDLGenerationFolder / designName.append(".xdl");
117  std::fstream xdlExport(xdlFilePath.string().c_str(), std::ios_base::out);
118  torc::physical::XdlExporter fileExporter(xdlExport);
119  fileExporter(designPtr);
120 }
const std::string dummyInstName
const std::string dummyInstSiteLcoation
const std::string dummyInstSiteType
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
std::string string
static boost::filesystem::path gXDLGenerationFolder
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
Verbose encapsulation of a wire's information.
static InstanceSharedPtr newInstancePtr(const string &inName, const string &inType, const string &inTile, const string &inSite, EInstanceBonding inBonding=eInstanceBondingUnknown, InstanceReferenceSharedPtr inInstanceReferencePtr=InstanceReferenceSharedPtr())
Construct and return a new Instance shared pointer.
boost::filesystem::path path
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
const std::string kNameSeparator
Physical design programmable interconnect point.
Definition: Pip.hpp:34
const std::string kFamily
static DesignSharedPtr newDesignPtr(const string &inName, const string &inDevice, const string &inPackage, const string &inSpeedGrade, const string &inXdlVersion)
Create and return a new Design shared pointer.
Physical design exporter for XDL.
Definition: XdlExporter.hpp:31

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void exportTileSinks ( DDB inDDB,
TileIndex  inTileIndex 
)

Export all pips within the specified tile.

Definition at line 123 of file WireXdlGenerator.cpp.

123  {
124  const Tiles& tiles = inDDB.getTiles();
125  const TileInfo& tileInfo = tiles.getTileInfo(inTileIndex);
126 
127  TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
128 
129  std::cout << "Tile name: " << tileInfo.getName() << ", Tile type name: "
130  << tiles.getTileTypeName(tileTypeIndex) << std::endl;
131 
132  WireCount wireCount = tiles.getWireCount(tileTypeIndex);
133 
134  // iterate through all the wires in the tile
135  for(WireIndex wireIndex /* implicitly initialized to 0 */; wireIndex < wireCount; wireIndex++) {
136  // join the tile index and the wire index into a "tilewire"
137  Tilewire source(inTileIndex, wireIndex);
138  // expand all of the sinks of interest in this tile
139  TilewireVector sinks;
140  inDDB.expandTilewireSinks(source, sinks, false, true, true, true);
141  if(sinks.empty())
142  continue;
143  // iterate over all of the pips that we have found
144  TilewireVector::iterator p = sinks.begin();
145  TilewireVector::iterator e = sinks.end();
146  while(p < e) {
147  // look up the sink tilewire
148  Tilewire sink = *p++;
149  exportSink(inDDB, source, sink);
150  }
151  }
152 }
std::vector< Tilewire > TilewireVector
Vector of Tilewire objects.
Definition: Tilewire.hpp:101
const Tiles & getTiles(void) const
Returns a constant reference to the family and device tile data.
Definition: DDB.hpp:146
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
Encapsulation of a wire index in an unsigned 16-bit integer.
void expandTilewireSinks(const Tilewire &inTilewire, TilewireVector &outSinks, bool inUseTied=true, bool inUseRegular=true, bool inUseIrregular=true, bool inUseRoutethrough=true)
Expands the given tilewire's arc sinks.
Definition: DDB.cpp:214
Encapsulation of a device tile and wire pair.
Definition: Tilewire.hpp:39
Tile map, tile type, and wire information for the family and device.
Definition: Tiles.hpp:36
Encapsulation of a wire count in an unsigned 16-bit integer.
Encapsulation of a tile within a device tile map.
Definition: TileInfo.hpp:33
const char * getTileTypeName(TileTypeIndex inTileTypeIndex) const
Returns the tile type name for the given tile type index.
Definition: Tiles.hpp:164
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
Definition: TileInfo.hpp:92
Encapsulation of a tile type index in an unsigned 16-bit integer.
const char * getName(void) const
Returns the name for this tile.
Definition: TileInfo.hpp:98
WireCount getWireCount(TileTypeIndex inTileTypeIndex) const
Returns the wire count for the specified tile type.
Definition: Tiles.hpp:157
void exportSink(DDB &inDDB, Tilewire &inSource, Tilewire &inSink)
Export a single pip.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

Export pips from arbitrary tiles for the given device.

Definition at line 155 of file WireXdlGenerator.cpp.

155  {
156 
157  if(argc != 2) {
158  std::cerr << "Invalid arguments. Usage: " << argv[0] <<
159  " <xdl_generation_folder>" << std::endl;
160  exit (-1);
161  }
162 
163  // Create the xdl generation folder if it doesn't exits
164  gXDLGenerationFolder = argv[1];
165  if(!boost::filesystem::exists(gXDLGenerationFolder))
166  boost::filesystem::create_directory(gXDLGenerationFolder);
167 
168  // construct and initialize the device database
169  DirectoryTree directoryTree(argv[0]);
170 
171 
172  DeviceDesignator designator("xc5vfx130tff1738-2");
173  DDB ddb(designator);
174  std::cout << ddb; // this allows the database to annotate stream output
175 
176  // look up all tile types
177  const Tiles& tiles = ddb.getTiles();
178  tiles.getTileTypeCount();
179  TileCount tileCount = tiles.getTileCount();
180 
181  // Go over the supported tile types, find the first tile of the type in "all types" list
182  uint32_t supportedTileIndex = 0;
183  while(kSupportedTiles[supportedTileIndex].compare("LAST_TILE") != 0) {
184 
185  for(TileIndex i; i < tileCount; i++) {
186  const TileInfo& tileInfo = tiles.getTileInfo(i);
187  TileTypeIndex tileTypeIndex = tileInfo.getTypeIndex();
188  std::string tileTypeName = tiles.getTileTypeName(tileTypeIndex);
189  if(tileTypeName.compare(kSupportedTiles[supportedTileIndex]) == 0) {
190  exportTileSinks(ddb, i);
191  break;
192  }
193  }
194  supportedTileIndex++;
195  }
196 
197 
198  return 0;
199 }
Encapsulation of a tile index in an unsigned 32-bit integer.
void exportTileSinks(DDB &inDDB, TileIndex inTileIndex)
Export all pips within the specified tile.
Encapsulation of a device designator and its constituent elements.
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
TileTypeCount getTileTypeCount(void) const
Returns the tile type count for this device.
Definition: Tiles.hpp:151
const TileInfo & getTileInfo(TileIndex inTileIndex) const
Returns the TileInfo object for the specified tile.
Definition: Tiles.hpp:137
TileCount getTileCount(void) const
Returns the tile count for this device.
Definition: Tiles.hpp:149
std::string string
static boost::filesystem::path gXDLGenerationFolder
Tile map, tile type, and wire information for the family and device.
Definition: Tiles.hpp:36
Encapsulation of filesystem paths that are used by the library.
Encapsulation of a tile count in an unsigned 32-bit integer.
Encapsulation of a tile within a device tile map.
Definition: TileInfo.hpp:33
const char * getTileTypeName(TileTypeIndex inTileTypeIndex) const
Returns the tile type name for the given tile type index.
Definition: Tiles.hpp:164
const TileTypeIndex & getTypeIndex(void) const
Returns the tile type index for this tile.
Definition: TileInfo.hpp:92
Encapsulation of a tile type index in an unsigned 16-bit integer.
static const std::string kSupportedTiles[]

+ Here is the call graph for this function:

Variable Documentation

const std::string dummyInstName = "dummyInst"

Definition at line 19 of file WireXdlGenerator.cpp.

const std::string dummyInstSiteLcoation = "SLICE_X1Y1"

Definition at line 21 of file WireXdlGenerator.cpp.

const std::string dummyInstSiteType = "SLICEL"

Definition at line 20 of file WireXdlGenerator.cpp.

boost::filesystem::path gXDLGenerationFolder
static

Definition at line 23 of file WireXdlGenerator.cpp.

const std::string kSupportedTiles[]
static

Definition at line 25 of file WireXdlGenerator.cpp.