CN115729752A - Register checking method and device and storage medium - Google Patents

Register checking method and device and storage medium Download PDF

Info

Publication number
CN115729752A
CN115729752A CN202110996437.5A CN202110996437A CN115729752A CN 115729752 A CN115729752 A CN 115729752A CN 202110996437 A CN202110996437 A CN 202110996437A CN 115729752 A CN115729752 A CN 115729752A
Authority
CN
China
Prior art keywords
register
value
address
segment
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.)
Pending
Application number
CN202110996437.5A
Other languages
Chinese (zh)
Inventor
段勤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Weiguang Co ltd
Original Assignee
Zeku Technology Shanghai Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zeku Technology Shanghai Corp Ltd filed Critical Zeku Technology Shanghai Corp Ltd
Priority to CN202110996437.5A priority Critical patent/CN115729752A/en
Publication of CN115729752A publication Critical patent/CN115729752A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a register checking method and device and a storage medium, and the method comprises the following steps: reading a register address and register data in a target chip; sequentially searching an address node corresponding to the register address and at least one register segmentation sub-node corresponding to the address node from the multi-layer register index; analyzing at least one register segmentation sub-node to obtain at least one register segmentation information, and converting register data into at least one register value based on the at least one register segmentation information; respectively searching a value subnode corresponding to each register segmentation subnode from the multi-layer register index based on at least one register value to obtain at least one value subnode; and according to the at least one value sub-node, retrieving at least one register interpretation data segment from a register interpretation database corresponding to the multi-layer register index so as to realize register check based on the at least one register interpretation data segment.

Description

一种寄存器检查方法及装置、存储介质Register checking method and device, and storage medium

技术领域technical field

本申请涉及寄存器领域,尤其涉及一种寄存器检查方法及装置、存储介质。The present application relates to the field of registers, in particular to a method and device for checking registers, and a storage medium.

背景技术Background technique

在基于芯片及系统(System On Chip,SOC)平台上做驱动开发,或者芯片验证(Chip Validation,CV)的过程中,若系统出现问题,会通过检查寄存器的值,并确认是否与实际配置相符来进行验证。In the process of driver development based on the chip and system (System On Chip, SOC) platform, or chip verification (Chip Validation, CV), if there is a problem with the system, the value of the register will be checked to confirm whether it is consistent with the actual configuration to verify.

目前,针对寄存器的检查可以通过驱动CPU发送寄存器读取指令到系统总线,SOC平台返回所需数据,或者使用Trace32(仿真器)工具通过国际标准测试协议(Joint TestAction Group,JTAG)口发送寄存器读取指令,SOC平台返回所需数据;之后查阅硬件规格标准文档来定位问题寄存器。At present, the inspection of registers can be done by driving the CPU to send register read instructions to the system bus, and the SOC platform returns the required data, or use the Trace32 (emulator) tool to send register read instructions through the international standard test protocol (Joint TestAction Group, JTAG) port. Fetch instructions, and the SOC platform returns the required data; then refer to the hardware specification standard document to locate the problem register.

然而,一个SOC平台的寄存器数量很多,单个问题也会关联几个甚至十几个寄存器,导致检查效率低、耗时长的问题。However, a SOC platform has a large number of registers, and a single problem will also be associated with several or even more than a dozen registers, resulting in low checking efficiency and time-consuming problems.

发明内容Contents of the invention

本申请实施例提供一种寄存器检查方法及装置、存储介质,能够提高检查效率,减少耗时问题。Embodiments of the present application provide a register checking method and device, and a storage medium, which can improve checking efficiency and reduce time-consuming problems.

本申请的技术方案是这样实现的:The technical scheme of the present application is realized like this:

第一方面,本申请实施例提出一种寄存器检查方法,所述方法包括:In the first aspect, the embodiment of the present application proposes a register checking method, the method including:

读取目标芯片中的寄存器地址和寄存器数据;从多层寄存器索引中依次查找所述寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点;Read the register address and register data in the target chip; sequentially search for the address node corresponding to the register address and at least one register segment sub-node corresponding to the address node from the multi-layer register index;

解析所述至少一个寄存器分段子节点,得到至少一个寄存器分段信息,并基于所述至少一个寄存器分段信息,将所述寄存器数据转换成至少一个寄存器值;所述至少一个寄存器值的数量与所述至少一个寄存器分段子节点的数量相同;Parse the at least one register segment sub-node to obtain at least one register segment information, and convert the register data into at least one register value based on the at least one register segment information; the number of the at least one register value is the same as The number of the at least one register segment child node is the same;

基于所述至少一个寄存器值,从所述多层寄存器索引中分别查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点;Based on the at least one register value, search for a value sub-node corresponding to each register segment sub-node from the multi-layer register index to obtain at least one value sub-node;

根据所述至少一个取值子节点,从所述多层寄存器索引对应的寄存器释义数据库中检索至少一个寄存器解释数据段,以基于所述至少一个寄存器解释数据段实现寄存器检查。According to the at least one value subnode, at least one register interpretation data segment is retrieved from the register interpretation database corresponding to the multi-level register index, so as to implement register checking based on the at least one register interpretation data segment.

第二方面,本申请实施例提出一种寄存器检查装置,所述装置包括:In the second aspect, the embodiment of the present application proposes a device for checking registers, and the device includes:

读取单元,用于读取目标芯片中的寄存器地址和寄存器数据;The reading unit is used to read the register address and register data in the target chip;

查找单元,用于从多层寄存器索引中依次查找所述寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点;A search unit, configured to sequentially search for the address node corresponding to the register address and at least one register segment sub-node corresponding to the address node from the multi-layer register index;

解析单元,用于解析所述至少一个寄存器分段子节点,得到至少一个寄存器分段信息;A parsing unit, configured to parse the at least one register segment sub-node to obtain at least one register segment information;

转换单元,用于基于所述至少一个寄存器分段信息,将所述寄存器数据转换成至少一个寄存器值;所述至少一个寄存器值的数量与所述至少一个寄存器分段子节点的数量相同;A conversion unit, configured to convert the register data into at least one register value based on the at least one register segment information; the number of the at least one register value is the same as the number of sub-nodes of the at least one register segment;

所述查找单元,还用于基于所述至少一个寄存器值,从所述多层寄存器索引中分别查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点;The search unit is further configured to respectively search for a value sub-node corresponding to each register segment sub-node from the multi-layer register index based on the at least one register value, to obtain at least one value sub-node;

检索单元,用于根据所述至少一个取值子节点,从所述多层寄存器索引对应的寄存器释义数据库中检索至少一个寄存器解释数据段,以基于所述至少一个寄存器解释数据段实现寄存器检查。The retrieval unit is configured to retrieve at least one register interpretation data segment from the register interpretation database corresponding to the multi-level register index according to the at least one value subnode, so as to implement register checking based on the at least one register interpretation data segment.

第三方面,本申请实施例提出一种寄存器检查装置,所述装置包括:处理器、存储器及通信总线;所述处理器执行存储器存储的运行程序时实现如上述任一项所述的方法。In a third aspect, the embodiment of the present application provides a device for checking registers, the device includes: a processor, a memory, and a communication bus; when the processor executes the running program stored in the memory, the method described in any one of the above is implemented.

第四方面,本申请实施例提出一种存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现如上述任一项所述的方法。In a fourth aspect, the embodiment of the present application provides a storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described in any one of the above is implemented.

本申请实施例提供了一种寄存器检查方法及装置、存储介质,该方法包括:读取目标芯片中的寄存器地址和寄存器数据;从多层寄存器索引中依次查找寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点;解析至少一个寄存器分段子节点,得到至少一个寄存器分段信息,并基于至少一个寄存器分段信息,将寄存器数据转换成至少一个寄存器值;至少一个寄存器值的数量与至少一个寄存器分段子节点的数量相同;基于至少一个寄存器值,从多层寄存器索引中分别查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点;根据至少一个取值子节点,从多层寄存器索引对应的寄存器释义数据库中检索至少一个寄存器解释数据段,以基于至少一个寄存器解释数据段实现寄存器检查。采用上述实现方案,预先设置多层寄存器索引和多层寄存器索引对应的寄存器释义数据库,在读取到目标芯片中的寄存器地址和寄存器分段信息之后,基于多层寄存器索引确定出至少一个取值子节点,并基于至少一个取值子节点从寄存器释义数据库中检索至少一个寄存器解释数据段,由此能够快速定位寄存器对应的解释数据,进而提高检查效率,减少耗时问题。The embodiment of the present application provides a register checking method and device, and a storage medium. The method includes: reading the register address and register data in the target chip; sequentially searching the address node and address node corresponding to the register address from the multi-layer register index Corresponding to at least one register segment sub-node; parse at least one register segment sub-node to obtain at least one register segment information, and convert register data into at least one register value based on at least one register segment information; the number of at least one register value The same as the number of at least one register segment sub-node; based on at least one register value, search for a value sub-node corresponding to each register segment sub-node from the multi-layer register index, and obtain at least one value sub-node; according to at least one The value sub-node retrieves at least one register interpretation data segment from the register interpretation database corresponding to the multi-level register index, so as to implement register checking based on the at least one register interpretation data segment. Using the above implementation scheme, the multi-layer register index and the register definition database corresponding to the multi-layer register index are preset, and after reading the register address and register segment information in the target chip, at least one value is determined based on the multi-layer register index sub-node, and retrieve at least one register interpretation data segment from the register interpretation database based on at least one value sub-node, so that the interpretation data corresponding to the register can be quickly located, thereby improving inspection efficiency and reducing time-consuming problems.

附图说明Description of drawings

图1为本申请实施例提供的一种寄存器检查方法的流程图;FIG. 1 is a flowchart of a register checking method provided in an embodiment of the present application;

图2为本申请实施例提供的一种词典文件生成方法的流程图;Fig. 2 is the flowchart of a kind of dictionary file generating method that the embodiment of the present application provides;

图3为本申请实施例提供的一种示例性的一段硬件规格标准文档的组成示意图;FIG. 3 is a schematic diagram of the composition of an exemplary piece of hardware specification standard document provided by the embodiment of the present application;

图4为本申请实施例提供的一种示例性的四层结构的二叉树链式寄存器索引的结构示意图;FIG. 4 is a schematic structural diagram of an exemplary four-layer binary tree chain register index provided by an embodiment of the present application;

图5为本申请实施例提供的一种示例性的SOC软件调试方法的流程示意图;FIG. 5 is a schematic flow diagram of an exemplary SOC software debugging method provided in an embodiment of the present application;

图6为本申请实施例提供的一种寄存器检查装置的结构示意图一;FIG. 6 is a structural schematic diagram 1 of a register checking device provided by an embodiment of the present application;

图7为本申请实施例提供的一种寄存器检查装置的结构示意图二。FIG. 7 is a second structural schematic diagram of a device for checking registers provided by an embodiment of the present application.

具体实施方式Detailed ways

应当理解,此处描述的具体实施例仅仅用以解释本申请。并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the present application. It is not intended to limit the application.

本申请实施例提供一种寄存器检查方法,如图1所示,该方法可以包括:The embodiment of the present application provides a register checking method, as shown in Figure 1, the method may include:

S101、读取目标芯片中的寄存器地址和寄存器数据;从多层寄存器索引中依次查找寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点。S101. Read the register address and register data in the target chip; sequentially search for an address node corresponding to the register address and at least one register segment sub-node corresponding to the address node from the multi-layer register index.

本申请实施例提出的一种寄存器检查方法可以适用于基于soc芯片中的寄存器进行系统故障排除的场景中。A method for checking registers proposed in the embodiment of the present application may be applicable to a scenario where system troubleshooting is performed based on registers in a SoC chip.

本申请实施例中,进行寄存器索引的装置可以为任何具备通信和存储功能的设备,例如:平板电脑、手机、个人计算机(Personal Computer,PC)、笔记本电脑、可穿戴设备等设备。In the embodiment of the present application, the device for register indexing can be any device with communication and storage functions, such as tablet computer, mobile phone, personal computer (Personal Computer, PC), notebook computer, wearable device and other devices.

需要说明的是,在需要调试的平台上,驱使CPU将SOC的寄存器地址和寄存器地址中的寄存器数据dump下来,该过程需要加载并运行寄存器dump指令,来读取目标芯片中的寄存器地址和寄存器数据。在本申请实施例中,可以基于具体的实现逻辑预先设计寄存器dump指令,如针对数量大的寄存器实行分段或者筛选处理等。It should be noted that on the platform that needs to be debugged, the CPU is driven to dump the register address of the SOC and the register data in the register address. This process needs to load and run the register dump command to read the register address and register data in the target chip. data. In the embodiment of the present application, the register dump instruction may be pre-designed based on specific implementation logic, such as implementing segmentation or screening processing for a large number of registers.

本申请实施例中,在读取到目标芯片中的寄存器地址和寄存器数据之后,可以将寄存器地址和寄存器数据保存为binary文件data.bin。In the embodiment of the present application, after the register address and register data in the target chip are read, the register address and register data may be saved as a binary file data.bin.

需要说明的是,在读取到目标芯片中的寄存器地址和寄存器数据之后,就要从硬件规格标准文档中查找对应的寄存器解释数据了,为提高查找效率,在本申请实施例中,针对硬件规格标准文档,从中提取对硬件调试有用的寄存器相关信息,以生成多层寄存器索引和多层寄存器索引对应的寄存器释义数据库,多层寄存器索引和寄存器释义数据库共同组成了硬件规格标准文档对应的词典文件。寄存器检查装置直接通过该词典文件检索SOC中检索寄存器的解释数据。首先,在读取到寄存器地址和寄存器数据之后,从多层寄存器索引中依次查找寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点。It should be noted that after reading the register address and register data in the target chip, it is necessary to search for the corresponding register interpretation data from the hardware specification standard document. In order to improve the search efficiency, in the embodiment of this application, for the hardware Specification standard documents, from which register-related information useful for hardware debugging is extracted to generate multi-layer register indexes and register definition databases corresponding to multi-layer register indexes, which together form a dictionary corresponding to hardware specification standard documents document. The register checking device directly searches the interpretation data of the search register in the SOC through the dictionary file. First, after the register address and register data are read, the address node corresponding to the register address and at least one register segment sub-node corresponding to the address node are sequentially searched from the multi-layer register index.

本申请实施例中,多层寄存器索引的结构为多层结构的二叉树链式索引,其中,多层寄存器索引中的第一层寄存器索引由一组地址节点组成,第一层寄存器索引中的每一个地址节点指向第二层寄存器索引中的一组寄存器分段子节点,第二层寄存器索引中的每一个寄存器分段子节点指向第三层寄存器索引中的一组取值子节点;一组地址节点、一组寄存器分段子节点和一组取值子节点由单链表结构组成;其中,一组地址节点中保存硬件规格标准文档中的寄存器的地址信息,一组寄存器分段子节点中保存硬件规格标准文档中寄存器的地址信息对应的分段信息,一组取值子节点中保存硬件规格标准文档中寄存器的地址信息对应的分段信息对应的取值范围。In the embodiment of the present application, the structure of the multi-layer register index is a multi-layer binary tree chain index, wherein the first layer register index in the multi-layer register index is composed of a group of address nodes, each of the first layer register index An address node points to a group of register segment sub-nodes in the second-level register index, and each register segment sub-node in the second-level register index points to a group of value sub-nodes in the third-level register index; a group of address nodes 1. A group of register sub-nodes and a group of value sub-nodes are composed of a single-linked list structure; among them, a group of address nodes saves the address information of the registers in the hardware specification standard document, and a group of register sub-nodes saves the hardware specification standard The segment information corresponding to the address information of the register in the document, and the value range corresponding to the segment information corresponding to the address information of the register in the hardware specification standard document is stored in a group of value sub-nodes.

具体的,基于上述多层寄存器索引结构,在读取到目标芯片中的寄存器地址和寄存器数据之后,从第一层寄存器索引中,查找与寄存器地址对应的地址节点,并从第二层寄存器索引中确定该地址节点指向的至少一个寄存器分段子节点。Specifically, based on the above-mentioned multi-layer register index structure, after reading the register address and register data in the target chip, from the first layer register index, find the address node corresponding to the register address, and from the second layer register index Determine at least one register segment child node pointed to by the address node in .

