Exemplo n.º 1
0
def test_sub():
    assert (assemble_instruction("sub $r1 $r2 $r3") ==
            0b00000000010000110000100000100010)
Exemplo n.º 2
0
def test_nor():
    assert (assemble_instruction("nor $r1 $r2 $r4") ==
            0b00000000010001000000100000100111)
Exemplo n.º 3
0
def test_bne_neg():
    assert (assemble_instruction("bne $r2 $r9 -1") ==
            0b00010100010010011111111111111111)
Exemplo n.º 4
0
def test_andi():
    assert (assemble_instruction("andi $r1 $r2 0x01") ==
            0b00110000010000010000000000000001)
Exemplo n.º 5
0
def test_add():
    assert (assemble_instruction("add $r1 $r2 $r3") ==
            0b00000000010000110000100000100000)
Exemplo n.º 6
0
def test_srl():
    assert (assemble_instruction("srl $r5 $r6 0x12") ==
            0b00000000000001100010110010000010)
Exemplo n.º 7
0
def test_mult():
    assert (assemble_instruction("mult $r3 $r4") ==
            0b00000000011001000000000000011000)
Exemplo n.º 8
0
def test_div_fp():
    assert (assemble_instruction("div.s $f1, $f2, $f3") == 0x46031043)
Exemplo n.º 9
0
def test_cvt_sw():
    assert (assemble_instruction("cvt.s.w $f0, $f1") == 0x46800820)
Exemplo n.º 10
0
def test_sub_fp():
    assert (assemble_instruction("sub.s $f1, $f2, $f3") == 0x46031041)
Exemplo n.º 11
0
def test_mul_fp():
    assert (assemble_instruction("mul.s $f1, $f2, $f3") == 0x46031042)
Exemplo n.º 12
0
def test_add_fp():
    assert (assemble_instruction("add.s $f1, $f2, $f3") == 0x46031040)
Exemplo n.º 13
0
def test_ss():
    assert (assemble_instruction("s.s $f1, 0($r10)") == 0xe5410000)
Exemplo n.º 14
0
def test_ls():
    assert (assemble_instruction("l.s $f1, 0($r10)") == 0xc5410000)
Exemplo n.º 15
0
def test_mfhi():
    assert (
        assemble_instruction("mfhi $r1") == 0b00000000000000000000100000010000)
Exemplo n.º 16
0
def test_cvt_ws():
    assert (assemble_instruction("cvt.w.s $f0, $f1") == 0x46000824)
Exemplo n.º 17
0
def test_mflo():
    assert (
        assemble_instruction("mflo $r1") == 0b00000000000000000000100000010010)
Exemplo n.º 18
0
def test_ceq():
    assert (assemble_instruction("c.eq.s $f0, $f1") == 0x46010032)
Exemplo n.º 19
0
def test_sra():
    assert (assemble_instruction("sra $r1 $r2 0x2") ==
            0b00000000000000100000100010000011)
Exemplo n.º 20
0
def test_cle():
    assert (assemble_instruction("c.le.s $f0, $f1") == 0x4601003e)
Exemplo n.º 21
0
def test_div():
    assert (assemble_instruction("div $r3 $r4") ==
            0b00000000011001000000000000011010)
Exemplo n.º 22
0
def test_clt():
    assert (assemble_instruction("c.lt.s $f0, $f1") == 0x4601003c)
Exemplo n.º 23
0
def test_or():
    assert (assemble_instruction("or $r1 $r2 $r3") ==
            0b00000000010000110000100000100101)
Exemplo n.º 24
0
def test_bc1f():
    assert (assemble_instruction("bc1f 0x2") == 0x45000002)
Exemplo n.º 25
0
def test_xori():
    assert (assemble_instruction("xori $r1 $r2 0x04") ==
            0b00111000010000010000000000000100)
Exemplo n.º 26
0
def test_bc1t():
    assert (assemble_instruction("bc1t 0x1") == 0x45010001)
Exemplo n.º 27
0
def test_bne():
    assert (assemble_instruction("bne $r1 $r2 0x1234") ==
            0b00010100001000100001001000110100)
Exemplo n.º 28
0
def test_syscall():
    assert (assemble_instruction("syscall") == 0b001100)
Exemplo n.º 29
0
def test_bgez():
    assert (assemble_instruction("bgez $r1 0x1234") ==
            0b00000100001000010001001000110100)
Exemplo n.º 30
0
def test_sb():
    assert (assemble_instruction("sb $r1 13($r2)") ==
            0b10100000010000010000000000001101)