OpenASIP  2.0
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
ProGe::NetlistVisualization Class Reference

#include <NetlistVisualization.hh>

Collaboration diagram for ProGe::NetlistVisualization:
Collaboration graph

Public Member Functions

 NetlistVisualization ()
 
virtual ~NetlistVisualization ()
 

Static Public Member Functions

static void visualizeBlockTree (const BaseNetlistBlock &root, std::ostream &streamOut)
 
static void listConnections (const BaseNetlistBlock &block, std::ostream &streamOut)
 
static void listNetlistDescriptors (const BaseNetlistBlock &block, std::ostream &streamOut)
 
static void listNetlistDescriptors (const Netlist &netlist, std::ostream &streamOut)
 
static std::string toString (Direction dir)
 
static std::string portWidthToString (const NetlistPort &port)
 

Static Private Member Functions

static void printBlockTree (const BaseNetlistBlock &node, std::string prefix, std::ostream &streamOut)
 
static void printBlock (const BaseNetlistBlock &root, const std::string &prefix, std::ostream &streamOut)
 
static void printParameter (const Parameter &parameter, const std::string &prefix, std::ostream &streamOut)
 
static void printPort (const NetlistPort &port, const std::string &prefix, std::ostream &streamOut)
 

Detailed Description

Definition at line 50 of file NetlistVisualization.hh.

Constructor & Destructor Documentation

◆ NetlistVisualization()

ProGe::NetlistVisualization::NetlistVisualization ( )

Definition at line 53 of file NetlistVisualization.cc.

53 {}

◆ ~NetlistVisualization()

ProGe::NetlistVisualization::~NetlistVisualization ( )
virtual

Definition at line 55 of file NetlistVisualization.cc.

55 {}

Member Function Documentation

◆ listConnections()

void ProGe::NetlistVisualization::listConnections ( const BaseNetlistBlock block,
std::ostream &  streamOut 
)
static

Definition at line 65 of file NetlistVisualization.cc.

66  {
67  // typedef boost::graph_traits<Netlist>::edge_iterator EdgeIterator;
68  // typedef std::pair<EdgeIterator, EdgeIterator> EdgePair;
69  typedef std::pair<std::string, std::string> PortNamePair;
70  typedef std::set<PortNamePair> ConnectionSet;
71 
72  ConnectionSet connections;
73  // EdgePair edge_it;
74 
76  for (edge_it = block.netlist().begin(); edge_it != block.netlist().end();
77  edge_it++) {
78  const NetlistPort* port_a =
79  block.netlist()[boost::source(*edge_it, block.netlist())];
80  const NetlistPort* port_b =
81  block.netlist()[boost::target(*edge_it, block.netlist())];
82  std::string port_a_name(port_a->parentBlock().instanceName());
83  port_a_name += ":" + port_a->name();
84  std::string port_b_name(port_b->parentBlock().instanceName());
85  port_b_name += ":" + port_b->name();
86 
87  if (port_a_name < port_b_name) {
88  connections.insert(std::make_pair(port_a_name, port_b_name));
89  } else {
90  connections.insert(std::make_pair(port_b_name, port_a_name));
91  }
92  }
93 
94  ConnectionSet::const_iterator conn_it;
95  for (conn_it = connections.begin(); conn_it != connections.end();
96  conn_it++) {
97  streamOut << conn_it->first << " <-> " << conn_it->second
98  << std::endl;
99  }
100 }

References ProGe::Netlist::begin(), ProGe::Netlist::end(), ProGe::BaseNetlistBlock::instanceName(), ProGe::NetlistPort::name(), ProGe::BaseNetlistBlock::netlist(), and ProGe::NetlistPort::parentBlock().

Here is the call graph for this function:

◆ listNetlistDescriptors() [1/2]

void ProGe::NetlistVisualization::listNetlistDescriptors ( const BaseNetlistBlock block,
std::ostream &  streamOut 
)
static

Definition at line 103 of file NetlistVisualization.cc.

104  {
105  listNetlistDescriptors(block.netlist(), streamOut);
106 }

References ProGe::BaseNetlistBlock::netlist().

Here is the call graph for this function:

