Adaptive Signal Annotation Method, Electronic Device, and Medium

By placing annotation information according to the starting position and length of the signal value in the signal annotation method, and optimizing the arrangement of annotation lines using preset separators, the problem of low utilization efficiency of signal annotation space in the prior art is solved, and a more efficient and beautiful signal annotation effect is achieved.

CN119918482BActive Publication Date: 2025-05-30成都融见软件科技有限公司 +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510414166.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-03
Publication Date
2025-05-30
Estimated Expiration
2045-04-03

AI Technical Summary

Technical Problem

The existing signal annotation methods are low in space utilization efficiency, poor in rationality, and not beautiful enough. Especially when the signal annotation text is long, it is easy to have incomplete display or occupy a large amount of space.

Method used

By obtaining the signal value of the signal to be annotated in the code line to be annotated one by one, placing the signal annotation information in one or more annotation lines according to the starting position and length of the signal value, reducing the number of annotation information required to be truncated, and optimizing the arrangement of annotation lines by preset separating characters.

Benefits of technology

This improves the space utilization efficiency of signal annotations, makes the annotation information clearer and more beautiful, reduces the number of annotation information that needs to be cut off, and avoids the problem of annotation lines occupying too much space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918482B_ABST
    Figure CN119918482B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and in particular, to an adaptive signal annotation method, an electronic device, and a medium. The method includes: S1. Obtain a list of signals to be annotated; S2. Set M strings, initially set n = 1 and m = 1; S3. Obtain V n , if it is empty, execute S8, otherwise, obtain B n , and execute S4; S4. If L m ≥B n −1, then execute S5, otherwise, execute S7; S5. If m < M, then set m = m + 1 and return to execute S4. If m = M, then execute S6; S6. Truncate R1 to the position of B n −2, and set m = 1; S7. First, fill R m with a preset delimiter character to the position of B n −1, and then set R m =R m +V n , and execute S8; S8. If n
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to an adaptive signal annotation method, an electronic device, and a medium. Background Art

[0002] In Electronic Design Automation (EDA) software, in order to quickly obtain the values of design signals at different simulation times in the source code view, a method of inserting signal value annotations in the source code view is usually adopted. Signal annotations are generally inserted above or below the code line where the signal name of the original design code is located to improve readability. Usually, a relatively large number of signal names with a relatively close physical space distance need to be annotated in one line of code. Since the text length of the signal annotation is different from the length of the original signal name, when the signal annotation text is long, if a single-line annotation content is used, it is easy to have the problem that the annotation text is not fully displayed. If a multi-line annotation method is used, it may cause the annotation lines within the visible range to occupy a large amount of space, squeezing the display space of the original design code. Therefore, the existing signal annotation method has low space utilization efficiency, poor rationality, and is not very beautiful. Summary of the Invention

[0003] The object of the present invention is to provide an adaptive signal annotation method, an electronic device, and a medium, which can effectively improve the space utilization efficiency of signal annotations and make the signal annotations more reasonable and beautiful.

[0004] The first aspect of the present invention provides an adaptive signal annotation method, including:

[0005] Step S1, obtaining a list of signals to be annotated {A 1 , A 2 , …, A n , …, A N}, where A n is the nth signal to be annotated in the code line to be annotated, the value range of n is from 1 to N, and A 1 , A 2 , …, A n , …, A N are arranged in the order in which they appear in the code line to be annotated;

[0006] Step S2, setting M strings {R 1 , R 2 , …, R m , …, R M}, where R m is the mth string, the value range of m is from 1 to M, M is the maximum number of annotation lines, and each R m is initially empty. Initially, n = 1 and m = 1 are set;

[0007] Step S3: Obtain the signal value V of A n of A n , if V n is empty, then execute Step S8, otherwise, obtain the starting position B of the text column of A n of A n , and execute Step S4;

[0008] Step S4: Compare the length L of the current R m of R m with B n -1. If L m ≥ B n -1, then execute Step S5, otherwise, execute Step S7;

