[Oberon] Boot procedure FPGA Oberon

Paul Reed paulreed at paddedcell.com
Thu Jan 23 16:10:08 CET 2014


Dear Herr Greim,

> I have just seen that Ni[k]laus Wirth has totally revi[s]ed some chapters
> of the documentation (my browser cache has cheated me).
> Also the boot procedure is now different, its now using the RS-232
> interface.
> The Verilog files on his web site seems to be still the old ones. B[u]t I
> will watch the web site, waiting for further news...

As the book says, the RS232 interface was used extensively by Prof. Wirth
as the system was developed.

The bootloader for the Oberon system will vary, depend on what hardware is
actually attached.  It is compiled using the "RISC0" mode of the compiler,
triggered by an asterisk after the keyword MODULE, which generates a
single self-contained instruction stream for inclusion directly in the
FPGA.

The ../prom.mem file, intended to be placed in the project directory
itself (the source files are by convention placed in a subdirectory src/
of the project directory, hence the path prefix) is a text file which
simply contains the opcodes generated by the compiler, in hex, 8 digits,
one opcode per line.  The "initial $readmemh" reads these opcodes into the
mem array as the hardware is being synthesised.

If you want to have fun and explore the RISC without attaching any
external hardware (this is how I have introduced the RISC to the students
at ETH in the System Construction course), you may find it easier first to
build the Oberon-0 compiler from Prof. Wirth's Compiler Construction
section of his home page.

Indeed, the first few programs I wrote for the RISC computer, to test the
peripheral hardware I was designing (like the display), were in Oberon-0;
and the first bootloader was Oberon-0 too; we only later switched to using
the full Oberon compiler with its "RISC0" mode.

For example, the following Oberon-0 program will sequence the LEDs on the
Spartan-3 board:

MODULE TestLEDs;

CONST
  ledAdr = -60;

VAR
  x, y, z: INTEGER;

BEGIN z := 0;
  REPEAT
    PUT(ledAdr, z); x := 1000;
    REPEAT y := 1000;
      REPEAT y := y-1 UNTIL y = 0;
      x := x-1
    UNTIL x = 0;
    z := z+1
  UNTIL FALSE
END TestLEDs.

The Oberon-0 compiler will compile the above to produce something like the
below, which you can put into your prom.mem file (which must be
zero-filled to the size of the array):

5D00FFB4
40000000
A0D00008
5000FFC4
81D00008
A1000000
400003E8
A0D00000
400003E8
A0D00004
80D00004
40090001
A0D00004
80D00004
40090000
E9FFFFFA
80D00000
40090001
A0D00000
80D00000
40090000
E9FFFFF2
80D00008
40080001
A0D00008
E7FFFFE9
00000000
...

Have fun!

Cheers,
Paul





More information about the Oberon mailing list