A method of requesting arbitration and an arbitrator

By using two-dimensional arrays and AND/OR operations, the problem that the polling arbitrator cannot be dynamically changed after the priority is determined is solved, realizing fast arbitration and improved scalability, and ensuring the efficiency and fairness of the arbitrator.

CN115617723BActive Publication Date: 2026-02-27MU XI LING ZHI KE JI (HANG ZHOU) YOU XIAN GONG SI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211310750.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-25
Publication Date
2026-02-27
Estimated Expiration
2042-10-25

AI Technical Summary

Technical Problem

The existing polling arbitrator cannot be dynamically changed after the priority is determined, resulting in poor scalability and an inability to quickly arbitrate the highest priority input request.

Method used

A two-dimensional array is used to represent the priority relationship of the input channels. The highest priority input request is quickly arbitrated through AND and OR operations, and the two-dimensional array is dynamically updated according to the cumulative time of the input request and the user-defined priority relationship.

Benefits of technology

It improves arbitration efficiency, enables dynamic changes after priorities are determined, and enhances the scalability and fairness of the arbitrator.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115617723B_ABST
    Figure CN115617723B_ABST
Patent Text Reader

Abstract

The application relates to a request arbitration method and an arbitrator, and belongs to the technical field of data processing. The request arbitration method comprises the following steps: acquiring a first array representing input requests of each input channel at a current time, the number of elements in the first array being consistent with the number of input channels; and arbitrating an input request with the highest current priority according to the first array and a preset two-dimensional array representing priority relationships of each input channel, wherein the priority relationships of each input channel in the two-dimensional array are configurable, the number of elements in each row or each column of the two-dimensional array is consistent with the number of elements in the first array, and each row or each column of the two-dimensional array represents a priority comparison result of a specified input channel and each input channel. The application no longer adopts a polling mode, but performs arbitration based on the two-dimensional array with the configurable priority relationships of the input channels, so that the defect that the polling method cannot be dynamically changed during polling after the priority is determined is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of data processing technology, specifically relating to a method for requesting arbitration and an arbitrator. Background Technology

[0002] An arbitrator is a circuit that selects one input request from multiple input requests and outputs it based on specific requirements. Its characteristics include both concurrent requests and unique outputs.

[0003] Existing arbitrators often use a polling approach to arbitrate multiple input requests and select those that meet specific requirements. However, existing polling arbitrators suffer from poor scalability because the priority cannot be dynamically changed during the polling period once it is determined. Summary of the Invention

[0004] Therefore, the purpose of this application is to provide a method for requesting arbitration, an arbitrator, an electronic device, and a computer-readable storage medium to improve the problem that existing polling arbitrators cannot dynamically change priorities during the polling period once they are determined.

[0005] The embodiments of this application are implemented as follows:

[0006] In a first aspect, embodiments of this application provide a request arbitration method, comprising: obtaining a first array representing input requests for each input channel at the current moment, wherein the number of elements in the first array is consistent with the number of input channels; arbitrating the input request with the highest current priority based on the first array and a preset two-dimensional array representing the priority relationship of each input channel, wherein the priority relationship of each input channel in the two-dimensional array is configurable, the number of elements in each row or column of the two-dimensional array is consistent with the number of elements in the first array, and each row or column of the two-dimensional array represents the priority comparison result between the specified input channel and each input channel.

[0007] In this embodiment, a two-dimensional array is used to represent the priority relationship of each input channel, and a first array is used to represent the input request of each input channel. This allows the highest priority input request to be quickly arbitrated based directly on the first and two-dimensional arrays during arbitration, which is more efficient than polling. At the same time, instead of polling, arbitration is based on a configurable two-dimensional array of input channel priority relationships, which improves the shortcomings of existing polling methods where the priority cannot be dynamically changed during polling after it is determined.

[0008] In one possible implementation of the first aspect embodiment, the first array is a row vector. Based on the first array and a preset two-dimensional array representing the priority relationship of each input channel, the input request with the highest current priority is arbitrated, including: performing a bitwise AND operation on each row element of the two-dimensional array with the first array according to the corresponding bit position to obtain a first AND result corresponding to each row element; performing an OR operation on each element in the first AND result corresponding to each row element to obtain an OR operation result corresponding to each row element; and arbitrating the input request with the highest current priority based on the OR operation result corresponding to each row element and the first array.

[0009] In this embodiment of the application, when the first array is a row vector, by performing a bitwise AND operation on each row element of the two-dimensional array with the first array and then performing an OR operation on each element in the AND result, the OR operation result corresponding to each row element can be obtained. This allows us to know whether there is a valid request on a channel with a higher priority than our own channel. Combined with the first array representing the input requests of each input channel, the input request with the highest priority at present can be arbitrated.

[0010] In one possible implementation of the first aspect embodiment, arbitrating the input request with the highest current priority based on the OR operation result corresponding to each row element and the first array includes: obtaining a second array based on the OR operation result corresponding to each row element, wherein each element in the second array corresponds to an OR operation result; inverting each element in the second array, and performing a bitwise AND operation between the inverted second array and the first array according to the corresponding bit positions to obtain a second AND result; and determining the input request with the highest current priority based on the second AND result.