◆ listNetlistDescriptors() [2/2]

void ProGe::NetlistVisualization::listNetlistDescriptors ( const Netlist netlist,
std::ostream &  streamOut 
)
static

Definition at line 109 of file NetlistVisualization.cc.

110  {
112  for (desc_it = netlist.descriptorBegin();
113  desc_it != netlist.descriptorEnd(); desc_it++) {
114  const NetlistPort* port = desc_it->first;
115  const BaseNetlistBlock* parent = &port->parentBlock();
116  size_t descriptor = desc_it->second;
117  streamOut << parent->instanceName() << ":" << port->name() << ":"
118  << descriptor << std::endl;
119  }
120 }

References ProGe::Netlist::descriptorBegin(), ProGe::Netlist::descriptorEnd(), ProGe::BaseNetlistBlock::instanceName(), ProGe::NetlistPort::name(), and ProGe::NetlistPort::parentBlock().

Here is the call graph for this function:

◆ portWidthToString()

std::string ProGe::NetlistVisualization::portWidthToString ( const NetlistPort port)
static

Definition at line 184 of file NetlistVisualization.cc.

184  {
185  if (port.dataType() == BIT) {
186  return "1";
187  } else if (port.dataType() == BIT_VECTOR) {
188  if (port.realWidthAvailable()) {
189  return std::string("[") + Conversion::toString(port.realWidth()) +
190  "-1:0]";
191  } else {
192  return std::string("[") + port.widthFormula() + "-1:0]";
193  }
194  } else {
195  return "N/A";
196  }
197 }

References ProGe::BIT, ProGe::BIT_VECTOR, ProGe::NetlistPort::dataType(), ProGe::NetlistPort::realWidth(), ProGe::NetlistPort::realWidthAvailable(), Conversion::toString(), and ProGe::NetlistPort::widthFormula().

Referenced by printPort().

Here is the call graph for this function:

◆ printBlock()

void ProGe::NetlistVisualization::printBlock ( const BaseNetlistBlock root,
const std::string &  prefix,
std::ostream &  streamOut 
)
staticprivate

Definition at line 145 of file NetlistVisualization.cc.

147  {
148  streamOut << prefix << "Blk: " << blockNode.instanceName() << " : "
149  << blockNode.moduleName() << std::endl;
150 }

References ProGe::BaseNetlistBlock::instanceName(), and ProGe::BaseNetlistBlock::moduleName().

Referenced by printBlockTree(), and visualizeBlockTree().

Here is the call graph for this function:

◆ printBlockTree()

void ProGe::NetlistVisualization::printBlockTree ( const BaseNetlistBlock node,
std::string  prefix,
std::ostream &  streamOut 
)
staticprivate

Definition at line 123 of file NetlistVisualization.cc.

125  {
126  for (size_t i = 0; i < blockNode.parameterCount(); i++) {
127  printParameter(blockNode.parameter(i), prefix + "|- ", streamOut);
128  }
129 
130  for (size_t i = 0; i < blockNode.portCount(); i++) {
131  printPort(blockNode.port(i), prefix + "|- ", streamOut);
132  }
133 
134  for (size_t i = 0; i < blockNode.subBlockCount(); i++) {
135  printBlock(blockNode.subBlock(i), prefix + "+- ", streamOut);
137  blockNode.subBlock(i),
138  prefix + TCEString::applyIf(
139  i < blockNode.subBlockCount() - 1, "| ", " "),
140  streamOut);
141  }
142 }

References TCEString::applyIf(), ProGe::BaseNetlistBlock::parameter(), ProGe::BaseNetlistBlock::parameterCount(), ProGe::BaseNetlistBlock::port(), ProGe::BaseNetlistBlock::portCount(), printBlock(), printParameter(), printPort(), ProGe::BaseNetlistBlock::subBlock(), and ProGe::BaseNetlistBlock::subBlockCount().

Referenced by visualizeBlockTree().

Here is the call graph for this function:

◆ printParameter()

void ProGe::NetlistVisualization::printParameter ( const Parameter parameter,
const std::string &  prefix,
std::ostream &  streamOut 
)
staticprivate

Definition at line 153 of file NetlistVisualization.cc.

