Class: RPicSim::ProgramCounter

Inherits:
Object
  • Object
show all
Defined in:
lib/rpicsim/program_counter.rb

Overview

Instances of this class represent the program counter in a simulated microcontroller.

Instance Method Summary collapse

Constructor Details

#initialize(processor) ⇒ ProgramCounter

Returns a new instance of ProgramCounter

Parameters:

  • processor (Mplab::Processor)


8
9
10
# File 'lib/rpicsim/program_counter.rb', line 8

def initialize(processor)
  @processor = processor
end

Instance Method Details

#valueInteger

Returns:

  • (Integer)


13
14
15
# File 'lib/rpicsim/program_counter.rb', line 13

def value
  @processor.get_pc
end

#value=(val) ⇒ Object

Parameters:

  • val (Integer)


18
19
20
# File 'lib/rpicsim/program_counter.rb', line 18

def value=(val)
  @processor.set_pc(val)
end