Jump to content

Recommended Posts

Importantly, this means that Type Cast is not an in-place operation the way it would be in C (the help for Type Cast suggests that it operates like a C cast). If you have, say, a string that you want to cast to an array of U32, all of that data may get copied even though it's unchanged.

This has actually caused me problems on a single-board RIO. My code received an image over TCP, and TCP Read outputs a string. That data needed to be passed to the FPGA through a DMA FIFO as a U32 or U64 array. The time required for the Type Cast operation caused a substantial delay and I couldn't find any way around it.

Link to comment

Random Trivia:

Type Cast is also the only way to cast a 32-bit Integer to a SGL and retain the bit pattern.

I also had an application on a RT system which wanted to do this and when I realised this was not in-place (it takes approximately 1us for EACH U32-SGL conversion which was WAY too much for us to allow at the time) I had to scrap it and refactor my communications.  We should get together and pester NI to offer an in-place bit-preserving method to convert between different 32-bit representations!

Link to comment
1 hour ago, shoneill said:

We should get together and pester NI to offer an in-place bit-preserving method to convert between different 32-bit representations!

Seriously. In my case I was finding that the time required to receive an image and send it to the FPGA was divided into roughly equal amounts of time for the TCP Read, the Type Cast to U32, and the DMA Write, suggesting that each one involved a similar operation (copying all the received data). I don't ever imagine that TCP Read could write directly into the DMA buffer, but it would be nice to cut out the Type Cast copy.

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.