[0011] In this embodiment, a second array is used to represent the OR operation result corresponding to each row element. This result is then inverted and ANDed with the first array to quickly obtain the input request with the highest priority. This method is more efficient than polling.

[0012] In one possible implementation of the first aspect embodiment, the first array is a column vector. Based on the first array and a preset two-dimensional array representing the priority relationship of each input channel, the input request with the highest current priority is arbitrated, including: performing a bitwise AND operation on each column element of the two-dimensional array with the first array according to the corresponding bit position to obtain a first AND result corresponding to each column element; performing an OR operation on each element in the first AND result corresponding to each column element to obtain an OR operation result corresponding to each column element; and arbitrating the input request with the highest current priority based on the OR operation result corresponding to each column element and the first array.

[0013] In this embodiment of the application, when the first array is a column vector, by performing a bitwise AND operation on each column element of the two-dimensional array with the first array and performing an OR operation on each element in the AND result, the OR operation result corresponding to each row element can be obtained. This allows us to know whether there is a valid request on a channel with a higher priority than our own channel. Combined with the first array representing the input requests of each input channel, the input request with the highest priority at present can be arbitrated.

[0014] In one possible implementation of the first aspect embodiment, arbitrating the input request with the highest current priority based on the OR operation result corresponding to each column element and the first array includes: obtaining a second array based on the OR operation result corresponding to each column element, wherein each element in the second array corresponds to an OR operation result; performing a bitwise AND operation between the second array and the first array according to the corresponding bit positions to obtain a second AND result; and determining the input request with the highest current priority based on the second AND result.

[0015] In this embodiment, a second array is used to represent the OR operation result corresponding to each column element. Then, the second array and the first array are ANDed to quickly obtain the input request with the highest priority, which is more efficient than the polling method.

[0016] In one possible implementation of the first aspect embodiment, obtaining a first array representing the input requests of each input channel at the current moment includes: obtaining the first array based on the input requests from each input channel at the current moment.

[0017] In this embodiment of the application, a first array is used to represent the input requests of each input channel at the current moment. This allows the highest priority input request to be quickly arbitrated based on the first array and the two-dimensional array representing the priority relationship of each input channel during arbitration.

[0018] In one possible implementation of the first aspect embodiment, after arbitrating the input request with the highest current priority, the method further includes: updating the two-dimensional array according to the cumulative time of the input requests of each input channel, so as to arbitrate the input request with the highest priority among the input requests of each input channel at the next moment based on the updated two-dimensional array; wherein, the larger the cumulative time of the input request, the higher the priority of the corresponding input channel.

[0019] In this embodiment, each input request is assigned a time, and the larger the cumulative time, the higher the priority of the corresponding input channel. This is used to update the two-dimensional array, so that during arbitration, the later input request is prevented from winning before the previous input request, thus ensuring the fairness of instruction execution.

[0020] In one possible implementation of the first aspect embodiment, the method further includes: updating the two-dimensional array according to the cumulative time of input requests for each input channel, wherein the larger the cumulative time of input requests, the higher the priority of the corresponding input channel; and updating the updated two-dimensional array again according to the user-defined priority relationship of each input channel, so as to arbitrate the input request with the highest priority among the input requests of each input channel at the next moment based on the updated two-dimensional array.

[0021] In this embodiment of the application, when updating the two-dimensional array, in addition to considering the cumulative time of input requests for each input channel, the priority relationship of each input channel defined by the user is also taken into account, which makes the scalability and practicality of the solution better.

[0022] In one possible implementation of the first aspect embodiment, initially, the two-dimensional array is determined according to the default priority of each input channel; at other times, the two-dimensional array is determined according to the cumulative time of input requests for each input channel and the default priority of each input channel, or the two-dimensional array is determined according to the cumulative time of input requests for each input channel, the default priority of each input channel, and the user-defined priority relationship of each input channel.

[0023] Secondly, embodiments of this application also provide an arbitrator, including: an acquisition unit and a arbitration unit. The acquisition unit is used to acquire a first array representing input requests of each input channel at the current time, wherein the number of elements in the first array is consistent with the number of input channels. The arbitration unit is used to arbitrate the input request with the highest current priority based on the first array and a preset two-dimensional array representing the priority relationship of each input channel. The priority relationship of each input channel in the two-dimensional array is configurable, the number of elements in each row or column of the two-dimensional array is consistent with the number of elements in the first array, and each row or column of the two-dimensional array represents the priority comparison result between the specified input channel and each input channel.

[0024] Other features and advantages of this application will be set forth in the following description. The objectives and other advantages of this application can be realized and obtained through the structures specifically pointed out in the written description and the accompanying drawings. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. The above and other objects, features, and advantages of this application will become clearer through the drawings. The same reference numerals indicate the same parts in all the drawings. The drawings are not intentionally drawn to scale to actual size; the focus is on illustrating the main points of this application.

[0026] Figure 1 A flowchart illustrating a method for requesting arbitration provided in an embodiment of this application is shown.

[0027] Figure 2 This illustration shows a schematic diagram of the principle of a two-dimensional array provided in an embodiment of this application.

[0028] Figure 3 This illustration shows a schematic diagram of another two-dimensional array provided in an embodiment of this application.

[0029] Figure 4 This illustration shows a schematic diagram of another two-dimensional array provided in an embodiment of this application. Detailed Implementation

