CN116126736B - Chip code optimization method based on user requirements - Google Patents

Chip code optimization method based on user requirements Download PDF

Info

Publication number
CN116126736B
CN116126736B CN202310401751.3A CN202310401751A CN116126736B CN 116126736 B CN116126736 B CN 116126736B CN 202310401751 A CN202310401751 A CN 202310401751A CN 116126736 B CN116126736 B CN 116126736B
Authority
CN
China
Prior art keywords
detection
code
chip
nodes
linked list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202310401751.3A
Other languages
Chinese (zh)
Other versions
CN116126736A (en
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.)
Qingdao Qingruan Jingzun Microelectronics Technology Co ltd
Original Assignee
Qingdao Qingruan Jingzun Microelectronics Technology Co 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 Qingdao Qingruan Jingzun Microelectronics Technology Co ltd filed Critical Qingdao Qingruan Jingzun Microelectronics Technology Co ltd
Priority to CN202310401751.3A priority Critical patent/CN116126736B/en
Publication of CN116126736A publication Critical patent/CN116126736A/en
Application granted granted Critical
Publication of CN116126736B publication Critical patent/CN116126736B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/362Software debugging
    • G06F11/3628Software debugging of optimised code
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

The invention relates to the technical field of chip code inspection, in particular to a chip code optimization method based on user requirements, which comprises the following steps: according to the method, a running code of a chip code is obtained according to a quality detection instruction, code cutting and end-to-end connection are carried out on the running code to obtain a detection linked list, grammar semantic detection is carried out on the detection linked list to obtain a grammar semantic detection result of the running code, a test data set is obtained according to the detection linked list, wherein the data type and the data value of the test data set are all sourced from a test database which is pre-bound with the detection linked list, the test linked list is tested in sequence by utilizing the test data set to obtain a dynamic test result of the running code, and the grammar semantic detection result and the dynamic test result are fed back to an initiator of the quality detection instruction to finish quality detection of the chip code.

Description

