What is the relation between address lines and memory?

31,729

Solution 1

To express in very easy terms, without any bus-multiplexing, the number of bits required to address a memory is the number of lines (address or data) required to access that memory.

Quoting from the Wikipedia article,

a system with a 32-bit address bus can address 232 (4,294,967,296) memory locations.

for a simple example, consider this, you have 3 address lines (A, B, C), so the values which can be formed using 3 bits are

A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Total 8 values. So using ABC, you can access any of those eight values, i.e., you can reach any of those memory addresses.

So, TL;DR, the simple relationship is, with n number of lines, we can represent 2n number of addresses.

Solution 2

An address line usually refers to a physical connection between a CPU/chipset and memory. They specify which address to access in the memory. So the task is to find out how many bits are required to pass the input number as an address.

In your example, the input is 2 kilobytes = 2048 = 2^11, hence the answer 11. If your input is 64 kilobytes, the answer is 16 (65536 = 2^16).

Share:
31,729
Admin
Author by

Admin

Updated on July 07, 2020

Comments

  • Admin
    Admin almost 4 years

    These are my assignments:

    Write a program to find the number of address lines in an n Kbytes of memory. Assume that n is always to the power of 2.

    Sample input: 2

    Sample output: 11

    I don't need specific coding help, but I don't know the relation between address lines and memory.