CN113467938A - Bus resource allocation method, device and related equipment - Google Patents

Bus resource allocation method, device and related equipment Download PDF

Info

Publication number
CN113467938A
CN113467938A CN202110678023.8A CN202110678023A CN113467938A CN 113467938 A CN113467938 A CN 113467938A CN 202110678023 A CN202110678023 A CN 202110678023A CN 113467938 A CN113467938 A CN 113467938A
Authority
CN
China
Prior art keywords
data
data channel
channel
flow
read
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110678023.8A
Other languages
Chinese (zh)
Inventor
孙旭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Original Assignee
Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd filed Critical Shandong Yunhai Guochuang Cloud Computing Equipment Industry Innovation Center Co Ltd
Priority to CN202110678023.8A priority Critical patent/CN113467938A/en
Publication of CN113467938A publication Critical patent/CN113467938A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Abstract

The application discloses a bus resource allocation method, which comprises the steps of counting the data flow of each data channel in a preset monitoring period; calculating to obtain total data flow according to the data flow of each data channel; calculating to obtain the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel; time slicing is carried out on the preset monitoring period according to each arbitration weight, and distribution time corresponding to each data channel is obtained, so that each data channel obtains bus resources according to the distribution time; the bus resource allocation method can realize reasonable allocation of bus resources, effectively improve the utilization rate of the bus resources and further improve the system performance. The application also discloses a bus resource allocation device, a system and a computer readable storage medium, which have the beneficial effects.

Description

Bus resource allocation method, device and related equipment
Technical Field
The present application relates to the field of resource sharing technologies, and in particular, to a bus resource allocation method, and further, to a bus resource allocation apparatus, a bus resource allocation system, and a computer-readable storage medium.
Background
With the continuous development of integrated circuits, the requirements on the processing speed performance of SOC (System on Chip) chips are higher and higher. The system bus is used as a central bridge for connecting each module, which has an important influence on the performance of the SOC system, and particularly in a system with a plurality of master devices and a plurality of slave devices, the arbitration mechanism of the bus influences the read-write efficiency of multi-path data, thereby influencing the performance of the SOC chip.
In the related art, the multi-user arbitration method for the system bus mainly includes a fixed priority method and a time division multiplexing method. The fixed priority method means that the priority level of each master module is determined and cannot be changed along with the operation of the system, and when a plurality of master modules request to use the bus resource at the same time, the arbiter allocates the bus use right according to the priority levels of the master modules; however, when a high priority master is using the bus all the time, a low priority master may not get bus resources, thereby rendering the low priority master instructions ineffective. The time division multiplexing method is mainly that the time with fixed length is appointed for each main device to occupy the shared resource in advance, and the shared resource is distributed to another main device when the time is over; however, this method has a high requirement for time slice division, and if the division is not reasonable, the waiting time of the path with high priority and high bandwidth requirement is lengthened, the bus performance of the system is degraded, and in the practical application process, the data read-write request bandwidth between different master and slave devices is dynamically changed, and if the fixed time slice division is used, the arbitration allocation efficiency is low in some time, and the performance of the bus and the SOC chip is affected.
Therefore, how to implement reasonable allocation of bus resources to effectively improve the utilization rate of bus resources, thereby improving system performance is a problem to be urgently solved by those skilled in the art.
Disclosure of Invention
The bus resource allocation method can realize reasonable allocation of bus resources, effectively improve the utilization rate of the bus resources and further improve the system performance; another object of the present application is to provide a bus resource allocation apparatus, system and computer readable storage medium, all of which have the above advantages.
In a first aspect, the present application provides a bus resource allocation method, including:
in a preset monitoring period, counting the data flow of each data channel;
calculating to obtain total data flow according to the data flow of each data channel;
calculating to obtain the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel;
and time slicing is carried out on the preset monitoring period according to each arbitration weight to obtain the distribution time corresponding to each data channel, so that each data channel obtains bus resources according to the distribution time.
Preferably, in the preset monitoring period, the counting data traffic of each data channel includes:
when the data channel is a data writing channel, counting data writing flow corresponding to all writing instructions in the data writing channel in the preset monitoring period;
and when the data channel is a data reading channel, counting the data reading flow corresponding to all the reading instructions in the data reading channel in the preset monitoring period.
Preferably, in the preset monitoring period, counting write data flows corresponding to all write instructions in the write data channel, including:
determining a write data bit width flag bit and a write data length according to the write instruction;
calculating according to the write data bit width zone bit to obtain a write data bit width;
calculating according to the write data length to obtain a write data burst length;
calculating to obtain the write data flow corresponding to the write instruction according to the write data bit width and the write data burst length;
and counting the write data flow corresponding to all the write instructions to obtain the write data flow of the write data channel in the preset monitoring period.
Preferably, in the preset monitoring period, the counting read data traffic corresponding to all read instructions in the read data channel includes:
determining a bit width zone bit and a read data length of read data according to the read instruction;
calculating according to the read data bit width zone bit to obtain a read data bit width;
calculating according to the read data length to obtain a read data burst length;
calculating to obtain the read data flow corresponding to the read instruction according to the read data bit width and the read data burst length;
and counting the read data flow corresponding to all the read instructions to obtain the read data flow of the read data channel in the preset monitoring period.
Preferably, before the obtaining of the arbitration weight of each data channel according to the preset total weight, the total data traffic and the data traffic of each data channel by calculation, the method further includes:
calculating to obtain the maximum bandwidth of the data channel according to the preset monitoring period and the bit width of the bus data;
judging whether the data flow of each data channel exceeds the maximum bandwidth of the corresponding data channel;
and if not, executing the step of calculating and obtaining the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel.
Preferably, the bus resource allocation further includes:
when the data flow of the data channel exceeds the maximum bandwidth of the corresponding data channel, calculating and obtaining the average arbitration weight of each data channel according to the preset total weight;
and time slicing is carried out on the preset monitoring period according to the average arbitration weight, and the distribution time corresponding to each data channel is obtained, so that each data channel obtains bus resources according to the distribution time.
Preferably, the acquiring, by each data channel, bus resources according to the allocation time includes:
and when the time for acquiring the bus resources by the data channel reaches the allocation time, switching to the next data channel until all the data channels are switched.
In a second aspect, the present application also discloses a bus resource allocation apparatus, including:
the data flow monitoring module is used for counting the data flow of each data channel in a preset monitoring period;
the data flow statistic module is used for calculating and obtaining total data flow according to the data flow of each data channel;
the arbitration weight distribution module is used for calculating and obtaining the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel;
and the time slicing module is used for time slicing the preset monitoring period according to each arbitration weight to obtain the distribution time corresponding to each data channel so that each data channel obtains the bus resource according to the distribution time.
In a third aspect, the present application further discloses a bus resource allocation system, including:
a memory for storing a computer program;
a processor for implementing the steps of any of the bus resource allocation methods described above when executing the computer program.
In a fourth aspect, the present application also discloses a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of any of the bus resource allocation methods described above.
The bus resource allocation method comprises the steps of counting data flow of each data channel in a preset monitoring period; calculating to obtain total data flow according to the data flow of each data channel; calculating to obtain the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel; and time slicing is carried out on the preset monitoring period according to each arbitration weight to obtain the distribution time corresponding to each data channel, so that each data channel obtains bus resources according to the distribution time.
Therefore, the bus resource allocation method provided by the application can monitor the data traffic of each data channel in real time, and can adjust the arbitration priority of different data channels in real time in the system operation process by analyzing the data traffic of each data channel, so that the data channel of the high-speed high-bandwidth read-write request obtains a corresponding high priority, and the data channel of the low-speed low-bandwidth read-write request obtains a corresponding low priority, thereby realizing reasonable allocation of bus resources, effectively improving the utilization rate of the bus resources and further improving the system performance.
The bus resource allocation apparatus, system and computer readable storage medium provided by the present application all have the above beneficial effects, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the prior art and the embodiments of the present application, the drawings that are needed to be used in the description of the prior art and the embodiments of the present application will be briefly described below. Of course, the following description of the drawings related to the embodiments of the present application is only a part of the embodiments of the present application, and it will be obvious to those skilled in the art that other drawings can be obtained from the provided drawings without any creative effort, and the obtained other drawings also belong to the protection scope of the present application.
Fig. 1 is a schematic flowchart of a bus resource allocation method provided in the present application;
FIG. 2 is a schematic flow chart illustrating another bus resource allocation method provided in the present application;
fig. 3 is a schematic structural diagram of a 2-master 2-slave AXI bus provided in the present application;
fig. 4 is a schematic diagram of a monitoring period division provided in the present application;
fig. 5 is a schematic structural diagram of a bus resource allocation apparatus provided in the present application;
fig. 6 is a schematic structural diagram of a bus resource allocation system provided in the present application.
Detailed Description
The core of the application is to provide a bus resource allocation method, which can realize reasonable allocation of bus resources, effectively improve the utilization rate of the bus resources and further improve the system performance; at the other core of the present application, a bus resource allocation apparatus, a system and a computer readable storage medium are provided, which also have the above advantages.
In order to more clearly and completely describe the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a bus resource allocation method.
Referring to fig. 1, fig. 1 is a schematic flow chart of a bus resource allocation method provided in the present application, where the bus resource allocation method includes:
s101: in a preset monitoring period, counting the data flow of each data channel;
the step aims to count the data traffic of each data channel, wherein the data channel refers to a channel for reading or writing data in a system, and specifically, the data traffic of each data channel in a preset data monitoring period is counted. The value of the preset monitoring period does not affect the implementation of the technical scheme, and the value is set by technical personnel according to actual requirements, so that the method is not limited by the application.
As a preferred embodiment, the counting data traffic of each data channel in the preset monitoring period may include: when the data channel is a data writing channel, counting data writing flow corresponding to all writing instructions in the data writing channel in a preset monitoring period; and when the data channel is a data reading channel, counting the data reading flow corresponding to all the reading instructions in the data reading channel in a preset monitoring period.
Because the data channel is used for realizing the data reading and writing function, the data channel can be divided into a read data channel and a write data channel, and on the basis, when data traffic statistics is carried out on each path of data channel, the read data traffic in the read data channel and the write data traffic in the write data channel can be respectively counted. Specifically, for a write data channel, statistics may be performed on write data traffic corresponding to all write instructions obtained by the write data channel within a preset monitoring period; for the read data channel, statistics may be performed on read data traffic corresponding to all read data instructions obtained by the read data channel in a preset monitoring period.
As a preferred embodiment, the counting write data traffic corresponding to all write instructions in a write data channel in the preset monitoring period may include: determining a write data bit width flag bit and a write data length according to the write instruction; calculating according to the bit width flag bit of the write data to obtain the bit width of the write data; calculating according to the write data length to obtain the write data burst length; calculating according to the write data bit width and the write data burst length to obtain write data flow corresponding to the write instruction; and counting the write data flow corresponding to all the write instructions to obtain the write data flow of the write data channel in a preset monitoring period.
The preferred embodiment provides a statistical method for write data traffic in a write data channel. Specifically, the write data traffic corresponding to each write instruction is counted first, and then the write data traffic corresponding to all the write instructions in the preset monitoring period is summed up, so that all the write data traffic of the write data channel in the preset monitoring period can be obtained. When each write instruction is subjected to write data flow statistics, the write data flow statistics can be obtained through calculation according to a write data bit width and a write data burst length, the write data bit width can be obtained through calculation according to a write data bit width flag bit in the write instruction, the write data burst length can be obtained through calculation according to a write data length in the write instruction, the write data bit width flag bit is a write data bit width flag bit in a bus protocol, and the write data length is a write data length specified in the bus protocol.
As a preferred embodiment, the counting read data traffic corresponding to all read instructions in the read data channel in the preset monitoring period may include: determining a bit width zone bit and a read data length of read data according to the read instruction; calculating according to the read data bit width zone bit to obtain the read data bit width; calculating according to the read data length to obtain the read data burst length; calculating according to the read data bit width and the read data burst length to obtain read data flow corresponding to the read instruction; and counting the read data flow corresponding to all the read instructions to obtain the read data flow of the read data channel in a preset monitoring period.
The preferred embodiment provides a statistical method for the read data traffic in the read data channel. Specifically, the read data traffic corresponding to each read instruction is counted first, and then the read data traffic corresponding to all read instructions in the preset monitoring period is summed, so that all the read data traffic of the read data channel in the preset monitoring period can be obtained. When each read instruction is subjected to data reading flow statistics, the data reading flow statistics can be obtained through calculation according to the read data bit width and the read data burst length, the read data bit width can be obtained through calculation according to a read data bit width flag bit in the read instruction, the read data burst length can be obtained through calculation according to the read data length in the read instruction, the read data bit width flag bit is a read data bit width flag bit in a bus protocol, and the read data length is a read data length specified in the bus protocol.
S102: calculating to obtain total data flow according to the data flow of each data channel;
the step aims to realize total data flow statistics, namely, the sum of the data flows of all data channels is calculated to obtain the total data flow. It should be noted that the total data traffic of all the data channels refers to the total data traffic of the data channels of the same type, and as described above, the data channels may be divided into two types, i.e., a read data channel and a write data channel, so that when the total data traffic is counted, the total write data traffic of all the write data channels in the system and the total read data traffic of all the read data channels in the system may be counted respectively, and then subsequent bus resource allocation is performed on all the read data channels and all the write data channels respectively.
S103: calculating to obtain the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel;
the step aims to perform arbitration weight calculation on each data channel, that is, the total data traffic and the data traffic of each data channel are calculated by combining with the preset total weight to obtain the arbitration weight corresponding to each data channel, wherein the arbitration weight is used for realizing time slicing of the corresponding data channel, and the preset total weight is a preset constant value, and the specific value of the preset total weight does not influence the implementation of the technical scheme. In a specific implementation process, a ratio of data traffic of each data channel to total data traffic may be calculated first, and a product of each ratio and a preset total weight is further calculated, where the product is an arbitration weight of the corresponding data channel.
It is conceivable that, when the product of the comparison value and the preset total weight is calculated, the value of the product is not necessarily an integer, and in order to facilitate subsequent time slicing, rounding operations may be performed on each product, and the rounded integer is used as the arbitration weight of the corresponding data channel. Specifically, firstly, screening out the product with the largest value from all products, and finally performing arbitration weight calculation on the data channel corresponding to the largest product; further, when the value of the product is not more than 1, namely the integer part is 0, the arbitration weight of the corresponding data channel is set to be 1, when the value of the product is more than 1, namely the integer part is not 0, the arbitration weight of the corresponding data channel is set to be the integer part of the product, after the rounding of all the products except the maximum product is completed, the sum difference value of the preset total weight and all the rounded products is calculated, and the difference value is used as the integer part of the maximum product, namely the arbitration weight of the data channel corresponding to the maximum product, so that the calculation of the arbitration weights of all the data channels is realized.
S104: and time slicing is carried out on the preset monitoring period according to each arbitration weight to obtain the corresponding distribution time of each data channel, so that each data channel obtains the bus resource according to the distribution time.
The step aims to time-slice each data channel so that each data channel acquires bus resources according to allocation time, thereby realizing bus resource allocation. Firstly, performing time slicing on a preset monitoring period according to each arbitration weight, namely dividing the preset monitoring period into a corresponding number of time slices according to each arbitration weight, wherein the number of the time slices is equal to the number of the arbitration weights, when the specific implementation is realized, the proportion of each arbitration weight in a preset total weight is calculated, and then the product of each proportion and the preset monitoring period is calculated, wherein the product is the time distributed to a corresponding data channel; furthermore, each data channel can acquire the bus resource according to the time allocated by the data channel, so that the bus resource allocation is realized.
As a preferred embodiment, the acquiring, by each data channel, bus resources according to the allocation time may include: and when the time for the data channel to acquire the bus resources reaches the allocation time, switching to the next data channel until all the data channels are switched.
When each data channel acquires the bus resources according to the allocation time, the data channels are switched in sequence. Specifically, each data channel can be controlled to sequentially acquire bus resources according to corresponding allocation time, and once the time for acquiring the bus resources reaches the corresponding allocation time, the next data channel can be switched to until all data channels in the system are switched, so that the bus resources are allocated in the monitoring period. It should be noted that the switching order of the data channels is not unique, and for example, the data channels may be switched according to the order of the distribution time from small to large or from large to small, which is not limited in the present application.
It can be understood that, after the data channel is switched, it indicates that the current monitoring cycle is ended, at this time, the data is initialized, and the step of S101 is returned, and the bus resource allocation of the next monitoring cycle is performed again.
Therefore, the bus resource allocation method provided by the application can monitor the data traffic of each data channel in real time, and can adjust the arbitration priority of different data channels in real time in the system operation process by analyzing the data traffic of each data channel, so that the data channel of the high-speed high-bandwidth read-write request obtains a corresponding high priority, and the data channel of the low-speed low-bandwidth read-write request obtains a corresponding low priority, thereby realizing reasonable allocation of bus resources, effectively improving the utilization rate of the bus resources and further improving the system performance.
The embodiment of the application provides another bus resource allocation method.
Referring to fig. 2, fig. 2 is a schematic flow chart of another bus resource allocation method provided in the present application, where the bus resource allocation method includes:
s201: in a preset monitoring period, counting the data flow of each data channel;
s202: calculating to obtain total data flow according to the data flow of each data channel;
s203: calculating to obtain the maximum bandwidth of the data channel according to a preset monitoring period and the bit width of the bus data;
s204: judging whether the data flow of each data channel exceeds the maximum bandwidth of the corresponding data channel; if not, executing S205, if yes, executing S206;
s205: calculating to obtain the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel; time slicing is carried out on the preset monitoring period according to each arbitration weight to obtain the distribution time corresponding to each data channel, so that each data channel obtains bus resources according to the distribution time;
s206: calculating according to a preset total weight to obtain an average arbitration weight of each data channel; and time slicing is carried out on the preset monitoring period according to the average arbitration weight to obtain the distribution time corresponding to each data channel, so that each data channel obtains the bus resource according to the distribution time.
Specifically, to ensure normal operation of read/write operations and further ensure system performance, before performing arbitration weight calculation and time slicing, it is first determined whether the data traffic of each data channel exceeds the maximum bandwidth of the data channel, and if so, it indicates that if the bus resource allocation is continued according to the arbitration weight calculation method of S205, the corresponding data channel cannot perform normal data read operation or data write operation, and therefore, only when the data traffic of each data channel does not exceed the maximum bandwidth of the corresponding data channel, the arbitration weight calculation can be continued according to the method of S205, and further, the bus resource allocation is completed.
Further, if the data traffic of one or more data channels exceeds the maximum bandwidth of the corresponding data channel, the process proceeds to S206 to calculate the average arbitration weight, that is, the arbitration weights of all data channels have the same value, so that the preset monitoring period can be time-sliced according to the average arbitration weight, so that each data channel obtains the same allocation time, and the bus resource is obtained according to the allocation time, thereby realizing the bus resource allocation.
Of course, the method for allocating bus resources based on the average arbitration weight in S206 is only one preferred implementation manner provided in the embodiment of the present application, and is not unique, and may also be implemented by directly counting the number of data channels (the number of data channels or the number of data channels), and performing an average processing on the duration of the preset monitoring period according to the number of data channels, where an average value of the average processing is allocation time corresponding to each data channel.
Therefore, according to the bus resource allocation method provided by the embodiment of the application, before time slicing is performed on each data channel based on the arbitration weight, whether the data traffic of each data channel exceeds the respective maximum bandwidth is judged, and the time slicing based on the arbitration weight and the time slicing based on the average arbitration weight are performed respectively for different situations, so that the bus resource allocation is realized.
Based on the foregoing embodiments, taking an AXI (Advanced eXtensible Interface) bus as an example, the embodiments of the present application provide another bus resource allocation method, and the specific implementation flow thereof is as follows:
firstly, carrying out channel marking on each data channel in the system, wherein the marking content comprises but is not limited to the operation type of the data channel, the data interaction direction and both data interaction parties.
In the AXI bus, a data channel may be used to implement two operations of reading data and writing data, and may be marked as a read type or a write type when the channel is marked, and a data interaction direction is identified by a master device port number and a slave device port number, for example, referring to fig. 3, fig. 3 is a schematic structural diagram of a 2-master 2-slave device AXI bus provided in this application, when a master device 0 reads a slave device 1, the channel is marked as 3b001, where 3 represents 3 bits; b represents a 2-system; bit [2] represents a read type or a write type, wherein the read type is represented when the value is 0, and the write type is represented when the value is 1; bit [1] represents "master", represents master 0(master0) when the value is 0, and represents master 1(master1) when the value is 1; bit [0] represents "slave," slave 0(slave0) when it takes a value of 0, and slave 1(slave) when it takes a value of 1. Specifically, the following table can be referred to, and table 1 is a table of Bit bits in a channel tag provided in the present application.
TABLE 1 comparison table of each Bit in a channel tag
Channel marking R/W MASTER SLAVE
Bite bit [2] [1] [0]
Secondly, monitoring the data flow of each data channel:
1. the monitoring time point of each time is generated according to the system clock, for example, the statistical analysis is performed once every 100ms (preset monitoring period), and the enable signal monitored every 100ms can be generated in a mode of counting by the system clock.
2. For a write instruction, the data flow statistical method corresponding to a data channel comprises the following steps:
firstly, calculating the data flow of the write instruction:
w_Flow_0=(w_burst_size x w_burst_len);
wherein, w _ Flow _0 is the data Flow of the current write instruction; w _ burst _ size is the data bit width of the current write instruction operation, and w _ burst _ len is the data burst length of the current write operation;
wherein w _ burst _ size is 2m_axi_awsize;w_burst_len=m_axi_awlen+1;
Wherein, m _ AXI _ awsize is a write data bit width flag bit in the AXI protocol, and m _ AXI _ awlen is the write data length specified in the AXI protocol;
secondly, in the same monitoring period, data flow accumulation is carried out on all the writing instructions:
w_Flow_sum=w_Flow_0+w_Flow_1+w_Flow_2+……w_Flow_N;
wherein, w _ Flow _ sum is the sum of all write data flows in the same monitoring period; w _ Flow _0 is the data Flow of the 0 th group of write instructions, w _ Flow _1 is the data Flow of the 1 st group of write instructions, w _ Flow _2 is the data Flow of the 2 nd group of write instructions, and w _ Flow _ N is the data Flow of the nth group of write instructions;
further, when the monitored time point is reached, it is registered:
w_Flow_sum_reg=w_Flow_sum;
wherein w _ Flow _ sum _ reg is a register value of the write data Flow sum of the current period;
and finally, resetting the monitoring period when entering the next monitoring period:
w_Flow_sum=0。
3. for a read instruction, the data flow statistical method corresponding to the data channel comprises the following steps:
firstly, the data flow of the current read instruction is calculated:
r_Flow_0=(r_burst_size x r_burst_len);
wherein r _ Flow _0 is the data Flow of the current read instruction; r _ burst _ size is the data bit width of the current read instruction operation, and r _ burst _ len is the data burst length of the current read operation;
wherein r _ burst _ size is 2m_axi_awsize;r_burst_len=m_axi_awlen+1;
Wherein, m _ AXI _ awsize is a bit width flag bit of read data in an AXI protocol, and m _ AXI _ awlen is the length of the read data specified in the AXI protocol;
secondly, in the same monitoring period, data flow accumulation is carried out on all the reading instructions:
r_Flow_sum=r_Flow_0+r_Flow_1+r_Flow_2+……r_Flow_N;
wherein r _ Flow _ sum is the sum of all read data flows in the same monitoring period; r _ Flow _0 is the data Flow of the read instruction of the 0 th group, r _ Flow _1 is the data Flow of the read instruction of the 1 st group, r _ Flow _2 is the data Flow of the read instruction of the 2 nd group, r _ Flow _ N is the data Flow of the read instruction of the Nth group;
further, when the monitored time point is reached, it is registered:
r_Flow_sum_reg=r_Flow_sum;
wherein r _ Flow _ sum _ reg is a register value of the read data Flow sum of the current period;
and finally, resetting the monitoring period when entering the next monitoring period:
r_Flow_sum=0。
and thirdly, performing arbitration weight calculation, calculating the bandwidth requirement of each data channel according to the monitoring result of the read-write data flow of each data channel, and calculating the weight of each data channel during arbitration, wherein the calculation methods of the data reading channel and the data writing channel are the same, and repeated introduction is avoided.
1. Calculating the maximum bandwidth of the data channel:
Flow_max=fsys*data_width;
wherein, Flow _ max is the maximum bandwidth of the data channel; f. ofsysThe system clock frequency is adopted, and the data _ width is the bus data bit width;
2. the bandwidth requirement ratios for each write data channel are calculated and scaled to the base arbitration weights for each write data channel, e.g., the total arbitration weight is set to 64, taking the structure in FIG. 3 as an example:
firstly, the sum of write data flow in each write data channel is calculated:
w_Flow_sum_all_chan=w_Flow_sum_reg_00+w_Flow_sum_reg_01+w_Flow_sum_reg_10+r_Flow_sum_reg_11;
wherein w _ Flow _ sum _ all _ chan is the sum of all write data flows; w _ Flow _ sum _ reg _00 writes slave0 channel data traffic for master0, w _ Flow _ sum _ reg _01 writes slave 1 channel data traffic for master0, w _ Flow _ sum _ reg _10 writes slave0 channel data traffic for master1, and w _ Flow _ sum _ reg _11 writes slave 1 channel data traffic for master 1;
further, a base arbitration weight for each write data channel is calculated:
w_weight_00=w_Flow_sum_reg_00/w_Flow_sum_all_chan*64;
w_weight_01=w_Flow_sum_reg_01/w_Flow_sum_all_chan*64;
w_weight_10=w_Flow_sum_reg_10/w_Flow_sum_all_chan*64;
w_weight_11=w_Flow_sum_reg_11/w_Flow_sum_all_chan*64;
w _ weight _00 is a write slave0 channel basis arbitration weight for master0, w _ weight _01 is a write slave 1 channel basis arbitration weight for master0, w _ weight _10 is a write slave0 channel basis arbitration weight for master1, and w _ weight _11 is a write slave 1 channel basis arbitration weight for master 1.
3. The bandwidth requirement ratios of the respective read data channels are calculated and scaled to the basic arbitration weights for the respective read data channels, e.g., the total arbitration weight is set to 64, taking the structure in fig. 3 as an example:
firstly, the sum of the read data flow in each read data channel is calculated:
r_Flow_sum_all_chan=r_Flow_sum_reg_00+r_Flow_sum_reg_01+r_Flow_sum_reg_10+r_Flow_sum_reg_11;
wherein r _ Flow _ sum _ all _ chan is the sum of all read data flows; r _ Flow _ sum _ reg _00 reads the channel data traffic of the slave device 0 for the master device 0, r _ Flow _ sum _ reg _01 reads the channel data traffic of the slave device 1 for the master device 0, r _ Flow _ sum _ reg _10 reads the channel data traffic of the slave device 0 for the master device 1, and r _ Flow _ sum _ reg _11 reads the channel data traffic of the slave device 1 for the master device 1;
further, the basic arbitration weights for each read data channel are calculated:
r_weight_00=r_Flow_sum_reg_00/r_Flow_sum_all_chan*64;
r_weight_01=r_Flow_sum_reg_01/r_Flow_sum_all_chan*64;
r_weight_10=r_Flow_sum_reg_10/r_Flow_sum_all_chan*64;
r_weight_11=r_Flow_sum_reg_11/r_Flow_sum_all_chan*64;
wherein r _ weight _00 is a master0 read slave0 channel basis arbitration weight, r _ weight _01 is a master0 read slave 1 channel basis arbitration weight, r _ weight _10 is a master1 read slave0 channel basis arbitration weight, and r _ weight _11 is a master1 read slave 1 channel basis arbitration weight.
4. Actual arbitration weight calculation:
calculating the actual arbitration weights of the data channels according to the basic arbitration weights, wherein as can be seen from the above steps 2 and 3, the basic arbitration weights comprise integer and fractional parts, and the generation of the actual arbitration right can be realized as follows:
(1) according to the comparison, finding out the data channel with the maximum basic arbitration weight, and finally calculating the actual arbitration weight;
(2) when the integer part of the basic arbitration weight is 0, the actual arbitration weight is 1;
(3) when the integer part of the basic arbitration weight is not 0, the actual arbitration weight is equal to the integer part;
(4) the data channel with the largest base arbitration weight has an actual arbitration weight equal to 64 minus the sum of the other actual arbitration weights.
Fourthly, generating time slices according to the actual arbitration weight: a complete monitoring cycle is divided into 64 times by means of clock counting, and the time slices are divided according to the actual arbitration weight value, for example, referring to fig. 4, fig. 4 is a schematic diagram of the monitoring cycle division provided in the present application.
Fifthly, time slice ownership switching: when the time of the bus resource owned by one of the data channels reaches the size of the time slice (i.e. the allocation time), the time slice ownership is switched, i.e. the next data channel is switched.
And sixthly, updating the new arbitration parameters when one monitoring period is finished.
Therefore, the bus resource allocation method provided by the embodiment of the application can monitor the data traffic of each data channel in real time, and can adjust the arbitration priorities of different data channels in real time in the system operation process by analyzing the data traffic of each data channel, so that the data channel of the high-speed high-bandwidth read-write request obtains a corresponding high priority, and the data channel of the low-speed low-bandwidth read-write request obtains a corresponding low priority, thereby realizing reasonable allocation of bus resources, effectively improving the utilization rate of the bus resources, and further improving the system performance.
To solve the above technical problem, the present application further provides a bus resource allocation apparatus, please refer to fig. 5, where fig. 5 is a schematic structural diagram of the bus resource allocation apparatus provided in the present application, and the bus resource allocation apparatus may include:
the data flow monitoring module 1 is used for counting the data flow of each data channel in a preset monitoring period;
the data flow statistic module 2 is used for calculating and obtaining total data flow according to the data flow of each data channel;
the arbitration weight distribution module 3 is used for calculating and obtaining the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel;
and the time slicing module 4 is configured to perform time slicing on the preset monitoring period according to each arbitration weight to obtain allocation time corresponding to each data channel, so that each data channel obtains bus resources according to the allocation time.
Therefore, the bus resource allocation device provided in the embodiment of the present application can monitor the data traffic of each data channel in real time, and can adjust the arbitration priority of different data channels in real time in the system operation process by analyzing the data traffic of each data channel, so that the data channel of the high-speed high-bandwidth read-write request obtains a corresponding high priority, and the data channel of the low-speed low-bandwidth read-write request obtains a corresponding low priority, thereby implementing reasonable allocation of bus resources, effectively improving the utilization rate of bus resources, and further improving the system performance.
As a preferred embodiment, the data traffic monitoring module 1 may include:
the data writing flow monitoring unit is used for counting the data writing flows corresponding to all the writing instructions in the data writing channel in a preset monitoring period when the data writing channel is the data writing channel;
and the read data flow monitoring unit is used for counting the read data flows corresponding to all the read instructions in the read data channel in a preset monitoring period when the data channel is the read data channel.
As a preferred embodiment, the write data traffic monitoring unit may be specifically configured to determine a write data bit width flag bit and a write data length according to a write instruction; calculating according to the bit width flag bit of the write data to obtain the bit width of the write data; calculating according to the write data length to obtain the write data burst length; calculating according to the write data bit width and the write data burst length to obtain write data flow corresponding to the write instruction; and counting the write data flow corresponding to all the write instructions to obtain the write data flow of the write data channel in a preset monitoring period.
As a preferred embodiment, the read data traffic monitoring unit may be specifically configured to determine a read data bit width flag bit and a read data length according to a read instruction; calculating according to the read data bit width zone bit to obtain the read data bit width; calculating according to the read data length to obtain the read data burst length; calculating according to the read data bit width and the read data burst length to obtain read data flow corresponding to the read instruction; and counting the read data flow corresponding to all the read instructions to obtain the read data flow of the read data channel in a preset monitoring period.
As a preferred embodiment, the bus resource allocating apparatus may further include a bandwidth determining module, configured to calculate and obtain a maximum bandwidth of the data channel according to a preset monitoring period and a bus data bit width before obtaining the arbitration weight of each data channel according to the preset total weight, the total data traffic, and the data traffic of each data channel; judging whether the data flow of each data channel exceeds the maximum bandwidth of the corresponding data channel; and if not, calculating to obtain the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel.
As a preferred embodiment, the bandwidth determining module may be further configured to calculate, according to a preset total weight, an average arbitration weight of each data channel when the data traffic of the data channel exceeds the maximum bandwidth of the corresponding data channel; and time slicing is carried out on the preset monitoring period according to the average arbitration weight, and the distribution time corresponding to each data channel is obtained, so that each data channel can obtain the bus resource according to the distribution time.
As a preferred embodiment, the time slicing module 4 may be specifically configured to switch to a next data channel when the time for the data channel to acquire the bus resource reaches the allocation time, until all the data channels are switched.
For the introduction of the apparatus provided in the present application, please refer to the above method embodiments, which are not described herein again.
To solve the above technical problem, the present application further provides a bus resource allocation system, please refer to fig. 6, where fig. 6 is a schematic structural diagram of a bus resource allocation system provided in the present application, and the bus resource allocation apparatus may include:
a memory 10 for storing a computer program;
the processor 20, when executing the computer program, may implement the steps of any of the bus resource allocation methods described above.
For the introduction of the system provided by the present application, please refer to the above method embodiment, which is not described herein again.
To solve the above problem, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, can implement the steps of any one of the above bus resource allocation methods.
The computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
For the introduction of the computer-readable storage medium provided in the present application, please refer to the above method embodiments, which are not described herein again.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The technical solutions provided by the present application are described in detail above. The principles and embodiments of the present application are explained herein using specific examples, which are provided only to help understand the method and the core idea of the present application. It should be noted that, for those skilled in the art, without departing from the principle of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall into the protection scope of the present application.

Claims (10)

1. A method for allocating bus resources, comprising:
in a preset monitoring period, counting the data flow of each data channel;
calculating to obtain total data flow according to the data flow of each data channel;
calculating to obtain the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel;
and time slicing is carried out on the preset monitoring period according to each arbitration weight to obtain the distribution time corresponding to each data channel, so that each data channel obtains bus resources according to the distribution time.
2. The method according to claim 1, wherein the counting data traffic of each data channel in a preset monitoring period includes:
when the data channel is a data writing channel, counting data writing flow corresponding to all writing instructions in the data writing channel in the preset monitoring period;
and when the data channel is a data reading channel, counting the data reading flow corresponding to all the reading instructions in the data reading channel in the preset monitoring period.
3. The method of claim 2, wherein the counting write data flows corresponding to all write commands in the write data channel in the preset monitoring period includes:
determining a write data bit width flag bit and a write data length according to the write instruction;
calculating according to the write data bit width zone bit to obtain a write data bit width;
calculating according to the write data length to obtain a write data burst length;
calculating to obtain the write data flow corresponding to the write instruction according to the write data bit width and the write data burst length;
and counting the write data flow corresponding to all the write instructions to obtain the write data flow of the write data channel in the preset monitoring period.
4. The method according to claim 2, wherein the counting read data traffic corresponding to all read commands in the read data channel in the preset monitoring period includes:
determining a bit width zone bit and a read data length of read data according to the read instruction;
calculating according to the read data bit width zone bit to obtain a read data bit width;
calculating according to the read data length to obtain a read data burst length;
calculating to obtain the read data flow corresponding to the read instruction according to the read data bit width and the read data burst length;
and counting the read data flow corresponding to all the read instructions to obtain the read data flow of the read data channel in the preset monitoring period.
5. The method according to any one of claims 1 to 4, wherein before the obtaining of the arbitration weight of each data channel according to the preset total weight, the total data traffic and the data traffic of each data channel, the method further comprises:
calculating to obtain the maximum bandwidth of the data channel according to the preset monitoring period and the bit width of the bus data;
judging whether the data flow of each data channel exceeds the maximum bandwidth of the corresponding data channel;
and if not, executing the step of calculating and obtaining the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel.
6. The bus resource allocation method of claim 5, further comprising:
when the data flow of the data channel exceeds the maximum bandwidth of the corresponding data channel, calculating and obtaining the average arbitration weight of each data channel according to the preset total weight;
and time slicing is carried out on the preset monitoring period according to the average arbitration weight, and the distribution time corresponding to each data channel is obtained, so that each data channel obtains bus resources according to the distribution time.
7. The method according to claim 1, wherein the obtaining of the bus resource by each data channel according to the allocation time includes:
and when the time for acquiring the bus resources by the data channel reaches the allocation time, switching to the next data channel until all the data channels are switched.
8. A bus resource allocation apparatus, comprising:
the data flow monitoring module is used for counting the data flow of each data channel in a preset monitoring period;
the data flow statistic module is used for calculating and obtaining total data flow according to the data flow of each data channel;
the arbitration weight distribution module is used for calculating and obtaining the arbitration weight of each data channel according to the preset total weight, the total data flow and the data flow of each data channel;
and the time slicing module is used for time slicing the preset monitoring period according to each arbitration weight to obtain the distribution time corresponding to each data channel so that each data channel obtains the bus resource according to the distribution time.
9. A bus resource allocation system, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the bus resource allocation method according to any one of claims 1 to 7 when executing said computer program.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the bus resource allocation method according to any one of claims 1 to 7.
CN202110678023.8A 2021-06-18 2021-06-18 Bus resource allocation method, device and related equipment Pending CN113467938A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110678023.8A CN113467938A (en) 2021-06-18 2021-06-18 Bus resource allocation method, device and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110678023.8A CN113467938A (en) 2021-06-18 2021-06-18 Bus resource allocation method, device and related equipment

Publications (1)

Publication Number Publication Date
CN113467938A true CN113467938A (en) 2021-10-01

Family

ID=77868606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110678023.8A Pending CN113467938A (en) 2021-06-18 2021-06-18 Bus resource allocation method, device and related equipment

Country Status (1)

Country Link
CN (1) CN113467938A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113806258A (en) * 2021-11-16 2021-12-17 苏州浪潮智能科技有限公司 Dynamic self-adaptive virtual channel mapping method, device and storage medium
CN113868157A (en) * 2021-08-20 2021-12-31 山东云海国创云计算装备产业创新中心有限公司 Arbitration method and device for AHB system bus, AHB system bus and medium
CN114710411A (en) * 2022-04-07 2022-07-05 中国联合网络通信集团有限公司 Bandwidth allocation method, device, gateway and storage medium
CN115622832A (en) * 2022-09-27 2023-01-17 苏州海格电控股份有限公司 CAN communication time-sharing multiplexing control method, device, terminal and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1929471A (en) * 2005-09-05 2007-03-14 中兴通讯股份有限公司 Device for dispatching and arbitration
US20090290551A1 (en) * 2008-05-21 2009-11-26 Realtek Semiconductor Corp. Channel utilizing method and system for wireless networks
CN108848040A (en) * 2018-06-13 2018-11-20 迈普通信技术股份有限公司 File transmitting method, equipment and computer readable storage medium
CN111356181A (en) * 2020-02-25 2020-06-30 杭州迪普信息技术有限公司 Flow forwarding method and device, network equipment and computer readable storage medium
CN112306939A (en) * 2020-10-29 2021-02-02 山东云海国创云计算装备产业创新中心有限公司 Bus calling method, device, equipment and storage medium
CN112597077A (en) * 2020-12-11 2021-04-02 北京时代民芯科技有限公司 Bus interconnection system with dynamically configured channels

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1929471A (en) * 2005-09-05 2007-03-14 中兴通讯股份有限公司 Device for dispatching and arbitration
US20090290551A1 (en) * 2008-05-21 2009-11-26 Realtek Semiconductor Corp. Channel utilizing method and system for wireless networks
CN108848040A (en) * 2018-06-13 2018-11-20 迈普通信技术股份有限公司 File transmitting method, equipment and computer readable storage medium
CN111356181A (en) * 2020-02-25 2020-06-30 杭州迪普信息技术有限公司 Flow forwarding method and device, network equipment and computer readable storage medium
CN112306939A (en) * 2020-10-29 2021-02-02 山东云海国创云计算装备产业创新中心有限公司 Bus calling method, device, equipment and storage medium
CN112597077A (en) * 2020-12-11 2021-04-02 北京时代民芯科技有限公司 Bus interconnection system with dynamically configured channels

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
苟彦: "存储区域网络在联机事务处理下的性能优化及应用", 《中国优秀博硕士学位论文全文数据库(硕士)》, no. 01, pages 1 - 65 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113868157A (en) * 2021-08-20 2021-12-31 山东云海国创云计算装备产业创新中心有限公司 Arbitration method and device for AHB system bus, AHB system bus and medium
CN113806258A (en) * 2021-11-16 2021-12-17 苏州浪潮智能科技有限公司 Dynamic self-adaptive virtual channel mapping method, device and storage medium
CN113806258B (en) * 2021-11-16 2022-02-18 苏州浪潮智能科技有限公司 Dynamic self-adaptive virtual channel mapping method, device and storage medium
WO2023087621A1 (en) * 2021-11-16 2023-05-25 苏州浪潮智能科技有限公司 Dynamic self-adaptive virtual channel mapping method and apparatus, and storage medium
CN114710411A (en) * 2022-04-07 2022-07-05 中国联合网络通信集团有限公司 Bandwidth allocation method, device, gateway and storage medium
CN114710411B (en) * 2022-04-07 2023-10-31 中国联合网络通信集团有限公司 Bandwidth allocation method, device, gateway and storage medium
CN115622832A (en) * 2022-09-27 2023-01-17 苏州海格电控股份有限公司 CAN communication time-sharing multiplexing control method, device, terminal and storage medium

Similar Documents

Publication Publication Date Title
CN113467938A (en) Bus resource allocation method, device and related equipment
CN109783224B (en) Task allocation method and device based on load allocation and terminal equipment
US7644142B2 (en) Methods and apparatus to perform process placement for distributed applications
CN108027889B (en) Training and scheduling method for incremental learning cloud system and related equipment
CN104268018B (en) Job scheduling method and job scheduler in a kind of Hadoop clusters
CN103502944B (en) Virutal machine memory method of adjustment and equipment
CN110351375B (en) Data processing method and device, computer device and readable storage medium
CN106878389B (en) Method and device for resource scheduling in cloud system
CN104320854A (en) Resource scheduling method and device
CN105511964A (en) I/O request processing method and device
CN114244718A (en) Power transmission line communication network equipment management system
CN113886034A (en) Task scheduling method, system, electronic device and storage medium
CN114237908A (en) Resource arrangement optimization method and system for edge computing
CN114926318A (en) Multi-GPU aggregation method, image processing device, electronic equipment and storage medium
CN107396445A (en) A kind of information reporting dispatching method, system, host device and slave devices
CN106020971B (en) CPU scheduling method and device in cloud host system
US10789012B2 (en) Write method and write apparatus for storage device
CN116150067A (en) Bandwidth adjustment method, device, electronic equipment and storage medium
CN114710411B (en) Bandwidth allocation method, device, gateway and storage medium
CN111767188B (en) Training task monitoring method and device
US10257823B2 (en) Training resource allocation method, apparatus, and system
CN112788768A (en) Communication resource allocation method and device
CN108304252B (en) Task scheduling method and device
CN111984406A (en) Method, device and equipment for distributing CPU (Central processing Unit) resources in management process of virtualization platform
CN107870815B (en) Task scheduling method and system of distributed system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination