CN118331641A - Instruction storage system, instruction storage method, instruction reading method and electronic device - Google Patents
Instruction storage system, instruction storage method, instruction reading method and electronic device Download PDFInfo
- Publication number
- CN118331641A CN118331641A CN202410748273.8A CN202410748273A CN118331641A CN 118331641 A CN118331641 A CN 118331641A CN 202410748273 A CN202410748273 A CN 202410748273A CN 118331641 A CN118331641 A CN 118331641A
- Authority
- CN
- China
- Prior art keywords
- memory
- bit
- read
- storage
- state information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/3004—Arrangements for executing specific machine instructions to perform operations on memory
- G06F9/30043—LOAD or STORE instructions; Clear instruction
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3003—Monitoring arrangements specially adapted to the computing system or computing system component being monitored
- G06F11/3037—Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a memory, e.g. virtual memory, cache
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Mathematical Physics (AREA)
- Quality & Reliability (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及存储技术领域,特别涉及一种指令存储系统、指令存储方法、指令读取方法及电子设备。The present application relates to the field of storage technology, and in particular to an instruction storage system, an instruction storage method, an instruction reading method and an electronic device.
背景技术Background technique
在存储技术领域,指令读写装置需要对RFIC(Radio Frequency IntegratedCircuit,射频集成电路)接收到的MIPI(Mobile Industry Processor Interface ,移动产业处理器接口)指令进行读写。考虑到不同业务场景下指令读写装置对MIPI指令的读取需求是不同的,在一些业务场景,指令读写装置需要对MIPI指令重复读取多次,在另一些业务场景下,需要对MIPI指令读取一次。In the field of storage technology, the instruction reading and writing device needs to read and write the MIPI (Mobile Industry Processor Interface) instructions received by the RFIC (Radio Frequency Integrated Circuit). Considering that the instruction reading and writing device has different reading requirements for MIPI instructions in different business scenarios, in some business scenarios, the instruction reading and writing device needs to read the MIPI instructions repeatedly for multiple times, and in other business scenarios, the MIPI instructions need to be read once.
为满足不同业务场景下的读取需求,相关技术配置了两个存储器,一个为FIFO(First Input First Output,先进先出)存储器,另一个为RAM(Random Access Memory,随机存取存储器),两个存储器的地址彼此独立。对于需要读取多次的MIPI指令,可将其存储到RAM中,对于需要读取一次的MIPI指令,可将其存储到FIFO存储器中,从而可在不同业务场景下从不同的存储器中读取所需的MIPI指令。To meet the reading requirements in different business scenarios, the relevant technology configures two memories, one is a FIFO (First Input First Output) memory, and the other is a RAM (Random Access Memory). The addresses of the two memories are independent of each other. For MIPI instructions that need to be read multiple times, they can be stored in RAM, and for MIPI instructions that need to be read once, they can be stored in FIFO memory, so that the required MIPI instructions can be read from different memories in different business scenarios.
然而,由于需要部署两个存储器,导致电子设备的存储芯片面积较大,而存储芯片面积越大,电子设备的成本越高,性能越差。However, since two memories need to be deployed, the memory chip area of the electronic device is larger, and the larger the memory chip area, the higher the cost of the electronic device and the worse the performance.
发明内容Summary of the invention
本申请实施例提供了一种指令存储系统、指令存储方法、指令读取方法及电子设备,能够减少电子设备的存储芯片的面积,从而降低电子设备的成本,提升电子设备的性能。所述技术方案如下:The embodiments of the present application provide an instruction storage system, an instruction storage method, an instruction reading method and an electronic device, which can reduce the area of the storage chip of the electronic device, thereby reducing the cost of the electronic device and improving the performance of the electronic device. The technical solution is as follows:
第一方面,提供了一种指令存储系统,所述系统包括处理器、存储装置及指令读写装置,所述存储装置支持至少两种存储模式,所述至少两种存储模式包括第一存储模式和第二存储模式,所述第一存储模式对应读取多次的指令,所述第二存储模式对应读取一次的指令,所述存储装置包括存储器;In a first aspect, an instruction storage system is provided, the system comprising a processor, a storage device and an instruction reading and writing device, the storage device supporting at least two storage modes, the at least two storage modes comprising a first storage mode and a second storage mode, the first storage mode corresponding to instructions read multiple times, the second storage mode corresponding to instructions read once, the storage device comprising a memory;
所述处理器,用于配置所述存储装置当前所支持的目标存储模式;The processor is used to configure a target storage mode currently supported by the storage device;
所述存储器,用于存储所述目标存储模式对应的指令;The memory is used to store instructions corresponding to the target storage mode;
所述指令读写装置,用于对所述存储器中的指令进行读写。The instruction reading and writing device is used to read and write instructions in the memory.
在第一方面的第一种可能的实现方式中,所述存储装置还包括:多路选择器;In a first possible implementation manner of the first aspect, the storage device further includes: a multiplexer;
所述多路选择器,用于获取所述存储器在所述目标存储模式下的状态信息,基于所述状态信息,生成通知消息,并将所述通知消息发送给所述指令读写装置;The multiplexer is used to obtain the state information of the memory in the target storage mode, generate a notification message based on the state information, and send the notification message to the instruction reading and writing device;
所述指令读写装置,还用于在接收到所述通知消息后,执行相应的控制操作。The instruction reading and writing device is also used to execute corresponding control operations after receiving the notification message.
在第一方面的第二种可能的实现方式中,所述多路选择器,具体用于获取所述存储器在所述目标存储模式下的第一状态信息,基于所述第一状态信息,生成第一通知消息,并将所述第一通知消息发送给所述指令读写装置,所述第一状态信息用于指示所述存储器在所述目标存储模式下的存储空间已满;In a second possible implementation manner of the first aspect, the multiplexer is specifically used to obtain first status information of the memory in the target storage mode, generate a first notification message based on the first status information, and send the first notification message to the instruction reading and writing device, wherein the first status information is used to indicate that the storage space of the memory in the target storage mode is full;
所述指令读写装置,具体用于在接收到所述存储装置上报的所述第一通知消息和关闭写使能信号之间不存在写延迟的情况下,当接收到所述第一通知消息后,停止向所述存储器中写入指令。The instruction reading and writing device is specifically used to stop writing instructions to the memory after receiving the first notification message reported by the storage device, when there is no write delay between receiving the first notification message reported by the storage device and turning off the write enable signal.
在第一方面的第三种可能的实现方式中,所述多路选择器,具体用于获取所述存储器在所述目标存储模式下的第二状态信息,基于所述第二状态信息,生成第二通知消息,并将所述第二通知消息发送给所述指令读写装置,所述第二状态信息用于指示所述存储器在所述目标存储模式下的存储空间将满;In a third possible implementation manner of the first aspect, the multiplexer is specifically used to obtain second state information of the memory in the target storage mode, generate a second notification message based on the second state information, and send the second notification message to the instruction reading and writing device, wherein the second state information is used to indicate that the storage space of the memory in the target storage mode is about to be full;
所述指令读写装置,具体用于在接收到所述存储装置上报的所述第二通知消息和关闭写使能信号之间存在写延迟的情况下,当接收到所述第二通知消息后,停止向所述存储器中写入指令。The instruction reading and writing device is specifically used to stop writing instructions to the memory after receiving the second notification message reported by the storage device when there is a write delay between receiving the second notification message reported by the storage device and turning off the write enable signal.
在第一方面的第四种可能的实现方式中,所述多路选择器,具体用于获取所述存储器在所述目标存储模式下的第三状态信息,基于所述第三状态信息,生成第三通知消息,并将所述第三通知消息发送给所述指令读写装置,所述第三状态信息用于指示所述存储器在所述目标存储模式下存储的指令已读完;In a fourth possible implementation manner of the first aspect, the multiplexer is specifically used to obtain third state information of the memory in the target storage mode, generate a third notification message based on the third state information, and send the third notification message to the instruction reading and writing device, wherein the third state information is used to indicate that the instructions stored in the memory in the target storage mode have been read;
所述指令读写装置,具体用于在接收到所述存储装置上报的所述第三通知消息和关闭读使能信号之间不存在读延迟的情况下,当接收到所述第三通知消息后,停止读取所述存储器中的指令。The instruction reading and writing device is specifically used to stop reading instructions in the memory after receiving the third notification message reported by the storage device and when there is no read delay between receiving the third notification message reported by the storage device and turning off the read enable signal.
在第一方面的第五种可能的实现方式中,所述多路选择器,具体用于获取所述存储器在所述目标存储模式下的第四状态信息,基于所述第四状态信息,生成第四通知消息,并将所述第四通知消息发送给所述指令读写装置,所述第四状态信息用于指示所述存储器在所述目标存储模式下存储的指令将读完;In a fifth possible implementation manner of the first aspect, the multiplexer is specifically used to obtain fourth state information of the memory in the target storage mode, generate a fourth notification message based on the fourth state information, and send the fourth notification message to the instruction reading and writing device, wherein the fourth state information is used to indicate that the instructions stored in the memory in the target storage mode will be read completely;
所述指令读写装置,具体用于在接收到所述存储装置上报的所述第四通知消息和关闭读使能信号之间存在读延迟的情况下,当接收到所述第四通知消息后,停止读取所述存储器中的指令。The instruction reading and writing device is specifically used to stop reading instructions in the memory after receiving the fourth notification message reported by the storage device when there is a read delay between receiving the fourth notification message reported by the storage device and turning off the read enable signal.
在第一方面的第六种可能的实现方式中,在所述目标存储模式为所述第一存储模式时,所述存储装置还包括:第一比较器;In a sixth possible implementation manner of the first aspect, when the target storage mode is the first storage mode, the storage device further includes: a first comparator;
所述第一比较器,用于生成所述存储器在所述第一存储模式下的所述状态信息,并将所述状态信息发送所述给所述多路选择器。The first comparator is used to generate the state information of the memory in the first storage mode, and send the state information to the multiplexer.
在第一方面的第七种可能的实现方式中,所述第一比较器,具体用于在所述存储器对应的N位最新写地址与N位最大写地址相同时,生成第一状态信息,并将所述第一状态信息发送给所述多路选择器,所述第一状态信息用于指示所述存储器在所述第一存储模式下的存储空间已满,所述N位最大写地址对应的十进制数值等于所述存储器的队列深度减去1,所述N为正整数;In a seventh possible implementation manner of the first aspect, the first comparator is specifically used to generate first status information when the N-bit latest write address corresponding to the memory is the same as the N-bit maximum write address, and send the first status information to the multiplexer, wherein the first status information is used to indicate that the storage space of the memory in the first storage mode is full, the decimal value corresponding to the N-bit maximum write address is equal to the queue depth of the memory minus 1, and N is a positive integer;
所述第一比较器,具体用于在所述N位最大写地址对应的十进制数值与所述N位最新写地址对应的十进制数值之间的差值小于等于第一数值时,生成第二状态信息,并将所述第二状态信息发送给所述多路选择器,所述第二状态信息用于指示所述存储器在所述第一存储模式下的存储空间将满;The first comparator is specifically configured to generate second status information when the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the N-bit latest write address is less than or equal to the first value, and send the second status information to the multiplexer, wherein the second status information is used to indicate that the storage space of the memory in the first storage mode is about to be full;
所述第一比较器,具体用于在所述存储器对应的N位最新读地址与所述N位最大写地址相同时,生成所述第三状态信息,并将第三状态信息发送给所述多路选择器,所述第三状态信息用于指示所述存储器在所述第一存储模式下存储的指令已读完;The first comparator is specifically used to generate the third state information when the N-bit latest read address corresponding to the memory is the same as the N-bit maximum write address, and send the third state information to the multiplexer, wherein the third state information is used to indicate that the instructions stored in the memory in the first storage mode have been read;
所述第一比较器,具体用于在所述N位最大写地址对应的十进制数值和所述N位最新读地址对应的十进制数值之间的差值小于等于第二数值时,生成第四状态信息,并将所述第四状态信息发送给所述多路选择器,所述第四状态信息用于指示所述存储器在所述第一存储模式下存储的指令将读完。The first comparator is specifically used to generate fourth state information and send the fourth state information to the multiplexer when the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the N-bit latest read address is less than or equal to the second value. The fourth state information is used to indicate that the instructions stored in the memory in the first storage mode will be read.
在第一方面的第八种可能的实现方式中,所述存储装置还包括:位选择器;In an eighth possible implementation manner of the first aspect, the storage device further includes: a bit selector;
所述位选择器,用于获取所述存储器对应的N+1位最新读地址和N+1位最新写地址,将所述N+1位最新读地址的低N位作为所述N位最新读地址,并将所述N+1位最新写地址的低N位作为所述N位最新写地址;The bit selector is used to obtain the N+1-bit latest read address and the N+1-bit latest write address corresponding to the memory, and use the lower N bits of the N+1-bit latest read address as the N-bit latest read address, and use the lower N bits of the N+1-bit latest write address as the N-bit latest write address;
所述位选择器还用于将所述N位最新读地址和所述N位最新写地址发送给所述第一比较器。The bit selector is further configured to send the N-bit latest read address and the N-bit latest write address to the first comparator.
在第一方面的第九种可能的实现方式中,在所述目标存储模式为所述第二存储模式时,所述存储装置还包括:第二比较器;In a ninth possible implementation manner of the first aspect, when the target storage mode is the second storage mode, the storage device further includes: a second comparator;
所述第二比较器,用于在所述目标存储模式为所述第二存储模式时,生成所述存储器在所述第二存储模式下的所述状态信息,并将所述状态信息发送所述给所述多路选择器。The second comparator is used to generate the state information of the memory in the second storage mode when the target storage mode is the second storage mode, and send the state information to the multiplexer.
在第一方面的第十种可能的实现方式中,所述第二比较器,具体用于在所述存储器对应的N+1位最新写地址和N+1位最新读地址的最高位上的数值不同,且除最高位以外的其他位上的数值相同时,生成第一状态信息,并将所述第一状态信息发送给所述多路选择器,所述第一状态信息用于指示所述存储器在所述第二存储模式下的存储空间已满,所述N为正整数;In a tenth possible implementation manner of the first aspect, the second comparator is specifically configured to generate first status information and send the first status information to the multiplexer when the values of the highest bits of the N+1-bit latest write address and the N+1-bit latest read address corresponding to the memory are different and the values of the other bits except the highest bit are the same, wherein the first status information is used to indicate that the storage space of the memory in the second storage mode is full, and N is a positive integer;
所述第二比较器,具体用于在所述N+1位最新写地址对应的十进制数值和所述N+1位最新读地址对应的十进制数值之间的差值大于等于第三数值时,生成第二状态信息,并将所述第二状态信息发送给所述多路选择器,所述第二状态信息用于指示所述存储器在所述第二存储模式下的存储空间将满;The second comparator is specifically configured to generate second status information when the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address is greater than or equal to a third value, and send the second status information to the multiplexer, wherein the second status information is used to indicate that the storage space of the memory in the second storage mode is about to be full;
所述第二比较器,具体用于在所述N+1位最新读地址和所述N+1位最新写地址相同时,生成第三状态信息,并将所述第三状态信息发送给所述多路选择器,所述第三状态信息用于指示所述存储器在所述第二存储模式下存储的指令已读完;The second comparator is specifically used to generate third state information when the N+1-bit latest read address and the N+1-bit latest write address are the same, and send the third state information to the multiplexer, wherein the third state information is used to indicate that the instructions stored in the memory in the second storage mode have been read;
所述第二比较器,具体用于在所述N+1位最新写地址对应的十进制数值和所述N+1位最新读地址对应的十进制数值之间的差值小于等于第四数值时,生成第四状态信息,并将所述第四状态信息发送给所述多路选择器,所述第四状态信息用于指示所述存储器在所述第二存储模式下存储的指令将读完。The second comparator is specifically used to generate fourth state information and send the fourth state information to the multiplexer when the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address is less than or equal to a fourth value. The fourth state information is used to indicate that the instructions stored in the memory in the second storage mode will be read.
第二方面,提供了一种指令存储方法,所述方法应用于第一方面所述的指令存储系统,所述方法包括:In a second aspect, an instruction storage method is provided, the method being applied to the instruction storage system according to the first aspect, the method comprising:
在所述存储装置处于目标存储模式下,响应于指令写入请求,所述指令读写装置向所述存储器中写入指令;When the storage device is in a target storage mode, in response to an instruction write request, the instruction reading and writing device writes instructions into the memory;
在接收到所述存储装置上报的所述第一通知消息和关闭写使能信号之间不存在写延迟的情况下,当接收到第一通知消息后,所述指令读写装置停止向所述存储器中写入指令,所述第一通知消息用于通知所述指令读写装置所述存储器在所述目标存储模式下的存储空间已满;In the case where there is no write delay between receiving the first notification message reported by the storage device and turning off the write enable signal, the instruction reading and writing device stops writing instructions to the memory after receiving the first notification message, and the first notification message is used to notify the instruction reading and writing device that the storage space of the memory in the target storage mode is full;
在接收到所述存储装置上报的所述第二通知消息和关闭写使能信号之间存在写延迟的情况下,当接收到第二通知消息后,所述指令读写装置停止向所述存储器中写入指令,所述第二通知消息用于通知所述指令读写装置所述存储器在所述目标存储模式下的存储空间将满。In the case that there is a write delay between receiving the second notification message reported by the storage device and turning off the write enable signal, the instruction read and write device stops writing instructions to the memory after receiving the second notification message, and the second notification message is used to notify the instruction read and write device that the storage space of the memory in the target storage mode is about to be full.
在第二方面的第一种可能的实现方式中,所述在接收到所述存储装置上报的所述第一通知消息和关闭写使能信号之间不存在写延迟的情况下,当接收到第一通知消息后,所述指令读写装置停止向所述存储器中写入指令之前,还包括:In a first possible implementation manner of the second aspect, when there is no write delay between receiving the first notification message reported by the storage device and turning off the write enable signal, after receiving the first notification message, before the instruction reading and writing device stops writing instructions to the memory, it also includes:
所述多路选择器获取第一状态信息,基于所述第一状态信息,生成所述第一通知消息,并将所述第一通知消息发送给所述指令读写装置,所述第一状态信息用于指示所述存储器在所述目标存储模式下的存储空间已满。The multiplexer obtains first status information, generates the first notification message based on the first status information, and sends the first notification message to the instruction reading and writing device, wherein the first status information is used to indicate that the storage space of the memory in the target storage mode is full.
在第二方面的第二种可能的实现方式中,所述多路选择器获取第一状态信息,包括:In a second possible implementation manner of the second aspect, the multiplexer acquires the first state information, including:
当所述目标存储模式为所述第一存储模式,所述第一比较器在所述N位最新写地址与所述N位最大写地址相同时,生成所述第一状态信息,并将所述第一状态信息发送给所述多路选择器;When the target storage mode is the first storage mode, the first comparator generates the first state information when the N-bit latest write address is the same as the N-bit maximum write address, and sends the first state information to the multiplexer;
当所述目标存储模式为所述第二存储模式,所述第二比较器在所述N+1位最新写地址和N+1位最新读地址的最高位上的数值不同,且除最高位以外的其他位上的数值相同时,生成所述第一状态信息,并将所述第一状态信息发送给所述多路选择器。When the target storage mode is the second storage mode, the second comparator generates the first state information and sends the first state information to the multiplexer when the values of the highest bits of the N+1-bit latest write address and the N+1-bit latest read address are different, and the values of the bits other than the highest bit are the same.
在第二方面的第三种可能的实现方式中,所述在接收到所述存储装置上报的所述第二通知消息和关闭写使能信号之间存在写延迟的情况下,当接收到第二通知消息后,所述指令读写装置停止向所述存储器中写入指令之前,还包括:In a third possible implementation manner of the second aspect, in a case where there is a write delay between receiving the second notification message reported by the storage device and turning off the write enable signal, after receiving the second notification message, before the instruction reading and writing device stops writing instructions to the memory, it also includes:
所述多路选择器获取第二状态信息,基于所述第二状态信息,生成所述第二通知消息,并将所述第二通知消息发送给所述指令读写装置,所述第二状态信息用于指示所述存储器在所述目标存储模式下的存储空间将满。The multiplexer obtains second status information, generates the second notification message based on the second status information, and sends the second notification message to the instruction reading and writing device, wherein the second status information is used to indicate that the storage space of the memory in the target storage mode is about to be full.
在第二方面的第四种可能的实现方式中,所述多路选择器获取第二状态信息,包括:In a fourth possible implementation manner of the second aspect, the multiplexer acquires the second state information, including:
当所述目标存储模式为所述第一存储模式,所述第一比较器在所述N位最大写地址对应的十进制数值与所述N位最新写地址对应的十进制数值之间的差值小于等于第一数值时,生成所述第二状态信息,并将所述第二状态信息发送给所述多路选择器;When the target storage mode is the first storage mode, the first comparator generates the second state information when the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the N-bit latest write address is less than or equal to the first value, and sends the second state information to the multiplexer;
当所述目标存储模式为所述第二存储模式,所述第二比较器在所述N+1位最新写地址对应的十进制数值和所述N+1位最新读地址对应的十进制数值之间的差值大于等于第三数值,生成所述第二状态信息,并将所述第二状态信息发送给所述多路选择器。When the target storage mode is the second storage mode, the second comparator generates the second state information when the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address is greater than or equal to a third value, and sends the second state information to the multiplexer.
第三方面,提供了一种指令读取方法,所述方法应用于第一方面所述的指令存储系统,所述方法包括:In a third aspect, an instruction reading method is provided, the method being applied to the instruction storage system according to the first aspect, the method comprising:
在所述存储装置处于目标存储模式下,响应于指令读取请求,所述指令读写装置从所述存储器中读取指令;When the storage device is in a target storage mode, in response to an instruction read request, the instruction read-write device reads an instruction from the memory;
在接收到所述存储装置上报的所述第三通知消息和关闭读使能信号之间不存在读延迟的情况下,当接收到第三通知消息后,所述指令读写装置停止读取所述存储器中的指令,所述第三通知消息用于通知所述指令读写装置所述存储器在所述目标存储模式下存储的指令已读完;In the case where there is no read delay between receiving the third notification message reported by the storage device and turning off the read enable signal, the instruction reading and writing device stops reading instructions in the memory after receiving the third notification message, and the third notification message is used to notify the instruction reading and writing device that the instructions stored in the memory in the target storage mode have been read;
在接收到所述存储装置上报的所述第四通知消息和关闭读使能信号之间存在读延迟的情况下,当接收到第四通知消息后,所述指令读写装置停止读取所述存储器中的指令,所述第四通知消息用于通知所述指令读写装置所述存储器在所述目标存储模式下存储的指令将读完。In the case where there is a read delay between receiving the fourth notification message reported by the storage device and turning off the read enable signal, the instruction read-write device stops reading the instructions in the memory after receiving the fourth notification message, and the fourth notification message is used to notify the instruction read-write device that the instructions stored in the memory in the target storage mode will be read.
在第三方面的第一种可能的实现方式中,所述在接收到所述存储装置上报的所述第三通知消息和关闭读使能信号之间不存在读延迟的情况下,当接收到第三通知消息后,所述指令读写装置停止读取所述存储器中的指令之前,还包括:In a first possible implementation manner of the third aspect, when there is no read delay between receiving the third notification message reported by the storage device and turning off the read enable signal, after receiving the third notification message, before the instruction reading and writing device stops reading the instruction in the memory, it also includes:
所述多路选择器获取第三状态信息,基于所述第三状态信息,生成所述第三通知消息,并将所述第三通知消息发送给所述指令读写装置,所述第三状态信息用于指示所述存储器在所述目标存储模式下存储的指令已读完。The multiplexer obtains third status information, generates the third notification message based on the third status information, and sends the third notification message to the instruction reading and writing device, wherein the third status information is used to indicate that the instructions stored in the memory in the target storage mode have been read.
在第三方面的第二种可能的实现方式中,所述多路选择器获取第三状态信息,包括:In a second possible implementation manner of the third aspect, the multiplexer acquires the third state information, including:
当所述目标存储模式为所述第一存储模式,所述第一比较器在所述N位最新读地址与所述N位最大写地址相同时,生成所述第三状态信息,并将所述第三状态信息发送给所述多路选择器;When the target storage mode is the first storage mode, the first comparator generates the third state information when the N-bit latest read address is the same as the N-bit maximum write address, and sends the third state information to the multiplexer;
当所述目标存储模式为所述第二存储模式,所述第二比较器在所述N+1位最新读地址和所述N+1位最新写地址相同时,生成所述第三状态信息,并将所述第三状态信息发送给所述多路选择器。When the target storage mode is the second storage mode, the second comparator generates the third state information when the N+1-bit latest read address and the N+1-bit latest write address are the same, and sends the third state information to the multiplexer.
在第三方面的第三种可能的实现方式中,所述在接收到所述存储装置上报的所述第四通知消息和关闭读使能信号之间存在读延迟的情况下,当接收到第四通知消息后,所述指令读写装置停止读取所述存储器中的指令,还包括:In a third possible implementation manner of the third aspect, in a case where there is a read delay between receiving the fourth notification message reported by the storage device and turning off the read enable signal, after receiving the fourth notification message, the instruction reading and writing device stops reading instructions in the memory, further comprising:
所述多路选择器获取第四状态信息,基于所述第四状态信息,生成所述第四通知消息,并将所述第四通知消息发送给所述指令读写装置,所述第四状态信息用于指示所述存储器在所述目标存储模式下存储的指令将读完。The multiplexer obtains fourth status information, generates the fourth notification message based on the fourth status information, and sends the fourth notification message to the instruction reading and writing device, wherein the fourth status information is used to indicate that the instructions stored in the memory in the target storage mode will be read out.
在第三方面的第四种可能的实现方式中,所述多路选择器获取所述第四状态信息,包括:In a fourth possible implementation manner of the third aspect, the multiplexer acquires the fourth state information, including:
当所述目标存储模式为所述第一存储模式,所述第一比较器在所述N位最大写地址对应的十进制数值和所述最新读地址对应的十进制数值之间的差值小于等于第二数值时,生成所述第四状态信息,并将所述第四状态信息发送给所述多路选择器;When the target storage mode is the first storage mode, the first comparator generates the fourth state information when the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the latest read address is less than or equal to the second value, and sends the fourth state information to the multiplexer;
当所述目标存储模式为所述第二存储模式,所述第二比较器在所述N+1位最新写地址对应的十进制数值和所述N+1位最新读地址对应的十进制数值之间的差值小于等于第四数值时,生成所述第四状态信息,并将所述第四状态信息发送给所述多路选择器。When the target storage mode is the second storage mode, the second comparator generates the fourth state information and sends the fourth state information to the multiplexer when the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address is less than or equal to the fourth value.
第四方面,提供了一种电子设备,所述电子设备包括第一方面所述的指令存储系统。According to a fourth aspect, an electronic device is provided, wherein the electronic device comprises the instruction storage system according to the first aspect.
第五方面,提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条计算机程序,所述至少一条计算机程序被处理器执行时能够实现第二方面所述的指令存储方法,或第三方面所述的指令读取方法。In a fifth aspect, a computer-readable storage medium is provided, in which at least one computer program is stored. When the at least one computer program is executed by a processor, it can implement the instruction storage method described in the second aspect or the instruction reading method described in the third aspect.
第六方面,提供了一种计算机程序产品,所述计算机程序产品包括计算机程序,所述计算机程序被处理器执行时能够实现第二方面所述的指令存储方法,或第三方面所述的指令读取方法。In a sixth aspect, a computer program product is provided, the computer program product comprising a computer program, and when the computer program is executed by a processor, it can implement the instruction storage method described in the second aspect, or the instruction reading method described in the third aspect.
本申请实施例提供的技术方案带来的有益效果是:The beneficial effects of the technical solution provided by the embodiment of the present application are:
本申请实施例提供的指令存储系统包括存储装置,该存储装置支持至少两种存储模式,该至少两种存储模式包括第一存储模式和第二存储模式,当存储装置处于第一存储模式,存储装置包括的存储器可以存储需要读取多次的指令,当存储装置处于第二存储模式,存储装置包括的存储器可以存储需要读取一次的指令。由于无需部署两个存储器,通过部署一个存储装置即可实现对不同业务场景下的指令的存储,减少了存储器的数量,相应地电子设备内部存储芯片的面积也会减少,随着存储芯片面积的减小,电子设备成本减少,性能提升。The instruction storage system provided in the embodiment of the present application includes a storage device, which supports at least two storage modes, and the at least two storage modes include a first storage mode and a second storage mode. When the storage device is in the first storage mode, the memory included in the storage device can store instructions that need to be read multiple times, and when the storage device is in the second storage mode, the memory included in the storage device can store instructions that need to be read once. Since there is no need to deploy two memories, the storage of instructions in different business scenarios can be achieved by deploying one storage device, which reduces the number of memories, and accordingly the area of the internal storage chip of the electronic device will also be reduced. As the area of the storage chip is reduced, the cost of the electronic device is reduced and the performance is improved.
此外,本申请实施例提供的存储装置能够监测存储器的读写状态,在指令写入场景下,当监测到存储器的存储空间已满,存储装置向指令读写装置上报第一通知消息,指令读写装置在接收到存储装置上报的第一通知消息和关闭写使能信号之间不存在写延迟的情况下,停止向存储器中写入指令;当监测到存储器的存储空间将满,存储装置向指令读写装置上报第二通知消息,指令读写装置在接收到存储装置上报的第二通知消息和关闭写使能信号之间存在写延迟的情况下,停止向存储器中写入指令。在指令读取场景下,当监测到存储器中存储的指令已读完,存储装置向指令读写装置上报第三通知消息,指令读写装置在接收到存储装置上报的第三通知消息和关闭写使能信号之间不存在读延迟的情况下,停止读取存储器中的指令;当监测到存储器中存储的指令将读完,存储装置向指令读写装置上报第四通知消息,指令读写装置在接收到存储装置上报的第四通知消息和关闭写使能信号之间存在读延迟的情况下,停止读取存储器中的指令。通过监测存储器的读写状态,提升了电子设备的性能。In addition, the storage device provided in the embodiment of the present application is capable of monitoring the read and write status of the memory. In the instruction writing scenario, when it is monitored that the storage space of the memory is full, the storage device reports a first notification message to the instruction read and write device, and the instruction read and write device stops writing instructions to the memory when there is no write delay between receiving the first notification message reported by the storage device and turning off the write enable signal; when it is monitored that the storage space of the memory is about to be full, the storage device reports a second notification message to the instruction read and write device, and the instruction read and write device stops writing instructions to the memory when there is a write delay between receiving the second notification message reported by the storage device and turning off the write enable signal. In the instruction reading scenario, when it is detected that the instructions stored in the memory have been read, the storage device reports a third notification message to the instruction reading and writing device, and the instruction reading and writing device stops reading the instructions in the memory when there is no read delay between receiving the third notification message reported by the storage device and closing the write enable signal; when it is detected that the instructions stored in the memory are about to be read, the storage device reports a fourth notification message to the instruction reading and writing device, and the instruction reading and writing device stops reading the instructions in the memory when there is a read delay between receiving the fourth notification message reported by the storage device and closing the write enable signal. By monitoring the read and write status of the memory, the performance of the electronic device is improved.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
图1是相关技术提供的指令系统的设计架构图;FIG1 is a design architecture diagram of an instruction system provided by related technology;
图2是本申请实施例提供的一种指令存储系统的设计架构图;FIG2 is a design architecture diagram of an instruction storage system provided in an embodiment of the present application;
图3是本申请实施例提供的一种指令存储系统的结构示意图;FIG3 is a schematic diagram of the structure of an instruction storage system provided in an embodiment of the present application;
图4是本申请实施例提供的另一种指令存储系统的结构示意图;FIG4 is a schematic diagram of the structure of another instruction storage system provided in an embodiment of the present application;
图5是本申请实施例提供的第一存储模式下读写过程的示意图;5 is a schematic diagram of a reading and writing process in a first storage mode provided in an embodiment of the present application;
图6是本申请实施例提供的第二存储模式下读写过程的示意图;6 is a schematic diagram of a reading and writing process in a second storage mode provided in an embodiment of the present application;
图7是本申请实施例提供的另一种指令存储系统的结构示意图;FIG7 is a schematic diagram of the structure of another instruction storage system provided in an embodiment of the present application;
图8是本申请实施例提供的另一种指令存储系统的结构示意图;FIG8 is a schematic diagram of the structure of another instruction storage system provided in an embodiment of the present application;
图9是本申请实施例提供的另一种指令存储系统的结构示意图;FIG9 is a schematic diagram of the structure of another instruction storage system provided in an embodiment of the present application;
图10是本申请实施例提供的不同存储模式下存储器的空满状态判断逻辑过程的示意图;10 is a schematic diagram of a logic process for determining the empty or full state of a memory in different storage modes provided by an embodiment of the present application;
图11是本申请实施例提供的一种指令存储方法的流程图;FIG11 is a flow chart of an instruction storage method provided in an embodiment of the present application;
图12是本申请实施例提供的一种指令读取方法的流程图;FIG12 is a flow chart of an instruction reading method provided in an embodiment of the present application;
图13是本申请实施例提供的基于指令存储系统进行指令读写的整体流程图;13 is an overall flow chart of instruction reading and writing based on an instruction storage system provided in an embodiment of the present application;
图14是本申请实施例提供的电子设备的结构示意图。FIG. 14 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application more clear, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
可以理解,本申请实施例所使用的术语“每个”、“多个”及“任一”等,多个包括两个或两个以上,每个是指对应的多个中的每一个,任一是指对应的多个中的任意一个。举例来说,多个词语包括10个词语,而每个词语是指这10个词语中的每一个词语,任一词语是指10个词语中的任意一个词语。It can be understood that the terms "each", "multiple", and "any" used in the embodiments of the present application include two or more, each refers to each of the corresponding multiple, and any refers to any one of the corresponding multiple. For example, the multiple words include 10 words, and each word refers to each word of the 10 words, and any word refers to any one of the 10 words.
需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据,并且相关数据的收集、使用和处理需要遵守相关国家和地区的相关法律法规和标准,并提供有相应的操作入口,供用户选择授权或者拒绝。It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
在执行本申请实施例之前,首先对本申请实施例涉及的名词进行解释。Before executing the embodiments of the present application, the terms involved in the embodiments of the present application are first explained.
FIFO即先进先出队列,即先进入的指令先完成并引退。基于FIFO的机制,FIFO存储器可用于存储需要读取一次的指令。FIFO存储器中的指令按照入列时间先后顺序读取,且读取后将被清除。FIFO stands for First In First Out, which means the first instruction to enter is completed and retired first. Based on the FIFO mechanism, the FIFO memory can be used to store instructions that need to be read once. The instructions in the FIFO memory are read in the order of their entry time and are cleared after reading.
RAM可用于存储需要读取多次的指令。RAM中的指令可以按照入列时间先后顺序读取,也可以随机读取,且读取后不会被清除。RAM can be used to store instructions that need to be read multiple times. Instructions in RAM can be read in the order of their entry time or randomly, and they will not be cleared after reading.
定序器(Sequencer)为数字电路和计算机体系结构中是一个重要组件,负责协调和控制各个功能单元的操作顺序,确保数据在正确的时间被传输和处理 。The sequencer is an important component in digital circuits and computer architecture, responsible for coordinating and controlling the operation sequence of each functional unit to ensure that data is transmitted and processed at the correct time.
CMD为Windows 命令提示符,是 Windows 系统的一种命令行操作工具,用户可以通过输入命令来完成各种各样的系统或程序操作。CMD is the Windows command prompt, a command line operation tool of the Windows system. Users can complete various system or program operations by entering commands.
MCU(Microcontroller Unit,微控制单元)又叫单片机,是将CPU(CentralProcess Unit,中央处理器)的主频与规格做适当缩减,并将存储器、定时器、A/D转换、时钟、I/O端口及串行通讯等多种功能模块和接口集成在单个芯片上,实现电子设备控制的功能,具有性能高、功耗低、可编程、灵活度高等优点。MCU (Microcontroller Unit), also known as single-chip microcomputer, appropriately reduces the main frequency and specifications of CPU (Central Process Unit), and integrates multiple functional modules and interfaces such as memory, timer, A/D conversion, clock, I/O port and serial communication on a single chip to realize the function of electronic device control. It has the advantages of high performance, low power consumption, programmability and high flexibility.
MUX(Multiplexer,多路选择器)是一个多输入、单输出的组合逻辑电路,一个n输入的多路选择器即是一个n路的数字开关,可以根据通道选择控制信号的不同,从n个输入中选取一个输出到公共的输出端。MUX (Multiplexer) is a combinational logic circuit with multiple inputs and a single output. An n-input multiplexer is an n-channel digital switch that can select one output from n inputs to a common output terminal according to different channel selection control signals.
在射频通信领域,针对不同的业务场景,RFIC会接收到具有不同读取需求的MIPI指令。为便于对具有不同读取需求的MIPI指令进行管理,相关技术提供了一种指令存储系统,该系统包括两个存储器,一个为具有FIFO功能的Memory(即FIFO存储器),另一个为具有RAM功能的Memory(即RAM存储器)。参见图1,对于RFIC接收到的指令,如果该指令为需要读取一次的指令,可将其存储到FIFO存储器中;如果该指令为需要读取多次的指令,可将其存储到RAM存储器中。当因业务需求需要读取指令时,可从相应的存储器中读取指令,然后将所读取的指令加载到CMD进程中,以实现相应的功能。In the field of radio frequency communication, for different business scenarios, RFIC will receive MIPI instructions with different reading requirements. In order to facilitate the management of MIPI instructions with different reading requirements, the relevant technology provides an instruction storage system, which includes two memories, one is a memory with a FIFO function (i.e., a FIFO memory), and the other is a memory with a RAM function (i.e., a RAM memory). Referring to Figure 1, for the instruction received by the RFIC, if the instruction is an instruction that needs to be read once, it can be stored in the FIFO memory; if the instruction is an instruction that needs to be read multiple times, it can be stored in the RAM memory. When the instruction needs to be read due to business needs, the instruction can be read from the corresponding memory, and then the read instruction can be loaded into the CMD process to implement the corresponding function.
相关技术提供的指令存储系统解决了对不同读取需求的指令的管理问题,但是需要部署两个存储器。由于在电子设备内部部署的存储器越多,电子设备的存储芯片的面积越大,而电子设备的存储芯片面积越大,电子设备的成本越高,功耗越高,性能越差。The instruction storage system provided by the related art solves the problem of managing instructions with different reading requirements, but two memories need to be deployed. The more memories deployed inside the electronic device, the larger the area of the electronic device's memory chip, and the larger the area of the electronic device's memory chip, the higher the cost of the electronic device, the higher the power consumption, and the worse the performance.
本申请实施例设计了一个指令存储系统,该指令存储系统包括存储装置,该存储装置包括一个存储器(Sequencer Memory),该存储器兼具FIFO存储器和RAM存储器的功能,且该存储器具有一套读写地址和一个存储队列。参见图2,对于RFIC接收到的指令,无论该指令是需要读取一次的指令,还是需要读取多次的指令,均可将其存储到该存储器的存储队列中。当因业务需求需要读取指令时,可从该存储器中读取指令,然后将所读取的指令加载到CMD进程中,以实现相应的功能。采用本申请实施例只需要部署一个存储器,即可实现对具有不同读取需求的指令的读写,相比于相关技术,部署的存储器数量要少,减小了电子设备的存储芯片的面积,降低电子设备的成本和功耗,提升电子设备的性能。The embodiment of the present application designs an instruction storage system, which includes a storage device, which includes a memory (Sequencer Memory), which has the functions of a FIFO memory and a RAM memory, and the memory has a set of read and write addresses and a storage queue. Referring to Figure 2, for the instructions received by the RFIC, whether the instructions are instructions that need to be read once or instructions that need to be read multiple times, they can be stored in the storage queue of the memory. When the instructions need to be read due to business needs, the instructions can be read from the memory, and then the read instructions can be loaded into the CMD process to implement the corresponding functions. Using the embodiment of the present application, only one memory needs to be deployed to realize the reading and writing of instructions with different reading requirements. Compared with the related art, the number of deployed memories is less, which reduces the area of the memory chip of the electronic device, reduces the cost and power consumption of the electronic device, and improves the performance of the electronic device.
另外,存储器的存储空间是有限的,为避免存储器的写溢出,同时避免存储器中指令读取异常,需要存储器带有标识位,用于指示存储的空满状态。通常FIFO存储器具有标识位,通过该标识位可以获知FIFO存储器的空满状态,而RAM存储器不具有标识位,无法获知RAM存储器的空满状态。相关技术提供的指令存储系统所包括的RAM存储器因不具有标识位,无法确定出RAM存储器的空满状态,导致系统很难执行读写操作和流量控制。而本申请实施例提供的指令存储系统,无论存储器处于何种存储模式,均能够确定出存储器的空满状态,便于系统执行读写操作和流量控制。In addition, the storage space of the memory is limited. In order to avoid write overflow of the memory and to avoid abnormal instruction reading in the memory, the memory needs to have an identification bit to indicate the empty and full status of the storage. Usually, the FIFO memory has an identification bit, through which the empty and full status of the FIFO memory can be known, while the RAM memory does not have an identification bit, and the empty and full status of the RAM memory cannot be known. The RAM memory included in the instruction storage system provided by the related art does not have an identification bit, so the empty and full status of the RAM memory cannot be determined, which makes it difficult for the system to perform read and write operations and flow control. The instruction storage system provided in the embodiment of the present application can determine the empty and full status of the memory regardless of the storage mode of the memory, which facilitates the system to perform read and write operations and flow control.
参见图3,本申请实施例提供的指令存储系统,该系统包括处理器301、存储装置302及指令读写装置303。3 , an instruction storage system provided in an embodiment of the present application includes a processor 301 , a storage device 302 , and an instruction reading and writing device 303 .
其中,存储装置302支持至少两种存储模式,至少两种存储模式包括第一存储模式和第二存储模式等,第一存储模式对应需要读取多次的指令,第二存储模式对应读取一次的指令。为实现存储功能,存储装置302包括存储器3021。当存储装置302处于第一存储模式,存储器3021具有RAM存储器的功能,能够存储需要读取多次的指令。当存储装置302处于第二存储模式,存储器3021具有FIFO存储器的功能,可以存储需要读取一次的指令。为便于所存储的指令进行管理,存储器3021具有一个存储队列,该存储队列的队列深度可以为64、128等等。为便于对所存储的指令进行读写,存储器3021具有一套读写地址,该套读写地址可以采用N位二进制数表示。其中,N为正整数,可根据存储队列的队列深度确定。例如,存储队列的队列深度为64,N可以为6;存储队列的队列深度为128,N可以为7。存储队列的每一存储位置对应一个写地址和一个读地址,写地址可以表示为seq_waddr[N-1:0],读地址可以表示为seq_raddr[N-1:0]。假设存储器3021的存储队列的队列深度为64,则可以确定N为6,每一存储位置对应的写地址可以表示为seq_waddr[5:0],每一存储位置对应的读地址可以表示为seq_waddr[5:0]。The storage device 302 supports at least two storage modes, including a first storage mode and a second storage mode, etc. The first storage mode corresponds to instructions that need to be read multiple times, and the second storage mode corresponds to instructions that need to be read once. To realize the storage function, the storage device 302 includes a memory 3021. When the storage device 302 is in the first storage mode, the memory 3021 has the function of a RAM memory and can store instructions that need to be read multiple times. When the storage device 302 is in the second storage mode, the memory 3021 has the function of a FIFO memory and can store instructions that need to be read once. To facilitate the management of the stored instructions, the memory 3021 has a storage queue, and the queue depth of the storage queue can be 64, 128, etc. To facilitate the reading and writing of the stored instructions, the memory 3021 has a set of read and write addresses, and the set of read and write addresses can be represented by an N-bit binary number. Among them, N is a positive integer and can be determined according to the queue depth of the storage queue. For example, if the queue depth of the storage queue is 64, N can be 6; if the queue depth of the storage queue is 128, N can be 7. Each storage location of the storage queue corresponds to a write address and a read address, the write address can be expressed as seq_waddr[N-1:0], and the read address can be expressed as seq_raddr[N-1:0]. Assuming that the queue depth of the storage queue of the memory 3021 is 64, it can be determined that N is 6, the write address corresponding to each storage location can be expressed as seq_waddr[5:0], and the read address corresponding to each storage location can be expressed as seq_waddr[5:0].
其中,处理器301可以为MCU等,本申请实施例不对处理器301做具体的限定。处理器301可以配置存储装置302当前支持的目标存储模式。处理器301在配置存储装置302当前支持的目标存储模式时,可以根据当前的业务场景进行配置。例如,在当前的业务场景下需要对存储装置302中的指令读取多次,可配置目标存储模式为第一存储模式;在当前的业务场景下需要存储装置302中的指令读取一次,可配置目标存储模式为第二存储模式。基于处理器301所配置的目标存储模式,存储器3021可以存储目标存储模式对应的指令。Among them, the processor 301 can be an MCU, etc., and the embodiment of the present application does not make specific limitations on the processor 301. The processor 301 can configure the target storage mode currently supported by the storage device 302. When configuring the target storage mode currently supported by the storage device 302, the processor 301 can be configured according to the current business scenario. For example, in the current business scenario, it is necessary to read the instructions in the storage device 302 multiple times, and the target storage mode can be configured as the first storage mode; in the current business scenario, it is necessary to read the instructions in the storage device 302 once, and the target storage mode can be configured as the second storage mode. Based on the target storage mode configured by the processor 301, the memory 3021 can store instructions corresponding to the target storage mode.
其中,指令读写装置303用于对存储器3021中的指令进行读写。具体地,响应于指令写入请求,指令读写装置303可以向存储器3021中写入指令;响应于指令写入请求,指令读写装置303可以从存储器3021中读取指令。存储器3021中存储的指令可以采用M位二进制数表示,其中,M为正整数,M的取值一般大于等于2,可以为64、128等。为了区分向存储器写入的指令以及从存储器3021中读取的指令,可以将向存储器3021中写入的指令表示为Seq_wr_cmd[M-1:0],将从存储器3021中读取的指令表示为Seq_rd_cmd[M-1:0]。当存储器3021中存储的指令采用128位二进制数表示,对于向存储器3021中写入的指令可以表示为Seq_wr_cmd[127:0],从存储器3021中读取的指令可以表示为Seq_ rd _cmd[127:0]。The instruction reading and writing device 303 is used to read and write instructions in the memory 3021. Specifically, in response to an instruction writing request, the instruction reading and writing device 303 can write instructions to the memory 3021; in response to an instruction writing request, the instruction reading and writing device 303 can read instructions from the memory 3021. The instructions stored in the memory 3021 can be represented by an M-bit binary number, where M is a positive integer, and the value of M is generally greater than or equal to 2, and can be 64, 128, etc. In order to distinguish between instructions written to the memory and instructions read from the memory 3021, the instructions written to the memory 3021 can be represented as Seq_wr_cmd[M-1:0], and the instructions read from the memory 3021 can be represented as Seq_rd_cmd[M-1:0]. When the instructions stored in the memory 3021 are represented by 128-bit binary numbers, the instructions written to the memory 3021 can be represented as Seq_wr_cmd[127:0], and the instructions read from the memory 3021 can be represented as Seq_rd_cmd[127:0].
本申请实施例的存储装置302支持至少两种存储模式,通过配置存储装置当前所支持的目标存储模式,可以将需要读取一次的指令和需要读取多次的指令存储到同一存储器中。由于一个存储器能够实现多个存储器的功能,因而可以在电子设备内部部署少量的存储器,从而减少电子设备的存储芯片的面积,降低电子设备的成本及功耗,提升电子设备的性能。The storage device 302 of the embodiment of the present application supports at least two storage modes. By configuring the target storage mode currently supported by the storage device, instructions that need to be read once and instructions that need to be read multiple times can be stored in the same memory. Since one memory can realize the functions of multiple memories, a small amount of memory can be deployed inside the electronic device, thereby reducing the area of the memory chip of the electronic device, reducing the cost and power consumption of the electronic device, and improving the performance of the electronic device.
参见图4,本申请实施例提供的存储装置302还包括:多路选择器3022。该多路选择器3022用于获取存储器在目标存储模式下的状态信息,基于状态信息,生成通知消息,并将该通知消息发送给指令读写装置303。指令读写装置303在接收到通知消息后,可以执行相应的控制操作。该状态信息用于指示存储器在目标存储模式下的空满状态,可以包括第一状态信息、第二状态信息、第三状态信息及第四状态信息等。其中,第一状态信息用于指示存储器的存储空间已满,第二状态信息用于指示存储器的存储空间将满,第三状态信息用于指示存储器中存储的指令已读完,第四状态信息用于指示存储器中存储的指令将读完。相应地,通知消息包括第一通知消息、第二通知消息、第三通知消息及第四通知消息。其中,第一通知消息与第一状态信息对应,用于通知指令读写装置303存储器的存储空间已满;第二通知消息与第二状态信息对应,用于通知指令读写装置303存储器的存储空间将满;第三通知消息与第三状态信息对应,用于通知指令读写装置303存储器所存储的指令已读完;第四通知消息与第四状态信息对应,用于通知指令读写装置303存储器所存储的指令将读完。Referring to FIG. 4 , the storage device 302 provided in the embodiment of the present application further includes: a multiplexer 3022. The multiplexer 3022 is used to obtain the state information of the memory in the target storage mode, generate a notification message based on the state information, and send the notification message to the instruction reading and writing device 303. After receiving the notification message, the instruction reading and writing device 303 can perform corresponding control operations. The state information is used to indicate the empty and full state of the memory in the target storage mode, and may include first state information, second state information, third state information, and fourth state information. Among them, the first state information is used to indicate that the storage space of the memory is full, the second state information is used to indicate that the storage space of the memory is about to be full, the third state information is used to indicate that the instructions stored in the memory have been read, and the fourth state information is used to indicate that the instructions stored in the memory will be read. Accordingly, the notification message includes a first notification message, a second notification message, a third notification message, and a fourth notification message. Among them, the first notification message corresponds to the first status information, and is used to notify that the storage space of the instruction read and write device 303 memory is full; the second notification message corresponds to the second status information, and is used to notify that the storage space of the instruction read and write device 303 memory is about to be full; the third notification message corresponds to the third status information, and is used to notify that the instructions stored in the instruction read and write device 303 memory have been read; the fourth notification message corresponds to the fourth status information, and is used to notify that the instructions stored in the instruction read and write device 303 memory are about to be read.
通常来说,在指令写入场景下指令读写装置会生成写使能信号,响应于写使能信号,可以向存储器中写入指令,当写使能信号关闭后,不再向存储器中写入指令;在指令读取场景下指令读写装置会生成读使能信号,响应于读使能信号,可以从存储器中读取指令,当写使能信号关闭后,不再从存储器中读取指令。根据存储器的不同状态信息以及指令读写装置上报的通知消息和指令读写装置关闭使能信号之间是否存在延迟,可以分为如下几种情况:Generally speaking, in the instruction writing scenario, the instruction reading and writing device will generate a write enable signal. In response to the write enable signal, instructions can be written to the memory. When the write enable signal is turned off, instructions are no longer written to the memory. In the instruction reading scenario, the instruction reading and writing device will generate a read enable signal. In response to the read enable signal, instructions can be read from the memory. When the write enable signal is turned off, instructions are no longer read from the memory. According to the different status information of the memory and whether there is a delay between the notification message reported by the instruction reading and writing device and the instruction reading and writing device turning off the enable signal, it can be divided into the following situations:
第一种情况,多路选择器3022获取存储器3021在目标存储模式下的第一状态信息,基于第一状态信息,生成第一通知消息,进而将第一通知消息发送给指令读写装置303。指令控制装置303在接收到存储装置上报的第一通知消息和关闭写使能信号之间不存在写延迟的情况下,当接收到第一通知消息后,停止向存储器中写入指令,以避免写溢出。In the first case, the multiplexer 3022 obtains the first state information of the memory 3021 in the target storage mode, generates a first notification message based on the first state information, and then sends the first notification message to the instruction reading and writing device 303. When there is no write delay between receiving the first notification message reported by the storage device and turning off the write enable signal, the instruction control device 303 stops writing instructions to the memory after receiving the first notification message to avoid write overflow.
第二种情况,多路选择器3022获取存储器3021在目标存储模式下的第二状态信息,基于第二状态信息,生成第二通知消息,进而将第二通知消息发送给指令读写装置303。指令读写装置303在接收到存储装置上报的第二通知消息和关闭写使能信号之间存在写延迟的情况下,当接收到第二通知消息后,停止向存储器中写入指令,从而避免存储器3021中指令写溢出。In the second case, the multiplexer 3022 obtains the second state information of the memory 3021 in the target storage mode, generates a second notification message based on the second state information, and then sends the second notification message to the instruction reading and writing device 303. When there is a write delay between receiving the second notification message reported by the storage device and turning off the write enable signal, the instruction reading and writing device 303 stops writing instructions to the memory after receiving the second notification message, thereby avoiding instruction write overflow in the memory 3021.
第三种情况,多路选择器3022获取存储器3021在目标存储模式下的第三状态信息,基于第三状态信息,生成第三通知消息,进而将第三通知消息发送给指令读写装置303。指令读写装置303在接收到存储装置上报的第三通知消息和关闭读使能信号之间不存在读延迟的情况下,当接收到第三通知消息后,停止读取存储器中的指令,从而避免指令读取异常。In the third case, the multiplexer 3022 obtains the third state information of the memory 3021 in the target storage mode, generates a third notification message based on the third state information, and then sends the third notification message to the instruction reading and writing device 303. When there is no read delay between receiving the third notification message reported by the storage device and turning off the read enable signal, the instruction reading and writing device 303 stops reading the instructions in the memory after receiving the third notification message, thereby avoiding abnormal instruction reading.
第四种情况,多路选择器3022获取存储器3021在目标存储模式下的第四状态信息,基于第四状态信息,生成第四通知消息,进而将第四通知消息发送给指令读写装置303。指令读写装置303在接收到存储装置上报的第四通知消息和关闭读使能信号之间存在读延迟的情况下,当接收到第四通知消息后,停止读取存储器中的指令,从而不仅能够保证存储器3021中指令全部读出,而且能够避免指令读取错误。In the fourth case, the multiplexer 3022 obtains the fourth state information of the memory 3021 in the target storage mode, generates a fourth notification message based on the fourth state information, and then sends the fourth notification message to the instruction reading and writing device 303. When there is a read delay between receiving the fourth notification message reported by the storage device and turning off the read enable signal, the instruction reading and writing device 303 stops reading the instructions in the memory after receiving the fourth notification message, thereby not only ensuring that all instructions in the memory 3021 are read out, but also avoiding instruction reading errors.
本申请实施例中,存储装置302支持第一存储模式和第二存储模式,当存储装置302处于不同的存储模式下,指令读写装置303对存储装置302所包括的存储器3021中指令的读写机制是不同的。当存储装置302处于第一存储模式,存储器3021中存储需要读取多次的指令,且所存储的指令读取后不会清除,也即是,存储器3021中所存储的指令的数量是固定的。例如,图5示出了处于第一存储模式下的存储器3021,参见图5,该存储器3021的存储队列的队列深度为64,对应64个存储位置,64个存储位置的编号从0~63,每个存储位置对应一个读地址和写地址,假设读地址和写地址均采用6位二进制数表示,则每个存储位置的写地址可以表示为seq_waddr[5:0],每个存储位置的读地址可以表示为seq_raddr[5:0]。假设读写过程同时进行,响应于第一次的指令写入请求,指令读写装置303从编号2的存储位置开始写入指令,响应于第一次的指令读取请求,指令读写装置303从编号0的存储位置开始读取指令,经过多个时钟周期,指令读写装置303将存储器3021写满,而从存储器3021读取的指令并未清除。In the embodiment of the present application, the storage device 302 supports the first storage mode and the second storage mode. When the storage device 302 is in different storage modes, the instruction reading and writing mechanism of the instruction reading and writing device 303 for the instructions in the memory 3021 included in the storage device 302 is different. When the storage device 302 is in the first storage mode, the memory 3021 stores instructions that need to be read multiple times, and the stored instructions will not be cleared after reading, that is, the number of instructions stored in the memory 3021 is fixed. For example, FIG5 shows the memory 3021 in the first storage mode. Referring to FIG5, the queue depth of the storage queue of the memory 3021 is 64, corresponding to 64 storage locations, and the 64 storage locations are numbered from 0 to 63, and each storage location corresponds to a read address and a write address. Assuming that the read address and the write address are both represented by 6-bit binary numbers, the write address of each storage location can be represented as seq_waddr[5:0], and the read address of each storage location can be represented as seq_raddr[5:0]. Assuming that the reading and writing processes are carried out simultaneously, in response to the first instruction write request, the instruction read and write device 303 starts writing instructions from the storage location numbered 2. In response to the first instruction read request, the instruction read and write device 303 starts reading instructions from the storage location numbered 0. After multiple clock cycles, the instruction read and write device 303 fills the memory 3021, while the instructions read from the memory 3021 are not cleared.
当存储装置302处于第二存储模式,存储器3021中存储需要读取一次的指令,由于所存储的指令读取后将被清除,因而存储器3021所存储的指令的数量并不是固定的。假设存储器3021的读写操作同时进行,且读速度和写速度相同,则存储器3021可以存储无限多的指令。例如,图6示出了处于第二存储模式下的存储器3021,参见图6,存储器3021的存储队列的队列深度为64,对应64个存储位置,64个存储位置的编号从0~63,每个存储位置对应一个读地址和写地址,假设读地址和写地址均采用6位二进制数表示,则每个存储位置的写地址可以表示为seq_waddr[5:0],每个存储位置的读地址可以表示为seq_raddr[5:0]。假设读写过程同时进行,响应于第一次的指令写入请求,指令读写装置303从编号2的存储位置开始写入指令,响应于第一次的指令读取请求,指令读写装置303从编号0的存储位置开始读取指令,经过多个时钟周期,读取的指令被清除,指令读写装置303向编号为63的存储位置写入指令之后,跳转到编号为0的存储位置继续写,相应地,指令读写装置303从编号为63的存储位置上读取指令之后,跳转到编号为0的存储位置继续读取。When the storage device 302 is in the second storage mode, the memory 3021 stores instructions that need to be read once. Since the stored instructions will be cleared after reading, the number of instructions stored in the memory 3021 is not fixed. Assuming that the read and write operations of the memory 3021 are performed simultaneously, and the read speed and the write speed are the same, the memory 3021 can store an unlimited number of instructions. For example, FIG6 shows the memory 3021 in the second storage mode. Referring to FIG6, the queue depth of the storage queue of the memory 3021 is 64, corresponding to 64 storage locations, and the 64 storage locations are numbered from 0 to 63. Each storage location corresponds to a read address and a write address. Assuming that the read address and the write address are both represented by 6-bit binary numbers, the write address of each storage location can be represented as seq_waddr[5:0], and the read address of each storage location can be represented as seq_raddr[5:0]. Assuming that the reading and writing processes are carried out simultaneously, in response to the first instruction write request, the instruction read and write device 303 starts writing instructions from the storage location numbered 2. In response to the first instruction read request, the instruction read and write device 303 starts reading instructions from the storage location numbered 0. After multiple clock cycles, the read instructions are cleared. After the instruction read and write device 303 writes instructions to the storage location numbered 63, it jumps to the storage location numbered 0 to continue writing. Correspondingly, after the instruction read and write device 303 reads instructions from the storage location numbered 63, it jumps to the storage location numbered 0 to continue reading.
通过上述分析可以看出,当存储器3021处于不同的存储模式时,指令读写装置303对存储器3021中指令的读写方式不同,存储器3021的空满状态的判断逻辑也是不同的,相应地,多路选择器3022获取存储器3021的状态信息的方式是不同的。针对不同的存储模式,本申请实施例部署了不同的比较器,进而基于不同的比较器,生成存储器3021在不同存储模式下空满状态的状态信息。Through the above analysis, it can be seen that when the memory 3021 is in different storage modes, the instruction reading and writing device 303 reads and writes instructions in the memory 3021 in different ways, and the judgment logic of the empty and full state of the memory 3021 is also different. Correspondingly, the multiplexer 3022 obtains the state information of the memory 3021 in a different way. For different storage modes, the embodiment of the present application deploys different comparators, and then based on different comparators, generates the state information of the empty and full state of the memory 3021 in different storage modes.
参见图7,在目标存储模式为第一存储模式时,存储装置还包括:第一比较器3023。第一比较器3023用于生成存储器3021在第一存储模式下的状态信息,并将该状态信息发送给多路选择器3022。在本申请实施例中,状态信息包括第一状态信息、第二状态信息、第三状态信息及第四状态信息,不同的状态信息所指示的存储器的空满状态是不同的。针对不同的状态信息,第一比较器3023的判断逻辑是不同的。具体包括以下几种情况:Referring to FIG. 7 , when the target storage mode is the first storage mode, the storage device further includes: a first comparator 3023. The first comparator 3023 is used to generate state information of the memory 3021 in the first storage mode, and send the state information to the multiplexer 3022. In the embodiment of the present application, the state information includes first state information, second state information, third state information and fourth state information, and the empty and full states of the memory indicated by different state information are different. For different state information, the judgment logic of the first comparator 3023 is different. Specifically, the following situations are included:
第一种情况、第一比较器3023获取存储器3021对应的N位最新写地址与N位最大写地址,由于存储器3021在第一存储模式下所存储的指令的数量是固定的,且读取后不会清除,因而该N位最大写地址可以为向存储器3021中写入指令时,存储队列的最后一个存储位置对应的地址,该N位最大写地址对应的十进制数值为存储器3021的队列深度减去1。例如,存储器3021的队列深度为64,则N位最大写地址对应的十进制数值为63,转换为二进制数表示为111111。基于所获取的N位最新写地址与N位最大写地址,第一比较器3023将N位最新写地址与N位最大写地址进行比较,如果存储器3021对应的N位最新写地址与N位最大写地址相同,说明存储器3021的存储队列的最后一个存储位置上已经写入指令,此时第一比较器3023可以确定存储器3021的存储空间已满,进而生成用于指示存储器3021的存储空间已满的第一状态信息,然后将第一状态信息发送给多路选择器3022。例如,存储器3021对应的6位最大写地址为111111,第一比较器3023获取到6位最新写地址为111111,则可以确定存储器3021的存储空间已满,进而生成第一状态信息,然后将所生成的第一状态信息发送给多路选择器3022。In the first case, the first comparator 3023 obtains the N-bit latest write address and the N-bit maximum write address corresponding to the memory 3021. Since the number of instructions stored in the memory 3021 in the first storage mode is fixed and will not be cleared after reading, the N-bit maximum write address can be the address corresponding to the last storage position of the storage queue when writing instructions to the memory 3021. The decimal value corresponding to the N-bit maximum write address is the queue depth of the memory 3021 minus 1. For example, if the queue depth of the memory 3021 is 64, the decimal value corresponding to the N-bit maximum write address is 63, which is converted into a binary number and represented as 111111. Based on the obtained N-bit latest write address and N-bit maximum write address, the first comparator 3023 compares the N-bit latest write address with the N-bit maximum write address. If the N-bit latest write address corresponding to the memory 3021 is the same as the N-bit maximum write address, it means that the instruction has been written to the last storage position of the storage queue of the memory 3021. At this time, the first comparator 3023 can determine that the storage space of the memory 3021 is full, and then generate the first state information indicating that the storage space of the memory 3021 is full, and then send the first state information to the multiplexer 3022. For example, if the 6-bit maximum write address corresponding to the memory 3021 is 111111, and the first comparator 3023 obtains the 6-bit latest write address as 111111, it can be determined that the storage space of the memory 3021 is full, and then generate the first state information, and then send the generated first state information to the multiplexer 3022.
第二种情况、第一比较器3023获取存储器3021对应的N位最新写地址与N位最大写地址,将二进制表示的N位最新写地址转换为对应的十进制数值,并将二进制表示的N位最大写地址转换为对应的二进制数值,然后将N位最大写地址对应的十进制数值与N位最新写地址对应的十进制数值进行比较,由于在第一存储模式下存储器3021所存储的指令的数量是固定的,且读取后不会清除,因而每个写地址对应的二进制数值可以指示出每个存储位置的编号,当N位最大写地址对应的十进制数值与N位最新写地址对应的十进制数值之间的差值小于等于第一数值,说明存储器3021中最新写入指令的存储位置与最后一个存储位置比较接近,第一比较器3023可以确定存储器3021的存储空间将满,进而生成用于指示存储器3021的存储空间将满的第二状态信息,然后将第二状态信息发送给多路选择器3022。其中,第一数值可以为1、2等。例如,第一数值为3,6位最大写地址对应的十进制数值为63,6位最新写地址对应的十进制数值为61,6位最大写地址对应的十进制数值与6位最新写地址对应的十进制数值之间的差值为2,小于第一数值3,第一比较器3023可以确定存储器3021的存储空间将满,进而生成第二状态信息。In the second case, the first comparator 3023 obtains the N-bit latest write address and the N-bit maximum write address corresponding to the memory 3021, converts the binary representation of the N-bit latest write address into the corresponding decimal value, and converts the binary representation of the N-bit maximum write address into the corresponding binary value, and then compares the decimal value corresponding to the N-bit maximum write address with the decimal value corresponding to the N-bit latest write address. Since the number of instructions stored in the memory 3021 in the first storage mode is fixed and will not be cleared after reading, the binary value corresponding to each write address can indicate the number of each storage location. When the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the N-bit latest write address is less than or equal to the first value, it means that the storage location of the latest write instruction in the memory 3021 is close to the last storage location. The first comparator 3023 can determine that the storage space of the memory 3021 is about to be full, and then generate the second state information for indicating that the storage space of the memory 3021 is about to be full, and then send the second state information to the multiplexer 3022. The first value can be 1, 2, etc. For example, the first value is 3, the decimal value corresponding to the 6-bit maximum write address is 63, the decimal value corresponding to the 6-bit latest write address is 61, and the difference between the decimal value corresponding to the 6-bit maximum write address and the decimal value corresponding to the 6-bit latest write address is 2, which is less than the first value 3. The first comparator 3023 can determine that the storage space of the memory 3021 is about to be full, and then generate second status information.
第三种情况、第一比较器3023获取存储器3021对应的N位最新读地址与N位最大写地址,将N位最新读地址与N位最大写地址进行比较,由于在第一存储模式下存储器3021所存储的指令的数量是固定的,且读取后不会清除,当N位最新读地址与N位最大写地址相同时,说明已将存储器3021的存储队列中最后一个存储位置上的指令读完,第一比较器3023可以生成用于指示存储器3021中指令读完的第三状态信息,进而将第三状态信息发送给多路选择器3022。例如,6位最大写地址为111111,6位最新读地址为111111,6位最大写地址与6位最新读地址相同,第一比较器3023可以确定存储器3021中存储的指令已读完,进而生成第三状态信息。In the third case, the first comparator 3023 obtains the N-bit latest read address and the N-bit maximum write address corresponding to the memory 3021, and compares the N-bit latest read address with the N-bit maximum write address. Since the number of instructions stored in the memory 3021 is fixed in the first storage mode and will not be cleared after reading, when the N-bit latest read address is the same as the N-bit maximum write address, it means that the instruction at the last storage position in the storage queue of the memory 3021 has been read, and the first comparator 3023 can generate the third state information indicating that the instruction in the memory 3021 has been read, and then send the third state information to the multiplexer 3022. For example, the 6-bit maximum write address is 111111, the 6-bit latest read address is 111111, the 6-bit maximum write address is the same as the 6-bit latest read address, and the first comparator 3023 can determine that the instruction stored in the memory 3021 has been read, and then generate the third state information.
第四种情况、第一比较器3023获取存储器3021对应的N位最新读地址与N位最大写地址,将二进制表示的N位最新读地址转换为对应的十进制数值,并将二进制表示的N位最大读地址业转换为对应的十进制数值,进而将N位最大写地址对应的十进制数值和最新读地址对应的十进制数值进行比较,由于在第一存储模式下存储器3021所存储的指令的数量是固定的,且读取后不会清除,当N位最大写地址对应的十进制数值和最新读地址对应的十进制数值之间的差值小于等于第二数值,说明最新的读取位置与存储器3021的存储队列中最后一个存储位置比较接近,第一比较器3023可以确定存储器存储的指令将读完,进而生成用于指示存储器3021中指令即将读完的第四状态信息,然后将第四状态信息发送给多路选择器3022。其中,第二数值可以为3、4等。例如,第二数值为3,6位最大写地址对应的十进制数值为63,6位最新读地址对应的十进制数值为61,6位最大写地址对应的十进制数值与6位最新读地址对应的十进制数值之间的差值为2,小于第二数值3,第一比较器3023可以确定存储器3021中存储的指令将读完,进而生成第四状态信息。In the fourth case, the first comparator 3023 obtains the N-bit latest read address and the N-bit maximum write address corresponding to the memory 3021, converts the binary N-bit latest read address into the corresponding decimal value, and converts the binary N-bit maximum read address into the corresponding decimal value, and then compares the decimal value corresponding to the N-bit maximum write address with the decimal value corresponding to the latest read address. Since the number of instructions stored in the memory 3021 is fixed in the first storage mode and will not be cleared after reading, when the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the latest read address is less than or equal to the second value, it means that the latest read position is close to the last storage position in the storage queue of the memory 3021. The first comparator 3023 can determine that the instructions stored in the memory will be read, and then generate the fourth state information for indicating that the instructions in the memory 3021 are about to be read, and then send the fourth state information to the multiplexer 3022. Among them, the second value can be 3, 4, etc. For example, the second value is 3, the decimal value corresponding to the 6-bit maximum write address is 63, the decimal value corresponding to the 6-bit latest read address is 61, and the difference between the decimal value corresponding to the 6-bit maximum write address and the decimal value corresponding to the 6-bit latest read address is 2, which is less than the second value 3. The first comparator 3023 can determine that the instructions stored in the memory 3021 will be read, and then generate the fourth state information.
本申请实施例中,存储器3021的存储队列中每个存储位置上的存储地址为N位,对应存储器3021的存储队列的队列深度。在第一存储模式下,存储器3021中存储的指令读取后不会清除,采用N位的地址可以判断出存储器3021的空满状态,而在第二存储模式下,存储器3021中存储的指令读取后会清除,可以循环写入指令,采用N位地址不便于判断第二存储模式下存储器3021的空满状态。为使存储器3021处于不同存储模式下均可对存储器3021的空满状态进行判断,在对存储器3021执行读写操作之后,可将N位最新读地址和N位最新写地址均扩展一位,得到N+1位最新读地址和N+1位最新写地址,然后将N+1位最新读地址和N+1位最新写地址提供给用于对存储器3021进行空满状态判断的设备。由于第一比较器3023是根据N位最新读地址和N位最新写地址进行空满状态判断的,为实现第一比较器3032的判断逻辑,参见图8,存储装置302还包括:位选择器3024。该位选择器3024用于获取存储器3021对应的N+1位最新读地址和N+1位最新写地址,将N+1位最新读地址的低N位作为N位最新读地址,并将N+1位最新写地址的低N位作为N位最新写地址,然后将N位最新读地址和N位最新写地址发送给第一比较器3023。例如,位选择器3024获取到7位最新读地址为0111100,7位最新写地址为0111111,从7位最新读地址中获取低6位,得到6位最新读地址为111100,从7位最新写地址中获取低6位,得到6位最新写地址为111111。In the embodiment of the present application, the storage address at each storage position in the storage queue of the memory 3021 is N bits, corresponding to the queue depth of the storage queue of the memory 3021. In the first storage mode, the instructions stored in the memory 3021 will not be cleared after reading, and the empty and full state of the memory 3021 can be judged by using the N-bit address, while in the second storage mode, the instructions stored in the memory 3021 will be cleared after reading, and the instructions can be written cyclically, and the use of the N-bit address is not convenient for judging the empty and full state of the memory 3021 in the second storage mode. In order to enable the empty and full state of the memory 3021 to be judged in different storage modes, after performing a read and write operation on the memory 3021, the N-bit latest read address and the N-bit latest write address can be expanded by one bit to obtain the N+1-bit latest read address and the N+1-bit latest write address, and then the N+1-bit latest read address and the N+1-bit latest write address are provided to the device for judging the empty and full state of the memory 3021. Since the first comparator 3023 performs empty or full state judgment based on the N-bit latest read address and the N-bit latest write address, in order to implement the judgment logic of the first comparator 3032, referring to FIG8 , the storage device 302 further includes: a bit selector 3024. The bit selector 3024 is used to obtain the N+1-bit latest read address and the N+1-bit latest write address corresponding to the memory 3021, use the lower N bits of the N+1-bit latest read address as the N-bit latest read address, and use the lower N bits of the N+1-bit latest write address as the N-bit latest write address, and then send the N-bit latest read address and the N-bit latest write address to the first comparator 3023. For example, the bit selector 3024 obtains the 7-bit latest read address as 0111100, the 7-bit latest write address as 0111111, obtains the lower 6 bits from the 7-bit latest read address, and obtains the 6-bit latest read address as 111100, and obtains the lower 6 bits from the 7-bit latest write address, and obtains the 6-bit latest write address as 111111.
上述第一种情况和第二种情况针对的是向处于第一存储模式下的存储器3021中写入指令的场景,第三种情况和第四种情况针对的是从处于第一存储模式下的存储器3021中读取指令的场景。The first and second cases mentioned above are aimed at the scenario of writing instructions into the memory 3021 in the first storage mode, and the third and fourth cases are aimed at the scenario of reading instructions from the memory 3021 in the first storage mode.
参见图9,在目标存储模式为第二存储模式时,存储装置还包括:第二比较器3025。第二比较器3025可以生成存储器3021在第二存储模式下的状态信息,进而将所生成的状态信息发送给多路选择器3022。在本申请实施例中,状态信息包括第一状态信息、第二状态信息、第三状态信息及第四状态信息,不同的状态信息所指示的存储器的空满状态是不同的。针对不同的状态信息,第二比较器3025的判断逻辑是不同的。具体包括以下几种情况:Referring to FIG9 , when the target storage mode is the second storage mode, the storage device further includes: a second comparator 3025. The second comparator 3025 can generate state information of the memory 3021 in the second storage mode, and then send the generated state information to the multiplexer 3022. In the embodiment of the present application, the state information includes first state information, second state information, third state information and fourth state information, and the empty and full states of the memory indicated by different state information are different. For different state information, the judgment logic of the second comparator 3025 is different. Specifically, the following situations are included:
第一种情况、第二比较器3025获取存储器3021对应的N+1位最新写地址和N+1位最新读地址,并将N+1位最新写地址和N+1位最新读地址进行比较。由于在第二存储模式下存储器3021所存储的指令的数量是不固定的,指令读取后会清除,当存储队列中最后一个存储位置上写入指令后,可以跳转到存储队列的起始存储位置上继续写指令,当存储队列中最后一个存储位置上写入指令跳转到存储队列的起始存储位置时,存储队列的起始存储位置将变为最高位的数值为1,其他低N位的数值为0,而读写操作可以同步执行,当N+1位最新写地址和N+1位最新读地址的最高位上的数值不同,且除最高位以外的其他位上的数值相同时,说明读写操作对应的指令相差一个存储队列,此时第二比较器3025可以生成用于指示存储器3021的存储空间已满的第一状态信息,进而将第一状态信息发送给多路选择器3022。例如,指令读写装置303只进行写操作未进行读操作,7位最新写地址为1000000,7位最新读地址为0000000,第二比较器3025可以确定存储器3021的存储空间已满,进而生成第一状态信息。又例如,指令读写装置303同步进行写操作和读操作,7位最新写地址为1000010,7位最新读地址为0000010,第二比较器3025可以确定存储器3021的存储空间已满,进而生成第一状态信息。In the first case, the second comparator 3025 obtains the N+1-bit latest write address and the N+1-bit latest read address corresponding to the memory 3021, and compares the N+1-bit latest write address and the N+1-bit latest read address. Since the number of instructions stored in the memory 3021 is not fixed in the second storage mode, the instruction will be cleared after reading. After the instruction is written to the last storage position in the storage queue, it can jump to the starting storage position of the storage queue to continue writing the instruction. When the instruction written to the last storage position in the storage queue jumps to the starting storage position of the storage queue, the starting storage position of the storage queue will become the highest bit value 1, and the other low N bits are 0, and the read and write operations can be performed synchronously. When the highest bits of the N+1-bit latest write address and the N+1-bit latest read address are different, and the values of the bits other than the highest bit are the same, it means that the instructions corresponding to the read and write operations differ by one storage queue. At this time, the second comparator 3025 can generate the first state information for indicating that the storage space of the memory 3021 is full, and then send the first state information to the multiplexer 3022. For example, the instruction reading and writing device 303 only performs a write operation without performing a read operation, the 7-bit latest write address is 1000000, and the 7-bit latest read address is 0000000, and the second comparator 3025 can determine that the storage space of the memory 3021 is full, and then generate the first state information. For another example, the instruction reading and writing device 303 performs a write operation and a read operation simultaneously, the 7-bit latest write address is 1000010, and the 7-bit latest read address is 0000010, and the second comparator 3025 can determine that the storage space of the memory 3021 is full, and then generate the first state information.
第二种情况、第二比较器3025获取存储器3021对应的N+1位最新写地址和N+1位最新读地址,将二进制表示的N+1位最新写地址转换为十进制数值,并将二进制表示的N+1位最新读地址转换为十进制数值,然后将N+1位最新写地址对应的十进制数值和N+1位最新读地址对应的十进制数值进行比较,如果N+1位最新写地址对应的十进制数值大于N+1位最新读地址对应的十进制数值,则将N+1位最新写地址对应的十进制数值减去N+1位最新读地址对应的十进制数值,如果N+1位最新写地址对应的十进制数值小于N+1位最新读地址对应的十进制数值,则将N+1位最新读地址对应的十进制数值减去N+1位最新写地址对应的十进制数值,由于在第二存储模式下存储器3021所存储的指令的数量是不固定的,指令读取后会清除,当N+1位最新写地址对应的十进制数值和N+1位最新读地址对应的十进制数值之间的差值大于等于第三数值,第二比较器3025可以确定存储器3021的存储空间将满,进而生成第二状态信息,然后将第二状态信息发送给多路选择器3022。其中,第三数值可以为62、63等。例如,假设第三数值为62,7位最新写地址对应的十进制数值为67,7位最新读地址对应的十进制数值为3,7位最新写地址对应的十进制数值与7位最新读地址对应的十进制数值之间的差值为64,大于第三数值62,第二比较器3025可以确定存储器3021的存储空间将满,进而生成第二状态信息。In the second case, the second comparator 3025 obtains the N+1-bit latest write address and the N+1-bit latest read address corresponding to the memory 3021, converts the binary representation of the N+1-bit latest write address into a decimal value, and converts the binary representation of the N+1-bit latest read address into a decimal value, and then compares the decimal value corresponding to the N+1-bit latest write address with the decimal value corresponding to the N+1-bit latest read address. If the decimal value corresponding to the N+1-bit latest write address is greater than the decimal value corresponding to the N+1-bit latest read address, then the decimal value corresponding to the N+1-bit latest write address is subtracted from the decimal value corresponding to the N+1-bit latest read address. If N+1 If the decimal value corresponding to the latest write address of the N+1 bit is less than the decimal value corresponding to the latest read address of the N+1 bit, the decimal value corresponding to the latest read address of the N+1 bit is subtracted from the decimal value corresponding to the latest write address of the N+1 bit. Since the number of instructions stored in the memory 3021 in the second storage mode is not fixed, the instructions will be cleared after reading. When the difference between the decimal value corresponding to the latest write address of the N+1 bit and the decimal value corresponding to the latest read address of the N+1 bit is greater than or equal to the third value, the second comparator 3025 can determine that the storage space of the memory 3021 is about to be full, and then generate the second state information, and then send the second state information to the multiplexer 3022. The third value can be 62, 63, etc. For example, assuming that the third value is 62, the decimal value corresponding to the 7-bit latest write address is 67, the decimal value corresponding to the 7-bit latest read address is 3, and the difference between the decimal value corresponding to the 7-bit latest write address and the decimal value corresponding to the 7-bit latest read address is 64, which is greater than the third value 62. The second comparator 3025 can determine that the storage space of the memory 3021 is about to be full, and then generate second status information.
第三种情况、第二比较器3025获取存储器3021对应的N+1位最新写地址和N+1位最新读地址,将N+1位最新读地址和N+1位最新写地址进行比较,由于在第二存储模式下存储器3021所存储的指令的数量是不固定的,指令读取后会清除,当N+1位最新读地址和N+1位最新写地址相同时,第二比较器3025可以确定存储器3021中存储的指令已读空,进而生成第三状态信息,然后将第三状态信息发送给多路选择器3022。例如,7位最新写地址为0001111,7位最新读地址为0001111,7位最新写地址与7位最新读地址相同,第二比较器3025可以确定存储器存储的指令已读完,进而生成第三状态信息。In the third case, the second comparator 3025 obtains the N+1-bit latest write address and the N+1-bit latest read address corresponding to the memory 3021, and compares the N+1-bit latest read address with the N+1-bit latest write address. Since the number of instructions stored in the memory 3021 is not fixed in the second storage mode, the instructions will be cleared after reading. When the N+1-bit latest read address and the N+1-bit latest write address are the same, the second comparator 3025 can determine that the instructions stored in the memory 3021 have been read empty, and then generate the third state information, and then send the third state information to the multiplexer 3022. For example, the 7-bit latest write address is 0001111, the 7-bit latest read address is 0001111, the 7-bit latest write address is the same as the 7-bit latest read address, and the second comparator 3025 can determine that the instructions stored in the memory have been read, and then generate the third state information.
第四种情况、第二比较器3025获取存储器3021对应的N+1位最新写地址和N+1位最新读地址,将二进制表示的N+1位最新写地址转换为十进制数值,并将二进制表示的N+1位最新读地址转换为十进制数值,然后将N+1位最新写地址对应的十进制数值和N+1位最新读地址对应的十进制数值进行比较,由于在第二存储模式下存储器3021所存储的指令的数量是不固定的,指令读取后会清除,当N+1位最新写地址对应的十进制数值和N+1位最新读地址对应的十进制数值之间的差值小于等于第四数值,第二比较器3025可以确定存储器3021中存储的指令将读空,进而生成第四状态信息,然后将第四状态信息发送给多路选择器3022。其中,第四数值可以为3、4等。例如,假设第四数值为4,7位最新写地址对应的十进制数值为63,7位最新读地址对应的十进制数值为61,7位最新写地址对应的十进制数值与7位最新读地址对应的十进制数值之间的差值为2,小于第四数值3,第二比较器3025可以确定存储器3021中存储的指令将读完,进而生成第四状态信息。In the fourth case, the second comparator 3025 obtains the N+1-bit latest write address and the N+1-bit latest read address corresponding to the memory 3021, converts the binary representation of the N+1-bit latest write address into a decimal value, and converts the binary representation of the N+1-bit latest read address into a decimal value, and then compares the decimal value corresponding to the N+1-bit latest write address with the decimal value corresponding to the N+1-bit latest read address. Since the number of instructions stored in the memory 3021 is not fixed in the second storage mode, the instructions will be cleared after reading. When the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address is less than or equal to the fourth value, the second comparator 3025 can determine that the instruction stored in the memory 3021 will be read empty, and then generate the fourth state information, and then send the fourth state information to the multiplexer 3022. The fourth value can be 3, 4, etc. For example, assuming that the fourth value is 4, the decimal value corresponding to the 7-bit latest write address is 63, the decimal value corresponding to the 7-bit latest read address is 61, and the difference between the decimal value corresponding to the 7-bit latest write address and the decimal value corresponding to the 7-bit latest read address is 2, which is less than the fourth value 3. The second comparator 3025 can determine that the instructions stored in the memory 3021 will be read, and then generate the fourth state information.
上述第一种情况和第二种情况针对的是向处于第二存储模式下的存储器3021中写入指令的场景,第三种情况和第四种情况针对的是从处于第二存储模式下的存储器3021中读取指令的场景。The first and second cases mentioned above are aimed at the scenario of writing instructions into the memory 3021 in the second storage mode, and the third and fourth cases are aimed at the scenario of reading instructions from the memory 3021 in the second storage mode.
本申请实施例中,当存储装置302处于第一存储模式时,多路选择器3022选择从第一比较器3023中获取存储器3021的状态信息;当存储装置302处于第二存储模式时,多路选择器3022选择从第二比较器3025中获取存储器3021的状态信息。通过从不同的比较器中获取存储器3021的状态信息,实现了对处于不同存储模式的存储器3021的空满状态的监测,避免写溢出以及读取异常的情况,提高了系统的性能。In the embodiment of the present application, when the storage device 302 is in the first storage mode, the multiplexer 3022 selects to obtain the state information of the memory 3021 from the first comparator 3023; when the storage device 302 is in the second storage mode, the multiplexer 3022 selects to obtain the state information of the memory 3021 from the second comparator 3025. By obtaining the state information of the memory 3021 from different comparators, the empty and full states of the memory 3021 in different storage modes are monitored, write overflow and read abnormalities are avoided, and the performance of the system is improved.
图10示出了对不同存储模式下存储装置所包括的存储器的空满状态的判断过程,参见图10,当存储装置处于第一存储模式时,位选择器获取存储器对应的7位最新写地址Seq_waddr_ptr[6:0]和7位最新读地址Seq_raddr_ptr[6:0],从7位最新写地址Seq_waddr_ptr[6:0]中获取低6位,得到6位最新写地址Seq_waddr_ptr[5:0],并从7位最新读地址Seq_raddr _ptr[6:0]中获取低6位,得到6位最新读地址Seq_raddr_ptr[5:0],然后将6位最新写地址Seq_waddr_ptr[5:0]和6位最新读地址Seq_raddr_ptr[5:0]提供给第一比较器,第一比较器基于最新写地址Seq_waddr_ptr[5:0]和6位最新读地址Seq_raddr_ptr[5:0],生成存储器的状态信息,分别为ram_almost_full(第一存储模式下的将满)、ram_ full(第一存储模式下的满)、ram_almost_empty(第一存储模式下的将空)、ram_ empty(第一存储模式下的空),然后将所生成的第一存储模式下的状态信息发送给多路选择器。FIG10 shows a process for judging the empty or full state of a memory included in a storage device in different storage modes. Referring to FIG10 , when the storage device is in the first storage mode, the bit selector obtains the 7-bit latest write address Seq_waddr_ptr[6:0] and the 7-bit latest read address Seq_raddr_ptr[6:0] corresponding to the memory, obtains the lower 6 bits from the 7-bit latest write address Seq_waddr_ptr[6:0] to obtain the 6-bit latest write address Seq_waddr_ptr[5:0], and obtains the lower 6 bits from the 7-bit latest read address Seq_raddr _ptr[6:0] to obtain the 6-bit latest read address Seq_raddr_ptr[5:0], and then provide the 6-bit latest write address Seq_waddr_ptr[5:0] and the 6-bit latest read address Seq_raddr_ptr[5:0] to the first comparator. The first comparator generates the status information of the memory based on the latest write address Seq_waddr_ptr[5:0] and the 6-bit latest read address Seq_raddr_ptr[5:0], which are ram_almost_full (almost full in the first storage mode), ram_full (full in the first storage mode), ram_almost_empty (almost empty in the first storage mode), and ram_empty (empty in the first storage mode). Then, the status information in the first storage mode generated is sent to the multiplexer.
参见图10,当存储装置处于第二存储模式时,第二比较器获取存储器对应的7位最新写地址Seq_waddr_ptr[6:0]和7位最新读地址Seq_raddr_ptr[6:0],基于7位最新写地址Seq_waddr_ptr[6:0]和7位最新读地址Seq_raddr_ptr[6:0],生成存储器的状态信息,分别为fifo_almost_full(第二存储模式下的将满)、fifo_ full(第二存储模式下的满)、fifo_almost_empty(第二存储模式下的将空)、fifo_ empty(第二存储模式下的空),然后将所生成的第二存储模式下的状态信息发送给多路选择器。Referring to Figure 10, when the storage device is in the second storage mode, the second comparator obtains the 7-bit latest write address Seq_waddr_ptr[6:0] and the 7-bit latest read address Seq_raddr_ptr[6:0] corresponding to the memory, and generates status information of the memory based on the 7-bit latest write address Seq_waddr_ptr[6:0] and the 7-bit latest read address Seq_raddr_ptr[6:0], which are fifo_almost_full (almost full in the second storage mode), fifo_full (full in the second storage mode), fifo_almost_empty (almost empty in the second storage mode), and fifo_empty (empty in the second storage mode), and then sends the generated status information in the second storage mode to the multiplexer.
多路选择器基于不同存储模式下的空满状态信息,生成相应的通知消息,分别为Seq_almost_full(存储空间将写满)、Seq_ full(存储空间已写满)、Seq_almost_empty(存储空间将读空)、Seq_ empty(存储空间已读满),然后将所生成的通知消息发送给指令读写装置,使得指令读写装置能够根据存储器的空满状态,对存储器中指令进行读写。The multiplexer generates corresponding notification messages based on the empty and full status information in different storage modes, namely Seq_almost_full (the storage space is about to be full), Seq_full (the storage space is already full), Seq_almost_empty (the storage space is about to be empty), and Seq_empty (the storage space is already full), and then sends the generated notification messages to the instruction read and write device, so that the instruction read and write device can read and write instructions in the memory according to the empty and full status of the memory.
本申请实施例提供了一种指令存储方法,以上述实施例提供的指令存储系统执行本申请实施例为例,参见图11,本申请实施例提供的方法流程:The embodiment of the present application provides an instruction storage method. Taking the instruction storage system provided in the above embodiment as an example to execute the embodiment of the present application, see FIG. 11 , the method flow provided in the embodiment of the present application is as follows:
1101、在存储装置处于目标存储模式下,响应于指令写入请求,指令读写装置向存储器中写入指令。1101. When the storage device is in a target storage mode, in response to an instruction write request, the instruction read/write device writes instructions into the memory.
其中,目标存储模式为第一存储模式或第二存储模式。当因业务需求需要向指令存储系统中写入指令时,会向指令存储系统发送指令写入请求,响应于指令写入请求,指令存储系统的指令读写装置向存储装置所包括的存储器中写入指令。The target storage mode is the first storage mode or the second storage mode. When an instruction needs to be written into the instruction storage system due to business needs, an instruction write request is sent to the instruction storage system, and in response to the instruction write request, the instruction reading and writing device of the instruction storage system writes the instruction into the memory included in the storage device.
1102、在接收到存储装置上报的第一通知消息和关闭写使能信号之间不存在写延迟的情况下,当接收到第一通知消息后,指令读写装置停止向存储器中写入指令。1102. In a case where there is no write delay between receiving the first notification message reported by the storage device and turning off the write enable signal, after receiving the first notification message, the instruction reading and writing device stops writing instructions to the memory.
其中,第一通知消息用于通知指令读写装置该存储器在目标存储模式下的存储空间已满。该第一通知消息由多路选择器获取第一状态信息,并基于第一状态信息生成。The first notification message is used to notify the instruction reading and writing device that the storage space of the memory in the target storage mode is full. The first notification message is obtained by the multiplexer from the first state information and is generated based on the first state information.
在本申请实施中,目标存储模式可以为第一存储模式,也可以为第二存储模式,当存储装置处于不同的存储模式时,不同的比较器会对存储器的空满状态进行监测。具体地,当目标存储模式为第一存储模式,第一比较器获取N位最新写地址与N位最大写地址,当N位最新写地址与N位最大写地址相同时,第一比较器生成第一状态信息,并将第一状态信息发送给多路选择器;当目标存储模式为第二存储模式,第二比较器获取N+1位最新写地址和N+1位最新读地址,在N+1位最新写地址和N+1位最新读地址的最高位上的数值不同,且除最高位以外的其他位上的数值相同时,第二比较器生成第一状态信息,并将第一状态信息发送给多路选择器。In the implementation of the present application, the target storage mode can be the first storage mode or the second storage mode. When the storage device is in different storage modes, different comparators will monitor the empty and full states of the storage. Specifically, when the target storage mode is the first storage mode, the first comparator obtains the latest N-bit write address and the maximum N-bit write address. When the latest N-bit write address is the same as the maximum N-bit write address, the first comparator generates first state information and sends the first state information to the multiplexer; when the target storage mode is the second storage mode, the second comparator obtains the latest N+1-bit write address and the latest N+1-bit read address. When the values on the highest bits of the latest N+1-bit write address and the latest N+1-bit read address are different, and the values on the bits other than the highest bit are the same, the second comparator generates first state information and sends the first state information to the multiplexer.
1103、在接收到存储装置上报的第二通知消息和关闭写使能信号之间存在写延迟的情况下,当接收到第二通知消息后,指令读写装置停止向存储器中写入指令。1103. In the case where there is a write delay between receiving the second notification message reported by the storage device and turning off the write enable signal, after receiving the second notification message, the instruction reading and writing device stops writing instructions to the memory.
其中,第二通知消息用于通知指令读写装置存储器在目标存储模式下的存储空间将满。该第二通知消息由多路选择器获取第二状态信息,并基于第二状态信息生成。The second notification message is used to notify the instruction reading and writing device that the storage space of the memory in the target storage mode is about to be full. The second notification message is obtained by the multiplexer from the second state information and is generated based on the second state information.
在本申请实施中,目标存储模式可以为第一存储模式,也可以为第二存储模式,当存储装置处于不同的存储模式时,不同的比较器会对存储器的空满状态进行监测。具体地,当目标存储模式为第一存储模式,第一比较器获取N位最大写地址和N位最新写地址,将二进制表示的N位最大写地址转换为十进制数值,并将二进制表示的N位最新写地址转换为十进制数值,然后计算N位最大写地址对应的十进制数值与N位最新写地址之间的差值,当N位最大写地址对应的十进制数值与N位最新写地址对应的十进制数值之间的差值小于等于第一数值时,第一比较器生成第二状态信息,并将第二状态信息发送给多路选择器;当目标存储模式为第二存储模式,第二比较器获取N+1位最新写地址和N+1位最新读地址,将二进制表示的N+1位最新写地址转换为十进制数值,并将二进制表示的N+1位最新读地址转换为十进制数值,如果N+1位最新写地址对应的十进制数值大于N+1位最新读地址对应的十进制数值,将N+1位最新写地址对应的十进制数值减去N+1位最新读地址对应的十进制数值,如果N+1位最新写地址对应的十进制数值小于N+1位最新读地址对应的十进制数值,将N+1位最新读地址对应的十进制数值减去N+1位最新写地址对应的十进制数值,当N+1位最新写地址对应的十进制数值和N+1位最新读地址对应的十进制数值之间的差值大于等于第三数值时,第二比较器生成第二状态信息,并将第二状态信息发送给多路选择器。In the implementation of the present application, the target storage mode can be the first storage mode or the second storage mode. When the storage device is in different storage modes, different comparators will monitor the empty and full states of the storage. Specifically, when the target storage mode is the first storage mode, the first comparator obtains the N-bit maximum write address and the N-bit latest write address, converts the binary representation of the N-bit maximum write address into a decimal value, and converts the binary representation of the N-bit latest write address into a decimal value, and then calculates the difference between the decimal value corresponding to the N-bit maximum write address and the N-bit latest write address. When the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the N-bit latest write address is less than or equal to the first value, the first comparator generates second state information and sends the second state information to the multiplexer; when the target storage mode is the second storage mode, the second comparator obtains the N+1-bit latest write address and the N+1-bit latest read address, converts the binary representation of the N+1-bit latest write address into a decimal value. Value, and convert the binary representation of the N+1-bit latest read address into a decimal value. If the decimal value corresponding to the N+1-bit latest write address is greater than the decimal value corresponding to the N+1-bit latest read address, the decimal value corresponding to the N+1-bit latest write address is subtracted from the decimal value corresponding to the N+1-bit latest read address. If the decimal value corresponding to the N+1-bit latest write address is less than the decimal value corresponding to the N+1-bit latest read address, the decimal value corresponding to the N+1-bit latest read address is subtracted from the decimal value corresponding to the N+1-bit latest write address. When the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address is greater than or equal to the third value, the second comparator generates second state information and sends the second state information to the multiplexer.
本申请实施例在指令写入场景下,可对存储器的空满状态进行监测。通过对存储器的空满状态进行监测,避免了存储器的写溢出,提高了系统性能。In the instruction writing scenario, the embodiment of the present application can monitor the empty and full status of the memory. By monitoring the empty and full status of the memory, the write overflow of the memory is avoided and the system performance is improved.
本申请实施例提供了一种指令读取方法,以上述实施例提供的指令存储系统执行本申请实施例为例,参见图12,本申请实施例提供的方法流程:The embodiment of the present application provides an instruction reading method. Taking the instruction storage system provided in the above embodiment as an example to execute the embodiment of the present application, referring to FIG. 12 , the method flow provided in the embodiment of the present application is as follows:
1201、在存储装置处于目标存储模式下,响应于指令读取请求,指令读写装置从存储器中读取指令。1201. When the storage device is in a target storage mode, in response to an instruction read request, an instruction read/write device reads instructions from a memory.
其中,目标存储模式为第一存储模式或第二存储模式。当因业务需求需要从指令存储系统中读取指令时,可以向指令存储系统发送指令读取请求,响应于指令读取请求,指令存储系统的指令读写装置从存储器中读取指令。The target storage mode is the first storage mode or the second storage mode. When it is necessary to read instructions from the instruction storage system due to business needs, an instruction read request can be sent to the instruction storage system, and in response to the instruction read request, the instruction read and write device of the instruction storage system reads the instruction from the memory.
1202、在接收到存储装置上报的第三通知消息和关闭读使能信号之间不存在读延迟的情况下,当接收到第三通知消息后,指令读写装置停止读取存储器中的指令。1202. In a case where there is no read delay between receiving the third notification message reported by the storage device and turning off the read enable signal, after receiving the third notification message, the instruction reading and writing device stops reading instructions in the memory.
其中,第三通知消息用于通知指令读写装置存储器在目标存储模式下存储的指令已读完。第三通知消息由多路选择器获取第三状态信息,并基于第三状态信息生成。The third notification message is used to notify the instruction reading and writing device that the instructions stored in the memory in the target storage mode have been read out. The third notification message is generated by the multiplexer acquiring the third state information and based on the third state information.
在本申请实施中,目标存储模式可以为第一存储模式,也可以为第二存储模式,当存储装置处于不同的存储模式时,不同的比较器会对存储器的空满状态进行监测。具体地,当目标存储模式为第一存储模式,第一比较器获取N位最新读地址与N位最大写地址,当N位最新读地址与N位最大写地址相同时,第一比较器生成第三状态信息,并将第三状态信息发送给多路选择器;当目标存储模式为第二存储模式,第二比较器获取N+1位最新写地址和N+1位最新读地址,当N+1位最新读地址和N+1位最新写地址相同时,第二比较器生成第三状态信息,并将第三状态信息发送给多路选择器。In the implementation of the present application, the target storage mode can be the first storage mode or the second storage mode. When the storage device is in different storage modes, different comparators will monitor the empty and full states of the storage. Specifically, when the target storage mode is the first storage mode, the first comparator obtains the latest N-bit read address and the maximum N-bit write address. When the latest N-bit read address is the same as the maximum N-bit write address, the first comparator generates third state information and sends the third state information to the multiplexer; when the target storage mode is the second storage mode, the second comparator obtains the latest N+1-bit write address and the latest N+1-bit read address. When the latest N+1-bit read address is the same as the latest N+1-bit write address, the second comparator generates third state information and sends the third state information to the multiplexer.
1203、在接收到存储装置上报的第四通知消息和关闭读使能信号之间存在读延迟的情况下,当接收到第四通知消息后,指令读写装置停止读取存储器中的指令。1203. In a case where there is a read delay between receiving the fourth notification message reported by the storage device and turning off the read enable signal, after receiving the fourth notification message, the instruction reading and writing device stops reading instructions in the memory.
其中,第四通知消息用于通知指令读写装置存储器在目标存储模式下存储的指令将读完。第四通知消息由多路选择器获取第四状态信息,并基于第四状态信息生成。The fourth notification message is used to notify the instruction reading and writing device that the instructions stored in the memory in the target storage mode will be read out. The fourth notification message is obtained by the multiplexer from the fourth state information and is generated based on the fourth state information.
在本申请实施中,目标存储模式可以为第一存储模式,也可以为第二存储模式,当存储装置处于不同的存储模式时,不同的比较器会对存储器的空满状态进行监测。具体地,当目标存储模式为第一存储模式,第一比较器获取N位最大写地址和N位最新读地址,将二进制表示的N位最大写地址转换为十进制数值,并将二进制表示的N位最新读地址转换为二进制数值,然后计算N位最大写地址对应的十进制数值和N位最新读地址对应的十进制数值之间的差值,当N位最大写地址对应的十进制数值和N位最新读地址对应的十进制数值之间的差值小于等于第二数值时,第一比较器生成第四状态信息,并将第四状态信息发送给多路选择器;当目标存储模式为第二存储模式,第二比较器获取N+1位最新写地址和N+1位最新读地址,将二进制表示的N+1位最新写地址转换为十进制数值,并将二进制表示的N+1位最新读地址转换为十进制数值,然后计算N+1位最新写地址对应的十进制数值和N+1位最新读地址对应的十进制数值之间的差值,当N+1位最新写地址对应的十进制数值和N+1位最新读地址对应的十进制数值之间的差值小于等于第四数值时,第二比较器生成第四状态信息,并将第四状态信息发送给多路选择器。In the implementation of the present application, the target storage mode can be the first storage mode or the second storage mode. When the storage device is in different storage modes, different comparators will monitor the empty and full states of the storage. Specifically, when the target storage mode is the first storage mode, the first comparator obtains the N-bit maximum write address and the N-bit latest read address, converts the binary representation of the N-bit maximum write address into a decimal value, and converts the binary representation of the N-bit latest read address into a binary value, and then calculates the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the N-bit latest read address. When the difference between the decimal value corresponding to the N-bit maximum write address and the decimal value corresponding to the N-bit latest read address is less than or equal to the second value, the first comparator generates fourth state information and sends the fourth state information to the multiplexer; when the target storage mode is the first storage mode, the first comparator obtains the N-bit maximum write address and the N-bit latest read address, and the fourth state information is sent to the multiplexer. The formula is the second storage mode, the second comparator obtains the N+1-bit latest write address and the N+1-bit latest read address, converts the binary representation of the N+1-bit latest write address into a decimal value, and converts the binary representation of the N+1-bit latest read address into a decimal value, and then calculates the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address. When the difference between the decimal value corresponding to the N+1-bit latest write address and the decimal value corresponding to the N+1-bit latest read address is less than or equal to the fourth value, the second comparator generates fourth state information and sends the fourth state information to the multiplexer.
本申请实施例在指令读取场景下,可对存储器的空满状态进行监测。通过对存储器的空满状态进行监测,避免了存储器的指令读取错误,提高了系统性能。In the instruction reading scenario, the embodiment of the present application can monitor the empty or full state of the memory. By monitoring the empty or full state of the memory, instruction reading errors of the memory are avoided and system performance is improved.
图13示出了基于本申请实施例提供的指令存储系统的指令读取和写入过程,参见图13,响应于指令写入请求,指令读写装置生成写使能信号,响应于写使能信号,可以将指令seq_wr_cmd[127:0]写入到存储器;响应于指令读取请求,指令读写装置生成读使能信号,响应于读使能信号,可以从存储器中读取指令seq_rd_cmd[127:0]。在指令写入和读取过程中,存储装置会监测存储器的空满状态,基于所监测的存储器的状态信息,生成相应的通知消息,并将通知消息发送给指令读写装置,以使指令读写装置能够根据存储器的状态信息对存储器中指令进行读写。存储装置对存储器的空满状态的监测过程包括:当存储装置处于第一存储模式时,位选择器获取存储器对应的7位最新写地址Seq_waddr_ptr[6:0]和7位最新读地址Seq_raddr_ptr[6:0],从7位最新写地址Seq_waddr_ptr[6:0]中获取低6位,得到6位最新写地址Seq_waddr_ptr[5:0],并从7位最新读地址Seq_ raddr _ptr[6:0]中获取低6位,得到6位最新读地址Seq_raddr_ptr[5:0],然后将6位最新写地址Seq_waddr_ptr[5:0]和6位最新读地址Seq_raddr_ptr[5:0]提供给第一比较器,第一比较器基于最新写地址Seq_waddr_ptr[5:0]和6位最新读地址Seq_raddr_ptr[5:0],生成存储器的状态信息,分别为ram_almost_full(第一存储模式下的将满)、ram_ full(第一存储模式下的满)、ram_almost_empty(第一存储模式下的将空)、ram_ empty(第一存储模式下的空),然后将所生成的第一存储模式下的状态信息发送给多路选择器。当存储装置处于第二存储模式时,第二比较器获取存储器对应的7位最新写地址Seq_waddr_ptr[6:0]和7位最新读地址Seq_raddr_ptr[6:0],基于7位最新写地址Seq_waddr_ptr[6:0]和7位最新读地址Seq_raddr_ptr[6:0],生成存储器的空满状态信息,分别为fifo_almost_full(第二存储模式下的将满)、fifo_ full(第二存储模式下的满)、fifo_almost_empty(第二存储模式下的将空)、fifo_ empty(第二存储模式下的空),然后将所生成的第二存储模式下的状态信息发送给多路选择器。多路选择器基于不同存储模式下的状态信息,生成相应的通知消息,分别为Seq_almost_full(存储空间将写满)、Seq_ full(存储空间已写满)、Seq_almost_empty(存储空间将读空)、Seq_ empty(存储空间已读满),然后将所生成的通知消息发送给指令读写装置,使得指令读写装置能够对存储器中指令的进行读写。FIG13 shows the instruction reading and writing process of the instruction storage system provided in the embodiment of the present application. Referring to FIG13 , in response to an instruction write request, the instruction read and write device generates a write enable signal. In response to the write enable signal, the instruction seq_wr_cmd[127:0] can be written to the memory; in response to an instruction read request, the instruction read and write device generates a read enable signal. In response to the read enable signal, the instruction seq_rd_cmd[127:0] can be read from the memory. During the instruction writing and reading process, the storage device monitors the empty and full status of the memory, generates a corresponding notification message based on the status information of the monitored memory, and sends the notification message to the instruction read and write device, so that the instruction read and write device can read and write the instructions in the memory according to the status information of the memory. The monitoring process of the empty and full state of the memory by the storage device includes: when the storage device is in the first storage mode, the bit selector obtains the 7-bit latest write address Seq_waddr_ptr[6:0] and the 7-bit latest read address Seq_raddr_ptr[6:0] corresponding to the memory, obtains the lower 6 bits from the 7-bit latest write address Seq_waddr_ptr[6:0] to obtain the 6-bit latest write address Seq_waddr_ptr[5:0], and obtains the lower 6 bits from the 7-bit latest read address Seq_raddr _ptr[6:0] to obtain the 6-bit latest read address Seq_raddr_ptr[5:0], and then provide the 6-bit latest write address Seq_waddr_ptr[5:0] and the 6-bit latest read address Seq_raddr_ptr[5:0] to the first comparator. The first comparator generates the status information of the memory based on the latest write address Seq_waddr_ptr[5:0] and the 6-bit latest read address Seq_raddr_ptr[5:0], which are ram_almost_full (almost full in the first storage mode), ram_full (full in the first storage mode), ram_almost_empty (almost empty in the first storage mode), and ram_empty (empty in the first storage mode). Then, the status information in the first storage mode generated is sent to the multiplexer. When the storage device is in the second storage mode, the second comparator obtains the 7-bit latest write address Seq_waddr_ptr[6:0] and the 7-bit latest read address Seq_raddr_ptr[6:0] corresponding to the memory, and generates the empty and full status information of the memory based on the 7-bit latest write address Seq_waddr_ptr[6:0] and the 7-bit latest read address Seq_raddr_ptr[6:0], which are fifo_almost_full (almost full in the second storage mode), fifo_full (full in the second storage mode), fifo_almost_empty (almost empty in the second storage mode), and fifo_empty (empty in the second storage mode), and then sends the generated status information in the second storage mode to the multiplexer. Based on the status information under different storage modes, the multiplexer generates corresponding notification messages, namely Seq_almost_full (storage space is about to be full), Seq_full (storage space is full), Seq_almost_empty (storage space is about to be empty), and Seq_empty (storage space is full), and then sends the generated notification messages to the instruction read and write device, so that the instruction read and write device can read and write instructions in the memory.
本申请实施例提供了一种电子设备100,该电子设备100包括上述实施例所述的指令存储系统。图14示出了电子设备100的结构示意图。该电子设备100可以为手机、个人电脑(Personal Computer,PC)、平板电脑、AR(Augmented Reality,增强现实)设备、VR(VirtualReality,虚拟现实)设备、车载电脑、可穿戴设备、智能家居设备等。The embodiment of the present application provides an electronic device 100, which includes the instruction storage system described in the above embodiment. FIG14 shows a schematic diagram of the structure of the electronic device 100. The electronic device 100 can be a mobile phone, a personal computer (PC), a tablet computer, an AR (Augmented Reality) device, a VR (Virtual Reality) device, a car computer, a wearable device, a smart home device, etc.
电子设备100可以包括处理器110、外部存储器接口120、内部存储器121、通用串行总线(Universal Serial Bus,USB)接口130、充电管理模块140、电源管理模块141、电池142、天线1、天线2、移动通信模块150、无线通信模块160、音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D、传感器模块180、按键190、马达191、指示器192、摄像头193、显示屏194以及用户标识模块(Subscriber Identification Module,SIM)卡接口195等。其中,传感器模块180可以包括压力传感器180A、陀螺仪传感器180B、气压传感器180C、磁传感器180D、加速度传感器180E、距离传感器180F、接近光传感器180G、指纹传感器180H、温度传感器180J、触摸传感器180K、环境光传感器180L、骨传导传感器180M等。The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a Subscriber Identification Module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如,处理器110可以包括MCU、应用处理器(Application Processor,AP)、调制解调处理器、图形处理器(Graphics ProcessingUnit,GPU),图像信号处理器(Image Signal Processor,ISP)、控制器、视频编解码器、数字信号处理器(Digital Signal Processor,DSP)、基带处理器、和/或神经网络处理器(Neural-network Processing Unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an MCU, an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(Inter-Integrated Circuit,I2C)接口、集成电路内置音频(Inter-Integrated CircuitSound,I2S)接口、脉冲编码调制(Pulse Code Modulation,PCM)接口、通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口、MIPI接口、通用输入输出(General-Purpose Input/Output,GPIO)接口、用户标识模块接口、和/或通用串行总线(Universal Serial Bus,USB)接口等。In some embodiments, the processor 110 may include one or more interfaces. The interface may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver/Transmitter (UART) interface, a MIPI interface, a General-Purpose Input/Output (GPIO) interface, a User Identity Module interface, and/or a Universal Serial Bus (USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(Serial Data Line,SDA)和一根串行时钟线(Derail Clock Line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K、充电器、闪光灯、摄像头193等。例如,处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 can be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example, the processor 110 can be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface to realize the touch function of the electronic device 100.
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 via the I2S interface to achieve the function of answering a call through a Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样、量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。I2S接口和PCM接口都可以用于音频通信。The PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如,处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194、摄像头193等外围器件。MIPI接口包括摄像头串行接口(Camera Serial Interface,CSI)、显示屏串行接口(DisplaySerial Interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193、显示屏194、无线通信模块160、音频模块170、传感器模块180等。GPIO接口还可以被配置为I2C接口、I2S接口、UART接口、MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口、Micro USB接口、USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据,也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, can also be used to transfer data between the electronic device 100 and a peripheral device, and can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110、内部存储器121、显示屏194、摄像头193和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数、电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193 and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
电子设备100的无线通信功能可以通过天线1、天线2、移动通信模块150、无线通信模块160、调制解调处理器以及基带处理器等实现。The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如,可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器、开关、功率放大器、低噪声放大器(Low Noise Amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波、放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and may be set in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(WirelessLocal Area Networks,WLAN)(如无线保真(Wireless Fidelity,Wi-Fi)网络)、蓝牙(Bluetooth,BT)、全球导航卫星系统(Global Navigation Satellite System,GNSS)、调频(Frequency Modulation,FM)、近距离无线通信技术(Near Field Communication,NFC)、红外技术(Infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频、放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate and amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(Global System For Mobile Communications,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址接入(CodeDivision Multiple Access,CDMA)、宽带码分多址(Wideband Code Division MultipleAccess,WCDMA)、时分码分多址(Time-Division Code Division Multiple Access,TD-SCDMA)、长期演进(Long Term Evolution,LTE)、BT、GNSS、WLAN、NFC 、FM、和/或IR技术等。所述GNSS可以包括全球卫星定位系统(Global Positioning System ,GPS)、全球导航卫星系统(Global Navigation Satellite System,GNASS)、北斗卫星导航系统(BeidouNavigation Satellite System,BDS)、准天顶卫星系统(Quasi-Zenith SatelliteSystem,QZSS)和/或星基增强系统(Satellite Based Augmentation Systems,SBAS)。In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include Global System For Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology. The GNSS may include a Global Positioning System (GPS), a Global Navigation Satellite System (GNASS), a Beidou Navigation Satellite System (BDS), a Quasi-Zenith Satellite System (QZSS) and/or a Satellite Based Augmentation System (SBAS).
电子设备100通过GPU、显示屏194以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
显示屏194用于显示图像、视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-EmittingDiode,OLED)、有源矩阵有机发光二极体或主动矩阵有机发光二极体(Active-MatrixOrganic Light Emitting Diode的,AMOLED)、柔性发光二极管(Flex Light-EmittingDiode,FLED)、Miniled、MicroLed,Micro-oLed、量子点发光二极管(Quantum Dot LightEmitting Diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
电子设备100可以通过ISP,摄像头193、视频编解码器、GPU、显示屏194以及应用处理器等实现拍摄功能。The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
ISP 用于处理摄像头193反馈的数据。例如,拍照时打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点、亮度、肤色进行算法优化。ISP还可以对拍摄场景的曝光、色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(Charge Coupled Device,CCD)或互补金属氧化物半导体(Complementary Metal-Oxide-Semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB、YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal oxide semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(Moving Picture Experts Group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
NPU为神经网络(Neural-Network ,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如,图像识别,人脸识别,语音识别,文本理解等。NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. NPU can realize applications such as intelligent cognition of electronic device 100, such as image recognition, face recognition, voice recognition, text understanding, etc.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如,至少一个磁盘存储器件、闪存器件、通用闪存存储器(Universal Flash Storage,UFS)等。处理器110通过运行存储在内部存储器121的指令、和/或存储在设置于处理器中的存储器的指令,执行电子设备100的各种功能应用以及数据处理。The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, for example, at least one disk storage device, a flash memory device, a universal flash storage (Universal Flash Storage, UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
电子设备100可以通过音频模块170、扬声器170A、受话器170B、麦克风170C、耳机接口170D,以及应用处理器等实现音频功能。例如,音乐播放、录音等。The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170 , the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号、降噪,还可以识别声音来源,实现定向录音功能等。Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to microphone 170C to input the sound signal into microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to realize the collection of sound signals, noise reduction, identification of sound sources, realization of directional recording function, etc.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(Open Mobile Terminal Platform,OMTP)标准接口、美国蜂窝电信工业协会(Cellular Telecommunications Industry Association of the USA,CTIA)标准接口。The earphone interface 170D is used to connect a wired earphone and can be the USB interface 130 or a 3.5 mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器、电感式压力传感器、电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如,当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the touch operation intensity according to the pressure sensor 180A. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions. For example, when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, an instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, an instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即x、y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist positioning and navigation.
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换、计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
距离传感器180F用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can obtain a vibration signal. In some embodiments, the bone conduction sensor 180M can obtain a vibration signal of a vibrating bone block of the vocal part of the human body. The bone conduction sensor 180M can also contact the human pulse to receive a blood pressure beat signal. In some embodiments, the bone conduction sensor 180M can also be set in an earphone and combined into a bone conduction earphone. The audio module 170 can parse out a voice signal based on the vibration signal of the vibrating bone block of the vocal part obtained by the bone conduction sensor 180M to realize a voice function. The application processor can parse the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M to realize a heart rate detection function.
按键190包括开机键、音量键等。按键190可以是机械按键,也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如,拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如,时间提醒、接收信息、闹钟、游戏等),也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (for example, taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example, time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
指示器192可以是指示灯,可以用于指示充电状态、电量变化,也可以用于指示消息、未接来电、通知等。The indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡、Micro SIM卡、SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一条计算机程序,所述至少一条计算机程序被处理器执行时能够实现上述实施例所述的指令存储方法,或上述实施例所述的指令读取方法。An embodiment of the present application provides a computer-readable storage medium, in which at least one computer program is stored. When the at least one computer program is executed by a processor, it can implement the instruction storage method described in the above embodiment, or the instruction reading method described in the above embodiment.
本申请实施例提供了一种计算机程序产品,所述计算机程序产品包括计算机程序,所述计算机程序被处理器执行时能够实现上述实施例所述的指令存储方法,或上述实施例所述的指令读取方法。An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it can implement the instruction storage method described in the above embodiment, or the instruction reading method described in the above embodiment.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims (24)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410748273.8A CN118331641B (en) | 2024-06-11 | 2024-06-11 | Instruction storage system, instruction storage method, instruction reading method and electronic device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410748273.8A CN118331641B (en) | 2024-06-11 | 2024-06-11 | Instruction storage system, instruction storage method, instruction reading method and electronic device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN118331641A true CN118331641A (en) | 2024-07-12 |
| CN118331641B CN118331641B (en) | 2025-02-07 |
Family
ID=91779020
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410748273.8A Active CN118331641B (en) | 2024-06-11 | 2024-06-11 | Instruction storage system, instruction storage method, instruction reading method and electronic device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118331641B (en) |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030131162A1 (en) * | 2002-01-10 | 2003-07-10 | Stacey Secatch | Non-destructive read FIFO |
| CN101281489A (en) * | 2007-04-03 | 2008-10-08 | 中兴通讯股份有限公司 | FIFO memory implementing method and apparatus |
| CN104461399A (en) * | 2014-12-19 | 2015-03-25 | 上海新储集成电路有限公司 | Writing cache system of nonvolatile memory and data read-write method thereof |
| US20180032335A1 (en) * | 2016-07-31 | 2018-02-01 | Microsoft Technology Licensing, Llc | Transactional register file for a processor |
| CN111414148A (en) * | 2020-04-03 | 2020-07-14 | 中国人民解放军国防科技大学 | Hybrid FIFO data storage method and device for high-performance processor |
-
2024
- 2024-06-11 CN CN202410748273.8A patent/CN118331641B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030131162A1 (en) * | 2002-01-10 | 2003-07-10 | Stacey Secatch | Non-destructive read FIFO |
| CN101281489A (en) * | 2007-04-03 | 2008-10-08 | 中兴通讯股份有限公司 | FIFO memory implementing method and apparatus |
| CN104461399A (en) * | 2014-12-19 | 2015-03-25 | 上海新储集成电路有限公司 | Writing cache system of nonvolatile memory and data read-write method thereof |
| US20180032335A1 (en) * | 2016-07-31 | 2018-02-01 | Microsoft Technology Licensing, Llc | Transactional register file for a processor |
| CN111414148A (en) * | 2020-04-03 | 2020-07-14 | 中国人民解放军国防科技大学 | Hybrid FIFO data storage method and device for high-performance processor |
Also Published As
| Publication number | Publication date |
|---|---|
| CN118331641B (en) | 2025-02-07 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110347269B (en) | A method for realizing air mouse mode and related equipment | |
| CN113448382B (en) | Multi-screen display electronic device and multi-screen display method of electronic device | |
| CN113448482B (en) | Touch screen sliding response control method and device, and electronic device | |
| CN113126948B (en) | Audio playing method and related equipment | |
| CN114880251B (en) | Storage unit access method, access device and terminal equipment | |
| CN113485173B (en) | Switch switching method and related device | |
| CN113973398A (en) | Wireless network connection method, electronic equipment and chip system | |
| CN113490291A (en) | Data downloading method and device and terminal equipment | |
| CN114915747B (en) | Video call method, electronic device and readable storage medium | |
| CN114466238B (en) | Frame demultiplexing method, electronic device and storage medium | |
| CN111492678B (en) | A file transmission method and electronic device | |
| CN112527220B (en) | Electronic equipment display method and electronic equipment | |
| CN113901485B (en) | Application program loading method, electronic device and storage medium | |
| CN114095602B (en) | Index display method, electronic device, and computer-readable storage medium | |
| CN116048772B (en) | Central processing unit frequency adjustment method, device and terminal equipment | |
| CN116048769B (en) | Memory recycling method and device and terminal equipment | |
| CN113674258B (en) | Image processing method and related equipment | |
| CN114828098B (en) | Data transmission method and electronic device | |
| CN116133165A (en) | Headset connection system, method, headset, electronic device, and readable storage medium | |
| CN118331641B (en) | Instruction storage system, instruction storage method, instruction reading method and electronic device | |
| CN114116610A (en) | Method, apparatus, electronic device and medium for obtaining stored information | |
| CN113973152A (en) | A kind of quick reply method and electronic device for unread message | |
| CN113364067A (en) | Charging precision calibration method and electronic equipment | |
| CN115619628B (en) | Image processing method and terminal equipment | |
| CN115019803B (en) | Audio processing method, electronic device and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address |
Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040 Patentee after: Honor Terminal Co.,Ltd. Country or region after: China Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong Patentee before: Honor Device Co.,Ltd. Country or region before: China |
|
| CP03 | Change of name, title or address |