Decode binary string

Alright, I am fetching a 32-bit binary string from the Instruction Memory class. How do I go about "parsing" the string for each binary address. This way I can store each of the memory addresses in a temporary variable before passing the instruction onto the ALU?

Also some of the strings will have leading zeros to account for the entire 32-bits. How can you determine between the actual addresses and the "extended" zeros?

1
2
3
4
ADD:

31              26  25               21 20               16  15               11  10                6  5                  0 
       Op	               Rs	          Rt	              Rd	           Shamt	          Func


Each of these point to an address. The Op is the most important, because I want to read the Op to see what the instruction is. For instance, if ADD then send the rest of the string (with extending zeros to make 32-bit string) to the ALU.
Last edited on
What is the exact specification of your problem? Decode MIPS instructions written in string that contains characters '0' and '1'. Are there any restrictions that make your problem more specific. Something about the instruction format?
(I mean the MIPS instruction format is just something I found in google that looks like your problem. But it appears complex. Unless someone have done this before, it is unlikely that they will tell you how to decode those instructions straight off the bat.)

Regards
Well really I will have a 32-bit binary string. I would like to figure out how to "decode" that string into numbers and letters.
So you have something like :

0001000100010001000100010001000100010001

And want to make it look like what?
Yes, and particularly, what is the specification of the decoder. What is supposed to be the mapping between this binary string and the instruction string? There is no default/conventional one, so this should have been explained somehow.

Also, to be certain, I ask once more. Your input and output are character strings, right? This is of secondary importance, but still.

Regards
Last edited on
Topic archived. No new replies allowed.