2018-06-01 18:13:53 +02:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module Risc
|
2018-06-02 20:59:41 +02:00
|
|
|
class Dummy
|
|
|
|
def padded_length
|
|
|
|
4
|
2018-06-01 18:13:53 +02:00
|
|
|
end
|
2018-06-05 17:11:25 +02:00
|
|
|
def byte_length
|
|
|
|
4
|
|
|
|
end
|
2018-06-01 18:13:53 +02:00
|
|
|
end
|
2018-06-08 19:43:36 +02:00
|
|
|
class Machine
|
|
|
|
def set_platform(plat)
|
|
|
|
@platform = plat
|
|
|
|
end
|
|
|
|
def set_translated
|
|
|
|
@translated = true
|
|
|
|
translate_methods( @platform.translator )
|
|
|
|
@cpu_init = risc_init.to_cpu(@platform.translator)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class DummyPlatform
|
|
|
|
def self.boot
|
|
|
|
machine = Risc.machine.boot
|
|
|
|
machine.set_platform( self.new )
|
|
|
|
machine
|
|
|
|
end
|
|
|
|
def translator
|
|
|
|
DummyTranslator.new
|
|
|
|
end
|
|
|
|
def padding
|
|
|
|
0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class DummyTranslator
|
|
|
|
def translate(arg)
|
|
|
|
DummyInstruction.new
|
|
|
|
end
|
|
|
|
end
|
2018-06-02 22:48:12 +02:00
|
|
|
class DummyInstruction < Dummy
|
|
|
|
include Util::List
|
2018-06-05 17:11:25 +02:00
|
|
|
def initialize(nekst = nil)
|
|
|
|
@next = nekst
|
|
|
|
end
|
2018-06-06 09:00:07 +02:00
|
|
|
def insert(instruction)
|
|
|
|
ret = super
|
|
|
|
Position.get(self).trigger_inserted if Position.set?(self)
|
|
|
|
ret
|
|
|
|
end
|
2018-06-08 19:43:36 +02:00
|
|
|
def assemble(io)
|
|
|
|
io.write_unsigned_int_32(0)
|
|
|
|
end
|
|
|
|
def total_byte_length
|
|
|
|
4
|
|
|
|
end
|
2018-06-02 22:48:12 +02:00
|
|
|
end
|
2018-06-01 18:13:53 +02:00
|
|
|
end
|