OpenASIP  2.0
Address.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 Address.hh
26  *
27  * Declaration of Address class.
28  *
29  * @author Ari Metsähalme 2005 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_ADDRESS_HH
34 #define TTA_ADDRESS_HH
35 
36 #include "BaseType.hh"
37 
38 namespace TTAMachine {
39  class AddressSpace;
40 }
41 
42 namespace TTAProgram {
43 
44 /**
45  * An address in the target memory system of the TTA program.
46  *
47  * An address is a number that identifies a location in an address space. An
48  * address can point to a location of data memory, instruction memory or
49  * unified memory.
50  */
51 class Address {
52 public:
53  Address(
56  ~Address();
57 
59  const TTAMachine::AddressSpace& space() const;
60  bool operator==(const Address& other) const;
61  bool operator!=(const Address& other) const;
62 
63  bool operator<(const Address& addr) const {
64  if (location_ < addr.location_) return true;
65  if (location_ > addr.location_) return false;
66 
67  // The location is equal.
68 
69  if (space_ < addr.space_) return true;
70 
71  return false;
72  }
73 
74 private:
75  /// The location identified by the address.
77  /// The address space of the address.
79 };
80 
81 #include "Address.icc"
82 
83 }
84 
85 #endif
TTAProgram
Definition: Estimator.hh:65
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
BaseType.hh
TTAProgram::Address
Definition: Address.hh:51
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
Address.icc
TTAProgram::Address::space
const TTAMachine::AddressSpace & space() const
TTAProgram::Address::operator==
bool operator==(const Address &other) const
Definition: Address.cc:40
TTAProgram::Address::operator!=
bool operator!=(const Address &other) const
Definition: Address.cc:46
TTAProgram::Address::location_
InstructionAddress location_
The location identified by the address.
Definition: Address.hh:76
TTAProgram::Address::location
InstructionAddress location() const
TTAProgram::Address::operator<
bool operator<(const Address &addr) const
Definition: Address.hh:63
TTAProgram::Address::~Address
~Address()
TTAMachine
Definition: Assembler.hh:48
TTAProgram::Address::Address
Address(InstructionAddress location, const TTAMachine::AddressSpace &space)
TTAProgram::Address::space_
const TTAMachine::AddressSpace * space_
The address space of the address.
Definition: Address.hh:78