import pytest


@pytest.mark.parametrize('rs, rt, rd, sat', [
    (4, 0x80000000, 0x80000000, 1),
    (4, 0x80000004, 0x80000000, 0),
])
def test_q6_r_sub_rr_sat(hexagon, rs, rt, rd, sat):
    hexagon.memory.controllers[0].mem.write(0, 4, b'\x02\xc1\xc0\xf6')
    hexagon.registers.general[0] = rs
    hexagon.registers.general[1] = rt
    hexagon.cycle()
    assert hexagon.registers.general[2] == rd
    assert hexagon.registers.usr.ovf == sat
