LabVIEW FPGA Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
crossrulz

Allow Type Cast in FPGA

Status: New

We need a way to simply reinterpret the bits in our FPGAs.  I currently have a situation where I need to change my SGL values into U32 for the sake of sending data up to the host.  Currently, the only way is to make an IP node.  That is just silly.  We should be able to use the Type Cast simply for the purpose of reinterpreting the bits.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
11 Comments
Intaris
Proven Zealot

I use the To boolean array and back. To boolean array and back is basically free on FPGA if the bits match.

crossrulz
Knight of NI

I will have to try that, but when I looked at it before, the To Boolean Array coerced my SGL.  I was left to assume this would drop my decimal points and just leave my rounded off integer value.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
djclark
Member

Unfortunately Number To Boolean Array coerces floating point data to U32, rather than flattening it. Everything after the decimal gets truncated.

Intaris
Proven Zealot

I don't use SGL on FPGA so that's something I've never seen.

 

I think fixing this bug would be the best approach because that behaviour is wierd.

r_good
Member

I will have to look into this, but try typecasting the SGL as FXP and then use Boolean array to number to typecast to U32.  

 

I will try and find where I had to accomplish this, very long time ago though.

 

I think that is the trick though, would be so much nicer to directly typecast though.  Not sure why the compiler cannot figure it out given they implemented the single already.  

heel
Member

Yes the lack of typecasting in FPGA is a nuissance. Hope this will get fixed. I dont see any reason why not to support typecasting.

MrJackHamilton
Member

I'm not sure about this, FPGA space is precious, and high-level implementations are often inefficient, this would consume FPGA space at the expense of coding convenience.

 

As my main concern in coding FPGA is fabric space, I prefer more low-level tools than high-level abstraction tools.

JHE
Member
Member

To boolean array and its opposite are typecast. They just cannot handle SGL, they get converted to I32 before boolean array.

 

Now, if someone would do some IP Nodes for SGL to U32 cast and back, and share it, I would be one happy camper 🙂

 

 

crossrulz
Knight of NI

They are out there.  I would have to search to find it again.  That is what I ended up doing.  But the issue with using IP nodes is you have to recompile them when you go to a new LabVIEW version and/or change hardware.  The type cast should just happen natively.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
T-REX$
Active Participant