CN113868157B - Arbitration method and device for AHB system bus, AHB system bus and medium - Google Patents
Arbitration method and device for AHB system bus, AHB system bus and medium Download PDFInfo
- Publication number
- CN113868157B CN113868157B CN202110962618.6A CN202110962618A CN113868157B CN 113868157 B CN113868157 B CN 113868157B CN 202110962618 A CN202110962618 A CN 202110962618A CN 113868157 B CN113868157 B CN 113868157B
- Authority
- CN
- China
- Prior art keywords
- data
- arbitration
- data channel
- weight
- monitoring period
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000012544 monitoring process Methods 0.000 claims abstract description 108
- 238000012545 processing Methods 0.000 claims description 11
- 238000004364 calculation method Methods 0.000 claims description 10
- 238000004590 computer program Methods 0.000 claims description 10
- 230000005856 abnormality Effects 0.000 claims description 6
- 230000005540 biological transmission Effects 0.000 description 9
- DRHKJLXJIQTDTD-OAHLLOKOSA-N Tamsulosine Chemical compound CCOC1=CC=CC=C1OCCN[C@H](C)CC1=CC=C(OC)C(S(N)(=O)=O)=C1 DRHKJLXJIQTDTD-OAHLLOKOSA-N 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 238000011161 development Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
- G06F13/12—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor
- G06F13/124—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine
- G06F13/126—Program control for peripheral devices using hardware independent of the central processor, e.g. channel or peripheral processor where hardware is a sequential transfer control unit, e.g. microprocessor, peripheral processor or state-machine and has means for transferring I/O instructions and statuses between control unit and main processor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/14—Handling requests for interconnection or transfer
- G06F13/16—Handling requests for interconnection or transfer for access to memory bus
- G06F13/1605—Handling requests for interconnection or transfer for access to memory bus based on arbitration
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Microelectronics & Electronic Packaging (AREA)
- Bus Control (AREA)
Abstract
The application discloses an arbitration method and device for an AHB system bus, the AHB system bus and a medium, wherein the arbitration method comprises the following steps: monitoring the data flow of each data channel in real time with a preset monitoring period to obtain a first data flow corresponding to each data channel; determining the actual arbitration weight of each data channel by utilizing each first data flow when each preset monitoring period is finished; and dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to transmit data in the corresponding time slice. The bus utilization rate of the AHB system can be improved, and further the performance of the SOC chip is improved.
Description
Technical Field
The present application relates to the field of chip design technologies, and in particular, to an arbitration method and apparatus for an AHB system bus, and a medium.
Background
With the continuous development of integrated circuits, the requirements on the processing speed performance of SOC (System on Chip) chips are increasing. The system bus, which serves as a backbone bridge connecting the individual modules, has an important impact on the performance of the SOC system, especially in systems with multiple masters and multiple slaves. The arbitration mechanism of the system bus affects the read-write efficiency of the multipath data, and further affects the performance of the SOC chip. The AHB (i.e., ADVANCED HIGH Performance Bus) is a high-speed Bus in an AMBA (i.e., advanced Microcontroller Bus Architecture, advanced microcontroller Bus architecture) Bus system, supports continuous transmission and segmented transmission in a clock edge operation, can connect multiple master devices, supports Bus width configuration, and supports byte, half-word, and word transmission. A typical AHB system consists of multiple master-slave devices and buses. The master device is typically operated by devices such as a CPU (i.e., central Processing Unit, a central processing unit), a DMA (i.e., direct Memory Access, direct Memory Access), and a DSP (i.e., DIGITAL SIGNAL Process, digital signal processing), the slave device is typically operated by an external Memory interface such as an internal RAM (i.e., random Access Memory, random-Access Memory) such as a Sram (Static Random-Access Memory) controller, a Flash (Flash) controller, an AHB-to-APB (i.e., ADVANCED PERIPHERAL Bus) bridge, and some other peripheral devices.
Currently, an arbitration mechanism of an AHB system bus is usually to preset weight parameters of each data channel, so that when the AHB system actually operates, the problem of low utilization rate of the AHB system bus exists.
Disclosure of Invention
Accordingly, the present application is directed to an arbitration method and apparatus for an AHB system bus, and a medium thereof, which can improve the utilization of the AHB system bus, thereby improving the performance of an SOC chip. The specific scheme is as follows:
in a first aspect, the present application discloses an arbitration method for an AHB system bus, including:
Monitoring the data flow of each data channel in real time with a preset monitoring period to obtain a first data flow corresponding to each data channel;
determining the actual arbitration weight of each data channel by utilizing each first data flow when each preset monitoring period is finished;
and dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to transmit data in the corresponding time slice.
Optionally, the monitoring the data traffic of each data channel in real time with a preset monitoring period to obtain a first data traffic corresponding to each data channel includes:
Monitoring the data flow of each instruction corresponding to each data channel in real time according to a preset monitoring period to obtain a second data flow corresponding to each instruction;
And for any data channel, calculating the sum of second data flows of all instructions corresponding to the data channel in each preset monitoring period to obtain the first data flow of the data channel in each preset monitoring period.
Optionally, the monitoring the data traffic of each instruction corresponding to each data channel includes:
And calculating the data flow of each instruction corresponding to each data channel by using the data bit width of each instruction operation and the actual data burst length of each instruction operation.
Optionally, the determining the actual arbitration weight of each data channel by using each first data flow includes:
calculating the sum of the first data flows to obtain the total data flow of each data channel;
Calculating a basic arbitration weight corresponding to each data channel by using a preset weight total number, the first data flow of each data channel and the total data flow;
An actual arbitration weight for each of the data lanes is determined based on the base arbitration weights.
Optionally, the determining the actual arbitration weight of each data channel based on the base arbitration weight includes:
Determining the maximum basic arbitration weight from the basic arbitration weights;
For the non-maximum basic arbitration weight, if the integer part is 0, determining a preset value as the actual arbitration weight of the corresponding data channel, otherwise, determining the integer part as the actual arbitration weight of the corresponding data channel;
Determining the sum of actual arbitration weights corresponding to the non-maximum basic arbitration weights to obtain a weight sum;
And taking the difference value between the total number of the preset weights and the weight sum as the actual arbitration weight of the data channel corresponding to the maximum basic arbitration weight.
Optionally, before calculating the basic arbitration weight corresponding to each data channel by using the preset weight total number, the first data flow of each data channel, and the total data flow, the method further includes:
Judging whether channel abnormality exists or not by using the total data flow and the bus data bit width, if so, determining the actual arbitration weight of each data channel as the same preset weight value, otherwise, triggering the step of calculating the basic arbitration weight corresponding to each data channel by using the total preset weight, the first data flow and the total data flow of each data channel.
Optionally, the method further comprises:
Determining a monitoring period coefficient by using the average length of the data packet, the utilization rate of the data bandwidth, the number of master devices of the master devices connected with the AHB system bus and the number of slave devices of the slave devices;
And determining the preset monitoring period by using the monitoring period coefficient and the clock period of the AHB system.
In a second aspect, the present application discloses an arbitration device for an AHB system bus, including:
The channel flow monitoring module is used for monitoring the data flow of each data channel in real time in a preset monitoring period to obtain a first data flow corresponding to each data channel;
An arbitration weight determining module, configured to determine an actual arbitration weight of each data channel by using each first data flow when each preset monitoring period ends;
And the time slice dividing module is used for dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight so that each data channel can utilize an AHB system bus to carry out data transmission in the corresponding time slice.
In a third aspect, the present application discloses an AHB system bus, comprising:
a storage unit for storing a computer program;
and the processing unit is used for executing the computer program to realize the arbitration method of the AHB system bus.
In a fourth aspect, the present application discloses a computer readable storage medium storing a computer program which, when executed by a processing unit, implements the foregoing method of arbitration for an AHB system bus.
The method comprises the steps of monitoring the data flow of each data channel in real time according to a preset monitoring period to obtain a first data flow corresponding to each data channel; determining the actual arbitration weight of each data channel by utilizing each first data flow when each preset monitoring period is finished; and dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to transmit data in the corresponding time slice. The application monitors the data flow of each data channel in real time according to the preset period, determines the actual arbitration weight of each channel according to the real-time flow data of each data channel, and divides the next preset monitoring period according to the actual arbitration weight, thus determining the bus-owned time of each data channel, and enabling the bus-owned time of the data channel with large real-time data flow to be longer and the bus-owned time of the data channel with small real-time data flow to be relatively shorter, namely enabling the high-speed high-bandwidth read-write request to obtain the corresponding high priority and the low-speed low-bandwidth read-write request to obtain the corresponding low priority, thereby improving the bus utilization rate of the AHB system and further improving the performance of the SOC chip.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of an arbitration method for an AHB system bus according to the present application;
fig. 2 is a schematic structural diagram of an AHB system according to the present disclosure;
FIG. 3 is a flow chart of an arbitration method for an AHB system bus according to the present application;
FIG. 4 is a schematic diagram of a specific time slice division disclosed in the present application;
Fig. 5 is a schematic diagram of an arbitration device for an AHB system bus according to the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Currently, an arbitration mechanism of an AHB system bus is usually to preset weight parameters of each data channel, so that when the AHB system actually operates, the problem of low utilization rate of the AHB system bus exists. Therefore, the application provides an arbitration scheme of the AHB system bus, which can improve the utilization rate of the AHB system bus and further improve the performance of the SOC chip.
Referring to fig. 1, the embodiment of the application discloses an arbitration method for an AHB system bus, which comprises the following steps:
Step S11: and monitoring the data flow of each data channel in real time according to a preset monitoring period to obtain a first data flow corresponding to each data channel.
In a specific embodiment, the monitoring cycle coefficient can be determined by using the average length of the data packet, the data bandwidth utilization rate, the number of master devices of the master devices connected with the AHB system bus and the number of slave devices of the slave devices; and determining the preset monitoring period by using the monitoring period coefficient and the clock period of the AHB system.
Specifically, the time point of each monitoring can be generated according to the system clock, and each Tc time is statistically analyzed once, and the enabling signal monitored every Tc is generated in a system clock counting mode, namely, the preset monitoring period is Tc. Specifically, the method can be determined by the following formula:
tc=k×t; wherein, t=1/fsys, T is the clock period of the AHB system, fsys is the clock frequency of the AHB system, and K is the monitoring period coefficient.
And k= LENGTHAVE MS BW 16;
Wherein ms=master_num×2+slave_num;
Master_num is the number of Master devices, slave_num is the number of Slave devices, LENGTHAVE is the average length of data packets, MS is the equivalent value of the number of devices, BW is the utilization rate of data bandwidth, and BW is an estimated value in the process of project development.
The average length of the data packet is a predefined value, the value is defined according to the performance of the master-slave equipment and the application scene, and the data bandwidth utilization rate is an estimated value obtained by estimation according to the actual application scene.
It should be noted that if the preset monitoring period is too long, the monitoring is not real-time enough, and the actual data flow condition of each channel in the system may not be reflected due to too short monitoring period, for example, only one device sends data to another device in the period. The embodiment of the application obtains the optimal value by considering the data bandwidth utilization rate, the average length of the data packet, the number of devices and the like. For example, K may be 10000, that is, TC is 10000 times of a system clock period, which is an optimal value considering a data bandwidth utilization rate, an average length of a data packet, and the like in a certain application scenario.
Further, in a specific embodiment, the embodiment monitors the data flow of each instruction corresponding to each data channel in real time in a preset monitoring period to obtain a second data flow corresponding to each instruction; and for any data channel, calculating the sum of second data flows of all instructions corresponding to the data channel in each preset monitoring period to obtain the first data flow of the data channel in each preset monitoring period.
In a specific embodiment, the data bit width of each instruction operation and the actual data burst length of each instruction operation may be used to calculate the data flow of each instruction corresponding to each data channel.
It should be noted that, the AHB bus system is generally built by Master (Master device), slave (Slave device), arbiter (arbiter), decoder (Decoder) and other basic devices, and is a multi-Master multi-Slave structure. The embodiment of the application mainly considers an arbitrator part and arbitrates by monitoring the flow data of each data channel in real time. For example, referring to fig. 2, an embodiment of the present application discloses a specific AHB system structure schematic, including a master device 0, a master device 1, a master device 2, and a master device 3, a slave device 0, a slave device 1, and a slave device 3, and a bus. The following describes an arbitration scheme of the AHB system bus provided by the present application by taking fig. 2 as an example, but the scheme provided by the present application is not limited to the configuration of 4 masters and 3 slaves in fig. 2.
Specifically, the channels are marked according to the number of Master devices, that is, the number of Slave devices of Slave is not considered, for example, the markable channels are:
channel_0 read/write data Channel issued by MASTER_0 (Master 0)
Channel_1 read/write data Channel issued by MASTER_1 (Master 1)
Channel_2 read/write data Channel issued by master_2 (MASTER 2)
Channel_3 read/write data Channel issued by master_3 (MASTER 3)
The flow rate of each channel is calculated in the same manner, and in the following, one of the channels is taken as an example,
Firstly, calculating the data flow of a single instruction, wherein the application does not distinguish reading or writing instructions, and combines calculation:
wr_Flow_0=(wr_burst_size x wr_burst_len);
Wherein wr_flow_0 is the data Flow of a single instruction; wrburst size: the data bit width of a single instruction operation; wrburst len is the actual data burst length for a single instruction operation.
And wr_burst_size=2 hsize, hsize is the transmission byte flag signal in the AHB protocol; HBURST is a burst type signal in the AHB protocol; the correspondence between wr_burst_len and HBURST is shown in table one:
List one
HBURST[2:0] | Type(s) | Description of the invention | wr_burst_len |
000 | SINGLE | Single transmission | 1 |
001 | INCR | Incremental burst of unspecified length | x |
010 | WRAP4 | 4-Beat loop burst | 4 |
011 | INCR4 | Burst of 4 beats delta | 4 |
100 | WRAP8 | 8-Beat loop burst | 8 |
101 | INCR8 | 8 Beat delta burst | 8 |
110 | WRAP16 | 16 Beat loop burst | 16 |
111 | INCR16 | Burst of 16 beats delta | 16 |
When HBURST [2:0] is 001, for the burst mode with indefinite length, wrburst len needs to be calculated according to the actually transmitted data, and the calculation mode is as follows:
when the hready signal is detected as high while htrans is 2 (NONSEQ: discontinuous state) or 3 (SEQ: continuous state), counting is incremented by one,
Cnt_incr=Cnt_incr+1;
When the instruction operation is finished, namely htrans is about to become 0, the instruction operation is assigned to wr_burst_len at the moment;
wr_burst_len=Cnt_incr;
wherein cnt_incr is an intermediate variable in the calculation process, hready is a one-time transmission completion signal in the AHB protocol, and htrans is a current transmission type signal in the AHB protocol.
In the same monitoring period, the flow of each instruction is accumulated to obtain the data flow of the data channel in the period:
wr_Flow_sum=wr_Flow_0+wr_Flow_1+wr_Flow_2+……wr_Flow_N;
Wherein w_flow_sum is the sum of the data flows of all instructions in the same period, wr_flow_0 is the data Flow of the 0 th instruction, wr_flow_1 is the data Flow of the 1 st instruction, wr_flow_2 is the data Flow of the 2 nd instruction, wr_flow_n is the data Flow of the nth instruction,
When the monitored time point is reached, that is, when the end of the preset monitoring period is reached, the monitored time point is registered, wherein wr_flow_sum_reg=wr_flow_sum, and wr_flow_sum_reg is the registered value of the data Flow sum of the current period, and the registered value is cleared to wr_flow_sum=0 in the next system clock period.
Step S12: and determining the actual arbitration weight of each data channel by utilizing each first data flow when each preset monitoring period is finished.
Step S13: and dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to transmit data in the corresponding time slice.
Therefore, the embodiment of the application monitors the data flow of each data channel in real time in a preset monitoring period to obtain the first data flow corresponding to each data channel; determining the actual arbitration weight of each data channel by utilizing each first data flow when each preset monitoring period is finished; and dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to transmit data in the corresponding time slice. The application monitors the data flow of each data channel in real time according to the preset period, determines the actual arbitration weight of each channel according to the real-time flow data of each data channel, and divides the next preset monitoring period according to the actual arbitration weight, thus determining the bus-owned time of each data channel, and enabling the bus-owned time of the data channel with large real-time data flow to be longer and the bus-owned time of the data channel with small real-time data flow to be relatively shorter, namely enabling the high-speed high-bandwidth read-write request to obtain the corresponding high priority and the low-speed low-bandwidth read-write request to obtain the corresponding low priority, thereby improving the bus utilization rate of the AHB system and further improving the performance of the SOC chip.
Referring to fig. 3, the embodiment of the application discloses a specific arbitration method for an AHB system bus, which comprises the following steps:
Step S21: and monitoring the data flow of each data channel in real time according to a preset monitoring period to obtain a first data flow corresponding to each data channel.
The specific implementation of step S21 may refer to the disclosure of the foregoing embodiment, and will not be described herein.
Step S22: and calculating the sum value of the first data flow when each preset monitoring period is finished, and obtaining the total data flow of each data channel.
Step S23: and calculating the corresponding basic arbitration weight of each data channel by using the total number of preset weights, the first data flow of each data channel and the total data flow.
In a specific embodiment, the bandwidth demand ratio of each channel is calculated and scaled to the basic arbitration weight of each channel, for the purpose of calculation, the total weight is set to 128, taking the structure in fig. 2 as an example, the flow sum of each data channel is calculated first, and the total data flow is obtained:
wr_Flow_sum_all_chan=wr_Flow_sum_reg_0+wr_Flow_sum_reg_1+wr_Flow_sum_reg_2+wr_Flow_sum_reg_3;
Wherein wr_flow_sum_all_chan is the sum of the data flows of all the data channels; wrFlow_sum_reg_0 is channel_0 Channel data traffic, wrFlow_sum_reg_1 is channel_1 Channel data traffic, wrFlow_sum_reg_2 is hannel _2 Channel data traffic, and r_Flow_sum_reg_3 is hannel _3 Channel data traffic.
Then, calculating the basic arbitration weight of each channel:
wr_weight_0=128*wr_Flow_sum_reg_0/wr_Flow_sum_all_chan;
wr_weight_1=128*wr_Flow_sum_reg_1/wr_Flow_sum_all_chan;
wr_weight_2=128*wr_Flow_sum_reg_2/wr_Flow_sum_all_chan;
wr_weight_3=128*wr_Flow_sum_reg_3/wr_Flow_sum_all_chan;
wherein wr_weight_0 is a channel_0 Channel base arbitration weight, wr_weight_1 is a channel_1 Channel base arbitration weight, wr_weight_2 is a channel_2 Channel base arbitration weight, and wr_weight_3 is a channel_3 Channel base arbitration weight.
Step S24: an actual arbitration weight for each of the data lanes is determined based on the base arbitration weights.
In a specific embodiment, determining a maximum basic arbitration weight from the basic arbitration weights; for the non-maximum basic arbitration weight, if the integer part is 0, determining a preset value as the actual arbitration weight of the corresponding data channel, otherwise, determining the integer part as the actual arbitration weight of the corresponding data channel; determining the sum of actual arbitration weights corresponding to the non-maximum basic arbitration weights to obtain a weight sum; and taking the difference value between the total number of the preset weights and the weight sum as the actual arbitration weight of the data channel corresponding to the maximum basic arbitration weight.
It should be noted that, if the integer part is 0, the preset value is determined as the actual arbitration weight of the corresponding data channel, so that each channel can be divided into corresponding time slices in the next period, and the situation that the corresponding channel can never obtain the weight and system abnormality occurs is avoided.
That is, in the embodiment of the present application, the actual arbitration weights of the channels are calculated according to the basic arbitration weights, where the basic arbitration weights generally include an integer part and a fractional part, and the channel with the largest basic weight is found according to the comparison, and the actual arbitration weight of the channel is calculated at last, and is not the largest basic arbitration weight, the integer part is 0, and the actual arbitration weight is 1; the integer part is not 0, the actual arbitration weight is equal to the integer part, the channel with the largest basic weight, and the actual arbitration weight is equal to 128 minus other actual arbitration weights.
In addition, before calculating the sum value of the first data traffic to obtain the total data traffic of each data channel, the method further includes: before calculating the basic arbitration weight corresponding to each data channel by using the preset weight total number, the first data flow of each data channel and the total data flow, the method further comprises:
Judging whether channel abnormality exists or not by using the total data flow and the bus data bit width, if so, determining the actual arbitration weight of each data channel as the same preset weight value, otherwise, triggering the step of calculating the basic arbitration weight corresponding to each data channel by using the total preset weight, the first data flow and the total data flow of each data channel.
That is, in the embodiment of the present application, in the process of calculating the bandwidth requirement of each channel through the monitoring result of the flow rate of each channel and calculating the weight of each channel during arbitration, it is first determined whether the channel has an abnormality.
Firstly, multiplying the clock frequency of an AHB system by the bit width of bus data to obtain the maximum bandwidth of a channel:
Flow_max=fsys*data_width;
wherein flow_max is the maximum bandwidth of the channel, fsys is the clock frequency of the AHB system, and data_width is the bus data bit width.
The total data traffic is compared to the channel maximum bandwidth in s (seconds) and the traffic statistics period is Tc, so conversion is required at the time of comparison. If the total data flow is larger than the ratio of the maximum bandwidth of the channel to the preset monitoring period, channel abnormality exists.
When there is a channel anomaly at this time when wr_flow_sum_all_chan > flow_max/Tc, the individual channels arbitrate according to the same weight. When wr_flow_sum_all_chan < flow_max/Tc or wr_flow_sum_all_chan=flow_max/Tc, triggering the step of calculating the basic arbitration weight corresponding to each data channel by using the total number of preset weights, the first data Flow of each data channel and the total data Flow.
Step S25: and dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to transmit data in the corresponding time slice.
For example, a complete monitoring period is divided into 128 parts by means of clock counting, and is divided into different time slices according to actual arbitration weights, as shown in fig. 4, the embodiment of the application discloses a specific time slice division schematic diagram, and in the next monitoring period, channels 0, 1,2 and 3 respectively correspond to different time slices. In the next period, when the time of the bus owned by one channel reaches the corresponding time slice size, the time slice ownership is switched, and when the period is finished, the arbitration weight is updated.
Therefore, the flow of the AHB bus is monitored and dynamically arbitrated based on the flow, the flow of data can be monitored in real time, automatic arbitration weight calculation is carried out in real time according to the flow information of each channel, and the data is automatically updated in the next monitoring adjustment period. By the method, the ports of the high-speed high-bandwidth read-write requests can obtain corresponding high priority in the actual running process of the SOC system, the low-speed low-bandwidth read-write requests can obtain corresponding low priority, the utilization rate of a system bus can be improved, and the performance, usability and reliability of the whole SOC chip are further improved.
Referring to fig. 5, an embodiment of the present application discloses an arbitration device for an AHB system bus, including:
the channel flow monitoring module 11 is configured to monitor, in real time, a data flow of each data channel in a preset monitoring period, so as to obtain a first data flow corresponding to each data channel;
An arbitration weight determining module 12, configured to determine an actual arbitration weight of each data channel by using each first data flow rate at the end of each preset monitoring period;
And a time slice dividing module 13, configured to divide a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to perform data transmission in the corresponding time slice.
Therefore, the embodiment of the application monitors the data flow of each data channel in real time in a preset monitoring period to obtain the first data flow corresponding to each data channel; determining the actual arbitration weight of each data channel by utilizing each first data flow when each preset monitoring period is finished; and dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight, so that each data channel uses an AHB system bus to transmit data in the corresponding time slice. The application monitors the data flow of each data channel in real time according to the preset period, determines the actual arbitration weight of each channel according to the real-time flow data of each data channel, and divides the next preset monitoring period according to the actual arbitration weight, thus determining the bus-owned time of each data channel, and enabling the bus-owned time of the data channel with large real-time data flow to be longer and the bus-owned time of the data channel with small real-time data flow to be relatively shorter, namely enabling the high-speed high-bandwidth read-write request to obtain the corresponding high priority and the low-speed low-bandwidth read-write request to obtain the corresponding low priority, thereby improving the bus utilization rate of the AHB system and further improving the performance of the SOC chip.
The channel flow monitoring module 11 includes:
the instruction data flow monitoring sub-module is used for monitoring the data flow of each instruction corresponding to each data channel in real time in a preset monitoring period to obtain a second data flow corresponding to each instruction;
And the channel data flow meter operator module is used for calculating the sum value of second data flow of all instructions corresponding to the data channel in each preset monitoring period for any data channel to obtain the first data flow of the data channel in each preset monitoring period.
The instruction data flow monitoring sub-module is specifically configured to calculate the data flow of each instruction corresponding to each data channel by using the data bit width of each instruction operation and the actual data burst length of each instruction operation.
The arbitration weight determining module 12 specifically includes:
The total data flow meter operator module is used for calculating the sum value of the first data flow to obtain the total data flow of each data channel;
The basic arbitration weight calculation sub-module is used for calculating the basic arbitration weight corresponding to each data channel by utilizing the preset weight total number, the first data flow of each data channel and the total data flow;
An actual arbitration weight determination sub-module for determining an actual arbitration weight for each of the data lanes based on the base arbitration weights.
Further, the actual arbitration weight determining submodule is specifically configured to determine a maximum basic arbitration weight from the basic arbitration weights; for the non-maximum basic arbitration weight, if the integer part is 0, determining a preset value as the actual arbitration weight of the corresponding data channel, otherwise, determining the integer part as the actual arbitration weight of the corresponding data channel; determining the sum of actual arbitration weights corresponding to the non-maximum basic arbitration weights to obtain a weight sum; and taking the difference value between the total number of the preset weights and the weight sum as the actual arbitration weight of the data channel corresponding to the maximum basic arbitration weight.
The device also comprises a channel abnormity judging module which is used for judging whether channel abnormity exists by utilizing the total data flow and the bus data bit width, if so, determining the actual arbitration weight of each data channel to be the same preset weight value, otherwise, starting a basic arbitration weight computing sub-module.
The device also comprises a preset monitoring period determining module, wherein the preset monitoring period determining module is used for determining a monitoring period coefficient by utilizing the average length of the data packet, the utilization rate of the data bandwidth, the number of the master devices connected with the AHB system bus and the number of the slave devices; and determining the preset monitoring period by using the monitoring period coefficient and the clock period of the AHB system.
The embodiment of the application discloses an AHB system bus, which comprises a processing unit and a storage unit; wherein the storage unit is used for storing a computer program; the processing unit is configured to execute the computer program to implement the method for arbitrating an AHB system bus disclosed in the foregoing embodiment.
For specific processes of the above-mentioned AHB system bus arbitration method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
Further, the embodiment of the application also discloses a computer readable storage medium for storing a computer program, wherein the computer program is executed by a processing unit to realize the arbitration method of the AHB system bus disclosed in the previous embodiment.
For specific processes of the above-mentioned AHB system bus arbitration method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
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. The software modules may be disposed 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 above detailed description of the arbitration method and device for the AHB system bus, the AHB system bus and the medium provided by the application applies specific examples to illustrate the principle and implementation of the application, and the description of the above examples is only used for helping to understand the method and core idea of the application; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present application, the present description should not be construed as limiting the present application in view of the above.
Claims (9)
1. An arbitration method for an AHB system bus, comprising:
Monitoring the data flow of each data channel in real time with a preset monitoring period to obtain a first data flow corresponding to each data channel;
determining the actual arbitration weight of each data channel by utilizing each first data flow when each preset monitoring period is finished;
Dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight so that each data channel utilizes an AHB system bus to transmit data in the corresponding time slice;
The method further comprises the steps of: determining a monitoring period coefficient by using the average length of the data packet, the utilization rate of the data bandwidth, the number of master devices of the master devices connected with the AHB system bus and the number of slave devices of the slave devices; determining the preset monitoring period by using the monitoring period coefficient and the clock period of the AHB system;
specifically, the calculation formula of the preset monitoring period Tc is as follows:
Tc=K*T;
wherein, t=1/fsys, T is the clock period of the AHB system, fsys is the clock frequency of the AHB system, and K is the monitoring period coefficient;
The calculation formula of the monitoring period coefficient K is as follows:
K= Lengthave * MS * BW * 16;
wherein ms=master_num×2+slave_num;
In the formula, master_num is the number of Master devices, slave_num is the number of Slave devices, LENGTHAVE is the average length of data packets, MS is the equivalent value of the number of devices, and BW is the data bandwidth utilization rate.
2. The method for arbitration of an AHB system bus according to claim 1, wherein the monitoring the data traffic of each data channel in real time with a preset monitoring period, to obtain a first data traffic corresponding to each data channel, includes:
Monitoring the data flow of each instruction corresponding to each data channel in real time according to a preset monitoring period to obtain a second data flow corresponding to each instruction;
And for any data channel, calculating the sum of second data flows of all instructions corresponding to the data channel in each preset monitoring period to obtain the first data flow of the data channel in each preset monitoring period.
3. The method for arbitration of an AHB system bus of claim 2, wherein monitoring the data traffic of each command corresponding to each data channel comprises:
And calculating the data flow of each instruction corresponding to each data channel by using the data bit width of each instruction operation and the actual data burst length of each instruction operation.
4. The method of arbitration for an AHB system bus of claim 1, wherein said determining an actual arbitration weight for each of said data lanes using each of said first data traffic comprises:
calculating the sum of the first data flows to obtain the total data flow of each data channel;
Calculating a basic arbitration weight corresponding to each data channel by using a preset weight total number, the first data flow of each data channel and the total data flow;
An actual arbitration weight for each of the data lanes is determined based on the base arbitration weights.
5. The method of arbitration for an AHB system bus of claim 4, wherein said determining an actual arbitration weight for each of said data lanes based on said base arbitration weights comprises:
Determining the maximum basic arbitration weight from the basic arbitration weights;
For the non-maximum basic arbitration weight, if the integer part is 0, determining a preset value as the actual arbitration weight of the corresponding data channel, otherwise, determining the integer part as the actual arbitration weight of the corresponding data channel;
Determining the sum of actual arbitration weights corresponding to the non-maximum basic arbitration weights to obtain a weight sum;
And taking the difference value between the total number of the preset weights and the weight sum as the actual arbitration weight of the data channel corresponding to the maximum basic arbitration weight.
6. The method for arbitration of an AHB system bus of claim 4, wherein before calculating the base arbitration weight corresponding to each data channel by using a preset total number of weights, the first data traffic of each data channel, and the total data traffic, the method further comprises:
Judging whether channel abnormality exists or not by using the total data flow and the bus data bit width, if so, determining the actual arbitration weight of each data channel as the same preset weight value, otherwise, triggering the step of calculating the basic arbitration weight corresponding to each data channel by using the total preset weight, the first data flow and the total data flow of each data channel.
7. An apparatus for arbitrating an AHB system bus, comprising:
The channel flow monitoring module is used for monitoring the data flow of each data channel in real time in a preset monitoring period to obtain a first data flow corresponding to each data channel;
An arbitration weight determining module, configured to determine an actual arbitration weight of each data channel by using each first data flow when each preset monitoring period ends;
The time slice dividing module is used for dividing a time slice corresponding to each data channel in the next preset monitoring period based on the actual arbitration weight so that each data channel can utilize an AHB system bus to transmit data in the corresponding time slice;
The device is also used for determining a monitoring period coefficient by utilizing the average length of the data packet, the utilization rate of the data bandwidth, the number of the master devices connected with the AHB system bus and the number of the slave devices; determining the preset monitoring period by using the monitoring period coefficient and the clock period of the AHB system;
specifically, the calculation formula of the preset monitoring period Tc is as follows:
Tc=K*T;
wherein, t=1/fsys, T is the clock period of the AHB system, fsys is the clock frequency of the AHB system, and K is the monitoring period coefficient;
The calculation formula of the monitoring period coefficient K is as follows:
K= Lengthave * MS * BW * 16;
wherein ms=master_num×2+slave_num;
In the formula, master_num is the number of Master devices, slave_num is the number of Slave devices, LENGTHAVE is the average length of data packets, MS is the equivalent value of the number of devices, and BW is the data bandwidth utilization rate.
8. An AHB system bus, comprising:
a storage unit for storing a computer program;
A processing unit for executing the computer program to implement the method of arbitration of an AHB system bus according to any one of claims 1 to 6.
9. A computer readable storage medium storing a computer program which, when executed by a processing unit, implements the method of arbitration of an AHB system bus according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110962618.6A CN113868157B (en) | 2021-08-20 | 2021-08-20 | Arbitration method and device for AHB system bus, AHB system bus and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110962618.6A CN113868157B (en) | 2021-08-20 | 2021-08-20 | Arbitration method and device for AHB system bus, AHB system bus and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113868157A CN113868157A (en) | 2021-12-31 |
CN113868157B true CN113868157B (en) | 2024-06-28 |
Family
ID=78988032
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110962618.6A Active CN113868157B (en) | 2021-08-20 | 2021-08-20 | Arbitration method and device for AHB system bus, AHB system bus and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113868157B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005210567A (en) * | 2004-01-26 | 2005-08-04 | Sony Corp | Bus control method and bus control apparatus |
CN101676890A (en) * | 2008-08-15 | 2010-03-24 | 北京北大众志微系统科技有限责任公司 | Bus arbitration method for dynamically adjusting bandwidth allocation and arbitrator thereof |
CN113467938A (en) * | 2021-06-18 | 2021-10-01 | 山东云海国创云计算装备产业创新中心有限公司 | Bus resource allocation method, device and related equipment |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2000148670A (en) * | 1998-11-06 | 2000-05-30 | Nec Corp | Bus access arbitration system |
US20070264938A1 (en) * | 2006-05-10 | 2007-11-15 | Bhaskar Srinivasan | Method and system for adaptive link monitoring in wireless sensor networks |
JP2009043089A (en) * | 2007-08-09 | 2009-02-26 | Ricoh Co Ltd | Bus control device and bus control method |
CN110932989B (en) * | 2019-11-20 | 2021-09-21 | 华南理工大学 | Elephant flow path monitoring and scheduling method based on SDN data center network |
US11055243B1 (en) * | 2020-04-19 | 2021-07-06 | Nuvoton Technology Corporation | Hierarchical bandwidth allocation bus arbiter |
CN112306939A (en) * | 2020-10-29 | 2021-02-02 | 山东云海国创云计算装备产业创新中心有限公司 | Bus calling method, device, equipment and storage medium |
-
2021
- 2021-08-20 CN CN202110962618.6A patent/CN113868157B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005210567A (en) * | 2004-01-26 | 2005-08-04 | Sony Corp | Bus control method and bus control apparatus |
CN101676890A (en) * | 2008-08-15 | 2010-03-24 | 北京北大众志微系统科技有限责任公司 | Bus arbitration method for dynamically adjusting bandwidth allocation and arbitrator thereof |
CN113467938A (en) * | 2021-06-18 | 2021-10-01 | 山东云海国创云计算装备产业创新中心有限公司 | Bus resource allocation method, device and related equipment |
Also Published As
Publication number | Publication date |
---|---|
CN113868157A (en) | 2021-12-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7275119B2 (en) | Early detection and grant, an arbitration scheme for single transfers on AMBA advanced high-performance bus | |
US20120042105A1 (en) | Bus arbitration apparatus | |
US7526593B2 (en) | Packet combiner for a packetized bus with dynamic holdoff time | |
CN110471872B (en) | System and method for realizing M-LVDS bus data interaction based on ZYNQ chip | |
US7624221B1 (en) | Control device for data stream optimizations in a link interface | |
US6920586B1 (en) | Real-time debug support for a DMA device and method thereof | |
EP2751697A1 (en) | Integrating intellectual property (ip) blocks into a processor | |
US7013357B2 (en) | Arbiter having programmable arbitration points for undefined length burst accesses and method | |
US20110283032A1 (en) | Arbitration device | |
US20070067527A1 (en) | Data transfer bus system connecting a plurality of bus masters | |
CN113868157B (en) | Arbitration method and device for AHB system bus, AHB system bus and medium | |
JP2004318340A (en) | Data transfer controller | |
CN113791892A (en) | Data path arbitration method, data path arbitration device and chip | |
EP3579507A1 (en) | Dynamic scheduling method, device, and system | |
CN117009266A (en) | Handshake protocol bus arbitration module and system on chip | |
Steinberg et al. | An empirical analysis of the IEEE-1394 serial bus protocol | |
US20050060452A1 (en) | System and method for generating bus requests in advance based on speculation states | |
KR20170024876A (en) | Scheduling method of system on chip including real-time shared interface | |
US11520725B2 (en) | Performance monitor for interconnection network in an integrated circuit | |
EP2343656A1 (en) | Network scheduling method, computer program product and network-on-chip | |
JP4151362B2 (en) | Bus arbitration method, data transfer device, and bus arbitration method | |
JP2005004563A (en) | Dma transfer controller | |
KR20180074197A (en) | Bus traffic control apparatus and bus system having the same | |
US20110055446A1 (en) | Semiconductor integrated circuit device | |
JP4504737B2 (en) | Performance monitor circuit |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |