OpenASIP  2.0
FUPort.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 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 FUPort.hh
26  *
27  * Declaration of FUPort class.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  * @note reviewed 14 Jun 2004 by am, tr, ao, ll
31  * @note rating: red
32  */
33 
34 #ifndef TTA_FU_PORT_HH
35 #define TTA_FU_PORT_HH
36 
37 #include <string>
38 
39 #include "BaseFUPort.hh"
40 
41 namespace TTAMachine {
42 
43 /**
44  * Represens an operand, trigger or result port of a function unit.
45  */
46 class FUPort : public BaseFUPort {
47 public:
48  FUPort(
49  const std::string& name, int width, FunctionUnit& parent, bool triggers,
50  bool setsOpcode, bool noRegister = false);
51  FUPort(const ObjectState* state, Unit& parent);
52  virtual ~FUPort();
53 
54  virtual bool isTriggering() const;
55  virtual bool isOpcodeSetting() const;
56 
57  void setTriggering(bool triggers);
58 
59  virtual ObjectState* saveState() const;
60  virtual void loadState(const ObjectState* state);
61 
62  std::string bindingString() const;
63  void updateBindingString() const;
64 
65  bool isArchitectureEqual(FUPort* port);
66 
67  bool noRegister() const;
68  void setNoRegister(bool noRegister);
69 
70  /// ObjectState name for FUPort.
71  static const std::string OSNAME_FUPORT;
72  /// ObjectState attribute key for triggering feature.
73  static const std::string OSKEY_TRIGGERING;
74  /// ObjectState attribute key for operand code setting feature.
75  static const std::string OSKEY_OPCODE_SETTING;
76  /// ObjectState attribute key for noRegister setting feature.
77  static const std::string OSKEY_NO_REGISTER;
78 
79 protected:
80  // this is for UniversalFUPort class
81  FUPort(
82  const std::string& name, int width, FunctionUnit& parent, bool triggers,
83  bool setsOpcode, bool noRegister, bool dummy);
84 
85 private:
86  void cleanupGuards() const;
87  void cleanupOperandBindings() const;
88  void loadStateWithoutReferences(const ObjectState* state);
89 
90  /// Specifies whether this is a triggering port.
91  bool triggers_;
92  /// Specifies whether this is an operation selecting port.
94  /// Binding string describes the operation bindings of
95  /// of the port to allow fast binding comparison.
96  mutable std::string bindingString_;
97  // Indicated that port do not have internal register for storing value.
99 };
100 }
101 
102 #endif
TTAMachine::FUPort::noRegister
bool noRegister() const
Definition: FUPort.cc:469
TTAMachine::FUPort::bindingString_
std::string bindingString_
Binding string describes the operation bindings of of the port to allow fast binding comparison.
Definition: FUPort.hh:96
TTAMachine::FUPort::cleanupOperandBindings
void cleanupOperandBindings() const
Definition: FUPort.cc:388
TTAMachine::FUPort::isOpcodeSetting
virtual bool isOpcodeSetting() const
Definition: FUPort.cc:195
TTAMachine::BaseFUPort
Definition: BaseFUPort.hh:44
TTAMachine::FUPort::~FUPort
virtual ~FUPort()
Definition: FUPort.cc:168
TTAMachine::FUPort::setNoRegister
void setNoRegister(bool noRegister)
Definition: FUPort.cc:479
TTAMachine::FUPort::triggers_
bool triggers_
Specifies whether this is a triggering port.
Definition: FUPort.hh:91
TTAMachine::FUPort::OSKEY_NO_REGISTER
static const std::string OSKEY_NO_REGISTER
ObjectState attribute key for noRegister setting feature.
Definition: FUPort.hh:77
ObjectState
Definition: ObjectState.hh:59
TTAMachine::FUPort::setsOpcode_
bool setsOpcode_
Specifies whether this is an operation selecting port.
Definition: FUPort.hh:93
TTAMachine::FUPort::isTriggering
virtual bool isTriggering() const
Definition: FUPort.cc:182
BaseFUPort.hh
TTAMachine::FUPort::updateBindingString
void updateBindingString() const
Definition: FUPort.cc:294
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::FUPort
Definition: FUPort.hh:46
TTAMachine::FUPort::bindingString
std::string bindingString() const
Definition: FUPort.cc:280
TTAMachine::Unit
Definition: Unit.hh:51
TTAMachine::FUPort::cleanupGuards
void cleanupGuards() const
Definition: FUPort.cc:354
TTAMachine::FUPort::saveState
virtual ObjectState * saveState() const
Definition: FUPort.cc:239
TTAMachine::FUPort::OSNAME_FUPORT
static const std::string OSNAME_FUPORT
ObjectState name for FUPort.
Definition: FUPort.hh:71
dummy
SimValue dummy(32)
a dummy simvalue which is given for operands that are not bound
TTAMachine::FUPort::OSKEY_OPCODE_SETTING
static const std::string OSKEY_OPCODE_SETTING
ObjectState attribute key for operand code setting feature.
Definition: FUPort.hh:75
TTAMachine::FUPort::noRegister_
bool noRegister_
Definition: FUPort.hh:98
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
TTAMachine::FUPort::setTriggering
void setTriggering(bool triggers)
Definition: FUPort.cc:212
TTAMachine::FUPort::loadStateWithoutReferences
void loadStateWithoutReferences(const ObjectState *state)
Definition: FUPort.cc:416
TTAMachine
Definition: Assembler.hh:48
TTAMachine::FUPort::loadState
virtual void loadState(const ObjectState *state)
Definition: FUPort.cc:257
TTAMachine::BaseFUPort::width
virtual int width() const
Definition: BaseFUPort.cc:109
TTAMachine::FUPort::FUPort
FUPort(const std::string &name, int width, FunctionUnit &parent, bool triggers, bool setsOpcode, bool noRegister=false)
Definition: FUPort.cc:76
TTAMachine::FUPort::isArchitectureEqual
bool isArchitectureEqual(FUPort *port)
Definition: FUPort.cc:332
TTAMachine::FUPort::OSKEY_TRIGGERING
static const std::string OSKEY_TRIGGERING
ObjectState attribute key for triggering feature.
Definition: FUPort.hh:73