Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

pDATA - xDATA (can we talk?)

robert
2008-12-24
2013-03-12
  • robert
    robert
    2008-12-24

    OK - sorry, i'm still trying to wrap my head around the crazy little 8051/8052.  So I have this 4k xRAM on-chip and this 32k/64k xRAM off-chip.  The dis-jointed nature of the architecture seems to have left me no standard/generic way to access these separate regions.  Thus SDCC has no generic solution as well.  OK, there is _XPAGE to help with paging - I would so love to use both my full off-chip 64k and my on chip 4k.  I mean it would be so kool to address pDATA as the 4k in 256 byte pages and xDATA as my 64k off-chip RAM, but I don't see an easy way to do this.  Has anyone seen a technique for such things?  A nice macro or keyhole optimization?

    This SiL chip I am working with has a few modes, but none of them as kool/useful as I desire.  E.g. it would be nice for 8Bit access to go on-chip and 16Bit access to go off chip.  Oh well, I am sure these are common:
    00: Internal Only: MOVX accesses on-chip XRAM only. All effective addresses alias to on-chip memory space.
    01: Split Mode without Bank Select: the Address High port latches to resolve upper address byte.
    10: Split Mode with Bank Select: EMI0CN to determine the high-byte of the address.
    11: External Only: MOVX accesses off-chip XRAM only. On-chip XRAM is not visible to the CPU.

    For ease of use, I am currently only doing 11 - external only.  Can anyone give some good advice to unravel this mess and any SDCC tricks that apply?

     
    • Maarten Brock
      Maarten Brock
      2008-12-24

      With 64k external ram there is no clean solution, I'm afraid. With 32k I advise to use it at 0x8000-0xFFFF so they don't overlap.

      With 64k external I would sacrifice 4k of the external ram and always use the internal because it is faster. If you really need all the ram you can get, you have to switch EMI0CN yourself when you need the one or the other. I recommend to use 10 - Split Mode with Bank Select so initialization works correctly.

      Maarten