Class: RPicSim::Variable
- Inherits:
-
Object
- Object
- RPicSim::Variable
- Defined in:
- lib/rpicsim/variable.rb
Overview
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.
Instance Method Summary collapse
-
#address ⇒ Integer
The main (lowest) address of this variable.
-
#addresses ⇒ Array(Integer)
The addresses in memory occupied by this variable.
-
#memory_value ⇒ Object
Reads the value directly from the memory object backing the register.
-
#memory_value=(val) ⇒ Object
Writes the value to the variable in a lower-level way that overrides any read-only bits.
-
#name ⇒ Symbol
The name of the variable.
- #to_s ⇒ String
-
#value ⇒ Integer
Reads the value of the variable.
-
#value=(val) ⇒ Integer
Writes the value to the variable.
Instance Method Details
#address ⇒ Integer
The main (lowest) address of this variable.
54 55 56 |
# File 'lib/rpicsim/variable.rb', line 54 def address @storage.address end |
#addresses ⇒ Array(Integer)
The addresses in memory occupied by this variable.
48 49 50 |
# File 'lib/rpicsim/variable.rb', line 48 def addresses @storage.addresses end |
#memory_value ⇒ Object
Reads the value directly from the memory object backing the register. For some types of variables, this is the same as #value.
37 38 39 |
# File 'lib/rpicsim/variable.rb', line 37 def memory_value @storage.memory_value end |
#memory_value=(val) ⇒ Object
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=.
31 32 33 |
# File 'lib/rpicsim/variable.rb', line 31 def memory_value=(val) @storage.memory_value = val end |
#name ⇒ Symbol
The name of the variable.
60 61 62 |
# File 'lib/rpicsim/variable.rb', line 60 def name @storage.name end |
#to_s ⇒ String
42 43 44 |
# File 'lib/rpicsim/variable.rb', line 42 def to_s @storage.to_s end |
#value ⇒ Integer
Reads the value of the variable.
18 19 20 |
# File 'lib/rpicsim/variable.rb', line 18 def value @storage.value end |
#value=(val) ⇒ Integer
Writes the value to the variable.
24 25 26 |
# File 'lib/rpicsim/variable.rb', line 24 def value=(val) @storage.value = val end |