Shop OBEX P1 Docs P2 Docs Learn Events
ANNOUNCING: Large memory model using external memory expansion — Parallax Forums

ANNOUNCING: Large memory model using external memory expansion

KaioKaio Posts: 253
edited 2007-02-21 10:01 in Propeller 1
Hi all,

I will present you my concept for a large memory model for assembly language when using a memory expansion circuit. When I started of thinking about this concept I did not known of Bill's concept. I like his concept very much because it can be used for the Propeller out of the box without any additional circuit. But the main memory of the Propeller is currently limited to 32 KB. I know that the next chip with more memory is in work. But if you need more memory today for your application you must use a memory expansion like this from Mahjongg. I have made a test implementation based on this memory expansion.

My concept is independent from a specific memory expansion. It supports up to 1 GB RAM. Let me explain how it works. The external memory is splited in virtual pages of 1 KB = 256 longs. The content of a memory page will be loaded to a code page area in the Cog where it is processed at real speed. After the code page is located a jump table and some routines to access other memory pages. The required space for this depends on the used memory expansion. The free memory after this area up to Propeller special registers can be used for global variables, which can be accessed from code in any memory page.

$0   - $0FF area of assembly code and local variables
$100 - $10B jump table
$10C - $180 core routines incl. memory mapper
$181 - $1EF area of global variables (e.g. 111 longs)
$1F0 - $1FF special registers




Inside the code page area you can have local variables, which should be, not only for performance reason, accessed from the code located in the same memory page. If you will do that I would prefer the following layout for your code page.

$0         jump to begin of code
$1 ... $A  e.g. 10 local variables
$B   - $FF assembly code




The jump on the first address is required, because the memory mapper will start the code of the page always at this address if it is automatically loaded. Now you ask me why automatically? Let us have a look at the jump table which is located after the code page area.

contCode                jmp     #loadNextPage
fjmp                    jmp     #farJmp
fcall                   jmp     #farCall
fret                    jmp     #farRet
readByte                jmp     #loadByte
readWord                jmp     #loadWord
readLong                jmp     #loadLong
                        nop     'reserved
                        nop     'reserved
                        nop     'reserved
                        nop     'reserved
                        nop     'reserved




The first entry in jump table will load the next memory page into the Cog and continues the code at address 0. So the paging of code is independent from your code, or with other words normally you must not take care when your code does exceed the code page.
Further we have entries to execute code in other memory pages via FJMP, FCALL and to return by FRET. And entries to get a byte, word or long from another memory page.

Summary of the advantages.
- usage of all available assembly instructions possible
- up to 1 GB external memory supported
- independent from memory expansion
- code running at real speed

Here are the drawbacks.
- some overhead for memory mapping
- special compiler necessary

What do you think about this concept?

Thomas


P.S.: I know my english is not perfect. Feel free to ask me, if something is not clear.
Sign In or Register to comment.