Kodewerxhttp://www.kodewerx.org/forum/ [solved]http://www.kodewerx.org/forum/viewtopic.php?f=24&t=11447 Page 1 of 1

 Author: ChickenzRage0 [ Wed Oct 08, 2014 2:21 pm ] Post subject: [solved] Hey, long time lurker here, couldn't use my other account for some reason so I just made this for now. I'm finally studying computer science and just started. I got this question however at one of my lectures and since my lecturer doesn't have the best English its a bit confusing to understand. Code:6. How many bits are required to address a 4M x 32-bit main memory if a. main memory is word-addressable? b. main memory is byte-addressable?Many thanks if you provide any help

 Author: James0x57 [ Wed Oct 08, 2014 6:29 pm ] Post subject: Re: 4Mx32bit main memory? Google?http://electronics.stackexchange.com/qu ... addressingI don't have a best guess at what 4M means.

 Author: ChickenzRage0 [ Thu Oct 09, 2014 9:41 am ] Post subject: Re: 4Mx32bit main memory? 4M means 4 Mega which is 2^22 (2^2 * 2^20)

 Author: Parasyte [ Sun Oct 12, 2014 12:15 am ] Post subject: Re: 4Mx32bit main memory? The math is pretty simple, actually. 4Mbit = 0x400000 bits. Divide by 8 to get the total number of bytes = 0x80000. Divide again by 4 to get the total number of words = 0x20000.Now subtract 1 from each of these and count the number of set bits:0x7FFFF = 19 bits for byte-addressable.0x1FFFF = 17 bits for word-addressable.In other words, the chip requires 19 address lines and 8 data lines (4M x 8) or 17 address lines and 32 data lines (4M x 32)

Author:  ChickenzRage0 [ Sun Oct 12, 2014 6:14 am ]
Post subject:  Re: 4Mx32bit main memory?

