OpenASIP  2.0
NetlistFactories.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2015 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /*
25  * @file NetlistFactories.hh
26  *
27  * Declaration of NetlistFactories class.
28  *
29  * Collection of factories for creating netlist ports, port groups and blocks.
30  *
31  * Created on: 25.5.2015
32  * @author Henry Linjamäki 2015 (henry.linjamaki-no.spam-tut.fi)
33  * @note rating: red
34  */
35 
36 #ifndef NETLISTFACTORIES_HH
37 #define NETLISTFACTORIES_HH
38 
39 #include <map>
40 #include <utility>
41 
42 #include "Machine.hh"
43 #include "MachineImplementation.hh"
44 
45 #include "SignalTypes.hh"
46 #include "SignalGroupTypes.hh"
47 #include "NetlistPort.hh"
48 #include "NetlistPortGroup.hh"
49 
50 namespace ProGe {
51 
52 /*
53  * Factory that creates prototype ports by given signal (group) types.
54  */
55 class PortFactory {
56 public:
59  const IDF::MachineImplementation& impl);
60  virtual ~PortFactory();
61 
62  NetlistPort* createPort(SignalType type, Direction direction = IN) const;
64 
65  static NetlistPort* create(SignalType type, Direction direction = IN);
67  static void initializeContext(
69  const IDF::MachineImplementation& impl);
70  static PortFactory* instance();
71 
72  static NetlistPort* clockPort(Direction direction = IN);
73  static NetlistPort* resetPort(Direction direction = IN);
74 
75 private:
76  PortFactory();
77 
78  void registerPort(SignalType, const NetlistPort* port);
79  void registerPort(const NetlistPort* port);
80  void registerPorts();
81  void registerPortGroup(
82  SignalGroupType type,
83  const NetlistPortGroup* portGroup);
84  void registerPortGroup(const NetlistPortGroup* portGroup);
85  void registerPortGroups();
86 
87  typedef std::map<SignalType, const NetlistPort*>
89  typedef std::map<SignalGroupType, const NetlistPortGroup*>
91 
92  /// The creation context.
93  /*const TTAMachine::Machine* machine_;*/
94  /// The creation context.
95  /*const IDF::MachineImplementation* implementation_;*/
96  /// Registered NetlistPort prototypes.
98  /// Registered NetlistPortGroup prototypes.
100 
101  /// Singleton instance of the factory.
103  /// The creation context for singleton instance.
105  /// The creation context for singleton instance.
107 };
108 
109 } /* namespace ProGe */
110 
111 
112 
113 #endif /* NETLISTFACTORIES_HH */
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
ProGe::PortFactory::resetPort
static NetlistPort * resetPort(Direction direction=IN)
Definition: NetlistFactories.cc:209
ProGe::PortFactory::createPort
NetlistPort * createPort(SignalType type, Direction direction=IN) const
Definition: NetlistFactories.cc:134
ProGe::PortFactory::registerPortGroups
void registerPortGroups()
Definition: NetlistFactories.cc:112
ProGe::PortFactory::PortGroupPrototypeContainer
std::map< SignalGroupType, const NetlistPortGroup * > PortGroupPrototypeContainer
Definition: NetlistFactories.hh:90
ProGe::PortFactory::initializeContext
static void initializeContext(const TTAMachine::Machine &machine, const IDF::MachineImplementation &impl)
Definition: NetlistFactories.cc:169
ProGe::PortFactory::~PortFactory
virtual ~PortFactory()
Definition: NetlistFactories.cc:60
NetlistPortGroup.hh
ProGe::NetlistPortGroup
Definition: NetlistPortGroup.hh:53
ProGe::PortFactory::staticMachine_
static const TTAMachine::Machine * staticMachine_
The creation context for singleton instance.
Definition: NetlistFactories.hh:104
ProGe::PortFactory::portPrototypes_
PortPrototypeContainer portPrototypes_
The creation context.
Definition: NetlistFactories.hh:97
ProGe::PortFactory::instance
static PortFactory * instance()
Definition: NetlistFactories.cc:184
ProGe::PortFactory::PortFactory
PortFactory()
Definition: NetlistFactories.cc:48
SignalTypes.hh
NetlistPort.hh
ProGe::PortFactory::staticImplementation_
static const IDF::MachineImplementation * staticImplementation_
The creation context for singleton instance.
Definition: NetlistFactories.hh:106
ProGe::PortFactory::registerPortGroup
void registerPortGroup(SignalGroupType type, const NetlistPortGroup *portGroup)
Definition: NetlistFactories.cc:96
Machine.hh
ProGe::PortFactory::clockPort
static NetlistPort * clockPort(Direction direction=IN)
Definition: NetlistFactories.cc:200
ProGe::SignalType
SignalType
Definition: SignalTypes.hh:42
ProGe::PortFactory::registerPorts
void registerPorts()
Definition: NetlistFactories.cc:89
ProGe::PortFactory
Definition: NetlistFactories.hh:55
ProGe::PortFactory::instance_
static PortFactory * instance_
Singleton instance of the factory.
Definition: NetlistFactories.hh:102
ProGe::PortFactory::createPortGroup
NetlistPortGroup * createPortGroup(SignalGroupType type) const
Definition: NetlistFactories.cc:152
ProGe
Definition: FUGen.hh:54
SignalGroupTypes.hh
ProGe::PortFactory::create
static NetlistPort * create(SignalType type, Direction direction=IN)
Definition: NetlistFactories.cc:147
ProGe::PortFactory::portGroupPrototypes_
PortGroupPrototypeContainer portGroupPrototypes_
Registered NetlistPortGroup prototypes.
Definition: NetlistFactories.hh:99
ProGe::NetlistPort
Definition: NetlistPort.hh:70
ProGe::PortFactory::PortPrototypeContainer
std::map< SignalType, const NetlistPort * > PortPrototypeContainer
Definition: NetlistFactories.hh:88
ProGe::SignalGroupType
SignalGroupType
Definition: SignalGroupTypes.hh:43
ProGe::Direction
Direction
Direction of the port.
Definition: ProGeTypes.hh:52
ProGe::IN
@ IN
Input port.
Definition: ProGeTypes.hh:53
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
MachineImplementation.hh
TTAMachine::Machine
Definition: Machine.hh:73
ProGe::PortFactory::registerPort
void registerPort(SignalType, const NetlistPort *port)
Definition: NetlistFactories.cc:77