Homework: Machine Instructions

 

Show the machine instruction (in binary and hex) for each instruction below which is marked with a number. Use the Machine Instruction Opcodes and Formats handout to get all opcodes and formats you need. Use the MIPS Registers handout to translate the register mneumonics to register numbers.

read:
        move    $t1,$v0
        la      $v1, num
        sll     $t6, $s6, 21      # 1
        add     $t4, $t1, $v0     # 2
        li      $v0, 99
        addi    $s0, $v0, 45      # 3
        sub     $t4, $t1, $t4     # 4
        lw      $t2, num2
        bgez    $t1, one          # 5
        bltz    $t1, $0, two      # 6
        sra     $t5, $t5, 31      # 7
        xor     $t6, $t2, $t1     # 8
        addi    $t2, $t2, -39     # 9
        ori     $t5, $t3, 0xa4    # 10
        beq     $s1, $s2, read    # 11
one:    addi    $t2, $t2, -1
        li      $t3, 12
two:    addi    $t2, $t2, 1
        li      $t3, -12

Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2021