Arria® 10 and Cyclone® 10 GX Avalon® Memory-Mapped (Avalon-MM) Interface for PCI Express* User Guide

ID 683724
Date 4/13/2024
Document Table of Contents

13.3. Avalon-MM Test Driver Module

The BFM driver module, altpcietb_bfm_driver_downstream.v is configured to test the DMA example Endpoint design. The BFM driver module configures the Endpoint Configuration Space registers and then tests the example Endpoint DMA channel. This file is in the <variation_name>_tb/altera_pcie_<dev>_tbed_<quartus_ver>/sim/ directory.

The BFM test driver module performs the following steps in sequence:

  1. Configures the Root Port and Endpoint Configuration Spaces, which the BFM test driver module does by calling the procedure ebfm_cfg_rp_ep, which is part of altpcietb_bfm_configure.
  2. Finds a suitable BAR to access the example Endpoint design Control Register space. Either BARs 2 or 3 must be at least a 256-byte memory BAR to perform the DMA channel test. The find_mem_bar procedure in the altpcietb_bfm_driver_avmm does this.
  3. If a suitable BAR is found in the previous step, the driver performs the following tasks:
    1. DMA read—The driver programs the DMA to read data from the BFM shared memory into the Endpoint memory. The descriptor control fields specify for the DMA to issue an MSI when the last descriptor has completed.
    1. DMA write—The driver programs the DMA to write the data from its Endpoint memory back to the BFM shared memory. The descriptor control fields are specified so that the DMA completes the following steps to indicate transfer completion:
      • The DMA issues an MSI when the last descriptor has completed.
      • The data written back to BFM is checked against the data that was read from the BFM.
      • The driver programs the DMA to perform a test that demonstrates downstream access of the DMA Endpoint memory.
Note: Edit this file if you want to add your own custom PCIe transactions. Insert your own custom function after the find_mem_bar function. You can use the functions in the BFM Procedures and Functions section.