Microcontroller bus arbitration method and device based on Round-Robin algorithm

By employing the Round-Robin algorithm and pointer masking, the unfairness of bus arbitration in microcontroller systems is resolved, enabling reasonable allocation and efficient transmission of bus resources. This method is applicable to various microprocessor architectures.

CN121478682APending Publication Date: 2026-02-06NO 47 INST OF CHINA ELECTRONICS TECH GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511535051.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-02-06

AI Technical Summary

Technical Problem

In microcontroller systems, when multiple master devices simultaneously request access to slave devices, bus contention issues make it difficult to allocate bus arbitration efficiently and reliably. Some devices may occupy the system bus for extended periods, affecting data transmission to other devices.

Method used

The system employs the Round-Robin algorithm combined with pointer calculation and masking to process bus requests through arbitration pointers and masks, dynamically controlling bus priority and implementing a bus arbitration device, including an arbitration request processing module, a Round-Robin arbitrator, and an arbitration result processing module.

Benefits of technology

It achieves reasonable allocation of bus resources, prevents a single device from occupying the bus for a long time, improves bus transmission efficiency and compatibility, and is suitable for various microprocessor architectures.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121478682A_ABST
    Figure CN121478682A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computer application, in particular to a microcontroller bus arbitration method and device based on a Round-Robin algorithm. According to the method and the device, an arbitration result is generated through pointer calculation in combination with a mask mode. The device comprises a multi-bus input interface, an internal interconnection matrix, a Round-Robin bus arbitration module and a slave device bus output interface. According to the method, priority data transmission of bus arbitration can be better processed and controlled, the situation that transmission of other buses is shelved due to the fact that a certain single high-priority channel suddenly occurs or occupies a system bus for a long time is prevented, and resources of bus allocation and data transmission are controlled in a more reasonable and efficient mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer application technology, and in particular to a microcontroller bus arbitration method and apparatus based on the Round-Robin algorithm. Background Technology

[0002] The Round-Robin algorithm, also known as round-robin scheduling, is based on the principle of "dynamic and equal opportunity." It ensures that each requester gets a turn to access the bus, preventing some requesters from monopolizing it for extended periods. Unlike fixed priorities, the priority in the Round-Robin algorithm changes dynamically; a requester that was granted priority in the previous round will have its priority reduced to the lowest in the next round.

[0003] Bus arbitration is crucial in microcontroller systems where bus matrices typically integrate multiple master and slave devices. These devices require efficient and reliable data communication via a shared on-chip bus. In a microcontroller system, when multiple master devices simultaneously request access to a single slave device, bus contention arises. Therefore, a bus arbitrator is needed to arbitrate these requests. Summary of the Invention

[0004] This invention proposes a microcontroller bus arbitration method and apparatus based on the Round-Robin algorithm. The method and apparatus generate the arbitration result through pointer calculation combined with a masking method. The method and apparatus include: a multi-bus input interface, an internal interconnect matrix, a Round-Robin bus arbitration module, and a slave device bus output interface. This invention can better handle and control the priority data transmission of bus arbitration, preventing a single high-priority channel from suddenly or for an extended period of time occupying the system bus, thus avoiding the suspension of transmissions on other buses. It controls bus allocation and data transmission resources in a more rational and efficient manner.

[0005] The technical solution adopted by the present invention to achieve the above objectives is as follows:

[0006] A microcontroller bus arbitration method based on the Round-Robin algorithm is proposed. In a bus matrix with multiple bus masters, the Round-Robin algorithm is used to generate external priority control signals to dynamically control the bus transmission within the internal bus matrix. The method includes the following steps:

[0007] 1) Initialize the arbitration pointer. Calculate the arbitration pointer based on the arbitration result Grant generated by the previous clock trigger, and generate a mask based on the position pointed to by the arbitration pointer.

[0008] 2) When a master device sends a channel request Req, the mask is calculated by comparing it with the current request to obtain the request mask MaskReq;

[0009] 3) Process the request mask MaskReq to obtain a valid bus grant MaskGrant;

[0010] 4) Process the channel request (Req) to obtain the bus authorization (UnmaskGrant);

[0011] 5) Select either a valid bus grant MaskGrant or a bus grant UnmaskGrant based on the request mask MaskReq as the final arbitration result, which serves as the external priority control signal.

[0012] Step 1) specifically refers to:

[0013] The arbitration pointer points to the high 1 bit of the previous arbitration result. If the high 1 bit is 1 at this time, it points to the low 1 bit of the previous arbitration result, sets the value of the bit pointed to by the pointer and the bits above it to 1, and sets the value of the bits below the pointer to 0.

[0014] Step 2) specifically refers to:

[0015] Perform a bitwise AND operation between the mask and the current input channel request Req to obtain MaskReq.

[0016] Step 3) specifically refers to:

[0017] Keep the least significant bit in MaskReq that is 1, and set the other bits to zero to obtain MaskGrant.

[0018] Step 4) specifically involves:

[0019] Keep the least significant bit in Req that is 1, and set the other bits to zero to get UnmaskGrant.

[0020] Step 5) specifically involves:

[0021] Determine if MaskReq is all zeros. If MaskReq is not all zeros, then use MaskGrant as the arbitration result; otherwise, use UnmaskGrant as the arbitration result.

[0022] A microcontroller bus arbitration device based on the Round-Robin algorithm includes:

[0023] The arbitration request processing module is used to receive channel requests (Req).

[0024] The Round-Robin arbitrator is used to arbitrate channel requests (Req) and generate arbitration results.

[0025] The arbitration result processing module is used to process the one-hot code format arbitration result generated by the arbitration into an external priority control signal.

[0026] The present invention has the following beneficial effects and advantages:

[0027] 1. This invention uses arbitration pointers and calculation masks, which is simple to implement and can quickly calculate the current arbitration result based on the previous arbitration result and the current bus input request.

[0028] 2. The Round-Robin arbitrator of the present invention can be configured with different parameters according to different functional requirements, which is highly flexible.

[0029] 3. The Round-Robin arbitrator of the present invention is compatible with existing microcontroller system platforms and has good compatibility. Attached Figure Description

[0030] Figure 1 Module block diagram of the present invention in a typical microcontroller bus matrix;

[0031] Figure 2 Internal module structure diagram of the present invention;

[0032] Figure 3 The workflow diagram of this invention. Detailed Implementation

[0033] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.

[0034] This invention relates to a microcontroller bus arbitration method and apparatus based on the Round-Robin algorithm, the structure of which is as follows: Figure 2 As shown, it includes an arbitration request processing module, a Round-Robin arbitrator, and an arbitration result processing module.

[0035] This invention is applicable to various microprocessor architectures, with typical application scenarios such as... Figure 1 As shown, it includes multiple bus master devices, a bus matrix module, a bus matrix external priority control module, and a slave device module.

[0036] A microcontroller bus arbitration method based on the Round-Robin algorithm includes: generating an external priority control signal using the Round-Robin algorithm in a bus matrix for multiple bus master devices, and performing dynamic priority control on the bus transmission of the internal bus matrix.

[0037] The processing method of this Round-Robin controller provides an implementation device, the structure of which is as follows: Figure 2As shown, it includes bus input processing for N channels, generating arbitration requests for the Round-Robin arbitration module;

[0038] The arbitration result of the Round-Robin arbitrator is generated by the microcontroller bus arbitration method and apparatus of the Round-Robin algorithm of the present invention.

[0039] The arbitration result processing module processes the one-hot code format arbitration result generated by the arbitration into an external priority control signal.

[0040] like Figure 3 The flowchart shown below illustrates the specific processing steps of this Round-Robin arbitration method. The detailed implementation process is as follows:

