IF-RIO

cancel
Showing results for 
Search instead for 
Did you mean: 

how to clock my code?

Hi,

   I can have two clocks from my PCI5640R card. A DAC clock which I configured to run at 1MHz and a FPGA clock at 20MHz.
   In another way of seeing it, my block can be eithered driven by a 1MHz clock or a 20MHz clock.
   However, I want to my blocks driven by some other clock, say 5MHz. One reason might be that the code in my block is too complex to run at 20MHz. What kind of structure should I use? I attached the code I can think of ,but I do not know whether it really works the way I want. Say, will the content in the shiftregister be incremented every 0.2us, i.e., the increment and latch operation block driven by 5MHz?
   It the code works, how does FPGA generate its 5MHz clock?
   Moreover, what is the architecture of the attached code? by architecture, I mean the corresponding block diagram of a VHDL code which usually consists of counter, latch, adder or something.
   Many Thanks.

David,
 
 
0 Kudos
Message 1 of 2
(6,241 Views)
Hi David,

I think the best way to learn more about LabVIEW FPGA is to use the Gettting Started with LabVIEW FPGA 8.0 knowledge base, especially the link to the LabVIEW FPGA Module Training course.  This is the same course we teach internally for NI employees getting started with LabVIEW FPGA.  The structure you are implementing in your attached image uses a counter on a high speed clock (20MHz for example) to only execute the increment function only every 4 ticks, so the increment occurs at 5 MHz. 

When you take a look at the training, look especially at Lesson 7, slides 7 and 8.  Those slides demonstrate the idea of the enable chain and dataflow implemented in FPGA logic.  That lesson also introduces the idea of pipelining code.  Pipelining code can be useful for implementing code that would normally be done too slowly to run in a faster clock domain.  The trade off for pipelining is an overal latency in the data stream.  It make take 4 tics of the 20MHz clock to get the first data point out, but after that, you would be able to "stream" that slower computation at the 20MHz speed.

Hope this helps.
Spex
National Instruments

To the pessimist, the glass is half empty; to the optimist, the glass is half full; to the engineer, the glass is twice as big as it needs to be has a 2x safety factor...
0 Kudos
Message 2 of 2
(6,170 Views)