WO2017202155A1 - Method of sharing hardware resource, controller, data storage device, and system - Google Patents

Method of sharing hardware resource, controller, data storage device, and system Download PDF

Info

Publication number
WO2017202155A1
WO2017202155A1 PCT/CN2017/080824 CN2017080824W WO2017202155A1 WO 2017202155 A1 WO2017202155 A1 WO 2017202155A1 CN 2017080824 W CN2017080824 W CN 2017080824W WO 2017202155 A1 WO2017202155 A1 WO 2017202155A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
read
data
hardware resource
axi
Prior art date
Application number
PCT/CN2017/080824
Other languages
French (fr)
Chinese (zh)
Inventor
刘卫
Original Assignee
深圳市中兴微电子技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市中兴微电子技术有限公司 filed Critical 深圳市中兴微电子技术有限公司
Publication of WO2017202155A1 publication Critical patent/WO2017202155A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/16Handling requests for interconnection or transfer for access to memory bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0875Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with dedicated cache, e.g. instruction or stack

Definitions

  • the present invention relates to resource sharing technologies in the field of computers, and in particular, to a method, a controller, a memory and a system, and a computer storage medium for sharing hardware resources.
  • each controller performs competition and mutual exclusion on hardware resources in a multi-core system, in order to enable reasonable and orderly use of shared hardware resources.
  • hardware resources must be locked and unlocked through hardware resource locks.
  • registers are used to implement hardware resource locks. When the number of hardware resources in the system is increased, the number of registers required to implement hardware resource locks is correspondingly increased, which increases the implementation cost of the SOC. The scalability of the system is degraded.
  • embodiments of the present invention are expected to provide a method, a controller, a memory and a system, and a computer storage medium for sharing hardware resources, which improve the scalability of the multi-core system.
  • An embodiment of the present invention provides a method for sharing hardware resources, where the method includes:
  • the operation instruction sent by the Advanced Scalable Interface determining that the operation instruction is a hardware resource lock in the first storage unit in a static random access memory (SRAM)
  • SRAM static random access memory
  • the AXI locks or unlocks the hardware resource lock successfully
  • the first read data is data corresponding to an instruction of the first read operation.
  • the determining that the AXI locks the hardware resource lock successfully comprises:
  • the first write data is written into the first storage unit.
  • the determining that the AXI unlocks the hardware resource lock successfully includes:
  • the method further includes:
  • the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock in the first storage unit, sending a second read operation instruction to the first storage unit, and transmitting the instruction to the AXI
  • the second read operation instruction corresponds to the second read data.
  • the method further includes:
  • the operation instruction sent by the AXI is an instruction of a write operation or a read operation of a non-hardware resource lock in the second storage unit in the SRAM, sending an instruction or reading of the write operation to the second storage unit An instruction to operate, and send the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the AXI.
  • the method further includes:
  • Configuring the first storage unit or the second storage list according to the number of hardware resource locks The size of the storage area of the meta.
  • the embodiment of the invention further provides a method for sharing hardware resources, the method comprising:
  • the method further includes:
  • the first read data is the first preset value
  • Write data as the second preset value.
  • the embodiment of the present invention further provides a controller for sharing hardware resources, where the controller includes: a data processing unit and an instruction conversion unit;
  • the data processing unit is configured to: after receiving the operation instruction sent by the AXI, determine whether the operation instruction is an operation instruction for locking or unlocking the hardware resource lock in the first storage unit in the SRAM;
  • the instruction conversion unit is configured to: when the data processing unit determines that the operation instruction sent by the AXI is an operation instruction for locking or unlocking a hardware resource lock in the first storage unit, buffering the locking or Decrypting an operation instruction corresponding to the first write data, and sending an instruction of the first read operation to the first storage unit; determining, according to the acquired first read data, that the AXI locks the hardware resource lock or The unlocking is successful, and the first read data is data corresponding to an instruction of the first read operation.
  • the instruction conversion unit is further configured to: when the obtained first read data is the first preset value, write the first write data into the first storage unit; or
  • the second write data is written into the first storage unit, and the written second write data is a second preset value.
  • the data processing unit is further configured to determine that the operation instruction sent by the AXI is not an operation instruction for locking or unlocking a hardware resource lock in the first storage unit, and determining that the AXI sends the operation instruction. Whether the operation instruction is an instruction to perform a read operation on the hardware resource lock in the first storage unit;
  • the instruction conversion unit is further configured to: when the data processing unit determines that the operation instruction sent by the AXI is an instruction to perform a read operation on a hardware resource lock in the first storage unit, send the instruction to the first storage unit
  • the second read operation instruction transmits the second read data corresponding to the second read operation instruction to the AXI.
  • the data processing unit is further configured to: determine, when the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock in the first storage unit, determine whether the operation instruction sent by the AXI is Is an instruction to read or read a non-hardware resource lock in the second storage unit in the SRAM;
  • the instruction conversion unit is further configured to: when the data processing unit determines that the operation instruction sent by the AXI is an instruction to perform a write operation or a read operation on a non-hardware resource lock in the second storage unit, The second storage unit transmits an instruction of the write operation or an instruction of the read operation, and sends the write data or the read data corresponding to the instruction of the write operation or the read operation to the AXI.
  • the data processing unit and the instruction conversion unit may use a central processing unit (CPU), a digital signal processor (DSP, Digital Singnal Processor), or a programmable logic array (FPGA, Field-) when performing processing. Programmable Gate Array) implementation.
  • CPU central processing unit
  • DSP digital signal processor
  • FPGA programmable logic array
  • FPGA Field-
  • the embodiment of the present invention further provides a memory that shares hardware resources, where the memory includes: a first storage unit and a second storage unit, where
  • the first storage unit is configured to send an instruction of the first read operation or an instruction of the first read operation to the controller after receiving an instruction of the first read operation or the second read operation sent by the controller The first read data or the second read data corresponding to the instruction of the second read operation;
  • the second storage unit is configured to send an instruction of the read operation or the write to the controller after receiving an instruction of a write operation or a read operation sent by the controller to a non-hardware resource lock
  • the instruction of the operation corresponds to writing data or reading data.
  • the first storage unit is further configured to acquire, when the first read data is the first preset value, an operation instruction for locking or unlocking the hardware resource lock by the AXI cached by the controller. Corresponding first write data; or,
  • the embodiment of the present invention may further provide a system for sharing hardware resources, where the system includes a controller and a memory;
  • the controller is any of the controllers described above; the memory is any of the memories described above.
  • Embodiments of the present invention also provide a computer storage medium in which computer executable instructions are stored, the computer executable instructions configuring a method of executing the shared hardware resource.
  • An embodiment of the present invention provides a method, a controller, a memory, and a system for sharing hardware resources. After receiving an operation instruction sent by the AXI, the controller determines that the operation instruction is a hardware resource lock in a first storage unit in the SRAM. And performing an instruction to lock or unlock the operation, buffering the write data corresponding to the instruction of the locking or unlocking operation, and sending an instruction of the first read operation to the first storage unit; according to the obtained first The first read data corresponding to the instruction of the read operation, Determining that the AXI locks or unlocks the hardware resource lock successfully.
  • FIG. 1 is a schematic flowchart of a method for sharing hardware resources according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a control state of AXI locking a hardware resource lock according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of a control state in which AXI unlocks a hardware resource lock according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of another method for sharing hardware resources according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a controller for sharing hardware resources according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a memory sharing a hardware resource according to an embodiment of the present invention.
  • FIG. 1 is a schematic flowchart of a method for sharing hardware resources according to an embodiment of the present invention; as shown in FIG. 1 , the method includes:
  • Step 101 After receiving the operation instruction sent by the AXI, determining that the operation instruction is an operation instruction for locking or unlocking the hardware resource lock in the first storage unit in the SRAM, buffering the operation instruction of locking or unlocking Corresponding first write data, and sending an instruction of the first read operation to the first storage unit;
  • the controller determines whether the operation instruction is to lock the hardware resource in the first storage unit in the SRAM. And an operation instruction for locking or unlocking; when it is determined that the operation instruction is an operation instruction for locking or unlocking the hardware resource lock in the first storage unit, buffering the operation instruction corresponding to the locking or unlocking First writing data, and sending an instruction of the first read operation to the first storage unit;
  • the operation instruction for locking or unlocking herein may be understood as a first write operation instruction for the hardware resource lock, and at the first The write operation instruction carries the first write data corresponding to the first write operation instruction.
  • Step 102 Determine, according to the acquired first read data, that the AXI locks or unlocks the hardware resource lock successfully, and the first read data is data corresponding to an instruction of the first read operation.
  • the first storage unit After receiving the instruction of the first read operation sent by the controller, the first storage unit sends the first read data corresponding to the instruction of the first read operation to the controller. After receiving the first read data, the controller determines that the AXI locks or unlocks the hardware resource lock successfully.
  • the determining that the AXI locks the hardware resource successfully comprises: determining that the first read data corresponding to the obtained instruction of the first read operation is a first preset value, Writing the first write data to the first storage unit.
  • the controller determines whether the first read data corresponding to the acquired instruction of the first read operation is a first preset value, such as “0”, when the controller determines that the first read data is the first pre- When the value is set to "0", the cached first write data is written into the target address in the first storage unit, indicating that the master N in the AXI locks the hardware resource lock successfully.
  • a first preset value such as “0”
  • the controller determines that the first read data is not the first preset value, such as “0”, the write operation instruction is not sent to the target address in the first storage unit, indicating that the hardware resource lock has been If the controllers of other shared hardware resources in the multi-core system are locked, the first write data cached before is discarded, indicating that the master N in the AXI fails to lock the hardware resource lock.
  • the controller configures the storage area size of the first storage unit according to the number of the hardware resource locks.
  • FIG. 2 is a schematic diagram of a control state in which AXI locks a hardware resource lock according to an embodiment of the present invention. As shown in FIG. 2, when the hardware resource lock is in an idle (IDLE) 201 state, the controller receives AXI to add a hardware resource lock.
  • IDLE idle
  • the controller receives AXI to add a hardware resource lock.
  • the locked operation command can be understood as an instruction to perform a first write operation on the hardware resource lock in the first storage unit in the SRAM, and at the first
  • the instruction of the write operation carries the first write data corresponding to the instruction of the first write operation; the target address is the target address carried in the locked operation instruction.
  • the controller receives the first read data corresponding to the instruction of the first read operation sent by the first storage unit, and if the first read data is the first preset value, such as “0”, then the write to the write (WRITE) 202 The state, and the first write data buffered by the controller is written into the first storage unit. After the write operation is completed, the IDLE201 state is transferred, indicating that the AXI locks the hardware resource lock successfully. Conversely, if the hardware resource lock has been locked by another controller, the previously written first write data is discarded, indicating that AXI fails to lock the hardware resource lock and transitions to the initial idle IDLE201 state.
  • the determining that the AXI unlocks the hardware resource lock successfully comprises: determining that the first read data corresponding to the obtained instruction of the first read operation is consistent with the first write data Writing the second write data to the first storage unit, and writing the second write data to a second preset value.
  • the controller determines that the first read data is not the first preset value, such as "0", determining whether the first read data is consistent with the previously cached first write data, when determining the When the first read data is consistent with the first write data, the second write data is written to the target address in the first storage unit, and the written second write data is a second preset value, such as “0” , indicating that the master N in the AXI unlocks the hardware resource lock successfully.
  • the controller determines that the read data is not the first preset value “0”, When a write data is inconsistent, the second write operation instruction is not sent to the target address in the first storage unit, indicating that the hardware resource lock cannot be unlocked by the master N in the AXI, and the previously cached first part is discarded.
  • a write data indicates that master N in AXI has failed to latch the hardware resource.
  • one target address corresponds to one hardware resource lock, and the target address is a target address carried in an unlocked operation instruction.
  • FIG. 3 is a schematic diagram of a control state in which AXI unlocks a hardware resource lock according to an embodiment of the present invention.
  • the hardware resource lock is in an IDLE301 state.
  • the controller receives an operation instruction for unlocking the hardware resource lock by AXI, Firstly, the first write data corresponding to the unlocked operation instruction is buffered, and then an instruction of the first read operation is generated, and the instruction of the first read operation is sent to the target address in the first storage unit, and the state is changed to the READ303 state; here,
  • the unlocked operation instruction may be understood as an instruction to perform a first write operation on a hardware resource lock in the first storage unit, and the instruction in the first write operation carries an instruction related to the first write operation.
  • the target address is a target address specified in the instruction of the first write operation; after the controller receives the first read data corresponding to the instruction of the first read operation sent by the first storage unit, If the first read data is consistent with the first write data buffered by the controller, then the WRITE 302 state is entered, and the second address is written to the target address in the first storage unit. Data, a second write data for the second preset value, such as "0", and proceeds to the initial state IDLE301, AXI represents the hardware resource lock unlock success. Conversely, the hardware resource lock cannot be unlocked by the master N in the AXI, and the previously cached first write data is discarded, and the initial IDLE301 state is transferred, indicating that AXI fails to unlock the hardware resource lock.
  • the method further includes: when the operation instruction sent by the AXI is not an operation instruction for locking or unlocking the hardware resource lock, determining whether the operation instruction sent by the AXI is to the hardware The resource lock performs an operation of a read operation; when the operation command sent by the AXI is an instruction to perform a read operation on the hardware resource lock, sending a second read operation instruction to the first storage unit, and transmitting the instruction to the AXI The second reading corresponding to the second read operation instruction according to.
  • the controller determines that the operation instruction sent by the AXI is not an operation instruction for locking or unlocking the hardware resource lock, determining whether the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock
  • the controller determines that the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock, directly sending the second read operation instruction to the first storage unit, and returning the first storage unit
  • the second read data corresponding to the second read operation instruction is sent to the AXI.
  • the second read operation instruction carries the second read data corresponding to the second read operation instruction.
  • the method further includes: when the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock, determining whether the operation instruction sent by the AXI is a second storage unit in the SRAM The non-hardware resource lock in the instruction to perform a write operation or the read operation; the operation instruction sent by the AXI is an instruction to write the non-hardware resource lock or an instruction to read the operation, to the second storage
  • the unit transmits an instruction of the write operation or an instruction of the read operation, and sends the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the AXI.
  • the controller determines whether the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock, and determines whether the operation instruction sent by the AXI is a write operation on a non-hardware resource lock in the second storage unit.
  • the instruction of the instruction or the read operation the controller determines that the operation instruction sent by the AXI is an instruction of a write operation or a read operation of the non-hardware resource lock, and directly sends the write to the second storage unit
  • the operation instruction or the instruction of the read operation, and the write data or the read data corresponding to the instruction of the write operation or the read operation returned by the second storage unit is sent to the AXI.
  • the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the instruction of the read operation; the storage difference of the second storage unit
  • the size is also configured according to the number of hardware resource locks.
  • FIG. 4 is a schematic flowchart of another method for sharing hardware resources according to an embodiment of the present invention. As shown in FIG. 4, the method includes:
  • Step 401 After receiving an instruction of the first read operation or the second read operation sent by the controller, send the instruction of the first read operation or the second read operation to the controller.
  • the first read data or the second read data corresponding to the instruction;
  • Step 402 after receiving an instruction for writing a non-hardware resource lock sent by the controller or an instruction of a read operation, sending an instruction of the read operation or an instruction of the write operation to the controller. Write data or read data.
  • the first storage unit in the SRAM acquires an instruction to perform a first read operation on the hardware resource lock sent by the controller;
  • the first storage unit in the SRAM acquires an instruction to perform a second read operation on the hardware resource lock sent by the controller; here, the lock or unlock is performed.
  • the operation instruction can be understood as an instruction to perform a first write operation on the hardware resource lock, and the instruction in the first write operation carries the first write data corresponding to the instruction of the first write operation; the second read The operation instructions also carry second read data corresponding to the instructions of the second read operation.
  • the first storage unit sends, according to the received instruction of the first read operation or the instruction of the second read operation, the first read data corresponding to the instruction of the first read operation or the instruction of the second read operation to the controller. Or second read data.
  • the instruction of the first read operation is an instruction conversion command issued by the controller, and the operation instruction for locking or unlocking is converted into an instruction of the first read operation, and the instruction of the first read operation carries the first The first read data corresponding to the instruction of the read operation.
  • the second storage unit in the SRAM acquires the instruction of the write operation or the read operation sent by the controller to the non-hardware resource lock.
  • the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the read operation.
  • Second The storage unit transmits the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the controller according to the received instruction of the write operation or the instruction of the read operation.
  • the method further includes: when the first read data is the first preset value, the first storage unit acquires AXI cached by the controller, and locks the hardware resource lock. Or the unlocked operation instruction corresponds to the first write data.
  • the first read data is a first preset value. If the value is “0”, the first storage unit acquires an operation instruction for locking or unlocking the hardware resource lock by the AXI cached by the instruction conversion unit in the controller. Corresponding first write data indicates that master N in AXI successfully locks the hardware resource lock.
  • the storage area size of the first storage unit is configured according to the number of hardware resource locks.
  • the method further includes: when the first read data is consistent with the first write data corresponding to the instruction that the AXI cached by the controller locks or unlocks the hardware resource lock
  • the first storage unit acquires second write data written by the controller, and the written second write data is a second preset value.
  • the first memory unit transmits the first read data corresponding to the instruction of the first read operation and the instruction of the controller in the controller that the AXI caches the hardware resource lock to lock or unlock the operation
  • the second write data written by the controller is obtained, and the second write data written is a second preset value, such as “0”, indicating that the master N in the AXI is to the hardware resource.
  • the lock was unlocked successfully.
  • FIG. 5 is a schematic structural diagram of a controller 51 for sharing hardware resources according to an embodiment of the present invention.
  • the controller 51 includes: a data processing unit 511, and an instruction conversion unit. 512 and data control unit 513, wherein
  • the data processing unit 511 is configured to: after receiving the operation instruction sent by the AXI, determine whether the operation instruction is an instruction to lock or unlock the hardware resource lock in the first storage unit in the SRAM;
  • the instruction conversion unit 512 is configured to cache the add-on when the data processing unit 511 determines that the operation instruction sent by the AXI is an instruction to lock or unlock the hardware resource lock in the first storage unit. Locking or unlocking the first write data corresponding to the operation instruction, and sending an instruction of the first read operation to the first storage unit; determining, according to the acquired first read data, that the AXI locks the hardware resource lock or The unlocking is successful, and the first read data is data corresponding to an instruction of the first read operation.
  • the data processing unit 511 determines whether the operation instruction is an instruction to lock or unlock the hardware resource lock; determining the lock or unlock
  • the instruction to generate the first write operation by the instruction of the locking or unlocking operation is sent to the instruction conversion unit 512; here, the locking or unlocking operation is performed.
  • the instruction can be understood as an instruction to perform a first write operation on the hardware resource lock, and the instruction in the first write operation carries the first write data corresponding to the instruction of the first write operation.
  • the instruction conversion unit 512 buffers the first write data corresponding to the instruction of the locking or unlocking operation, and sends the first data to the data control unit 513.
  • the instruction of the read operation wherein the instruction of the first read operation carries the first read data corresponding to the instruction of the first read operation.
  • the data control unit 513 After receiving the instruction of the first read operation sent by the instruction conversion unit 512, the data control unit 513 sends the instruction of the first read operation to the target address in the first storage unit.
  • the destination address here refers to the destination address carried in the instruction to lock or unlock the operation.
  • the first storage unit After receiving the instruction of the first read operation sent by the data control unit 513, the first storage unit sends the first read data corresponding to the instruction of the first read operation to the data control unit 513, and the data is controlled. After receiving the first read data, the unit 513 sends the first read data to the instruction conversion unit 512, and the instruction conversion unit 512 determines the AXI pair hardware according to the first read data sent by the data control unit 513.
  • the resource lock is locked or unlocked successfully.
  • the instruction conversion unit 512 is further configured to: when the obtained first read data is the first preset value, write the first write data to the first storage unit. .
  • the instruction conversion unit 512 determines whether the first read data corresponding to the acquired instruction of the first read operation is a first preset value, such as “0”, when the instruction conversion unit 512 determines the first read data.
  • the instruction of the write operation is sent to the data control unit 513, and the data control unit 513 writes the first write data buffered by the instruction conversion unit 512 according to the instruction of the write operation.
  • Entering the target address in the first storage unit indicates that the master N in AXI successfully locks the hardware resource lock.
  • the target address refers to a target address carried in an instruction for locking or unlocking operations.
  • the instruction conversion unit 512 determines that the first read data is not the first preset value, such as "0"
  • the instruction of the first write operation is not sent to the target address in the first storage unit, indicating that the The hardware resource lock has been locked by each controller of the other shared hardware resource locks in the multi-core system, and the first write data buffered before is discarded, indicating that the master N in AXI fails to lock the hardware resource latch.
  • one target address corresponds to one hardware resource lock
  • the data processing unit 511 configures the storage area size of the first storage unit according to the number of the hardware resource locks.
  • control state of the specific AXI locking of the hardware resource lock is described in FIG. 2 in the embodiment of the method, and is not described here.
  • the instruction conversion unit 512 is further configured to determine that the first read data corresponding to the instruction for acquiring the first read operation is consistent with the first write data, and the second write data is Writing to the first storage unit, the written second write data is a second preset value.
  • the instruction conversion unit 512 determines that the first read data is not the first preset value, such as “0”, and determines whether the first read data is consistent with the previously cached first write data.
  • an instruction of the second write operation is sent to the data control unit 513, and the data control unit 513 receives the second write sent by the instruction conversion unit 512.
  • the second write data is written to the target address in the first storage unit, and the written second write data is a second preset value, such as “0”, indicating the master N pair in the AXI.
  • the hardware resource lock is unlocked successfully.
  • the instruction conversion unit 512 determines that the first read data is not the first preset value, such as “0”, and does not coincide with the first write data, then the target address in the first storage unit is not Sending a second write operation instruction, indicating that the hardware resource lock cannot be unlocked by the master N in the AXI, discarding the previously written first write data, indicating that the master N in the AXI fails to unlock the hardware resource.
  • one target address corresponds to one hardware resource lock, and the target address is a target address carried in an instruction for locking or unlocking operations.
  • the data processing unit 511 is further configured to determine, when the operation instruction sent by the AXI is not an instruction to lock or unlock the hardware resource lock, determine an operation instruction sent by the AXI. Whether it is an instruction to perform a read operation on the hardware resource lock; the instruction conversion unit 512 is further configured to: the data processing unit 511 determines that the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock Directly sending an instruction of the second read operation to the data control unit 513, and after receiving the instruction of the second read operation sent by the instruction conversion unit 512, the data control unit 513 sends the instruction to the first storage unit.
  • the second read data corresponding to the instruction of the second read operation returned by the first storage unit is sent to the instruction conversion unit 512, and the instruction conversion unit 512 further
  • the second read data is sent to the data processing unit 511, and the second read data is sent by the data processing unit 511 to the AXI.
  • the instruction of the second read operation carries the second read data corresponding to the instruction of the second read operation.
  • the data processing unit 511 is further configured to determine whether the operation instruction sent by the AXI is an operation instruction when the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock.
  • the non-hardware resource lock in the second storage unit is an instruction of a write operation or a read operation; the instruction conversion unit 512 is further configured to determine that the operation instruction sent by the AXI is to the non-hardware
  • the resource lock performs an instruction of a write operation or an instruction of a read operation
  • the instruction of the write operation or the instruction of the read operation is directly sent to the data control unit 513, and the data control unit 513 receives the location sent by the instruction conversion unit 512.
  • the instruction of the write operation or the instruction of the read operation is sent to the second storage unit, and the instruction of the write operation or the read operation of the second storage unit is returned
  • the write data or the read data corresponding to the instruction is sent to the instruction conversion unit 512, and the instruction conversion unit 512 sends the write data or the read data to the data processing.
  • Element 511 and then transmits the write data from the processing unit 511 to the AXI read instruction or a write operation corresponding to the data or read data.
  • the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the instruction of the read operation; the storage difference of the second storage unit The size is configured by the data processing unit 511 in accordance with the number of hardware resource locks.
  • FIG. 6 is a schematic structural diagram of a memory for sharing a hardware resource according to the present invention.
  • the memory 61 includes: a first storage unit 611 and a second storage unit 612;
  • the first storage unit 611 is configured to send an instruction of the first read operation to the controller after receiving an instruction of the first read operation or the second read operation sent by the controller Or the first read data or the second read data corresponding to the instruction of the second read operation;
  • the second storage unit 612 is configured to send an instruction of the read operation or the instruction to the controller after receiving an instruction of a write operation or a read operation sent by the controller to a non-hardware resource lock Write data or read data corresponding to the instruction of the write operation.
  • the first storage unit 611 when the controller receives an instruction that the AXI locks or unlocks the hardware resource lock, the first storage unit 611 receives an instruction sent by the controller to perform a first read operation on the hardware resource lock; when the controller receives When the instruction to read the hardware resource lock is performed by the AXI, the first storage unit 611 receives an instruction for performing a second read operation on the hardware resource lock sent by the controller; here, the locking or unlocking operation instruction may be understood as referring to The instruction to perform the first write operation on the hardware resource lock carries the first write data corresponding to the instruction of the first write operation in the instruction of the first write operation.
  • the first storage unit 611 sends, according to the received instruction of the first operation or the instruction of the second operation, the first read data corresponding to the instruction of the first read operation or the instruction of the second read operation or Second read data.
  • the instruction of the first read operation is an instruction conversion command issued by the controller, and the instruction for locking or unlocking operation is converted into an instruction of the first read operation, and the first read operation carries the first instruction
  • the first read data corresponding to the instruction of the read operation; the second read data corresponding to the instruction of the second read operation is carried in the instruction of the second read operation.
  • the second storage unit 612 receives the instruction of the write operation or the read operation sent by the controller to the non-hardware resource lock, where The instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the read operation.
  • the second storage unit 612 transmits the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the controller according to the received instruction of the write operation or the instruction of the read operation.
  • the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the read operation.
  • the first storage unit 611 is further configured to: when the first read data is the first preset value, acquire an instruction that the controller cached by the AXI locks or unlocks the hardware resource lock. The first write data.
  • the first storage unit 611 receives the location.
  • the first write data corresponding to the instruction of the controller cache AXI to lock or unlock the hardware resource lock indicates that the master N in the AXI successfully locks the hardware resource lock.
  • the area size of the first storage unit 611 is configured according to the number of hardware resource locks, and the instruction of the locking or unlocking operation may be regarded as an instruction to perform a first write operation on the hardware resource lock.
  • the instruction of a write operation carries the first write data corresponding to the instruction of the first write operation.
  • the first storage unit 611 is further configured to: first, corresponding to the instruction that the first read data is locked or unlocked by the AXI cached by the controller to the hardware resource lock.
  • the write data is consistent, the second write data written by the controller is obtained, and the second write data written is a second preset value.
  • the first storage unit 611 sends the read data corresponding to the read operation instruction
  • the first write data corresponding to the instruction of the AXI cached in the controller that locks or unlocks the hardware resource lock is consistent.
  • the second write data written in the controller is obtained, and the second write number written is a second preset value, such as "0" write data, to indicate that the AXI locks the hardware resource lock successfully.
  • a system for sharing hardware resources includes a controller as shown in FIG. 5 and a memory as shown in FIG. 6.
  • Embodiments of the present invention also provide a computer storage medium in which computer executable instructions are stored, the computer executable instructions configuring a method of executing the shared hardware resource.
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the present invention may employ computer-usable storage media (including but not limited to disks) in one or more of the computer-usable program code embodied therein. A form of computer program product embodied on a memory and optical storage, etc.).
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • the cache is Locking or unlocking the operation corresponding to the write data, and transmitting an instruction of the first read operation to the first storage unit; according to the acquired first read operation
  • the instruction corresponding to the first read data determines that the AXI locks or unlocks the hardware resource lock successfully.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