[0009] Step S5: If m < M, then set m = m + 1 and return to execute Step S4. If m = M, then execute Step S6;

[0010] Step S6: Truncate R to the position of B 1 -2, and set m = 1; n -2, and set m = 1;

[0011] Step S7: First, fill R with the preset delimiter character to the position of B m -1, and then set R n = R m + V m ; n ;

[0012] Step S8: If n < N, then set n = n + 1, m = 1, and return to execute Step S3. Otherwise, execute Step S9;

[0013] Step S9: Based on the current {R 1 , R 2 , …, R m , …, R M}, display the signal annotation of the to-be-annotated code line on the source code interface. Each non-empty R m occupies a code line, and the smaller the m value, the closer the line corresponding to R m is to the to-be-annotated code line.

[0014] The second aspect of the present invention provides an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the first aspect of the present invention.

[0015] A third aspect of the present invention provides a computer-readable storage medium storing computer-executable instructions for executing the method described in the first aspect of the present invention.

[0016] The present invention has obvious advantages and beneficial effects compared with the prior art. By means of the above technical solutions, an adaptive signal annotation method, an electronic device, and a medium provided by the present invention can achieve considerable technological progressiveness and practicality, and have wide industrial utilization value. It has at least the following beneficial effects:

[0017] By obtaining the signal values of the signals to be annotated in the code lines to be annotated one by one, and placing the signal annotation information in one or more annotation lines according to the start position and length of the signal values, the present invention reduces the number of annotation information that needs to be truncated, improves the utilization efficiency of the annotation space, and makes the displayed annotation information clearer and more beautiful. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0019] Figure 1 It is a flowchart of the adaptive signal annotation method provided by the embodiment of the present invention;

[0020] Figure 2 It is a schematic diagram of the adaptive signal annotation display provided by the embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0021] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0022] An embodiment of the present invention provides an adaptive signal annotation method, as Figure 1 shown, including:

[0023] Step S1, obtaining a list of signals to be annotated {A 1 , A 2 , …, A n , …, A N} in the code line to be annotated, where A n is the nth signal to be annotated in the code line to be annotated, the value range of n is from 1 to N, and A1 , A 2 , …, A n , …, A N Arrange in the order of appearance in the code line to be annotated.

[0024] Among them, the code line to be annotated can be any line of code in the source code that contains the signal to be annotated, and the signal to be annotated is the signal for which the signal value needs to be displayed.

[0025] Step S2: Set M strings {R 1 , R 2 , …, R m , …, R M}, where R m is the m-th string, the value range of m is from 1 to M, M is the maximum number of annotation lines, and each R m is initially empty, initially set n = 1, m = 1.

[0026] Among them, R m is used to store the annotation information of the m-th line of the code line to be annotated, and each R m is initially empty. The number of annotation lines that the code line to be annotated finally needs to present changes adaptively according to the required annotation information, but the maximum number of annotation lines cannot exceed M.

[0027] Step S3: Obtain the signal value V n of A n . If V n is empty, execute Step S8; otherwise, obtain the starting position B n of the text column of A n , and execute Step S4.

[0028] Among them, if the signal value V n of A n is empty, it means that the signal value of A n at the current moment is empty, and there is no need to annotate. Just operate on the next signal to be annotated directly.

[0029] Step S4: Compare the length L m of the current R m with B n -1. If L m ≥ B n -1, execute Step S5; otherwise, execute Step S7.

[0030] Among them, the smaller the value of m, the R mWhen the corresponding line is displayed on the source code interface, the closer it is to the line of code to be annotated. Therefore, try to place the annotation information as close as possible to the line of code to be annotated. So, start the judgment from m = 1. It should be noted that in the same annotation line, there should be at least one character interval between two adjacent signal annotation information to clearly display the annotation information. Therefore, it is necessary to judge L m ≥B n -1, rather than L m ≥B n 。If L m ≥B n -1, it means that if V n is directly placed in R m , then part of the content of V n will be blocked by the existing content in R m . Therefore, it is necessary to judge whether the next R m meets the placement requirements.