[0030] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0031] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0032] Furthermore, the term "and / or" in this application is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.

[0033] Given that existing arbitrators primarily use a polling approach to arbitrate multiple input requests, there is a limitation that priorities cannot be dynamically changed during the polling period once determined, resulting in poor scalability. This application provides a novel request arbitration method to address the problems of current polling arbitrators, enabling the selection of the highest-priority input request from multiple input requests.

[0034] The following will combine Figure 1 The principle of the arbitration request method provided in the embodiments of this application will be explained.

[0035] S1: Obtain a first array representing the input requests of each input channel at the current moment, wherein the number of elements in the first array is the same as the number of input channels.

[0036] When arbitration is required for input requests from various input channels at the current moment, a first array representing the input requests from each input channel at the current moment is obtained. The number of elements in the first array is the same as the number of input channels, and each element (with a value of 0 or 1) indicates whether the input request for the corresponding input channel is valid. Assuming the number of input channels is n, the number of elements in the first array is also n, where n is an integer greater than or equal to 2. The value of each element in the first array is either 0 or 1. If an input channel has an input request at the current moment, the corresponding element has a value of 1; if an input channel does not have an input request at the current moment, the corresponding element has a value of 0. In this case, 0 in the first array indicates that the corresponding input channel has no input request at the current moment, and 1 in the first array indicates that the corresponding input channel has an input request at the current moment. Conversely, 0 in the first array indicates that the corresponding input channel has an input request at the current moment, and 1 in the first array indicates that the corresponding input channel does not have an input request at the current moment.

[0037] The first array above can be obtained based on the input requests from each input channel at the current moment. Each element in the first array represents whether the input request for the corresponding input channel is valid. For better understanding, let's take an arbiter with four input channels (channel 0, channel 1, channel 2, and channel 3) as an example. Assuming that the input requests for channels 1 and 2 are valid at the current moment, the first array above can be represented as 1d_req_valid[3:0]=4'b0110. Assuming that the input requests for channels 0 and 2 are valid at the current moment, the first array above can be represented as 1d_req_valid[3:0]=4'b0101. It should be noted that in this example, 1 in the first array indicates that there is an input request for the corresponding input channel at the current moment, and 0 in the first array indicates that there is no input request for the corresponding input channel at the current moment.

[0038] It is understandable that the order of the input channels in the first array is not limited to the order of channel 3, channel 2, channel 1, and channel 0 from the most significant bit to the least significant bit in the example. This order can be customized. For example, assuming that the most significant bit in the first array corresponds to channel 0, the second most significant bit corresponds to channel 1, the second least significant bit corresponds to channel 2, and the least significant bit corresponds to channel 3, and still assuming that the input requests for channel 1 and channel 2 are valid at the current moment, then the first array above can be represented as 1d_req_valid[0:3]=4'b0110. It is also understandable that the first array above can be represented by a column vector in addition to a row vector.

[0039] S2: Based on the first array and the preset two-dimensional array representing the priority relationship of each input channel, arbitrate the input request with the highest current priority.

[0040] After obtaining the first array representing the input requests of each input channel at the current moment, the highest priority input request can be arbitrated based on the first array and the preset two-dimensional array representing the priority relationship of each input channel.

[0041] This two-dimensional array is an n*n two-dimensional array matrix. The priority relationship of each input channel in the two-dimensional array is configurable. The number of elements in each row or column of the two-dimensional array is the same as the number of elements in the first array, which is n. Each row or column of the two-dimensional array represents the priority comparison result of the specified input channel with the other input channels. Each element in this two-dimensional array can be flipped between 0 and 1. The priority can be adjusted by rewriting this two-dimensional array matrix using a one-dimensional priority array.

[0042] If the total number of requests in the arbitrator is n, then pairwise comparisons will produce A. n 2 According to design requirements, a lowest-level default priority needs to be set for this combination. This default priority has the lowest priority and can be overridden by other conditions. However, when all other priority conditions are the same, the default priority is used for comparison. In this invention, the default priority is the channel number. This paper uses the example of a smaller channel number having higher priority (it can be understood that the request arbitration method shown in this application also supports the comparison logic that a larger channel number has higher priority) for explanation.

[0043] To better understand, let's take an example with four input channels (channel 0, channel 1, channel 2, and channel 3). By default, the priority of the four input channels is: channel 0 > channel 1 > channel 2 > channel 3. If we use 0 to represent that the current channel's priority is greater than or equal to the priority of the channel being compared, and 1 to represent that the current channel's priority is less than the priority of the channel being compared (or vice versa, 1 to represent that the current channel's priority is equal to the priority of the channel being compared, and 0 to represent that the current channel's priority is less than or equal to the priority of the channel being compared), then initially, a two-dimensional array representing the priority relationship of each input channel would look like this: Figure 2 As shown.

[0044] Understandable, Figure 2 The two-dimensional array shown is an example from the perspective of comparing the channel corresponding to each row with the channel corresponding to each column (i.e., from the row perspective). Of course, it can also be an example from the perspective of comparing the channel corresponding to each column with the channel corresponding to each row (i.e., from the column perspective). If described from the column perspective, 0 indicates that the priority of the current channel is less than or equal to the priority of the compared channel, and 1 indicates that the priority of the current channel is greater than the priority of the compared channel. It can be seen that the results from the row perspective and the column perspective are exactly opposite.

[0045] Figure 2 Row 0 represents the comparison result of channel 0 with all other channels, row 1 represents the comparison result of channel 1 with all other channels, row 2 represents the comparison result of channel 2 with all other channels, and row 3 represents the comparison result of channel 3 with all other channels. Since channel 0 has the highest priority, all comparison results in row 0 are 0. Channel 1 has the second highest priority, so all comparison results in row 1 are 0 except for column 0. Similarly, channel 2 has the second lowest priority, so all comparison results in row 2 are 0 except for columns 0 and 1. Channel 3 has the lowest priority, so all comparison results in row 3 are 1 except for column 3.

[0046] It should be noted that, Figure 2 The two-dimensional array shown is determined based on the default priority of each input channel. Since the default priority is the lowest, it can be overridden by other conditions. For example, the priority can be adjusted by rewriting this two-dimensional array with a one-dimensional priority array. For example, the one-dimensional priority array can be Array{0, 1, 2, 3} (abbreviated as ArrayA). This one-dimensional priority array represents the priority of channels 0 to 3 from left to right. Each element in Array represents the expected priority of a certain channel. The larger the number, the higher the priority (although the smaller the number, the higher the priority can also be; this article explains it by assuming that the larger the number, the higher the priority).

[0047] If you want to change the original default channel priority order (channel 0 > channel 1 > channel 2 > channel 3) to channel 3 > channel 2 > channel 1 > channel 0 using this one-dimensional priority array, you only need to set the value corresponding to channel 3 to the maximum and the value corresponding to channel 0 to the minimum. After rewriting the one-dimensional priority array ArrayA, the channel priority will become channel 3 > channel 2 > channel 1 > channel 0.

[0048] If some channels in the priority array have the same priority, such as channels 1 and 2 having the same priority, then the one-dimensional priority array can be Array{0, 1, 1, 2} (abbreviated as ArrayB). When updating the priority of each channel in the two-dimensional array, it is also necessary to compare it with the default priority. Since the default priority is that the smaller the channel number, the higher the priority, the priority after rewriting the one-dimensional priority array is Channel 3 > Channel 1 > Channel 2 > Channel 0. It can be seen that although channels 1 and 2 have the same priority in the one-dimensional priority array, because the default priority of channel 1 is higher than the default priority of channel 2, the final priority is Channel 3 > Channel 1 > Channel 2 > Channel 0.

[0049] It is understandable that the aforementioned one-dimensional priority array can be obtained based on the user-defined priority relationship between each input channel, or it can be obtained based on the cumulative time (i.e., age) of input requests from each input channel. There can be multiple priority arrays, such as a priority array obtained based on the cumulative time (i.e., age) of input requests from each input channel plus a priority array obtained based on the user-defined priority relationship between each input channel.

[0050] To avoid a situation where, during arbitration, a newly generated request is positioned closer to the polling pointer than an earlier request (i.e., the newer request originates from a higher-priority input channel), it will be output first, unfairly disadvantaging earlier requests. In this embodiment, to prevent this, based on a first-come, first-served principle, each input request participating in arbitration is assigned a time (age). If an input request fails in arbitration, its time is accumulated until it succeeds, at which point the accumulated time is reset to zero. This allows for subsequent updates to the two-dimensional array based on the accumulated time of input requests from each input channel; a larger accumulated time corresponds to a higher priority input channel.

[0051] For ease of understanding, assume that initially, all four channels (Channels 0-3) have valid input requests. At this time, the cumulative time for these four input requests is the same, all being 0. Since, by default, smaller channel numbers have higher priority, during the arbitration process, the input request from Channel 0 wins, and the cumulative time for the input requests from Channels 1-3 increases by 1. Then, suppose a new input request arrives at Channel 0. At this point, the cumulative times for the input requests from these four channels (Channels 1-3) are 0, 1, 1, and 1, respectively. Next, the two-dimensional array is updated based on the cumulative time of the input requests from each input channel, and arbitration is performed accordingly. Since, by default, smaller channel numbers have higher priority, the input request from Channel 1 wins in the next moment. The cumulative times for the input requests from the unsuccessful Channels 1, 2, and 3 are increased by 1. At this point, the cumulative times for the input requests from these four channels are 1, 0, 2, and 2, respectively. Next, the two-dimensional array is updated based on the cumulative time of input requests from each input channel, and arbitration is performed accordingly. Since the smaller the channel number, the higher the priority by default, the input request from channel 2 wins in the next moment. The cumulative time of input requests from channels 1 and 3 that did not win is incremented by 1. At this time, the cumulative times corresponding to the input requests of these 4 channels are 2, 0, 0, and 3, respectively. Then, the two-dimensional array is updated based on the cumulative time of input requests from each input channel, and arbitration is performed accordingly. In the next moment, the input request from channel 3 wins.

[0052] To better understand the principle of updating a two-dimensional array based on a one-dimensional priority array, let's first update ArrayA={0, 1, 2, 3}. Figure 2 The process of updating the two-dimensional array shown in the figure, using ArrayB={0,1,1,2}, will be explained.

[0053] When Array A is applied to a two-dimensional array, first, channels 0 and 1 in Array A are compared. Since channel 1 > channel 0, the coordinate (1, 0) needs to be changed to 1, and the coordinate (0, 1) needs to be changed to 0. Next, channel 0 is compared with channel 2. Since channel 2 > channel 0, the coordinate (2, 0) needs to be changed to 1, and the coordinate (0, 2) needs to be changed to 0. Then, channel 0 is compared with channel 3. Since channel 3 > channel 0, the coordinate (3, 0) needs to be changed to 1, and the coordinate (0, 3) needs to be changed to 0. Then, channel 1 is compared with channel 2. Since channel 2 > channel 1, the coordinate (2, 1) needs to be changed to 1, and the coordinate (1, 2) needs to be changed to 0. Finally, channel 1 is compared with channel 3. Since channel 3 > channel 1, the coordinate (3, 1) needs to be changed to 1, and the coordinate (1, 3) needs to be changed to 0. Then, channel 2 is compared with channel 3. Since channel 3 > channel 2, the coordinate (3, 2) needs to be rewritten to 1, and the coordinate (2, 3) needs to be rewritten to 0. After ArrayA updates the two-dimensional array, the channel priority changes to channel 3 > channel 2 > channel 1 > channel 0. The updated two-dimensional array is as follows: Figure 3 As shown.

[0054] Then, apply ArrayB = {0, 1, 1, 2} to the updated two-dimensional array, that is, apply ArrayB to... Figure 3 Update the two-dimensional array shown to obtain Figure 4 The two-dimensional array shown has the following channel priority after being updated by ArrayB: Channel 3 > Channel 1 > Channel 2 > Channel 0.

[0055] As demonstrated above, the influence of the two one-dimensional priority arrays on the two-dimensional array matrix is ​​such that the later the one-dimensional priority array is used, the stronger its influence on the two-dimensional array matrix. These one-dimensional priority arrays can represent user-defined priority relationships between input channels, and / or the cumulative time of input requests for each input channel (the age of the generated input requests). The size of the priority arrays and the order in which they are used can be defined by the user, facilitating expansion and use.

[0056] Based on the above description, initially, the two-dimensional array is determined according to the default priority of each input channel. At other times, the two-dimensional array is determined according to the cumulative time of input requests for each input channel, the default priority of each input channel (when the cumulative time is the same, the default priority needs to be combined to determine the final priority), or, the cumulative time of input requests for each input channel, the user-defined priority relationship between each input channel, and the default priority of each input channel (when the cumulative time is the same, the default priority needs to be combined to determine the final priority, or, when the user-defined priority relationship between each input channel needs to be combined with the default priority to determine the final priority). This application may involve multiple (two or more) priorities. For example, when two priorities are involved (default priority of input channel and priority determined by the cumulative time of input requests of input channel), the two-dimensional array is determined according to the cumulative time of input requests of each input channel and the default priority of each input channel. When three priorities are involved (default priority of input channel, priority determined by the cumulative time of input requests of input channel and user-defined priority of each input channel), the two-dimensional array is determined according to the cumulative time of input requests of each input channel, the default priority of each input channel, and the user-defined priority relationship of each input channel.

[0057] After describing the characteristics of the two-dimensional array shown in this application, the process of arbitrating the input request with the highest priority based on the first array and the preset two-dimensional array representing the priority relationship of each input channel will be explained below.

[0058] In the first implementation, assuming the first array is a row vector, the process of S2 can be: performing a bitwise AND operation between each row element in the two-dimensional array and the first array according to the corresponding bit position to obtain the first AND result corresponding to each row element; performing an OR operation on each element in the first AND result corresponding to each row element to obtain the OR operation result corresponding to each row element; and arbitrating the input request with the highest priority based on the OR operation result corresponding to each row element and the first array.

[0059] To better understand, assuming that the input requests for channel 1 and channel 2 are valid at the current moment, the first array above can be represented as 1d_req_valid[3:0]=4'b0110. The following uses... Figure 4 Let's take the two-dimensional array shown as an example for explanation. Following a similar approach to the first array, then... Figure 4The elements in the 2D array shown can be represented as 2d_map[0][3:0] = 4'b1110, 2d_map[1][3:0] = 4'b1000, 2d_map[2][3:0] = 4'b1010, and 2d_map[3][3:0] = 4'b0000. In the expression "2d_map[i][3:0]", the first square bracket (from left to right) indicates the i-th row, and the value of i is 0, 1, 2, or 3.

[0060] Then, perform a bitwise AND operation between the element in row 0 and the first array according to the corresponding bit positions. The result is 4'b0110. Then, perform an OR operation on each element in the result. The OR operation result corresponding to the element in row 0 is 1, which means that there is a valid request on a channel with a higher priority than its own channel (channel 0).

[0061] Similarly, performing a bitwise AND operation between the first row element and the first array according to the corresponding bit positions yields 4'b0000. Then, performing an OR operation on each element in this result yields an OR operation result of 0 for the first row element, indicating that there is no valid request on a channel with a higher priority than channel 1 or that channel 1 is the highest priority channel.

[0062] Similarly, performing a bitwise AND operation between the second row element and the first array according to the corresponding bit positions yields 4'b0010. Then, performing an OR operation on each element in this result yields an OR operation result of 1 for the second row element, indicating that there is a valid request on a channel with a higher priority than channel 2.

[0063] Similarly, performing a bitwise AND operation between the elements in the third row and the first array according to their corresponding bits yields 4'b0000. Then, performing an OR operation on each element in this result yields an OR operation result of 0 for the elements in the third row, indicating that there is no valid request on a channel with a higher priority than channel 3 or that channel 3 is the highest priority channel.

[0064] Then, based on the OR operation result of each row of elements and the first array, the input request with the highest priority can be arbitrated. Based on the above analysis, since the OR operation result of the elements in row 0 is 1, the OR operation result of the elements in row 1 is 0, the OR operation result of the elements in row 2 is 1, and the OR operation result of the elements in row 3 is 0, where 1 indicates a valid request exists on a channel with a higher priority than itself, and 0 indicates no valid request exists on a channel with a higher priority than itself, or that its own channel is the highest priority channel, a valid request can only originate from channel 1 and channel 3. Combining this with the first array representing the input requests for each input channel, since there is no valid request on channel 3 but a valid request on channel 1, it can be determined that the input request with the highest priority currently originates from channel 1.

[0065] Optionally, the process of arbitrating the highest priority input request based on the OR operation result corresponding to each row element and the first array can be as follows: Obtain a second array based on the OR operation result corresponding to each row element, where each element in the second array corresponds to an OR operation result; invert each element in the second array, and perform a bitwise AND operation between the inverted second array and the first array according to the corresponding bit positions to obtain a second AND result; determine the highest priority input request based on the second AND result. For example, if the second array is represented by 1d_tmp_result[3:0], then the second array 1d_tmp_result[3:0] = 4'b0101. Performing a bitwise AND operation between the second array and the first array yields 4'b0010. Since the channel corresponding to 1 in the second AND result is channel 1, it can be determined that the highest priority input request comes from channel 1, meaning the input request from channel 1 wins.

[0066] In the second implementation, if the first array is a column vector, then the process of S2 can be: performing a bitwise AND operation on each column element of the two-dimensional array with the first array according to the corresponding number of bits to obtain the first AND result corresponding to each column element; performing an OR operation on each element in the first AND result corresponding to each column element to obtain the OR operation result corresponding to each column element; and arbitrating the input request with the highest priority based on the OR operation result corresponding to each column element and the first array.

[0067] To better understand, assuming that the input requests for channel 1 and channel 2 are valid at the current moment, the first array above can be represented as 1d_req_valid[3:0]=4'b0110. The following uses... Figure 4 Let's take the two-dimensional array shown as an example for explanation. Following a similar approach to the first array, then... Figure 4The element in column 0 of the two-dimensional array shown can be represented as 2d_map[0][3:0] = 4'b0000, the element in column 1 can be represented as 2d_map[1][3:0] = 4'b0101, the element in column 2 can be represented as 2d_map[2][3:0] = 4'b0001, and the element in row 3 can be represented as 2d_map[3][3:0] = 4'b0111. In the expression "2d_map[i][3:0]", the first square bracket (from left to right) contains the element 'i', which represents the i-th row. The value of 'i' is 0, 1, 2, or 3.

[0068] Then, perform a bitwise AND operation between the element in column 0 and the first array according to the corresponding number of bits. The result is 4'b0000. Then, perform an OR operation on each element in the result. The OR operation result corresponding to the element in column 0 is 0, which means that there is a valid request on a channel with a higher priority than its own channel.

[0069] Similarly, performing a bitwise AND operation between the first column element and the first array according to the corresponding bit positions yields 4'b0100. Then, performing an OR operation on each element in this result yields an OR operation result of 1 for the first column element, indicating that there is no valid request on a channel with a higher priority than the current channel or that the current channel is the highest priority channel.

[0070] Similarly, performing a bitwise AND operation between the second column element and the first array according to the corresponding bit positions yields 4'b0000. Then, performing an OR operation on each element in this result yields an OR operation result of 0 for the second column element, indicating that there is a valid request on a channel with a higher priority than the current channel.

[0071] Similarly, performing a bitwise AND operation between the third column element and the first array according to the corresponding bit positions yields 4'b0110. Then, performing an OR operation on each element in this result yields an OR operation result of 1 for the third column element, indicating that there is no valid request on a channel with a higher priority than the current channel or that the current channel is the highest priority channel.

[0072] Then, based on the OR operation result of each column element and the first array, the input request with the highest priority can be arbitrated. Based on the above analysis, since the OR operation result of the 0th column element is 0, the OR operation result of the 1st column element is 1, the OR operation result of the 2nd column element is 0, and the OR operation result of the 3rd column element is 1, where 0 indicates a valid request exists on a channel with a higher priority than itself, and 1 indicates no valid request exists on a channel with a higher priority than itself or that its own channel is the highest priority channel, a valid request can only originate from channel 1 and channel 3. Combining this with the first array representing the input requests of each input channel, since there is no valid request on channel 3 but a valid request on channel 1, it can be determined that the input request with the highest priority currently originates from channel 1.

[0073] Optionally, the process of arbitrating the highest priority input request based on the OR operation result corresponding to each column element and the first array can be as follows: Obtain a second array based on the OR operation result corresponding to each column element, where each element in the second array corresponds to an OR operation result; perform a bitwise AND operation between the second array and the first array according to the corresponding bit positions to obtain a second AND result; determine the highest priority input request based on the second AND result. For example, assuming the second array is represented by 1d_tmp_result[3:0], then the second array 1d_tmp_result[3:0] = 4'b1010. Performing a bitwise AND operation between the second array and the first array yields 4'b0010. Since the channel corresponding to 1 in the second AND result is channel 1, it can be determined that the highest priority input request comes from channel 1, meaning the input request from channel 1 wins.

[0074] Optionally, after arbitrating the input request with the highest current priority, the arbitration method further includes: updating the two-dimensional array based on the cumulative time of input requests from each input channel, so as to arbitrate the input request with the highest priority from the input requests from each input channel at the next moment based on the updated two-dimensional array, wherein the larger the cumulative time of the input request, the higher the priority of the corresponding input channel. To avoid later input requests being executed before earlier input requests, each input request participating in the arbitration is assigned a time (age). If an input request does not win in the arbitration process, the time is accumulated until the input request wins in the arbitration process, at which point the corresponding accumulated time is cleared. After arbitrating the input request with the highest current priority from the input requests from each input channel at the current moment based on the two-dimensional array, the time of the input requests that did not win needs to be updated, and then the two-dimensional array is updated based on the cumulative time of the input requests from each input channel.

[0075] When updating the two-dimensional array based on the cumulative time of input requests for each input channel, it is necessary to determine the priority of each input channel. In this embodiment, the larger the cumulative time of the input request, the higher the priority of the input channel. If there are two or more input channels with the same cumulative time of input requests, the priority of these input channels with the same cumulative time of input requests can also be determined according to the default channel priority. Assuming that the cumulative times of input requests for channels 1 to 3 are 1, 0, 2, and 2 respectively, although the cumulative times corresponding to channels 2 and 3 are the same, since the default channel priority is that channel 3 is less than channel 2, the priority order of the channels at this time can be obtained as: channel 2 > channel 3 > channel 0 > channel 1.

[0076] Optionally, after arbitrating the input request with the highest priority, the arbitration method further includes: updating the two-dimensional array based on the cumulative time of input requests from each input channel, wherein a larger cumulative time corresponds to a higher priority input channel; and updating the updated two-dimensional array again based on the user-defined priority relationship between the input channels, so as to arbitrate the input request with the highest priority among the input requests from each input channel at the next moment based on the updated two-dimensional array. When the user has defined the priority relationship between the input channels, when updating the two-dimensional array, in addition to updating the two-dimensional array based on the cumulative time of input requests from each input channel, it is also necessary to update the updated two-dimensional array again based on the user-defined priority relationship between the input channels. For the specific update principle, please refer to the process of updating the two-dimensional array using ArrayA and ArrayB described above.

[0077] Even if the user-defined priority relationships of each input channel are the same, the final priority relationship can be determined based on the default priority of the input channels, so that the priorities of each input channel are different.

[0078] It is understandable that, when considering both the user-defined priority relationship of each input channel and the cumulative time of input requests for each input channel, the update order is not limited to first updating the two-dimensional array with the cumulative time and then updating the updated two-dimensional array again using the user-defined priority relationship of each input channel; the order can also be reversed.

[0079] To better understand, the arbitration method shown in this application is explained below with examples. Assuming that initially all four channels have valid input requests, in cycle 0, the highest priority input request is arbitrated from the four input requests based on the two-dimensional array, and then the two-dimensional array is updated. In cycle 1, the highest priority input request is arbitrated from the three input requests based on the two-dimensional array updated in cycle 0, and then the two-dimensional array is updated. In cycle 2, the highest priority input request is arbitrated from the two input requests based on the two-dimensional array updated in cycle 1, and then the two-dimensional array is updated. In cycle 3, the highest priority input request is arbitrated from the one input request based on the two-dimensional array updated in cycle 2, and then the two-dimensional array is updated. That is, after each arbitration of the highest priority input request, the two-dimensional array is updated, and the next arbitration is based on the latest two-dimensional array, and this process repeats.

[0080] Based on the same inventive concept, embodiments of this application also provide an arbitrator, which includes: an acquisition unit and an arbitration unit.

[0081] The acquisition unit is used to acquire a first array representing the input requests of each input channel at the current moment, wherein the number of elements in the first array is consistent with the number of input channels. The input request status of each input channel can be determined based on the high and low levels of its data lines; when the level of a data line of an input channel is high, the input request of that input channel is valid.

[0082] An arbitration unit is used to arbitrate the input request with the highest current priority based on the first array and a preset two-dimensional array representing the priority relationship of each input channel. The priority relationship of each input channel in the two-dimensional array is configurable. The number of elements in each row or column of the two-dimensional array is the same as the number of elements in the first array. Each row or column of the two-dimensional array represents the priority comparison result between the specified input channel and each input channel.

[0083] In addition, the arbitrator also includes registers for storing a preset two-dimensional array representing the priority relationship of each input channel. It also includes timers (or counters) for timing (or counting) the cumulative time of input requests for each input channel; the number of timers or counters is the same as the number of input channels.

[0084] The arbitrator provided in this application embodiment has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the aforementioned method embodiment.