具体的,生成多层寄存器索引和寄存器释义数据库的过程包括:Specifically, the process of generating a multi-layer register index and register definition database includes:

S201、从原始硬件规格标准文档中提取寄存器的地址信息、地址信息对应的分段信息、分段信息对应的取值范围和对取值范围内每个取值的解释数据。S201. Extract the address information of the register, segment information corresponding to the address information, value range corresponding to the segment information, and interpretation data for each value within the value range from the original hardware specification standard document.

本申请实施例中,原始硬件规格标准文档中的寄存器相关信息包括:寄存器的地址信息,地址信息对应的分段信息、分段信息对应的取值范围和对取值范围内的每个取值的解释数据。In the embodiment of this application, the register-related information in the original hardware specification standard document includes: the address information of the register, the segment information corresponding to the address information, the value range corresponding to the segment information, and each value within the value range interpretation data.

图3为一段原始硬件规格标准文档,regOffset字段描述了本寄存器的地址信息,fieldRange中存储了每段寄存器的内部偏移起始和内部偏移终止,其存储形式为[内部偏移终止:内部偏移起始],fieldRange字段描述了本寄存器的分段信息和分段信息对应的取值范围,具体的,参考图3,寄存器通常为32bit的unsigned int型数据,针对regOffset为0x0000000的寄存器,fieldRange为[0:0],[1:1],[2:2],[3:3],[31:4],可知,[0:0]占1bit,[1:1]占1bit,[2:2]占1bit,[3:3]占1bit,[31:4]占28bit,则0x0000000的分段信息为1bit、1bit、1bit、1bit、28bit,其中,1bit的取值范围为0-1,28bit的取值范围为0-228;fieldDescription字段则描述了对分段信息的解释数据。Figure 3 is an original hardware specification standard document. The regOffset field describes the address information of this register. The fieldRange stores the internal offset start and internal offset end of each register. The storage format is [internal offset end: internal Offset start], the fieldRange field describes the segment information of this register and the value range corresponding to the segment information. Specifically, refer to Figure 3. The register is usually 32bit unsigned int data. For the register whose regOffset is 0x0000000, fieldRange is [0:0], [1:1], [2:2], [3:3], [31:4], it can be seen that [0:0] occupies 1 bit, [1:1] occupies 1 bit, [2:2] occupies 1 bit, [3:3] occupies 1 bit, and [31:4] occupies 28 bits, then the segmentation information of 0x0000000 is 1 bit, 1 bit, 1 bit, 1 bit, 28 bits, and the value range of 1 bit is 0 -1, the value range of 28bit is 0-2 28 ; the fieldDescription field describes the interpretation data of the segmentation information.

S202、根据解释数据建立寄存器释义数据库。S202. Establish a register interpretation database according to the interpretation data.

本申请实施例中,建立空白寄存器释义数据库,在获取到每个取值对应的解释数据之后,将每一条解释数据存储至空白寄存器释义数据库中,得到寄存器释义数据库。In the embodiment of the present application, a blank register interpretation database is established, and after obtaining the interpretation data corresponding to each value, each piece of interpretation data is stored in the blank register interpretation database to obtain the register interpretation database.

S203、基于寄存器的地址信息、地址信息对应的分段信息和分段信息对应的取值范围之间的层级对应关系,建立多层寄存器索引。S203. Based on the hierarchical correspondence between the address information of the register, the segment information corresponding to the address information, and the value range corresponding to the segment information, a multi-layer register index is established.

本申请实施例中,由于多层寄存器索引的结构为多层结构的二叉树链式索引,故首先基于层级对应关系设置多层结构的二叉树链式索引的索引结构,该索引结构为多层寄存器索引中的第一层寄存器索引由一组地址节点组成,第一层寄存器索引中的每一个地址节点指向第二层寄存器索引中的一组寄存器分段子节点,第二层寄存器索引中的每一个寄存器分段子节点指向第三层寄存器索引中的一组取值子节点;一组地址节点、一组寄存器分段子节点和一组取值子节点由单链表结构组成。之后,将寄存器的地址信息依次保存至一组地址节点中、将地址信息对应的分段信息依次保存至一组寄存器分段子节点中、将分段信息对应的取值范围依次保存至一组取值子节点中。In the embodiment of the present application, since the structure of the multi-layer register index is a multi-layer binary tree chain index, firstly, the index structure of the multi-layer binary tree chain index is set based on the hierarchical correspondence, and the index structure is a multi-layer register index The first-level register index in is composed of a set of address nodes, each address node in the first-level register index points to a set of register segment child nodes in the second-level register index, and each register in the second-level register index The segment sub-nodes point to a group of value sub-nodes in the third-level register index; a group of address nodes, a group of register segment sub-nodes and a group of value sub-nodes are composed of a single linked list structure. Afterwards, the address information of the register is sequentially saved to a group of address nodes, the segment information corresponding to the address information is sequentially saved to a group of register segment sub-nodes, and the value range corresponding to the segment information is sequentially saved to a group of fetch nodes in the value child node.

需要说明的是,针对单链表结构,每个节点会指向其同类型的下一个节点、或者同时指向其子链表的头指针,若该节点为单链表结构的最后一个节点,则该节点会指向空节点。It should be noted that, for the singly linked list structure, each node will point to the next node of its same type, or point to the head pointer of its sub-linked list at the same time. If the node is the last node of the singly linked list structure, the node will point to empty node.

需要说明的是,在将寄存器的地址信息依次保存至一组地址节点中之前,先将寄存器的地址信息按照偏移地址值的大小进行排序,得到排序后的地址信息,之后,将排序后的地址信息依次保存至一组地址节点中,此时能够保证得到的二叉树是一颗有序的二叉树,可以提高寄存器检查和比对的效率。It should be noted that before storing the address information of the registers in a group of address nodes in sequence, the address information of the registers is sorted according to the size of the offset address value to obtain the sorted address information, and then the sorted The address information is stored in a group of address nodes in turn. At this time, the obtained binary tree can be guaranteed to be an ordered binary tree, which can improve the efficiency of register checking and comparison.

需要说明的是,在设置一组寄存器分段子节点的过程中,可以先将寄存器的地址信息对应的分段信息中预留分段信息提出,得到调整后的分段信息,之后,基于调整后的分段信息设置一组寄存器分段子节点。能够极大的减少一组寄存器分段子节点的数量,进而降低多层寄存器索引的复杂度,并减小了多层寄存器索引的存储大小。It should be noted that, in the process of setting a group of register segment subnodes, the reserved segment information in the segment information corresponding to the address information of the register can be proposed first to obtain the adjusted segment information, and then, based on the adjusted The segmentation information sets a set of register segment subnodes. The number of sub-nodes of a group of register segments can be greatly reduced, thereby reducing the complexity of the multi-layer register index, and reducing the storage size of the multi-layer register index.

参考图3,fieldRand[31:4]的fieldName为Reserved,表征该分段信息为预留分段信息,预留分段信息是为留作之后做扩展使用的、当前未被使用,因此剔除[31:4]对应的寄存器分段子节点,从而减少了二叉树结构的分支节点。Referring to Figure 3, the fieldName of fieldRand[31:4] is Reserved, indicating that the segment information is reserved segment information. The reserved segment information is reserved for future expansion and is currently not used, so [ 31:4] corresponding register segment child nodes, thus reducing the branch nodes of the binary tree structure.

S204、根据解释数据和取值范围内每个取值之间的对应关系,建立多层寄存器索引和寄存器释义数据库的对应关系。S204. According to the corresponding relationship between the interpretation data and each value within the value range, establish a corresponding relationship between the multi-layer register index and the register definition database.

本申请实施例中,由于一个取值对应一条解释数据,故可根据解释数据和取值之间的对应关系,建立多层寄存器索引和寄存器释义数据库的对应关系。In the embodiment of the present application, since one value corresponds to one piece of interpretation data, the corresponding relationship between the multi-layer register index and the register interpretation database can be established according to the correspondence between the interpretation data and the value.

需要说明的是,还可以在多层寄存器索引中新增第四层寄存器索引,第四层寄存器索引中存储取值的解释信息,第三层寄存器索引中的每一个取值子节点指向第四层寄存器索引中的一个解释信息标识,之后根据解释信息标识和解释数据之间的对应关系,建立多层寄存器索引和寄存器释义数据库的对应关系。具体的多层寄存器索引的三层寄存器索引结构或者四层寄存器索引结构可根据实际情况进行选择,本申请实施例不做具体的限定。It should be noted that a fourth-level register index can also be added to the multi-level register index. The fourth-level register index stores value interpretation information, and each value sub-node in the third-level register index points to the fourth An interpretation information identifier in the layer register index, and then according to the corresponding relationship between the interpretation information identifier and the interpretation data, establish the corresponding relationship between the multi-layer register index and the register interpretation database. The specific three-level register index structure or the four-level register index structure of the multi-level register index can be selected according to actual conditions, and is not specifically limited in this embodiment of the present application.

基于S201-S204的步骤描述,生成了原始硬件规格标准文档对应的词典文件,以四层结构的二叉树链式寄存器索引为例,如图4所示,为四层结构的二叉树链式寄存器索引和索引释义数据库组成的词典文件的结构示意图。Based on the steps described in S201-S204, the dictionary file corresponding to the original hardware specification standard document is generated. Taking the binary tree chain register index of the four-layer structure as an example, as shown in Figure 4, it is the binary tree chain register index of the four-layer structure and Schematic diagram of the structure of the dictionary file composed of the index paraphrase database.

第一层寄存器索引:保存的是寄存器的偏移地址,其右节点指向下一个寄存器的偏移地址,其左节点指向本寄存器的分段信息,即图4中的第二层寄存器索引节点,其结构体内部信息为:The first-level register index: saves the offset address of the register, its right node points to the offset address of the next register, and its left node points to the segment information of this register, that is, the second-level register index node in Figure 4, The internal information of its structure is:

Figure BDA0003234211450000071
Figure BDA0003234211450000071

Figure BDA0003234211450000081
Figure BDA0003234211450000081

第二层寄存器索引,:保存的是寄存器的当前分段信息,其右节点指向的是寄存器中下一个分段信息,其左节点指向的是当前分段信息中的不同取值信息,即图4中的第三层索引寄存器节点,其结构体内部信息为:The second-level register index: it saves the current segment information of the register, its right node points to the next segment information in the register, and its left node points to different value information in the current segment information, that is, The internal information of the structure of the third-level index register node in 4 is:

Figure BDA0003234211450000082
Figure BDA0003234211450000082

第三层寄存器索引:保存的是寄存器内某个分段信息中的一个取值信息,比如一个3bit的字段可能的取值会是{3'b0、3'b1、3'b10、3'b11、3'b100…},其右节点指向寄存器内某个分段信息中的下一个取值信息,其左节点指向寄存器内某个分段信息中的一个取值信息所标识的解释信息标识,即图4中的第四层索引寄存器节点,其结构体内部信息为:The third-level register index: saves a value information in a certain segment information in the register, for example, the possible value of a 3-bit field will be {3'b0, 3'b1, 3'b10, 3'b11 , 3'b100...}, its right node points to the next value information in a certain segment information in the register, and its left node points to the interpretation information identified by a value information in a certain segment information in the register, That is, the fourth layer index register node in Figure 4, the internal information of its structure is:

Figure BDA0003234211450000083
Figure BDA0003234211450000083

第四层索引寄存器:所有节点保存的是寄存器内某个分段信息中的一个取值信息所标识的解释信息标识,通过该解释信息标识从寄存器释义数据库中获取具体的解释数据。The fourth layer index register: all nodes save the interpretation information identification identified by a value information in a segment information in the register, and obtain specific interpretation data from the register interpretation database through the interpretation information identification.

需要说明的是,在生成了原始硬件规格标准文档对应的词典文件之后,可以将该词典文件按照二进制文件格式保存为原始硬件规格标准词典文件。It should be noted that after the dictionary file corresponding to the original hardware specification standard document is generated, the dictionary file can be saved as an original hardware specification standard dictionary file in binary file format.

S102、解析至少一个寄存器分段子节点,得到至少一个寄存器分段信息,并基于至少一个寄存器分段信息,将寄存器数据转换成至少一个寄存器值;至少一个寄存器值的数量与至少一个寄存器分段子节点的数量相同。S102. Parse at least one register segment sub-node to obtain at least one register segment information, and convert register data into at least one register value based on at least one register segment information; the quantity of at least one register value is related to at least one register segment sub-node the same amount.

在从多层寄存器索引中依次查找到寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点之后,就要解析至少一个寄存器分段子节点,得到至少一个寄存器分段信息,并基于至少一个寄存器分段信息,将寄存器数据转换成至少一个寄存器值了。After the address node corresponding to the register address and at least one register segment sub-node corresponding to the address node are sequentially searched from the multi-layer register index, at least one register segment sub-node must be parsed to obtain at least one register segment information, and based on at least A register segmentation information that converts register data into at least one register value.

本申请实施例中,在寄存器分段子节点中存储了寄存器的分段信息,由此,分别解析每个寄存器分段子节点,得到每个寄存器分段子节点对应的寄存器分段信息。In the embodiment of the present application, the register segment information is stored in the register segment sub-node, so that each register segment sub-node is parsed separately to obtain the register segment information corresponding to each register segment sub-node.

本申请实施例中,寄存器分段信息为寄存器分段子节点对应的起始偏移和终止偏移,可基于至少一个起始偏移和对应的至少一个终止偏移,确定至少一个寄存器分段信息所占至少一个比特值;之后基于至少一个比特值,将寄存器数据划分为至少一段寄存器数据;将至少一段寄存器数据进行进制转换,得到至少一个寄存器值。In the embodiment of the present application, the register segment information is the start offset and end offset corresponding to the register segment sub-node, and at least one register segment information can be determined based on at least one start offset and at least one corresponding end offset Occupying at least one bit value; then, based on the at least one bit value, dividing the register data into at least one piece of register data; converting the at least one piece of register data to obtain at least one register value.

需要说明的是,至少一段寄存器数据为0和1的排列组成,故,将至少一段寄存器数据转换成十进制值,确定出至少一个寄存器值。It should be noted that at least one piece of register data is composed of an arrangement of 0 and 1, therefore, at least one piece of register data is converted into a decimal value to determine at least one register value.

示例性的,参考图3,fieldRange的存储形式为[内部偏移终止:内部偏移起始],针对regOffset为0x0000004的寄存器,fieldRange为[1:0],[3:2],[5:4],[9:6],[10:10],[31:11],可知,[1:0]占2bit,[3:2]占2bit,[5:4]占2bit,[9:6]占4bit,[10:10]占1bit,[31:11]占21bit,则0x0000004的分段信息为2bit、2bit、2bit、4bit、1bit、21bit,则将0x0000004的寄存器内部的寄存器数据划分为6段数据,其中前4段数据均为2个数据,取值为00、01、10或11,第5段数据为1个数据,取值为0或1,第6段数据为21个数据。之后,将6段数据转换成十进制值,确定出6个寄存器取值。Exemplarily, referring to FIG. 3, the storage form of fieldRange is [internal offset end: internal offset start], for the register whose regOffset is 0x0000004, fieldRange is [1:0], [3:2], [5: 4], [9:6], [10:10], [31:11], it can be seen that [1:0] occupies 2 bits, [3:2] occupies 2 bits, [5:4] occupies 2 bits, [9: 6] occupies 4 bits, [10:10] occupies 1 bit, and [31:11] occupies 21 bits, then the segmentation information of 0x0000004 is 2bit, 2bit, 2bit, 4bit, 1bit, 21bit, then divide the register data inside the register of 0x0000004 It is 6 pieces of data, the first 4 pieces of data are 2 pieces of data, the value is 00, 01, 10 or 11, the 5th piece of data is 1 piece of data, the value is 0 or 1, the value of the 6th piece of data is 21 pieces data. Afterwards, convert the 6 segments of data into decimal values to determine the values of 6 registers.

