OpenASIP 2.2
Loading...
Searching...
No Matches
ImmediateUnit.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 ImmediateUnit.hh
26 *
27 * Declaration of ImmediateUnit class.
28 *
29 * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30 */
31
32#ifndef TTA_IMMEDIATE_UNIT_HH
33#define TTA_IMMEDIATE_UNIT_HH
34
35#include <string>
36#include <list>
37
38#include "Machine.hh"
39#include "RegisterFile.hh"
40
41class ObjectState;
42
43namespace TTAMachine {
44
45class InstructionTemplate;
46
47/**
48 * Represent a immediate unit in the machine.
49 */
51public:
53 const std::string& name, unsigned int size, unsigned int width,
54 unsigned int maxReads, unsigned int guardLatency,
55 Machine::Extension extension);
56 ImmediateUnit(const ObjectState* state);
58
59 virtual void setMaxWrites(int maxWrites);
60 virtual void setName(const std::string& name);
61
62 bool signExtends() const { return extension_ == Machine::SIGN; }
63 bool zeroExtends() const { return extension_ == Machine::ZERO; }
64
65 virtual Machine::Extension extensionMode() const;
66 virtual int latency() const;
68
69 virtual void unsetMachine();
70
71 virtual ObjectState* saveState() const;
72 virtual void loadState(const ObjectState* state);
73
74 /// ObjectState name for ImmediateUnit.
75 static const std::string OSNAME_IMMEDIATE_UNIT;
76 /// ObjectState attribute key for the extension mode.
77 static const std::string OSKEY_EXTENSION;
78 /// ObjectState attribute value for sign extension.
79 static const std::string OSVALUE_SIGN;
80 /// ObjectState attribute value for zero extension.
81 static const std::string OSVALUE_ZERO;
82 /// ObjectState attribute key for latency.
83 static const std::string OSKEY_LATENCY;
84
85private:
86 virtual void setLatency(int latency);
87 void loadStateWithoutReferences(const ObjectState* state);
88
89 /**
90 * Extension mode applied to the long immediate when it is narrower than
91 * the immediate register.
92 */
94
95 /**
96 * Minimum number of cycles needed between the encoding of a long
97 * immediate and its earliest transport on a data bus.
98 */
100};
101}
102
103#endif
virtual int size() const
virtual int width() const
virtual TCEString name() const
static const std::string OSVALUE_SIGN
ObjectState attribute value for sign extension.
virtual void setLatency(int latency)
void loadStateWithoutReferences(const ObjectState *state)
virtual void loadState(const ObjectState *state)
Machine::Extension extension_
static const std::string OSKEY_LATENCY
ObjectState attribute key for latency.
virtual void setMaxWrites(int maxWrites)
virtual void setExtensionMode(Machine::Extension mode)
virtual int latency() const
static const std::string OSNAME_IMMEDIATE_UNIT
ObjectState name for ImmediateUnit.
virtual ObjectState * saveState() const
virtual Machine::Extension extensionMode() const
static const std::string OSVALUE_ZERO
ObjectState attribute value for zero extension.
virtual void setName(const std::string &name)
static const std::string OSKEY_EXTENSION
ObjectState attribute key for the extension mode.
@ SIGN
Sign extension.
Definition Machine.hh:82
@ ZERO
Zero extension.
Definition Machine.hh:81
virtual int maxReads() const
virtual int guardLatency() const
virtual int maxWrites() const
mode
Definition tceopgen.cc:45