I wish to know how the device knows that A0 pin is different then A14 pin. Both are not at all same value, one is worth 1, other is worth 16384.
No, not at all. The memory chip has no concept of numbers or sequence. It's just a grid of cells. The idea of '1-16383' is a completely human concept.
EDIT: I'm probably wrong, Atardov mentions pipelining. Sounds like this memory has some optimisations that get ignored/wasted if you rearrange the lines? Nonetheless what I write here holds for simpler SRAMS.
Every unique combination of inputs on the A pins points to a unique memory cell in the chip.
Here are a couple of mental exercises that might help.
Wiring all the address lines Inverted To simplify things I'm going to assume we're working with 8-bit addresses.
Let's invert every single address line before it gets to the SRAM chip.
From Inverter SRAM
circuit Chip inputs
A0 --------> NOT ------> A0
A1 --------> NOT ------> A1
A2 --------> NOT ------> A2
A3 --------> NOT ------> A3
A4 --------> NOT ------> A4
A5 --------> NOT ------> A5
A6 --------> NOT ------> A6
A7 --------> NOT ------> A7
This converts our addresses. Eg:
00000000 becomes 11111111
00000001 becomes 11111110
00000010 becomes 11111101
00000011 becomes 11111100
Effectively we're inverting the address'. new_address = totalmemsize - old_address
Let's walk through an example write and read:
(1) Our circuit tries to write to address 11100010. In actual fact our number gets written to address 00011101 (the inverse).
(2) Our circuit tries to read from address 11100010. In actual fact our number gets read from address 00011101 (the inverse).
We've written something to what we think is the correct address. We've then read it back out again. Nothing went wrong. Our circuit is completely blind to the fact the memory chip is getting the 'wrong' addresses, because as far as it's concerned the promise of "one piece of data is stored at each unique address" is true.
Another example process: let's fill the first 100 bytes of memory, in order.
(1) int i = 0;
(2) memory[ i ] = 6;
(3) if ( i >= 99 ) halt;
(4) i = i + 1;
(5) goto 1
What will actually happen is we will fill the last 100 cells of memory, in reverse order. But we don't care how it's arranged inside the chip, all we care is that we can access it using address 0, 1, 2, 3, ..., 98, 99.
Substitution cipher You may have tried one of these for fun some time in your life
A
caeser cipher is a common example of a substitution cipher. Read up on it if you're not familiar.
A proper
substitution cipher can re-arrange the letters any way it wants.
The important thing to know about these ciphers: they are symmetrical. That means if you perform operation X to convert your original message into the ciphered one, then you do the opposite of X to get it back again.
Now for some mental stretches.
Let's pretend we have a chip that re-arranges our address lines in a pre-defined fashion. Each line in is wired to a line out, and no wires are junctioned or missed:
From Re-arranger SRAM
circuit Chip inputs
A0 --------> ##### ------> A0
A1 --------> ##### ------> A1
A2 --------> ##### ------> A2
A3 --------> ##### ------> A3
A4 --------> ##### ------> A4
A5 --------> ##### ------> A5
A6 --------> ##### ------> A6
A7 --------> ##### ------> A7
Really we don't need a chip to do this. Jumper wires would be fine.
What would happen if we used this circuit? Again, everything would work fine. Our SRAM would operate. We'd be able to use all addresses of memory however we wanted and they would appear to work as normal. Our circuit would be clueless to the fact its address lines are re-arranged.
You can think of the re-arrange chip as a bit like a substitution cipher. Even though the address lines only send data left to right in my diagram, let's pretend we can stand on either the circuit side or SRAM side at 'look' at the other.
When standing on the left (circuit) side and looking toward the right: our perception of reality will get re-arranged via process X. If we draw picaso's face in the bits of the SRAM from here then our painted pixels will get re-arranged according to process X.
For us to see out painting: those pixels start on the right (SRAM) side and have to travel to the left. They go through the inverse operation of X to do this. By the time they reach our eyes they have been re-arranged into our original picture.
Have I confused everyone enough yet?
The Exception Has the memory chip been programmed by something else before we use it in our circuit? We have to use the same wire order that it was programmed with, otherwise it will appear that the contents have been re-arranged.
Being an SRAM this isn't probably an issue