class RPicSim::Variable

Instances of this class represents a variable in the memory of the simulated microcontroller. This class provides methods for reading, writing, and getting address of the variable.

@api public

Public Class Methods

new(storage) click to toggle source

Creates a new Variable object. @param storage The internal storage for the variable. @api private

# File lib/rpicsim/variable.rb, line 12
def initialize(storage)
  @storage = storage
end

Public Instance Methods

address() click to toggle source

The main (lowest) address of this variable. @return [Integer]

# File lib/rpicsim/variable.rb, line 54
def address
  @storage.address
end
addresses() click to toggle source

The addresses in memory occupied by this variable. @return [Array(Integer)]

# File lib/rpicsim/variable.rb, line 48
def addresses
  @storage.addresses
end
memory_value() click to toggle source

Reads the value directly from the memory object backing the register. For some types of variables, this is the same as {#value}.

# File lib/rpicsim/variable.rb, line 37
def memory_value
  @storage.memory_value
end
memory_value=(val) click to toggle source

Writes the value to the variable in a lower-level way that overrides any read-only bits. For some types of variables, this is the same as {#value=}.

# File lib/rpicsim/variable.rb, line 31
def memory_value=(val)
  @storage.memory_value = val
end
name() click to toggle source

The name of the variable. @return [Symbol]

# File lib/rpicsim/variable.rb, line 60
def name
  @storage.name
end
to_s() click to toggle source

@return [String]

# File lib/rpicsim/variable.rb, line 42
def to_s
  @storage.to_s
end
value() click to toggle source

Reads the value of the variable. @return [Integer]

# File lib/rpicsim/variable.rb, line 18
def value
  @storage.value
end
value=(val) click to toggle source

Writes the value to the variable. @return [Integer]

# File lib/rpicsim/variable.rb, line 24
def value=(val)
  @storage.value = val
end