D for reconfigurable computing?

Sean Kelly sean at f4.ca
Wed Nov 29 15:34:25 PST 2006


Roel Meeuws wrote:
> Hi there,
> 
> I've been looking at D for some time now, and there are quite some interesting
> features there! And because I feel this language has potential, I would like
> to suggest a feature that would be beneficial within my research discipline.
> I'm working with reconfigurable computing, and to be more precise at the
> moment our group is automatically translating high-level languages to
> hardware. This would make it possible for non-hardware designers to take
> advantage of FPGAs and the like.
> 
> Anyway, the feature that about every language out there is lacking is easy
> bitlevel manipulation... You will ask, why the heck would you want to do that?
> Well, when considering cpus that do not make direct bitlevel manipulation
> possible I would agree, but the future will not have a big role for "old" ways
> of thinking. There will be hybrid environments with accelerators and FPGAs
> etc. And doing a bitreversal without a for-loop and xors and shifts is
> probably a lot easier...
> 
> How could this be done? When the elementary type bit is added and any integer
> type can be casted to a bitarray and back, we would basically be done. Maybe
> this could also make it possible to define arbitrary size integers like
> 1024-bit integer or something. Of course, this would require generic
> implementations for any integer operators.

For what it's worth, D actually had a bit type until recently when it 
was replaced by bool.  The bit type was one byte by itself and packed in 
arrays, which is about what you're asking for.  This was changed for two 
reasons: 'bit' and 'bool' aren't really the same thing, so using bit 
values to represent logical true/false didn't sit well with many D 
programmers; also, packed bit arrays represented an annoying corner case 
of array manipulation as it is not possible to take the address of a bit 
element.  The compromise, when bit changed to bool, was the addition of 
the BitArray class in Phobos.  That said, Phobos also contains "to the 
metal" instructions for bit manipulation in std.intrinsic: 
http://www.digitalmars.com/d/phobos/std_intrinsic.html  This isn't 
perhaps quite as nice, semantically, as dealing with a bit array, but 
it's quite optimal and far better than all the xor nonsense required in 
other languages.


Sean



More information about the Digitalmars-d mailing list