[Oberon] FPGA - Little Endian & Bit numbering
Chris Burrows
chris at cfbsoftware.com
Sat Sep 23 01:12:36 CEST 2017
> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Skulski, Wojciech
> Sent: Saturday, 23 September 2017 7:24 AM
> To: ETH Oberon and related systems
> Subject: Re: [Oberon] FPGA - Little Endian & Bit numbering
>
> > It's odd, however, that there is no (non-SYSTEM) procedure for
> > converting an integer back to a set.
>
> Here BlackBox is ahead, as usual. From the CP Language Report:
>
> 10.3 Predeclared Procedures
>
> Name Argument type Result type Function
> BITS(x) INTEGER SET {i | ODD(x DIV 2^i)}
>
> I used BITS a lot in my data processing. It is extremely useful.
>
Yes BITS is useful and this definition is not ambiguous although it might be
inefficient to implement for some target processors. However Component
Pascal defines a limit of 32 elements in a set whereas now in Oberon the
limit is implementation-defined so that definition could be problematic.
We implemented BITS as an extension in the Astrobe Oberon for Cortex-M
compiler and also *currently* have a limit of 32 elements.
Another interesting extension implemented in Wirth's ARM compiler that we
have adopted in Astrobe is allowing ABS to take a SET value as an argument.
It returns the number of elements in the set. E.g.
S := {1, 3, 4, 7, 11, 13, 17, 19, 23, 29, 31);
ABS(s) = 11
This was included as a standard function in an earlier version of the Oberon
Report but is no longer there, presumably as it cannot be efficiently be
implemented in some non-ARM instructions sets.
Regards,
Chris Burrows
CFB Software
http://www.astrobe.com
More information about the Oberon
mailing list