torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Unpacker.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_UNPACKER_HPP
17 #define TORC_PACKER_UNPACKER_HPP
18 
19 #include "torc/physical/Design.hpp"
23 #include "PrimitiveStructure.hpp"
24 #include <boost/smart_ptr.hpp>
25 #include <iostream>
26 #include <string>
27 #include <map>
28 
29 namespace torc {
30 namespace packer {
31 
32  namespace packer { class UnpackerUnitTest; }
33 
34  class Unpacker {
35 
36  protected:
37  /// \brief Our unit test class has access to our internals.
39 
40  // types
41  /// \brief Imported type name
43  /// \brief Imported type name
50  /// \brief Map of PrimitiveStructure Shared Pointers.
51  typedef std::map<std::string, PrimitiveStructureSharedPtr>
53  /// \brief Vector of Primitive Element Pin Pointers.
54  typedef std::vector<const torc::architecture::PrimitiveElementPin*>
56  /// \brief Map of Candidate Nets
57  typedef std::map<const torc::architecture::PrimitiveElementPin*,
59  /// \brief Map of Primitive Element Name to Primitive Element.
60  typedef std::map<std::string, const PrimitiveStructure::PrimitiveElement*>
62  /// \brief Map of Primitive Element Pointer to Instance Shared Pointer.
63  typedef std::map<const torc::architecture::PrimitiveElement*,
65 
66  //members
71 
72  /// \brief Initialize this object based on the PrimitiveDef information.
73  virtual void initialize(void);
74  /// \brief Default unpack function.
75  void unpack(void);
76  /// \brief Unpack function that takes Instance iterators as input.
78  /// \brief Function to find the next element.
79  bool findNextElement(const PrimitiveStructure& inPrimitiveStructure,
81  torc::physical::InstanceSharedPtr& inInstancePtr,
82  NameToElementPtrMap& inUsedElements,
83  std::vector<std::string> inInstanceInputPins,
84  CandidateNet& inElementPinsForNet,
86  &outNetSourcePin,
87  std::vector<torc::physical::InstanceSharedPtr>
88  &outNewInstances,
89  ElementPtrToInstancePtrMap &elementToInstanceMap);
90 
91  public:
92  //constructors
93  Unpacker(DesignSharedPtr& inDesignPtr) : mDesignPtr(inDesignPtr), mDDBPtr(0) {
94  initialize();
95  }
96 
97  /// \brief Virtual destructor.
98  virtual ~Unpacker(void) {}
99 
100 };
101 
102 } // namespace packer
103 } // namespace torc
104 
105 #endif // TORC_PACKER_UNPACKER_HPP
virtual ~Unpacker(void)
Virtual destructor.
Definition: Unpacker.hpp:98
torc::architecture::DDB DDB
Definition: Unpacker.hpp:48
Header for the ConfigMap class.
std::vector< InstanceSharedPtr > InstanceSharedPtrVector
Vector of Instance shared pointers.
Unpacker(DesignSharedPtr &inDesignPtr)
Definition: Unpacker.hpp:93
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
bool findNextElement(const PrimitiveStructure &inPrimitiveStructure, const torc::architecture::PrimitiveElement &element, torc::physical::InstanceSharedPtr &inInstancePtr, NameToElementPtrMap &inUsedElements, std::vector< std::string > inInstanceInputPins, CandidateNet &inElementPinsForNet, const torc::architecture::PrimitiveElementPin *&outNetSourcePin, std::vector< torc::physical::InstanceSharedPtr > &outNewInstances, ElementPtrToInstancePtrMap &elementToInstanceMap)
Function to find the next element.
Definition: Unpacker.cpp:70
Header for the Instance class.
InstanceSharedPtrVector::const_iterator InstanceSharedPtrConstIterator
Constant iterator to Instance shared pointers.
Definition: Circuit.hpp:72
friend class torc::packer::packer::UnpackerUnitTest
Our unit test class has access to our internals.
Definition: Unpacker.hpp:38
torc::physical::DesignSharedPtr DesignSharedPtr
Imported type name.
Definition: Unpacker.hpp:44
void unpack(void)
Default unpack function.
Definition: Unpacker.cpp:281
InstanceSharedPtrVector mInstances
Definition: Unpacker.hpp:68
Header for the PrimitiveStructure class.
std::map< const torc::architecture::PrimitiveElement *, torc::physical::InstanceSharedPtr > ElementPtrToInstancePtrMap
Map of Primitive Element Pointer to Instance Shared Pointer.
Definition: Unpacker.hpp:64
std::string string
torc::physical::Circuit::InstanceSharedPtrConstIterator InstanceSharedPtrConstIterator
Definition: Unpacker.hpp:47
torc::physical::ConfigMap ConfigMap
Definition: Unpacker.hpp:49
std::map< const torc::architecture::PrimitiveElementPin *, PrimitiveElementPinPtrVector > CandidateNet
Map of Candidate Nets.
Definition: Unpacker.hpp:58
Header for the Design class.
std::map< std::string, const PrimitiveStructure::PrimitiveElement * > NameToElementPtrMap
Map of Primitive Element Name to Primitive Element.
Definition: Unpacker.hpp:61
virtual void initialize(void)
Initialize this object based on the PrimitiveDef information.
Definition: Unpacker.cpp:41
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
torc::physical::InstanceSharedPtrVector InstanceSharedPtrVector
Definition: Unpacker.hpp:45
std::vector< const torc::architecture::PrimitiveElementPin * > PrimitiveElementPinPtrVector
Vector of Primitive Element Pin Pointers.
Definition: Unpacker.hpp:55
Encapsulation of a primitive site element. Primitive elements are subcomponents of logic primitive s...
Encapsulation of a primitive element pin's name, flags, and element pointer. Primitive element pins ...
PrimitiveStructuresSharedPtrMap mPrimitiveStructures
Definition: Unpacker.hpp:67
std::string string
Imported type name.
Definition: Unpacker.hpp:42
Configuration setting map.
Definition: ConfigMap.hpp:39
DesignSharedPtr mDesignPtr
Definition: Unpacker.hpp:69
Header for the DDB class.
Encapsulation of the site index, pin name, and pin flags for a package.
std::map< std::string, PrimitiveStructureSharedPtr > PrimitiveStructuresSharedPtrMap
Map of PrimitiveStructure Shared Pointers.
Definition: Unpacker.hpp:52