[Oberon] Numeric CASE vs IF THEN ELSE Performance

Chris Burrows chris at cfbsoftware.com
Sun Jun 10 01:57:12 CEST 2018

> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Andreas Pirklbauer
> Sent: Sunday, 10 June 2018 3:55 AM
> To: ETH Oberon and related systems
> Subject: [Oberon] Numeric CASE vs IF THEN ELSE Performance
>   > I'll post a message on the Astrobe Forum and this mailing
>   > list when it is available.
> Ok. We can compare notes then. I have carried forward the
> implementation of the numeric CASE statement from Ceres Oberon to
> FPGA Oberon (but of course using the regular BR instruction, i.e.
> using BR,cond [Rn] and not BR,cond PC,[Rn]).
> If the performance with your *modified* BR instruction really is
> demonstrably better AND the new instruction becomes part of the RISC
> instruction set, then it is perhaps worth making the implementation
> of the numeric CASE available to everyone.

I have some example code and output to illustrate all of this but
unfortunately this mailing list is not a suitable medium:

* Attaching files, showing screenshots and including formatted code snippets
are problematic.
* Everybody is bombarded with copies of the files even if they have 0%
interest in the discussion.

Consequently I have relaunched this discussion on the Astrobe forum:


The Soundex-inspired example code included there has an Astrobe compiler
listing file which shows the actual code generated for each statement in a
disassembler-style listing, and a screenshot of the output showing the
actual results running on an Arty development board.

If you compile this example on your implementation you will be able to
compare the code generated by each.

If you look at the disassembler listing you will see that another CASE
benefit (particularly useful in embedded systems) is that it uses
significantly less code space than IF THEN ELSE as long as the selections
are not too sparse. The total code generated for each version of the Soundex
procedures is:

IF-THEN-ELSE: 420 Bytes
CASE: 240 Bytes

Chris Burrows
CFB Software

More information about the Oberon mailing list