A method of sharing a hardware resource comprises: receiving an operation command transmitted from an advanced extensible interface (AXI), when it is determined that the operation command is one of locking or unlocking command used to perform a locking or unlocking operation on a hardware resource lock in a first storage unit in static random access memory (SRAM), buffering first write data corresponding to the locking or unlocking command, and transmitting, to the first storage unit, a first read command (101); and determining, according to acquired first read data, whether the AXI has successfully locked or unlocked the hardware resource lock, wherein the first read data is data corresponding to the first read command (102).

Description

共享硬件资源的方法、控制器、存储器及系统Method, controller, memory and system for sharing hardware resources
相关申请的交叉引用Cross-reference to related applications
本申请基于申请号为201610370034.9、申请日为2016年05月27日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。The present application is based on a Chinese patent application filed on Jan. 27, 2016, the entire disclosure of which is hereby incorporated by reference.
技术领域Technical field
本发明涉及计算机领域中的资源共享技术,具体涉及一种共享硬件资源的方法、控制器、存储器及系统、计算机存储介质。The present invention relates to resource sharing technologies in the field of computers, and in particular, to a method, a controller, a memory and a system, and a computer storage medium for sharing hardware resources.
背景技术Background technique
在多核系统中的片上系统(SOC,System on Chip)中,各控制器对多核系统中硬件资源进行的操作时,存在竞争与互斥,为了能够对各共享的硬件资源进行合理有序的使用,避免多个控制器同时对同一个硬件资源进行操作,必须要通过硬件资源锁对硬件资源进行锁定与解锁。而现有技术中使用寄存器来实现硬件资源锁,在所述系统中的硬件资源数量变多时,所需要用来实现硬件资源锁的寄存器也相应的变多,这会增加SOC的实现成本,使所述系统的可扩展性变差。In a system-on-chip (SOC) in a multi-core system, each controller performs competition and mutual exclusion on hardware resources in a multi-core system, in order to enable reasonable and orderly use of shared hardware resources. To prevent multiple controllers from operating on the same hardware resource at the same time, hardware resources must be locked and unlocked through hardware resource locks. In the prior art, registers are used to implement hardware resource locks. When the number of hardware resources in the system is increased, the number of registers required to implement hardware resource locks is correspondingly increased, which increases the implementation cost of the SOC. The scalability of the system is degraded.
发明内容Summary of the invention
为解决现有存在的技术问题,本发明实施例期望提供一种共享硬件资源的方法、控制器、存储器及系统、计算机存储介质,提高了多核系统的可扩展性。In order to solve the existing technical problems, embodiments of the present invention are expected to provide a method, a controller, a memory and a system, and a computer storage medium for sharing hardware resources, which improve the scalability of the multi-core system.
本发明实施例的技术方案是这样实现的: The technical solution of the embodiment of the present invention is implemented as follows:
本发明实施例提供一种共享硬件资源的方法,所述方法包括:An embodiment of the present invention provides a method for sharing hardware resources, where the method includes:
接收到先进可扩展接口(AXI,Advanced eXtensible Interface)发送的操作指令后,判定所述操作指令是对静态随机存取存储器(SRAM,Static Random Access Memory)中第一存储单元中的硬件资源锁进行加锁或解锁操作的指令时,缓存所述加锁或解锁操作的指令相对应的第一写数据,并向所述第一存储单元发送第一读操作的指令;After receiving the operation instruction sent by the Advanced Scalable Interface (AXI), determining that the operation instruction is a hardware resource lock in the first storage unit in a static random access memory (SRAM) When the instruction of the operation is locked or unlocked, the first write data corresponding to the instruction of the lock or unlock operation is buffered, and the instruction of the first read operation is sent to the first storage unit;
根据获取到的第一读数据,确定所述AXI对所述硬件资源锁加锁或解锁成功,所述第一读数据是与所述第一读操作的指令相对应的数据。And determining, according to the acquired first read data, that the AXI locks or unlocks the hardware resource lock successfully, and the first read data is data corresponding to an instruction of the first read operation.
上述方案中,所述确定所述AXI对所述硬件资源锁加锁成功包括:In the above solution, the determining that the AXI locks the hardware resource lock successfully comprises:
判定获取到的所述第一读数据为第一预设值时,将所述第一写数据写入所述第一存储单元。When it is determined that the acquired first read data is the first preset value, the first write data is written into the first storage unit.
上述方案中,所述确定所述AXI对所述硬件资源锁解锁成功包括:In the above solution, the determining that the AXI unlocks the hardware resource lock successfully includes:
判定获取到的所述第一读数据与所述第一写数据一致时,将第二写数据写入所述第一存储单元,写入第二写数据为第二预设值。When it is determined that the acquired first read data is consistent with the first write data, writing the second write data to the first storage unit, and writing the second write data to a second preset value.
上述方案中,所述方法还包括:In the above solution, the method further includes:
判定所述AXI发送的操作指令是对所述第一存储单元中的硬件资源锁进行读操作的指令时,向所述第一存储单元发送第二读操作指令,并向所述AXI发送所述第二读操作指令相对应的第二读数据。Determining that the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock in the first storage unit, sending a second read operation instruction to the first storage unit, and transmitting the instruction to the AXI The second read operation instruction corresponds to the second read data.
上述方案中,所述方法还包括:In the above solution, the method further includes:
判定所述AXI发送的操作指令是对SRAM中第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令时,向所述第二存储单元发送所述写操作的指令或读操作的指令,并向所述AXI发送所述写操作的指令或读操作的指令相对应的写数据或读数据。Determining, when the operation instruction sent by the AXI is an instruction of a write operation or a read operation of a non-hardware resource lock in the second storage unit in the SRAM, sending an instruction or reading of the write operation to the second storage unit An instruction to operate, and send the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the AXI.
上述方案中,所述方法还包括:In the above solution, the method further includes:
根据所述硬件资源锁的数量配置所述第一存储单元或所述第二存储单 元的存储区域大小。Configuring the first storage unit or the second storage list according to the number of hardware resource locks The size of the storage area of the meta.
本发明实施例还提供一种共享硬件资源的方法,所述方法包括:The embodiment of the invention further provides a method for sharing hardware resources, the method comprising:
接收到控制器发送的对硬件资源锁进行第一读操作的指令或第二读操作的指令后,向所述控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据;Receiving the instruction of the first read operation or the instruction of the second read operation sent by the controller, sending the instruction of the first read operation or the instruction of the second read operation to the controller Corresponding first read data or second read data;
接收到所述控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令后,向所述控制器发送所述读操作的指令或所述写操作的指令相对应的写数据或读数据。Receiving an instruction of the write operation or a read operation of the non-hardware resource lock sent by the controller, sending the instruction of the read operation or the write data corresponding to the instruction of the write operation to the controller or Read the data.
上述方案中,所述方法还包括:In the above solution, the method further includes:
所述第一读数据为第一预设值时,获取所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作指令相对应的第一写数据;或者,所述第一读数据与所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作指令相对应的第一写数据一致时,获取所述控制器写入的第二写数据,写入的第二写数据为第二预设值。When the first read data is the first preset value, acquiring, by the AXI cached by the controller, the first write data corresponding to the lock or unlock operation instruction of the hardware resource lock; or the first read Obtaining the second write data written by the controller, and writing the second data when the data is consistent with the first write data corresponding to the lock or unlock operation instruction of the hardware resource lock by the AXI cached by the controller. Write data as the second preset value.
本发明实施例又提供一种共享硬件资源的控制器,所述控制器包括:数据处理单元和指令转换单元;其中,The embodiment of the present invention further provides a controller for sharing hardware resources, where the controller includes: a data processing unit and an instruction conversion unit;
所述数据处理单元,配置为接收到AXI发送的操作指令后,判断所述操作指令是否是对SRAM中第一存储单元中的硬件资源锁进行加锁或解锁的操作指令;The data processing unit is configured to: after receiving the operation instruction sent by the AXI, determine whether the operation instruction is an operation instruction for locking or unlocking the hardware resource lock in the first storage unit in the SRAM;
所述指令转换单元,配置为所述数据处理单元判定所述AXI发送的操作指令是对所述第一存储单元中的硬件资源锁进行加锁或解锁的操作指令时,缓存所述加锁或解锁的操作指令相对应的第一写数据,并向所述第一存储单元发送第一读操作的指令;根据获取到的第一读数据,确定所述AXI对所述硬件资源锁加锁或解锁成功,所述第一读数据是与所述第一读操作的指令相对应的数据。 The instruction conversion unit is configured to: when the data processing unit determines that the operation instruction sent by the AXI is an operation instruction for locking or unlocking a hardware resource lock in the first storage unit, buffering the locking or Decrypting an operation instruction corresponding to the first write data, and sending an instruction of the first read operation to the first storage unit; determining, according to the acquired first read data, that the AXI locks the hardware resource lock or The unlocking is successful, and the first read data is data corresponding to an instruction of the first read operation.
上述方案中,所述指令转换单元,还配置为判定获取到的所述第一读数据为第一预设值时,将所述第一写数据写入所述第一存储单元;或者,In the above solution, the instruction conversion unit is further configured to: when the obtained first read data is the first preset value, write the first write data into the first storage unit; or
判定获取到的所述第一读数据与所述第二写数据一致时,将第二写数据写入所述第一存储单元,写入的第二写数据为第二预设值。When it is determined that the acquired first read data is consistent with the second write data, the second write data is written into the first storage unit, and the written second write data is a second preset value.
上述方案中,所述数据处理单元,还配置为判断所述AXI发送的操作指令不是对所述第一存储单元中的硬件资源锁进行加锁或解锁的操作指令时,判断所述AXI发送的操作指令是否是对所述第一存储单元中的硬件资源锁进行读操作的指令;In the above solution, the data processing unit is further configured to determine that the operation instruction sent by the AXI is not an operation instruction for locking or unlocking a hardware resource lock in the first storage unit, and determining that the AXI sends the operation instruction. Whether the operation instruction is an instruction to perform a read operation on the hardware resource lock in the first storage unit;
所述指令转换单元,还配置为所述数据处理单元判定所述AXI发送的操作指令是对所述第一存储单元中的硬件资源锁进行读操作的指令时,向所述第一存储单元发送第二读操作指令,并向所述AXI发送所述第二读操作指令相对应的第二读数据。The instruction conversion unit is further configured to: when the data processing unit determines that the operation instruction sent by the AXI is an instruction to perform a read operation on a hardware resource lock in the first storage unit, send the instruction to the first storage unit The second read operation instruction transmits the second read data corresponding to the second read operation instruction to the AXI.
上述方案中,所述数据处理单元,还配置为判断所述AXI发送的操作指令不是对所述第一存储单元中的硬件资源锁进行读操作的指令时,判断所述AXI发送的操作指令是否是对SRAM中第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令;In the above solution, the data processing unit is further configured to: determine, when the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock in the first storage unit, determine whether the operation instruction sent by the AXI is Is an instruction to read or read a non-hardware resource lock in the second storage unit in the SRAM;
所述指令转换单元,还配置为所述数据处理单元判定所述AXI发送的操作指令是对所述第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令时,向所述第二存储单元发送所述写操作的指令或读操作的指令,并向所述AXI发送所述写操作的指令或读操作的指令相对应的写数据或读数据。The instruction conversion unit is further configured to: when the data processing unit determines that the operation instruction sent by the AXI is an instruction to perform a write operation or a read operation on a non-hardware resource lock in the second storage unit, The second storage unit transmits an instruction of the write operation or an instruction of the read operation, and sends the write data or the read data corresponding to the instruction of the write operation or the read operation to the AXI.
所述数据处理单元和所述指令转换单元在执行处理时,可以采用中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital Singnal Processor)或可编程逻辑阵列(FPGA,Field-Programmable Gate Array)实现。 The data processing unit and the instruction conversion unit may use a central processing unit (CPU), a digital signal processor (DSP, Digital Singnal Processor), or a programmable logic array (FPGA, Field-) when performing processing. Programmable Gate Array) implementation.
本发明实施例还提供一种共享硬件资源的存储器,所述存储器包括:第一存储单元和第二存储单元,其中,The embodiment of the present invention further provides a memory that shares hardware resources, where the memory includes: a first storage unit and a second storage unit, where
所述第一存储单元,配置为接收到控制器发送的对硬件资源锁进行第一读操作的指令或第二读操作的指令后,向所述控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据;The first storage unit is configured to send an instruction of the first read operation or an instruction of the first read operation to the controller after receiving an instruction of the first read operation or the second read operation sent by the controller The first read data or the second read data corresponding to the instruction of the second read operation;
所述第二存储单元,配置为接收到所述控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令后,向所述控制器发送所述读操作的指令或所述写操作的指令相对应的写数据或读数据。The second storage unit is configured to send an instruction of the read operation or the write to the controller after receiving an instruction of a write operation or a read operation sent by the controller to a non-hardware resource lock The instruction of the operation corresponds to writing data or reading data.
上述方案中,所述第一存储单元,还配置为所述第一读数据为第一预设值时,获取所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁的操作指令相对应的第一写数据;或者,In the above solution, the first storage unit is further configured to acquire, when the first read data is the first preset value, an operation instruction for locking or unlocking the hardware resource lock by the AXI cached by the controller. Corresponding first write data; or,
所述第一读数据与所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁的操作指令相对应的写数据一致时,获取所述控制器写入的为第二预设值的写数据。And acquiring, by the controller, a second preset value written by the controller, when the first read data is consistent with the write data corresponding to the operation instruction that the AXI cached by the controller is locked or unlocked by the hardware resource lock. Write data.
本发明实施例还可提供一种共享硬件资源的系统,所述系统包括控制器和存储器;其中,The embodiment of the present invention may further provide a system for sharing hardware resources, where the system includes a controller and a memory;
所述控制器为上面所述的任意一种控制器;所述存储器为上面所述的任意一种存储器。The controller is any of the controllers described above; the memory is any of the memories described above.
本发明实施例还提供一种计算机存储介质,其中存储有计算机可执行指令,该计算机可执行指令配置执行上述共享硬件资源的方法。Embodiments of the present invention also provide a computer storage medium in which computer executable instructions are stored, the computer executable instructions configuring a method of executing the shared hardware resource.
本发明实施例提供一种共享硬件资源的方法、控制器、存储器及系统,通过控制器接收到AXI发送的操作指令后,判定所述操作指令是对SRAM中第一存储单元中的硬件资源锁进行加锁或解锁操作的指令时,缓存所述加锁或解锁操作的指令相对应的写数据,并向所述第一存储单元发送第一读操作的指令;根据获取到的所述第一读操作的指令相对应的第一读数据, 确定所述AXI对所述硬件资源锁加锁或解锁成功。如此,通过使用所述SRAM来实现对硬件资源锁的加锁或解锁,不仅能在多核系统中的硬件资源数量变多时实现所需数量的硬件资源锁,而且还降低了SOC的使用成本,提高了多核系统的可扩展性;通过AXI能方便的被AXI中的管理员访问,能实现良好的可移植性。An embodiment of the present invention provides a method, a controller, a memory, and a system for sharing hardware resources. After receiving an operation instruction sent by the AXI, the controller determines that the operation instruction is a hardware resource lock in a first storage unit in the SRAM. And performing an instruction to lock or unlock the operation, buffering the write data corresponding to the instruction of the locking or unlocking operation, and sending an instruction of the first read operation to the first storage unit; according to the obtained first The first read data corresponding to the instruction of the read operation, Determining that the AXI locks or unlocks the hardware resource lock successfully. In this way, by using the SRAM to lock or unlock the hardware resource lock, not only can the required number of hardware resource locks be realized when the number of hardware resources in the multi-core system increases, but also the SOC usage cost is lowered and the SOC is increased. The scalability of multi-core systems; AXI can be easily accessed by administrators in AXI, enabling good portability.
附图说明DRAWINGS
图1为本发明实施例一种共享硬件资源的方法流程示意图;FIG. 1 is a schematic flowchart of a method for sharing hardware resources according to an embodiment of the present invention;
图2为本发明实施例中AXI对硬件资源锁进行加锁的控制状态示意图;2 is a schematic diagram of a control state of AXI locking a hardware resource lock according to an embodiment of the present invention;
图3为本发明实施例中AXI对硬件资源锁进行解锁的控制状态示意图。FIG. 3 is a schematic diagram of a control state in which AXI unlocks a hardware resource lock according to an embodiment of the present invention.
图4为本发明实施例另一种共享硬件资源的方法流程示意图;4 is a schematic flowchart of another method for sharing hardware resources according to an embodiment of the present invention;
图5为本发明实施例一种共享硬件资源的控制器的结构组成示意图;FIG. 5 is a schematic structural diagram of a controller for sharing hardware resources according to an embodiment of the present invention; FIG.
图6为本发明实施例一种共享硬件资源的存储器的结构组成示意图。FIG. 6 is a schematic structural diagram of a memory sharing a hardware resource according to an embodiment of the present invention.
具体实施方式detailed description
下面结合附图对本发明的具体实施方式进行详细说明。应当理解的是,此处所描述的具体实施方式仅用于说明和解释本发明,并不用于限制本发明。The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative and not restrictive.
图1为本发明实施例一种共享硬件资源的方法流程示意图;如图1所示,该方法包括:FIG. 1 is a schematic flowchart of a method for sharing hardware resources according to an embodiment of the present invention; as shown in FIG. 1 , the method includes:
步骤101,接收到AXI发送的操作指令后,判定所述操作指令是对SRAM中第一存储单元中的硬件资源锁进行加锁或解锁的操作指令时,缓存所述加锁或解锁的操作指令相对应的第一写数据,并向所述第一存储单元发送第一读操作的指令;Step 101: After receiving the operation instruction sent by the AXI, determining that the operation instruction is an operation instruction for locking or unlocking the hardware resource lock in the first storage unit in the SRAM, buffering the operation instruction of locking or unlocking Corresponding first write data, and sending an instruction of the first read operation to the first storage unit;
这里,控制器在接收到所述AXI中管理员(master N)发出的操作指令后,判断该操作指令是否是对SRAM中第一存储单元中的硬件资源锁进 行加锁或解锁的操作指令;当判断该操作指令是对所述第一存储单元中的硬件资源锁进行加锁或解锁的操作指令时,缓存所述加锁或解锁的操作指令相对应的第一写数据,并向第一存储单元发送第一读操作的指令;这里加锁或解锁的操作指令可以理解为就是对所述硬件资源锁的第一写操作指令,并且在所述第一写操作指令中携带有与所述第一写操作指令相对应的第一写数据。Here, after receiving the operation instruction issued by the administrator (master N) in the AXI, the controller determines whether the operation instruction is to lock the hardware resource in the first storage unit in the SRAM. And an operation instruction for locking or unlocking; when it is determined that the operation instruction is an operation instruction for locking or unlocking the hardware resource lock in the first storage unit, buffering the operation instruction corresponding to the locking or unlocking First writing data, and sending an instruction of the first read operation to the first storage unit; the operation instruction for locking or unlocking herein may be understood as a first write operation instruction for the hardware resource lock, and at the first The write operation instruction carries the first write data corresponding to the first write operation instruction.
步骤102,根据获取到的第一读数据,确定所述AXI对所述硬件资源锁加锁或解锁成功,所述第一读数据是与所述第一读操作的指令相对应的数据。Step 102: Determine, according to the acquired first read data, that the AXI locks or unlocks the hardware resource lock successfully, and the first read data is data corresponding to an instruction of the first read operation.
这里,第一存储单元收到控制器发送的第一读操作的指令后,向所述控制器发送所述第一读操作的指令相对应的第一读数据。控制器接收到所述第一读数据后,确定所述AXI对所述硬件资源锁加锁或解锁成功。Here, after receiving the instruction of the first read operation sent by the controller, the first storage unit sends the first read data corresponding to the instruction of the first read operation to the controller. After receiving the first read data, the controller determines that the AXI locks or unlocks the hardware resource lock successfully.
在本发明实施例中,所述确定所述AXI对所述硬件资源加锁成功包括:判断获取到的所述第一读操作的指令相对应的第一读数据为第一预设值时,将所述第一写数据写入所述第一存储单元。In the embodiment of the present invention, the determining that the AXI locks the hardware resource successfully comprises: determining that the first read data corresponding to the obtained instruction of the first read operation is a first preset value, Writing the first write data to the first storage unit.
这里,控制器判断获取到的所述第一读操作的指令相对应的第一读数据是否为第一预设值,如“0”,当控制器判断所述第一读数据为第一预设值,如“0”时,将缓存的所述第一写数据写入所述第一存储单元中的目标地址中,表示AXI中的master N对所述硬件资源锁加锁成功。Here, the controller determines whether the first read data corresponding to the acquired instruction of the first read operation is a first preset value, such as “0”, when the controller determines that the first read data is the first pre- When the value is set to "0", the cached first write data is written into the target address in the first storage unit, indicating that the master N in the AXI locks the hardware resource lock successfully.
反之,如果控制器判断所述第一读数据不为第一预设值,如“0”时,则不向所述第一存储单元中的目标地址发送写操作指令,表示该硬件资源锁已经被多核系统中的其他共享硬件资源的各控制器加锁,则丢弃之前缓存的所述第一写数据,表示AXI中的master N对所述硬件资源锁加锁失败。这里,控制器根据所述硬件资源锁的数量配置所述第一存储单元的存储区域大小。 On the other hand, if the controller determines that the first read data is not the first preset value, such as “0”, the write operation instruction is not sent to the target address in the first storage unit, indicating that the hardware resource lock has been If the controllers of other shared hardware resources in the multi-core system are locked, the first write data cached before is discarded, indicating that the master N in the AXI fails to lock the hardware resource lock. Here, the controller configures the storage area size of the first storage unit according to the number of the hardware resource locks.
图2为本发明实施例中AXI对硬件资源锁进行加锁的控制状态示意图,如图2所示,硬件资源锁处于空闲(IDLE)201状态时,控制器接收到AXI对硬件资源锁进行加锁的操作指令后,首先缓存与该加锁的操作指令对应的第一写数据,之后产生一个第一读操作的指令,并向第一存储单元中的目标地址发出第一读操作的指令,转入下一个读(READ)203状态;这里,所述加锁的操作指令可以理解为就是对SRAM中第一存储单元中的硬件资源锁进行第一写操作的指令,并且在所述第一写操作的指令中携带有与所述第一写操作的指令相对应的第一写数据;所述目标地址是所述加锁的操作指令中携带的目标地址。控制器接收来自第一存储单元发送的第一读操作的指令相对应的第一读数据,如果该第一读数据为第一预设值,如“0”,则转入写(WRITE)202状态,并将控制器之前缓存的第一写数据写入第一存储单元,写操作完成后,转入IDLE201状态,表示AXI对硬件资源锁加锁成功。反之,表示该硬件资源锁已经被其他控制器加锁,则丢弃之前缓存的第一写数据,表示AXI对硬件资源锁加锁失败,转入初始的空闲IDLE201状态。2 is a schematic diagram of a control state in which AXI locks a hardware resource lock according to an embodiment of the present invention. As shown in FIG. 2, when the hardware resource lock is in an idle (IDLE) 201 state, the controller receives AXI to add a hardware resource lock. After the operation instruction of the lock, first buffering the first write data corresponding to the locked operation instruction, then generating an instruction of the first read operation, and issuing an instruction of the first read operation to the target address in the first storage unit, Transfer to the next read (READ) 203 state; here, the locked operation command can be understood as an instruction to perform a first write operation on the hardware resource lock in the first storage unit in the SRAM, and at the first The instruction of the write operation carries the first write data corresponding to the instruction of the first write operation; the target address is the target address carried in the locked operation instruction. The controller receives the first read data corresponding to the instruction of the first read operation sent by the first storage unit, and if the first read data is the first preset value, such as “0”, then the write to the write (WRITE) 202 The state, and the first write data buffered by the controller is written into the first storage unit. After the write operation is completed, the IDLE201 state is transferred, indicating that the AXI locks the hardware resource lock successfully. Conversely, if the hardware resource lock has been locked by another controller, the previously written first write data is discarded, indicating that AXI fails to lock the hardware resource lock and transitions to the initial idle IDLE201 state.
本发明实施例中,所述确定所述AXI对所述硬件资源锁解锁成功包括:判定获取到的所述第一读操作的指令相对应的第一读数据与所述第一写数据一致时,将第二写数据写入所述第一存储单元,写入的第二写数据为第二预设值。In the embodiment of the present invention, the determining that the AXI unlocks the hardware resource lock successfully comprises: determining that the first read data corresponding to the obtained instruction of the first read operation is consistent with the first write data Writing the second write data to the first storage unit, and writing the second write data to a second preset value.
这里,控制器判断所述第一读数据不为第一预设值,如“0”时,则判断所述第一读数据是否与之前缓存的所述第一写数据一致,当判断所述第一读数据与所述第一写数据一致时,向所述第一存储单元中的目标地址写入第二写数据,写入的第二写数据为第二预设值,如“0”,表示AXI中的master N对所述硬件资源锁解锁成功。Here, the controller determines that the first read data is not the first preset value, such as "0", determining whether the first read data is consistent with the previously cached first write data, when determining the When the first read data is consistent with the first write data, the second write data is written to the target address in the first storage unit, and the written second write data is a second preset value, such as “0” , indicating that the master N in the AXI unlocks the hardware resource lock successfully.
反之,如果控制器判断所述读数据不为第一预设值“0”,也与所述第 一写数据不一致时,则不向所述第一存储单元中的目标地址发送第二写操作指令,表示该硬件资源锁不能被所述AXI中的master N解锁,则丢弃之前缓存的所述第一写数据,表示AXI中的master N对所述硬件资源锁存解锁失败。这里,一个目标地址对应一个硬件资源锁,并且该目标地址是解锁的操作指令中携带的目标地址。On the other hand, if the controller determines that the read data is not the first preset value “0”, When a write data is inconsistent, the second write operation instruction is not sent to the target address in the first storage unit, indicating that the hardware resource lock cannot be unlocked by the master N in the AXI, and the previously cached first part is discarded. A write data indicates that master N in AXI has failed to latch the hardware resource. Here, one target address corresponds to one hardware resource lock, and the target address is a target address carried in an unlocked operation instruction.
图3为本发明实施例中AXI对硬件资源锁进行解锁的控制状态示意图,如图3所示,硬件资源锁处于IDLE301状态,当控制器接收到AXI对硬件资源锁进行解锁的操作指令后,首先缓存该做解锁的操作指令对应的第一写数据,之后产生一个第一读操作的指令,并向第一存储单元中的目标地址发出第一读操作的指令,转入READ303状态;这里,所述解锁的操作指令可以理解为就是对第一存储单元中的硬件资源锁进行第一写操作的指令,在所述第一写操作的指令中携带有与所述第一写操作的指令相对应的第一写数据;该目标地址是所述第一写操作的指令中指定的目标地址;控制器接收来自第一存储单元发送的第一读操作的指令相对应的第一读数据后,如果该第一读数据与控制器之前缓存的第一写数据一致,则转入WRITE302状态,并向第一存储单元中的目标地址写入第二写数据,写入的第二写数据为第二预设值,如“0”,并转入初始的IDLE301状态,表示AXI对所述硬件资源锁解锁成功。反之表示该硬件资源锁不能被AXI中的master N解锁,则丢弃之前缓存的第一写数据,转入初始的IDLE301状态,表示AXI对所述硬件资源锁解锁失败。3 is a schematic diagram of a control state in which AXI unlocks a hardware resource lock according to an embodiment of the present invention. As shown in FIG. 3, the hardware resource lock is in an IDLE301 state. When the controller receives an operation instruction for unlocking the hardware resource lock by AXI, Firstly, the first write data corresponding to the unlocked operation instruction is buffered, and then an instruction of the first read operation is generated, and the instruction of the first read operation is sent to the target address in the first storage unit, and the state is changed to the READ303 state; here, The unlocked operation instruction may be understood as an instruction to perform a first write operation on a hardware resource lock in the first storage unit, and the instruction in the first write operation carries an instruction related to the first write operation. Corresponding first write data; the target address is a target address specified in the instruction of the first write operation; after the controller receives the first read data corresponding to the instruction of the first read operation sent by the first storage unit, If the first read data is consistent with the first write data buffered by the controller, then the WRITE 302 state is entered, and the second address is written to the target address in the first storage unit. Data, a second write data for the second preset value, such as "0", and proceeds to the initial state IDLE301, AXI represents the hardware resource lock unlock success. Conversely, the hardware resource lock cannot be unlocked by the master N in the AXI, and the previously cached first write data is discarded, and the initial IDLE301 state is transferred, indicating that AXI fails to unlock the hardware resource lock.
本发明实施例中,所述方法还包括:所述AXI发送的操作指令不是对所述硬件资源锁进行加锁或解锁的操作指令时,判断所述AXI发送的操作指令是否是对所述硬件资源锁进行读操作的指令;所述AXI发送的操作指令是对所述硬件资源锁进行读操作的指令时,向所述第一存储单元发送第二读操作指令,并向所述AXI发送所述第二读操作指令相对应的第二读数 据。In the embodiment of the present invention, the method further includes: when the operation instruction sent by the AXI is not an operation instruction for locking or unlocking the hardware resource lock, determining whether the operation instruction sent by the AXI is to the hardware The resource lock performs an operation of a read operation; when the operation command sent by the AXI is an instruction to perform a read operation on the hardware resource lock, sending a second read operation instruction to the first storage unit, and transmitting the instruction to the AXI The second reading corresponding to the second read operation instruction according to.
这里,控制器判断所述AXI发送的操作指令不是对所述硬件资源锁进行加锁或解锁的操作指令时,判断所述AXI发送的操作指令是否是对所述硬件资源锁进行读操作的指令;控制器判断所述AXI发送的操作指令是对所述硬件资源锁进行读操作的指令时,直接向第一存储单元发送所述第二读操作指令,并将所述第一存储单元返回的所述第二读操作指令相对应的第二读数据发送给所述AXI。这里第二读操作指令中携带有与所述第二读操作指令相对应的第二读数据。Here, when the controller determines that the operation instruction sent by the AXI is not an operation instruction for locking or unlocking the hardware resource lock, determining whether the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock When the controller determines that the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock, directly sending the second read operation instruction to the first storage unit, and returning the first storage unit The second read data corresponding to the second read operation instruction is sent to the AXI. Here, the second read operation instruction carries the second read data corresponding to the second read operation instruction.
本发明实施例中,所述方法还包括:所述AXI发送的操作指令不是对所述硬件资源锁进行读操作的指令时,判断所述AXI发送的操作指令是否为对SRAM中第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令;所述AXI发送的操作指令是对所述非硬件资源锁进行写操作的指令或读操作的指令时,向所述第二存储单元发送所述写操作的指令或读操作的指令,并向所述AXI发送所述写操作的指令或读操作的指令相对应的写数据或读数据。In the embodiment of the present invention, the method further includes: when the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock, determining whether the operation instruction sent by the AXI is a second storage unit in the SRAM The non-hardware resource lock in the instruction to perform a write operation or the read operation; the operation instruction sent by the AXI is an instruction to write the non-hardware resource lock or an instruction to read the operation, to the second storage The unit transmits an instruction of the write operation or an instruction of the read operation, and sends the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the AXI.
这里,控制器判断所述AXI发送的操作指令不是对所述硬件资源锁进行读操作的指令时,判断所述AXI发送的操作指令是否是对第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令;所述控制器判断所述AXI发送的操作指令是对所述非硬件资源锁进行写操作的指令或读操作的指令时,直接向第二存储单元发送所述写操作的指令或读操作的指令,并将所述第二存储单元返回的与所述写操作的指令或读操作的指令相对应的写数据或读数据发送给所述AXI。这里,所述写操作的指令或所述读操作的指令中携带有与所述写操作的指令或所述读操作的指令相对应的写数据或读数据;所述第二存储单元的存储区别大小也是根据硬件资源锁的数量配置的。 Here, the controller determines whether the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock, and determines whether the operation instruction sent by the AXI is a write operation on a non-hardware resource lock in the second storage unit. The instruction of the instruction or the read operation; the controller determines that the operation instruction sent by the AXI is an instruction of a write operation or a read operation of the non-hardware resource lock, and directly sends the write to the second storage unit The operation instruction or the instruction of the read operation, and the write data or the read data corresponding to the instruction of the write operation or the read operation returned by the second storage unit is sent to the AXI. Here, the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the instruction of the read operation; the storage difference of the second storage unit The size is also configured according to the number of hardware resource locks.
图4为本发明实施例另一种共享硬件资源的方法流程示意图,如图4所示,所述方法包括:FIG. 4 is a schematic flowchart of another method for sharing hardware resources according to an embodiment of the present invention. As shown in FIG. 4, the method includes:
步骤401,接收到控制器发送的对硬件资源锁进行第一读操作的指令或第二读操作的指令后,向所述控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据;Step 401: After receiving an instruction of the first read operation or the second read operation sent by the controller, send the instruction of the first read operation or the second read operation to the controller. The first read data or the second read data corresponding to the instruction;
步骤402,接收到所述控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令后,向所述控制器发送所述读操作的指令或所述写操作的指令相对应的写数据或读数据。Step 402, after receiving an instruction for writing a non-hardware resource lock sent by the controller or an instruction of a read operation, sending an instruction of the read operation or an instruction of the write operation to the controller. Write data or read data.
这里,控制器中接收的AXI对所述硬件资源锁进行加锁或解锁的操作指令时,SRAM中的第一存储单元获取到控制器发送的对硬件资源锁进行第一读操作的指令;当控制器接收的AXI对所述硬件资源锁进行读操作的指令时,SRAM中的第一存储单元获取到控制器发送的对硬件资源锁进行第二读操作的指令;这里,加锁或解锁的操作指令可以理解为就是指对硬件资源锁进行第一写操作的指令,在该第一写操作的指令中携带有与所述第一写操作的指令相对应的第一写数据;第二读操作的指令中也携带有与该第二读操作的指令相对应的第二读数据。第一存储单元根据接收到的第一读操作的指令或第二读操作的指令,向控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据。这里该第一读操作的指令是由控制器发出的指令转换命令,将加锁或解锁的操作指令转换为第一读操作的指令,在该第一读操作的指令中携带有与该第一读操作的指令相对应的第一读数据。Here, when the AXI received by the controller locks or unlocks the hardware resource lock, the first storage unit in the SRAM acquires an instruction to perform a first read operation on the hardware resource lock sent by the controller; When the AXI received by the controller reads the hardware resource lock, the first storage unit in the SRAM acquires an instruction to perform a second read operation on the hardware resource lock sent by the controller; here, the lock or unlock is performed. The operation instruction can be understood as an instruction to perform a first write operation on the hardware resource lock, and the instruction in the first write operation carries the first write data corresponding to the instruction of the first write operation; the second read The operation instructions also carry second read data corresponding to the instructions of the second read operation. The first storage unit sends, according to the received instruction of the first read operation or the instruction of the second read operation, the first read data corresponding to the instruction of the first read operation or the instruction of the second read operation to the controller. Or second read data. The instruction of the first read operation is an instruction conversion command issued by the controller, and the operation instruction for locking or unlocking is converted into an instruction of the first read operation, and the instruction of the first read operation carries the first The first read data corresponding to the instruction of the read operation.
控制器接收的AXI对非硬件资源锁进行写操作的指令或读操作的指令后,SRAM中的第二存储单元获取到控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令,这里,在该写操作的指令或读操作的指令中携带有与该写操作的指令或读操作的指令相对应的写数据或读数据。第二 存储单元根据接收到的写操作的指令或读操作的指令,向控制器发送所述写操作的指令或读操作的指令相对应的写数据或读数据。After the AXI receives the instruction of the write operation or the read operation of the non-hardware resource lock, the second storage unit in the SRAM acquires the instruction of the write operation or the read operation sent by the controller to the non-hardware resource lock. Here, the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the read operation. Second The storage unit transmits the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the controller according to the received instruction of the write operation or the instruction of the read operation.
在本发明实施例中,所述方法还包括:所述第一读数据为第一预设值时,所述第一存储单元获取所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁的操作指令相对应的第一写数据。In the embodiment of the present invention, the method further includes: when the first read data is the first preset value, the first storage unit acquires AXI cached by the controller, and locks the hardware resource lock. Or the unlocked operation instruction corresponds to the first write data.
这里,第一读数据为第一预设值,如为“0”时,第一存储单元获取所述控制器中指令转换单元缓存的AXI对所述硬件资源锁进行加锁或解锁的操作指令相对应的第一写数据,表示AXI中的master N对所述硬件资源锁加锁成功。这里,所述第一存储单元的存储区域大小根据所述硬件资源锁的数量所配置。Here, the first read data is a first preset value. If the value is “0”, the first storage unit acquires an operation instruction for locking or unlocking the hardware resource lock by the AXI cached by the instruction conversion unit in the controller. Corresponding first write data indicates that master N in AXI successfully locks the hardware resource lock. Here, the storage area size of the first storage unit is configured according to the number of hardware resource locks.
具体的AXI对硬件资源锁进行加锁的控制状态参照第一种方法实施例中的图2描述,在此不再赘述。The control state of the specific AXI lock on the hardware resource lock is described with reference to FIG. 2 in the first method embodiment, and details are not described herein again.
在本发明实施例中,所述方法还包括:所述第一读数据与所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作的指令相对应的第一写数据一致时,所述第一存储单元获取所述控制器写入的第二写数据,写入的第二写数据为第二预设值。In the embodiment of the present invention, the method further includes: when the first read data is consistent with the first write data corresponding to the instruction that the AXI cached by the controller locks or unlocks the hardware resource lock The first storage unit acquires second write data written by the controller, and the written second write data is a second preset value.
这里,当第一存储单元发送所述第一读操作的指令相对应的第一读数据与所述控制器中指令转换单元缓存的AXI对所述硬件资源锁进行加锁或解锁操作的指令相对应的第一写数据一致时,获取控制器写入的第二写数据,写入的第二写数据为第二预设值,如“0”,表示AXI中的master N对所述硬件资源锁解锁成功。Here, when the first memory unit transmits the first read data corresponding to the instruction of the first read operation and the instruction of the controller in the controller that the AXI caches the hardware resource lock to lock or unlock the operation, When the corresponding first write data is consistent, the second write data written by the controller is obtained, and the second write data written is a second preset value, such as “0”, indicating that the master N in the AXI is to the hardware resource. The lock was unlocked successfully.
具体的AXI对硬件资源锁进行解锁的控制状态参照第一种方法实施例中的图3描述,在此不再赘述。The control state of the specific AXI to unlock the hardware resource lock is described with reference to FIG. 3 in the first method embodiment, and details are not described herein again.
图5为本发明实施例一种共享硬件资源的控制器51的结构组成示意图,如图5所示,所述控制器51包括:数据处理单元511、指令转换单元 512和数据控制单元513,其中,FIG. 5 is a schematic structural diagram of a controller 51 for sharing hardware resources according to an embodiment of the present invention. As shown in FIG. 5, the controller 51 includes: a data processing unit 511, and an instruction conversion unit. 512 and data control unit 513, wherein
所述数据处理单元511,配置为接收到AXI发送的操作指令后,判断所述操作指令是否是对SRAM中第一存储单元中的硬件资源锁进行加锁或解锁操作的指令;The data processing unit 511 is configured to: after receiving the operation instruction sent by the AXI, determine whether the operation instruction is an instruction to lock or unlock the hardware resource lock in the first storage unit in the SRAM;
所述指令转换单元512,配置为所述数据处理单元511判断所述AXI发送的操作指令是对所述第一存储单元中的硬件资源锁进行加锁或解锁操作的指令时,缓存所述加锁或解锁操作的指令相对应的第一写数据,并向第一存储单元发送第一读操作的指令;根据获取到的第一读数据,确定所述AXI对所述硬件资源锁加锁或解锁成功,所述第一读数据是与所述第一读操作的指令相对应的数据。The instruction conversion unit 512 is configured to cache the add-on when the data processing unit 511 determines that the operation instruction sent by the AXI is an instruction to lock or unlock the hardware resource lock in the first storage unit. Locking or unlocking the first write data corresponding to the operation instruction, and sending an instruction of the first read operation to the first storage unit; determining, according to the acquired first read data, that the AXI locks the hardware resource lock or The unlocking is successful, and the first read data is data corresponding to an instruction of the first read operation.
这里,数据处理单元511通过AXI在接收到所述AXI中管理员master N发出的操作指令后,判断该操作指令是否是对硬件资源锁进行加锁或解锁操作的指令;判定该加锁或解锁操作指令是对所述硬件资源锁进行加锁或解锁操作的指令时,将所述加锁或解锁操作的指令生成第一写操作的指令发送至指令转换单元512;这里,加锁或解锁操作的指令可以理解为就是对硬件资源锁进行第一写操作的指令,在该第一写操作的指令中携带有与该第一写操作的指令相对应的第一写数据。指令转换单元512接收到所述数据处理单元511发送的加锁或解锁操作的指令后,缓存所述加锁或解锁操作的指令相对应的第一写数据,并向数据控制单元513发送第一读操作的指令;这里该第一读操作的指令中携带有与该第一读操作的指令相对应的第一读数据。数据控制单元513接收到指令转换单元512发送的所述第一读操作的指令后,将所述第一读操作的指令发送至第一存储单元中的目标地址。这里的目标地址是指加锁或解锁操作的指令中携带的目标地址。第一存储单元收到数据控制单元513发送的第一读操作的指令后,向数据控制单元513发送所述第一读操作的指令相对应的第一读数据,数据控制 单元513接收到所述第一读数据后,将所述第一读数据发送至指令转换单元512,指令转换单元512根据数据控制单元513发送的所述第一读数据,确定所述AXI对硬件资源锁加锁或解锁成功。Here, after receiving the operation instruction issued by the administrator master N in the AXI, the data processing unit 511 determines whether the operation instruction is an instruction to lock or unlock the hardware resource lock; determining the lock or unlock When the operation instruction is an instruction to lock or unlock the hardware resource lock, the instruction to generate the first write operation by the instruction of the locking or unlocking operation is sent to the instruction conversion unit 512; here, the locking or unlocking operation is performed. The instruction can be understood as an instruction to perform a first write operation on the hardware resource lock, and the instruction in the first write operation carries the first write data corresponding to the instruction of the first write operation. After receiving the instruction of the locking or unlocking operation sent by the data processing unit 511, the instruction conversion unit 512 buffers the first write data corresponding to the instruction of the locking or unlocking operation, and sends the first data to the data control unit 513. The instruction of the read operation; wherein the instruction of the first read operation carries the first read data corresponding to the instruction of the first read operation. After receiving the instruction of the first read operation sent by the instruction conversion unit 512, the data control unit 513 sends the instruction of the first read operation to the target address in the first storage unit. The destination address here refers to the destination address carried in the instruction to lock or unlock the operation. After receiving the instruction of the first read operation sent by the data control unit 513, the first storage unit sends the first read data corresponding to the instruction of the first read operation to the data control unit 513, and the data is controlled. After receiving the first read data, the unit 513 sends the first read data to the instruction conversion unit 512, and the instruction conversion unit 512 determines the AXI pair hardware according to the first read data sent by the data control unit 513. The resource lock is locked or unlocked successfully.
在本发明实施例中,所述指令转换单元512,还配置为判定获取到的所述第一读数据是第一预设值时,将所述第一写数据写入所述第一存储单元。In the embodiment of the present invention, the instruction conversion unit 512 is further configured to: when the obtained first read data is the first preset value, write the first write data to the first storage unit. .
这里,指令转换单元512判断获取到的所述第一读操作的指令相对应的第一读数据是否为第一预设值,如“0”,当指令转换单元512判断所述第一读数据为第一预设值,如“0”时,向数据控制单元513发送写操作的指令,数据控制单元513根据所述写操作的指令,将指令转换单元512缓存的所述第一写数据写入所述第一存储单元中的目标地址中,表示AXI中的master N对所述硬件资源锁加锁成功。这里该目标地址是指加锁或解锁操作的指令中携带的目标地址。Here, the instruction conversion unit 512 determines whether the first read data corresponding to the acquired instruction of the first read operation is a first preset value, such as “0”, when the instruction conversion unit 512 determines the first read data. When the first preset value is "0", the instruction of the write operation is sent to the data control unit 513, and the data control unit 513 writes the first write data buffered by the instruction conversion unit 512 according to the instruction of the write operation. Entering the target address in the first storage unit indicates that the master N in AXI successfully locks the hardware resource lock. Here, the target address refers to a target address carried in an instruction for locking or unlocking operations.
反之,如果指令转换单元512判断所述第一读数据不是第一预设值,如“0”时,则不向所述第一存储单元中的目标地址发送第一写操作的指令,表示该硬件资源锁已经被多核系统中的其他共享硬件资源锁的各控制器加锁,则丢弃之前缓存的所述第一写数据,表示AXI中的master N对硬件资源锁存加锁失败。这里,一个目标地址对应一个硬件资源锁,数据处理单元511根据所述硬件资源锁的数量配置所述第一存储单元的存储区域大小。On the other hand, if the instruction conversion unit 512 determines that the first read data is not the first preset value, such as "0", the instruction of the first write operation is not sent to the target address in the first storage unit, indicating that the The hardware resource lock has been locked by each controller of the other shared hardware resource locks in the multi-core system, and the first write data buffered before is discarded, indicating that the master N in AXI fails to lock the hardware resource latch. Here, one target address corresponds to one hardware resource lock, and the data processing unit 511 configures the storage area size of the first storage unit according to the number of the hardware resource locks.
具体的AXI对硬件资源锁进行加锁的控制状态参照方法实施例中的图2描述,这里不在赘述。The control state of the specific AXI locking of the hardware resource lock is described in FIG. 2 in the embodiment of the method, and is not described here.
在本发明实施例中,所述指令转换单元512,还配置为判定获取到所述第一读操作的指令相对应的第一读数据与所述第一写数据一致时,将第二写数据写入所述第一存储单元,写入的第二写数据为第二预设值。In the embodiment of the present invention, the instruction conversion unit 512 is further configured to determine that the first read data corresponding to the instruction for acquiring the first read operation is consistent with the first write data, and the second write data is Writing to the first storage unit, the written second write data is a second preset value.
这里,指令转换单元512判定所述第一读数据不为第一预设值,如“0”时,则判断所述第一读数据是否与之前缓存的所述第一写数据一致,当判 定所述第一读数据与所述第一写数据一致时,则向所述数据控制单元513发送第二写操作的指令,数据控制单元513接收到指令转换单元512发送的所述第二写操作的指令后,向所述第一存储单元中的目标地址写入第二写数据,写入的第二写数据为第二预设值,如“0”,表示AXI中的master N对所述硬件资源锁解锁成功。Here, the instruction conversion unit 512 determines that the first read data is not the first preset value, such as “0”, and determines whether the first read data is consistent with the previously cached first write data. When the first read data is consistent with the first write data, an instruction of the second write operation is sent to the data control unit 513, and the data control unit 513 receives the second write sent by the instruction conversion unit 512. After the operation instruction, the second write data is written to the target address in the first storage unit, and the written second write data is a second preset value, such as “0”, indicating the master N pair in the AXI. The hardware resource lock is unlocked successfully.
反之,如果指令转换单元512判断所述第一读数据不为第一预设值如“0”,也与所述第一写数据不一致时,则不向所述第一存储单元中的目标地址发送第二写操作指令,表示该硬件资源锁不能被所述AXI中的master N解锁,则丢弃之前缓存的所述第一写数据,表示AXI中的master N对硬件资源锁存解锁失败。这里,一个目标地址对应一个硬件资源锁,并且该目标地址是加锁或解锁操作的指令中携带的目标地址。On the other hand, if the instruction conversion unit 512 determines that the first read data is not the first preset value, such as “0”, and does not coincide with the first write data, then the target address in the first storage unit is not Sending a second write operation instruction, indicating that the hardware resource lock cannot be unlocked by the master N in the AXI, discarding the previously written first write data, indicating that the master N in the AXI fails to unlock the hardware resource. Here, one target address corresponds to one hardware resource lock, and the target address is a target address carried in an instruction for locking or unlocking operations.
具体的AXI对硬件资源锁进行解锁的控制状态参照方法实施例中的图3描述,在此不再赘述。The control state of the specific AXI to unlock the hardware resource lock is described in FIG. 3 in the embodiment of the method, and details are not described herein again.
在本发明实施例中,所述数据处理单元511,还配置为判定所述AXI发送的操作指令不是对所述硬件资源锁进行加锁或解锁操作的指令时,判断所述AXI发送的操作指令是否是对所述硬件资源锁进行读操作的指令;所述指令转换单元512,还配置为所述数据处理单元511判定所述AXI发送的操作指令是对所述硬件资源锁进行读操作的指令时,直接向所述数据控制单元513发送第二读操作的指令,数据控制单元513接收到所述指令转换单元512发送的所述第二读操作的指令后,向第一存储单元发送所述第二读操作的指令,并将所述第一存储单元返回的所述第二读操作的指令相对应的第二读数据发送给所述指令转换单元512,指令转换单元512再将所述第二读数据发送给数据处理单元511,再由数据处理单元511向所述AXI发送所述第二读数据。这里第二读操作的指令中携带有与所述第二读操作的指令相对应的第二读数据。 In the embodiment of the present invention, the data processing unit 511 is further configured to determine, when the operation instruction sent by the AXI is not an instruction to lock or unlock the hardware resource lock, determine an operation instruction sent by the AXI. Whether it is an instruction to perform a read operation on the hardware resource lock; the instruction conversion unit 512 is further configured to: the data processing unit 511 determines that the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock Directly sending an instruction of the second read operation to the data control unit 513, and after receiving the instruction of the second read operation sent by the instruction conversion unit 512, the data control unit 513 sends the instruction to the first storage unit. And the second read data corresponding to the instruction of the second read operation returned by the first storage unit is sent to the instruction conversion unit 512, and the instruction conversion unit 512 further The second read data is sent to the data processing unit 511, and the second read data is sent by the data processing unit 511 to the AXI. Here, the instruction of the second read operation carries the second read data corresponding to the instruction of the second read operation.
本发明实施例中,所述数据处理单元511,还配置为判定所述AXI发送的操作指令不是对所述硬件资源锁进行读操作的指令时,判断所述AXI发送的操作指令是否是对第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令;所述指令转换单元512,还配置为所述数据处理单元511判定所述AXI发送的操作指令是对所述非硬件资源锁进行写操作的指令或读操作的指令时,直接向所述数据控制单元513发送所述写操作的指令或读操作的指令,数据控制单元513接收到所述指令转换单元512发送的所述写操作的指令或读操作的指令后,向第二存储单元发送所述写操作的指令或读操作的指令,并将所述第二存储单元返回的所述写操作的指令或读操作的指令相对应的写数据或读数据发送给所述指令转换单元512,指令转换单元512再将所述写数据或读数据发送给数据处理单元511,再由数据处理单元511向所述AXI发送所述写操作的指令或读操作的指令相对应的写数据或读数据。这里,所述写操作的指令或所述读操作的指令中携带有与所述写操作的指令或所述读操作的指令相对应的写数据或读数据;所述第二存储单元的存储区别大小是由数据处理单元511根据硬件资源锁的数量配置的。In the embodiment of the present invention, the data processing unit 511 is further configured to determine whether the operation instruction sent by the AXI is an operation instruction when the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock. The non-hardware resource lock in the second storage unit is an instruction of a write operation or a read operation; the instruction conversion unit 512 is further configured to determine that the operation instruction sent by the AXI is to the non-hardware When the resource lock performs an instruction of a write operation or an instruction of a read operation, the instruction of the write operation or the instruction of the read operation is directly sent to the data control unit 513, and the data control unit 513 receives the location sent by the instruction conversion unit 512. After the instruction of the operation or the instruction of the read operation is described, the instruction of the write operation or the instruction of the read operation is sent to the second storage unit, and the instruction of the write operation or the read operation of the second storage unit is returned The write data or the read data corresponding to the instruction is sent to the instruction conversion unit 512, and the instruction conversion unit 512 sends the write data or the read data to the data processing. Element 511, and then transmits the write data from the processing unit 511 to the AXI read instruction or a write operation corresponding to the data or read data. Here, the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the instruction of the read operation; the storage difference of the second storage unit The size is configured by the data processing unit 511 in accordance with the number of hardware resource locks.
图6为本发明实施一种共享硬件资源的存储器的结构组成示意图,如图6所示,所述存储器61包括:第一存储单元611和第二存储单元612;其中,FIG. 6 is a schematic structural diagram of a memory for sharing a hardware resource according to the present invention. As shown in FIG. 6, the memory 61 includes: a first storage unit 611 and a second storage unit 612;
所述第一存储单元611,配置为接收到控制器发送的对硬件资源锁进行第一读操作的指令或第二读操作的指令后,向所述控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据;The first storage unit 611 is configured to send an instruction of the first read operation to the controller after receiving an instruction of the first read operation or the second read operation sent by the controller Or the first read data or the second read data corresponding to the instruction of the second read operation;
所述第二存储单元612,配置为接收到所述控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令后,向所述控制器发送所述读操作的指令或所述写操作的指令相对应的写数据或读数据。 The second storage unit 612 is configured to send an instruction of the read operation or the instruction to the controller after receiving an instruction of a write operation or a read operation sent by the controller to a non-hardware resource lock Write data or read data corresponding to the instruction of the write operation.
这里,控制器中接收到AXI对所述硬件资源锁进行加锁或解锁操作的指令时,第一存储单元611接收控制器发送的对硬件资源锁进行第一读操作的指令;当控制器接收到AXI对所述硬件资源锁进行读操作的指令时,第一存储单元611接收控制器发送的对硬件资源锁进行第二读操作的指令;这里,加锁或解锁操作指令可以理解为就是指对硬件资源锁进行第一写操作的指令,在该第一写操作的指令中携带有与所述第一写操作的指令相对应的第一写数据。第一存储单元611根据接收到的第一操作的指令或第二操作的指令,向控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据。这里该第一读操作的指令是由控制器发出的指令转换命令,将加锁或解锁操作的指令转换为第一读操作的指令,在该第一读操作的指令中携带有与该第一读操作的指令相对应的第一读数据;在该第二读操作的指令中携带有与该第二读操作的指令相对应的第二读数据。Here, when the controller receives an instruction that the AXI locks or unlocks the hardware resource lock, the first storage unit 611 receives an instruction sent by the controller to perform a first read operation on the hardware resource lock; when the controller receives When the instruction to read the hardware resource lock is performed by the AXI, the first storage unit 611 receives an instruction for performing a second read operation on the hardware resource lock sent by the controller; here, the locking or unlocking operation instruction may be understood as referring to The instruction to perform the first write operation on the hardware resource lock carries the first write data corresponding to the instruction of the first write operation in the instruction of the first write operation. The first storage unit 611 sends, according to the received instruction of the first operation or the instruction of the second operation, the first read data corresponding to the instruction of the first read operation or the instruction of the second read operation or Second read data. The instruction of the first read operation is an instruction conversion command issued by the controller, and the instruction for locking or unlocking operation is converted into an instruction of the first read operation, and the first read operation carries the first instruction The first read data corresponding to the instruction of the read operation; the second read data corresponding to the instruction of the second read operation is carried in the instruction of the second read operation.
控制器接收到AXI对非硬件资源锁进行写操作的指令或读操作的指令时,第二存储单元612接收控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令,这里,在该写操作的指令或读操作的指令中携带有与该写操作的指令或读操作的指令相对应的写数据或读数据。第二存储单元612根据接收到的写操作的指令或读操作的指令,向控制器发送所述写操作的指令或读操作的指令相对应的写数据或读数据。这里所述写操作的指令或读操作的指令中携带有与所述写操作的指令或读操作的指令相对应的写数据或读数据。When the controller receives the instruction of the AXI to write to the non-hardware resource lock or the instruction of the read operation, the second storage unit 612 receives the instruction of the write operation or the read operation sent by the controller to the non-hardware resource lock, where The instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the read operation. The second storage unit 612 transmits the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the controller according to the received instruction of the write operation or the instruction of the read operation. Here, the instruction of the write operation or the instruction of the read operation carries write data or read data corresponding to the instruction of the write operation or the read operation.
所述第一存储单元611,还配置为所述第一读数据为第一预设值时,获取所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作的指令相对应的第一写数据。The first storage unit 611 is further configured to: when the first read data is the first preset value, acquire an instruction that the controller cached by the AXI locks or unlocks the hardware resource lock. The first write data.
这里,第一读数据为第一预设值如“0”时,第一存储单元611接收所 述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作的指令相对应的第一写数据,表示AXI中的master N对所述硬件资源锁加锁成功。这里,所述第一存储单元611的区域大小根据所述硬件资源锁的数量所配置,所述加锁或解锁操作的指令可以认为就是对硬件资源锁进行第一写操作的指令,在该第一写操作的指令中携带有与该第一写操作的指令相对应的第一写数据。Here, when the first read data is the first preset value, such as “0”, the first storage unit 611 receives the location. The first write data corresponding to the instruction of the controller cache AXI to lock or unlock the hardware resource lock indicates that the master N in the AXI successfully locks the hardware resource lock. Here, the area size of the first storage unit 611 is configured according to the number of hardware resource locks, and the instruction of the locking or unlocking operation may be regarded as an instruction to perform a first write operation on the hardware resource lock. The instruction of a write operation carries the first write data corresponding to the instruction of the first write operation.
在本发明实施例中,所述第一存储单元611还配置为所述第一读数据与所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作的指令相对应的第一写数据一致时,获取所述控制器写入的第二写数据,写入的第二写数据为第二预设值。In the embodiment of the present invention, the first storage unit 611 is further configured to: first, corresponding to the instruction that the first read data is locked or unlocked by the AXI cached by the controller to the hardware resource lock. When the write data is consistent, the second write data written by the controller is obtained, and the second write data written is a second preset value.
这里,当第一存储单元611发送所述读操作指令相对应的读数据与所述控制器中缓存的AXI对所述硬件资源锁进行加锁或解锁操作的指令相对应的第一写数据一致时,获取所述控制器中写入的第二写数据,写入的第二写数为第二预设值,如“0”的写数据,以表示所述AXI对硬件资源锁解锁成功。Here, when the first storage unit 611 sends the read data corresponding to the read operation instruction, the first write data corresponding to the instruction of the AXI cached in the controller that locks or unlocks the hardware resource lock is consistent. The second write data written in the controller is obtained, and the second write number written is a second preset value, such as "0" write data, to indicate that the AXI locks the hardware resource lock successfully.
具体的AXI对硬件资源锁进行加锁或解锁的控制状态参照第一种方法实施例中的图2或图3描述,在此不再赘述。The control state of the specific AXI to lock or unlock the hardware resource lock is described with reference to FIG. 2 or FIG. 3 in the first method embodiment, and details are not described herein again.
本发明实施例中,一种共享硬件资源的系统,包括如图5所示的控制器和如图6所示的存储器。In the embodiment of the present invention, a system for sharing hardware resources includes a controller as shown in FIG. 5 and a memory as shown in FIG. 6.
本发明实施例还提供一种计算机存储介质,其中存储有计算机可执行指令,该计算机可执行指令配置执行上述共享硬件资源的方法。Embodiments of the present invention also provide a computer storage medium in which computer executable instructions are stored, the computer executable instructions configuring a method of executing the shared hardware resource.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘 存储器和光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the present invention may employ computer-usable storage media (including but not limited to disks) in one or more of the computer-usable program code embodied therein. A form of computer program product embodied on a memory and optical storage, etc.).
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention has been described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
以上所述,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.
工业实用性Industrial applicability
采用本发明实施例,是通过控制器接收到AXI发送的操作指令后,判定所述操作指令是对SRAM中第一存储单元中的硬件资源锁进行加锁或解锁操作的指令时,缓存所述加锁或解锁操作的指令相对应的写数据,并向所述第一存储单元发送第一读操作的指令;根据获取到的所述第一读操作 的指令相对应的第一读数据,确定所述AXI对所述硬件资源锁加锁或解锁成功。如此,通过使用所述SRAM来实现对硬件资源锁的加锁或解锁,不仅能在多核系统中的硬件资源数量变多时实现所需数量的硬件资源锁,而且还降低了SOC的使用成本,提高了多核系统的可扩展性;通过AXI能方便的被AXI中的管理员访问,能实现良好的可移植性。 According to the embodiment of the present invention, after the controller receives the operation instruction sent by the AXI, and determines that the operation instruction is an instruction to lock or unlock the hardware resource lock in the first storage unit in the SRAM, the cache is Locking or unlocking the operation corresponding to the write data, and transmitting an instruction of the first read operation to the first storage unit; according to the acquired first read operation The instruction corresponding to the first read data determines that the AXI locks or unlocks the hardware resource lock successfully. In this way, by using the SRAM to lock or unlock the hardware resource lock, not only can the required number of hardware resource locks be realized when the number of hardware resources in the multi-core system increases, but also the SOC usage cost is lowered and the SOC is increased. The scalability of multi-core systems; AXI can be easily accessed by administrators in AXI, enabling good portability.

