d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Can Anyone Explain Why?
12Next
Add Reply New Topic New Poll
Member
Posts: 2,769
Joined: Dec 24 2009
Gold: 14.00
Oct 22 2012 04:54pm
Q: If the Simple Machine Language had 32 registers instead of 16, what is the minimum number of bits which would be required for an "ADD" operation?

A: 19, since each register (of which there are 3 in an ADD instruction) would require at minimum 5 bits to address, and 4 for the opcode.

I don't get it..
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Oct 22 2012 05:16pm
what don't you get, exactly?

OPCODE + REG 1 + REG 2 + REG 3 ---> 4 + 5 + 5 + 5 = 19

This post was edited by irimi on Oct 22 2012 05:17pm
Member
Posts: 2,769
Joined: Dec 24 2009
Gold: 14.00
Oct 22 2012 05:21pm
Why is it 5 minimum per register though? What's wrong with it being 4? Redundancy?

This post was edited by Foxic on Oct 22 2012 05:22pm
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Oct 22 2012 05:22pm
How many bits do you need to represent the number 32?
Member
Posts: 2,769
Joined: Dec 24 2009
Gold: 14.00
Oct 22 2012 05:23pm
5, but why is that relevant to the total amount a single register can hold?
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Oct 22 2012 05:24pm
Quote (Foxic @ Oct 22 2012 04:23pm)
5, but why is that relevant to the total amount a single register can hold?


why are you asking about the amount a single register can hold?
Member
Posts: 2,769
Joined: Dec 24 2009
Gold: 14.00
Oct 22 2012 05:25pm
32 is the amount of registers, why is that relevant to how many bits a register should hold? I'm probably not getting something here..

This post was edited by Foxic on Oct 22 2012 05:25pm
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Oct 22 2012 05:26pm
Quote (Foxic @ Oct 22 2012 04:25pm)
32 is the amount of registers, why is that relevant to how many bits a register should hold?


And my question is, why are you asking this question? How is your question relevant?
Member
Posts: 2,769
Joined: Dec 24 2009
Gold: 14.00
Oct 22 2012 05:28pm
Quote (irimi @ Oct 22 2012 06:26pm)
And my question is, why are you asking this question?  How is your question relevant?


Maybe I'm not wording it properly. Each register has to address at least 5 bits (as the answer states).. but why? Why would the register total (32) have anything to do with this?
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Oct 22 2012 05:29pm
Quote (Foxic @ Oct 22 2012 04:28pm)
Maybe I'm not wording it properly. Each register has to address at least 5 bits (as the answer states).. but why? Why would the register total (32) have anything to do with this?


You aren't reading the question or the answer correctly. Reread what you wrote in your very first post. Then reread it again.

Hint: "each register requires 5 bits to address" can be rewritten as "it takes 5 bits to address each register"

This post was edited by irimi on Oct 22 2012 05:29pm
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll