![]() |
Mips/spim
Address Content
------------------------ [0x00400000] 0x123e0203 ^^If you're familiar with spim, or even mips ... you will know what i'm talkin about ... I have a couple of questions: what does that x in there mean? and if I want to print out the content, then how do I do that? like i could do sw 0(address) ... but it will give me value in decimal .. not in hex ... so will i have to convert decimal into hex just to print out the content? thanks! |
Quote:
As for printing I have no idea. -MBirchmeier |
Quote:
|
Quote:
|
help?? please!!!!!
|
[0x00400000] 0x123e0203
To start off, [0x00400000] is an adress value in memory of the instruction 0x123e0203(instruction you need to decode). 0x is the prefix for hexa presentation now lets decode 0x123e0203 0001 0010 0011 1110 0000 0010 0000 0011 000100 10001 11110 0000001000000011 first 6 bits are the opcode giving->beq (branch if equal) which is an I format instruction. we have two registers to compare 10001 -> $17 = $s1 11110 -> $30 = $fp and 0000001000000011 is the immediate field corresponding to a label you need to branch to if $s1 == $fp. this binary number is an offset from the current position address. meaning the label should be [0x00400000] + 0000 0010 0000 0011 ( sign extended offcource) the branch address should be [0x00400000] + 0x203 = [0x00400203] |
Quote:
i am having a hard time printing values in hex .. or yeah maybe even obtaining value of a register in hex fomat! i hope i made myself clear this time sorry about the confusion |
sorry dude.. cant help you on this one. i havent really learnt how to use PCspim yet. but should be able to answer your question next week...
if you dont get your question answered by then ill post a new reply.. |
was going through some mips code, just wanted to correct what i said earlier about branching. you take the immediate field and the new Program counter or address to branch to would be PC = (PC + 4) + (immediate* 4)
PC +4 because well this is how mips works.... immediate *4 because mips is byte adressable this way in branching we can cover all 32-bits of the memory only by a 16 bit immediate field.. (PC+4) +/- 2^15 |
| All times are GMT -5. The time now is 1:17 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC