SlideShare une entreprise Scribd logo
1  sur  39
Lesson 7
      Synchronizing FPGA and Host Data
                  Transfers

TOPICS
A.   LabVIEW FPGA and Host Communication
B.   Synchronization
C.   Direct Memory Access (DMA) FIFOs
D.   Lossless Data Transfer
E.   Interrupts
F.   Handshaking

                                           ni.com/training
A. LabVIEW FPGA and Host Communication

• FPGA VI and host VI are inherently asynchronous
• Each VI runs independent of the other
• Data transfer synchronization needs to be implemented
  based on the application needs
• To transfer large amounts of data between the target and
  host at high rates you must buffer the data




                                                   ni.com/training
Synchronization and Buffering

• Synchronization—Causing tasks occur at the same time or
  in unison by using clock, triggers, or events
• Buffer—An area of computer memory that stores multiple
  data items




                                                 ni.com/training
B. Synchronization

• Level of synchronization depends on the application
• Synchronization not required in some slower control
  applications
 − For example, if the data acquisition loop is faster than the
   control loop, the control loop reads the most recent value
• Synchronization required to acquire and transfer lossless
  data at a known rate




                                                         ni.com/training
Asynchronous vs. Synchronous

• Asynchronous Applications
 − Applications that don’t require tight synchronization for control
   or data processing
 − Timing performed on the FPGA, but no synchronization to the
   host application
 − Most recent data is okay, many control applications
• Synchronous Applications
 − Synchronization required between FPGA VI and host VI



                                                         ni.com/training
Synchronous Applications

• Timing control
 − Timing from the FPGA/acquisition controls the timing/loop rate
   of the host VI, and vice-versa
• Synchronized Data Transfer
 − Synchronization transfers/streams data from acquisition to host
   VI for processing and logging
 − Lossless data transfer




                                                       ni.com/training
Synchronization Methods

• Direct Memory Access (FIFO)
• Interrupts
• Handshaking




                                ni.com/training
C. Direct Memory Access (DMA) FIFOs

Data Buffering
• To transfer larger amounts of data at high rates between the
  target and the host you must buffer your data.
• The best way to buffer data is by using Direct Memory
  Access (DMA) data transfer methods.




                                                    ni.com/training
Direct Memory Access (DMA) FIFOs (continued)

• Transfers data from FPGA directly to memory on the RT controller
  through bus mastering.
• Streams large amounts of data.
• Provides better performance than using local FIFO and reading
  indicators.
• Host processes data while FPGA transfers data to host memory.
• Without DMA, processor must read data.
• Consists of two parts—FIFO part and host part.
• FPGA writes data one element at a time to the FPGA memory.
• DMA engine transfers data along PCI bus to host memory.

                                                          ni.com/training
Demonstration: Target-to-Host DMA FIFO




       Explore how the FPGA transfers data to the host.
GOAL




       <Exercises>LabVIEW FPGADemonstrations



                                                      ni.com/training
Demonstration: Host-to-Target DMA FIFO




       Explore how the host transfers data to the FPGA.
GOAL




       <Exercises>LabVIEW FPGADemonstrations



                                                      ni.com/training
Creating DMA FIFOs

• Create DMA FIFO the same way as FPGA FIFOs
 − Right-click target
 − Select New»FIFO
 − Choose Target to Host
   or Host to Target as
   Type
• All DMA FIFOs are
  U32 data type
 − Must convert to
   and from U32.

                                               ni.com/training
Writing Data to a Target-to-Host DMA FIFO

Drag FIFO from Project Explorer window.




                                          ni.com/training
Writing Data to a Target-to-Host DMA FIFO
(continued)
FIFO Write Function
• Element—Inputs the data element to be stored.
• Timeout—Inputs the number of clock ticks the function waits
  for available space in the FIFO if the FIFO is full. The default
  is 0, or no wait. A value of –1 prevents the function from
  timing out.
• Timed Out?—Returns True if space in the FIFO is not
  available before the function completes execution.
 − If Timed Out? is True, the function does not add Element to the
   FIFO.

                                                       ni.com/training
Reading Data from a Target-to-Host DMA FIFO

Read a DMA FIFO in the
host:
1. Open a reference to the FPGA
2. Add an Invoke Method function
3. Choose the DMA FIFO»Read
   method




                                       ni.com/training
Reading Data from a Target-to-Host DMA FIFO
(continued)
Read a DMA FIFO on the host:
• Number of Elements
 − Function completes when elements are
   read or timeout is reached
 − Same overhead regardless of the number of elements; read
   more elements if host is too slow
• Timeout—Time to wait before timeout (–1 = indefinite wait;
  Default is 5,000 ms)


                                                   ni.com/training
DMA FIFO with Blocking

Implementing a DMA FIFO with blocking:
• User specifies number
  of elements
• Best method when
  input/output rate is known




                                         ni.com/training
DMA FIFO with Polling

Implementing a DMA FIFO with polling:
• Acquires as many samples
  as are currently available
• Best when the
  input/output rate is
  unknown




                                        ni.com/training
Writing Multiple Channels

Writing multiple channels of data to a DMA FIFO by
interleaving




                                                     ni.com/training
Reading Multiple Channels

Reading multiple channels from a DMA FIFO in the host




                                                 ni.com/training
D. Lossless Data Transfer

• Lossless Application
• Overflow—DMA Full?
• Underflow—Check for –50400




                               ni.com/training
Overflow

Overflow—too many data points for buffer, may lose data
• Acquire data slower
• Increase number of elements to read on the host
• Increase the rate that the host reads data
• Increase buffer sizes on FPGA and host




                                                  ni.com/training
Demonstration: Target to Host DMA FIFO –
 Overflow




       Explore how overflow of the DMA FIFO occurs if the
       RT host VI is too complex.
GOAL




       <Exercises>LabVIEW FPGADemonstrations

                                                      ni.com/training
Underflow

    Underflow—not enough data to read, FIFO read times out
•
    Increase timeout
•
    Read data less often
•
    Read smaller sets of elements
•




                                                  ni.com/training
Demonstration: Target to Host DMA FIFO –
 Underflow




       Explore how underflow occurs when the DMA FIFO tries to
       read data before it is available.
GOAL




       <Exercises>LabVIEW FPGADemonstrations

                                                    ni.com/training
Exercise 7-1: DMA-Based Data Transfers




       Observe how DMA-based handshaking works.
GOAL




                                                  ni.com/training
E. Interrupts

• Send a trigger from the target to the host application.
• Why use an interrupt?
 − Eliminate polling
 − Allow host to perform other operations while waiting for the
   Interrupt signal
• Communicate over a physical hardware line




                                                        ni.com/training
Advantages of Interrupts

• An interrupt requires execution of a low-level driver on the
  host, so a host can process more polling operations/s than
  interrupts/s
• Comparison statistics for a Networked RIO Device:
 − A single poll requires 10 s
 − An interrupt requires about 250 s
• Use Interrupts when FPGA sends data less often and host
  must do other processing


                                                     ni.com/training
Implementing an Interrupt




                            ni.com/training
Implementing an Interrupt (continued)

Interrupt Express VI
• IRQ Number
 − Specifies which logical interrupt (0 – 31) to assert
 − Default is 0
• Wait Until Cleared
 − Specifies if this VI waits until the host VI acknowledges the
   logical interrupt
 − Default is False
• Wait Until Cleared as True causes jitter due to dependency
  upon the host VI

                                                          ni.com/training
Host and Interrupts

• Host must acknowledge interrupts
• Use Wait on IRQ and Acknowledge IRQ methods
 − IRQ Number(s)—specifies the logical interrupt or array of
   logical interrupts for which the function waits
 − Timeout (ms)—specifies the number of milliseconds the VI
   waits before timing out. –1 = infinite timeout
 − Timed Out—returns TRUE if this method has timed out
 − IRQ(s) Asserted—returns the asserted interrupts. Empty or –1
   array indicates that no interrupts were received


                                                     ni.com/training
Acknowledge IRQ Method

• Acknowledges and resets to the
  default value any interrupts that
  occur
 − Wire after the Wait on IRQ method
 − IRQ Number(s) specifies the logical interrupt or array of logical
   interrupts for which the function waits




                                                         ni.com/training
Interrupt Example




                    ni.com/training
DMA FIFO with Interrupts

Implementing a DMA FIFO with an interrupt
• Prevents the CPU from polling the DMA FIFO to see if elements have
  arrived
  − Least resource intensive DMA FIFO transfer method
  − Slowest DMA FIFO transfer method due to IRQ delay




                                                         ni.com/training
Exercise 7-2: Interrupt-Based Handshaking




       Observe an example of how interrupt-based handshaking
       works.
GOAL




                                                    ni.com/training
F. Handshaking

Handshaking—Checks that a receiving device is ready to
receive or a transmitting device is ready to transmit
• Handshaked synchronization—occurs when two or more
  devices act in sequence
• Host uses Boolean controls and indicators (data available
  and data read flags) on the target to coordinate operations
• Requires polling
• Assures that all data that is sent is also received


                                                    ni.com/training
Handshaking Process

1. FPGA acquires data
   and writes values to Array
2. FPGA writes True to
   Data Available
3. When Data Available
   is True, host reads data
4. After reading data,
   host writes True to
   Data Read
5. FPGA loop iterates
   when Data Read is True

                                ni.com/training
Quiz

1. Which of the following are    2. What error are you likely
   methods of transferring          to get if you create a DMA
   data from the target to the      FIFO that is too small?
   host?                            a. Underflow
   a.   Handshaking                 b. Overflow
   b.   Target-scoped FIFO          c. Evenflow
   c.   Interrupt
   d.   DMA FIFO
   e.   FTP


                                                    ni.com/training
Quiz

3. What happens when a           4. Which technique requires
   DMA FIFO has an                  the host VI to use polling?
   underflow condition?             a. Handshaking
   a. The FPGA resets               b. Interrupts
   b. The FIFO Read throws          c. DMA FIFO
      Error –50400
   c. The Timed Out? indicator
      latches true




                                                     ni.com/training

Contenu connexe

Tendances

Tendances (6)

HPE NonStop GTUG Berlin - 'Yuma' Workshop
HPE NonStop GTUG Berlin - 'Yuma' Workshop HPE NonStop GTUG Berlin - 'Yuma' Workshop
HPE NonStop GTUG Berlin - 'Yuma' Workshop
 
FlashCopy and DB2 for z/OS
FlashCopy and DB2 for z/OSFlashCopy and DB2 for z/OS
FlashCopy and DB2 for z/OS
 
Xilinx track g
Xilinx   track gXilinx   track g
Xilinx track g
 
Real Time Debugging - What to do when a breakpoint just won't do
Real Time Debugging - What to do when a breakpoint just won't doReal Time Debugging - What to do when a breakpoint just won't do
Real Time Debugging - What to do when a breakpoint just won't do
 
PLNOG15 :Assuring Performance, Scalability and Reliability in NFV Deployments...
PLNOG15 :Assuring Performance, Scalability and Reliability in NFV Deployments...PLNOG15 :Assuring Performance, Scalability and Reliability in NFV Deployments...
PLNOG15 :Assuring Performance, Scalability and Reliability in NFV Deployments...
 
1 dhcp server and windows server 2012
1 dhcp server and windows server 20121 dhcp server and windows server 2012
1 dhcp server and windows server 2012
 

Similaire à 7 Adv Host Integration 1234869680124198 3

Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
Mike Willbanks
 

Similaire à 7 Adv Host Integration 1234869680124198 3 (20)

