[Oberon] Volatile variables in Oberon

Skulski, Wojciech skulski at pas.rochester.edu
Sat Jul 30 08:06:00 CEST 2016


Chris:

> But Oberon variables are not mapped to registers that can be changed "from
> the other end". The explicit operations SYSTEM.GET and SYSTEM.PUT are used
> when you want to transfer data between a peripheral register (mapped to an
> absolute memory location) and Oberon variables.

 Pardon my C on this mailing list. The point I want to make is that it is ugly. 

Here is a sample of my C program where I am reading from an absolute memory location mapped to an FPGA register. The "target" is an integer, which is then used to retrieve a value from the FPGA. The address is not constant, but I can make it constant using a #define.

 long target; /* long int holds addr, needs a typecast */
 short value;
 short *virt_saddr;	/* typed pointer to 16-bit short */

 virt_saddr = (short *) target; /* convert target to pointer */
 value = * virt_saddr;            /* read value from address   */

I would prefer to write in C something like the following:
 
 short value at address; /* address is constant, which is most often the case*/

In Oberon it would be something like this:

 CONST address = ....; 
  VAR value: INTEGER AT address; (* address must be constant*)

Now the question, is this unreasonable? 

Wojtek


More information about the Oberon mailing list