Memory access method, device, electronic device and storage medium

By detecting BANK access parameters of multiple channels in parallel, the problem of low DMA channel conflict detection efficiency is solved, efficient parallel access to memory is achieved, and memory access efficiency is improved.

CN114416612BActive Publication Date: 2024-08-23SHENZHEN INTELLIFUSION TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111620489.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-27
Publication Date
2024-08-23
Estimated Expiration
2041-12-27

AI Technical Summary

Technical Problem

As memory capacity increases, conflict detection on DMA channels requires serial processing when accessing multiple BANKs, resulting in large memory access delays and low efficiency.

Method used

By obtaining the memory access requests of multiple channels issued by DMA, parallel conflict detection is performed based on the BANK access parameters of each channel, and the authorization parameters of each channel are determined to achieve parallel access of multiple channels and shorten the logical processing delay.

Benefits of technology

It improves the memory access efficiency, reduces the memory access delay, and improves the memory access efficiency by processing conflict detection of multiple channels in parallel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416612B
    Figure CN114416612B
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and provides a memory access method, device, electronic device and storage medium. The memory includes N BANKs. The memory access method includes: obtaining memory access requests of M channels issued by DMA, where M is an integer greater than 1; obtaining the channel's BANK access parameters according to the memory access request of each channel; the BANK access parameters include N groups of parameters corresponding to the N BANKs one by one; determining the authorization parameters of each channel in parallel according to the BANK access parameters of the M channels; the authorization parameters are used to indicate the BANKs that the channel can access. The memory access method provided by the present invention realizes parallel judgment of conflicts and parallel access to the memory in the scenario where DMA accesses the memory through multiple channels, shortens the logic processing delay, and improves the memory access efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a memory access method, device, electronic device and storage medium. Background Art

[0002] Memory is a memory device used to store information in modern information technology. With the development of computer technology and storage technology, the capacity of memory in electronic devices is getting larger and larger. Usually, memory includes multiple banks (also called storage bodies). As the capacity of memory continues to increase, the number of banks is also increasing.

[0003] In the related art, when direct memory access (DMA) accesses the memory through multiple access channels, it is necessary to detect in series whether the accesses of the multiple channels conflict. The more access channels there are and the more banks there are, the greater the delay of the logic processing, resulting in a larger delay in memory access and very low access efficiency. Summary of the invention

[0004] The present invention provides a memory access method, device, electronic equipment and storage medium, which reduce the memory access delay and improve the access efficiency.

[0005] In a first aspect, the present invention provides a memory access method, which is applied to accessing a memory, wherein the memory includes N BANKs, where N is an integer greater than 1, and the method includes: obtaining memory access requests of M channels issued by DMA; M is an integer greater than 1; obtaining BANK access parameters of the channel according to the memory access request of each of the channels; the BANK access parameters include N groups of parameters corresponding one by one to the N BANKs; determining authorization parameters of each of the channels in parallel according to the BANK access parameters of the M channels; the authorization parameters are used to indicate the BANKs accessible to the channel.

[0006] Optionally, each group of the parameters includes a BANK access identifier and a BANK access address; the BANK access identifier is used to indicate whether the channel accesses the BANK; the authorization parameters of each channel are determined in parallel based on the BANK access parameters of the M channels, including: obtaining the access priorities of the M channels; determining the target channel of each channel based on the access priorities, the priority of the target channel being higher than the priority of the channel; for each channel, determining the authorization parameters of the channel based on the BANK access identifier and BANK access address of the channel and the target channel of the channel.

[0007] Optionally, determining the authorization parameters of the channel according to the BANK access identifier and BANK access address of the channel and the target channel of the channel includes: determining a first parameter and a second parameter of the target channel according to the BANK access identifier of the target channel of the channel, the BANK access address of the channel and the BANK access address of the target channel of the channel; the first parameter is used to indicate a BANK accessible to the channel when the BANK access addresses of the channel and the target channel do not conflict; the second parameter is used to indicate a BANK inaccessible to the channel when the BANK access addresses of the channel and the target channel conflict; determining the authorization parameters of the channel according to the first parameter and the second parameter of the target channel and the BANK access identifier of the channel.

[0008] Optionally, determining the authorization parameters of the channel based on the first parameter and the second parameter of the target channel and the BANK access identifier of the channel includes: determining a third parameter based on the first parameter and the second parameter, the third parameter being used to indicate the BANK accessible to the channel; determining the authorization parameters of the channel based on the third parameter and the BANK access identifier of the channel.

[0009] Optionally, the memory access method also includes: merging the memory access requests of the M channels according to the authorization parameters and BANK access parameters of the M channels to determine a memory signal; the memory signal includes N-dimensional parameters, and the N dimensions correspond one-to-one to the N BANKs; and outputting the memory signal.

[0010] Optionally, the memory signal includes an N-dimensional enable parameter, a memory address parameter, a memory write indication parameter and a memory write data parameter; the enable parameter is used to indicate whether the M channels access the BANK, the memory address parameter is used to indicate the address of the BANK accessed by the M channels, the memory write indication parameter is used to indicate the location where the M channels write data into the BANK, and the memory write data parameter is used to indicate the data to be written.

[0011] Optionally, each group of parameters includes a BANK write indication parameter and a BANK write data parameter; the memory access requests of the M channels are merged according to the authorization parameters and BANK access parameters of the M channels to determine the memory signal, including: determining the enable parameter according to the authorization parameters of the M channels; determining the memory address parameter according to the authorization parameters and BANK access address of the M channels; determining the memory write indication parameter according to the authorization parameters and BANK write indication parameters of the M channels; determining the memory write data parameter according to the authorization parameters and BANK write data parameters of the M channels.

[0012] In a second aspect, a memory access device is provided, which is applied to accessing the memory, wherein the memory includes N BANKs, N is an integer greater than 1, and the device includes: an acquisition module, used to acquire memory access requests of M channels issued by direct memory access DMA; M is an integer greater than 1; a decoding module, used to acquire BANK access parameters of the channel according to the memory access request of each of the channels; the BANK access parameters include N groups of parameters corresponding to the N BANKs one by one; a processing module, used to determine the authorization parameters of each of the channels in parallel according to the BANK access parameters of the M channels; the authorization parameters are used to indicate the BANKs accessible by the channel.

[0013] In a third aspect, the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the memory access method provided by the present invention when executing the computer program.

[0014] In a fourth aspect, a chip is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the memory access method provided by the present invention when executing the computer program.

[0015] In a fifth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the memory access method provided by the present invention.

[0016] The present invention provides a memory access method, device, electronic device and storage medium. By performing BANK decoding on memory access requests of M channels issued by DMA, BANK access parameters for each channel to access each BANK can be obtained. Based on the BANK access parameters, parallel processing logic is used to simultaneously perform conflict detection on the M channels, thereby realizing parallel conflict detection of multiple channels and parallel access to the memory, shortening the logic processing delay and improving the memory access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 A schematic diagram of the principle of DMA accessing a memory provided by an embodiment of the present invention;

[0019] Figure 2 A flow chart of a method for accessing a memory provided by an embodiment of the present invention;

[0020] Figure 3 Another flow chart of a method for accessing a memory provided by an embodiment of the present invention;

[0021] Figure 4 A schematic diagram of a structure of a memory access device provided in an embodiment of the present invention;

[0022] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0024] It will be understood that the terms "first", "second", "third", "fourth", etc. (if any) in the embodiments of the present application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0025] First, the concept of the present invention will be described.

[0026] 1. BAND

[0027] Usually, inside the chip, data is stored in a large matrix in units of bits, and each unit can be called a cell. If you specify a row and a column, you can accurately locate a cell. This is the basic principle of memory chip addressing. This matrix can be called the BANK of the memory chip, also known as the logical BANK. Optionally, the memory chip can be manufactured by dividing the memory capacity into several arrays, that is, the memory chip includes multiple BANKs.

[0028] For example, each bank has 8M cells, and each cell consists of 8 bits, so the total capacity of a bank is 8M×8bit=64Mbit, or 8MB. Assuming that the memory includes 4 banks, the total capacity of the memory is 4×64Mbit=256Mbit, or 32MB.

[0029] With the development of computer technology and storage technology, the capacity of memory in electronic devices is getting larger and larger, and the number of BANKs included in the memory is also increasing.

[0030] In the present invention, the memory includes N BANKs, where N is an integer greater than 1. The present invention does not limit the value of N. For the convenience of description, the present invention takes N=16 as an example for description.

[0031] 2. DMA

[0032] DMA is an important module in electronic devices. DMA transmission can copy data from one address space to another address space without relying on the central processing unit (CPU). It provides high-speed data transmission between peripherals and memory or between memory and memory. When the CPU initializes this transmission action, the transmission action itself is implemented and completed by the DMA controller. DMA transmission does not require the CPU to directly control the transmission, nor does it have interrupt processing. It opens a direct data transmission channel for memory and input / output (IO) devices through hardware, which greatly improves the efficiency of the CPU.

[0033] DMA transmission can access the memory simultaneously through multiple access channels. Access channels can also be called channels. In the present invention, the number of access channels is M, where M is an integer greater than 1. The present invention does not limit the value of M. For the convenience of explanation, the present invention takes M=8 as an example for explanation.

[0034] For example, Figure 1 The schematic diagram of the principle of DMA accessing memory provided by the embodiment of the present invention. Figure 1 As shown, the number M of channels 14 is 8, which can be marked as channel 0 to channel 7. The memory includes 16 BANK13, that is, N=16, marked as BANK0 to BANK15. DMA11 accesses data to 16 BANK13 through 8 channels 14, and each BANK13 can be independently accessed in parallel. Among them, the access module 12 is used to perform conflict judgment on the memory access requests of the 8 channels issued by DMA, and merge the memory access requests of the 8 channels according to the conflict judgment results, so as to realize multi-channel parallel conflict judgment and parallel memory access, shorten the logic processing delay, and improve the access efficiency of the memory. Among them, the present invention does not limit the name of the access module 12, for example, it can also be called a memory access device, a memory access equipment, etc.

[0035] Optionally, DMA access includes but is not limited to at least one of the following: reading data from a memory (referred to as a read request), or writing data to a memory (referred to as a write request).

[0036] Optionally, the memory access requests of the eight channels issued by the DMA may be read requests at the same time, or write requests at the same time, or some may be read requests and some may be write requests.

[0037] 3. Conflict

[0038] In the present invention, there may be conflicts in accessing the same BANK among the M channels, so it is necessary to perform conflict detection on the memory access requests of the M channels issued by the DMA.

[0039] If two channels access the same BANK, but the BANK address is the same, it is determined that there is no conflict, and the two channels are allowed to obtain access authorization to the BANK at the same time. Optionally, in one scenario, the memory access requests of the two channels are both read requests, and the BANK address is the same. Optionally, in another scenario, the memory access requests of the two channels are both write requests, the BANK address is the same, and data is written to different areas in the BANK respectively.

[0040] If two channels access the same BANK, but the addresses of the BANK are different, it is determined that a conflict occurs. Optionally, when it is determined that a conflict occurs, the two channels need to access the BANK serially.

[0041] The technical solution of the present invention is described in detail below with reference to specific embodiments.

[0042] For the convenience of explanation, in various embodiments of the present invention, M=8, N=16 are used as examples for explanation. The 8 channels can be marked as channel 0 to channel 7. The 16 banks can be marked as BANK0 to BANK15. The access priorities of channel 0 to channel 7 decrease in sequence.

[0043] Figure 2 A flow chart of a memory access method provided by an embodiment of the present invention. The memory access method provided by this embodiment can be executed by a memory access device, electronic device or chip for accessing the memory. The memory includes N BANKs, where N is an integer greater than 1. Figure 2 As shown, the memory access method provided in this embodiment may include:

[0044] S201 , obtaining memory access requests of M channels issued by DMA.

[0045] Wherein, M is an integer greater than 1.

[0046] The parameters in the memory access request can be seen in Table 1.

[0047] Table 1 Parameters in memory access request

[0048]

[0049] The following is an example with reference to Table 1.

[0050] The parameters included in the memory access request of 8 channels can be expressed as: dma_req[8], dma_addr[8], dma_wdata[8], dma_wmask[8], dma_rdata[8], dma_rmask[8]. [8] indicates that each parameter is an 8-dimensional array. For example, dma_req[8] can include dma_req[0], dma_req[1], ..., dma_req[7], a total of 8 parameters, which respectively represent the first identification information corresponding to channels 0 to 7.

[0051] Taking the memory access request of channel 0 as an example, the memory access request of channel 0 may include the following parameters: first identification information dma_req[0], first address information dma_addr[0], first write indication parameter dma_wdata[0], first write data parameter dma_wmask[0], first read indication parameter dma_rdata[0] and first read data parameter dma_rmask[0].

[0052] S202: Acquire a BANK access parameter of a channel according to a memory access request of each channel.

[0053] The BANK access parameters include N groups of parameters corresponding to N BANKs one by one.

[0054] Specifically, the bank access parameters of each channel can be obtained by performing bank decoding on the memory access request of each channel. Since each channel can access N banks in parallel, after bank decoding, the memory access request of each channel corresponds to the parameters of N banks, that is, the bank access parameters of each channel include N groups of parameters, and the N groups of parameters correspond to the N banks one by one.

[0055] The bank access parameters of the channel can be found in Table 2.

[0056] Table 2 Channel BANK access parameters

[0057]

[0058] The parameters shown in Table 2 (BANK access identification, BANK access address, BANK write indication parameter, BANK write data parameter, BANK read indication parameter and BANK read data parameter) correspond one-to-one to the parameters shown in Table 1 (first identification information, first address information, first write indication parameter, first write data parameter, first read indication parameter and first read data parameter), and are obtained by performing BANK decoding on the parameters in Table 1.

[0059] The following is an example with reference to Table 2.

[0060] The bank access parameters of 8 channels can be expressed as: dma_bank_req[8]

[16] , dma_bank_addr[8]

[16] , dma_bank_wdata[8]

[16] , dma_bank_wmask[8]

[16] , dma_bank_rdata[8]

[16] , dma_bank_rmask[8]

[16] . [8]

[16] means that each parameter is a 8×16 two-dimensional array, [8] corresponds to 8 channels, and

[16] corresponds to 16 banks.

[0061] For example, dma_bank_req[8]

[16] includes dma_bank_req[0][0]~dma_bank_req[0]

[15] , dma_bank_req[1][0]~dma_b ank_req[1]

[15] , dma_bank_req[2][0]~dma_bank_req[2]

[15] , dma_bank_req[3][0]~dma_bank_req[3 ]

[15] , dma_bank_req[4][0]~dma_bank_req[4]

[15] , dma_bank_req[5][0]~dma_bank_req[5]

[15] , dma _bank_req[6][0]~dma_bank_req[6]

[15] , dma_bank_req[7][0]~dma_bank_req[7]

[15] total 8×16=128 parameters. Among them, dma_bank_req[0][0]~dma_bank_req[0]

[15] represent the bank access identification parameters of the 16 banks corresponding to channel 0.

[0062] Optionally, when the value of dma_bank_req[i][j] is 1, it indicates that the i-th channel needs to access the j-th BANK. When the value of dma_bank_req[i][j] is 0, it indicates that the i-th channel does not need to access the j-th BANK. Where i = 0, 1, ..., M; j = 0, 1, ..., N.

[0063] S203: Determine the authorization parameter of each channel in parallel according to the bank access parameters of the M channels. The authorization parameter is used to indicate the bank that the channel can access.

[0064] Specifically, the BANK access parameters of M channels can indicate the access status of each of the M channels to each of the N BANKs. Therefore, the authorization parameters of the M channels can be determined in parallel according to the BANK access parameters of the M channels. That is, conflict detection can be performed on the M channels at the same time through parallel processing logic to obtain the conflict detection results and determine the BANKs that each channel can access.

[0065] It can be seen that the memory access method provided in this embodiment is suitable for the scenario where DMA accesses N BANKs in parallel through M channels. By performing BANK decoding on the memory access requests of M channels issued by DMA, the BANK access parameters for each channel to access each BANK can be obtained, and the parallel processing logic is used to perform conflict detection on the M channels at the same time based on the BANK access parameters, thereby realizing parallel conflict detection of multiple channels and parallel access to the memory, shortening the logic processing delay, and improving the access efficiency of the memory.

[0066] Optional, Figure 3 Another flow chart of a method for accessing a memory provided by an embodiment of the present invention. Figure 3 As shown, in S203, determining the authorization parameters of each channel in parallel according to the BANK access parameters of the M channels may include:

[0067] S301. Obtain access priorities of M channels.

[0068] Among them, the access priority is used to indicate the access order and / or access authorization order of the M channels. For example. Assume that the access priority of channel 0 is higher than the access priority of channel 1. If the access of channel 0 and channel 1 does not conflict, for example, both access BANK0 and the address of BANK0 is the same. Then, if channel 0 is sure to access BANK0, channel 1 must be able to access BANK0. If the access of channel 0 and channel 1 conflicts, for example, both access BANK0 and the address of BANK0 is different. Then, if channel 0 is sure to access BANK0, channel 1 cannot access BANK0, and channel 0 and channel 1 need to access BANK0 serially.

[0069] Optionally, the access priorities of the M channels may be preset access priorities. For example, the access priorities of channels 0 to 7 decrease in sequence, that is, channel 0 has the highest access priority and channel 7 has the lowest access priority.

[0070] Optionally, the access priorities of the M channels may be obtained in real time.

[0071] S302: Determine a target channel for each channel according to the access priority, wherein the priority of the target channel is higher than the priority of the channel.

[0072] Give an example.

[0073] Assume that the access priorities of channels 0 to 7 decrease in sequence. For channel 2, the target channels include channel 0 and channel 1. For channel 4, the target channels include channel 0 to channel 3. For channel 7, the target channels include channel 0 to channel 6.

[0074] S303: For each channel, determine the authorization parameters of the channel according to the bank access identifier and bank access address of the channel and the target channel of the channel.

[0075] Among them, the BANK access identifier is used to indicate whether a channel accesses a BANK. The BANK access address can be used to determine whether the addresses of two channels with different access priorities conflict. It can be understood that if a channel with a high access priority accesses a certain BANK, and the channels with high access priority and low access priority do not conflict, the channel with low access priority can access the BANK. If a channel with a high access priority accesses a certain BANK, and the channels with high access priority and low access priority conflict, the channel with low access priority cannot access the BANK. If a channel with a high access priority does not access a certain BANK, the channel with low access priority can access the BANK. The channel with low access priority will not affect the channel with high access priority.

[0076] Therefore, for a certain channel, it is only necessary to refer to the target channel with a higher access priority than the channel and the parameters of the channel itself to determine the authorization parameters of the channel and the BANK that the channel can access.

[0077] Give an example.

[0078] For channel 2, the target channels include channel 0 and channel 1. The authorization parameters of channel 2 can be determined according to the bank access identifier and bank access address of channel 2, and the bank access identifiers and bank access addresses of channel 0 and channel 1.

[0079] For channel 7, the target channels include channel 0 to channel 6. The authorization parameters of channel 7 can be determined according to the bank access identifier and bank access address of channel 7, and the bank access identifiers and bank access addresses of channels 0 to channel 6.

[0080] It can be seen that in this implementation, the target channel corresponding to each channel with a higher access priority than the channel can be determined according to the access priorities of the M channels, and the channel is subjected to conflict detection with reference to the target channel with high access priority and the parameters of the channel itself to determine the authorization parameters of the channel, thereby avoiding the processing of relevant parameters of channels with lower access priorities than the channel, improving the detection efficiency of conflict detection on M channels at the same time, shortening the logic processing delay, and improving the access efficiency of the memory.

[0081] Optionally, in S303, determining the authorization parameters of the channel according to the bank access identifier and the bank access address of the channel and the target channel of the channel may include:

[0082] The first parameter and the second parameter are determined according to the bank access identifier of the target channel of the channel, the bank access address of the channel and the bank access address of the target channel of the channel. The first parameter is used to indicate the bank that the channel can access when the bank access address of the channel and the target channel does not conflict. The second parameter is used to indicate the bank that the channel cannot access when the bank access address of the channel and the target channel conflicts.

[0083] The authorization parameter of the channel is determined according to the first parameter and the second parameter of the target channel and the BANK access identifier of the channel.

[0084] Give an example.

[0085] Optionally, in one example, for channel 7, the target channels include channels 0 to 6, i = 0, 1, 2, 3, 4, 5, 6. Conflict detection is performed on channel 7 to determine the authorization parameters of channel 7, which may include:

[0086] Step 71: Determine the first parameter dma_bank_addr_eq7[i] of the i-th target channel according to the following algorithm logic.

[0087] dma_bank_addr_eq7[i]=dma_bank_req[i]&(dma_bank_addr[7]==dma_bank_addr[i])(i=0,1,2,3,4,5,6).

[0088] Among them, & and == are both operators in programming languages, & represents bitwise AND operation, == represents judging whether two operands are equal.

[0089] dma_bank_req[i] represents the BANK access identifier of the i-th target channel, dma_bank_addr[7] represents the BANK access address of the 7th channel, and dma_bank_addr[i] represents the BANK access address of the i-th target channel.

[0090] dma_bank_addr[7] == dma_bank_addr[i], indicating that channel 7 does not conflict with the i-th target channel.

[0091] dma_bank_addr_eq7[i] can indicate the BANK that the i-th target channel can access when channel 7 and the i-th target channel do not conflict.

[0092] Step 72: Determine the second parameter Dma_bank_addr_ne7[i] of the i-th target channel according to the following algorithm logic.

[0093] Dma_bank_addr_ne7[i]=dma_bank_req[i]&(dma_bank_addr[7]!=dma_bank_addr[i])(i=0,1,2,3,4,5,6).

[0094] Among them, != is an operator in programming language, which means to judge whether two operands are different.

[0095] dma_bank_addr[7]!=dma_bank_addr[i], indicating that channel 7 conflicts with the i-th target channel.

[0096] dma_bank_addr_eq7[i] can indicate the BANK that the i-th target channel can access when channel 7 conflicts with the i-th target channel.

[0097] Step 73: According to the first parameter dma_bank_addr_eq7[i], the second parameter Dma_bank_addr_ne7[i] and the BANK access identifier dma_bank_req[7] of channel 7, the authorization parameter of channel 7 can be determined.

[0098] Optionally, in another example, for channel 6, the target channels include channels 0 to 5, i = 0, 1, 2, 3, 4, 5. Conflict detection is performed on channel 6 to determine the authorization parameters of channel 6, which may include:

[0099] Step 61, determine the first parameter dma_bank_addr_eq6[i] of the i-th target channel according to the following algorithm logic. Wherein, dma_bank_req[i] represents the BANK access identifier of the i-th target channel, dma_bank_addr[6] represents the BANK access address of the 6th channel, and dma_bank_addr[i] represents the BANK access address of the i-th target channel. dma_bank_addr[6] == dma_bank_addr[i], indicating that channel 6 and the i-th target channel do not conflict. dma_bank_addr_eq6[i] can indicate the BANK that the i-th target channel can access when channel 6 and the i-th target channel do not conflict.

[0100] dma_bank_addr_eq6[i]=dma_bank_req[i]&(dma_bank_addr[6]==dma_bank_addr[i])(i=0,1,2,3,4,5).

[0101] Step 62: Determine the second parameter Dma_bank_addr_ne6[i] of the i-th target channel according to the following algorithm logic: dma_bank_addr[6]!=dma_bank_addr[i], indicating that channel 6 conflicts with the i-th target channel. Dma_bank_addr_ne6[i] may indicate the bank that the i-th target channel can access when channel 6 conflicts with the i-th target channel.

[0102] Dma_bank_addr_ne6[i]=dma_bank_req[i]&(dma_bank_addr[6]!=dma_bank_addr[i])(i=0,1,2,3,4,5).

[0103] Step 63: According to the first parameter dma_bank_addr_eq6[i], the second parameter Dma_bank_addr_ne6[i] and the BANK access identifier dma_bank_req[6] of channel 6, the authorization parameter of channel 6 can be determined.

[0104] Optionally, determining the authorization parameter of the channel according to the first parameter and the second parameter of the target channel and the BANK access identifier of the channel may include:

[0105] The third parameter is determined according to the first parameter and the second parameter, and the third parameter is used to indicate the BANK accessible by the channel.

[0106] The authorization parameter of the channel is determined according to the third parameter and the BANK access identifier of the channel.

[0107] Give an example.

[0108] Optionally, in one example, for the above-mentioned channel 7, step 73 may include:

[0109] Step 731 : Determine the third parameter Dma_bank_issue7 of channel 7 according to the following algorithm logic.

[0110] Dma_bank_issue7=dma_bank_addr_eq7[0]|(dma_bank_addr_eq7[1]&(~Dma_bank_addr_ne7[0]))|(dma_bank_ addr_eq7[2]&(~(|Dma_bank_addr_ne7[1:0])))|(dma_bank_addr_eq7[3]&(~(|Dma_bank_addr_ne7[2:0])))| (dma_bank_addr_eq7[4]&(~(|Dma_bank_addr_ne7[3:0])))|(dma_bank_addr_eq7[5]&(~(|Dma_bank_addr_ne 7[4:0])))|(dma_bank_addr_eq7[6]&(~(|Dma_bank_addr_ne7[5:0])))|((~(|Dma_bank_addr_ne7[6:0])))|.

[0111] Among them, | and ~ are operators in programming languages, | represents bitwise OR operation, and ~ represents bitwise NOT operation.

[0112] (|Dma_bank_addr_ne7[1:0]) indicates that Dma_bank_addr_ne7[0] and Dma_bank_addr_ne7[1] are bitwise ORed. (|Dma_bank_addr_ne7[2:0]) indicates that Dma_bank_addr_ne7[0], Dma_bank_addr_ne7[1] and Dma_bank_addr_ne7[2] are bitwise ORed. The meanings of other similar items are similar and will not be described here. Through this operation, the merging processing of the second parameters of multiple target channels is realized.

[0113] dma_bank_addr_eq7[0] can indicate the BANK that channel 0 can access when channel 7 and the 0th target channel (channel 0) do not conflict, that is, the BANK that channel 7 can access.

[0114] (dma_bank_addr_eq7[1]&(~Dma_bank_addr_ne7[0])) can indicate the BANK that channel 1 can access when channel 7 and the first target channel (channel 1) do not conflict, that is, the BANK that channel 7 can access.

[0115] And so on.

[0116] Dma_bank_issue7 can indicate the BANK that channel 7 can access when channel 7 and the target channel do not conflict.

[0117] Step 732: According to the following algorithm logic, the authorization parameter dma_bank_gnt[7] of channel 7 is determined according to the third parameter Dma_bank_issue7 of channel 7 and the BANK access identifier dma_bank_req[7] of channel 7.

[0118] dma_bank_gnt[7]=dma_bank_req[7]&Dma_bank_issue7.

[0119] Optionally, in another example, for the above-mentioned channel 6, step 63 may include:

[0120] Step 631 : Determine the third parameter Dma_bank_issue6 of channel 6 according to the following algorithm logic.

[0121] Dma_bank_issue6=dma_bank_addr_eq6[0]|(dma_bank_addr_eq6[1]&(~Dma_bank_addr_ne6[0]))|(dma_bank_addr_eq6[2]&(~(|Dma_bank_addr_ne6[1:0])))|(dma_bank_addr_eq6[3]&(~(| Dma_bank_addr_ne6[2:0])))|(dma_bank_addr_eq6[4]&(~(|Dma_bank_addr_ne6[3:0])))|(dm a_bank_addr_eq6[5]&(~(|Dma_bank_addr_ne6[4:0])))|((~(|Dma_bank_addr_ne6[5:0])))|.

[0122] Step 632: According to the following algorithm logic, the authorization parameter dma_bank_gnt[6] of channel 6 is determined according to the third parameter Dma_bank_issue6 of channel 6 and the BANK access identifier dma_bank_req[6] of channel 6.

[0123] dma_bank_gnt[6]=dma_bank_req[6]&Dma_bank_issue6.

[0124] Optionally, the memory access method provided in this embodiment may further include:

[0125] The memory access requests of the M channels are merged according to the authorization parameters of the M channels and the BANK access parameters to determine the memory signal. The memory signal includes N-dimensional parameters, and the N dimensions correspond to the N BANKs one by one.

[0126] Output memory signal.

[0127] It can be seen that in this implementation, the memory signal is an N-dimensional parameter, and the N dimensions correspond to the N BANKs one by one. Through the merging process, when multiple channels can access the same BANK, multiple channels can access the BANK in parallel, which reduces the memory access latency and improves the memory access efficiency.

[0128] Optionally, parameters included in the memory signal may refer to Table 3.

[0129] Table 3 Parameters of memory signals

[0130]

[0131] Optionally, combining the memory access requests of the M channels according to the authorization parameters and the BANK access parameters of the M channels to determine the memory signal may include:

[0132] The enabling parameters are determined according to the authorization parameters of the M channels.

[0133] The memory address parameters are determined according to the authorization parameters of the M channels and the BANK access address.

[0134] The memory write indication parameter is determined according to the authorization parameters of the M channels and the BANK write indication parameter.

[0135] The memory write data parameter is determined according to the authorization parameters of the M channels and the BANK write data parameter.

[0136] Give an example.

[0137] A) The following algorithm logic is used to determine the enable parameter Dma_bank_en based on the authorization parameters dma_bank_gnt[0]~dma_bank_gnt[7] of the M channels.

[0138] Dma_bank_en=|dma_bank_gnt[7:0].

[0139] Among them, |dma_bank_gnt[7:0] indicates that dma_bank_gnt[0] to dma_bank_gnt[7] are subjected to a bitwise OR operation, thereby realizing the merging of the authorization parameters of the M channels.

[0140] B) The following algorithm logic is used to determine the memory address parameter Dma_bank_addr based on the authorization parameters dma_bank_gnt[0]~dma_bank_gnt[7] of the M channels and the BANK access addresses dma_bank_addr[0]~dma_bank_addr[7] of the M channels.

[0141] Dma_bank_addr=(dma_bank_gnt[0]&dma_bank_addr[0])|(dma_bank_gnt[1]&dma_bank_addr[1])|(dma_bank_gnt[2]&dma_bank_addr[2])|(dma_bank_gnt[3]&dma_bank_ad dr[3])|(dma_bank_gnt[4]&dma_bank_addr[4])|(dma_bank_gnt[5]&dma_bank_addr[5])|(dma_bank_gnt[6]&dma_bank_addr[6])|(dma_bank_gnt[7]&dma_bank_addr[7]).

[0142] Among them, (dma_bank_gnt[0]&dma_bank_addr[0]) represents the address of the bank that can be accessed by channel 0, and so on. Through the bitwise OR operation, the bank addresses that can be accessed by M channels are merged.

[0143] C) Using the following algorithm logic, the memory write indication parameter Dma_bank_wmask is determined based on the authorization parameters dma_bank_gnt[0]~dma_bank_gnt[7] of the M channels and the BANK write indication parameters dma_bank_wmask[0]~dma_bank_wmask[7] of the M channels.

[0144] Dma_bank_wmask=(dma_bank_gnt[0]&dma_bank_wmask[0])|(dma_bank_gnt[1]&dma_bank_wmask[1])|(dma_bank_gnt[2]&dma_bank_wmask[2])|(dma_bank_gnt[3]&dma_bank_wm ask[3])|(dma_bank_gnt[4]&dma_bank_wmask[4])|(dma_bank_gnt[5]&dma_bank_wmask[5])|(dma_bank_gnt[6]&dma_bank_wmask[6])|(dma_bank_gnt[7]&dma_bank_wmask[7]).

[0145] Similarly, through a bitwise OR operation, the merging of the M channel write indication parameters is achieved.

[0146] D) The following algorithm logic is used to determine the memory write data parameters based on the authorization parameters dma_bank_gnt[0]~dma_bank_gnt[7] of the M channels and the BANK write data parameters dma_bank_wdata[0]~dma_bank_wdata[7] of the channels.

[0147] Dma_bank_wdata=(dma_bank_gnt[0]&dma_bank_wdata[0])|(dma_bank_gnt[1]&dma_bank_wdata[1])|(dma_bank_gnt[2]&dma_bank_wdata[2])|(dma_bank_gnt[3]&dma_bank_wd ata[3])|(dma_bank_gnt[4]&dma_bank_wdata[4])|(dma_bank_gnt[5]&dma_bank_wdata[5])|(dma_bank_gnt[6]&dma_bank_wdata[6])|(dma_bank_gnt[7]&dma_bank_wdata[7]).

[0148] Similarly, the write data parameters of M channels are merged through a bitwise OR operation.

[0149] Figure 4A schematic diagram of a structure of a memory access device provided by an embodiment of the present invention. The memory access method provided by this embodiment can be executed to access the memory provided by this embodiment. The memory includes N BANKs, where N is an integer greater than 1. Figure 4 As shown, the memory access device provided in this embodiment may include:

[0150] The acquisition module 401 is used to acquire memory access requests of M channels issued by DMA, where M is an integer greater than 1.

[0151] The decoding module 402 is used to obtain the bank access parameters of the channel according to the memory access request of each channel. The bank access parameters include N groups of parameters corresponding to N banks.

[0152] The processing module 403 is used to determine the authorization parameter of each channel in parallel according to the bank access parameters of the M channels. The authorization parameter is used to indicate the bank that the channel can access.

[0153] Optionally, each group of parameters includes a BANK access identifier and a BANK access address; the BANK access identifier is used to indicate whether the channel accesses the BANK;

[0154] The processing module 403 is used for:

[0155] Obtaining access priorities of the M channels;

[0156] Determine a target channel for each of the channels according to the access priority, the priority of the target channel being higher than the priority of the channel;

[0157] For each of the channels, the authorization parameters of the channel are determined according to the BANK access identifier and the BANK access address of the channel and the target channel of the channel.

[0158] Optionally, the processing module 403 is used to:

[0159] Determine a first parameter and a second parameter of the target channel according to a BANK access identifier of a target channel of the channel, a BANK access address of the channel and a BANK access address of a target channel of the channel; the first parameter is used to indicate a BANK accessible to the channel when the BANK access addresses of the channel and the target channel do not conflict; the second parameter is used to indicate a BANK inaccessible to the channel when the BANK access addresses of the channel and the target channel conflict;

[0160] The authorization parameter of the channel is determined according to the first parameter and the second parameter of the target channel and the BANK access identifier of the channel.

[0161] Optionally, the processing module 403 is used to:

[0162] Determine a third parameter according to the first parameter and the second parameter, wherein the third parameter is used to indicate a bank accessible by the channel;

[0163] An authorization parameter of the channel is determined according to the third parameter and the BANK access identifier of the channel.

[0164] Optionally, the processing module 403 is further used for:

[0165] Merging the memory access requests of the M channels according to the authorization parameters and BANK access parameters of the M channels to determine a memory signal; the memory signal includes N-dimensional parameters, and the N dimensions correspond to the N BANKs one by one;

[0166] The memory signal is output.

[0167] Optionally, the memory signal includes an N-dimensional enable parameter, a memory address parameter, a memory write indication parameter and a memory write data parameter; the enable parameter is used to indicate whether the M channels access the BANK, the memory address parameter is used to indicate the address of the BANK accessed by the M channels, the memory write indication parameter is used to indicate the location where the M channels write data into the BANK, and the memory write data parameter is used to indicate the data to be written.

[0168] Optionally, each group of parameters includes a BANK write indication parameter and a BANK write data parameter;

[0169] The processing module 403 is used to:

[0170] Determine the enabling parameter according to the authorization parameters of the M channels;

[0171] Determine the memory address parameter according to the authorization parameters of the M channels and the BANK access address;

[0172] Determine the memory write indication parameter according to the authorization parameters of the M channels and the BANK write indication parameter;

