Convert the Following Into Mips Instructions Again Use Slt to Determine

Yous are using an out of date browser. Information technology may non display this or other websites correctly.
You lot should upgrade or utilize an alternative browser.
  • Forums
  • Other Sciences
  • Programming and Computer Science

Aid with converting machine linguistic communication instruction into MIPS assembly instruction

  • Thread starter XodoX
  • Start engagement
I think it'due south piece of cake, but I don't become it.

Given the automobile language didactics 0x00221820. What MIPS assembly instruction does it represent?

I know the solution. It's add $3, $one, $2 I but don't know how to go there.

I know I have to convert the numbers into binary first. So y'all take 0000 0000 0010 0010 0001 etc..

Then you lot accept the first half-dozen 0'south, and that'southward how y'all make up one's mind what type it is ( R-type) ? How do I do this? So how practice I know information technology's add $3, $1, $2 using the numbers that are left afterwards the first 6 0's ? I know that at that place's a lsit where you lot can look it up, only you have 00221820, which is 8 segments in total. But it'south just 4 commands ( add $three, $1, $2 ).
Dosen't make any sense.:frown:

Answers and Replies

I call back it'southward easy, only I don't become it.

Given the machine linguistic communication instruction 0x00221820. What MIPS assembly teaching does information technology correspond?

I know the solution. It's add together $3, $1, $ii I just don't know how to go in that location.

I know I have to convert the numbers into binary first. And then you take 0000 0000 0010 0010 0001 etc..

If you lot have a number in hex already, converting to binary is pretty easy. Each hex digit is 4 binary $.25.
0x00221820 = 0000 0000 0010 0010 0001 1000 0010 0000 (base 2)

