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
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
The main (lowest) address of this variable. @return [Integer]
# File lib/rpicsim/variable.rb, line 54 def address @storage.address end
The addresses in memory occupied by this variable. @return [Array(Integer)]
# File lib/rpicsim/variable.rb, line 48 def addresses @storage.addresses end
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
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
The name of the variable. @return [Symbol]
# File lib/rpicsim/variable.rb, line 60 def name @storage.name end
@return [String]
# File lib/rpicsim/variable.rb, line 42 def to_s @storage.to_s end
Reads the value of the variable. @return [Integer]
# File lib/rpicsim/variable.rb, line 18 def value @storage.value end
Writes the value to the variable. @return [Integer]
# File lib/rpicsim/variable.rb, line 24 def value=(val) @storage.value = val end