I am struggling to find the bits which dont matter when I have a memory mapped system with several devices connected.
The memory map is given by
I need to figure out which bits I should pass to the address decoder and which bits are "Dont Cares".
I know the answer to this question is : A15 – A4 are the bits that matter and A3-A0 are dont cares.
Can someone post a step by step method on how to find these?
Thank you!
P.S. I wasnt sure where I should post this question, Feel free to move it to another stack site as you see fit.
Best Answer
If you want to figure it out the first step I would do is lay out the ranges as bits
Now based on the comment you made "A15 - A4 are the bits that matter and A3-A0 are dont cares." It makes me think that you only need to select whether it goes to memory, serial or parallel. We don't care about telling the difference between the min or max of a range, only that we are inside the range. So what we need to do is detect if bits that are unique to the entire range.
If you look at the above chart, we can see we can tell the difference between a Serial and parallel by checking if bit 4 is set. Now to tell if we are using one of the IO or if we are using memory we need to see if bit 15 is set.
We can see this easier if we mask off the bits that don't effect us
So we just need 2 bits to be able to choose the device we want, your multiplexer would look like this
Accessing something not in one of the 3 defined ranges will give "undefined behavior". If you don't want undefined behavior, then you need to define it! What will happen when I attempt to access a address in the range of
0x0020
to0x7FFF
?Here is a full schematic of the original setup, I could not make thicker lines for the buses, Just assume the
A0
on one side matches toA0
on the other.CS
is Chip Select.