How to Translate Machine Code Instructions to MIPS Assembly?

  • Thread starter Thread starter basketball853
  • Start date Start date
  • Tags Tags
    Binary Mips
Click For Summary

Discussion Overview

The discussion revolves around translating specific machine code instructions into MIPS assembly language. Participants are attempting to identify the correct MIPS assembly format for the given machine code and clarify the roles of various bits in the instructions.

Discussion Character

  • Homework-related
  • Technical explanation
  • Exploratory

Main Points Raised

  • One participant presents two machine code instructions and seeks assistance in translating them to MIPS assembly, expressing uncertainty about the instruction formats.
  • Another participant suggests looking through a list of instructions that start with the same binary prefix to find a match.
  • A participant questions whether the last bits of the instruction correspond to a shift operation and discusses the significance of the shift amount.
  • Another participant identifies the first instruction as a shift left logical (SLL) operation and provides a breakdown of the instruction format.
  • A subsequent participant proposes a specific assembly instruction based on their interpretation of the bits.
  • For the second instruction, a participant suggests it could be an OR operation involving specific registers.

Areas of Agreement / Disagreement

Participants express differing interpretations of the machine code instructions, with some proposing different assembly instructions for the same binary sequences. The discussion remains unresolved as there is no consensus on the correct translations.

Contextual Notes

There are uncertainties regarding the interpretation of the opcode and function bits, as well as the specific roles of the registers involved in the proposed instructions. Participants rely on external resources for clarification, indicating potential limitations in their current understanding.

Who May Find This Useful

Students studying computer architecture or assembly language programming, particularly those working on homework related to MIPS assembly language translation.

basketball853
Messages
18
Reaction score
0

Homework Statement


Hey everybody! here is my question: Translate the following machine code instructions to MIPS assembly. What is the format of each instruction?
1. 0000 0000 0000 1010 0100 1010 1000 0000
2. 0000 0000 0010 0010 0010 0000 0010 0101

Homework Equations





The Attempt at a Solution


Now when trying to figure out the solution of the first, i looked into my book and found an opcode which was the same as the first 6. Which was add... now i figured out the format:
and got this as a result add $t1, $zero, $t2 is that right? i was unsure because i kinda felt like i left the last part out... i figured out 0000 00 | 00000| 0 1010| 01001|
but i didn't know if i had to do anything with the ending function --- 101 1000 0000 ?

also the second question i am having trouble figuring it out... i know that the opcode and the function match up to encode a certain type but when I am looking for both the opcode and function together in my book/online they only have the opcode? if this is the case then it is another add right?

Your help is appreciated!
 
Physics news on Phys.org
I found 22 separate instructions that start with 000000. Go through those and find the one that matches the bits at the end.
 
Looks like it to me - SLL (shift left logical) for the first one.
0000 00ss ssst tttt dddd dhhh hh00 0000

hhhhh is the shift amount
ttttt is the register whose value is shifted left
sssss is the register where the shifted result is stored
 
okay cool, so i have:
OP = sll
$t2 = ttttt
$t1 = dddd
$t2 = h

sll $t1, $zero, $t2

would that be correct?
 
Last edited:
Also along with the second one,
i figured it would be: or $a0, $at, $v0

Thank you for everything so far!
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
Replies
3
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
13
Views
39K
  • · Replies 2 ·
Replies
2
Views
15K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 4 ·
Replies
4
Views
9K