Claims (16)

  1. 一种共享硬件资源的方法,所述方法包括:A method of sharing hardware resources, the method comprising:
    接收到先进可扩展接口AXI发送的操作指令后,判定所述操作指令是对静态随机存取存储器SRAM中第一存储单元中的硬件资源锁进行加锁或解锁操作的指令时,缓存所述加锁或解锁操作的指令相对应的第一写数据,并向所述第一存储单元发送第一读操作的指令;After receiving the operation instruction sent by the advanced extensible interface AXI, determining that the operation instruction is an instruction to lock or unlock the hardware resource lock in the first storage unit in the static random access memory (SRAM), buffering the addition Locking or unlocking the first write data corresponding to the instruction of the operation, and transmitting an instruction of the first read operation to the first storage unit;
    根据获取到的第一读数据,确定所述AXI对所述硬件资源锁加锁或解锁成功,所述第一读数据是与所述第一读操作的指令相对应的数据。And determining, according to the acquired first read data, that the AXI locks or unlocks the hardware resource lock successfully, and the first read data is data corresponding to an instruction of the first read operation.
  2. 根据权利要求1所述的方法,其中,所述确定所述AXI对所述硬件资源锁加锁成功包括:The method of claim 1, wherein the determining that the AXI locks the hardware resource lock successfully comprises:
    判定获取到的所述第一读数据为第一预设值时,将所述第一写数据写入所述第一存储单元。When it is determined that the acquired first read data is the first preset value, the first write data is written into the first storage unit.
  3. 根据权利要求1所述的方法,其中,所述确定所述AXI对所述硬件资源锁解锁成功包括:The method of claim 1, wherein the determining that the AXI unlocks the hardware resource lock comprises:
    判定获取到的所述第一读数据与所述第一写数据一致时,将第二写数据写入所述第一存储单元,写入第二写数据为第二预设值。When it is determined that the acquired first read data is consistent with the first write data, writing the second write data to the first storage unit, and writing the second write data to a second preset value.
  4. 根据权利要求1所述的方法,其中,所述方法还包括:The method of claim 1 wherein the method further comprises:
    判定所述AXI发送的操作指令是对所述第一存储单元中的硬件资源锁进行读操作的指令时,向所述第一存储单元发送第二读操作指令,并向所述AXI发送所述第二读操作指令相对应的第二读数据。Determining that the operation instruction sent by the AXI is an instruction to perform a read operation on the hardware resource lock in the first storage unit, sending a second read operation instruction to the first storage unit, and transmitting the instruction to the AXI The second read operation instruction corresponds to the second read data.
  5. 根据权利要求1所述的方法,其中,所述方法还包括:The method of claim 1 wherein the method further comprises:
    判定所述AXI发送的操作指令是对SRAM中第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令时,向所述第二存储单元发送所述写操作的指令或读操作的指令,并向所述AXI发送所述写操作的指令或读操作的指令相对应的写数据或读数据。 Determining, when the operation instruction sent by the AXI is an instruction of a write operation or a read operation of a non-hardware resource lock in the second storage unit in the SRAM, sending an instruction or reading of the write operation to the second storage unit An instruction to operate, and send the write data or the read data corresponding to the instruction of the write operation or the instruction of the read operation to the AXI.
  6. 根据权利要求1至5任一项所述的方法,其中,所述方法还包括:The method of any of claims 1 to 5, wherein the method further comprises:
    根据所述硬件资源锁的数量配置所述第一存储单元或所述第二存储单元的存储区域大小。Configuring a storage area size of the first storage unit or the second storage unit according to the number of hardware resource locks.
  7. 一种共享硬件资源的方法,所述方法包括:A method of sharing hardware resources, the method comprising:
    接收到控制器发送的对硬件资源锁进行第一读操作的指令或第二读操作的指令后,向所述控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据;Receiving the instruction of the first read operation or the instruction of the second read operation sent by the controller, sending the instruction of the first read operation or the instruction of the second read operation to the controller Corresponding first read data or second read data;
    接收到所述控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令后,向所述控制器发送所述读操作的指令或所述写操作的指令相对应的写数据或读数据。Receiving an instruction of the write operation or a read operation of the non-hardware resource lock sent by the controller, sending the instruction of the read operation or the write data corresponding to the instruction of the write operation to the controller or Read the data.
  8. 根据权利要求7所述的方法,其中,所述方法还包括:The method of claim 7 wherein the method further comprises:
    所述第一读数据为第一预设值时,获取所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作指令相对应的第一写数据;或者,所述第一读数据与所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁操作指令相对应的第一写数据一致时,获取所述控制器写入的第二写数据,写入的第二写数据为第二预设值。When the first read data is the first preset value, acquiring, by the AXI cached by the controller, the first write data corresponding to the lock or unlock operation instruction of the hardware resource lock; or the first read Obtaining the second write data written by the controller, and writing the second data when the data is consistent with the first write data corresponding to the lock or unlock operation instruction of the hardware resource lock by the AXI cached by the controller. Write data as the second preset value.
  9. 一种共享硬件资源的控制器,所述控制器包括:数据处理单元和指令转换单元;其中,A controller for sharing hardware resources, the controller comprising: a data processing unit and an instruction conversion unit; wherein
    所述数据处理单元,配置为接收到AXI发送的操作指令后,判断所述操作指令是否是对SRAM中第一存储单元中的硬件资源锁进行加锁或解锁的操作指令;The data processing unit is configured to: after receiving the operation instruction sent by the AXI, determine whether the operation instruction is an operation instruction for locking or unlocking the hardware resource lock in the first storage unit in the SRAM;
    所述指令转换单元,配置为所述数据处理单元判定所述AXI发送的操作指令是对所述第一存储单元中的硬件资源锁进行加锁或解锁的操作指令时,缓存所述加锁或解锁的操作指令相对应的第一写数据,并向所述第一存储单元发送第一读操作的指令;根据获取到的第一读数据,确定所述AXI 对所述硬件资源锁加锁或解锁成功,所述第一读数据是与所述第一读操作的指令相对应的数据。The instruction conversion unit is configured to: when the data processing unit determines that the operation instruction sent by the AXI is an operation instruction for locking or unlocking a hardware resource lock in the first storage unit, buffering the locking or Decrypting an operation instruction corresponding to the first write data, and transmitting an instruction of the first read operation to the first storage unit; determining the AXI according to the acquired first read data The hardware resource lock is locked or unlocked successfully, and the first read data is data corresponding to the instruction of the first read operation.
  10. 根据权利要求9所述的控制器,其中,所述指令转换单元,还配置为判定获取到的所述第一读数据为第一预设值时,将所述第一写数据写入所述第一存储单元;或者,The controller according to claim 9, wherein the instruction conversion unit is further configured to: write the first write data to the first data when the acquired first read data is a first preset value First storage unit; or,
    判定获取到的所述第一读数据与所述第二写数据一致时,将第二写数据写入所述第一存储单元,写入的第二写数据为第二预设值。When it is determined that the acquired first read data is consistent with the second write data, the second write data is written into the first storage unit, and the written second write data is a second preset value.
  11. 根据权利要求9所述的控制器,其中,所述数据处理单元,The controller of claim 9 wherein said data processing unit,
    还配置为判断所述AXI发送的操作指令不是对所述第一存储单元中的硬件资源锁进行加锁或解锁的操作指令时,判断所述AXI发送的操作指令是否是对所述第一存储单元中的硬件资源锁进行读操作的指令;And determining, when determining that the operation instruction sent by the AXI is not an operation instruction for locking or unlocking the hardware resource lock in the first storage unit, determining whether the operation instruction sent by the AXI is for the first storage An instruction to read a hardware resource lock in the unit;
    所述指令转换单元,还配置为所述数据处理单元判定所述AXI发送的操作指令是对所述第一存储单元中的硬件资源锁进行读操作的指令时,向所述第一存储单元发送第二读操作指令,并向所述AXI发送所述第二读操作指令相对应的第二读数据。The instruction conversion unit is further configured to: when the data processing unit determines that the operation instruction sent by the AXI is an instruction to perform a read operation on a hardware resource lock in the first storage unit, send the instruction to the first storage unit The second read operation instruction transmits the second read data corresponding to the second read operation instruction to the AXI.
  12. 根据权利要求9所述的控制器,其中,所述数据处理单元,The controller of claim 9 wherein said data processing unit,
    还配置为判断所述AXI发送的操作指令不是对所述第一存储单元中的硬件资源锁进行读操作的指令时,判断所述AXI发送的操作指令是否是对SRAM中第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令;And determining, when determining that the operation instruction sent by the AXI is not an instruction to perform a read operation on the hardware resource lock in the first storage unit, determining whether the operation instruction sent by the AXI is in the second storage unit in the SRAM An instruction for a write operation or a read operation for a non-hardware resource lock;
    所述指令转换单元,还配置为所述数据处理单元判定所述AXI发送的操作指令是对所述第二存储单元中的非硬件资源锁进行写操作的指令或读操作的指令时,向所述第二存储单元发送所述写操作的指令或读操作的指令,并向所述AXI发送所述写操作的指令或读操作的指令相对应的写数据或读数据。 The instruction conversion unit is further configured to: when the data processing unit determines that the operation instruction sent by the AXI is an instruction to perform a write operation or a read operation on a non-hardware resource lock in the second storage unit, The second storage unit transmits an instruction of the write operation or an instruction of the read operation, and sends the write data or the read data corresponding to the instruction of the write operation or the read operation to the AXI.
  13. 一种共享硬件资源的存储器,所述存储器包括:第一存储单元和第二存储单元,其中,A memory sharing a hardware resource, the memory comprising: a first storage unit and a second storage unit, wherein
    所述第一存储单元,配置为接收到控制器发送的对硬件资源锁进行第一读操作的指令或第二读操作的指令后,向所述控制器发送所述第一读操作的指令或所述第二读操作的指令相对应的第一读数据或第二读数据;The first storage unit is configured to send an instruction of the first read operation or an instruction of the first read operation to the controller after receiving an instruction of the first read operation or the second read operation sent by the controller The first read data or the second read data corresponding to the instruction of the second read operation;
    所述第二存储单元,配置为接收到所述控制器发送的对非硬件资源锁进行写操作的指令或读操作的指令后,向所述控制器发送所述读操作的指令或所述写操作的指令相对应的写数据或读数据。The second storage unit is configured to send an instruction of the read operation or the write to the controller after receiving an instruction of a write operation or a read operation sent by the controller to a non-hardware resource lock The instruction of the operation corresponds to writing data or reading data.
  14. 根据权利要求13所述的存储器,其中,所述第一存储单元,还配置为所述第一读数据为第一预设值时,获取所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁的操作指令相对应的第一写数据;或者,The memory of claim 13, wherein the first storage unit is further configured to acquire, by the AXI cached by the controller, the hardware resource lock when the first read data is a first preset value. The first write data corresponding to the locked or unlocked operation instruction; or
    所述第一读数据与所述控制器缓存的AXI对所述硬件资源锁进行加锁或解锁的操作指令相对应的写数据一致时,获取所述控制器写入的为第二预设值的写数据。And acquiring, by the controller, a second preset value written by the controller, when the first read data is consistent with the write data corresponding to the operation instruction that the AXI cached by the controller is locked or unlocked by the hardware resource lock. Write data.
  15. 一种共享硬件资源的系统,所述系统包括控制器和存储器;其中,A system for sharing hardware resources, the system including a controller and a memory; wherein
    所述控制器为权利要求9至12任一项所述的控制器;The controller is the controller of any one of claims 9 to 12;
    所述存储器为权利要求13或14所述的存储器。The memory is the memory of claim 13 or 14.
  16. 一种计算机存储介质,存储有计算机可执行指令,该计算机可执行指令配置执行上述权利要求1-6、或权利要求7-8所述的共享硬件资源的方法。 A computer storage medium storing computer executable instructions configured to perform the method of sharing hardware resources of claims 1-6, or 7-8.
