pub struct Address(Unsigned18Bit);
Expand description
An address has 17 normal value bits. There are 18 bits for the
operand base address in the instruction word, but the topmost bit
signals a deferred (i.e. indirect) access, so we should never see
a memory access to an address with the 0o400_000
bit set.
The program counter can also have its top bit set. This signals that in the TX-2 hardware, the associated sequence should be traced via Trap 42.
The Xj (index) registers form an 18-bit ring and are described on
page 3-68 of the User Handbook (section 3-3.1) as being signed
integers. Yet P (which also holds an address) is described on the
same page as being a positive integer. Therefore when performing
address arithmetic, we sometimes need to convert index register
values to the Signed18Bit
type.
Tuple Fields§
§0: Unsigned18Bit
Implementations§
Source§impl Address
impl Address
pub const ZERO: Address
pub const MAX: Address
pub const fn new(a: Unsigned18Bit) -> Address
Sourcepub const fn and(&self, mask: u32) -> Address
pub const fn and(&self, mask: u32) -> Address
Apply a bitmask to an address. This could also be done via
std::ops::BitAnd
, but trait implementations cannot be
const. Implementing this const methods allows us to form
address constants at compile time with code like Address::MAX & 0o03400
.
Sourcepub fn mark_bit(&self) -> Unsigned18Bit
pub fn mark_bit(&self) -> Unsigned18Bit
Extract the placeholder mark bit.
Sourcepub fn is_marked_placeholder(&self) -> bool
pub fn is_marked_placeholder(&self) -> bool
The placeholder phrasing here comes from the “TRAP 42” features. But the high bit in the operand address field in an instruction also marks the operand as using deferred addressing. We should choose more neutral naming to avoid confusion.
Sourcepub fn split(&self) -> (Unsigned18Bit, bool)
pub fn split(&self) -> (Unsigned18Bit, bool)
Split an address into its bottom 17 bits (which corresponds to
an actual memory register on the TX-2) and a “mark” bit. The
“mark” bit is variously used to signal deferred addressing
when fetching operands, and to flag a sequence for tracing
with trap 42 (in this context is is called a “placeholder mark
bit”). The split
method is the opposite of join
.
Sourcepub fn join(addr: Unsigned18Bit, mark: bool) -> Address
pub fn join(addr: Unsigned18Bit, mark: bool) -> Address
Form an address from the bottom 17 bits of addr
and a
possilbe mark bit, mark
. If mark
is false, the resulting
address will have a zero-valued top bit, no matter what is in
addr
. This is the opposite of split
.
Trait Implementations§
Source§impl From<&Address> for Unsigned18Bit
impl From<&Address> for Unsigned18Bit
Source§impl From<&Address> for Unsigned36Bit
impl From<&Address> for Unsigned36Bit
Source§impl From<Address> for Unsigned18Bit
impl From<Address> for Unsigned18Bit
Source§impl From<Address> for Unsigned36Bit
impl From<Address> for Unsigned36Bit
Source§impl From<Unsigned18Bit> for Address
impl From<Unsigned18Bit> for Address
Source§fn from(a: Unsigned18Bit) -> Address
fn from(a: Unsigned18Bit) -> Address
Source§impl IndexBy<Signed18Bit> for Address
impl IndexBy<Signed18Bit> for Address
fn index_by(&self, delta: Signed18Bit) -> Address
Source§impl IndexBy<Signed5Bit> for Address
impl IndexBy<Signed5Bit> for Address
fn index_by(&self, delta: Signed5Bit) -> Address
Source§impl IndexBy<Signed6Bit> for Address
impl IndexBy<Signed6Bit> for Address
fn index_by(&self, delta: Signed6Bit) -> Address
Source§impl IndexBy<Unsigned18Bit> for Address
impl IndexBy<Unsigned18Bit> for Address
fn index_by(&self, delta: Unsigned18Bit) -> Address
Source§impl Ord for Address
impl Ord for Address
Source§impl PartialOrd for Address
impl PartialOrd for Address
Source§impl TryFrom<Unsigned36Bit> for Address
impl TryFrom<Unsigned36Bit> for Address
Source§type Error = ConversionFailed
type Error = ConversionFailed
Source§fn try_from(n: Unsigned36Bit) -> Result<Address, ConversionFailed>
fn try_from(n: Unsigned36Bit) -> Result<Address, ConversionFailed>
impl Copy for Address
impl Eq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.