[0041] S101: Initialize the arbitration pointer, using the Grant generated in the previous round, in one-hot code format. Calculate the arbitration pointer, which points to the high 1 bit of the arbitration result from the previous round. For example, if the previous result was 0010, then its high 1 bit is 0100; if the highest bit is 1, it points to the lowest bit. Generate a mask based on the pointer position, with the bits at and above the pointer being 1 and the bits below the pointer being 0.

[0042] S102: Perform a bitwise AND operation between the mask calculated in S101 and the current input channel request Req. The result is denoted as MaskReq.

[0043] S103: Using the MaskReq calculated in S102, take the least significant bit that is 1 and denote it as MaskGrant.

[0044] S104: Use the input channel to request Req, and take the least significant bit that is 1, denoted as UnmaskGrant.

[0045] S105: Determine whether the MaskReq calculated in S102 is all zeros. If MaskReq is not all zeros, use the MaskGrant calculated in S103 as the arbitration result; if MaskReq is all zeros, use the UnmaskGrant calculated in S104 as the arbitration result.

[0046] In a microcontroller bus matrix system, the bus arbitration device, which includes the above steps, has its input signal generated by the master device bus, and its arbitration result is processed and output, connected to the external priority control interface of the bus matrix.

Claims

1. A microcontroller bus arbitration method based on the Round-Robin algorithm, wherein in a bus matrix with multiple bus masters, the Round-Robin algorithm is used to generate external priority control signals to dynamically control the bus transmission of the internal bus matrix, characterized in that, Includes the following steps: 1) Initialize the arbitration pointer. Calculate the arbitration pointer based on the arbitration result Grant generated by the previous clock trigger, and generate a mask based on the position pointed to by the arbitration pointer. 2) When a master device sends a channel request Req, the mask is calculated by comparing it with the current request to obtain the request mask MaskReq; 3) Process the request mask MaskReq to obtain a valid bus grant MaskGrant; 4) Process the channel request (Req) to obtain the bus authorization (UnmaskGrant); 5) Select either a valid bus grant MaskGrant or a bus grant UnmaskGrant based on the request mask MaskReq as the final arbitration result, which serves as the external priority control signal.

2. The microcontroller bus arbitration method based on the Round-Robin algorithm according to claim 1, characterized in that, Step 1) specifically refers to: The arbitration pointer points to the high 1 bit of the previous arbitration result. If the high 1 bit is 1 at this time, it points to the low 1 bit of the previous arbitration result, sets the value of the bit pointed to by the pointer and the bits above it to 1, and sets the value of the bits below the pointer to 0.

3. The microcontroller bus arbitration method based on the Round-Robin algorithm according to claim 1, characterized in that, Step 2) specifically refers to: Perform a bitwise AND operation between the mask and the current input channel request Req to obtain MaskReq.

4. The microcontroller bus arbitration method based on the Round-Robin algorithm according to claim 1, characterized in that, Step 3) specifically refers to: Keep the least significant bit in MaskReq that is 1, and set the other bits to zero to obtain MaskGrant.

5. A microcontroller bus arbitration method based on the Round-Robin algorithm according to claim 1, characterized in that, Step 4) specifically involves: Keep the least significant bit in Req that is 1, and set the other bits to zero to get UnmaskGrant.

6. A microcontroller bus arbitration method based on the Round-Robin algorithm according to claim 1, characterized in that, Step 5) specifically involves: Determine if MaskReq is all zeros. If MaskReq is not all zeros, then use MaskGrant as the arbitration result; otherwise, use UnmaskGrant as the arbitration result.

7. A microcontroller bus arbitration device based on the Round-Robin algorithm, used to implement the microcontroller bus arbitration method based on the Round-Robin algorithm as described in claim 1, characterized in that, include: The arbitration request processing module is used to receive channel requests (Req). The Round-Robin arbitrator is used to arbitrate channel requests (Req) and generate arbitration results. The arbitration result processing module is used to process the one-hot code format arbitration result generated by the arbitration into an external priority control signal.