Right, he posted the answers and they were different. Copy pasta doesn't really work so I'll just upload a pic.
Also apparently
Quote:
In a word-addressable system, a word is the smallest
 Attachments: Untitled.png [ 13.52 KiB | Viewed 3497 times ]
 Author: Parasyte [ Sun Oct 12, 2014 12:26 pm ] Post subject: Re: 4Mx32bit main memory? Nice! What I screwed up was dividing a pre-divided number. The full memory size for 4M x 32 is 128M (multiply: 4*32)It's already word-addressable, so it has 0x3FFFFF = 22 address lines.To make it byte-addressable, you have to multiply by 4: 0xFFFFFF = 24 address lines.It makes perfect sense.
 Author: Parasyte [ Sun Oct 12, 2014 3:06 pm ] Post subject: Re: 4Mx32bit main memory? It is hexadecimal notation, yes. The 0x prefix is the common hex notation prefix. Though \$ has also been used, primarily in old (DOS era) applications which had very little screen space.Prepare yourself for ...Parasyte's Number Representation TutorialHex is just another number representation. Whereas decimal is base-10, and binary is base-2; hexadecimal is base-16. Converting between different number bases is just a matter of expressing each number as a polynomial equation, and working out the exponents. Here's an example using 222:1. Polynomial expansion of a base-2 number222 = 1*222 + 0*221 + 0*220 + 0*219 ... + 0*22 + 0*21 + 0*20The final 20 can usually be discarded, since any positive number raised to an exponent of 0 is always equal to 1. And the penultimate exponent can also be discarded, because raising any positive number to an exponent of 1 is always equal to the original base. Simplify:222 = 1*222 + 0*221 + 0*220 + 0*219 ... + 0*22 + 0*2 + 0Of course, we can also simplify further by removing all the polynomial segments that are 0:222 = 1*222And multiplying by 1 is redundant, so we come full circle:222 = 222This example is rather boring, because only one digit is set. Things get a little more crazy when converting to base-10 and base-16. So here we go!2. Polynomial expansion of a base-10 numberIn base-2, each digit may have 2 possible values: 0 or 1. In base-10, each digit may have 10 possible values: 0 through 9. This property alone explains the number in the "base".Let's take a base-10 number: 4194304 and expand this number as a polynomial expression:4194304 = 4*106 + 1*105 + 9*104 + 4*103 + 3*102 + 0*101 + 4*100Super easy; each digit in the base-10 number is simply multiplied by the polynomial. Simplify if you like:4194304 = 4*106 + 1*105 + 9*104 + 4*103 + 3*102 + 43. Convert each sub-expression to base-24 = 223*102 = 300 = 256+32+8+4 = 28 + 25 + 23 + 224*103 = 4000 = 2048+1024+512+256+128+32 = 211 + 210 + 29 + 28 + 27 + 259*104 = 90000 = 65536+16384+4096+2048+1024+512+256+128+16 = 216 + 214 + 212 + 211 + 210 + 29 + 28 + 27 + 241*105 = 100000 = 65536+32768+1024+512+128+32 = 216 + 215 + 210 + 29 + 27 + 254*106 = 4000000 = 2097152+1048576+524288+262144+65536+2048+256 = 221 + 220 + 219 + 218 + 216 + 211 + 28And add all of the expanded expressions together. This is made easier by grouping common exponents, and recursively solving for those. To add exponents, take each group of two common exponents and reduce by removing one expression, and increasing the exponent by 1. For example, there are two 22:(22 + 22) = 23So here's the full series, grouped, and followed by the solution for the first iteration:221 + 220 + 219 + 218 + (216 + 216) + 216 + 215 + 214 + 212 + (211 + 211) + 211 + (210 + 210) + 210 + (29 + 29) + 29 + (28 + 28) + (28 + 28) + (27 + 27) + 27 + (25 + 25) + 25 + 24 + 23 + (22 + 22) =221 + 220 + 219 + 218 + (217) + 216 + 215 + 214 + 212 + (212) + 211 + (211) + 210 + (210) + 29 + (29) + (29) + (28) + 27 + (26) + 25 + 24 + 23 + (23)You'll notice the way I grouped these exponents is in groups of two. That's very important. Regroup, and solve again:221 + 220 + 219 + 218 + 217 + 216 + 215 + 214 + (212 + 212) + (211 + 211) + (210 + 210) + (29 + 29) + 29 + 28 + 27 + 26 + 25 + 24 + (23 + 23) =221 + 220 + 219 + 218 + 217 + 216 + 215 + 214 + (213) + (212) + (211) + (210) + 29 + 28 + 27 + 26 + 25 + 24 + (24)And again: (Yay! Recursion!)221 + 220 + 219 + 218 + 217 + 216 + 215 + 214 + 213 + 212 + 211 + 210 + 29 + 28 + 27 + 26 + 25 + (24 + 24) =221 + 220 + 219 + 218 + 217 + 216 + 215 + 214 + 213 + 212 + 211 + 210 + 29 + 28 + 27 + 26 + 25 + (25)... until there are no more common exponents ...221 + 220 + 219 + 218 + 217 + 216 + 215 + 214 + 213 + 212 + 211 + 210 + 29 + 28 + 27 + 26 + (25 + 25) =221 + 220 + 219 + 218 + 217 + 216 + 215 + 214 + 213 + 212 + 211 + 210 + 29 + 28 + 27 + 26 + (26)The pattern at this point is pretty obvious. If we continue this iteration, we will eventually simplify to 222. This is just a long-hand explanation for how addition with carry works in binary.4. What are those magic numbers?There are some magic numbers in the equations above. Take for instance this line:Quote:3*102 = 300 = 256+32+8+4 = 28 + 25 + 23 + 22The numbers 256, 32, 8, and 4 are "magic" numbers, because I didn't really explain how I got them. Obviously, they are the result of solving the exponents on the right side, but there's also no explanation for how I came up with these numbers, either. The answer is kind of depressing; it's just a matter of estimation. You need to answer the question, "what's the biggest power-of-two that fits into 300?" It turns out to be 256, because the next power-of-two is 512, which is greater than 300. Thus, 28 fits into 300, but 29 does not. Subtract the 256 from 300, and find the biggest power-of-two that fits into that result:300 - 256 = 4422 = 423 = 824 = 1625 = 3226 = 64Therefore 32 fits into 44, and 25 is the next polynomial segment. Repeat until the number is solved. The same estimation steps can be used to convert the other way, as well. Which is what we'll see in the following section.5. TL;DR: Onward to base-16The biggest power-of-sixteen that fits into 222 is 165 = 220, because 20 is evenly divisible by 4. Why 4? It takes 4 bits to represent one hex digit. This is defined by 16 = 24In fact, 165 fits into 222 exactly 4 times. So:222 = 4*165Which can also be written in hex notation as a 4 followed by 5 zeros: 0x400000.Fin.