S103、基于至少一个寄存器值,从多层寄存器索引中分别查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点。S103. Based on at least one register value, respectively search for a value sub-node corresponding to each register segment sub-node from the multi-level register index, to obtain at least one value sub-node.

本申请实施例中,基于至少一个寄存器值,从多层寄存器索引中的第三层寄存器索引中,查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点。In the embodiment of the present application, based on at least one register value, a value-taking sub-node corresponding to each register segment sub-node is searched from the third-level register index in the multi-level register index, and at least one value-taking sub-node is obtained.

示例性的,若寄存器值为3,则从第三层寄存器索引中,查找寄存器分段子节点对应的第三个取值子节点。Exemplarily, if the value of the register is 3, the third value sub-node corresponding to the sub-node of the register segment is searched from the third-level register index.

S104、根据至少一个取值子节点,从多层寄存器索引对应的寄存器释义数据库中检索至少一个寄存器解释数据段,以基于至少一个寄存器解释数据段实现寄存器检查。S104. According to at least one value subnode, retrieve at least one register interpretation data segment from the register interpretation database corresponding to the multi-level register index, so as to implement register checking based on the at least one register interpretation data segment.

本申请实施例中,在确定出至少一个取值子节点之后,从寄存器释义数据库中分别检索每一个取值子节点对应的一个寄存器解释数据段,得到至少一个寄存器解释数据段,该至少一个寄存器解释数据段组成了对应的寄存器的解释数据。In the embodiment of the present application, after at least one value-taking sub-node is determined, a register interpretation data segment corresponding to each value-taking sub-node is retrieved from the register interpretation database to obtain at least one register interpretation data segment, and the at least one register The interpretation data segment constitutes the interpretation data of the corresponding register.

进一步地,在得到寄存器的解释数据之后,可以保存并打印寄存器的解释数据,供调试查阅使用。Furthermore, after obtaining the interpreted data of the register, the interpreted data of the register can be saved and printed for debugging and reference.

进一步地,在实际的调试过程中,还可以在硬件规格标准文档中预先设置寄存器期望值,之后基于每一个寄存器的期望值与上述得到的寄存器值进行比较,并根据比较结果确定出该寄存器具体实现的功能是否为硬件规格标准文档期望实现的功能。具体的调试过程可以根据实际情况实现,本申请实施例不做具体的限定。Furthermore, in the actual debugging process, the expected value of the register can also be preset in the hardware specification standard document, and then the expected value of each register is compared with the above-mentioned obtained register value, and the specific realization of the register can be determined according to the comparison result. Whether the function is the function expected to be realized by the hardware specification standard document. The specific debugging process can be implemented according to the actual situation, and is not specifically limited in this embodiment of the present application.

可以理解的是,预先设置多层寄存器索引和多层寄存器索引对应的寄存器释义数据库,在读取到目标芯片中的寄存器地址和寄存器分段信息之后,基于多层寄存器索引确定出至少一个取值子节点,并基于至少一个取值子节点从寄存器释义数据库中检索至少一个寄存器解释数据段,由此能够快速定位寄存器对应的解释数据,进而提高检查效率,减少耗时问题。It can be understood that the multi-layer register index and the register definition database corresponding to the multi-layer register index are preset, and after reading the register address and register segment information in the target chip, at least one value is determined based on the multi-layer register index sub-node, and retrieve at least one register interpretation data segment from the register interpretation database based on at least one value sub-node, so that the interpretation data corresponding to the register can be quickly located, thereby improving inspection efficiency and reducing time-consuming problems.

基于上述实施例,本申请实施例提出了一种SOC软件调试方法,如图5所示,该方法可以包括:Based on the above-mentioned embodiments, the embodiment of the present application proposes a SOC software debugging method, as shown in FIG. 5, the method may include:

1、从原始硬件规格标准文档中进行原始硬件规格标准文本提取,提取对与硬件调试有用的信息,包括regOffset、fieldRange和fieldDescription。1. Extract the original hardware specification standard text from the original hardware specification standard document, and extract useful information for hardware debugging, including regOffset, fieldRange and fieldDescription.

2、利用regOffset、fieldRange建立多层结构的二叉树链式索引,根据fieldDescription建立二叉树链式索引的词典数据;二叉树链式索引和词典数据共同组成了词典文件。2. Use regOffset and fieldRange to build a binary tree chain index with a multi-layer structure, and build the dictionary data of the binary tree chain index according to fieldDescription; the binary tree chain index and dictionary data together form a dictionary file.

3、将词典文件按照二进制文件格式保存为原始硬件规格标准词典文件。3. Save the dictionary file as a standard dictionary file of the original hardware specification according to the binary file format.

4、加载寄存器转储指令。4. Load register dump instruction.

5、在目标平台驱使处理器执行寄存器转储指令,将寄存器地址和寄存器数据转储下来。5. Drive the processor to execute the register dump instruction on the target platform, and dump the register address and register data.

6、将寄存器地址和寄存器数据按照二进制文件格式保存为数据文件。6. Save the register address and register data as a data file in binary file format.

7、利用原始硬件规格标准字典文件和数据文件进行数据解析,得到寄存器的具体解释数据。7. Use the original hardware specification standard dictionary file and data file for data analysis to obtain the specific interpretation data of the register.

具体的,读入原始硬件规格标准字典文件的索引节点,获取每个节点的regOffset;之后,以regOffset为数据偏移,从数据文件中读取该偏移的寄存器数据,该寄存器数据通常为32bit的无符号整型;解析regOffset的子节点1,获取其内部分段信息fieldRange;基于fieldRange将寄存器数据划分为多段数据,并确定每段数据对应的取值信息,基于取值信息解析子节点1的子节点1x,分别得到多段数据对应的多段解释数据段,多段解释数据段组成了寄存器的具体解释数据。Specifically, read in the index node of the original hardware specification standard dictionary file, and obtain the regOffset of each node; then, use regOffset as the data offset, and read the register data of the offset from the data file, and the register data is usually 32bit unsigned integer; parse the child node 1 of regOffset to obtain its internal segment information fieldRange; divide the register data into multiple segments of data based on fieldRange, and determine the value information corresponding to each segment of data, and parse the child node 1 based on the value information The child node 1x of the multi-segment data respectively obtains the multi-segment interpretation data segment corresponding to the multi-segment data, and the multi-segment interpretation data segment constitutes the specific interpretation data of the register.

8、保存寄存器的具体解释数据,供调试查阅使用。8. Save the specific interpretation data of the register for debugging and reference.

基于上述实施例,本申请实施例提供一种寄存器检查装置1。如图6所示,该装置1包括:Based on the above embodiments, the embodiment of the present application provides a register checking device 1 . As shown in Figure 6, the device 1 includes:

读取单元10,用于读取目标芯片中的寄存器地址和寄存器数据;The reading unit 10 is used to read the register address and register data in the target chip;

查找单元11,用于从多层寄存器索引中依次查找所述寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点;A search unit 11, configured to sequentially search for the address node corresponding to the register address and at least one register segment sub-node corresponding to the address node from the multi-layer register index;

解析单元12,用于解析所述至少一个寄存器分段子节点,得到至少一个寄存器分段信息;The parsing unit 12 is configured to parse the at least one register segment sub-node to obtain at least one register segment information;

转换单元13,用于基于所述至少一个寄存器分段信息,将所述寄存器数据转换成至少一个寄存器值;所述至少一个寄存器值的数量与所述至少一个寄存器分段子节点的数量相同;A conversion unit 13, configured to convert the register data into at least one register value based on the at least one register segment information; the number of the at least one register value is the same as the number of child nodes of the at least one register segment;

所述查找单元11,还用于基于所述至少一个寄存器值,从所述多层寄存器索引中分别查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点;The search unit 11 is further configured to search for a value sub-node corresponding to each register segment sub-node from the multi-layer register index based on the at least one register value, to obtain at least one value sub-node;

检索单元14,用于根据所述至少一个取值子节点,从所述多层寄存器索引对应的寄存器释义数据库中检索至少一个寄存器解释数据段,以基于所述至少一个寄存器解释数据段实现寄存器检查。A retrieval unit 14, configured to retrieve at least one register interpretation data segment from the register interpretation database corresponding to the multi-level register index according to the at least one value subnode, so as to implement register checking based on the at least one register interpretation data segment .

