Jump to content

Booleans Stored as Bytes.. Why?


AlexA

Recommended Posts

I was doing some light reading and I noticed that Labview apparently stores Boolean data as bytes, where 8 zeros indicates false and anything else is true.

Does anyone have any insight into the logic behind this decision? This is not an important question just a curiosity. It seems like an awful waste of space for embedded applications like FPGAs.

Link to comment

I don't know the actualy answer, but I can say that in the past booleans were actually kept in a single bit and this was changed (presumably with LV 5, which would have been some time before LV FPGA came out). If you right click certain data conversion nodes (such a type cast and unflatten), you can tell them that your data is in 4.x format.

Pure guess - maybe this was done because of alignment and performance issues (i.e. everything else uses at least a byte)?

Link to comment

Hi Alex,

It seems like an awful waste of space for embedded applications like FPGAs.

when programming LabVIEW FPGA the output is VHDL code which is compiled and optimized by the Xilinx compiler. So you cannot transfer LabVIEW memory management to FPGA. And because of that I don't think that there is any waste of memory wrt. FPGA programming.

  • Like 1
Link to comment

I don't know the actualy answer, but I can say that in the past booleans were actually kept in a single bit and this was changed (presumably with LV 5, which would have been some time before LV FPGA came out). If you right click certain data conversion nodes (such a type cast and unflatten), you can tell them that your data is in 4.x format.

Pure guess - maybe this was done because of alignment and performance issues (i.e. everything else uses at least a byte)?

Actually it is a little different. In LabVIEW < 5.0 a skalar boolean was a 16 bit integer and the most significant bit defined the boolean status and everything else was don't care. However boolean arrays where packed into words, so an array of <= 16 boolean would consume 16 bit.

Now the history or this is of course presumably the MacOS which had somehow a similar notion, but the packing and unpacking of boolean arrays caused actually quite a bad performance for some operations. So LabVIEW 5.0 changed it to the more common 1 byte per boolean notion, which is what most C compilers use also as their default boolean implementation (although the C standard does nowhere specify what size a boolean has to be).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.