[Oberon] FPGA - Bit reversal

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Sat Sep 23 17:04:52 CEST 2017


Wojciech,

I agree that computer scientists (and language designers) need to listen more to engineers and their needs. As an example where "bitwise operators" have been made available at the programming language level in a consistent way (and without compromising type safety), one may check out how the Swift programming language has defined them:


https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-ID28 <https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html#//apple_ref/doc/uid/TP40014097-CH27-ID28>

https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-ID309 <https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/TheBasics.html#//apple_ref/doc/uid/TP40014097-CH5-ID309>


In Swift, integer literals can be written in as a binary number, with a 0b prefix, for example

	var binaryInteger: Uint8 = 0b00001111       // 15 in binary notation

and most bitwise operators that one would expect (bitwise and, bitwise or, etc) are in the language. However, a "bit reversal" operator does not exist in Swift either, but could be easily programming with the bitwise shift operators that do exist.

It would not be too hard to introduce some of these ideas/concepts/notations into the Oberon programming language. Part of the issue there seems to be that some operators or functions such as ORD are in fact not well defined, as outlined in this thread earlier.

Andreas


> On 23 Sep 2017, at 16:39, Andreas Pirklbauer <andreas_pirklbauer at yahoo.com> wrote:
> 
> Evil?
> 
> If you want to manipulate bits, then you cannot escape the fact, they they have their positions within the word. The position depends on a platform. There is no such thing in the world like a computer which would not depend on bit positions. A processor status or setup depends on particular bits within registers, the video or audio depends on particular bits, and so on.
> 
> I see this discussion as yet another chasm between computer scientists and engineers. The former want to live in an ideal programming world where algorithms move from place to place without changing anything. For them, bit positions are ugly details to get forgotten. For an engineer the very notion that particular bits are not accessible is a sheer absurd.
> 
> I build and program hardware. I deal with bits every day. Anything what hampers my access to bits is an instant enemy. Our friends computer scientists should one day wake up to the fact that hardware has to be controlled by accessing particular bits in particular places. Having good tools for doing this is essential. These tools need to be nurtured rather than frown upon.
> 
> I know that Chris is on our side. He programs microcontrollers.  I am talking to the others who still think that Oberon only runs on a Turing machine. Or on Windows.
> 
> Thanks,
> W
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20170923/d127fbc1/attachment.html>


More information about the Oberon mailing list