155  {
156  streamOut << prefix << "Prm: " << parameter.name() << " : "
157  << parameter.type() << " := " << parameter.value() << std::endl;
158 }

References ProGe::Parameter::name(), ProGe::Parameter::type(), and ProGe::Parameter::value().

Referenced by printBlockTree().

Here is the call graph for this function:

◆ printPort()

void ProGe::NetlistVisualization::printPort ( const NetlistPort port,
const std::string &  prefix,
std::ostream &  streamOut 
)
staticprivate

Definition at line 161 of file NetlistVisualization.cc.

163  {
164  streamOut << prefix << "Prt: " << port.name() << " "
165  << toString(port.direction()) << " " << portWidthToString(port)
166  << std::endl;
167 }

References ProGe::NetlistPort::direction(), ProGe::NetlistPort::name(), portWidthToString(), and toString().

Referenced by printBlockTree().

Here is the call graph for this function:

◆ toString()

std::string ProGe::NetlistVisualization::toString ( Direction  dir)
static

Definition at line 170 of file NetlistVisualization.cc.

170  {
171  switch (dir) {
172  case IN:
173  return "in";
174  case OUT:
175  return "out";
176  case BIDIR:
177  return "bidir";
178  default:
179  return "N/A";
180  }
181 }

References ProGe::BIDIR, ProGe::IN, and ProGe::OUT.

Referenced by printPort().

◆ visualizeBlockTree()

void ProGe::NetlistVisualization::visualizeBlockTree ( const BaseNetlistBlock root,
std::ostream &  streamOut 
)
static

Definition at line 58 of file NetlistVisualization.cc.

59  {
60  printBlock(root, "", streamOut);
61  printBlockTree(root, "", streamOut);
62 }

References printBlock(), and printBlockTree().

Referenced by ProGe::ProcessorGenerator::generateProcessor().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
ProGe::NetlistVisualization::printPort
static void printPort(const NetlistPort &port, const std::string &prefix, std::ostream &streamOut)
Definition: NetlistVisualization.cc:161
ProGe::BIT_VECTOR
@ BIT_VECTOR
Several bits.
Definition: ProGeTypes.hh:48
TCEString::applyIf
static std::string applyIf(bool expression, stringCRef ifTrue, stringCRef ifFalse)
Definition: TCEString.cc:229
ProGe::NetlistVisualization::listNetlistDescriptors
static void listNetlistDescriptors(const BaseNetlistBlock &block, std::ostream &streamOut)
Definition: NetlistVisualization.cc:103
ProGe::NetlistVisualization::printBlock
static void printBlock(const BaseNetlistBlock &root, const std::string &prefix, std::ostream &streamOut)
Definition: NetlistVisualization.cc:145
ProGe::BIDIR
@ BIDIR
Bidirectional port.
Definition: ProGeTypes.hh:55
ProGe::NetlistVisualization::printParameter
static void printParameter(const Parameter &parameter, const std::string &prefix, std::ostream &streamOut)
Definition: NetlistVisualization.cc:153
ProGe::NetlistVisualization::printBlockTree
static void printBlockTree(const BaseNetlistBlock &node, std::string prefix, std::ostream &streamOut)
Definition: NetlistVisualization.cc:123
Conversion::toString
static std::string toString(const T &source)
ProGe::NetlistVisualization::portWidthToString
static std::string portWidthToString(const NetlistPort &port)
Definition: NetlistVisualization.cc:184
ProGe::Netlist::const_descriptor_iterator
DescriptorMap::const_iterator const_descriptor_iterator
Definition: Netlist.hh:133
ProGe::BIT
@ BIT
One bit.
Definition: ProGeTypes.hh:47
ProGe::OUT
@ OUT
Output port.
Definition: ProGeTypes.hh:54
ProGe::NetlistVisualization::toString
static std::string toString(Direction dir)
Definition: NetlistVisualization.cc:170
ProGe::Netlist::const_iterator
boost::graph_traits< const Netlist >::edge_iterator const_iterator
Definition: Netlist.hh:126
ProGe::IN
@ IN
Input port.
Definition: ProGeTypes.hh:53