CAPI and OpenCAPI Hardware acceleration enablement
CAPI and OpenCAPI Hardware acceleration enablementCAPI and OpenCAPI Hardware acceleration enablement
CAPI and OpenCAPI Hardware acceleration enablement
 
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
Accelerating Apache Spark Shuffle for Data Analytics on the Cloud with Remote...
 
Linkmeup v076(2019-06).2
Linkmeup v076(2019-06).2Linkmeup v076(2019-06).2
Linkmeup v076(2019-06).2
 
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
 
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI serverPyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
Pyruvate, a reasonably fast, non-blocking, multithreaded WSGI server
 
Performance test
Performance testPerformance test
Performance test
 
2015 02 24 lmtv baselining
2015 02 24 lmtv baselining2015 02 24 lmtv baselining
2015 02 24 lmtv baselining
 
SPE effiency on modern hardware paper presentation
SPE effiency on modern hardware   paper presentationSPE effiency on modern hardware   paper presentation
SPE effiency on modern hardware paper presentation
 
How a BEAM runner executes a pipeline. Apache BEAM Summit London 2018
How a BEAM runner executes a pipeline. Apache BEAM Summit London 2018How a BEAM runner executes a pipeline. Apache BEAM Summit London 2018
How a BEAM runner executes a pipeline. Apache BEAM Summit London 2018
 
Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012Gearman - Northeast PHP 2012
Gearman - Northeast PHP 2012
 
LACNOG - Logging in the Post-IPv4 World
LACNOG - Logging in the Post-IPv4 WorldLACNOG - Logging in the Post-IPv4 World
LACNOG - Logging in the Post-IPv4 World
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
SCFE 2020 OpenCAPI presentation as part of OpenPWOER Tutorial
SCFE 2020 OpenCAPI presentation as part of OpenPWOER TutorialSCFE 2020 OpenCAPI presentation as part of OpenPWOER Tutorial
SCFE 2020 OpenCAPI presentation as part of OpenPWOER Tutorial
 
Accelerate Your C/C++ Applications with Amazon EC2 F1 Instances (CMP405) - AW...
Accelerate Your C/C++ Applications with Amazon EC2 F1 Instances (CMP405) - AW...Accelerate Your C/C++ Applications with Amazon EC2 F1 Instances (CMP405) - AW...
Accelerate Your C/C++ Applications with Amazon EC2 F1 Instances (CMP405) - AW...
 
P4 Introduction
P4 Introduction P4 Introduction
P4 Introduction
 
Itep
ItepItep
Itep
 
Host Data Plane Acceleration: SmartNIC Deployment Models
Host Data Plane Acceleration: SmartNIC Deployment ModelsHost Data Plane Acceleration: SmartNIC Deployment Models
Host Data Plane Acceleration: SmartNIC Deployment Models
 
OSN days 2019 - Open Networking and Programmable Switch
OSN days 2019 - Open Networking and Programmable SwitchOSN days 2019 - Open Networking and Programmable Switch
OSN days 2019 - Open Networking and Programmable Switch
 
Beran APM720 Monitoring System
Beran APM720 Monitoring SystemBeran APM720 Monitoring System
Beran APM720 Monitoring System
 
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon YangPractical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
Practical IoT Exploitation (DEFCON23 IoTVillage) - Lyon Yang
 

Plus de guest27165

Junior Senior Ppt Good To Know General2009
Junior Senior Ppt Good To Know General2009Junior Senior Ppt Good To Know General2009
Junior Senior Ppt Good To Know General2009
guest27165
 
Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3
guest27165
 
Xaml Guidelines Draft0
Xaml Guidelines Draft0Xaml Guidelines Draft0
Xaml Guidelines Draft0
guest27165
 
Pharmacy 090228205532 Phpapp01
Pharmacy 090228205532 Phpapp01Pharmacy 090228205532 Phpapp01
Pharmacy 090228205532 Phpapp01
guest27165
 