[0173] The memory write data parameter is determined according to the authorization parameters of the M channels and the BANK write data parameter.

[0174] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Figure 5 As shown, the electronic device provided in this embodiment may include a processor 502, a memory 504 and a communication interface 503 connected to a system bus 501. Among them, the processor 502 is used to provide computing and control capabilities. The memory 504 includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface 503 of the electronic device is used to achieve communication. When the computer program is executed by the processor 502, the memory access method provided by the present invention is implemented.

[0175] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the method for accessing the memory provided by the present application. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0176] It should be clear that the process of the processor executing the computer program in the embodiment of the present application is consistent with the execution process of each step in the above method, and the details can be found in the description above.

[0177] In one embodiment, a chip is provided, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the memory access method provided by the present invention when executing the computer program.

[0178] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the memory access method provided by the present invention can be implemented.

[0179] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0180] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0181] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for accessing a memory, characterized in that: Applied to accessing a memory, the memory comprising N memory banks BANK, N being an integer greater than 1, the method comprising: Get the memory access requests of M channels issued by direct memory access DMA; M is an integer greater than 1; Acquire a BANK access parameter of the channel according to a memory access request of each channel; the BANK access parameter includes N groups of parameters corresponding to the N BANKs one by one; Determine the authorization parameter of each channel in parallel according to the BANK access parameters of the M channels; the authorization parameter is used to indicate the BANK accessible by the channel; Each group of parameters includes a bank access identifier and a bank access address; the bank access identifier is used to indicate whether the channel accesses the bank; The step of determining the authorization parameter of each of the channels in parallel according to the BANK access parameters of the M channels comprises: Obtaining access priorities of the M channels; Determine a target channel for each of the channels according to the access priority, the priority of the target channel being higher than the priority of the channel; For each of the channels, the authorization parameters of the channel are determined according to the BANK access identifier and the BANK access address of the channel and the target channel of the channel.

2. The method according to claim 1, characterized in that Determining the authorization parameters of the channel according to the bank access identifier and the bank access address of the channel and the target channel of the channel includes: Determine a first parameter and a second parameter of the target channel according to a BANK access identifier of a target channel of the channel, a BANK access address of the channel and a BANK access address of a target channel of the channel; the first parameter is used to indicate a BANK accessible to the channel when the BANK access addresses of the channel and the target channel do not conflict; the second parameter is used to indicate a BANK inaccessible to the channel when the BANK access addresses of the channel and the target channel conflict; The authorization parameter of the channel is determined according to the first parameter and the second parameter of the target channel and the BANK access identifier of the channel.

3. The method according to claim 2, characterized in that Determining the authorization parameter of the channel according to the first parameter and the second parameter of the target channel and the BANK access identifier of the channel includes: Determine a third parameter according to the first parameter and the second parameter, wherein the third parameter is used to indicate a bank accessible by the channel; An authorization parameter of the channel is determined according to the third parameter and the BANK access identifier of the channel.

4. The method according to any one of claims 1 to 3, characterized in that Also includes: Merging the memory access requests of the M channels according to the authorization parameters and BANK access parameters of the M channels to determine a memory signal; The memory signal includes N-dimensional parameters, and the N dimensions correspond one-to-one to the N BANKs; The memory signal is output.

5. The method according to claim 4, characterized in that The memory signal includes an N-dimensional enable parameter, a memory address parameter, a memory write indication parameter and a memory write data parameter; the enable parameter is used to indicate whether the M channels access the BANK, the memory address parameter is used to indicate the address of the BANK accessed by the M channels, the memory write indication parameter is used to indicate the location where the M channels write data into the BANK, and the memory write data parameter is used to indicate the data to be written.

6. The method according to claim 5, characterized in that Each group of parameters includes a BANK write indication parameter and a BANK write data parameter; The step of combining the memory access requests of the M channels according to the authorization parameters and BANK access parameters of the M channels to determine the memory signal includes: Determine the enabling parameter according to the authorization parameters of the M channels; Determine the memory address parameter according to the authorization parameters of the M channels and the BANK access address; Determine the memory write indication parameter according to the authorization parameters of the M channels and the BANK write indication parameter; The memory write data parameter is determined according to the authorization parameters of the M channels and the BANK write data parameter.

7. A memory access device, characterized in that: Applied to accessing a memory, the memory comprising N memory banks BANK, N being an integer greater than 1, the device comprising: An acquisition module, used for acquiring memory access requests of M channels issued by direct memory access DMA; M is an integer greater than 1; A decoding module, used for acquiring a BANK access parameter of the channel according to a memory access request of each channel; the BANK access parameter includes N groups of parameters corresponding to the N BANKs one by one; A processing module, used for determining the authorization parameter of each of the channels in parallel according to the BANK access parameters of the M channels; the authorization parameter is used to indicate the BANK accessible by the channel; Each group of parameters includes a bank access identifier and a bank access address; the bank access identifier is used to indicate whether the channel accesses the bank; The processing module is used for: Obtaining access priorities of the M channels; Determine a target channel for each of the channels according to the access priority, the priority of the target channel being higher than the priority of the channel; For each of the channels, the authorization parameters of the channel are determined according to the BANK access identifier and the BANK access address of the channel and the target channel of the channel.

8. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 6 when executing the computer program.

9. A chip, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.