OpenASIP  2.0
BaseRegisterFile.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 BaseRegisterFile.hh
26  *
27  * Declaration of abstract BaseRegisterFile class.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  * @note reviewed 10 Jun 2004 by vpj, am, tr, ll
31  * @note rating: red
32  */
33 
34 #ifndef TTA_BASE_REGISTER_FILE_HH
35 #define TTA_BASE_REGISTER_FILE_HH
36 
37 #include <string>
38 
39 #include "Unit.hh"
40 #include "RFPort.hh"
41 
42 namespace TTAMachine {
43 
44 /**
45  * An abstract base class for register files as ImmediateUnit and
46  * RegisterFile.
47  */
48 class BaseRegisterFile : public Unit {
49 public:
50  virtual ~BaseRegisterFile();
51 
52  virtual int numberOfRegisters() const;
53  virtual int width() const;
54  virtual int size() const;
55 
56  virtual void setNumberOfRegisters(int registers);
57  virtual void setWidth(int width);
58 
59  virtual RFPort* port(const std::string& name) const;
60  virtual RFPort* port(int index) const;
61 
62  virtual ObjectState* saveState() const;
63  virtual void loadState(const ObjectState* state);
64 
65  /// ObjectState name for BaseRegisterFile.
66  static const std::string OSNAME_BASE_REGISTER_FILE;
67  /// ObjectState attribute key for the number of registers.
68  static const std::string OSKEY_SIZE;
69  /// ObjectState attribute key for bit width of the registers.
70  static const std::string OSKEY_WIDTH;
71 
72 protected:
73  BaseRegisterFile(const std::string& name, int size, int width);
74  BaseRegisterFile(const ObjectState* state);
75 
76 private:
77  void loadStateWithoutReferences(const ObjectState* state);
78 
79  /// Number of registers in the register file.
80  int size_;
81  /// Bit width of the registers in the register file.
82  int width_;
83 };
84 }
85 
86 #include "BaseRegisterFile.icc"
87 
88 #endif
TTAMachine::BaseRegisterFile::setWidth
virtual void setWidth(int width)
Definition: BaseRegisterFile.cc:112
TTAMachine::BaseRegisterFile::OSKEY_SIZE
static const std::string OSKEY_SIZE
ObjectState attribute key for the number of registers.
Definition: BaseRegisterFile.hh:68
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAMachine::BaseRegisterFile::~BaseRegisterFile
virtual ~BaseRegisterFile()
Definition: BaseRegisterFile.cc:84
TTAMachine::BaseRegisterFile::size_
int size_
Number of registers in the register file.
Definition: BaseRegisterFile.hh:80
TTAMachine::BaseRegisterFile::loadState
virtual void loadState(const ObjectState *state)
Definition: BaseRegisterFile.cc:176
ObjectState
Definition: ObjectState.hh:59
TTAMachine::BaseRegisterFile::BaseRegisterFile
BaseRegisterFile(const std::string &name, int size, int width)
Definition: BaseRegisterFile.cc:60
TTAMachine::RFPort
Definition: RFPort.hh:45
TTAMachine::BaseRegisterFile::numberOfRegisters
virtual int numberOfRegisters() const
Unit.hh
TTAMachine::BaseRegisterFile
Definition: BaseRegisterFile.hh:48
TTAMachine::BaseRegisterFile::OSKEY_WIDTH
static const std::string OSKEY_WIDTH
ObjectState attribute key for bit width of the registers.
Definition: BaseRegisterFile.hh:70
TTAMachine::Unit
Definition: Unit.hh:51
TTAMachine::BaseRegisterFile::loadStateWithoutReferences
void loadStateWithoutReferences(const ObjectState *state)
Definition: BaseRegisterFile.cc:190
BaseRegisterFile.icc
TTAMachine::BaseRegisterFile::setNumberOfRegisters
virtual void setNumberOfRegisters(int registers)
Definition: BaseRegisterFile.cc:96
TTAMachine::BaseRegisterFile::port
virtual RFPort * port(const std::string &name) const
Definition: BaseRegisterFile.cc:129
TTAMachine::BaseRegisterFile::saveState
virtual ObjectState * saveState() const
Definition: BaseRegisterFile.cc:159
TTAMachine::BaseRegisterFile::OSNAME_BASE_REGISTER_FILE
static const std::string OSNAME_BASE_REGISTER_FILE
ObjectState name for BaseRegisterFile.
Definition: BaseRegisterFile.hh:66
TTAMachine::BaseRegisterFile::width_
int width_
Bit width of the registers in the register file.
Definition: BaseRegisterFile.hh:82
RFPort.hh
TTAMachine
Definition: Assembler.hh:48
TTAMachine::BaseRegisterFile::size
virtual int size() const
TTAMachine::BaseRegisterFile::width
virtual int width() const