Industrialage 1234869680124198 3
Industrialage 1234869680124198 3Industrialage 1234869680124198 3
Industrialage 1234869680124198 3
guest27165
 
Events Profile Page 1234869680124198 3
Events Profile Page 1234869680124198 3Events Profile Page 1234869680124198 3
Events Profile Page 1234869680124198 3
guest27165
 
Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3
guest27165
 
Crm Esa08 1234869680124198 3
Crm Esa08 1234869680124198 3Crm Esa08 1234869680124198 3
Crm Esa08 1234869680124198 3
guest27165
 
Copia De Causas Y Consecuencias De Los Incendios Forestales
Copia De Causas Y Consecuencias De Los Incendios ForestalesCopia De Causas Y Consecuencias De Los Incendios Forestales
Copia De Causas Y Consecuencias De Los Incendios Forestales
guest27165
 

Plus de guest27165 (11)

Junior Senior Ppt Good To Know General2009
Junior Senior Ppt Good To Know General2009Junior Senior Ppt Good To Know General2009
Junior Senior Ppt Good To Know General2009
 
Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3
 
No Impact Man
No Impact ManNo Impact Man
No Impact Man
 
Test
TestTest
Test
 
Xaml Guidelines Draft0
Xaml Guidelines Draft0Xaml Guidelines Draft0
Xaml Guidelines Draft0
 
Pharmacy 090228205532 Phpapp01
Pharmacy 090228205532 Phpapp01Pharmacy 090228205532 Phpapp01
Pharmacy 090228205532 Phpapp01
 
Industrialage 1234869680124198 3
Industrialage 1234869680124198 3Industrialage 1234869680124198 3
Industrialage 1234869680124198 3
 
Events Profile Page 1234869680124198 3
Events Profile Page 1234869680124198 3Events Profile Page 1234869680124198 3
Events Profile Page 1234869680124198 3
 
Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3Customizing Share Point The Supported Wa 1234869680124198 3
Customizing Share Point The Supported Wa 1234869680124198 3
 
Crm Esa08 1234869680124198 3
Crm Esa08 1234869680124198 3Crm Esa08 1234869680124198 3
Crm Esa08 1234869680124198 3
 