Chip code optimization method based on user requirements
Technical Field
The invention relates to the technical field of chip code inspection, in particular to a chip code optimization method based on user requirements.
Background
The chip code is generally a programmable program for improving the intelligence of the chip, and is a code of digital operation and logic cycle judgment class which is specially designed in an industrial environment. Compared with the traditional element, the chip integrated with the code has higher intelligence, and the functions of communication, identification, alarm and the like are realized by running the code.
At present, the running code based on the chip code is mainly based on an abstract syntax tree structure analysis method, namely, the running code of the chip code generates a plurality of code branches in a layering manner according to a specific mode, and the exception of the running code of the chip code is determined by traversing the dependency relationship among the plurality of code branches.
Code detection based on an abstract syntax tree structure analysis method has high practicability, but when the code amount of running codes of chip codes becomes high, the differentiation time for differentiating into a plurality of code branches is high, and the problem of excessive resource waste is caused.
Disclosure of Invention
The invention provides a chip code optimization method based on user requirements, which mainly aims to solve the problems that the running code of the chip code tested by the traditional method needs to call excessive testing resources, so that the testing time and the resource consumption are high.
In order to achieve the above object, the present invention provides a chip code optimization method based on user requirements, including: and receiving a quality detection instruction of the chip code, and executing static detection and dynamic detection on the quality of the chip code according to the quality detection instruction.
Wherein the static detection of the chip code comprises: and acquiring an operation code of the chip code according to the quality detection instruction, wherein the operation code is constructed in an instruction form.
Executing code cutting on the running codes to obtain a plurality of sub-codes, and generating detection nodes by taking each sub-code as a detection object.
And executing end-to-end connection on all the detection nodes according to the sequence of the sub-codes corresponding to the detection nodes in the operation codes to obtain a detection linked list of the operation codes, wherein the detection linked list consists of a plurality of detection nodes with sequence.
And executing grammar and semantic detection on the detection linked list based on an abstract grammar tree structure analysis method to obtain a grammar and semantic detection result of the running code, and completing static detection of the chip code.
Wherein the dynamic detection of the chip code comprises: and acquiring a test data set according to the detection linked list, wherein the data type and the data value of the test data set are all derived from a test database pre-bound with the detection linked list.
And sequentially testing the detection linked list by using the test data set to obtain a dynamic test result of the running code.
And feeding the grammar and semantic detection result and the dynamic test result back to an initiator of the quality detection instruction to finish the quality detection of the chip codes.
Optionally, the construction of the quality detection instruction includes: and receiving a detection generation instruction sent by a detection personnel of the chip code.
Triggering a chip information inquiry instruction according to the detection generation instruction, and sending the chip information inquiry instruction to a detection personnel.
And after the chip information inquiry instruction is successfully sent to the inspector, receiving chip code information filled by the inspector, wherein the chip code information comprises a chip number and a storage address of an operation code of the chip.
And packaging the chip code information to a detection generation instruction to obtain the quality detection instruction.
Optionally, the executing code cutting on the running code to obtain a plurality of sub-codes includes: and acquiring the code type of the running code, wherein the code type comprises JAVA, C language and Python.
A cut table corresponding to the code type is obtained, wherein the cut table consists of identifiers.
And executing cutting on the running code according to the identifier of the cutting table to obtain a plurality of subcodes.
Optionally, the identifier includes: a data storage class identifier, a logical operation class identifier, an arithmetic operation class identifier, a jump and return identifier, a set and reset identifier, a data output class identifier, a data call class identifier.
Optionally, the generating a detection node using each sub-code as a detection object includes: and acquiring the packaging code, wherein the packaging code is pre-bound with a test database, and the test database can provide various types of test data according to the requirements of the packaging code.
And executing encapsulation by taking each sub-code as an object of encapsulation codes to obtain the detection node.
Optionally, the performing end-to-end connection on all the detection nodes according to the sequence of the running codes of the sub-codes corresponding to the detection nodes to obtain a detection linked list of the running codes includes: and acquiring the position of the subcode corresponding to each detection node in the running code to obtain the node position.
And according to the node position of each detection node, sequencing the plurality of detection nodes to obtain a sequencing linked list.
And acquiring annotation information of the subcodes corresponding to each detection node, wherein the annotation information of the subcodes comprises input data information of the subcodes, and the input data information consists of a type identifier and a range interval of the input data.
Judging whether the input data information of each detection node is the same or not, and merging the detection nodes with the same input data information into a similar relationship.
The detection nodes which do not have the same input data information are merged into a heterogeneous relationship.
Judging whether the detection nodes of the heterogeneous relations and the detection nodes of the similar relations contain the relations with the contained relations or not according to the input data information, and merging the detection nodes of the heterogeneous relations containing the detection nodes of the similar relations or the detection nodes of the similar relations containing the detection nodes of the heterogeneous relations into the contained relations.
And adjusting the sorting linked list according to the similar relationship, the different relationship and the inclusion relationship to obtain a detection linked list.
Optionally, the adjusting the sorting linked list according to the similar relationship, the heterogeneous relationship and the inclusion relationship to obtain a detection linked list includes: judging whether the relation between two groups of detection nodes in the detection linked list is a similar relation, and if the relation is the similar relation, packaging the two groups of detection nodes into a code block to obtain a similar detection node.
And if the two groups of detection nodes are not in the same type of relation, the two groups of detection nodes are packaged separately to form mutually independent code blocks, and two different types of detection nodes are obtained respectively.
And obtaining the sequencing chain table comprising the similar detection nodes and the heterogeneous detection nodes after finishing the similar relation judgment between all the two groups of detection nodes.
Judging whether the heterogeneous detection nodes and the similar detection nodes have the containing relation or not, and generating character keywords containing the relation in the code blocks of the heterogeneous detection nodes and the similar detection nodes with the containing relation.
And obtaining the detection linked list after judging the inclusion relation of all the heterogeneous detection nodes and the similar detection nodes.
Optionally, the code amount of the detection linked list is smaller than the code amount of the running code.
Optionally, the acquiring the test data set according to the detection linked list includes: traversing all heterogeneous detection nodes and similar detection nodes in the detection linked list, wherein all heterogeneous detection nodes and similar detection nodes are divided into character keywords with inclusion relations and character keywords without inclusion relations.
And extracting detection nodes with larger range intervals from heterogeneous detection nodes and similar detection nodes with character keywords to obtain data trigger nodes.
And acquiring input data information corresponding to the data trigger node, wherein the input data information consists of a type identifier and a range interval of the input data.
And starting the test database, and generating test data which accords with the input data information of the data trigger node by using the test database to obtain first test data.
And sequentially extracting input data information of heterogeneous detection nodes and similar detection nodes without character keywords, and generating corresponding test data based on a test database to obtain second test data.
Summarizing the first test data and the second test data to obtain the test data set.
Optionally, the step of sequentially testing the detection linked list by using the test data set to obtain a dynamic test result of the running code includes: and extracting first test data and second test data from the test data set, and generating a first test case and a second test case based on the first test data and the second test data respectively.
And operating the detection linked list, when the test cases need to be called in the operation process, correspondingly calling the first test case or the second test case according to the data types needed in the detection linked list until the operation process of the detection linked list is completed, and further obtaining the dynamic test result of the operation code.
The embodiment of the invention aims to solve the problems in the background technology, and divides the quality detection of the chip codes into dynamic detection and static detection, thereby improving the detection accuracy. In detail, the static detection of the chip code includes: executing code cutting on the running codes of the chip to obtain a plurality of sub-codes, taking each sub-code as a detection object, generating detection nodes, executing end-to-end connection on all the detection nodes according to the sequence of the sub-codes corresponding to the detection nodes in the running codes to obtain a detection linked list of the running codes, and executing grammar semantic detection on the detection linked list based on an abstract grammar tree structure analysis method. Compared with the traditional method, the embodiment of the invention constructs the detection linked list according to the running code for executing the grammar semantic detection on the running code by directly utilizing the abstract grammar tree structure analysis method, and the lightweight detection linked list can be more convenient for executing the grammar semantic detection by utilizing the abstract grammar tree structure analysis method because the code quantity of the detection linked list is smaller than that of the running code in principle. Further, in order to improve the detection accuracy, the embodiment of the invention further includes dynamic detection of the chip code, which mainly includes: according to the detection linked list, a test data set is obtained, wherein the data type and the data value of the test data set are all derived from a test database which is pre-bound with the detection linked list, the detection linked list is tested sequentially by using the test data set, and a dynamic test result of an operation code is obtained. Therefore, the chip code optimizing method based on the user requirements can solve the problems that the running code of the chip code tested by the traditional method needs to call excessive testing resources, and the testing time and the resource consumption are high.
Drawings
Fig. 1 is a flowchart of a chip code optimization method based on user requirements according to an embodiment of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Referring to fig. 1, a flowchart of a method for optimizing a chip code based on user requirements according to an embodiment of the present invention is shown. In this embodiment, the method for optimizing the chip code based on the user requirement includes: s1, receiving a quality detection instruction of a chip code.
It should be explained that the quality detection instruction of the chip code is generally issued by a detector of the chip code. Moreover, it should be emphasized that the chip code in the embodiment of the present invention may be a communication chip type, and its main application is mainly used in the production of communication devices.
Further, the construction of the quality detection instruction includes: and receiving a detection generation instruction sent by a detection personnel of the chip code.
Triggering a chip information inquiry instruction according to the detection generation instruction, and sending the chip information inquiry instruction to a detection personnel.
And after the chip information inquiry instruction is successfully sent to the inspector, receiving chip code information filled by the inspector, wherein the chip code information comprises a chip number and a storage address of an operation code of the chip.
And packaging the chip code information to a detection generation instruction to obtain the quality detection instruction.
Illustratively, the sheet is taken as a detector of a certain chip code production factory, and a communication chip for mobile phone communication produced by the factory needs to be detected, wherein the communication chip mainly plays a role of generating a communication channel, so that the sheet initiates a quality detection instruction of the communication chip, and the generation process of the quality detection instruction is as described above.
S2, acquiring an operation code of the chip code according to the quality detection instruction, wherein the operation code is constructed in an instruction form.
It should be emphasized that, compared with the traditional chip code optimization method based on user requirements, the chip code optimization method based on user requirements is divided into static detection and dynamic detection according to detection logic and steps, wherein the static detection mainly detects whether the running code of the chip code has a problem or not, and the dynamic detection mainly detects whether the communication mechanism of the chip code is perfect or not.
It should be explained that the communication chip mainly depends on software and hardware to generate and receive communication signals, where the correctness of the running code of the chip has extremely high strict requirements, in other words, grammar and semantic errors cannot exist in the code, so that the static detection in the embodiment of the invention mainly detects the grammar and semantic errors of the running code of the chip code.
In addition, the code formats of the running codes currently used for the chip include a ladder diagram format and an instruction table format, wherein the instruction table format is most common in practical engineering, so that the main object of static detection in the embodiment of the invention is the running code in the instruction table format.
S3, executing code cutting on the running codes to obtain a plurality of subcodes, and generating detection nodes by taking each subcode as a detection object.
In the embodiment of the present invention, the executing code cutting on the running code to obtain a plurality of subcodes includes: and acquiring the code type of the running code, wherein the code type comprises JAVA, C language and Python.
A cut table corresponding to the code type is obtained, wherein the cut table consists of identifiers.
And executing cutting on the running code according to the identifier of the cutting table to obtain a plurality of subcodes.
It should be explained that different code types have different writing rules of different code types, such as JAVA or C language, and thus there are code differences due to the different writing rules of the code. Further, the different programming languages each correspond to a cutting table, and the identifier includes: a data storage class identifier, a logical operation class identifier, an arithmetic operation class identifier, a jump and return identifier, a set and reset identifier, a data output class identifier, a data call class identifier, and the like.
Thus, when the above-mentioned different types of identifiers appear in the running code, then cutting is sequentially performed on the running code, thereby obtaining a plurality of sub-codes.
Further, in order to more accurately determine the correctness of the running code of the chip code, the embodiment of the invention encapsulates each sub-code in turn, and detects whether the running logic of each encapsulated sub-code is complete, and in detail, the generating a detection node by using each sub-code as a detection object includes: and acquiring the packaging code, wherein the packaging code is pre-bound with a test database, and the test database can provide various types of test data according to the requirements of the packaging code.
And executing encapsulation by taking each sub-code as an object of encapsulation codes to obtain the detection node.
It can be understood that, for example, after the communication chip for mobile phone communication is cut, a plurality of subcodes are obtained, wherein one subcode is used for obtaining the position information of the mobile phone, so that the subcodes obtained by the position information are encapsulated, and the position information for testing the operation correctness of the code can be provided in the test database, thereby facilitating the static detection of the code to be executed subsequently.
And S4, executing end-to-end connection on all the detection nodes according to the sequence of the sub-codes corresponding to the detection nodes in the operation codes, and obtaining a detection linked list of the operation codes.
In detail, according to the sequence of the sub-codes corresponding to the detection nodes in the operation codes, performing end-to-end connection on all the detection nodes to obtain a detection linked list of the operation codes, including: and acquiring the position of the subcode corresponding to each detection node in the running code to obtain the node position.
And according to the node position of each detection node, sequencing the plurality of detection nodes to obtain a sequencing linked list.
And acquiring annotation information of the subcodes corresponding to each detection node, wherein the annotation information of the subcodes comprises input data information of the subcodes, and the input data information consists of a type identifier and a range interval of the input data.
Judging whether the input data information of each detection node is the same or not, and merging the detection nodes with the same input data information into a similar relationship.
The detection nodes which do not have the same input data information are merged into a heterogeneous relationship.
Judging whether the detection nodes of the heterogeneous relations and the detection nodes of the similar relations contain the relations with the contained relations or not according to the input data information, and merging the detection nodes of the heterogeneous relations containing the detection nodes of the similar relations or the detection nodes of the similar relations containing the detection nodes of the heterogeneous relations into the contained relations.
And adjusting the sorting linked list according to the similar relationship, the different relationship and the inclusion relationship to obtain a detection linked list.
The communication chip for mobile phone communication is provided with 10 detection nodes, so that an ordering linked list is constructed according to the positions of subcodes corresponding to the 10 detection nodes in the running code of the communication chip. It can be understood that the similarity between the sequencing chain table of the communication chip and the running code of the communication chip is higher, and the difference is that the sequencing chain table of the communication chip is bound with the test database, and the encapsulation operation is performed through the encapsulation code.
In order to improve the test efficiency of the running codes, the embodiment of the invention adjusts the ordering linked list through annotation information. For example, if the input data information of the 1 st detection node is the integer data of the double-tuple type, and the range interval of the data is 10-100, the input data information of the 2 nd detection node is the character type of the single data, the limitation of the data range is not existed, the 3 rd detection node is the same as the 1 st detection node, the input data information is also the integer data of the double-tuple type, and the range interval of the data is 10-100, the input data information of the 4 th detection node is the character type of the single data, but the input data information of the 5 th detection node is limited to the character type data of the 5 th byte, the input data information of the 5 th detection node can be the integer data of the double-tuple type, the character type data of the single data can be also exist, and the limitation of the data range is not existed. Therefore, according to the above description, the 3 rd detection node and the 1 st detection node are in the same type of relationship, the 2 nd detection node, the 4 th detection node and the 5 th detection node are in different type of relationship with the 3 rd detection node and the 1 st detection node, and according to the input data type of the 5 th detection node, the data range of the 5 th detection node is wider, so that the 3 rd detection node and the 1 st detection node of the 5 th detection node and the same type of relationship belong to the inclusion relationship.
Further, the step of adjusting the sorting linked list according to the similar relationship, the heterogeneous relationship and the inclusion relationship to obtain a detection linked list includes: judging whether the relation between two groups of detection nodes in the detection linked list is a similar relation, and if the relation is the similar relation, packaging the two groups of detection nodes into a code block to obtain a similar detection node.
And if the two groups of detection nodes are not in the same type of relation, the two groups of detection nodes are packaged separately to form mutually independent code blocks, and two different types of detection nodes are obtained respectively.
And obtaining the sequencing chain table comprising the similar detection nodes and the heterogeneous detection nodes after finishing the similar relation judgment between all the two groups of detection nodes.
Judging whether the heterogeneous detection nodes and the similar detection nodes have the containing relation or not, and generating character keywords containing the relation in the code blocks of the heterogeneous detection nodes and the similar detection nodes with the containing relation.
And obtaining the detection linked list after judging the inclusion relation of all the heterogeneous detection nodes and the similar detection nodes.
For example, the 3 rd detection node and the 1 st detection node are in the same kind of relation, and thus are packaged into a code block to obtain a same kind of detection node, in addition, the 2 nd detection node, the 4 th detection node and the 5 th detection node are all packaged into different kinds of detection nodes, while the 5 th detection node is also different kinds of detection nodes, but is in a containing relation with the 3 rd detection node and the 1 st detection node, so that the different kinds of detection nodes corresponding to the 5 th detection node, and the 3 rd detection node and the 1 st detection node are packaged to obtain the same kind of detection node to generate character keywords containing relation.
According to the description, the sorting chain table is composed of a plurality of detecting nodes with sequence, but the sequence among the detecting nodes of the sorting chain table is the same as the sequence of the sub-codes corresponding to the detecting nodes in the running code. That is, the detection linked list does not change the running logic of the running code compared with the original running code, but optimizes and reduces the code itself, thereby reducing the testing pressure caused by code redundancy in the testing process, that is, the code quantity of the detection linked list is smaller than that of the running code.
S5, executing grammar and semantic detection on the detection linked list based on an abstract grammar tree structure analysis method to obtain a grammar and semantic detection result of the operation code.
It should be noted that, the abstract syntax tree structure analysis method is a disclosed technology, and will not be described herein. Compared with the traditional abstract syntax tree structure analysis method, the structure analysis object of the embodiment of the invention is not the running code of the chip, but the detection linked list constructed by the similar relations, the different relations and the containing relations, as described above, the detection linked list is lighter than the running code, so that the detection speed of syntax semantic detection can be effectively improved.
S6, acquiring a test data set according to the detection linked list, wherein the data type and the data value of the test data set are all derived from a test database which is pre-bound with the detection linked list.
It should be explained that, in the embodiment of the present invention, when performing the dynamic test, all the test data sets are derived from the above-mentioned test database, and in detail, the obtaining the test data sets according to the detection linked list includes:
traversing all heterogeneous detection nodes and similar detection nodes in the detection linked list, wherein all heterogeneous detection nodes and similar detection nodes are divided into character keywords with inclusion relations and character keywords without inclusion relations.
And extracting detection nodes with larger range intervals from heterogeneous detection nodes and similar detection nodes with character keywords to obtain data trigger nodes.
And acquiring input data information corresponding to the data trigger node, wherein the input data information consists of a type identifier and a range interval of the input data.
And starting the test database, and generating test data which accords with the input data information of the data trigger node by using the test database to obtain first test data.
And sequentially extracting input data information of heterogeneous detection nodes and similar detection nodes without character keywords, and generating corresponding test data based on a test database to obtain second test data.
Summarizing the first test data and the second test data to obtain the test data set.
For example, the 3 rd detection node and the 1 st detection node are packaged into the same kind of detection node, the heterogeneous detection node corresponding to the 5 th detection node and the same kind of detection node have character keywords with containing relations, and the heterogeneous detection node corresponding to the 5 th detection node comprises the 3 rd detection node and the 1 st detection node, so that input data information of the 5 th detection node is directly obtained, and corresponding test data is generated. Because the data of the 1 st, 3 rd and 5 th detection nodes have universality, the generated first test data has universality in the 1 st, 3 rd and 5 th detection nodes, and in time, the first test data can be continuously extracted to execute the test when the similar detection nodes generated by the 1 st and 3 rd detection nodes are in error due to overlarge range.
And S7, testing the detection linked list in sequence by using the test data set to obtain a dynamic test result of the running code.
It will be appreciated that the foregoing has emphasized that the sense link table does not change the operating logic of the operating code, and thus the sense link table may be operated to effect testing of the operating code. In detail, the step of sequentially testing the detection linked list by using the test data set to obtain a dynamic test result of the running code includes: and extracting first test data and second test data from the test data set, and generating a first test case and a second test case based on the first test data and the second test data respectively.
And operating the detection linked list, when the test cases need to be called in the operation process, correspondingly calling the first test case or the second test case according to the data types needed in the detection linked list until the operation process of the detection linked list is completed, and further obtaining the dynamic test result of the operation code.
It can be understood that the detection linked list is a lightweight operation code, the operation code is mainly optimized structurally by the change of the detection linked list, and test data is prepared in advance according to the data type and the data range required by the detection linked list in the data calling process, so that the whole dynamic test process is faster than the traditional test speed.
And S8, feeding back the grammar and semantic detection result and the dynamic test result to a quality detection instruction to finish quality detection of the chip codes.
The embodiment of the invention aims to solve the problems in the background technology, and divides the quality detection of the chip codes into dynamic detection and static detection, thereby improving the detection accuracy. In detail, the static detection of the chip code includes: executing code cutting on the running codes of the chip to obtain a plurality of sub-codes, taking each sub-code as a detection object, generating detection nodes, executing end-to-end connection on all the detection nodes according to the sequence of the sub-codes corresponding to the detection nodes in the running codes to obtain a detection linked list of the running codes, and executing grammar semantic detection on the detection linked list based on an abstract grammar tree structure analysis method. Compared with the traditional method, the embodiment of the invention constructs the detection linked list according to the running code for executing the grammar semantic detection on the running code by directly utilizing the abstract grammar tree structure analysis method, and the lightweight detection linked list can be more convenient for executing the grammar semantic detection by utilizing the abstract grammar tree structure analysis method because the code quantity of the detection linked list is smaller than that of the running code in principle. Further, in order to improve the detection accuracy, the embodiment of the invention further includes dynamic detection of the chip code, which mainly includes: according to the detection linked list, a test data set is obtained, wherein the data type and the data value of the test data set are all derived from a test database which is pre-bound with the detection linked list, the detection linked list is tested sequentially by using the test data set, and a dynamic test result of an operation code is obtained. Therefore, the chip code optimizing method based on the user requirements can solve the problems that the running code of the chip code tested by the traditional method needs to call excessive testing resources, and the testing time and the resource consumption are high.
Finally, it should be noted that the above-mentioned embodiments are merely for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications and equivalents may be made to the technical solution of the present invention without departing from the spirit and scope of the technical solution of the present invention.

