Bitstream Interpretation Library (BIL)  0.1
CfgPrint.cpp
Go to the documentation of this file.
1 
6 #include <cfgdecode/CfgPrint.hpp>
7 
8 using namespace bil;
9 
10 
11 void bil::printPIPs(const PIPRefs& pipRefs, const Device& device,
12  std::ostream& outputStream)
13 {
14  // cache tiles and tile types
15  const Tiles& tiles = device.tiles();
16  const TileTypes& tileTypes = device.tileTypes();
17 
18  // loop over all given PIP references
19  size_t pipCount = pipRefs.size();
20  for (size_t i = 0; i < pipCount; ++i)
21  {
22  // get current PIPRef
23  const PIPRef& pipRef = pipRefs[i];
24 
25  // get tile location of PIP
26  const Tile& tile = tiles.at(pipRef.tileIndex());
27 
28  // get start wire, direction, and end wire of PIP
29  const TileType& tileType = tileTypes.at(tile.typeIndex());
30  const PIPs& pips = tileType.pips();
31  const PIP& pip = pips.at(pipRef.pipIndex());
32  const Wires& wires = tileType.wires();
33  const Wire& startWire = wires.at(pip.startWireIndex());
34  const Wire& endWire = wires.at(pip.endWireIndex());
35 
36  // print that
37  outputStream << tile.name() << ' ' << startWire.name() << ' ';
38  outputStream << PIPDirection::toString(pip.direction()) << ' ';
39  outputStream << endWire.name() << '\n';
40  }
41 }