可选的,所述装置还包括:提取单元和建立单元;Optionally, the device further includes: an extraction unit and an establishment unit;

所述提取单元,用于从原始硬件规格标准文档中提取寄存器的地址信息、地址信息对应的分段信息、分段信息对应的取值范围和对取值范围内每个取值的解释数据;The extraction unit is configured to extract address information of the register, segment information corresponding to the address information, value range corresponding to the segment information, and interpretation data for each value within the value range from the original hardware specification standard document;

所述建立单元,用于根据所述解释数据建立所述寄存器释义数据库;基于所述寄存器的地址信息、所述地址信息对应的分段信息和所述分段信息对应的取值范围之间的层级对应关系,建立所述多层寄存器索引;根据所述解释数据和所述取值范围内每个取值之间的对应关系,建立所述多层寄存器索引和所述寄存器释义数据库的对应关系。The establishment unit is configured to establish the register interpretation database according to the interpretation data; based on the address information of the register, the segment information corresponding to the address information, and the value range corresponding to the segment information Hierarchical correspondence, establishing the multi-layer register index; according to the correspondence between the interpretation data and each value in the value range, establishing the correspondence between the multi-layer register index and the register interpretation database .

可选的,所述装置还包括:设置单元和保存单元;Optionally, the device further includes: a setting unit and a saving unit;

所述设置单元,用于根据所述层级对应关系,设置所述多层寄存器索引的索引结构,其中,上述索引结构为所述多层寄存器索引中的第一层寄存器索引由一组地址节点组成,所述第一层寄存器索引中的每一个地址节点指向第二层寄存器索引中的一组寄存器分段子节点,所述第二层寄存器索引中的每一个寄存器分段子节点指向第三层寄存器索引中的一组取值子节点;所述一组地址节点、所述一组寄存器分段子节点和所述一组取值子节点由单链表结构组成;The setting unit is configured to set the index structure of the multi-layer register index according to the hierarchical correspondence, wherein the above-mentioned index structure is that the first-level register index in the multi-layer register index consists of a group of address nodes , each address node in the first-level register index points to a group of register segment sub-nodes in the second-level register index, and each register segment sub-node in the second-level register index points to a third-level register index A group of value subnodes in; the group of address nodes, the group of register segment subnodes and the group of value subnodes are composed of a single linked list structure;

所述保存单元,用于将所述寄存器的地址信息依次保存至所述一组地址节点中,将所述地址信息对应的分段信息依次保存至所述一组寄存器分段子节点中,将所述分段信息对应的取值范围依次保存至所述一组取值子节点中。The saving unit is configured to sequentially save the address information of the register to the group of address nodes, sequentially save the segment information corresponding to the address information to the group of register segment sub-nodes, and The value range corresponding to the segment information is sequentially saved to the set of value sub-nodes.

可选的,所述建立单元,还用于通过将所述第三层寄存器索引中的每一个取值子节点指向所述寄存器释义数据库中对应的解释数据,建立所述多层寄存器索引和所述寄存器释义数据库的对应关系。Optionally, the establishment unit is further configured to establish the multi-layer register index and the Describe the corresponding relationship of the register definition database.

可选的,所述装置还包括:排序单元;Optionally, the device further includes: a sorting unit;

所述排序单元,用于将所述寄存器的地址信息按照偏移地址值的大小进行排序,得到排序后的地址信息;The sorting unit is configured to sort the address information of the register according to the size of the offset address value, and obtain the sorted address information;

所述保存单元,还用于将所述排序后的地址信息依次保存至所述一组地址节点中。The saving unit is further configured to sequentially save the sorted address information into the group of address nodes.

可选的,所述装置还包括:调整单元;Optionally, the device further includes: an adjustment unit;

所述调整单元,用于将所述地址信息对应的分段信息中的预留分段信息剔除,得到调整后的分段信息;The adjustment unit is configured to remove the reserved segment information in the segment information corresponding to the address information to obtain adjusted segment information;

所述设置单元,还用于基于所述调整后的分段信息设置所述一组寄存器分段子节点。The setting unit is further configured to set the group of register segment child nodes based on the adjusted segment information.

可选的,所述寄存器分段信息为寄存器分段子节点对应的起始偏移和终止偏移,所述装置还包括:确定单元和划分单元;Optionally, the register segment information is a start offset and an end offset corresponding to register segment subnodes, and the device further includes: a determination unit and a division unit;

所述确定单元,用于基于至少一个起始偏移和对应的至少一个终止偏移,确定所述至少一个寄存器分段信息所占至少一个比特值;The determining unit is configured to determine at least one bit value occupied by the at least one register segment information based on at least one start offset and at least one corresponding end offset;

所述划分单元,用于基于所述至少一个比特值,将所述寄存器数据划分为至少一段寄存器数据;The division unit is configured to divide the register data into at least one piece of register data based on the at least one bit value;

所述转换单元13,还用于将所述至少一段寄存器数据进行进制转换,得到所述至少一个寄存器值。The conversion unit 13 is further configured to convert the at least one piece of register data into a binary system to obtain the at least one register value.

本申请实施例提供的一种寄存器检查装置,读取目标芯片中的寄存器地址和寄存器数据;从多层寄存器索引中依次查找寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点;解析至少一个寄存器分段子节点,得到至少一个寄存器分段信息,并基于至少一个寄存器分段信息,将寄存器数据转换成至少一个寄存器值;至少一个寄存器值的数量与至少一个寄存器分段子节点的数量相同;基于至少一个寄存器值,从多层寄存器索引中分别查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点;根据至少一个取值子节点,从多层寄存器索引对应的寄存器释义数据库中检索至少一个寄存器解释数据段,以基于至少一个寄存器解释数据段实现寄存器检查。由此可见,本实施例提出的装置,预先设置多层寄存器索引和多层寄存器索引对应的寄存器释义数据库,在读取到目标芯片中的寄存器地址和寄存器分段信息之后,基于多层寄存器索引确定出至少一个取值子节点,并基于至少一个取值子节点从寄存器释义数据库中检索至少一个寄存器解释数据段,由此能够快速定位寄存器对应的解释数据,进而提高检查效率,减少耗时问题。A register inspection device provided in an embodiment of the present application reads the register address and register data in the target chip; sequentially searches the address node corresponding to the register address and at least one register segment sub-node corresponding to the address node from the multi-layer register index; Parsing at least one register segment child node, obtaining at least one register segment information, and converting the register data into at least one register value based on the at least one register segment information; the number of at least one register value and the number of at least one register segment child node Same; based on at least one register value, search for a value sub-node corresponding to each register segment sub-node from the multi-level register index, and obtain at least one value sub-node; according to at least one value sub-node, from the multi-level register At least one register interpretation data segment is retrieved from the register interpretation database corresponding to the index, so as to implement register checking based on the at least one register interpretation data segment. It can be seen that the device proposed in this embodiment presets the multi-layer register index and the register definition database corresponding to the multi-layer register index. After reading the register address and register segment information in the target chip, the multi-layer register index Determine at least one value sub-node, and retrieve at least one register interpretation data segment from the register interpretation database based on at least one value sub-node, so that the interpretation data corresponding to the register can be quickly located, thereby improving inspection efficiency and reducing time-consuming problems .

图7为本申请实施例提供的一种寄存器检查装置1的组成结构示意图二,在实际应用中,基于上述实施例的同一公开构思下,如图7所示,本实施例的装置1包括:处理器15、存储器16及通信总线17。Fig. 7 is a schematic diagram of the composition and structure of a register checking device 1 provided by the embodiment of the present application II. In practical applications, based on the same disclosed concept of the above embodiment, as shown in Fig. 7, the device 1 of this embodiment includes: Processor 15 , memory 16 and communication bus 17 .

