OpenASIP 2.2
Loading...
Searching...
No Matches
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
42namespace TTAMachine {
43
44/**
45 * An abstract base class for register files as ImmediateUnit and
46 * RegisterFile.
47 */
48class BaseRegisterFile : public Unit {
49public:
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
72protected:
73 BaseRegisterFile(const std::string& name, int size, int width);
74 BaseRegisterFile(const ObjectState* state);
75
76private:
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
virtual void setNumberOfRegisters(int registers)
static const std::string OSKEY_SIZE
ObjectState attribute key for the number of registers.
virtual ObjectState * saveState() const
virtual int numberOfRegisters() const
virtual int size() const
static const std::string OSKEY_WIDTH
ObjectState attribute key for bit width of the registers.
static const std::string OSNAME_BASE_REGISTER_FILE
ObjectState name for BaseRegisterFile.
void loadStateWithoutReferences(const ObjectState *state)
virtual int width() const
int width_
Bit width of the registers in the register file.
virtual void setWidth(int width)
int size_
Number of registers in the register file.
virtual RFPort * port(const std::string &name) const
virtual void loadState(const ObjectState *state)
virtual TCEString name() const