Claims (6)

1. A method for optimizing a chip code based on user requirements, the method comprising:
receiving a quality detection instruction of a chip code;
the construction of the quality detection instruction comprises the following steps:
receiving a detection generation instruction sent by a detector of the chip code;
triggering a chip information inquiry instruction according to the detection generation instruction, and sending the chip information inquiry instruction to a detector;
after the chip information inquiry instruction is successfully sent to the inspector, receiving chip code information filled by the inspector, wherein the chip code information comprises a chip number and a storage address of an operation code of the chip;
packaging the chip code information to a detection generation instruction to obtain the quality detection instruction;
and performing static detection and dynamic detection on the quality of the chip code according to the quality detection instruction, wherein the static detection on the chip code comprises the following steps:
acquiring an operation code of a chip code according to the quality detection instruction, wherein the operation code is constructed in an instruction form;
executing code cutting on the running code to obtain a plurality of subcodes, and taking each subcode as a detection object to generate a detection node;
according to the sequence of the sub-codes corresponding to the detection nodes in the operation codes, performing end-to-end connection on all the detection nodes to obtain a detection linked list of the operation codes, wherein the detection linked list consists of a plurality of detection nodes with sequence;
executing end-to-end connection on all detection nodes according to the sequence of the sub-codes corresponding to the detection nodes in the operation codes to obtain a detection linked list of the operation codes, wherein the method comprises the following steps:
acquiring the position of a sub-code corresponding to each detection node in the running code to obtain the node position;
according to the node position of each detection node, sequencing a plurality of detection nodes to obtain a sequencing chain table;
the method comprises the steps of obtaining annotation information of sub codes corresponding to each detection node, wherein the annotation information of the sub codes comprises input data information of the sub codes, and the input data information comprises a type identifier and a range interval of input data;
judging whether the input data information of each detection node is the same or not, and merging the detection nodes with the same input data information into a similar relationship;
merging the detection nodes which do not have the same input data information into a heterogeneous relationship;
judging whether the detection nodes of the heterogeneous relations and the detection nodes of the similar relations contain the relations with the contained relations or not according to the input data information, and merging the detection nodes of the heterogeneous relations containing the detection nodes of the similar relations or a plurality of detection nodes of the similar relations containing the detection nodes of the heterogeneous relations into the contained relations;
the sorting linked list is adjusted according to the similar relationship, the different relationship and the containing relationship, and a detection linked list is obtained;
executing grammar semantic detection on the detection linked list based on an abstract grammar tree structure analysis method to obtain a grammar semantic detection result of an operation code, and completing static detection of the chip code;
wherein the dynamic detection of the chip code comprises:
acquiring a test data set according to the detection linked list, wherein the data type and the data value of the test data set are all derived from a test database pre-bound with the detection linked list;
sequentially testing the detection linked list by using the test data set to obtain a dynamic test result of the running code;
and feeding the grammar and semantic detection result and the dynamic test result back to an initiator of the quality detection instruction to finish the quality detection of the chip codes.
2. The method for optimizing chip code based on user requirements according to claim 1, wherein said performing code cutting on said running code to obtain a plurality of subcodes comprises:
acquiring the code type of the running code, wherein the code type comprises JAVA, C language and Python;
acquiring a cutting table corresponding to the code type, wherein the cutting table consists of identifiers;
and executing cutting on the running code according to the identifier of the cutting table to obtain a plurality of subcodes.
3. The user demand based chip code optimization method of claim 2, wherein the identifier comprises: a data storage class identifier, a logical operation class identifier, an arithmetic operation class identifier, a jump and return identifier, a set and reset identifier, a data output class identifier, a data call class identifier.
4. The method for optimizing chip code based on user requirements as claimed in claim 3, wherein said generating a detection node using each sub-code as a detection object comprises:
acquiring an encapsulation code, wherein the encapsulation code is pre-bound with a test database, and the test database can provide various types of test data according to the requirement of the encapsulation code;
and executing encapsulation by taking each sub-code as an object of encapsulation codes to obtain the detection node.
5. The method for optimizing chip codes based on user requirements according to claim 4, wherein said adjusting said sorting linked list according to the like relationship, the heterogeneous relationship and the inclusion relationship to obtain a detection linked list comprises:
judging whether the relation between two groups of detection nodes in the detection linked list is a similar relation, and if the relation is the similar relation, packaging the two groups of detection nodes into a code block to obtain a similar detection node;
if the two groups of detection nodes are not in the same type of relation, the two groups of detection nodes are packaged separately to be mutually independent code blocks, and two different types of detection nodes are obtained respectively;
obtaining an ordering linked list comprising similar detection nodes and heterogeneous detection nodes after finishing the similar relation judgment between all two groups of detection nodes;
judging whether the heterogeneous detection nodes and the similar detection nodes have a containing relation or not, and generating character keywords containing the relation in code blocks of the heterogeneous detection nodes and the similar detection nodes with the containing relation;
and obtaining the detection linked list after judging the inclusion relation of all the heterogeneous detection nodes and the similar detection nodes.
6. The method for optimizing chip code based on user's demand according to claim 5, wherein the code amount of the detection linked list is smaller than the code amount of the running code.
CN202310401751.3A 2023-04-17 2023-04-17 Chip code optimization method based on user requirements Active CN116126736B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310401751.3A CN116126736B (en) 2023-04-17 2023-04-17 Chip code optimization method based on user requirements

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310401751.3A CN116126736B (en) 2023-04-17 2023-04-17 Chip code optimization method based on user requirements

Publications (2)

Publication Number Publication Date
CN116126736A CN116126736A (en) 2023-05-16
CN116126736B true CN116126736B (en) 2023-07-07

Family

ID=86303109

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310401751.3A Active CN116126736B (en) 2023-04-17 2023-04-17 Chip code optimization method based on user requirements

Country Status (1)

Country Link
CN (1) CN116126736B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033489A (en) * 2022-06-24 2022-09-09 平安普惠企业管理有限公司 Code resource detection method and device, electronic equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5966537A (en) * 1997-05-28 1999-10-12 Sun Microsystems, Inc. Method and apparatus for dynamically optimizing an executable computer program using input data
US11151018B2 (en) * 2018-04-13 2021-10-19 Baidu Usa Llc Method and apparatus for testing a code file
CN114510409A (en) * 2020-11-17 2022-05-17 腾讯科技(深圳)有限公司 Application program code detection method and computer readable storage medium
CN113778890B (en) * 2021-09-16 2023-06-30 平安银行股份有限公司 Code testing method and device, electronic equipment and storage medium
CN115481396A (en) * 2022-08-29 2022-12-16 中国科学院信息工程研究所 NC code abnormality detection method, device, equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033489A (en) * 2022-06-24 2022-09-09 平安普惠企业管理有限公司 Code resource detection method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN116126736A (en) 2023-05-16