[0031] Step S5: If m < M, then set m = m + 1 and return to execute Step S4. If m = M, then execute Step S6.

[0032] Among them, if m = M, it means that there is currently no R m that meets the condition of directly placing V n . In this case, it is necessary to truncate the R 1 closest to the line of code to be annotated and place V n in R 1 .

[0033] Step S6: Truncate R 1 to the position of B n -2 and set m = 1.

[0034] Step S7: First, fill R m with the preset delimiter character to the position of B n -1, and then set R m = R m + V n .

[0035] It should be noted that by filling R m with the preset delimiter character to the position of B n -1, the starting position of the text column of each signal in the annotation line is aligned with the starting position of the text column of the signal to be annotated, and it can ensure that there is an interval of one character between the annotation information of two adjacent signals in the same annotation line to clearly display the annotation information. The preset delimiter character can be specifically set as a space character.

[0036] Step S8: If n < N, then set n = n + 1, m = 1, and return to execute Step S3. Otherwise, execute Step S9.

[0037] Step S9. Based on the current {R 1 , R 2 , …, R m , …, R M}, display the signal annotation of the to-be-annotated code line on the source code interface. Each non-empty R m occupies one code line, and the smaller the value of m, the closer the corresponding line is to the to-be-annotated code line. m

[0038] Among them, each non-empty R m occupies one code line to form an annotation line. It should be noted that the empty R m does not generate an annotation line on the source code interface, that is, the total number of the last non-empty R m is the number of annotation lines of the to-be-annotated code line.

[0039] In order to prevent the signal values of some to-be-annotated signals from being too long and affecting the distribution of the signal values of other to-be-annotated signals, for the signal values of the to-be-annotated signals that are too long, a truncation operation can be performed in advance. As an embodiment, in step S3, if V n is not empty, before executing step S4, it is also necessary to execute:

[0040] Step S31. Compare the length P n of V n with a preset length threshold Q. If P n > Q, then truncate V n to the length of Q.

[0041] Through step S31, the length of the signal value of each to-be-annotated signal presented in the annotation line is within Q.

[0042] As an embodiment, in step S31, truncating V n to the length of Q includes:

[0043] Step S311. Store the original V n in a preset cache area, then delete the Qth and subsequent characters in V n , and set the Qth character in V n to a preset truncation character.

[0044] It should be noted that truncating V n to the length of Q only presents the truncated V n in the directly presented annotation line, but at the same time, the original V n also needs to be stored in the preset cache area. When the original V n ​When, it is obtained and displayed from the preset cache area. The specific preset truncation identifier may be " ", it can be understood that other identifiers can also be set as the truncation identifier.

[0045] Similarly, when performing the truncation operation in step S6, it is also necessary to ensure that the original value of the truncated signal value is stored in the preset cache area. The step S6 includes:

[0046] Step S61, determine whether the preset truncation identifier already exists in the last signal value in the current R 1 . If so, execute step S63; otherwise, execute step S62.

[0047] Among them, if the preset truncation identifier already exists in the last signal value in the current R 1 , it indicates that the truncation operation has been performed on the last signal value in R 1 . The original value of the last signal value in R 1 has already been stored in the preset cache area. Therefore, the second-stage operation can be directly continued without repeatedly storing the original value of the last signal value in R 1 in the preset cache area. If the preset truncation identifier does not exist in the last signal value in the current R 1 , it is necessary to first store the original value of the last signal value in R 1 in the preset cache area, and then perform the stage operation.

[0048] Step S62, store the original value of the last signal value in the current R 1 in the preset cache area, and execute step S63.

[0049] Step S63, delete the characters with column numbers B 1 -2 and column numbers greater than B n -2 in the current R n , and set the character with column number B 1 -2 in R n to the preset truncation character.

[0050] As an embodiment, the step S9 includes:

[0051] Step S91, initialize the signal annotation string W of the line of code to be annotated as empty, initialize m = 1, and execute step S92.

[0052] Step S92, determine whether R m is an empty string. If so, execute step S95; otherwise, execute step S93.

[0053] Step S93, determine whether W is empty. If it is empty, set W = R m, otherwise, set W = W + line break + R m , execute step S94.

[0054] Step S94: If m < M, then set m = m + 1, return and execute step S92; otherwise, execute step S95.

[0055] Step S95: Generate W below the code line to be annotated in the source code interface.

[0056] It should be noted that through steps S91 - S95, the non-empty R of the code line to be annotated m can be concatenated into a signal annotation string W, and line breaks during display are achieved through line breaks, realizing multi-line display of the annotation information of the code line to be annotated.

[0057] As an embodiment, after step S6, it further includes:

[0058] Step C7: Trigger a preset truncation identifier, obtain the target signal identifier corresponding to the triggered preset truncation identifier, obtain the target original signal value corresponding to the target signal identifier in the preset cache area, and present the target original signal value in the source code interface.

[0059] Among them, specifically, the preset truncation identifier can be clicked and selected in the source code interface, and the target original signal value corresponding to the target signal identifier can be obtained from the preset cache area for presentation.

[0060] As a specific example, the code line to be processed is "int s1,t,s,s4,s5,s6,s7,s8,s9;", and the signal annotation list {A 1 ,A 2 ,…,A n ,…,A N}={t,s,s4,s5,s6,s7,s8,s9} in the code line to be annotated. The signal annotation results presented by executing steps S1 - S6 are as Figure 2 shown. The annotation information of each signal is aligned with the starting position of the signal column. After processing through steps S1 - S6, the annotation information of signal S1 is "5f6d7 ", which is displayed in the first annotation line of the code line to be processed, is the preset truncation identifier. The annotation information of t is "45339bbf", which is displayed in the second annotation line of the code line to be processed. The annotation information of signal "s" is "41ec5fff", which is displayed in the third annotation line of the code line to be processed. The annotation information of signal "s4" is "4 ", which is displayed in the first annotation line of the code line to be processed, is a preset truncation identifier. The annotation information of signal "s5" is "41a0d80f", which is displayed in the second annotation line of the code line to be processed. The annotation information of signal "s6" is "41a02c2f", which is displayed in the second annotation line of the code line to be processed. The annotation information of signal "s7" is "41a016b3", which is displayed in the third annotation line of the code line to be processed. The annotation information of signal "s8" is "41a014f1", which is displayed in the first annotation line of the code line to be processed. The annotation information of signal "S9" is "41a014c4", which is displayed in the second annotation line of the code line to be processed. Based on the method described in the embodiments of the present invention, only two of the eight signals to be annotated perform truncation operations, which satisfies that the annotation information of all signals does not overlap, greatly reducing the number of signal annotation information that needs to be truncated in the case of only one line of display, and making the display more intuitive and more beautiful.

[0061] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts depict the steps as sequential processes, many of the steps can be performed in parallel, concurrently, or simultaneously. In addition, the order of the steps can be rearranged. The process can be terminated when its operations are completed, but it can also have additional steps not included in the figures. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0062] The embodiments of the present invention also provide an electronic device, including: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method described in the embodiments of the present invention.

[0063] The embodiments of the present invention also provide a computer-readable storage medium storing computer-executable instructions, and the computer instructions are used to execute the method described in the embodiments of the present invention.

[0064] In the embodiments of the present invention, by obtaining the signal values of the signals to be annotated in the code lines to be annotated one by one, and placing the signal annotation information in one or more annotation lines according to the start position and length of the signal values, the number of annotation information that needs to be truncated is reduced, the utilization efficiency of the annotation space is improved, and the displayed annotation information is clearer and more beautiful.