[0085] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0086] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method of requesting arbitration, characterized by, The method comprises the following steps: obtaining a first array representing input requests of each input channel at the current time, the number of elements in the first array being consistent with the number of input channels; arbitrating the input request with the highest priority at the current time according to the first array and a preset two-dimensional array representing the priority relationship of each input channel, wherein the priority relationship of each input channel in the two-dimensional array is configurable, the number of elements in each row or column of the two-dimensional array is consistent with the number of elements in the first array, and each row or column of the two-dimensional array represents the priority comparison result of a specified input channel and each input channel; if the first array is a row vector, arbitrating the input request with the highest priority at the current time according to the first array and a preset two-dimensional array representing the priority relationship of each input channel, comprising: performing an AND operation between each row element in the two-dimensional array and the first array according to the corresponding bit number to obtain a first AND result corresponding to each row element; performing an OR operation on each element in the first AND result corresponding to each row element to obtain an OR operation result corresponding to each row element; arbitrating the input request with the highest priority at the current time according to the OR operation result corresponding to each row element and the first array; wherein arbitrating the input request with the highest priority at the current time according to the OR operation result corresponding to each row element and the first array comprises: obtaining a second array according to the OR operation result corresponding to each row element, each element in the second array corresponding to an OR operation result; taking the inverse of each element in the second array, and performing an AND operation between the inverted second array and the first array according to the corresponding bit number to obtain a second AND result; determining the input request with the highest priority at the current time according to the second AND result.

2. The method of claim 1, wherein, if the first array is a column vector, arbitrating the input request with the highest priority at the current time according to the first array and a preset two-dimensional array representing the priority relationship of each input channel, comprising: performing an AND operation between each column element in the two-dimensional array and the first array according to the corresponding bit number to obtain a first AND result corresponding to each column element; performing an OR operation on each element in the first AND result corresponding to each column element to obtain an OR operation result corresponding to each column element; arbitrating the input request with the highest priority at the current time according to the OR operation result corresponding to each column element and the first array.

3. The method of claim 2, wherein, arbitrating the input request with the highest priority at the current time according to the OR operation result corresponding to each column element and the first array comprises: obtaining a second array according to the OR operation result corresponding to each column element, each element in the second array corresponding to an OR operation result; performing an AND operation between the second array and the first array according to the corresponding bit number to obtain a second AND result; determining the input request with the highest priority at the current time according to the second AND result.

4. The method of claim 1, wherein, obtaining a first array representing input requests of each input channel at the current time comprises: obtaining the first array according to input requests from each input channel at the current time.

5. The method according to any one of claims 1 to 4, characterized in that, After arbitrating the input request with the highest priority at the current time, the method further comprises: According to the accumulated time of the input requests of each input channel, the two-dimensional array is updated so that according to the updated two-dimensional array, the input request with the highest priority among the input requests of each input channel at the next moment is arbitrated; wherein the greater the accumulated time of the input request, the higher the priority of the corresponding input channel.

6. The method according to any one of claims 1 to 4, characterized in that, The method further comprises: According to the accumulated time of the input requests of each input channel, the two-dimensional array is updated, wherein the greater the accumulated time of the input request, the higher the priority of the corresponding input channel; According to the priority relationship of each input channel defined by the user, the updated two-dimensional array is updated again so that according to the two-dimensional array updated again, the input request with the highest priority among the input requests of each input channel at the next moment is arbitrated.

7. The method of any one of claims 1 to 4, characterized in that, At the initial moment, the two-dimensional array is determined according to the default priority of each input channel; At the remaining moments, the two-dimensional array is determined according to the accumulated time of the input requests of each input channel, the default priority of each input channel, or the two-dimensional array is determined according to the accumulated time of the input requests of each input channel, the default priority of each input channel, and the priority relationship of each input channel defined by the user.

8. An arbiter, characterized by Comprise: An acquisition unit is configured to acquire a first array representing input requests of each input channel at a current moment, wherein the number of elements in the first array is consistent with the number of input channels; An arbitration unit is configured to arbitrate an input request with the highest current priority according to the first array and a preset two-dimensional array representing priority relationships of each input channel, wherein the priority relationship of each input channel in the two-dimensional array is configurable, the number of elements in each row or column of the two-dimensional array is consistent with the number of elements in the first array, and each row or column of the two-dimensional array represents a priority comparison result between a specified input channel and each input channel; If the first array is a row vector, arbitrating an input request with the highest current priority according to the first array and a preset two-dimensional array representing priority relationships of each input channel comprises: Performing an AND operation between each row element in the two-dimensional array and the first array according to corresponding bit numbers to obtain a first AND result corresponding to each row element; Performing an OR operation on each element in the first AND result corresponding to each row element to obtain an OR operation result corresponding to each row element; Arbitrating an input request with the highest current priority according to the OR operation result corresponding to each row element and the first array; Wherein arbitrating an input request with the highest current priority according to the OR operation result corresponding to each row element and the first array comprises: Obtaining a second array according to the OR operation result corresponding to each row element, wherein each element in the second array corresponds to an OR operation result; Inverting each element in the second array, and performing an AND operation between the inverted second array and the first array according to corresponding bit numbers to obtain a second AND result; Determining an input request with the highest current priority according to the second AND result.

Citation Information

Patent Citations

  • Method and device for arbitrating dynamic priority

    CN101887382A

  • Multi-protocol conversion method capable of realizing priority scheduling

    CN105045743A