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