Notes on “Xilinx Zynq-7000 Embedded System Design and Implementation” 91 Situations where DDRI can perform arbitration
Imagine this: when ten cars rush towards a toll booth at the same time, how does the toll collector decide who goes first? Should the car that has been waiting the longest go first? Or should the ambulance be prioritized? Or should a convoy heading to the same destination be allowed to pass together?The DDRI arbiter of ARM Cortex acts as this “smart toll collector”, determining which memory requests can enter the DDR controller first. This article will analyze its three major decision rules using real cases:Wait Time, Urgency, Page Hit.
âïļ What is an Arbiter? Why do we need it?
In ARM systems, multiple master devices (CPU cores, GPU, DMA controllers, etc.) simultaneously issue memory requests to the DDR controller.The DDRI arbiter is responsible for selecting the highest priority request from these conflicting requests and sending it to the DDRC scheduler for processing. Without an arbitration mechanism:
- Low-priority devices may experience “starvation” (e.g., DMA transfers being continuously preempted by the CPU)
- Frequent memory row switching can lead to a performance drop (each switch adds a delay of 30~50ns)
Rule One: Wait Time – Give the “Longest Waiting” Request a Green Light
Principle: Each request starts timing when it enters the queue, and if it is not processed for a long time, its priority is automatically increased.
ð Real Case: GPU Memory Access on Raspberry Pi 4
- Scenario The VideoCore GPU of Raspberry Pi 4 continuously reads from video memory (located in LPDDR4), while the CPU cores perform AI inference calculations.
- Conflict The CPU issues a burst of weight read requests, blocking the GPU’s frame data requests.
- Arbitration Decision
<span><span><span>// Pseudocode: Wait Time Weight Calculation </span></span></span><span><span><span>if</span></span></span><span><span><span>(</span></span></span><span><span><span>request</span></span></span><span><span><span>.</span></span></span><span><span><span>wait_time </span></span></span><span><span><span>></span></span></span><span><span><span> THRESHOLD</span></span></span><span><span><span>)</span></span></span><span><span><span>{</span></span></span><span><span><span> priority </span></span></span><span><span><span>+=</span></span></span><span><span><span> WAIT_BOOST</span></span></span><span><span><span>;</span></span></span><span><span><span>// </span><span>Increase priority for timed-out requests </span></span></span><span><span><span>}</span></span></span>
ðĄ Key Value: In Cortex-A72, the timeout threshold is typically150~300ns (about 50~100 clock cycles).
Rule Two: Urgency – Open the VIP Lane for “Life-Saving Tasks”
Principle: The urgency of requests is identified through the QoS (Quality of Service) signal on the AXI bus (e.g., 0=lowest, 3=highest).
ð Real Case: Brake Signal Processing in Automotive ESP Systems
- Scenario In the Bosch ESP controller based on Cortex-R5:
- High Priority Brake sensor data writing (QoS=3, real-time requirement <10Ξs)
- Low Priority Fault log writing to SD card cache (QoS=0)
- Burst Conflict When ABS is triggered, sensor data floods in.
- Arbitration Decision
<span><span><span>// Pseudocode: Urgency Priority Logic </span></span></span><span><span>if</span></span><span><span>(</span></span><span><span>request_A</span></span><span><span>.</span></span><span><span>qos </span></span><span><span>></span></span><span><span> request_B</span></span><span><span>.</span></span><span><span>qos</span></span><span><span>)</span></span><span><span>{</span></span><span><span> select request_A</span></span><span><span>;</span></span><span><span><span>// Select the request with higher QoS </span></span></span><span><span>}</span></span>
â ïļ Note: Misuse of high QoS can lead to system imbalance (e.g., Linux kernel default QoS=0).
Rule Three: Page Hit – Allow “Readers of the Same Book” to Avoid Changing Shelves
Principle: DDR memory consists of multipleBanks (shelves) andRows (shelf layers). If a new request has the sameRow Address as the currently open one, there is no need to switch rows (avoiding tRCD delay).
ð Real Case: Frame Buffer Optimization in Hisilicon Hi3519 Video Encoder
- Scenario When processing 1080P video, the ISP module reads image data row by row
<span><span>Address Sequence:</span></span><span><span>Row1_Col1</span></span><span><span>â</span></span><span><span>Row1_Col2</span></span><span><span>â</span></span><span><span>...</span></span><span><span>â</span></span><span><span>Row1_Col1920</span></span>
<span><span><span>// Pseudocode: Page Hit Detection </span></span></span><span><span>if</span></span><span><span>(</span></span><span><span>current_bank </span></span><span><span>==</span></span><span><span> new_bank </span></span><span><span>&&</span></span><span><span> current_row </span></span><span><span>==</span></span><span><span> new_row</span></span><span><span>)</span></span><span><span>{</span></span><span><span> priority </span></span><span><span>+=</span></span><span><span> PAGE_HIT_BONUS</span></span><span><span>;</span></span><span><span><span>// Page hit bonus points </span></span></span><span><span>}</span></span>
ð Data Comparison:
Request Pattern Average Latency Bandwidth Utilization Random Access 45ns 65% After Page Hit Optimization 32ns 85%
How do the Three Rules Work Together?
The actual arbitration uses a weighted scoring system:
Overall Priority = Wait Time Weight à 0.4 + QoS Level à 0.5 + Page Hit Bonus à 0.1
ð Collaborative Case: Multi-Task Competition in Drone Flight Control Systems
- Devices
- Gyroscope DMA (QoS=2, waiting 100ns, page hit)
- Camera Capture (QoS=3, waiting 50ns, page miss)
- WiFi Data Transmission (QoS=1, waiting 200ns, page hit)
- Arbitration Calculation
- Gyroscope Score =
<span><span>100Ã0.4 + 2Ã0.5 + 1Ã0.1 = 41.1</span></span> - Camera Score =
<span><span>50Ã0.4 + 3Ã0.5 + 0Ã0.1 = 21.5</span></span> - WiFi Score =
<span><span>200Ã0.4 + 1Ã0.5 + 1Ã0.1 = 80.6</span></span>
How Can Developers Configure Arbitration Strategies?
In ARM chips, parameters can be adjusted through registers (taking NXP i.MX8 as an example):
// Set wait time threshold (priority increases beyond this value) MMDC_ArbiterCtrl0.THOLD =0x80;// 128 clock cycles // Configure QoS weight (0-7, higher values indicate greater weight) MMDC_QoS_WEIGHT.w_qos_weight =0x3;// Set QoS weight to medium // Enable page hit optimization MMDC_ArbiterCtrl0.PAGE_POLICY =1;// 1= prioritize page hit requests
Three Practical Tips for Beginners
-
Real-time tasks must set QoS
<span><span><span>// </span><span>Set QoS level when initiating requests on AXI </span></span></span><span><span><span>AXI_Request</span></span></span><span><span><span>.</span></span></span><span><span><span>qos </span></span></span><span><span><span>=</span></span></span><span><span><span>3</span></span></span><span><span><span>;</span></span></span><span><span><span>// </span><span>Highest urgency</span></span></span>-
Avoid “Long Wait Chains”:
- Incorrect: Allow low-priority tasks to continuously issue a large number of requests
- Correct: Use burst transfers to merge small requests (reducing arbitration frequency)
Optimize Memory Layout for Page Hit Rate:
- Place related data (e.g., image rows) in the same Bank but different Rows
- Separate data (e.g., audio/video) into different Banks
Conclusion: The Art of Balance
The DDRI arbiter is like a wise traffic commander:
- Wait Time Rule embodies fairness – “No vehicle should be left stranded forever”
- Urgency Rule ensures critical tasks – “Ambulances always have priority”
- Page Hit Rule enhances efficiency – “Let passengers going to the same floor share the elevator”
Understanding these three rules will help you tame the DDR bandwidth bottleneck in embedded development, allowing ARM systems to run faster and more stably.