Copia De Causas Y Consecuencias De Los Incendios Forestales
Copia De Causas Y Consecuencias De Los Incendios ForestalesCopia De Causas Y Consecuencias De Los Incendios Forestales
Copia De Causas Y Consecuencias De Los Incendios Forestales
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Dernier (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

7 Adv Host Integration 1234869680124198 3

  • 1. Lesson 7 Synchronizing FPGA and Host Data Transfers TOPICS A. LabVIEW FPGA and Host Communication B. Synchronization C. Direct Memory Access (DMA) FIFOs D. Lossless Data Transfer E. Interrupts F. Handshaking ni.com/training
  • 2. A. LabVIEW FPGA and Host Communication • FPGA VI and host VI are inherently asynchronous • Each VI runs independent of the other • Data transfer synchronization needs to be implemented based on the application needs • To transfer large amounts of data between the target and host at high rates you must buffer the data ni.com/training
  • 3. Synchronization and Buffering • Synchronization—Causing tasks occur at the same time or in unison by using clock, triggers, or events • Buffer—An area of computer memory that stores multiple data items ni.com/training
  • 4. B. Synchronization • Level of synchronization depends on the application • Synchronization not required in some slower control applications − For example, if the data acquisition loop is faster than the control loop, the control loop reads the most recent value • Synchronization required to acquire and transfer lossless data at a known rate ni.com/training
  • 5. Asynchronous vs. Synchronous • Asynchronous Applications − Applications that don’t require tight synchronization for control or data processing − Timing performed on the FPGA, but no synchronization to the host application − Most recent data is okay, many control applications • Synchronous Applications − Synchronization required between FPGA VI and host VI ni.com/training
  • 6. Synchronous Applications • Timing control − Timing from the FPGA/acquisition controls the timing/loop rate of the host VI, and vice-versa • Synchronized Data Transfer − Synchronization transfers/streams data from acquisition to host VI for processing and logging − Lossless data transfer ni.com/training
  • 7. Synchronization Methods • Direct Memory Access (FIFO) • Interrupts • Handshaking ni.com/training
  • 8. C. Direct Memory Access (DMA) FIFOs Data Buffering • To transfer larger amounts of data at high rates between the target and the host you must buffer your data. • The best way to buffer data is by using Direct Memory Access (DMA) data transfer methods. ni.com/training
  • 9. Direct Memory Access (DMA) FIFOs (continued) • Transfers data from FPGA directly to memory on the RT controller through bus mastering. • Streams large amounts of data. • Provides better performance than using local FIFO and reading indicators. • Host processes data while FPGA transfers data to host memory. • Without DMA, processor must read data. • Consists of two parts—FIFO part and host part. • FPGA writes data one element at a time to the FPGA memory. • DMA engine transfers data along PCI bus to host memory. ni.com/training
  • 10. Demonstration: Target-to-Host DMA FIFO Explore how the FPGA transfers data to the host. GOAL <Exercises>LabVIEW FPGADemonstrations ni.com/training
  • 11. Demonstration: Host-to-Target DMA FIFO Explore how the host transfers data to the FPGA. GOAL <Exercises>LabVIEW FPGADemonstrations ni.com/training
  • 12. Creating DMA FIFOs • Create DMA FIFO the same way as FPGA FIFOs − Right-click target − Select New»FIFO − Choose Target to Host or Host to Target as Type • All DMA FIFOs are U32 data type − Must convert to and from U32. ni.com/training
  • 13. Writing Data to a Target-to-Host DMA FIFO Drag FIFO from Project Explorer window. ni.com/training
  • 14. Writing Data to a Target-to-Host DMA FIFO (continued) FIFO Write Function • Element—Inputs the data element to be stored. • Timeout—Inputs the number of clock ticks the function waits for available space in the FIFO if the FIFO is full. The default is 0, or no wait. A value of –1 prevents the function from timing out. • Timed Out?—Returns True if space in the FIFO is not available before the function completes execution. − If Timed Out? is True, the function does not add Element to the FIFO. ni.com/training
  • 15. Reading Data from a Target-to-Host DMA FIFO Read a DMA FIFO in the host: 1. Open a reference to the FPGA 2. Add an Invoke Method function 3. Choose the DMA FIFO»Read method ni.com/training
  • 16. Reading Data from a Target-to-Host DMA FIFO (continued) Read a DMA FIFO on the host: • Number of Elements − Function completes when elements are read or timeout is reached − Same overhead regardless of the number of elements; read more elements if host is too slow • Timeout—Time to wait before timeout (–1 = indefinite wait; Default is 5,000 ms) ni.com/training
  • 17. DMA FIFO with Blocking Implementing a DMA FIFO with blocking: • User specifies number of elements • Best method when input/output rate is known ni.com/training
  • 18. DMA FIFO with Polling Implementing a DMA FIFO with polling: • Acquires as many samples as are currently available • Best when the input/output rate is unknown ni.com/training
  • 19. Writing Multiple Channels Writing multiple channels of data to a DMA FIFO by interleaving ni.com/training
  • 20. Reading Multiple Channels Reading multiple channels from a DMA FIFO in the host ni.com/training
  • 21. D. Lossless Data Transfer • Lossless Application • Overflow—DMA Full? • Underflow—Check for –50400 ni.com/training
  • 22. Overflow Overflow—too many data points for buffer, may lose data • Acquire data slower • Increase number of elements to read on the host • Increase the rate that the host reads data • Increase buffer sizes on FPGA and host ni.com/training
  • 23. Demonstration: Target to Host DMA FIFO – Overflow Explore how overflow of the DMA FIFO occurs if the RT host VI is too complex. GOAL <Exercises>LabVIEW FPGADemonstrations ni.com/training
  • 24. Underflow Underflow—not enough data to read, FIFO read times out • Increase timeout • Read data less often • Read smaller sets of elements • ni.com/training
  • 25. Demonstration: Target to Host DMA FIFO – Underflow Explore how underflow occurs when the DMA FIFO tries to read data before it is available. GOAL <Exercises>LabVIEW FPGADemonstrations ni.com/training
  • 26. Exercise 7-1: DMA-Based Data Transfers Observe how DMA-based handshaking works. GOAL ni.com/training
  • 27. E. Interrupts • Send a trigger from the target to the host application. • Why use an interrupt? − Eliminate polling − Allow host to perform other operations while waiting for the Interrupt signal • Communicate over a physical hardware line ni.com/training
  • 28. Advantages of Interrupts • An interrupt requires execution of a low-level driver on the host, so a host can process more polling operations/s than interrupts/s • Comparison statistics for a Networked RIO Device: − A single poll requires 10 s − An interrupt requires about 250 s • Use Interrupts when FPGA sends data less often and host must do other processing ni.com/training
  • 29. Implementing an Interrupt ni.com/training
  • 30. Implementing an Interrupt (continued) Interrupt Express VI • IRQ Number − Specifies which logical interrupt (0 – 31) to assert − Default is 0 • Wait Until Cleared − Specifies if this VI waits until the host VI acknowledges the logical interrupt − Default is False • Wait Until Cleared as True causes jitter due to dependency upon the host VI ni.com/training
  • 31. Host and Interrupts • Host must acknowledge interrupts • Use Wait on IRQ and Acknowledge IRQ methods − IRQ Number(s)—specifies the logical interrupt or array of logical interrupts for which the function waits − Timeout (ms)—specifies the number of milliseconds the VI waits before timing out. –1 = infinite timeout − Timed Out—returns TRUE if this method has timed out − IRQ(s) Asserted—returns the asserted interrupts. Empty or –1 array indicates that no interrupts were received ni.com/training
  • 32. Acknowledge IRQ Method • Acknowledges and resets to the default value any interrupts that occur − Wire after the Wait on IRQ method − IRQ Number(s) specifies the logical interrupt or array of logical interrupts for which the function waits ni.com/training
  • 33. Interrupt Example ni.com/training
  • 34. DMA FIFO with Interrupts Implementing a DMA FIFO with an interrupt • Prevents the CPU from polling the DMA FIFO to see if elements have arrived − Least resource intensive DMA FIFO transfer method − Slowest DMA FIFO transfer method due to IRQ delay ni.com/training
  • 35. Exercise 7-2: Interrupt-Based Handshaking Observe an example of how interrupt-based handshaking works. GOAL ni.com/training
  • 36. F. Handshaking Handshaking—Checks that a receiving device is ready to receive or a transmitting device is ready to transmit • Handshaked synchronization—occurs when two or more devices act in sequence • Host uses Boolean controls and indicators (data available and data read flags) on the target to coordinate operations • Requires polling • Assures that all data that is sent is also received ni.com/training
  • 37. Handshaking Process 1. FPGA acquires data and writes values to Array 2. FPGA writes True to Data Available 3. When Data Available is True, host reads data 4. After reading data, host writes True to Data Read 5. FPGA loop iterates when Data Read is True ni.com/training
  • 38. Quiz 1. Which of the following are 2. What error are you likely methods of transferring to get if you create a DMA data from the target to the FIFO that is too small? host? a. Underflow a. Handshaking b. Overflow b. Target-scoped FIFO c. Evenflow c. Interrupt d. DMA FIFO e. FTP ni.com/training
  • 39. Quiz 3. What happens when a 4. Which technique requires DMA FIFO has an the host VI to use polling? underflow condition? a. Handshaking a. The FPGA resets b. Interrupts b. The FIFO Read throws c. DMA FIFO Error –50400 c. The Timed Out? indicator latches true ni.com/training