#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Manila, Philippines
    Posts
    32
    Rep Power
    2

    Memory Addressing


    How many bits would you need to address a 2M X 32 memory if
    1) the memory is byte-addressable?
    2) the memory is word-addressable with a word size of 32 bits?

    Solutions:
    1) 2M = 2 x 2^20 = 2^1 x 2^20 = 2^21 = 21 bits
    2) 21 - [log 2 (32/32)] = 21 - [log 2 (1)] = 21 - 0 = 21 bits

    I am feeling a bit iffy for #2. Can someone help?
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    240
    Rep Power
    29
    Obviously for byte-addressed memory result should be 2 bits larger than for word-addressed memory.

    Number of bits is log2 of the number of choices. In the first case you have 2M choices for 32-bit words and 4 choices inside each word (since 32-bit word contains 4 bytes of 8 bit each).

    In the second case you have only 2M choices. Each choice uniquely identifies the word.

    I'm sorry, but your formula for #1 is a kind of mess - perhaps some of these equals signs do not mean equality?
    CodeAbbey - programming problems for novice coders
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Manila, Philippines
    Posts
    32
    Rep Power
    2
    Originally Posted by rodiongork
    #1 is a kind of mess - perhaps some of these equals signs do not mean equality?
    They do mean equality.

    mega (M) = 2^20

    Therefore:
    2M
    = (2) x (2^20)
    = (2^1) x (2^20)
    = 2^21

    I arrived to 21 bits by taking the exponent.

    Originally Posted by rodiongork
    Obviously for byte-addressed memory result should be 2 bits larger than for word-addressed memory.
    Does this mean #2 should be 19 bits?
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Location
    Saint-Petersburg, Russia
    Posts
    240
    Rep Power
    29
    I meant the last equality:
    2^21 = 21 bits
    Does this mean #2 should be 19 bits?
    I think it is bad idea to try guessing.

    What do you mean by "2M x 32" - perhaps we are speaking of different things?

    For example, try to solve the same task for "2 x 32" - i.e. for only 2 words of 32 bit.
    CodeAbbey - programming problems for novice coders
  8. #5
  9. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Location
    Manila, Philippines
    Posts
    32
    Rep Power
    2
    Ah yes, the last "equality" just means "therefore" it is 21 bits for byte-addressable memory.

    2M x 32 = L x W (from our lecture)

    I did ask the question at Electrical Engineering Stack Exchange and I got the following formula for word-addressable memory:
    Byte-addressable bits - log 2 (word size / Width)

    Our lecture example was 4M x 8, where 22 bits (4M = 2^22) are needed for byte-addressable memory.

    However, no solution was given for word-addressable memory:
    • 4M x 8 bit memory requires 21 bit addresses if it is word-addressable and word size is 16 bits
    • 4M x 8 bit memory requires 20 bit addresses if it is word-addressable and word size is 32 bits


    Applying the formula did yield the answers provided in our lecture example.

    I am wondering if it is possible to have the same number of bits for byte-addressable and word-addressable as can be seen in the homework problem 2M x 32?

IMN logo majestic logo threadwatch logo seochat tools logo