New Reply

Show the hex representation of MIPS instructions

 
Share Thread
May22-11, 06:03 PM   #1
 

Show the hex representation of MIPS instructions


Hey all
1. The problem statement, all variables and given/known data
Here i want to translate them and show the hex representation of these instructions:
1)add $t0, $t0, $zero
2)lw $t2, 16($s3)

2. Relevant equations
3. The attempt at a solution
eg. 2)
lw | $s3 | $t2 | 16
I-TYPE

then translate the assembly code:
35 | 19 | 10 | 16

The solution is 0x8E6A0010
But i 've no idea how the answer has been reached... Any help?
Thank's a lot
PhysOrg.com science news on PhysOrg.com

>> City-life changes blackbird personalities, study shows
>> Origins of 'The Hoff' crab revealed (w/ Video)
>> Older males make better fathers: Mature male beetles work harder, care less about female infidelity
May22-11, 06:27 PM   #2
 
What is the context of this question? Should you be able to answer it on a test or is it a homework problem meant to familiarize you with your assembler? I would write the code, compile it, and view the answer by stepping through the code.
May22-11, 06:46 PM   #3
 
It's an exam type question but MIPS assembly language table (http://en.wikipedia.org/wiki/MIPS_ar...embly_language) will be provided in exams
May23-11, 03:00 AM   #4
 
Recognitions:
Gold Membership Gold Member

Show the hex representation of MIPS instructions


Looks like you have decomposed the assembly instruction correctly:

3510 = instruction
1910 = s
1010 = t
1610 = C

Convert the base-10 values that you obtained into binary. Then group your binary results into the following I-type format:
[iiiiiiss] [sssttttt] [CCCCCCCC] [CCCCCCCC]

(use 6-bits of your instruction result, 5-bits of s, 5 of t, 16 bits of C, zero-padding as needed)

Then convert each 8-bit group to its hexadecimal equivalent.
May23-11, 10:10 AM   #5
 
thank you so much! cheers ;)
May23-11, 11:13 AM   #6
 
Could you please show me the way to convert hex value 0x8E6A0010 to decimal?
May23-11, 11:48 AM   #7
 
Quote by shieldcy View Post
Could you please show me the way to convert hex value 0x8E6A0010 to decimal?
The nth digit corresponds to how many b^n's there are, starting at n = 0, where b is the base (16 here).

0*16^0 + 1*16^1 + 0*16^2 + ... + 8*16^7
May23-11, 11:54 AM   #8
 
Oo yeah... thank's man ;)
May23-11, 12:24 PM   #9
 
Quote by shieldcy View Post
Oo yeah... thank's man ;)
No problem. That method works for converting any integer of any base into base 10 (you can even convert base 10 into base 10 with it).

e.g.
10110 base 2 = 0*2^0 + 1*2^1 + 1*2^2 + 0*2^3 + 1*2^4 = 2 + 4 + 16 = 22
New Reply

Similar discussions for: Show the hex representation of MIPS instructions
Thread Forum Replies
Anyone familiar with MIPS floating point instructions? Programming & Comp Sci 2
Executing instructions in the LC-3 Engineering, Comp Sci, & Technology Homework 0
How many instructions are there ? Computing & Technology 83
Latex instructions Forum Feedback & Announcements 4
Instructions for TI-83 for probabilities Set Theory, Logic, Probability, Statistics 2