在具体的实施例的过程中,上述读取单元10、查找单元11、解析单元12、转换单元13、检索单元14、提取单元、建立单元、设置单元、保存单元、排序单元、调整单元、确定单元和划分单元可由位于装置1上的处理器15实现,上述处理器15可以为特定用途集成电路(ASIC,Application Specific Integrated Circuit)、数字信号处理器(DSP,DigitalSignal Processor)、数字信号处理图像处理装置(DSPD,Digital Signal ProcessingDevice)、可编程逻辑图像处理装置(PLD,Programmable Logic Device)、现场可编程门阵列(FPGA,Field Programmable Gate Array)、CPU、控制器、微控制器、微处理器中的至少一种。可以理解地,对于不同的设备,用于实现上述处理器功能的电子器件还可以为其它,本实施例不作具体限定。In the process of the specific embodiment, the above-mentioned reading unit 10, searching unit 11, analyzing unit 12, converting unit 13, retrieving unit 14, extracting unit, establishing unit, setting unit, saving unit, sorting unit, adjusting unit, determining The unit and the dividing unit can be realized by a processor 15 located on the device 1, and the above-mentioned processor 15 can be an application-specific integrated circuit (ASIC, Application Specific Integrated Circuit), a digital signal processor (DSP, Digital Signal Processor), digital signal processing image processing device (DSPD, Digital Signal Processing Device), programmable logic image processing device (PLD, Programmable Logic Device), field programmable gate array (FPGA, Field Programmable Gate Array), CPU, controller, microcontroller, microprocessor at least one of . It can be understood that, for different devices, the electronic device used to implement the above processor function may also be other, which is not specifically limited in this embodiment.

在本申请实施例中,上述通信总线17用于实现处理器15和存储器16之间的连接通信;上述处理器15执行存储器16中存储的运行程序时实现如下的寄存器检查方法:In the embodiment of the present application, the above-mentioned communication bus 17 is used to realize connection and communication between the processor 15 and the memory 16; when the above-mentioned processor 15 executes the running program stored in the memory 16, the following register checking method is implemented:

读取目标芯片中的寄存器地址和寄存器数据;从多层寄存器索引中依次查找所述寄存器地址对应的地址节点和地址节点对应的至少一个寄存器分段子节点;解析所述至少一个寄存器分段子节点,得到至少一个寄存器分段信息,并基于所述至少一个寄存器分段信息,将所述寄存器数据转换成至少一个寄存器值;所述至少一个寄存器值的数量与所述至少一个寄存器分段子节点的数量相同;基于所述至少一个寄存器值,从所述多层寄存器索引中分别查找每个寄存器分段子节点对应的一个取值子节点,得到至少一个取值子节点;根据所述至少一个取值子节点,从所述多层寄存器索引对应的寄存器释义数据库中检索至少一个寄存器解释数据段,以基于所述至少一个寄存器解释数据段实现寄存器检查。Reading the register address and register data in the target chip; sequentially searching the address node corresponding to the register address and at least one register segment sub-node corresponding to the address node from the multi-layer register index; parsing the at least one register segment sub-node, Obtaining at least one register segment information, and converting the register data into at least one register value based on the at least one register segment information; the number of the at least one register value and the number of child nodes of the at least one register segment Same; based on the at least one register value, search for a value subnode corresponding to each register segment subnode from the multi-layer register index to obtain at least one value subnode; according to the at least one value subnode A node, retrieving at least one register interpretation data segment from the register interpretation database corresponding to the multi-level register index, so as to implement register checking based on the at least one register interpretation data segment.

进一步地,上述处理器15,还用于从原始硬件规格标准文档中提取寄存器的地址信息、地址信息对应的分段信息、分段信息对应的取值范围和对取值范围内每个取值的解释数据;根据所述解释数据建立所述寄存器释义数据库;基于所述寄存器的地址信息、所述地址信息对应的分段信息和所述分段信息对应的取值范围之间的层级对应关系,建立所述多层寄存器索引;根据所述解释数据和所述取值范围内每个取值之间的对应关系,建立所述多层寄存器索引和所述寄存器释义数据库的对应关系。Further, the above-mentioned processor 15 is also configured to extract the address information of the register, the segment information corresponding to the address information, the value range corresponding to the segment information, and each value within the value range from the original hardware specification standard document. the interpretation data; establish the register interpretation database according to the interpretation data; based on the hierarchical correspondence between the address information of the register, the segment information corresponding to the address information, and the value range corresponding to the segment information , establishing the multi-level register index; establishing a corresponding relationship between the multi-level register index and the register definition database according to the corresponding relationship between the interpretation data and each value in the value range.

进一步地,上述处理器15,还用于根据所述层级对应关系,设置所述多层寄存器索引的索引结构,其中,上述索引结构为所述多层寄存器索引中的第一层寄存器索引由一组地址节点组成,所述第一层寄存器索引中的每一个地址节点指向第二层寄存器索引中的一组寄存器分段子节点,所述第二层寄存器索引中的每一个寄存器分段子节点指向第三层寄存器索引中的一组取值子节点;所述一组地址节点、所述一组寄存器分段子节点和所述一组取值子节点由单链表结构组成;将所述寄存器的地址信息依次保存至所述一组地址节点中,将所述地址信息对应的分段信息依次保存至所述一组寄存器分段子节点中,将所述分段信息对应的取值范围依次保存至所述一组取值子节点中。Further, the above-mentioned processor 15 is also configured to set the index structure of the multi-layer register index according to the hierarchical correspondence, wherein the above-mentioned index structure is that the first-layer register index in the multi-layer register index consists of a Each address node in the first-level register index points to a group of register segment sub-nodes in the second-level register index, and each register segment sub-node in the second-level register index points to the first A group of value subnodes in the three-layer register index; the group of address nodes, the group of register segment subnodes and the group of value subnodes are composed of a single linked list structure; the address information of the register Sequentially saving to the group of address nodes, sequentially saving the segment information corresponding to the address information to the group of register segment sub-nodes, sequentially saving the value range corresponding to the segment information to the In a set of value child nodes.

进一步地,上述处理器15,还用于通过将所述第三层寄存器索引中的每一个取值子节点指向所述寄存器释义数据库中对应的解释数据,建立所述多层寄存器索引和所述寄存器释义数据库的对应关系。Further, the above-mentioned processor 15 is also configured to establish the multi-layer register index and the The register defines the corresponding relationship of the database.

进一步地,上述处理器15,还用于将所述寄存器的地址信息按照偏移地址值的大小进行排序,得到排序后的地址信息;将所述排序后的地址信息依次保存至所述一组地址节点中。Further, the above-mentioned processor 15 is also configured to sort the address information of the registers according to the size of the offset address value to obtain the sorted address information; and save the sorted address information to the set of address node.

进一步地,上述处理器15,还用于将所述地址信息对应的分段信息中的预留分段信息剔除,得到调整后的分段信息;基于所述调整后的分段信息设置所述一组寄存器分段子节点。Further, the above-mentioned processor 15 is further configured to remove the reserved segment information in the segment information corresponding to the address information to obtain adjusted segment information; set the A set of register segment subnodes.

进一步地,所述寄存器分段信息为寄存器分段子节点对应的起始偏移和终止偏移,Further, the register segment information is the start offset and end offset corresponding to the sub-nodes of the register segment,

上述处理器15,还用于基于至少一个起始偏移和对应的至少一个终止偏移,确定所述至少一个寄存器分段信息所占至少一个比特值;基于所述至少一个比特值,将所述寄存器数据划分为至少一段寄存器数据;将所述至少一段寄存器数据进行进制转换,得到所述至少一个寄存器值。The above-mentioned processor 15 is further configured to determine at least one bit value occupied by the at least one register segment information based on at least one start offset and at least one corresponding end offset; based on the at least one bit value, the The register data is divided into at least one piece of register data; the at least one piece of register data is converted into a base to obtain the at least one register value.

本申请实施例提供一种存储介质,其上存储有计算机程序,上述计算机可读存储介质存储有一个或者多个程序,上述一个或者多个程序可被一个或者多个处理器执行,应用于寄存器检查装置中,该计算机程序实现如上述的寄存器检查方法。An embodiment of the present application provides a storage medium on which a computer program is stored. The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors and applied to registers. In the inspection device, the computer program implements the register inspection method as described above.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It should be noted that, in this document, the term "comprising", "comprising" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article or apparatus comprising a set of elements includes not only those elements, It also includes other elements not expressly listed, or elements inherent in the process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本公开的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台图像显示设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本公开各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present disclosure can be embodied in the form of a software product in essence or the part that contributes to the related technology. The computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk, etc.) ) includes several instructions to make an image display device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in various embodiments of the present disclosure.