PCT/CN2017/080824 2016-05-27 2017-04-17 Method of sharing hardware resource, controller, data storage device, and system WO2017202155A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610370034.9A CN107436807A (en) 2016-05-27 2016-05-27 Method, controller, memory and the system of shared hardware resource
CN201610370034.9 2016-05-27

Publications (1)

Publication Number Publication Date
WO2017202155A1 true WO2017202155A1 (en) 2017-11-30

Family

ID=60412122

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/080824 WO2017202155A1 (en) 2016-05-27 2017-04-17 Method of sharing hardware resource, controller, data storage device, and system

Country Status (2)

Country Link
CN (1) CN107436807A (en)
WO (1) WO2017202155A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110876141A (en) * 2018-08-29 2020-03-10 阿里巴巴集团控股有限公司 Method, device, system, equipment and storage medium for processing repeated uplink message

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308461A (en) * 2007-05-18 2008-11-19 国际商业机器公司 Processor and method for processing lock-based transaction
CN103034593A (en) * 2012-12-11 2013-04-10 中国人民解放军国防科学技术大学 Multi--core processor oriented on-chip lock variable global addressing storage method and device
CN103377086A (en) * 2012-04-27 2013-10-30 华为技术有限公司 Method, device and system used for asynchronous multinuclear system to operate sharing resource
CN103377157A (en) * 2012-04-27 2013-10-30 沈阳高精数控技术有限公司 Dual-core data communication method for embedded type numerical control system
CN105095144A (en) * 2015-07-24 2015-11-25 中国人民解放军国防科学技术大学 Multi-core Cache consistency maintenance method and device based on fence and lock

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101308461A (en) * 2007-05-18 2008-11-19 国际商业机器公司 Processor and method for processing lock-based transaction
CN103377086A (en) * 2012-04-27 2013-10-30 华为技术有限公司 Method, device and system used for asynchronous multinuclear system to operate sharing resource
CN103377157A (en) * 2012-04-27 2013-10-30 沈阳高精数控技术有限公司 Dual-core data communication method for embedded type numerical control system
CN103034593A (en) * 2012-12-11 2013-04-10 中国人民解放军国防科学技术大学 Multi--core processor oriented on-chip lock variable global addressing storage method and device
CN105095144A (en) * 2015-07-24 2015-11-25 中国人民解放军国防科学技术大学 Multi-core Cache consistency maintenance method and device based on fence and lock

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110876141A (en) * 2018-08-29 2020-03-10 阿里巴巴集团控股有限公司 Method, device, system, equipment and storage medium for processing repeated uplink message
CN110876141B (en) * 2018-08-29 2023-04-21 阿里巴巴集团控股有限公司 Method, device, system, equipment and storage medium for processing repeated uplink message

