Hey guys, for anyone that's read my last post, please know I'm not trying to milk anyone for homework answers, but so far into my CS curriculum, ASM catches my interest the most. So if I post HW questions, I post the answers to, at least it shows I've attempted to speak with my professor (she doesn't speak English very well and the TA's are useless). Memory is a fairly important concept I want to master, even though it's a very small part of the course.

Questions
1.  (6 points)
How many bits would you need to address a memory with 2M 4-byte words if

2.  (3 points)
Assume a computer can use at most 18-bits to store a main memory address. Determine the
maximum size of the main memory if it is byte-addressable.
Maximum size in bytes:

3.  (4 points)
Assume a 16K-byte memory. What are the lowest and highest address if the memory is

I'm thinking there was something left out of the lecture or the notes, because I don't have any kind of conversion formula, assuming there is one. Sorry to bother you all with HW problems, but it'd help a lot to get these basics down first (I really, really want to work with cell phones and gadgets after this semester).
Posted on 2008-10-08 02:51:19 by angrynapkin
The last answer is clearly wrong.

Off the top of my head, 16k is 16384 bytes.
2^12 would be what, 4096 bytes (4k), and minus one would imply we are addressing BYTES.
Since the word size is 32 bits, the last address would be 16380 (a 32 bit value = 4 bytes).

Yeah, I studied digital electronic engineering.
Posted on 2008-10-08 04:52:57 by Homer
The last answer CAN be correct. If address 0 = first dword, address 1 = second dword.
It's a tricky question, as in practice absolutely everywhere (in every public cpu ever created) address 0 = first dword, address 4= second dword  :)
Posted on 2008-10-08 05:05:12 by Ultrano
But the "word-addressable" means that 0=first word, 1=second word, so the 2^12-1 answer is correct without doubt.
Posted on 2008-10-08 05:09:21 by Ultrano
Ah I see - in this case, the reference to the word size being 32 bits is absolutely irrelevant, I wouldn't say it's a tricky question, I'd say it is a TRICK question :P

In regards to formulae for converting between various number systems - yes, these do exist, however they're not always intuitive, or even helpful - and there will be very few real-world situations where you will be required to know how to do this by hand... as already pointed out in another thread, almost every calculator on the planet can make these conversions for you (a notable exception being the ultra cool and durable casio wristwatch calculator).
Posted on 2008-10-08 05:46:06 by Homer
Oh, okay. Thanks for the replies, but I was wondering how to work out the answers listed, like, why are those the right answers?
Posted on 2008-10-08 07:14:35 by angrynapkin
Figured it out guys, with some nifty Log base 2 work. Thanks for explaining that last question though, I hate the trick ones.
Posted on 2008-10-08 07:53:33 by angrynapkin
Assuming that the word size for any system is the smallest addressable unit:

Lowest: 0
Highest: memory size / word size - 1

However, I can see where Homer is coming from. In practice, we are used to working with absolute memory addresses and accounting for real data sizes by the operations involved. That last question makes you think in terms of calculated offsets, not actual memory addresses. In short, you are thinking in "arrays" instead of "bytes".

That last question could most definitely be worded more appropriately by the instructor, pertaining to practical application instead of loose theory.
Posted on 2008-10-08 20:56:39 by SpooK