A method for wildcard matching signal hierarchy names based on modules
Patent Information
- Application Number
- CN202610843792.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-11
- Publication Date
- 2026-09-01
AI Technical Summary
如果对同一模块实例化得到的各个实例对应的信号层级名称均按照现有技术中的匹配查找方法一一进行全面匹配,那么匹配工作量较大,搜索效率较低
本发明在某一实例对应的所有信号层级名称均与目标通配符匹配串不匹配的情况下,将将第一模块的标识和第一实例与目标通配符匹配串对应的第一层级匹配状态信息记录在目标表格里,其中第一实例由第一模块进行实例化得到;在后续判断待匹配的信号层级名称是否与目标通配符匹配串匹配的过程中,如果待匹配的信号层级名称对应的模块名称为第一模块的名称,则获取待匹配的信号层级名称中目标实例与目标通配符匹配串对应的第二层级匹配状态信息(其中目标实例是第一模块进行实例化得到的,目标实例中信号与第一实例中信号相同),并在第二层级匹配状态信息指示的匹配位置属于所述第一层级匹配状态信息指示的匹配位置的情况下,直接判定待匹配的信号层级名称与目标通配符匹配串不匹配,无需再获取待匹配的信号层级名称中信号所在的层级对应的匹配状态。由此,本发明能够减少不必要的重复计算量,提高匹配的效率,特别适用于芯片设计中对一个模块进行较多次实例化以及对一个模块进行实例化后得到的不同实例的信号一致的场景,匹配的效率能够大大提高。
Smart Images

Figure CN122673397A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chip verification design and debugging, and in particular to a method for finding signal level names based on wildcard matching of modules. Background Technology
[0002] In chip verification design and debugging, users often need to find specific signals / instances in the design. During this process, users may not remember the complete signal / instance level name for some signals / instances, so the debugging tool needs to be able to perform fuzzy search operations. This requirement is usually achieved through wildcard (*) matching.
[0003] Chip designs in real-world projects are generally quite large and have significant overhead. In actual chip design, there are typically two characteristics: (1) the number of modules and instances may differ by tens to tens of thousands of times, meaning a single module may be instantiated tens of thousands of times; (2) the signal instances in each instance obtained from the same module are completely identical. If the signal level names corresponding to each instance obtained from the same module are fully matched one by one using existing matching and search methods, the matching workload is large and the search efficiency is low. Summary of the Invention
[0004] The purpose of this invention is to provide a module-based wildcard matching method for finding signal level names, so as to reduce the matching workload and improve search efficiency.
[0005] According to the present invention, a method for finding signal level names based on wildcard matching of modules is provided, the method comprising the following steps: S100, if all signal level names corresponding to the first instance do not match the target wildcard matching string, then the identifier of the first module and the first level matching status information of the first instance and the target wildcard matching string are appended to the target table; the first instance is obtained by instantiating the first module.
[0006] S200: Obtain the name of the signal level to be matched. If the module identifier corresponding to the name of the signal level to be matched is the identifier of the first module, proceed to S300; otherwise, determine whether the name of the signal level to be matched matches the target wildcard matching string based on the matching status of the last level string of the name of the signal level to be matched and the last level string of the target wildcard matching string.
[0007] S300: If the matching position indicated by the second-level matching status information of the target instance and the target wildcard matching string in the signal level name to be matched belongs to the matching position indicated by the first-level matching status information, then it is directly determined that the signal level name to be matched does not match the target wildcard matching string, and the signal level name to be matched is not output; otherwise, it is determined whether the signal level name to be matched matches the target wildcard matching string based on the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string, and then proceeds to S400; the target instance is obtained by instantiating the first module, and the target instance includes the same signals as the first instance.
[0008] S400: If the name of the signal level to be matched matches the target wildcard matching string, then the target table is not updated, and the name of the signal level to be matched is output.
[0009] Compared with the prior art, the present invention has at least the following beneficial effects: In the case where all signal level names corresponding to a certain instance do not match the target wildcard matching string, this invention records the identifier of the first module and the first level matching status information of the first instance and the target wildcard matching string in the target table, wherein the first instance is obtained by instantiating the first module; in the subsequent process of determining whether the signal level name to be matched matches the target wildcard matching string, if the module name corresponding to the signal level name to be matched is the name of the first module, then the second level matching status information of the target instance and the target wildcard matching string in the signal level name to be matched is obtained (where the target instance is obtained by instantiating the first module, and the signal in the target instance is the same as the signal in the first instance), and if the matching position indicated by the second level matching status information belongs to the matching position indicated by the first level matching status information, it is directly determined that the signal level name to be matched does not match the target wildcard matching string, without needing to obtain the matching status corresponding to the level where the signal in the signal level name to be matched is located. Therefore, the present invention can reduce unnecessary repetitive calculations and improve matching efficiency. It is particularly suitable for scenarios in chip design where a module is instantiated multiple times and the signals of different instances obtained after instantiating a module are consistent, and the matching efficiency can be greatly improved. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 A flowchart illustrating a module-based wildcard matching method for finding signal level names, as provided in an embodiment of the present invention. Detailed Implementation
[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0013] According to this embodiment, a method for finding signal level names based on module-based wildcard matching is provided, such as... Figure 1 As shown, the method includes the following steps: S100, if all signal level names corresponding to the first instance do not match the target wildcard matching string, then the identifier of the first module and the first level matching status information of the first instance and the target wildcard matching string are appended to the target table; the first instance is obtained by instantiating the first module.
[0014] As a specific implementation, a table is used to record the matching status of the signal level name corresponding to the first instance and the level matching string corresponding to the target wildcard. Different rows of the table represent the matching status of different level matching strings of the target wildcard, and different columns represent the matching status of different level strings of the signal level name corresponding to the first instance. The different level matching strings of the target wildcard are obtained by splitting the target wildcard, and the different level strings of the signal level name corresponding to the first instance are obtained by splitting the signal level name corresponding to the first instance. For example, when the signal level name corresponding to the first instance is top.inst1.s0, there are three split level strings: top, inst1, and s0; when the target wildcard is *.a1, there are two split level matching strings: * and a1. It should be understood that the period (.) is the separator between different levels. This embodiment coarsens the matching granularity to the hierarchical level. It does not need to focus on the matching status of each character within a hierarchy, but only needs to obtain the matching status of each hierarchy. This reduces the amount of computation and the size of the recorded data, thereby improving search efficiency and reducing the use of space resources.
[0015] In one specific implementation, the first level matching status information is a set of row numbers in the column corresponding to the first instance in the first table whose matching status is True; the first table is a table used to record the level matching status of the signal level name corresponding to the first instance and the target wildcard matching string.
[0016] In this embodiment, the value of the record in the i-th row and j-th column of the first table is v[i][j], where v[i-1][j] = vbefore[i-1][j]||v[i-1][j-1] (mstri starts with *). v[i][j]= vbefore[i][j] represents the initial matching state between the first i-th level matching string in the target wildcard matching string and the first j-th level string in the signal level name corresponding to the first instance. mstri represents the i-th level matching string in the target wildcard matching string, sstrj represents the j-th level string in the signal level name corresponding to the first instance, * represents the wildcard, false represents the non-match flag, i ranges from 1 to a, a represents the number of level matching strings included in the target wildcard matching string, j ranges from 1 to b, b represents the number of level strings included in the signal level name corresponding to the first instance, vbefore[0][j] is false, v[i][0]=false, v[0][0]=true, true represents the match flag.
[0017] As a specific implementation method, firstly according to Get vbefore[i][j]; then execute v[i][j] = based on whether mstr ends with *. This leads to v[i][j]. Finally, it checks if mstri starts with *. If mstri starts with *, then v[i-1][j]=vbefore[i-1][j]||v[i-1][j-1] is executed; if mstri does not start with *, then v[i-1][j]=vbefore[i-1][j]||v[i-1][j-1] is not executed. It should be understood that the execution of v[i-1][j]=vbefore[i-1][j]||v[i-1][j-1] when mstri starts with * is the reason why the initial matching state vbefore[i-1][j] and v[i-1][j] in the table may be different. If mstri starts with * and ends with *, then both v[i][j]=vbefore[i][j]||v[i][j-1] and v[i-1][j]=vbefore[i-1][j]||v[i-1][j-1] apply.
[0018] In this embodiment, during the construction of the first table, v[i][j] is obtained in ascending order of j followed by ascending order of i. If v[i][j] is true, it means that the first i-th level matching string in the target wildcard matching string matches the first j-th level string in the signal level name corresponding to the first instance; if v[i][j] is false, it means that the first i-th level matching string in the target wildcard matching string does not match the first j-th level string in the signal level name corresponding to the first instance. It should be understood that || is an OR operation, that is, when mstri starts with *, v[i-1][j] is T as long as at least one of vbefore[i-1][j] and v[i-1][j-1] is T; when mstri ends with *, v[i][j] is T as long as at least one of vbefore[i][j] and v[i][j-1] is T.
[0019] As a specific implementation, for example, the first instance is inst1, and all the signal level names corresponding to inst1 are top.inst1.s0, top.inst1.s1, top.inst1.s2, top.inst1.s3, top.inst1.s4, top.inst1.s5, top.inst1.s6 and top.inst1.s7. inst1 is obtained by instantiating the first module inst. The target wildcard matching string is *.a1. The matching results of the signal level names corresponding to the first instance and the target wildcard matching string are shown in Table 1.
[0020] Table 1
[0021] It should be understood that in Table 1, T is an abbreviation for true and F is an abbreviation for false. F->T indicates that the initial value is F, and then mstr1 starting with * is updated to T. The last column of the last row of Table 1 being F indicates that all signal level names (top.inst1.s0~s7) corresponding to the first instance do not match the target wildcard string (*.a1). The first-level matching status information for the first instance and the target wildcard string is {0, 1}, and the identifier of the first module is inst. Therefore, the content appended to the target table is: {inst, {0, 1}}.
[0022] S200: Obtain the name of the signal level to be matched. If the module identifier corresponding to the name of the signal level to be matched is the identifier of the first module, proceed to S300; otherwise, determine whether the name of the signal level to be matched matches the target wildcard matching string based on the matching status of the last level string of the name of the signal level to be matched and the last level string of the target wildcard matching string.
[0023] In this embodiment, the process of obtaining the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string is similar to the process of obtaining the value of the last row and last column in the first table, and will not be repeated here. Furthermore, as a preferred embodiment, in the process of obtaining the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string, the number of common prefix levels c included in the signal level name to be matched and the signal level name corresponding to the first instance is also obtained. If c ≥ 1, then in the process of obtaining the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string, v[i][j] satisfying the condition j ≤ c is taken as the matching status of the first i level string of the target wildcard matching string and the first j level string of the signal level name to be matched. Therefore, the matching status corresponding to the common prefix levels no longer needs to be calculated, realizing the reuse of the matching status corresponding to the common prefix levels, reducing the amount of computation, and improving the efficiency of determining whether the signal level name to be matched matches the target wildcard matching string.
[0024] In this embodiment, when performing a matching search, the signal level name to be matched is usually obtained by traversing all instances corresponding to the same chip design. This traversal method arranges the signal level names to be matched with the same prefix adjacent to each other (i.e., the signal level names corresponding to the same instance are arranged adjacent to each other in position), which can improve the reuse rate of the matching state corresponding to the same prefix level, reduce the amount of computation, and is more suitable for the implementation of the module-based wildcard matching method for finding signal level names in this embodiment.
[0025] In one specific implementation, the second-level matching status information is a set of row numbers in the column corresponding to the target instance in the second table that have a matching status of True; the second table is a table used to record the level matching status of the signal level name to be matched and the target wildcard matching string.
[0026] In one specific implementation, the name of the signal level to be matched is top.inst2.s0, where inst2 is also instantiated from the first module inst (meaning that inst2 and inst1 include the same signals, i.e., both include signals s0, s1, s2, s3, s4, s5, s6, and s7), and the module identifier corresponding to the name of the signal level to be matched is inst. In this case, S300 needs to be executed.
[0027] In one specific implementation, the name of the signal level to be matched is `top.diff_inst3.a1`, where `diff_inst3` is not instantiated from the first module `inst`, and the module identifier corresponding to the signal level name to be matched is not `inst`. In this case, it is necessary to determine whether the signal level name to be matched matches the target wildcard matching string based on the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string. It should be understood that a matching status of `true` indicates that the signal level name to be matched matches the target wildcard matching string, and a matching status of `false` indicates that the signal level name to be matched does not match the target wildcard matching string.
[0028] As a specific implementation, the matching results between the signal level name to be matched, top.diff_inst3.a1, and the target wildcard matching string (*.a1) are shown in Table 2.
[0029] Table 2
[0030] It should be understood that the last column of the last row of Table 2, marked with T, indicates that the signal level name to be matched, top.diff_inst3.a1, matches the target wildcard matching string (*.a1).
[0031] S300: If the matching position indicated by the second-level matching status information of the target instance and the target wildcard matching string in the signal level name to be matched belongs to the matching position indicated by the first-level matching status information, then it is directly determined that the signal level name to be matched does not match the target wildcard matching string, and the signal level name to be matched is not output; otherwise, it is determined whether the signal level name to be matched matches the target wildcard matching string based on the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string, and then proceeds to S400; the target instance is obtained by instantiating the first module, and the target instance includes the same signals as the first instance.
[0032] In this embodiment, the matching position indicated by the second-level matching status information belonging to the matching position indicated by the first-level matching status information includes: the matching position indicated by the second-level matching status information is exactly equal to the matching position indicated by the first-level matching status information, or the matching position indicated by the second-level matching status information is a subset of the matching position indicated by the first-level matching status information.
[0033] In one specific implementation, the first-level matching status information corresponding to the first instance inst1 and the target wildcard matching string is {0, 1}, the identifier of the first module is inst, and the content appended to the target table is: {inst, {0, 1}}; the name of the signal level to be matched is top.inst2.s0, and inst2 is also instantiated from the first module inst (this means that inst2 and inst1 include the same signals, i.e., both include signals s0, s1, s2, s3, s4, s5, s6, and s7), and the module identifier corresponding to the name of the signal level to be matched is inst; in this case, it is necessary to obtain the second-level matching status information corresponding to the target instance (i.e., inst2) and the target wildcard matching string in the name of the signal level to be matched. The matching results of the name of the signal level to be matched and the target wildcard matching string are shown in Table 3.
[0034] Table 3
[0035] In Table 3, the second-level matching status information corresponding to the target instance (i.e., inst2) and the target wildcard matching string is {0, 1}. This means that the matching position indicated by the second-level matching status information is equal to the matching position indicated by the first-level matching status information. In this case, it is directly determined that the signal level name to be matched does not match the target wildcard matching string. There is no need to calculate the matching status corresponding to column s0 in Table 3 (in the process of obtaining the matching status of each row and column in Table 3, the matching status of each position in the table is obtained in the order of column number increment followed by row number increment). This can reduce the amount of calculation and improve the efficiency of determining whether top.inst2.s0 matches the target wildcard matching string.
[0036] As a specific implementation, if the matching position indicated by the second-level matching status information does not belong to the matching position indicated by the first-level matching status information, for example, when the first-level matching status information is {0,1}, the second-level matching status information is {0,2}, {1,2}, or {1,2,3}; then it is still necessary to determine whether the signal level name to be matched matches the target wildcard matching string based on the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string.
[0037] S400: If the name of the signal level to be matched matches the target wildcard matching string, then the target table is not updated, and the name of the signal level to be matched is output.
[0038] In one specific implementation, S400 further includes: if the signal level name to be matched does not match the target wildcard matching string, and there are other instances instantiated by the first module whose corresponding signal level names match the target wildcard matching string, or there are other instances instantiated by the first module whose corresponding signal level names have not been matched, then the first level matching status information in the target table is replaced with third level matching status information. The matching position indicated by the third level matching status information is the union of the matching position indicated by the first level matching status information and the matching position indicated by the second level matching status information. For example, if the first level matching status information is {0,1} and the second level matching status information is {0,2}, then the third level matching status information is {0,1,2}.
[0039] In one specific implementation, S400 further includes: if the signal level name to be matched does not match the target wildcard matching string, and the signal level names corresponding to other instances instantiated by the first module do not match the target wildcard matching string, then the identifier of the previous module and the level matching status information of the instance at the level above the first instance and the target wildcard matching string are appended to the target table; wherein, the instance at the level above the first instance is instantiated by the previous module.
[0040] For example, a module inst is defined, which includes signals s0 and s1: module modinst; s0,s1; endmodule A module `top` is defined, which includes two `inst` objects: module modtop; { modinst inst1(); modinst inst1(); } The top function is instantiated twice, resulting in modtop top1() and modtop top2().
[0041] If the signal level names (top1.inst1.s0, top1.inst1.s1, top1.inst2.s0, and top1.inst2.s1) corresponding to the instances (i.e., inst1 and dinst2) instantiated from the first module inst do not match the target wildcard matching string, then the identifier of the previous module (i.e., top) and the level matching status information of the instance at the level above the first instance (e.g., top1) with the target wildcard matching string are appended to the target table. Therefore, when other signal level names (e.g., top2.inst1.s0, top2.inst1.s1, top2.inst2.s0, and top2.inst2.s1) are matched with the target wildcard matching string, since the module corresponding to this other signal level name is top, if the matching position indicated by the level matching status information corresponding to top2 and the target wildcard matching string is the same as the matching position indicated by the level matching status information corresponding to top1 and the target wildcard matching string, then it is directly determined that the other signal level name does not match the target wildcard matching string. There is no need to obtain the matching status of other levels after the level where top2 is located, thus reducing the computational load. The processing of other cases after the target table is updated is similar to the processing process of S200-S400 above, mainly the identification of the compared level and the matched module changes, which will not be elaborated here.
[0042] This embodiment can reduce unnecessary repetitive calculations and improve matching efficiency. It is particularly suitable for scenarios in chip design where a module is instantiated multiple times and the signals of different instances obtained after instantiating a module are consistent, which can greatly improve matching efficiency.
[0043] While specific embodiments of the invention have been described in detail by way of example, those skilled in the art should understand that the examples are for illustrative purposes only and not intended to limit the scope of the invention. It should also be understood that various modifications can be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims
1. A method for finding signal level names based on wildcard matching of modules, characterized in that, Includes the following steps: S100, if all signal level names corresponding to the first instance do not match the target wildcard matching string, then the identifier of the first module and the first level matching status information of the first instance and the target wildcard matching string are appended to the target table; the first instance is obtained by instantiating the first module; S200: Obtain the name of the signal level to be matched. If the module identifier corresponding to the name of the signal level to be matched is the identifier of the first module, proceed to S300. Otherwise, determine whether the name of the signal level to be matched matches the target wildcard matching string based on the matching status of the last level string of the name of the signal level to be matched and the last level string of the target wildcard matching string. S300, if the matching position indicated by the second-level matching status information of the target instance and the target wildcard matching string in the signal level name to be matched belongs to the matching position indicated by the first-level matching status information, then it is directly determined that the signal level name to be matched does not match the target wildcard matching string, and the signal level name to be matched is not output. Otherwise, based on the matching status of the last level string of the signal level name to be matched and the last level string of the target wildcard matching string, it is determined whether the signal level name to be matched matches the target wildcard matching string, and then proceeds to S400; the target instance is obtained by instantiating the first module, and the target instance includes the same signals as the first instance; S400: If the name of the signal level to be matched matches the target wildcard matching string, then the target table is not updated, and the name of the signal level to be matched is output.
2. The method for finding signal level names based on wildcard matching according to claim 1, characterized in that, S400 further includes: if the signal level name to be matched does not match the target wildcard matching string, and there are other instances instantiated by the first module whose corresponding signal level names match the target wildcard matching string, or there are other instances instantiated by the first module whose corresponding signal level names have not been matched, then the first level matching status information in the target table is replaced with the third level matching status information, wherein the matching position indicated by the third level matching status information is the union of the matching position indicated by the first level matching status information and the matching position indicated by the second level matching status information.
3. The method for finding signal level names based on wildcard matching according to claim 1, characterized in that, S400 further includes: if the signal level name to be matched does not match the target wildcard matching string, and the signal level names corresponding to other instances instantiated by the first module do not match the target wildcard matching string, then the identifier of the previous module and the level matching status information of the instance at the level above the first instance and the target wildcard matching string are appended to the target table; wherein, the instance at the level above the first instance is instantiated by the previous module.
4. The method for finding signal level names based on wildcard matching according to claim 1, characterized in that, The method further includes: recording the matching status of the signal level name corresponding to the first instance and the level matching status of the target wildcard matching string in the form of a table, wherein different rows of the table represent the matching status of different level matching strings of the target wildcard matching string, and different columns of the table represent the matching status of different level strings of the signal level name corresponding to the first instance.
5. The method for finding signal level names based on wildcard matching according to claim 4, characterized in that, The first-level matching status information is the set of row numbers in the column corresponding to the first instance in the first table whose matching status is True; the second-level matching status information is the set of row numbers in the column corresponding to the target instance in the second table whose matching status is True; wherein, the first table is a table used to record the level matching status of the signal level name corresponding to the first instance and the target wildcard matching string, and the second table is a table used to record the level matching status of the signal level name to be matched and the target wildcard matching string.
6. The method for finding signal level names based on wildcard matching according to claim 5, characterized in that, The value of the record in the i-th row and j-th column of the first table is v[i][j], where v[i-1][j] = vbefore[i-1][j] || v[i-1][j-1] (mstri starts with *). v[i][j]= vbefore[i][j] represents the initial matching state between the first i-th level matching string in the target wildcard matching string and the first j-th level string in the signal level name corresponding to the first instance. mstri represents the i-th level matching string in the target wildcard matching string, sstrj represents the j-th level string in the signal level name corresponding to the first instance, * represents the wildcard, false represents the non-match flag, i ranges from 1 to a, a represents the number of level matching strings included in the target wildcard matching string, j ranges from 1 to b, b represents the number of level strings included in the signal level name corresponding to the first instance, vbefore[0][j] is false, v[i][0]=false, v[0][0]=true, true represents the match flag.
7. The method for finding signal level names based on wildcard matching according to claim 1, wherein the signal level name includes at least two levels.