yosys-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
SubCircuit::SolverWorker::DiCache Struct Reference

Public Member Functions

void add (const Graph &graph, adjMatrix_t &adjMatrix, const std::string &graphId, Solver *userSolver)
 
bool compare (int needleEdge, int haystackEdge, const std::map< std::string, std::set< std::set< std::string >>> &swapPorts, const std::map< std::string, std::set< std::map< std::string, std::string >>> &swapPermutations)
 
bool compare (int needleEdge, int haystackEdge, const std::map< std::string, std::string > &mapFromPorts, const std::map< std::string, std::set< std::set< std::string >>> &swapPorts, const std::map< std::string, std::set< std::map< std::string, std::string >>> &swapPermutations) const
 
bool compare (int needleEdge, int haystackEdge, const std::map< std::string, std::string > &mapFromPorts, const std::map< std::string, std::string > &mapToPorts) const
 
void printEdgeTypes () const
 

Data Fields

std::map< DiEdge, int > edgeTypesMap
 
std::vector< DiEdgeedgeTypes
 
std::map< std::pair< int, int >
, bool > 
compareCache
 

Detailed Description

Definition at line 656 of file subcircuit.cc.

Member Function Documentation

void SubCircuit::SolverWorker::DiCache::add ( const Graph graph,
adjMatrix_t adjMatrix,
const std::string &  graphId,
Solver userSolver 
)
inline

Definition at line 662 of file subcircuit.cc.

663  {
664  std::map<std::pair<int, int>, DiEdge> edges;
665  DiEdge::findEdgesInGraph(graph, edges);
666 
667  adjMatrix.clear();
668  adjMatrix.resize(graph.nodes.size());
669 
670  for (auto &it : edges) {
671  const Graph::Node &fromNode = graph.nodes[it.first.first];
672  const Graph::Node &toNode = graph.nodes[it.first.second];
673  it.second.userAnnotation = userSolver->userAnnotateEdge(graphId, fromNode.nodeId, fromNode.userData, toNode.nodeId, toNode.userData);
674  }
675 
676  for (const auto &it : edges) {
677  if (edgeTypesMap.count(it.second) == 0) {
678  edgeTypesMap[it.second] = edgeTypes.size();
679  edgeTypes.push_back(it.second);
680  }
681  adjMatrix[it.first.first][it.first.second] = edgeTypesMap[it.second];
682  }
683  }
virtual std::string userAnnotateEdge(const std::string &graphId, const std::string &fromNodeId, void *fromUserData, const std::string &toNodeId, void *toUserData)
Definition: subcircuit.cc:1602
std::vector< Node > nodes
Definition: subcircuit.h:72
std::vector< DiEdge > edgeTypes
Definition: subcircuit.cc:659
static void findEdgesInGraph(const Graph &graph, std::map< std::pair< int, int >, DiEdge > &edges)
Definition: subcircuit.cc:636
std::map< DiEdge, int > edgeTypesMap
Definition: subcircuit.cc:658

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SubCircuit::SolverWorker::DiCache::compare ( int  needleEdge,
int  haystackEdge,
const std::map< std::string, std::set< std::set< std::string >>> &  swapPorts,
const std::map< std::string, std::set< std::map< std::string, std::string >>> &  swapPermutations 
)
inline

Definition at line 685 of file subcircuit.cc.

687  {
688  std::pair<int, int> key(needleEdge, haystackEdge);
689  if (!compareCache.count(key))
690  compareCache[key] = edgeTypes.at(needleEdge).compare(edgeTypes.at(haystackEdge), swapPorts, swapPermutations);
691  return compareCache[key];
692  }
std::map< std::string, std::set< std::map< std::string, std::string > > > swapPermutations
Definition: subcircuit.cc:719
std::map< std::pair< int, int >, bool > compareCache
Definition: subcircuit.cc:660
std::vector< DiEdge > edgeTypes
Definition: subcircuit.cc:659
std::map< std::string, std::set< std::set< std::string > > > swapPorts
Definition: subcircuit.cc:718

+ Here is the caller graph for this function:

bool SubCircuit::SolverWorker::DiCache::compare ( int  needleEdge,
int  haystackEdge,
const std::map< std::string, std::string > &  mapFromPorts,
const std::map< std::string, std::set< std::set< std::string >>> &  swapPorts,
const std::map< std::string, std::set< std::map< std::string, std::string >>> &  swapPermutations 
) const
inline

Definition at line 694 of file subcircuit.cc.

696  {
697  return edgeTypes.at(needleEdge).compare(edgeTypes.at(haystackEdge), mapFromPorts, swapPorts, swapPermutations);
698  }
std::map< std::string, std::set< std::map< std::string, std::string > > > swapPermutations
Definition: subcircuit.cc:719
std::vector< DiEdge > edgeTypes
Definition: subcircuit.cc:659
std::map< std::string, std::set< std::set< std::string > > > swapPorts
Definition: subcircuit.cc:718
bool SubCircuit::SolverWorker::DiCache::compare ( int  needleEdge,
int  haystackEdge,
const std::map< std::string, std::string > &  mapFromPorts,
const std::map< std::string, std::string > &  mapToPorts 
) const
inline

Definition at line 700 of file subcircuit.cc.

701  {
702  return edgeTypes.at(needleEdge).compare(edgeTypes.at(haystackEdge), mapFromPorts, mapToPorts);
703  }
std::vector< DiEdge > edgeTypes
Definition: subcircuit.cc:659
void SubCircuit::SolverWorker::DiCache::printEdgeTypes ( ) const
inline

Definition at line 705 of file subcircuit.cc.

706  {
707  for (int i = 0; i < int(edgeTypes.size()); i++)
708  my_printf("%5d: %s\n", i, edgeTypes[i].toString().c_str());
709  }
std::vector< DiEdge > edgeTypes
Definition: subcircuit.cc:659
#define my_printf
Definition: subcircuit.cc:32

+ Here is the caller graph for this function:

Field Documentation

std::map<std::pair<int, int>, bool> SubCircuit::SolverWorker::DiCache::compareCache

Definition at line 660 of file subcircuit.cc.

std::vector<DiEdge> SubCircuit::SolverWorker::DiCache::edgeTypes

Definition at line 659 of file subcircuit.cc.

std::map<DiEdge, int> SubCircuit::SolverWorker::DiCache::edgeTypesMap

Definition at line 658 of file subcircuit.cc.


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