Dhans Posted December 16, 2016 Report Share Posted December 16, 2016 What does Labview exactly means 'flattening' and 'unflattening' that is used in explaining type cast's operation.Thanks in advance!! Quote Link to comment
smithd Posted December 16, 2016 Report Share Posted December 16, 2016 http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/flattened_data/ it just means " Flattening data makes the data from an arbitrarily complex cluster contiguous rather than stored in several places. " Quote Link to comment
ned Posted December 16, 2016 Report Share Posted December 16, 2016 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. Quote Link to comment
shoneill Posted December 16, 2016 Report Share Posted December 16, 2016 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! Quote Link to comment
ned Posted December 16, 2016 Report Share Posted December 16, 2016 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.