The problem is to modify SPOC, the Southampton Portable Occam Compiler, so that instead of producing C code, it produces PIC assembly language.
The goal is to allow a simple Occam program to be compiled into PIC assembly language. It should then be possible to execute the program on a PIC, once the program has been assembled and downloaded using suitable public domain tools.
The compiler will be based on the latest publicly available release of SPOC - currently this is version 1.3. The majority of modifications to SPOC will be to the back-end code generator. Minor modifications will be needed elsewhere, for example to add/remove parts of the Occam language which are particular to this implementation.
SPOC relies on the GMD compiler toolkit. It is not expected that any modifications will need to be made to these compiler tools, but a thorough understanding of how they work will be essential.
The compiler should be able to cope with the main Occam constructs, such as SEQ, PAR and ALT. It should be possible to evaluate expressions involving BOOLs, BYTEs and INTs. However, REALs will not be supported due to the limitations of the PIC instruction set and the small amount of memory available.
The I/O ports on the PIC will be made available within Occam programs for external communication. All internal communication will take place using Occam channels. There will also be a special TIMER channel, which will make use of the PICs real-time counter.
A simple run-time environment will need to be designed. This will be responsible for initialising the PIC, handling interrupts (if used), and scheduling processes when they are ready to execute. Emphasis will be placed upon making the run-time environment as small and efficient as possible.
The assembler code produced by the compiler will be targeted towards a specific member of the PIC family, the 16C84. However, it is hoped that if the code can be kept general enough then the compiler will be able to support other types of PIC with little or no modification.
Throughout the project it will be necessary to test the compiler to ensure that it exhibits the correct behavior. Where appropriate, the compiler will be expected to issue warnings and errors when presented with invalid Occam programs. For valid Occam programs, the compiler will be expected to produce correct assembler code. The correctness of the assembler code will be established by manually examining it, line by line, or by executing it on a PIC. A PIC simulator may also be a valuable tool during the testing process.