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

Pare Primitives. More...

#include <WritePrimitive.hpp>

Public Member Functions

 WritePrimitive ()
 
void WritePrimitiveFile (const char *outFileName, PrimitiveSetSharedPtr primitives)
 write an XDLRC file More...
 

Protected Attributes

FILE * outFile
 
const char * outFileName
 

Detailed Description

Pare Primitives.

Definition at line 35 of file WritePrimitive.hpp.

Constructor & Destructor Documentation

torc::physical::WritePrimitive::WritePrimitive ( )
inline

Definition at line 44 of file WritePrimitive.hpp.

44 {}

Member Function Documentation

void torc::physical::WritePrimitive::WritePrimitiveFile ( const char *  outFileName,
PrimitiveSetSharedPtr  primitives 
)

write an XDLRC file

Definition at line 22 of file WritePrimitive.cpp.

22  {
23 
24  outFileName = name;
25 
26  if (!(outFile = fopen(outFileName, "w")))
27  printf("Cannot open file '%s'.\n", outFileName);
28 
29  fprintf(outFile, "(primitive_defs %i\n", (int)(primitives->getPrimitiveCount()));
30  //write primitives
31  for(PrimitiveSet::PrimitiveSharedPtrConstIterator it = primitives->primitivesBegin(); it != primitives->primitivesEnd(); ++it){
32  fprintf(outFile, "\t(primitive_def %s %d %d\n", (*it)->getName().c_str(), ((int)((*it)->getPrimitivePinCount())), ((int)((*it)->getElementCount())));
33  //write PrimitivePins
34  for(Primitive::PrimitivePinSharedPtrConstIterator pp = (*it)->PrimitivePinsBegin(); pp != (*it)->PrimitivePinsEnd(); ++pp){
35  string sTmp = ((*pp)->getType()==OutputP) ? "output" : "input";
36  fprintf(outFile, "\t\t(pin %s %s %s)\n", (*pp)->getElementName().c_str(), (*pp)->getName().c_str(), sTmp.c_str());
37  }
38  //write elements
39  for(Primitive::ElementSharedPtrConstIterator ep = (*it)->elementsBegin(); ep != (*it)->elementsEnd(); ++ep){
40  fprintf(outFile, "\t\t(element %s %d\n", (*ep)->getName().c_str(), (int)((*ep)->getPrimitivePinCount()));
41  //write element PrimitivePins
42  for(Element::PrimitivePinSharedPtrConstIterator pp = (*ep)->PrimitivePinsBegin(); pp != (*ep)->PrimitivePinsEnd(); ++pp){
43  string sTmp = ((*pp)->getType()==OutputP) ? "output" : "input";
44  fprintf(outFile, "\t\t\t(pin %s %s)\n", (*pp)->getName().c_str(), sTmp.c_str());
45  }
46  //write element confs
47  if((*ep)->getConfigCount()>0){
48  fprintf(outFile, "\t\t\t(cfg");
49  for(Element::ConfigConstIterator cp = (*ep)->confsBegin(); cp != (*ep)->confsEnd(); ++cp)
50  fprintf(outFile, " %s", (*cp).c_str());
51  fprintf(outFile,")\n");
52  }
53  //write element connections
54  for(Element::ConnectionSharedPtrConstIterator cp = (*ep)->connectionsBegin(); cp != (*ep)->connectionsEnd(); ++cp){
55  Connection::ConnectionPinSharedPtrConstIterator src = (*cp)->getSource();
57  fprintf(outFile,"\t\t\t(conn %s %s ==> %s %s)\n", (*src).getElementName().c_str(), (*src).getPinName().c_str(),
58  (*dst).getElementName().c_str(), (*dst).getPinName().c_str());
59  }
60  fprintf(outFile, "\t\t)\n");
61  }
62  fprintf(outFile, ")\n");
63  }
64 
65  fclose(outFile);
66 
67  return;
68 }
ConnectionPinVector::const_iterator ConnectionPinSharedPtrConstIterator
Definition: Connection.hpp:40
ConnectionSharedPtrVector::const_iterator ConnectionSharedPtrConstIterator
Definition: Element.hpp:54
ConfigVector::const_iterator ConfigConstIterator
Definition: Element.hpp:57
PrimitiveSharedPtrVector::const_iterator PrimitiveSharedPtrConstIterator
Constant iterator for Primitive shared pointers.
ElementSharedPtrVector::const_iterator ElementSharedPtrConstIterator
Constant iterator for Element shared pointers.
Definition: Primitive.hpp:53
PrimitivePinSharedPtrVector::const_iterator PrimitivePinSharedPtrConstIterator
Definition: Component.hpp:39

+ Here is the caller graph for this function:

Field Documentation

FILE* torc::physical::WritePrimitive::outFile
protected

Definition at line 39 of file WritePrimitive.hpp.

const char* torc::physical::WritePrimitive::outFileName
protected

Definition at line 41 of file WritePrimitive.hpp.


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