From a reference I plant on the MIPS teaching ready (http://www.mrc.uidaho.edu/mrc/people/jff/digital/MIPSir.html), here is the encoding for add together d$, s$, t$, which means add the values in s$ and t$ and store the upshot in d$.

0000 00|ss sss|t tttt| dddd d|000 0010 0000

0000 00|00 001|0 0010| 0001 1|000 0010 0000

Can you match things up to figure out what due south$, t$, and d$ are?

And then yous take the first 6 0's, and that'due south how you determine what type it is ( R-type) ? How exercise I do this? And and so how do I know it'south add $iii, $ane, $ii using the numbers that are left after the outset 6 0's ? I know that there's a lsit where you can expect information technology up, but you take 00221820, which is 8 segments in total.
That would be 8 bytes in total.
But it's simply four commands ( add $3, $i, $2 ).
Dosen't brand any sense.:frown:
I call up information technology's easy, but I don't go it.

Given the machine language didactics 0x00221820. What MIPS assembly instruction does it stand for?

I know the solution. It's add $3, $1, $2 I but don't know how to get there.

I know I have to convert the numbers into binary get-go. And then y'all have 0000 0000 0010 0010 0001 etc..

Then you take the first 6 0's, and that's how yous determine what type it is ( R-blazon) ? How do I do this? And then how do I know it's add $3, $i, $ii using the numbers that are left after the get-go 6 0'southward ? I know that there'south a lsit where yous can look it upward, but y'all have 00221820, which is 8 segments in total. Just it's but iv commands ( add $3, $one, $ii ).
Dosen't make any sense.:frown:


Simply a few comments.

I'll assume you lot are writing your didactics has an increasing number from right to left. In the example you are working with its probably a adept idea to write the contents of memory in byte class every bit they appear in increasing order of memory location.

The other thing is to know how data is arranged by your architecture. There are things called the "endianess" of your data. You lot can have architectures that orient your words in the normal manner (A,B,C,D) = 0xABCD or in the weird way (A,B,C,D) = 0xCDAB. Then thats the start thing y'all should check.

The adjacent is pretty easy. For a lot of architectures you usually a byte for the instruction type and then fetching the offset byte will sort out that. The rest is obviously dependent on what pedagogy it is (register,register), (annals,memory) and so on.

Over again find out how data is stored with the "endianess" of the architecture and you volition always become the correct effect.

Ah, got it now! Thanks guys! Nonetheless, I have been trying to to the reverse at present.

You have MIPS add $t0, $t0, $zero and lw $t1, iv, ($s3) and it needs to be converted to the machine lawmaking binary form and MIPS pedagogy in hex. I suppose you first catechumen it to Hex 0x00000 ( whatever number) like above and and so to the binary form. How'd I do this? I thought the hex would be on the reference sheet, but I don't run across anything. Once I have that, I just catechumen information technology to binary.

No, you have information technology backwards. Figure out what the binary code is going to be for each instruction, then convert each one to hex. Use the instruction reference whose link I gave earlier to figure out where things need to go.
No, I don't accept information technology backwards. Information technology was hex to binary to mips. I also need mips to hex/binary. I have to use the reference sheet given to me and that's non on there. This reference canvas has it already listed, it need to be converted by me.

http://world wide web.megafileupload.com/en/file/288158/RelativeResourceManager-pdf.html

Couldn't upload it hither, it was to big. I think it'due south on page 3, just it merely says if it'south add, sub etc. I suppose 1st colum "mips opcode" and second column "binary", but that dosen't include registers etc. I don't know.

Your question in post #4 was
You take MIPS add $t0, $t0, $aught and lw $t1, 4, ($s3) and information technology needs to be converted to the motorcar code binary form and MIPS educational activity in hex. I suppose yous first catechumen it to Hex 0x00000 ( whatsoever number) like in a higher place and and then to the binary course. How'd I do this? I thought the hex would be on the reference sheet, but I don't see anything. Once I have that, I merely convert information technology to binary.
For the pedagogy add $t0, $t0, $zero, look up the add instruction in the reference I gave you. This will evidence y'all the binary grade of this op code, and will evidence you where the various operands need to get. When y'all have everything in identify, it'southward an easy affair to convert to hex. Starting from the least-significant bit (LSB), divide the binary number into groups of four bits. Convert each grouping into its hex equivalent.

For example, if you had these 3 groups - 1011 0011 0100, the hex equivalent is 0xA34.

Do the same for the lw education.

When yous said "I thought the hex would be on the reference sheet" the author who wrote the documentation for the op codes assumed that anyone who wanted to know the format of the automobile code would be able to convert back and forth between binary and hex.

No, that'southward not what I meant. I idea the hex of the MIPS instruction was on the sheet. Again, I can only employ the sail I posted the link to. Yours seems a picayune bit more than clear, merely I tin't use it. I thought you'd have to get the Hex first. Ok, I guess I was wrong. It's the binary code you'll have to get then convert it.
Bottom line: I can't figure out how to become the bianry code for information technology.

And I don't know what you're looking at, simply your sheet has "0000 00ss ssst tttt dddd d000 0010 0000" for add together. Is that what you mean?

No, that's not what I meant. I thought the hex of the MIPS educational activity was on the sheet. Once more, I can only utilise the sheet I posted the link to. Yours seems a little fleck more clear, merely I tin't use information technology. I thought yous'd have to get the Hex first. Ok, I guess I was wrong. Information technology'south the binary code you'll take to get and and so catechumen it.
Lesser line: I tin can't figure out how to get the bianry code for it.

And I don't know what you lot're looking at, but your canvas has "0000 00ss ssst tttt dddd d000 0010 0000" for add. Is that what you mean?


This is the binary code. The due south, t, and d messages show which bits are used for the source, target (?), and destination operands. For example, if the educational activity were add $t1, $t2, $t3, the registers involved are $9, $10, and $11, with $t1 being the destination register and the other two the s$ and t$ registers.

I should say once again that I haven't done any MIPS programming, but this is how it seems to work.

The five $.25 for sssss would be the flake pattern for 9, which is 10001. The five bits for ttttt would be the bit pattern for 10, which is 10010. The five $.25 for ddddd would be the bit design for 11, which is 10011. I've carve up these groups up with different colors to make them easier to comprehend.
0000 0010 001 ane 0010 1001 ane000 0010 0000

0000 00ss ssst tttt dddd d000 0010 0000

Is that articulate?

Ok, got it! Thanks very much for your assist!

Related Threads on Assist with converting auto language instruction into MIPS associates didactics

  • Last Mail service
22990atinesh
  • Terminal Post
Mark44
  • Last Post
FactChecker
  • Last Post
  • Last Post
rcgldr
  • Concluding Mail
rcgldr
  • Last Post
pairofstrings
  • Last Post
FactChecker
  • Concluding Postal service
Mark44
  • Last Mail service
rcgldr
  • Forums
  • Other Sciences
  • Programming and Computer science

preslerwarte1990.blogspot.com

Source: https://www.physicsforums.com/threads/help-with-converting-machine-language-instruction-into-mips-assembly-instruction.453249/

0 Response to "Convert the Following Into Mips Instructions Again Use Slt to Determine"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel