def test_execute_idle16():
    state = new_state(ACTIVE=True)
    instr = opcode_factory.idle16()
    name, executefn = decode(instr)
    executefn(state, Instruction(instr, None))
    expected_state = StateChecker(pc=RESET_ADDR, ACTIVE=False)
    expected_state.check(state)
Beispiel #2
0
def test_sim_idle16():
    instructions = [ (opcode_factory.idle16(), 16),
                     (opcode_factory.bkpt16(), 16),
                   ]
    epiphany = MockEpiphany()
    epiphany.init_state(instructions)
    assert epiphany.state.running
    epiphany.run()
    expected_state = StateChecker(pc=(4 + RESET_ADDR))
    expected_state.check(epiphany.state)
    assert not epiphany.state.running
def test_execute_idle16(capsys):
    state = new_state(rfSTATUS=1)
    instr = opcode_factory.idle16()
    name, executefn = decode(instr)
    executefn(state, Instruction(instr, None))
    out, err = capsys.readouterr()
    expected_state = StateChecker(pc=(2 + RESET_ADDR), rfSTATUS=0)
    expected_text = ('IDLE16 does not wait in this simulator. ' +
                     'Moving to next instruction.')
    expected_state.check(state)
    assert expected_text in out
    assert err == ''
    assert state.running
Beispiel #4
0
                          ('float32',     opcode_factory.float32(rd=1, rn=0, rm=0)),
                          ('fix32',       opcode_factory.fix32(rd=1, rn=0, rm=0)),
                          ('fabs32',      opcode_factory.fabs32(rd=1, rn=0, rm=0)),
                          ('movcond32',   opcode_factory.movcond32(condition=0b0000, rd=0, rn=0)),
                          ('movcond16',   opcode_factory.movcond16(condition=0b0000, rd=0, rn=0)),
                          ('movtimm32',   opcode_factory.movtimm32(rd=0b1111, imm=0)),
                          ('movimm32',    opcode_factory.movimm32(rd=0b1111, imm=0)),
                          ('movimm16',    opcode_factory.movimm16(rd=0b1111, imm=0)),
                          ('movfs32',     opcode_factory.movfs32(rn=0b110, rd='IRET')),
                          ('movfs16',     opcode_factory.movfs16(rn=0b110, rd='IRET')),
                          ('movts32',     opcode_factory.movts32(rn='IRET', rd=0b011)),
                          ('movts16',     opcode_factory.movts16(rn='IRET', rd=0)),
                          ('gie16',       opcode_factory.gie16()),
                          ('gid16',       opcode_factory.gid16()),
                          ('nop16',       opcode_factory.nop16()),
                          ('idle16',      opcode_factory.idle16()),
                          ('bkpt16',      opcode_factory.bkpt16()),
                          ('mbkpt16',     opcode_factory.mbkpt16()),
                          ('sync16',      opcode_factory.sync16()),
                          ('rti16',       opcode_factory.rti16()),
                          ('wand16',      opcode_factory.wand16()),
                          ('trap16',      opcode_factory.trap16(trap=0b111111)),
                          ('unimpl',      opcode_factory.unimpl()),
                         ])
def test_decode(name, instr):
    decoded_name, _ = decode(instr)
    assert decoded_name == name


def test_bit32_imm():
    instr = Instruction(opcode_factory.bitr32_immediate(rd=0b110110, rn=0b101101, imm=0b11111),