Intel® Quartus® Prime Pro Edition User Guide: Debug Tools

ID 683819
Date 12/12/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

8.5.5. Using the Monitor Service

The monitor service builds on top of the host service to allow reads of Avalon® memory-mapped interface agents at a regular interval. The service is fully software-based. The monitor service requires no extra soft-logic. This service streamlines the logic to do interval reads, and it offers better performance than exercising the host service manually for the reads.

Monitor Service

  1. Determine the host and the memory address range that you want to poll:
    set master_index     0
    set master [lindex [get_service_paths master] $master_index]
    set address          0x2000
    set bytes_to_read    100
    set read_interval_ms 100

    With the first host, read 100 bytes starting at address 0x2000 every 100 milliseconds.

  2. Open the monitor service:
    set monitor [lindex [get_service_paths monitor] 0]
    set claimed_monitor [claim_service monitor $monitor mylib]

    The monitor service opens the host service automatically.

  3. With the monitor service, register the address range and time interval:
    monitor_add_range $claimed_monitor $master $address $bytes_to_read
    monitor_set_interval $claimed_monitor $read_interval_ms
  4. Add more ranges, defining the result at each interval:
    global monitor_data_buffer
    set monitor_data_buffer [list]
  5. Gather the data and append it with a global variable:
    proc store_data {monitor master address bytes_to_read} {\
      global monitor_data_buffer
    # monitor_read_data returns the range of data polled from the running \
      design as a list
    #(in this example, a 100-element list).
      set data [monitor_read_data $claimed_monitor $master $address \
      $bytes_to_read]
    # Append the list as a single element in the monitor_data_buffer \
      global list.
      lappend monitor_data_buffer $data
    }
    Note: If this procedure takes longer than the interval period, the monitor service may have to skip the next one or more calls to the procedure. In this case, monitor_read_data returns the latest polled data.
  6. Register this callback with the opened monitor service:
    set callback [list store_data $claimed_monitor $master $address $bytes_to_read]
    monitor_set_callback $claimed_monitor $callback
  7. Use the callback variable to call when the monitor finishes an interval. Start monitoring:
    monitor_set_enabled $claimed_monitor 1

    Immediately, the monitor reads the specified ranges from the device and invokes the callback at the specified interval. Check the contents of monitor_data_buffer to verify this. To turn off the monitor, use 0 instead of 1 in the above command.