Programming Example – Metric Counter

Zynq UltraScale+ Device Technical Reference Manual (UG1085)

Document ID
UG1085
Release Date
2023-12-21
Revision
2.4 English

This example lists the steps used to program the DDR APM to count the number of bytes read from the DDR memory by the DisplayPort controller. The DisplayPort controller accesses DDR memory using the XPI port (slot) 3 as shown in This Figure.

APM metric counter 7 is used for this example. All programming registers are in the APMDDR register set.

1.Configure metric counter 7 to the XPI port (slot) 3. Write 011b to the MSR_1 [MET_CT7_SLOT] bit field.

2.Select the read-byte count metric. Write 011b to the MSR_1 [MET_CT7_SEL] bit field.

3.Enable the metric counter. Write 1 to the CR [MET_CNT_EN] bit.

4.Set the sample interval time. Write 32'h000 to SIR [SMPL_INTRVL_SIR] bit field.

5.Load the sample interval time value into the APM counter. Write 1 to the SICR [LOAD] bit.

6.Disable the down counter. Write 0 to SICR [ENABLE] bit.

7.Reset and enable the down counter. Write 9'h101 to SICR: [MET_CNT_RST] = 1, [LOAD] = 0, [ENABLE] = 1.

8.Get the byte count from metric counter 7. Read MCR_7 [MET_CT].