OpenASIP 2.2
Loading...
Searching...
No Matches
TemplateSlot.cc
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 TemplateSlot.cc
26 *
27 * Implementation of class TemplateSlot.
28 *
29 * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#include "TemplateSlot.hh"
34#include "MapTools.hh"
35#include "ImmediateUnit.hh"
36#include "ContainerTools.hh"
37#include "ObjectState.hh"
38
39using std::string;
40
41namespace TTAMachine {
42
43// initialization of static data members
44const string TemplateSlot::OSNAME_TEMPLATE_SLOT = "template_slot";
45const string TemplateSlot::OSKEY_SLOT = "slot";
46const string TemplateSlot::OSKEY_WIDTH = "width";
47const string TemplateSlot::OSKEY_DESTINATION = "destination";
48const string TemplateSlot::OSKEY_RF_READ = "rf_read";
49const string TemplateSlot::OSKEY_RF_WRITE = "rf_write";
50const string TemplateSlot::OSKEY_FU_READ = "fu_read";
51const string TemplateSlot::OSKEY_FU_WRITE = "fu_write";
52
53/**
54 * Constructor.
55 *
56 * @param slot The bus or which is programmed by the instruction bit field
57 * of this template slot.
58 * @param width The number of significant bits that can be encoded in this
59 * instruction field.
60 * @param destination The destination ImmediateUnit, that is, the
61 * ImmediateUnit that contains the registers that can be
62 * written with the bits in this template slot.
63 */
65 const Bus& slot,
66 int width,
67 ImmediateUnit& destination) :
68 bus_(&slot), immSlot_(NULL), width_(width), destination_(&destination) {
69}
70
71/**
72 * Constructor.
73 *
74 * @param slot The immediate slot which is programmed by the instruction bit
75 * field of this template slot.
76 * @param width The number of significant bits that can be encoded in this
77 * instruction field.
78 * @param destination The destination ImmediateUnit, that is, the
79 * ImmediateUnit that contains the registers that can be
80 * written with the bits in this template slot.
81 */
83 const ImmediateSlot& slot,
84 int width,
85 ImmediateUnit& destination) :
86 bus_(NULL), immSlot_(&slot), width_(width), destination_(&destination) {
87}
88
89/**
90 * Creates an implicit slot in a template that does not target
91 * an ImmediateUnit.
92 *
93 * @param slot The bus or which is programmed by the instruction bit field
94 * of this template slot.
95 */
96
98 : bus_(&slot), width_(0), destination_(NULL) {}
99
100/**
101 * Destructor.
102 */
105
106
107/**
108 * Saves the state of the object into an ObjectState instance.
109 *
110 * @return The newly created ObjectState instance.
111 */
115 slotState->setAttribute(OSKEY_SLOT, slot());
116 slotState->setAttribute(OSKEY_WIDTH, width());
117 slotState->setAttribute(OSKEY_DESTINATION, destination()->name());
118 return slotState;
119}
120}
void setAttribute(const std::string &name, const std::string &value)
TemplateSlot(const Bus &slot, int width, ImmediateUnit &destination)
static const std::string OSNAME_TEMPLATE_SLOT
ObjectState name for template slot.
static const std::string OSKEY_RF_READ
static const std::string OSKEY_FU_WRITE
std::string slot() const
static const std::string OSKEY_SLOT
ObjectState attribute key for slot name.
static const std::string OSKEY_RF_WRITE
static const std::string OSKEY_DESTINATION
ObjectState attribute key for destination.
ImmediateUnit * destination() const
static const std::string OSKEY_FU_READ
static const std::string OSKEY_WIDTH
ObjectState attribute key for bit width.
ObjectState * saveState() const