LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA global versus register

I'm trying to wrap my head around resource utilization in LabVIEW FPGA specifically when it comes to transfering data from one process to another on a single FPGA target. The following link is helpful but I still am not clear on the advantages of implementing the a Memory Item, Register Item, vs Global variable for a single value:

 

  • Memory Item (Implemented in LUT instead of Block Memory)
  • Register Item
  • Global Variable

 

It appears that all three items require "Logic Resources" (i.e. flip-flops and/or Look Up tables). Are these three mechanisims equal or do they actual have different resource and timing needs? I'm just not sure how to make the best decision for my application and how to coach my colleagues in doing the same.

 

 

Thanks,

Craig

 

 

Message 1 of 7
(6,378 Views)

I think Globals and Registers are essentially the same thing if used withn the same clock domain.  When using a Global across different clock domains, they are implemented internally as Handshake items I think (to make sure the synchronisation is correct).

 

A memory item requires more code as you can theoretically have more than one element stored and as such you have a certain overhead regarding indexing and storage.

 

These descriptions refer to scalars.  If you have an Array global or Register, then I think the difference to a memory item will be a lot less (and may again converge on the same implementation behind the scenes).

0 Kudos
Message 3 of 7
(6,289 Views)

A global variable in LabVIEW FPGA acts like a global variable in normal (non-FPGA) LabVIEW, but with the tradeoff that you don't get any control over how it's implemented on the FPGA. It's a good choice if you're familiar with LabVIEW but not FPGA and want to get your code running without worrying about the low-level details.

 

A memory item, whether implemented in block memory or in LUTs, acts like an array where you can access individual elements. Although a global variable or a register can contain an array, it is always accessed as a single unit.

 

As an example comparing a register or global variable versus a memory item, consider a circular buffer, where on average the read and write rates are the same but sometimes you write several items before doing a read, and sometimes you read several items between writes. A memory item is a the right choice because you can maintain independent read and write addresses, and avoid accidentally overwriting data so long as the addresses don't catch up to each other. With a register or global variable you'd need to read the entire array out, update the relevant elements, then store the entire array again, which would be more complicated and use more FPGA logic.

0 Kudos
Message 4 of 7
(6,268 Views)

@kelle Thank you for providing the links. I especially like the help document links which include flow charts. Very useful.

 

To the group, your comments and a little more digging into the help documents have confirmed your comments about when and why to use these various mechanisms. Thank you!

 

My next step will be to create some FPGA examples so I can compare if implementing one mechanism over the other requires more logic slices or not (for example global variable vs register item). I'll report back my findings.

 

Thanks!

Craig

0 Kudos
Message 5 of 7
(6,253 Views)

Any progress on those findings?

0 Kudos
Message 6 of 7
(4,197 Views)

Unfortunately no. As I recall the FPGA lessons provided in the NI curriculum simply specifies these items as possible storage mechanisms but does little to describe the actual scenarios in which to use them.  

0 Kudos
Message 7 of 7
(4,192 Views)