OpenASIP  2.0
TerminalAddress.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 TerminalAddress.cc
26  *
27  * Implementation of TerminalAddress class.
28  *
29  * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #include "TerminalAddress.hh"
34 #include "AddressSpace.hh"
35 
36 using namespace TTAMachine;
37 
38 namespace TTAProgram {
39 
40 /**
41  * Constructor. Creates a terminal address from a given immediate value and
42  * a reference to an address space.
43  *
44  * @param value Value of the address of the location.
45  * @param space Address space of the address.
46  */
47 TerminalAddress::TerminalAddress(
48  SimValue value,
49  const TTAMachine::AddressSpace& space)
50  : TerminalImmediate(value), space_(space) {
51 }
52 
53 /**
54  * The destructor.
55  */
57 }
58 
59 /**
60  * Tells whether the terminal is an inline immediate that refers to an
61  * address.
62  *
63  * @return true always.
64  */
65 bool
67  return true;
68 }
69 
70 /**
71  * Returns the address carried by this terminal.
72  *
73  * @return An address.
74  * @exception WrongSubclass never.
75  */
76 Address
79 }
80 
81 /**
82  * Creates an exact copy of the terminal and returns it.
83  *
84  * @return A copy of the terminal.
85  */
86 Terminal*
89 }
90 
91 /**
92  * Checks if terminals are equal.
93  *
94  * @param other Terminal to compare.
95  * @return true if terminals are equal.
96  */
97 bool
98 TerminalAddress::equals(const Terminal& other) const {
99 
100  if (other.isAddress() != true) {
101  return false;
102  }
103  return (address().location() == other.address().location() &&
104  address().space().name() == other.address().space().name());
105 }
106 
107 
108 } // namespace TTAProgram
TTAProgram
Definition: Estimator.hh:65
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAProgram::Address
Definition: Address.hh:51
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
TTAProgram::Terminal::isAddress
virtual bool isAddress() const
Definition: Terminal.cc:75
AddressSpace.hh
TTAProgram::Address::space
const TTAMachine::AddressSpace & space() const
TTAProgram::Terminal::address
virtual Address address() const
Definition: Terminal.cc:210
SimValue
Definition: SimValue.hh:96
TTAProgram::TerminalImmediate::value
virtual SimValue value() const
Definition: TerminalImmediate.cc:75
TTAProgram::TerminalAddress::isAddress
virtual bool isAddress() const
Definition: TerminalAddress.cc:66
TTAProgram::TerminalAddress::space_
const TTAMachine::AddressSpace & space_
Address space of the address.
Definition: TerminalAddress.hh:61
TTAProgram::TerminalImmediate::value_
SimValue value_
Value of the inline immediate.
Definition: TerminalImmediate.hh:62
TTAProgram::Address::location
InstructionAddress location() const
TTAProgram::TerminalAddress::~TerminalAddress
virtual ~TerminalAddress()
Definition: TerminalAddress.cc:56
TTAProgram::TerminalAddress::copy
virtual Terminal * copy() const
Definition: TerminalAddress.cc:87
SimValue::unsignedValue
unsigned int unsignedValue() const
Definition: SimValue.cc:919
TTAProgram::TerminalImmediate
Definition: TerminalImmediate.hh:44
TTAProgram::TerminalAddress::address
virtual Address address() const
Definition: TerminalAddress.cc:77
TerminalAddress.hh
TTAProgram::Terminal
Definition: Terminal.hh:60
TTAProgram::TerminalAddress::TerminalAddress
TerminalAddress(SimValue value, const TTAMachine::AddressSpace &space)
Definition: TerminalAddress.cc:47
TTAMachine
Definition: Assembler.hh:48
TTAProgram::TerminalAddress::equals
virtual bool equals(const Terminal &other) const
Definition: TerminalAddress.cc:98