[0065] The above are only the preferred embodiments of the present invention, and do not impose any form of limitation on the present invention. Although the present invention has been disclosed above with the preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some changes or modifications to equivalent embodiments by using the disclosed technical content within the scope of the technical solution of the present invention. However, as long as it does not depart from the content of the technical solution of the present invention, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention still fall within the scope of the technical solution of the present invention.

Claims

1. An adaptive signal annotation method, characterized in that: Including: Step S1, obtain the list of signals to be annotated in the code line to be annotated {A1, A2, ..., A n ,…,A N },A n is the nth signal to be annotated in the code line to be annotated, where n ranges from 1 to N, A1, A2, …, A n ,…,A N Arrange them in the order of the lines of code to be annotated; Step S2: Set M strings {R1, R2, ..., R m ,…,R M }, R m is the mth string, the value range of m is 1 to M, M is the maximum number of annotation lines, and each R m Initially empty, n=1, m=1 are set initially; Step S3: Get A n The signal value V n , if V n If it is empty, execute step S8, otherwise, obtain A n The text column starts at position B n , execute step S4; Step S4: Compare the current R m Length L m and B n -1, if L m ≥B n -1, then execute step S5, otherwise, execute step S7; Step S5: If m < M, set m = m + 1 and return to execute Step S4; if m = M, execute Step S6; Step S6: truncate R1 to B n -2 position; Step S7: First, R m Fill the default separator character to B n -1 position, then set R m =R m +V n ; Step S8: If n < N, set n = n + 1, m = 1, and return to execute Step S3; otherwise, execute Step S9; Step S9: Based on the current {R1, R2, ..., R m ,…,R M } Display the signal annotation of the code line to be annotated on the source code interface, and each non-empty R m It occupies one code line, and the smaller the m value is, the closer the line corresponding to R is to the code line to be annotated.

2. The method according to claim 1, wherein In step S3, if V n is not empty. Before executing step S4, you need to execute: Step S31: Compare V n The length P n and the preset length threshold Q, if P n >Q, then V n Truncated to the length of Q.

3. The method according to claim 2, wherein In step S31, V n Truncated to the length of Q, inclusive: Step S311: convert the original V n Stored in the preset cache area, and then V n Delete the Qth and subsequent characters in V n The Qth character in is set as the preset truncation character.

4. The method according to claim 3, wherein The said Step S6 includes: Step S61: Judge whether a preset truncation identifier exists in the last signal value in the current R1. If so, execute Step S63; otherwise, execute Step S62; Step S62: Store the original value of the last signal value in the current R1 in a preset cache area and execute Step S63; Step S63: set the column number of the current R1 to B n -2 and the column number is greater than B n -2 characters are deleted, and the column number B in R1 is n The character -2 is set as the default truncation character.

5. The method according to claim 1, wherein The said Step S9 includes: Step S91: Initialize the signal annotation string W of the code line to be annotated as empty, initialize m = 1, and execute Step S92; Step S92: Determine R m Is it an empty string? If so, execute step S95; otherwise, execute step S93; Step S93: Determine whether W is empty. If so, set W=R. m Otherwise, set W=W+newline+R m , execute step S94; Step S94: If m < M, set m = m + 1 and return to execute Step S92; otherwise, execute Step S95; Step S95: Generate W below the code line to be annotated in the source code interface.

6. The method according to claim 3 or 4, wherein Step C7: Trigger a preset truncation identifier, obtain the target signal identifier corresponding to the triggered preset truncation identifier, obtain the target original signal value corresponding to the target signal identifier in the preset cache area, and present the target original signal value in the source code interface.

7. An electronic device, characterized in that: Including: At least one processor; And a memory communicatively connected to the at least one processor; Wherein, the memory stores instructions executable by the at least one processor, and the instructions are configured to execute the method according to any one of the foregoing claims 1-6.

8. A computer-readable storage medium, characterized in that: Store computer-executable instructions for executing the method according to any one of the foregoing claims 1-6.

Citation Information

Patent Citations

  • Source code processing method and device

    CN104699467A

  • Adaptive display method for chip design code annotations, electronic equipment and medium

    CN117236270A