Similar Documents

Publication Publication Date Title
CN110196719B (en) Business rule generation method and system based on natural language processing
CN107273286B (en) Scene automatic test platform and method for task application
CN109033843B (en) Java file dependency analysis method and module for distributed static detection system
CN106777101B (en) Data processing engine
CN109460219B (en) Method for quickly serializing interface control file
CN111104106A (en) Visual development method, system and medium for integrating business process and communication message
CN102360336B (en) Automatic testing system based on grammatical rules and method
CN110502227B (en) Code complement method and device, storage medium and electronic equipment
CN101206467A (en) Universal numerical control code analysis method
CN111782265A (en) Software resource system based on field level blood relationship and establishment method thereof
CN111694547A (en) Automatic coding data processing application design tool based on data state change
CN116450616A (en) General heterogeneous relational database SQL migration method based on parse tree
CN116126736B (en) Chip code optimization method based on user requirements
CN111176660A (en) Distributed architecture-oriented micro-service contract management method and device, computer equipment and readable storage medium
CN108897678B (en) Static code detection method, static code detection system and storage device
CN110941655A (en) Data format conversion method and device
CN111913704A (en) VScode-based method for rapidly developing GSP7 script and plug-in tool
CN116302919A (en) Multi-language extensible code dependency analysis model and analysis method
US20090064092A1 (en) Visual programming language optimization
CN102486731B (en) Strengthen the visualization method of the call stack of software of software, equipment and system
CN115080011B (en) Code generation method and system based on abstract syntax tree
CN113535758B (en) Big data system and method for converting traditional database scripts into cloud in batch
CN116450246A (en) Event stream configurable method based on state machine
CN115348148A (en) Alarm compression processing method for composite condition
CN111176993A (en) Code static detection method based on abstract syntax tree

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