Jump to content

Calculating bits needed for Memory Address Register at specific memory sizes

RageAx

So I have an exam coming soon and I need to learn how to calculate how many bits I need for Memory Address Register at specific memory sizes.

 

For example: 
- how many bits do you need for MAR with the memory size of 1MB,10MB, 100MB and 1GB 

Link to comment
Share on other sites

Link to post
Share on other sites

1MB = 1024B

1B (byte) = 8b (bits)

So for 1MB you need 1024 * 8 = 8192 bits

For 10MB you need 10 * 1024 * 8 = 81920 bits

etc

I edit my posts a lot.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, MrDrWho13 said:

1MB = 1024B

1B (byte) = 8b (bits)

So for 1MB you need 1024 * 8 = 8192 bits

For 10MB you need 10 * 1024 * 8 = 81920 bits

etc

So for 1GB do you use 1000*1024*8 or 1024*1024*8?

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, RageAx said:

So for 1GB do you use 1000*1024*8 or 1024*1024*8?

Excellent question... uh..

 

Has your school done the talk about MegaBytes vs MebiBytes? My college did it but now I'm at uni they glossed over it.

 

If you don't know what I'm talking about then ignore that and look at this:

I would do 1024*1024*8

 

If your school is differentiating between Mega and Mebi then ignore 1024 and just use 1000 everywhere. ( 1000*1000*8 )

I edit my posts a lot.

Link to comment
Share on other sites

Link to post
Share on other sites

4 hours ago, MrDrWho13 said:

1MB = 1024B

1B (byte) = 8b (bits)

So for 1MB you need 1024 * 8 = 8192 bits

For 10MB you need 10 * 1024 * 8 = 81920 bits

etc

Oh god, no. For one computers don't address individual bits. So multiplying by 8 us never needed. Second, you are just counting how many bits of memory there are, not how many bits of address you need.

 

You need to find number of bits needed to hold the count of all the bytes you have. 

In order to address 2 bytes of memory, you need 1 address bit. Because 1 bit has 2 states, 1 and 0. 

With 2 bits you can address 4 bytes, with 3 bits you can address 8 bytes, and with n bits you can address 2^n bytes. 

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Pangea2017 said:

Memory Address Register is not the same as aviable Memory! It just stores the adress in a register. This mean it have the size of the memory address. If you want to know the minimal adress length use log base 2.

 

3 hours ago, geo3 said:

Oh god, no. For one computers don't address individual bits. So multiplying by 8 us never needed. Second, you are just counting how many bits of memory there are, not how many bits of address you need.

 

You need to find number of bits needed to hold the count of all the bytes you have. 

In order to address 2 bytes of memory, you need 1 address bit. Because 1 bit has 2 states, 1 and 0. 

With 2 bits you can address 4 bytes, with 3 bits you can address 8 bytes, and with n bits you can address 2^n bytes. 

Doh! Yes I didn't read the question correctly. These are the right answer.

I edit my posts a lot.

Link to comment
Share on other sites

Link to post
Share on other sites

log2(n) will give you the number of bits needed to address n bytes.

 

If you need to address 512 bytes then do:

log2(512) = 9

You need 9 bits to address bytes of memory.

 

Here is a simple table for some smaller values:

log2(2) = 1

log2(4) = 2

log2(8) = 3

log2(16) = 4

log2(32) = 5

log2(64) = 6

log2(128) = 7

log2(256) = 8

log2(512) = 9

log2(1024) = 10

Link to comment
Share on other sites

Link to post
Share on other sites

4 minutes ago, LAwLz said:

log2(n) will give you the number of bits needed to address n bytes.

God Damn logs Coming back to haunt people after Maths.....

Some people prefer a challenge, I just band my head against a wall until my method works...

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×