Also Published As

Publication number Publication date
CN107436807A (en) 2017-12-05

Similar Documents

Publication Publication Date Title
US11194920B2 (en) File system metadata protection
US20180107614A1 (en) Computing system with a nonvolatile storage and operating method thereof
JP5640845B2 (en) Storage system, storage control device, and storage control method
US11194486B2 (en) Storage data sanitization
KR102488636B1 (en) Encryption device encrypting data and timestamp, system on chip including the same, and electronic device
TWI633457B (en) Apparatuses and methods for performing secure operations
US10372628B2 (en) Cross-domain security in cryptographically partitioned cloud
US9946740B2 (en) Handling server and client operations uninterruptedly during pack and audit processes
US20120117332A1 (en) Synchronizing commands for preventing data corruption
US20140281588A1 (en) Generating efficient reads for a system having non-volatile memory
US9529805B2 (en) Systems and methods for providing dynamic file system awareness on storage devices
WO2015131446A1 (en) Method and device for secure access control based on on-chip bus protocol
US20150227755A1 (en) Encryption and decryption methods of a mobile storage on a file-by-file basis
CN112988055A (en) Machine including key-value store and method of operating key-value store
US10216562B2 (en) Generating diagnostic data
WO2017202155A1 (en) Method of sharing hardware resource, controller, data storage device, and system
US20210182375A1 (en) Device Manager Providing Resource Control and Synchronization
KR20200117405A (en) Distributed sysetm for managing distributed lock and operating method thereof
WO2016127807A1 (en) Method for writing multiple copies into storage device, and storage device
KR20220085031A (en) Storage device adapter to accelerate database temporary table processing
US20190042770A1 (en) Systems and methods for attached digital storage devices
WO2014147836A1 (en) Maintenance and replacement method for encryption function in storage system, and storage device
US11709785B2 (en) Just-in-time post-processing computation capabilities for encrypted data
US11249656B2 (en) Performance optimization for active-active locking using sticking affinity for storage objects
Kuhn Current and Future Developments

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17802001

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17802001

Country of ref document: EP

Kind code of ref document: A1