torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XdlUnpack.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef TORC_PACKER_XDLUNPACK_HPP
17 #define TORC_PACKER_XDLUNPACK_HPP
18 
19 #include "torc/physical/Design.hpp"
21 #include "ParsePrimitive.hpp"
22 #include "WritePrimitive.hpp"
23 
24 #include <boost/smart_ptr.hpp>
25 #include <iostream>
26 #include <string>
27 
28 namespace torc {
29 namespace physical {
30 
31 // Elements need to be removed
32 const string elementNames = "SRUSED REVUSED PRECYINIT DUSED CUSED COUTUSED CEUSED BUSED AUSED DCY0 CCY0 BCY0 ACY0 END";
33 
34 // Elements need to be removed based on their configuration
35 const string extraMuxNames = "CY0G CY0F GYMUX DYMUX FXMUX DXMUX CYINIT DIG_MUX DIF_MUX XBMUX DOUTMUX COUTMUX BOUTMUX AOUTMUX DFFMUX CFFMUX BFFMUX AFFMUX ACY0 BCY0 CCY0 DCY0 PRECYINIT CDI1MUX BDI1MUX ADI1MUX WEMUX TMUX OMUX IDELMUX D2OBYP_SEL IFFDELMUX IFFMUX END";
36 
37 //Inverters
38 const string extraInvNames = "CLKINV T1INV T2INV D1INV D2INV END";
39 
40 class XdlUnpack {
41 
42 public:
43 
44  DesignSharedPtr operator() (const DesignSharedPtr& inDesignPtr);
45  void unpack(const Circuit& circuit, CircuitSharedPtr newCircuit);
46  DesignSharedPtr unpack(const Design& design);
47  ModuleSharedPtr unpack(const Module& module);
48  PortSharedPtr unpack(const Port& port);
49  void unpack(Instance& instance, CircuitSharedPtr newCircuit);
50  NetSharedPtr unpack(const Net& net);
51  InstancePinSharedPtr unpack(const InstancePinSharedPtr instancePin, EPinDirection pinDirection, bool comma);
52  Pip unpack(const Pip& pip, bool comma);
53  RoutethroughSharedPtr unpack(const Routethrough& routethrough);
54 
55  /// \brief removes extra elements that are needed for unpacking
57 
58  // read primitives.
59  void readPrimitives(const char *fileName) {
60  ParsePrimitive parser;
61  primitives = parser.ParsePrimitiveFile(fileName);
62  return;
63  }
64 
65  // checks if the elemnt is a configured multiplexer that needs to be removed
66  bool isExtraMux(string elem){
67  char names[1024] ;
68  strcpy(names,extraMuxNames.c_str());
69  string pch;
70  pch = strtok (names," ");
71  while (pch!="END")
72  {
73  if(pch == elem){
74  return true;
75  }
76  pch = strtok (NULL," ");
77  }
78  return false;
79  }
80  //void unpack(const ConfigMap& configMap);
81 protected:
82  typedef boost::shared_ptr<torc::physical::Named> NamedSharedPtr;
83  typedef boost::shared_ptr<torc::physical::ConfigMap> ConfigMapSharedPtr;
84 
86 
87 };
88 
89 } // namespace physical
90 } // namespace torc
91 
92 #endif // TORC_PACKER_XDLUNPACK_HPP
void readPrimitives(const char *fileName)
Definition: XdlUnpack.hpp:59
Header for primitive parser.
boost::shared_ptr< Primitive > PrimitiveSharedPtr
Shared pointer encapsulation of a Primitive.
Definition: Primitive.hpp:171
boost::shared_ptr< torc::physical::ConfigMap > ConfigMapSharedPtr
Definition: XdlUnpack.hpp:83
boost::shared_ptr< Port > PortSharedPtr
Shared pointer encapsulation of a Port.
Physical netlist design.
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
boost::shared_ptr< PrimitiveSet > PrimitiveSetSharedPtr
Shared pointer encapsulation of a PrimitiveSet.
boost::shared_ptr< Module > ModuleSharedPtr
Shared pointer encapsulation of a Module.
Definition: Module.hpp:114
Header for primitive parser.
DesignSharedPtr operator()(const DesignSharedPtr &inDesignPtr)
Definition: XdlUnpack.cpp:23
Physical design instance.
const string elementNames
Definition: XdlUnpack.hpp:32
Header for the Design class.
PrimitiveSetSharedPtr primitives
Definition: XdlUnpack.hpp:85
Physical design net.
void removeExtraElements(PrimitiveSharedPtr primPtr)
removes extra elements that are needed for unpacking
Definition: XdlUnpack.cpp:649
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
boost::shared_ptr< Circuit > CircuitSharedPtr
Shared pointer encapsulation of a Circuit.
Definition: Circuit.hpp:219
void unpack(const Circuit &circuit, CircuitSharedPtr newCircuit)
Definition: XdlUnpack.cpp:35
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
PrimitiveSetSharedPtr ParsePrimitiveFile(const char *inFileName)
parse an XDLRC file
Physical design programmable interconnect point.
Definition: Pip.hpp:34
boost::shared_ptr< Routethrough > RoutethroughSharedPtr
Shared pointer encapsulation of a Routethrough.
const string extraInvNames
Definition: XdlUnpack.hpp:38
boost::shared_ptr< torc::physical::Named > NamedSharedPtr
Definition: XdlUnpack.hpp:82
const string extraMuxNames
Definition: XdlUnpack.hpp:35
Module input or output port.
Circuit composed of instances and nets.
Definition: Circuit.hpp:46
Header for the Factory class.
Hierarchical module.
Definition: Module.hpp:33
EPinDirection
Enumeration of instance pin directionality.
bool isExtraMux(string elem)
Definition: XdlUnpack.hpp:66