0
\$\begingroup\$

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

this table:

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.

\$\endgroup\$
2
  • \$\begingroup\$ Is this a 16 bit controller or is it bigger? I don't understand what you mean by "don't cares" from the information you gave us all the bits matter. \$\endgroup\$ Oct 26, 2013 at 5:01
  • \$\begingroup\$ @ScottChamberlain It is a 16 bit controller. I think I am phrasing this incorrectly, how would I be able to "address"(cant think of a better word) all those devices with the minimum number of bits? \$\endgroup\$
    – stackErr
    Oct 26, 2013 at 5:03

1 Answer 1

5
\$\begingroup\$

If you want to figure it out the first step I would do is lay out the ranges as bits

         1111 11
         5432 1098 7654 3210
         -------------------
0x1000 = 0001 0000 0000 0000 serial
0x100F = 0001 0000 0000 1111

0x1010 = 0001 0000 0001 0000 parallel
0x101F = 0001 0000 0001 1111

0x8000 = 1000 0000 0000 0000 memory
0xFFFF = 1111 1111 1111 1111

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

         1111 11
         5432 1098 7654 3210
         -------------------
0x1000 = 0XXX XXXX XXX0 XXXX serial
0x100F = 0XXX XXXX XXX0 XXXX

0x1010 = 0XXX XXXX XXX1 XXXX parallel
0x101F = 0XXX XXXX XXX1 XXXX

0x8000 = 1XXX XXXX XXXX XXXX memory
0xFFFF = 1XXX XXXX XXXX XXXX

So we just need 2 bits to be able to choose the device we want, your multiplexer would look like this

         MUX
      -----------
 A4 --| 0    00 |--- Serial
      |         |
      |      01 |--- Parallel
      |         |    ___
A15 --| 1    10 |---\   \
      |         |    |   >--- Memory
      |      11 |---/___/  
      -----------   (^--- That is a OR gate)

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 to 0x7FFF?

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 to A0 on the other. CS is Chip Select.

schematic

\$\endgroup\$
4
  • \$\begingroup\$ FYI, by A15 - A4 I meant, A15, A14, A13...A4 are all being used. If i understand your answer correctly, you only take into consideration A15 and A4. And yes we only need to access these three things so there will be no undefined behaviour. \$\endgroup\$
    – stackErr
    Oct 26, 2013 at 5:51
  • \$\begingroup\$ I know what you meant, and what I am saying is you wanted the minim bits, the minimum is 2. I updated the answer with a full schematic \$\endgroup\$ Oct 26, 2013 at 6:24
  • \$\begingroup\$ Can you come in chat?, I just invited you. \$\endgroup\$
    – stackErr
    Oct 26, 2013 at 6:33
  • \$\begingroup\$ I did not get it, Come to the Root Acess room, I am in there \$\endgroup\$ Oct 26, 2013 at 6:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.