lxXTaCoXxl 26 Posting Whiz in Training

I am trying to figure out how to convert hexadecimal values into mips instructions but I am not having any luck. From my understanding you have to first break the value down to machine level (binary) and then use that result to determine the instruction by converting each section of bits for the instruction type back to hexadecimal. For example:

AFBF0000 should break down to 10101111101111110000000000000000 in binary. Just looking at this I can tell that it is an I type instruction and the first six bits give me the opcode. So 101011 gives me 2B in hex which by my list of opcodes is sltu (this raises issue number one); according to the chart the next five bits (11101) should give me the first source register used by this instruction which turns into 1d in hex and by my chart is the stack pointer (sp). The following five bits (11111) should give me the second source register in the instruction which when converted becomes 1f which is ra. The remaining 16 bits for this I type instruction have a zero value giving us the final four zeroes in our hex value. According to my assembler this should actually be the instruction sw ra $0000(sp) but it is not in my case; I feel that either I am doing something wrong when converting my values or the opcodes in my list are either wrong or not in the correct format. All help is appreciated and thanks in advance for reading.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.