at.dms.kjc.spacetime
Class Address

java.lang.Object
  extended by at.dms.kjc.spacetime.Address

public class Address
extends Object

This class represents an unsigned 32-bit address in the SpaceTime backend. It has functions for adding, subtracting, aligning, and printing unsigned 32-bit values. Conceptually, it is used to represent a 32-bit address for memory that is byte-addressable.

Author:
mgordon

Field Summary
static Address MAX_ADDRESS
           
static Address ZERO
           
 
Method Summary
 Address add(Address i)
          Add the value of i to this address and return a new address with this value.
 Address add(int i)
          Add the value of i to this address and return a new address with this value.
 Address add32Byte(int i)
          Add the value of i to this address and return a new address with this value, round up the value to the next 32-byte boundary.
 Address ceil32()
          Return a new Address whose value is the next 32-byte aligned Address greater than this.
 Address div(int i)
          Return a new Address whose value is this / i.
static boolean inRange(Address addr, Address lb, Address ub)
          Return true if addr is within the range [lb, ub].
 Address mult(int i)
          Return a new Address whose value is this * i.
static String toHex(long addr)
          Return the hexadecimal string that represents this 32-bit unsigned value addr.
 String toString()
          Return the hexadecimal representation of the unsigned int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_ADDRESS

public static Address MAX_ADDRESS

ZERO

public static Address ZERO
Method Detail

toString

public String toString()
Return the hexadecimal representation of the unsigned int.

Overrides:
toString in class Object
Returns:
the hexadecimal representation of the unsigned int.
See Also:
toHex(long)

toHex

public static String toHex(long addr)
Return the hexadecimal string that represents this 32-bit unsigned value addr.

Parameters:
addr - The 32-bit unsigned value.
Returns:
The hexadecimal string for addr.

add

public Address add(Address i)
Add the value of i to this address and return a new address with this value.

Parameters:
i - The value to add to this address.
Returns:
A new address with i + this.

add

public Address add(int i)
Add the value of i to this address and return a new address with this value.

Parameters:
i - The value to add to this address.
Returns:
A new address with i + this.

add32Byte

public Address add32Byte(int i)
Add the value of i to this address and return a new address with this value, round up the value to the next 32-byte boundary.

Parameters:
i - The value to add to this address.
Returns:
A new address with i + this.

ceil32

public Address ceil32()
Return a new Address whose value is the next 32-byte aligned Address greater than this.

Returns:
a new Address whose value is the next 32-byte aligned Address greater than this.

div

public Address div(int i)
Return a new Address whose value is this / i.

Parameters:
i - The divisor.
Returns:
a new Address whose value is this / i.

mult

public Address mult(int i)
Return a new Address whose value is this * i.

Parameters:
i - The multiplier
Returns:
a new Address whose value is this * i.

inRange

public static boolean inRange(Address addr,
                              Address lb,
                              Address ub)
Return true if addr is within the range [lb, ub].

Parameters:
addr - The address to test.
lb - The lower bound.
ub - The upper bound.
Returns:
true if addr is within the range [lb, ub].