The Transterpreter Project

Concurrency, everywhere.


Transterpreter Summer '09 - Day 18 - Virtual Memory

Today began with some more cleanup (as can be evidenced by commits 5874, 5875, 5876, and 5878, which introduced various changes). The main commit of the day 5877 introduced the new memory interface for the AVR.

There is no real magic involved in the new memory interface thankfully. And as a bonus, our work was cut in half by the fact that we will never be writing data directly to flash from a running program. Thus all the write and pointer arithmetic functions required by the memory interface can be copied from the default interface. Only the four read functions require modification.

The memory interface lays out SRAM starting at 0x000 and ending at 0x7FFF, for a total of 32 KB of addressable space for SRAM. On our current AVR we have 2 KB of SRAM so that is enough for now. The address space for flash starts at 0x8000 and goes to 0xFFFF, which fits the entirety of the 32 KB of flash on our AVR1 has. Thus the read function inspects the requested address and if it is below 0x8000 it is read out of memory unchanged, otherwise the address is mapped into flash and then the appropriate magic is applied to read values out of flash.

The only problem is with FFI code, which now needs to be modified to use the memory interface2. This makes working with the FFI a little bit more tedious unfortunately (but we are of course going to try to get rid of as much FFI anyway and implement things in occam :)

The only other commit today is 5879 in which Carl fixed the plinker to output 16 bit bytecode.

Commstime

With our new memory interface we are now able to run commstime. There is still a bit of work needed to get commstime to work fully as it does some 32 bit calculations for which we need to compile the occam standard libraries for 16 bit architectures. Something we have not done for a while.


  1. the 328P by the way. 

  2. in fact FFI functions currently use a function called memcpyfromtvm, which is defined together with the FFI. 



Metadata