Method for processing compulsory assignment statement changing along with drive, electronic equipment and medium
By setting up a forced assignment module and a state machine for each forced assignment statement, updates are only performed when the signal changes and the state machine is active, thus solving the problem of frequent calculations of the expression on the right side of the forced assignment statement and improving system performance.
Patent Information
- Application Number
- CN202610110018.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-27
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2046-01-27
AI Technical Summary
In existing technologies, the frequent changes in the right-hand expression of a forced assignment statement that varies with the driver lead to a decrease in system performance and a significant waste of time.
During the compilation phase, a corresponding forced assignment module is set up for each forced assignment statement, and the target object and assignment content are recorded in the module. The assignment update operation is controlled by a state machine, and the update is only performed when the signal changes and the state machine is active.
This reduces the number of times the right-hand expression of a forced assignment statement is evaluated, improving system performance and saving processing time.
Smart Images

Figure CN121580924A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital simulation technology, and in particular to a method for processing forced assignment statements that vary with driving, an electronic device, and a medium. Background Technology
[0002] Forced assignment statements are used to forcibly modify signal values during simulation, and the forced assignment value cannot be affected by any value driven from it. For forced assignment statements that change with the driver, when the value of the right-hand side expression of the forced assignment statement changes after the statement occurs, the value of the left-hand side signal must change synchronously. In existing technology, when the signal in the right-hand side expression of a forced assignment statement changes, the calculation of the right-hand side expression is triggered. After the calculation is completed, it is determined whether the forced assignment statement has taken effect. If it has, the value of the left-hand side signal is updated synchronously; otherwise, the value of the left-hand side signal is not updated. In existing technology, the signal change of the right-hand side expression of a forced assignment statement that changes with the driver leads to repeated calculations of the right-hand side expression. When the signal of the right-hand side expression changes frequently, it consumes a lot of time and reduces system performance. Summary of the Invention
[0003] The purpose of this invention is to provide a method, electronic device, and medium for processing driver-dependent forced assignment statements, which can reduce the number of calculations of the right-hand expression of driver-dependent forced assignment statements, reduce time consumption, and improve system performance.
[0004] According to a first aspect of the present invention, a method for processing forced assignment statements that vary with the driver is provided, comprising: Step S1: During the compilation phase, obtain the set of forced assignment statements {A1, A2, ..., A...} in the chip design code that change with the driver. n ,...,A N}, A n A represents the nth driver-dependent forced assignment statement in the chip design code, where n ranges from 1 to N, and N is the total number of driver-dependent forced assignment statements in the chip design code. n Including A1 n and A2 n A1 n For A n The corresponding target object, A2 n For A n The corresponding assignment value is A2. n Includes at least one A n The corresponding drive signal; Step S2: During the compilation phase, for each A n Set up a corresponding forced assignment module Bn B n Set to A2 n The load of all drive signals in B n Set to A1 n Driven by, and in B n Record A1 n and A2 n In B n Set up a state machine in B n The default state of the state machine in B is inactive. n Forced assignment update operations are not performed when the system is inactive. Step S3: During the simulation phase, when any A n After it occurs, the corresponding B n The state machine in the process is updated to the active state, and the current occurrence of A is recorded in the dynamic database. n Corresponding A1 n With the current action on A1 n B n The mapping relationship; Step S4: During the simulation phase, when any A2 n The drive signal in A2 changes and the current drive signal changes. n Corresponding B n The state machine in the current dynamic database is in an active state and the current dynamic database records a change in the effect of the current driving signal A2. n Corresponding A1 n B n A2 changes with the current drive signal n Corresponding B n When they are the same, based on the corresponding B n A2 in n For A1 n Perform a forced assignment update operation.
[0005] According to a second aspect of the present invention, an electronic device is provided, comprising: 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, the instructions being configured to perform the method described in the first aspect of the present invention.
[0006] According to a third aspect of the present invention, a computer-readable storage medium is provided, storing computer-executable instructions for performing the method described in the first aspect of the present invention.
[0007] Compared with existing technologies, this invention has significant advantages and beneficial effects. Through the above technical solution, the method, electronic device, and medium for handling forced assignment statements that change with the driver provided by this invention achieve considerable technological advancement and practicality, and have broad industrial application value. It has at least the following beneficial effects: This invention sets up a corresponding forced assignment module for each forced assignment statement that changes with the driver. The forced assignment module records the corresponding target object and assignment content, and sets up a state machine in the forced assignment module. The corresponding forced assignment update operation is only executed when the signal in the assignment content changes and the corresponding state machine is in an active state. The forced assignment module does not execute the forced assignment update operation when it is in an inactive state. This invention can reduce the number of calculations of the right-hand expression of the forced assignment statement that changes with the driver, reduce the time consumed, and improve system performance. Attached Figure Description
[0008] 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.
[0009] Figure 1 The flowchart illustrates the method for handling forced assignment statements that change with the driver, as provided in this embodiment of the invention. Detailed Implementation
[0010] 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.
[0011] This invention provides a method for handling forced assignment statements that vary with the driver, such as... Figure 1 As shown, it includes: Step S1: During the compilation phase, obtain the set of forced assignment statements {A1, A2, ..., A...} in the chip design code that change with the driver. n ,...,A N}, A n A represents the nth driver-dependent forced assignment statement in the chip design code, where n ranges from 1 to N, and N is the total number of driver-dependent forced assignment statements in the chip design code. n Including A1 n and A2 n A1n For A n The corresponding target object, A2 n For A n The corresponding assignment value is A2. n Includes at least one A n The corresponding drive signal.
[0012] The target object is the left-hand side of the forced assignment expression, and the assignment content is the right-hand side of the forced assignment expression. Taking the forced assignment statement Force a[3] = b + c + d as an example, a[3] is the target object, b + c + d is the assignment content, and b, c, and d are the driving signals corresponding to the forced assignment statement. It should be noted that each A1 n Each corresponds to a signal bit. If the target object in the original forced assignment statement contains multiple signal bits, it is split into forced assignment statements corresponding to individual signal bits, generating {A1, A2, ..., A...}. n ,...,A N}
[0013] Step S2: During the compilation phase, for each A n Set up a corresponding forced assignment module B n B n Set to A2 n The load of all drive signals in B n Set to A1 n Driven by, and in B n Record A1 n and A2 n In B n Set up a state machine in B n The default state of the state machine in B is inactive. n Forced assignment update operations are not performed when the system is inactive.
[0014] Among them, A n Located in the procedural block of the chip design code, B n The simulation is set in the area of the chip design code that is not a procedural block. The procedural block of the chip design code refers to the code block that describes the execution flow of timing or combinational logic, while the non-procedural block of the chip design code refers to the code block that describes the static connections of the hardware structure. B n Simulation settings refer to B nThe module is designed for simulation purposes and is not a real physical connection. Taking the forced assignment statement Force a[3] = b + c + d as an example, a forced assignment module is set up for this forced assignment statement. The forced assignment module is set as the load of b, c, and d. Changes in b, c, and d can drive the forced assignment module to run. The forced assignment module is set as the driver of signal a[3] and can drive the modification of the signal value of a[3].
[0015] Step S3: During the simulation phase, when any A n After it occurs, the corresponding B n The state machine in the process is updated to an active state.
[0016] Step S4: During the simulation phase, when any A2 n The driving signal in B changes and the corresponding B n When the state machine in the middle is in an active state, based on the corresponding B n A2 in n For A1 n Perform a forced assignment update operation.
[0017] It should be noted that, through step S4, B is made n The state machine in the middle is in an inactive state and will not perform forced assignment update operations. There is no need to calculate the assignment content in the forced assignment statement, thus reducing useless calculations before the forced assignment statement takes effect.
[0018] By dynamically updating the forced assignment statement using a state machine, the problem of repeated calculation of the expression may occur when the signal on the right side of the forced assignment statement changes is effectively solved. This can save a lot of time in scenarios where the driving signal on the right side changes frequently and the expression is complex and computationally intensive.
[0019] It should be noted that steps S1-S2 are all operations performed during the compilation phase, while steps S3-S4 are all operations performed during the simulation phase.
[0020] As one embodiment, in step S3, during the simulation phase, when any A n After it occurs, the corresponding B n The state machine in the process is updated to an active state, including: Step S31: During the simulation phase, when any A n When it occurs, obtain the current occurrence A. n The corresponding current occurrence B n .
[0021] Step S32: The current occurrence of B n The state machine in the current state is updated to the initial state, and the current event B is triggered. n Calculate the corresponding A2n Get the driving value, and the current occurrence of B n The acquired driving value is used as the current occurrence of A n The corresponding buffered signal value is stored in the current occurrence B. n middle.
[0022] Step S34, B is currently occurring. n Force the acquired driving value to be assigned to the current occurrence A. n Corresponding A1 n And the corresponding current occurrence B n The state machine in the process is updated to an active state.
[0023] It should be noted that the current occurrence of A n The corresponding buffered signal value is stored in the current occurrence B. n In this process, before a forced drive operation is required, the value is compared with the cached signal value. If the value is equal to the cached signal value, there is no need to perform the corresponding forced assignment update operation. This ensures the correctness of the processing result and further reduces the execution of useless forced assignment update operations, thereby reducing processing time and improving system performance.
[0024] As one embodiment, in step S3, the currently occurring A is recorded in the dynamic database. n Corresponding A1 n With the current action on A1 n B n The mapping relationships include: Step C31: Obtain the currently occurring A n Corresponding A1 n And the corresponding current occurrence B n .
[0025] Step C32: If the current record in the dynamic database contains a record of the current occurrence A... n Corresponding A1 n With the current action on A1 n B n If the mapping relationship is correct, then proceed to step C33; otherwise, proceed to step C34.
[0026] Step C33: The current occurrence of B n Update to the current occurrence of A in the dynamic database n Corresponding A1 n B n Proceed to step S4.
[0027] Step C34: Directly convert the currently occurring A n Corresponding A1 n And the corresponding current occurrence B nThe mapping relationship is recorded in the dynamic database, and step S4 is executed.
[0028] It should be noted that in a design, the same target object may correspond to multiple forced assignment statements, but only one forced assignment statement can take effect on the target object at any given time. Steps C31-C34 enable accurate and rapid maintenance of A1 based on a dynamic database. n With the current action on A1 n B n The mapping relationship, based on the dynamic database, is only based on the current action on A1. n B n Performing forced assignment update operations further reduces the execution of useless forced assignment update operations, reduces processing time, and improves system performance.
[0029] As one embodiment, in step S2, for each A n Set up a corresponding forced assignment module B n ,include: Step S21, for each A n Set a corresponding index number.
[0030] Step S22, for each A n Set up a corresponding forced assignment module B n and for B n With A n Same index number.
[0031] It should be noted that each A n and the corresponding B n A has the same index number and is built based on the same index number. n and the corresponding B n The relationship between them.
[0032] Based on steps S21-S22, as one embodiment, step S31 includes: Step S311: During the simulation phase, when any A n When it occurs, obtain the information related to the currently occurring A. n B with the same corresponding index number n As the corresponding current occurrence B n .
[0033] As one embodiment, step S4 includes: Step S41: During the simulation phase, when any A2 n The drive signal in the middle changes, driving the corresponding B n When, if the corresponding B n If the state machine is in an inactive state, then the corresponding Bn If the forced assignment update operation is not performed, and the corresponding B n If the state machine is in an active state, then step S42 is executed.
[0034] Step S42: If the effect of the current driving signal recorded in the current dynamic database changes (A2) n Corresponding A1 n B n A2 changes with the current drive signal n Corresponding B n If the result is the same, proceed to step S43; otherwise, proceed to the corresponding B. n Do not perform a forced assignment update operation; Step S43: Trigger the corresponding B n Calculate A2 n Get A n The corresponding driving value will be A n The corresponding driving value and A n Compare the corresponding buffered signal values; if there is no change, then do not check A1. n Perform a forced assignment update operation; otherwise, proceed to step S44. Step S44, Place A n The corresponding driving value covers B n China A n The corresponding buffered signal value, and A n The corresponding driving value is forcibly assigned to A1. n .
[0035] It should be noted that in the prior art, once the driving signal changes, the calculation of the assignment content of the forced assignment statement is triggered. After the calculation is completed, it is then determined whether the forced assignment statement is effective. However, many forced assignment statements are often ineffective, making the assignment content calculation useless. The embodiments of the present invention can effectively avoid the occurrence of useless calculations by recording the state machine and state database in the forced assignment module. Only the corresponding calculations are performed on the forced assignment statements that are actually required to be executed, reducing processing time and improving system performance.
[0036] Taking the forced assignment statement Force a[3] = b + c + d as an example, the simulation runs normally. The state machine in the forced assignment module corresponding to Force a[3] = b + c + d is inactive by default. When the values of b, c, and d change and drive the forced assignment module corresponding to Force a[3] = b + c + d, if the state machine in the forced assignment module corresponding to Force a[3] = b + c + d is inactive, then the forced assignment module corresponding to Force a[3] = b + c + d will not work. When Force a[3] = b + c + d occurs, the forced assignment module corresponding to Force a[3] = b + c + d is found by index number. The state machine of the forced assignment module corresponding to Force a[3] = b + c + d is modified to the initial state and the forced assignment module corresponding to Force a[3] = b + c + d is triggered to run. The expression b + c + d is calculated to obtain the driving value and is retained as the buffer signal value in the forced assignment module corresponding to Force a[3] = b + c + d. Record the mapping relationship between a[3] and the forced assignment module corresponding to Force a[3] = b + c + d in the dynamic database, and modify the state machine of the forced assignment module corresponding to Force a[3] = b + c + d to the active state. Next, when the values of b, c, and d change and drive the forced assignment module corresponding to Force a[3] = b + c + d, the state machine of the forced assignment module corresponding to Force a[3] = b + c + d is active because the values of b, c, and d change and drive the forced assignment module corresponding to Force a[3] = b + c + d. The dynamic database records the mapping relationship between a[3] and the forced assignment module corresponding to Force a[3] = b + c + d. Therefore, the forced assignment module corresponding to Force a[3] = b + c + d calculates the driving value of the expression b + c + d and compares it with the cached signal value in the forced assignment module corresponding to Force a[3] = b + c + d. If there is no change, Force a[3] = b + c + d is not updated. If there is a change, the cached signal value in the forced assignment module corresponding to Force a[3] = b + c + d is overwritten, and the forced update of the signal value of a[3] is completed.
[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0038] It should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe the steps as sequential processes, many of these steps can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the steps can be rearranged. A process can be terminated when its operation is complete, but it may also have additional steps not included in the figures. A process can correspond to a method, function, procedure, subroutine, subroutine, etc.
[0039] This invention also 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, the instructions being configured to perform the method described in this invention.
[0040] This invention also provides a computer-readable storage medium storing computer-executable instructions for performing the methods described in this invention.
[0041] In this embodiment of the invention, a corresponding forced assignment module is set up for each forced assignment statement that changes with the driver. The corresponding target object and assignment content are recorded in the forced assignment module, and a state machine is set up in the forced assignment module. The corresponding forced assignment update operation is only executed when the signal in the assignment content changes and the corresponding state machine is in an active state. The forced assignment module does not execute the forced assignment update operation when it is in an inactive state. This invention can reduce the number of calculations of the right-hand expression of the forced assignment statement that changes with the driver, reduce the time consumed, and improve system performance.
[0042] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Although the present invention has been disclosed above with reference to preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some modifications or alterations to the above-disclosed technical content to create equivalent embodiments without departing from the scope of the present invention. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A method for handling forced assignment statements that vary with the driver, characterized in that, include: Step S1, in the compilation phase, obtaining a set of drive-varying forced assignment statements {A1, A2,..., A n ,...,A N} in the chip design code, A n is the nth drive-varying forced assignment statement in the chip design code, n ranges from 1 to N, N is the total number of drive-varying forced assignment statements in the chip design code, A n includes A1 n and A2 n , A1 n is a corresponding target object of A n , A2 n is a corresponding assignment content of A n , and A2 n includes at least one corresponding drive signal of A n ; Step S2: During the compilation phase, for each A n Set up a corresponding forced assignment module B n B n Set to A2 n The load of all drive signals in B n Set to A1 n Driven by, and in B n Record A1 n and A2 n In B n Set up a state machine in B n The default state of the state machine in B is inactive. n Forced assignment update operations are not performed when the system is inactive. Step S3, in the simulation phase, when any A n occurs, the corresponding B n 's state machine is updated to the active state, and the mapping relationship between the current A n and the B n currently acting on this A n is recorded in the dynamic database. n Step S4, in the simulation phase, when any of the A2 n drive signal changes and the current drive signal changes A2 n corresponding B n state machine in the current dynamic database recorded for the current drive signal changes A2 n corresponding A1 n B n with the current drive signal changes A2 n corresponding B n same, based on the A2 n corresponding B n A1 n perform a forced assignment update operation.
2. The method for handling forced assignment statements that vary with the driver according to claim 1, characterized in that, In the step S3, in the simulation phase, when any A n occurs, the corresponding B n state machine is updated to the active state, including: Step S31, in the simulation phase, when any A n occurs, the current occurring A n corresponding to the current occurring B n ; Step S32, update the state machine in the current occurrence B n to the initial state, and trigger the current occurrence B n Calculate the corresponding A2 n Get the drive value, and get the current occurrence B n The drive value as the current occurrence A n The corresponding cache signal value is stored in the current occurrence B n ; Step S34, current occurrence B is occurring n The acquired drive value is forcibly assigned to the current occurrence A n Corresponding A1 n , and the state machine in the corresponding current occurrence B n is updated to the active state.
3. The method for handling forced assignment statements that vary with the driver according to claim 1, characterized in that, The step S3 records the current occurring A n Corresponding A1 n The mapping relationship between the current A1 n B n acting on this A1 include: Step C31, get currently occurring A n Corresponding A1 n And corresponding currently occurring B n ; Step C32, if the current record in the dynamic database has a current occurrence A n corresponding A1 n with the current B n acting on this A1 n , then step C33 is executed, otherwise step C34 is executed; Step C33, current occurrence B is updated in dynamic database A n current occurrence A is updated in dynamic database B n corresponding A1 n B n Step S4 is executed; Step C34, directly mapping the current occurrence of A n the corresponding A1 n and the corresponding current occurrence B n is recorded in the dynamic database, step S4 is executed.
4. The method for handling forced assignment statements that vary with the driver according to claim 2, characterized in that, S2. For each A n setting a corresponding mandatory assignment module B n , comprising: Step S21, for each A n set a corresponding index number; Step S22, for each A n A corresponding mandatory assignment module B is set up n , and for B n the same index number as A n .
5. The method for handling forced assignment statements that vary with the driver according to claim 4, characterized in that, Step S31 includes: Step S311, in the simulation phase, when any A n occurs, the current occurrence A n corresponding index number of the same B n as the corresponding current occurrence B n .
6. The method for processing forced assignment statements that vary with the driver according to claim 2, characterized in that, Step S4 includes: Step S41, in the simulation stage, when the driving signal in any A2 n is changed to drive the corresponding B n , if the state machine of the corresponding B n is in the inactive state, the corresponding B n does not perform the forced assignment update operation, and if the state machine of the corresponding B n is in the active state, step S42 is performed; Step S42, if the current dynamic database recorded changes in the role of the current drive signal A2 n corresponding A1 n B n and the current drive signal changes A2 n corresponding B n same, step S43 is executed, otherwise, corresponding B n no forced assignment update operation is performed; Step S43, trigger the corresponding B n Calculate A2 n Get A n The corresponding drive value, A n The corresponding drive value and A n The corresponding cache signal value comparison, if there is no change, A1 n Perform a forced assignment update operation, otherwise, execute step S44; Step S44, A n The corresponding drive value covers B n In A n The corresponding cache signal value, and A n The corresponding drive value is assigned to A1 n .
7. The method for handling forced assignment statements that vary with the driver according to claim 1, characterized in that, A n B n analogizing a region where a non-procedure block of the chip design code is located, the procedure block of the chip design code being a code block describing an execution flow of a sequential or combinational logic, and the non-procedure block of the chip design code being a code block describing a static connection of a hardware structure.
8. An electronic device, characterized in that, include: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that are executed by the at least one processor, the instructions being configured to perform the method of any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The device stores computer-executable instructions for performing the method of any one of claims 1-7.
Citation Information
Patent Citations
Test configuration method, hardware simulator and test system
CN118278335A
Object-oriented, parallel language, method of programming and multi-processor computer
US20070169042A1