以上所述,仅为本申请的较佳实施例而已,并非用于限定本申请的保护范围。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the protection scope of the present application.

Claims (10)

1. A register checking method, the method comprising:
reading a register address and register data in a target chip; sequentially searching an address node corresponding to the register address and at least one register segmented sub-node corresponding to the address node from the multi-layer register index;
analyzing the at least one register segmentation sub-node to obtain at least one register segmentation information, and converting the register data into at least one register value based on the at least one register segmentation information; the number of the at least one register value is the same as the number of the at least one register segment child node;
based on the at least one register value, respectively searching a value subnode corresponding to each register segmentation subnode from the multi-layer register index to obtain at least one value subnode;
and according to the at least one value sub-node, retrieving at least one register interpretation data segment from a register interpretation database corresponding to the multi-layer register index, so as to realize register check based on the at least one register interpretation data segment.
2. The method according to claim 1, wherein before sequentially searching the address node corresponding to the register address and the at least one register segment sub-node corresponding to the address node from the multi-layer register index, the method further comprises:
extracting address information of a register, segmentation information corresponding to the address information, a value range corresponding to the segmentation information and interpretation data of each value in the value range from an original hardware specification standard document;
establishing the register paraphrasing database according to the interpretation data;
establishing the multi-layer register index based on the address information of the register, the segmentation information corresponding to the address information and the hierarchy corresponding relationship between the value ranges corresponding to the segmentation information;
and establishing the corresponding relation between the multilayer register index and the register paraphrase database according to the corresponding relation between the interpretation data and each value in the value range.
3. The method according to claim 2, wherein the establishing the multi-level register index based on a hierarchical correspondence between address information of the register, segment information corresponding to the address information, and a value range corresponding to the segment information includes:
setting an index structure of the multilayer register indexes according to the hierarchical correspondence, wherein the index structure is that a first layer register index in the multilayer register indexes is composed of a group of address nodes, each address node in the first layer register index points to a group of register segment sub-nodes in a second layer register index, and each register segment sub-node in the second layer register index points to a group of value sub-nodes in a third layer register index; the group of address nodes, the group of register segmentation sub-nodes and the group of value sub-nodes are composed of a singly linked list structure;
sequentially storing the address information of the register into the group of address nodes, sequentially storing the segmentation information corresponding to the address information into the group of register segmentation sub-nodes, and sequentially storing the value range corresponding to the segmentation information into the group of value sub-nodes.
4. The method of claim 3, wherein establishing a correspondence between the multi-level register index and the register paraphrase database based on the correspondence between the interpretation data and each value in the range of values comprises:
and establishing the corresponding relation between the multi-layer register index and the register paraphrase database by pointing each dereferencing child node in the third-layer register index to corresponding interpretation data in the register paraphrase database.
5. The method of claim 3, further comprising:
sorting the address information of the register according to the size of the offset address value to obtain the sorted address information;
and sequentially storing the sequenced address information into the group of address nodes.
6. The method of claim 3, further comprising:
removing reserved subsection information in subsection information corresponding to the address information to obtain adjusted subsection information;
setting the set of register segment sub-nodes based on the adjusted segment information.
7. The method of claim 1, wherein the register segment information is a start offset and an end offset corresponding to a register segment subnode, and wherein converting the register data into at least one register value based on the at least one register segment information comprises:
determining at least one bit value occupied by the at least one register segment information based on at least one start offset and a corresponding at least one end offset;
dividing the register data into at least one segment of register data based on the at least one bit value;
and carrying out binary conversion on the at least one segment of register data to obtain the at least one register value.
8. A register checking apparatus, characterized in that the apparatus comprises:
the reading unit is used for reading the register address and the register data in the target chip;
the searching unit is used for sequentially searching an address node corresponding to the register address and at least one register segmentation sub-node corresponding to the address node from the multi-layer register index;
the analysis unit is used for analyzing the at least one register segmentation sub-node to obtain at least one register segmentation information;
a conversion unit for converting the register data into at least one register value based on the at least one register segmentation information; the number of the at least one register value is the same as the number of the at least one register segment child node;
the searching unit is further configured to search, based on the at least one register value, one value subnode corresponding to each register segment subnode from the multi-layer register index, to obtain at least one value subnode;
and the retrieval unit is used for retrieving at least one register interpretation data segment from a register interpretation database corresponding to the multi-layer register index according to the at least one value sub-node so as to realize register check based on the at least one register interpretation data segment.
9. A register checking apparatus, characterized in that the apparatus comprises: a processor, a memory; the processor, when executing the execution program stored in the memory, implements the method of any of claims 1-7.
10. A storage medium on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 7.
CN202110996437.5A 2021-08-27 2021-08-27 Register checking method and device and storage medium Pending CN115729752A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110996437.5A CN115729752A (en) 2021-08-27 2021-08-27 Register checking method and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110996437.5A CN115729752A (en) 2021-08-27 2021-08-27 Register checking method and device and storage medium

Publications (1)

Publication Number Publication Date
CN115729752A true CN115729752A (en) 2023-03-03

Family

ID=85290416

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110996437.5A Pending CN115729752A (en) 2021-08-27 2021-08-27 Register checking method and device and storage medium

Country Status (1)

Country Link
CN (1) CN115729752A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117851341A (en) * 2023-11-23 2024-04-09 广州鼎甲计算机科技有限公司 Metadata indexing method, apparatus, computer device and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117851341A (en) * 2023-11-23 2024-04-09 广州鼎甲计算机科技有限公司 Metadata indexing method, apparatus, computer device and storage medium

Similar Documents

Publication Publication Date Title
CN112104664B (en) Protocol conversion method, device and equipment for data of Internet of things
CN101853301A (en) Regular expression matching method and system
CN107168762B (en) A Consistency Check Method for RUCM Models Based on Ontology
CN110222074A (en) It indexes lookup method, search device, electronic equipment and storage medium
CN103176905B (en) A defect correlation method and device
US11829696B2 (en) Connection analysis method for multi-port nesting model and storage medium
CN115729752A (en) Register checking method and device and storage medium
CN102063416B (en) Method and system for embedding double-byte fonts into PDF file
CN102063415B (en) Method and system for embedding single-byte fonts in PDF (Portable Document Format) file
CN114385679A (en) A table structure inspection method, table structure inspection device and electronic equipment
CN113282579A (en) Heterogeneous data storage and retrieval method, device, equipment and storage medium
CN111125216A (en) Method and device for importing data into Phoenix
CN117632999A (en) SQL-based code conversion method, device, equipment and medium
CN114880523A (en) Character string processing method and device, electronic equipment and storage medium
CN115391568A (en) Entity classification method, system, terminal and storage medium based on knowledge graph
CN113342818A (en) Data query method, system, storage medium and electronic equipment
CN115114297A (en) Data lightweight storage and search method and device, electronic equipment and storage medium
CN115481240A (en) A data asset quality detection method and detection device
CN111950257A (en) File analysis method and device
CN113836018B (en) A test environment configuration parameter backup method and related device
CN117493712B (en) PDF document navigable directory extraction method and device, electronic equipment and storage medium
CN114443688B (en) SQL rewriting method, device, electronic device and storage medium
CN118733717A (en) File duplication checking method, device, equipment, storage medium and program product
CN118796871A (en) A method, device and electronic device for database operation based on SQL
KR101921123B1 (en) Field-Indexing Method for Message

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20241022

Address after: 6th Floor, No.1 Chongqing Road, Banqiao District, Xinbei City, Taiwan, China, China

Applicant after: Weiguang Co.,Ltd.

Country or region after: Samoa

Address before: 200120 room 01, 8th floor (7th floor, real estate registration floor), No. 1, Lane 61, shengxia Road, pilot Free Trade Zone, Pudong New Area, Shanghai

Applicant before: Zheku Technology (Shanghai) Co.,Ltd.

Country or region before: China