8. DDR performance monitor (DDRPERFM)

8.1 Introduction

The DDRPERFM is intended to monitor DDR controller performance by counting events from a set of signals and gathering results under software control. The DDRPERFM can be used to feedback important statistics such as the DDR utilization, read/write bandwidth, bank activation, idle state duration for some off-line analysis of the DDR system performance and for optimal parameter settings to improve the DDR utilization and for power optimization.

8.2 Features

8.3 Block diagram

Figure 26. DDRPERFM block diagram

Block diagram of the DDRPERFM showing internal components like Signal Set Selection, Time Counter, Evt Counter0, Evt Counter7, APB interface, and Overflow detection, with external connections for DDRCTRL signals, clock, and APB.

The diagram illustrates the internal structure of the DDRPERFM block. It features a 'Signal Set Selection' block at the top, which receives multiple 'DDRCTRL perf_monitoring and DFI signals' (indicated by dashed arrows and ellipses). Below this are three counter blocks: 'Time Counter', 'Evt Counter0', and 'Evt Counter7'. The 'Time Counter' is clocked by 'ck_ddrc'. All three counters output 32-bit data (indicated by '32' with a slash) to an 'APB interface' block. The 'APB interface' is connected to an external 'APB' bus. An 'Overflow detection' block monitors the counters and produces an output signal 'ddrperfm_it'. The entire assembly is labeled 'DDRPERFM' in the bottom right corner. A reference code 'MSv46527V1' is located at the bottom right of the diagram area.

Block diagram of the DDRPERFM showing internal components like Signal Set Selection, Time Counter, Evt Counter0, Evt Counter7, APB interface, and Overflow detection, with external connections for DDRCTRL signals, clock, and APB.

8.4 Functional description

The DDRPERFM provides information of how efficiently the DDR controller is working by reporting statistics according to the set of signals selected for monitoring.

Up to 4 signals from 4 sets of signals along with one permanent clock counter can be monitored.

The counters are started and stopped by software.

All the counters stop when one counter saturates. (The quickest it can saturate is 8.05 seconds with 533 MHz DDR)

The counters may be halted without resetting them to suspend counting.

Useful composite statistics can be derived from counter values; This information can be used by developers to tune the DDR controller settings. For example to optimize the DDR utilization or to improve the low-power mode settings.

Table 27. DDRPERFM signal sets

SetCNT0CNT1CNT2CNT3
0perf_op_is_rdperf_op_is_wrperf_op_is_activatectl_idle
1perf_hpr_req_with_no_creditperf_lpr_req_with_nocreditReservedcactive_ddrc
2perf_op_is_enter_powerdowndownperf_op_is_refreshperf_selfref_modedfi_lp_req
3perf_hpr_xact_when_criticalperf_lpr_xact_when_criticalperf_wr_xact_when_criticaldfi_lp_req

The signals are described hereafter:

perf_op_is_rdAsserted for every read that is issued for commands going through CAM
perf_op_is_wrAsserted for every write that is issued for commands going through CAM.
perf_op_is_activateAsserted for every activate that is issued for commands going through CAM
ctl_idleAsserted when the controller is idle for extended periods and only when there are no commands or data on the DFI interface.
perf_hpr_req_with_nocreditAsserted when there is a High Priority Read (HPR) request (from XPI to PA) not served due to no available credit.
perf_lpr_req_with_nocreditAsserted when there is a Low Priority Read (LPR) request (from XPI to PA) not served due to no available credit.
cactive_ddrcDDRC Hardware Low-power clock active. Indicates that the DDRC requires its clock signal.
perf_op_is_enter_powerdownAsserted for every entry into Power down mode
perf_op_is_refreshAsserted for every refresh command that is issued by the controller.
perf_selfref_modeAsserted for the entire duration for which the controller stays in Self-Refresh mode.
perf_hpr_xact_when_criticalAsserted for every High Priority Read transaction that is scheduled when the High Priority queue is in critical state.
perf_lpr_xact_when_criticalAsserted for every Low Priority Read transaction that is scheduled when the Low Priority queue is in critical state.
perf_wr_xact_when_criticalAsserted for every write transaction that is scheduled when the write queue is in critical state.
dfi_lp_reqDFI low-power opportunity request. This signal is used by the controller to inform the PHY of an opportunity to switch to a low-power mode.

8.5 Application information

8.5.1 Signal set 0: to monitor the DDR utilization

By counting the read and write commands sent to DDR over a time window, can be monitored:

Note: The DDR efficiency is measured by the ratio of read and write count to the time where the DDR is not idle.

Example:

read_bandwidth (Mbyte/sec) ~= 4 * BL * freq * CNT0/TCNT
write_bandwidth (Mbyte/sec) ~= 4 * BL * freq * CNT1/TCNT
DDR_utilization = (BL/2) * (CNT0 + CNT1)/TCNT
with
    BL = 8
    freq = 533 MHz

The ratio of activate commands to the total of read and write commands is providing information about the bank conflict efficiency, this information can be used to select the best memory access pattern between the bank sequential or the bank interleaved.

8.5.2 Signal set 1: to monitor the HPR and LPR stores

By counting the durations where the DDRC stores are out-of-credit to fine tune the DDRCTRL scheduling and performance control:

These settings are controlled by DDRCTRL_SCHED, DDRCTRL_SCHED1, DDRCTRL_HPR1, DDRCTRL_LPR1, DDRCTRL_WR1 registers.

8.5.3 Signal set 2: to monitor the refresh and self-refresh duration

The refresh commands are sent at regular intervals when the DDR is not in self-refresh. Monitoring the PowerDown commands sent when the DDR is idle, can be used to fine tune the low-power settings controlled by DDRCTRL_PWRCTRL and DDRCTRL_PWRTMG.

8.5.4 Signal set 3: to monitor the DDR stalling

By counting the duration where any DDRC store is in critical state, it is possible to fine tune the DDRCTRL scheduling and performance control.

The queue goes to critical state when the starvation counters time out

These settings are controlled by DDRCTRL_PCFGR/W, DDRCTRL_PCFGQOS, DDRCTRL_CFGWQOS registers for each port.

8.6 DDRPERFM registers

8.6.1 DDRPERFM control register (DDRPERFM_CTL)

Address offset: 0x000

Reset value: 0x0000 0000

Note: Write-only register. A read request returns all zeros.

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.STOPSTART
ww

Bits 31:2 Reserved, must be kept at reset value.

Bit 1 STOP: stop all the counters.

0: writing a '0' has no effect.

1: writing a '1' stops all the counters

Writing a '1' when the counters are stopped (DDRPERFM_STATUS.BUSY = 0) is ignored

Bit 0 START: Start counters which are enabled, the time counter (TCNT) is always enabled.

0: writing a '0' has no effect.

1: writing a '1' Starts counters which are enabledW

writing a '1' when the counters are running (DDRPERFM_STATUS.BUSY = 1) is ignored

Caution: A simultaneous write of START and STOP bits at '1' has an unpredictable effect.

8.6.2 DDRPERFM configurationl register (DDRPERFM_CFG)

Address offset: 0x004

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SEL[1:0]
rwrw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.EN[3:0]
rwrwrwrw

Bits 31:18 Reserved, must be kept at reset value.

Bits 17:16 SEL[1:0]: select set of signals to be monitored (from 0 to 3) (see signal set description in Table 27: DDRPERFM signal sets) and counters to be enabled

Bits 15:4 Reserved, must be kept at reset value.

Bits 3:0 EN[3:0]: enable counter x (from 0 to 3)

0: the corresponding counter is disabled and does not increment

1: the corresponding counter is enabled and incremented on event at each clock

Note: The time counter (TCNT) is enabled by default.

Caution: The DDRPERFM_CFG can be modified only when the DDRPERFM is stopped.
A write to this register is ignored when DDRPERFM_STATUS.BUSY = 1

8.6.3 DDRPERFM status register (DDRPERFM_STATUS)

Address offset: 0x008

Reset value: 0x0000 0000

31302928272625242322212019181716
TOVFRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.BUSY
rr
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.COVF[3:0]
rrrr

Bit 31 TOVF: total counter overflow

Bits 30:17 Reserved, must be kept at reset value.

Bit 16 BUSY: Busy Status

Bits 15:4 Reserved, must be kept at reset value.

Bits 3:0 COVF[3:0]: Counter x Overflow (with x from 0 to 3)

Note: When any counter is in overflow, the DDRPERFM is stopped with all the counters keeping their value, the DDRPERFM needs a restart after overflowing counter has been cleared.

The counter overflow is also visible also by reading DDRPERFM_CNTx = 0xFFFF_FFFF

8.6.4 DDRPERFM counter clear register (DDRPERFM_CCR)

Address offset: 0x00C

Note: Write-only register. A read request returns all zeros

Reset value: 0x0000 0000

31302928272625242322212019181716
TCLRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
w
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CCLR[3:0]
wwww

Bit 31 TCLR: time counter clear
0: writing a '0' has no effect
1: writing a '1' clears the time counter

Bits 30:4 Reserved, must be kept at reset value.

Bits 3:0 CCLR[3:0]: counter x Clear (with x from 0 to 3)
0: writing a '0' has no effect
1: writing a '1' clears the corresponding event counter x (with x from 0 to 3)

Note: A write to this register is ignored when DDRPERFM_STATUS.BUSY = 1.

8.6.5 DDRPERFM interrupt enable register (DDRPERFM_IER)

Address offset: 0x010

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OVFIE
rw

Bits 31:1 Reserved, must be kept at reset value.

Bit 0 OVFIE: overflow interrupt enable
0: overflow interrupt disabled
1: overflow interrupt enabled

8.6.6 DDRPERFM interrupt status register (DDRPERFM_ISR)

Address offset: 0x014

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OVFF
r

Bits 31:1 Reserved, must be kept at reset value.

Bit 0 OVFF: overflow flag
This flag is set when one counter is in overflow

8.6.7 DDRPERFM interrupt clear register (DDRPERFM_ICR)

Address offset: 0x018

Note: Write-only register. A read request returns all zeros

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.OVF
w

Bits 31:1 Reserved, must be kept at reset value.

Bit 0 OVF: overflow flag

0: no action

1: clears the overflow flag

Note: Following a counter overflow, the programming sequence must be:

  1. 1) Clear the counter(s) by writing '1' to DDRPERFM_CCR appropriate bits
  2. 2) Clear the interrupt by writing '1' to DDRPERFM_ICR.OVF

8.6.8 DDRPERFM time counter register (DDRPERFM_TCNT)

Address offset: 0x020

Reset value: 0x0000 0000

31302928272625242322212019181716
CNT[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
CNT[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 CNT[31:0]: total time, this is number of DDR controller clocks elapsed while DDRPERFM has been running.

Caution: The time counter must only be read when DDRPERFM is stopped.
This register is read as zero when DDRPERFM_STATUS.BUSY=1.

8.6.9 DDRPERFM event counter x register (DDRPERFM_CNTx)

Address offset: 0x030 + x * 0x008 (x = 0 to 3)

Reset value: 0x0000 0000

31302928272625242322212019181716
CNT[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
CNT[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 CNT[31:0]: event counter value.

Each counter is incrementing when the corresponding signal from the selected set is asserted. See Table 27: DDRPERFM signal sets .

Caution: The counters must only be read when DDRPERFM is stopped.
These registers are read as zero when DDRPERFM_STATUS.BUSY=1.

8.6.10 DDRPERFM hardware configuration register (DDRPERFM_HWCFG)

Address offset: 0x3F0

Reset value: 0x0000 0004

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.NCNT[3:0]
rrrr

Bits 31:4 Reserved, must be kept at reset value.

Bits 3:0 NCNT[3:0]: number of counters for this configuration (4)

8.6.11 DDRPERFM version register (DDRPERFM_VER)

Address offset: 0x3F4

Reset value: 0x0000 0010

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.MAJREV[3:0]MINREV[3:0]
rrrrrrrr

Bits 31:8 Reserved, must be kept at reset value.

ST logo
ST logo

Bits 7:4 MAJREV[3:0]: Major revision number.

Bits 3:0 MINREV[3:0]: Minor revision number.

8.6.12 DDRPERFM ID register (DDRPERFM_ID)

Address offset: 0x3F8

Reset value: 0x0014 0061

31302928272625242322212019181716
ID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
ID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 ID[31:0]: DDRPERFM unique identification.

8.6.13 DDRPERFM magic ID register (DDRPERFM_SID)

Address offset: 0x3FC

Reset value: 0xA3C5 DD01

31302928272625242322212019181716
SID[31:16]
rrrrrrrrrrrrrrrr
1514131211109876543210
SID[15:0]
rrrrrrrrrrrrrrrr

Bits 31:0 SID[31:0]: magic ID for automatic IP discovery.

8.6.14 DDRPERFM register map

Table 28. Power control register map and reset values

OffsetRegister313029282726252423222120191817161514131211109876543210
0x000DDRPERFM_CTLRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.STOPSTART
Reset value000
0x004DDRPERFM_CFGRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.SEL[1:0]Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.EN[3:0]
Reset value000000
0x008DDRPERFM_STATUSTCLRTOVFRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.BUSYRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.COVF[3:0]
Reset value0000000
0x00CDDRPERFM_CCRTCLRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CCLR[3:0]
Reset value00000

Table 28. Power control register map and reset values (continued)

OffsetRegister313029282726252423222120191817161514131211109876543210
0x010DDRPERFM_IERResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResOVFIE
Reset value0
0x014DDRPERFM_ISRResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResOVFF
Reset value0
0x018DDRPERFM_ICRResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResOVF
Reset value0
0x01CReservedResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes
0x020DDRPERFM_TCNTCNT[31:0]
Reset value00000000000000000000000000000000
0x024 - 0x02CReservedResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes
0x030DDRPERFM_CNT0CNT[31:0]
Reset value00000000000000000000000000000000
0x034ReservedResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes
0x038DDRPERFM_CNT1CNT[31:0]
Reset value00000000000000000000000000000000
0x03CReservedResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes
0x040DDRPERFM_CNT2CNT[31:0]
Reset value00000000000000000000000000000000
0x044ReservedResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes
0x048DDRPERFM_CNT3CNT[31:0]
Reset value00000000000000000000000000000000
0x04C - 0x3ECReservedResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResRes
0x3F0DDRPERFM_HWCFGResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResNCNT[3:0]
Reset value0 1 0 0
0x3F4DDRPERFM_VERResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResResMAJREV[3:0]
MINREV[3:0]
Reset value0 0 0 1 0 0 0 0
0x3F8DDRPERFM_IDID[31:0]
Reset value00000000001010000000000001100001
0x3FCDDRPERFM_SIDSID[31:0]
Reset value10100011110001011101110100000001

Refer to Section 2.5 on page 159 for the register boundary addresses.