occam-pi on XMOS

XCore Project reviews, ideas, videos and proposals.
Goncalo
Junior Member
Posts: 7
Joined: Sat Oct 30, 2010 9:48 am

occam-pi on XMOS

Post by Goncalo »

Version: 1.1
Status: Complete
License: GPL
Download: /files/project_builds/occamPI_on_XMOS.zip

In my personal opinion this project is for educational purposes only. It doesn't make sense to use occam-pi on a XMOS platform. However it does make sense to use occam-pi on another single core architecture (Arduinos, PIC, etc...).
The motivation for this project come from this website http://concurrency.cc/ . These folks are making a good job by making available occam-pi to single core architectures. They already have occam-pi runnning on an arduino and on a NXT Brick (Lego Mindstorms).

While it is not possible to have XC on other platforms... I believe that occam-pi might be a solution to bring determinism and real-time to our projects! Who knows :p?!
********************************************************************************************************

I provide the code for XK-1A board - single thread. For now it is not implemented with multithreads. The code can be use with other XMOS boards.
Small and brief description (for more details go to the provided websites):
- One way to have occam-pi running on other platforms is to use an interpreter. The interpreter will read the occam-pi instructions and will translate to the respective architecture.

- To make possible the interaction of occam-pi with the microprocessor hardware (leds, adcs, etc..) it is necessary to have a Hardware Abstraction Layer (HAL). In this case the HAL is implement through sffi.c (tvm folder).

- libtvm folder: has all the interpreter code (it was necessary to make small adjustment to work on XMOS platform for example "disable" the floating points...)

- simple folder: has the XMOS single thread code

- tvm folder: has the files necessary to change for different projects:

- tvm.c is where everything takes place. Originally it reads the program from a file but I modified to read the program from memory (program.h)

- sffi.c is the HAL;

- xmos_port.xc is the interaction with XMOS hardware. sffi.c calls functions from here;

- program.h is the occam program in memory (the actual program is the test1.occ);

- blinkExample folder: has all the code that I used on the vmware for this project
Environment Set Up:
- With the code provided it is not possible to change the occam program :(...... to make these changes you need to have extra work (sorry)!

- I set up a virtual machine with a linux system and I installed kroc (http://projects.cs.kent.ac.uk/projects/ ... sterpreter)

- kroc is responsible for compiling your .occ files to .tbc files

- Then the interpreter (tvm.c) from the tvm folder will read this .tbc file and will run it.

- It is possible also to run this on linux and see the result before you put on the desired platform :)....

- This website explain all the stuff properly - http://pop-users.org/wiki/occam-pi/LearningResources
Notes:

- The interpreter occupies a lot of memory (50KB) so you only have 15KB for you occam programs + XC code....

- Again I don't see any practical usage of occam-pi on XMOS boards but it is fun to see the basis of XC running on XMOS :p

- To run the code just type on the XMOS command prompt: "xmake run" or "xrun --io demo.xe"
Have fun!
********************************************************************************************************

Websites:

- http://concurrency.cc/

- http://www.cs.kent.ac.uk/projects/ofa/kroc/

- http://pop-users.org/wiki/occam-pi

- http://pop-users.org/wiki/occam-pi/LearningResources

- http://projects.cs.kent.ac.uk/projects/ ... sterpreter

- http://occam-pi.org/occamdoc/course.html#name-out.ch
P.S. - Manuel Martins Barata is not a xcore user but he was heavily involved in this project. Thank you Barata for your help.
Images:


User avatar
Jamie
Experienced Member
Posts: 99
Joined: Mon Dec 14, 2009 1:01 pm

Post by Jamie »

Why??? Occam-pi is a concurrent message passing language and the XMOS architecture is perfect match for this! Is it doomed to run only on single cores now?
Goncalo
Junior Member
Posts: 7
Joined: Sat Oct 30, 2010 9:48 am

Post by Goncalo »

I agree with you it shouldn't be doomed!
That is why I said "on a XMOS platform" not "on multicore platform"... You have XC for XMOS, why use occam-pi?
User avatar
Jamie
Experienced Member
Posts: 99
Joined: Mon Dec 14, 2009 1:01 pm

Post by Jamie »

Well there are some significant differences between XC and occam-pi but I'm surprised that you claim occam-pi is unsuited for a platform very similar to the transputer.
Goncalo
Junior Member
Posts: 7
Joined: Sat Oct 30, 2010 9:48 am

Post by Goncalo »

Don't be surprised! It is just my opinion!
Remove the interpreter and when you have a compiler occam-pi two XMOS architecture then it is a different story.