Method for processing forced assignment statement with driving change, electronic device and medium
By setting up a forced assignment module and state machine for each forced assignment statement that changes with the driver, updates are only performed when the signal changes and the state machine is active, thus solving the problem of frequent calculation of the right-hand expression and improving system performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-27
- Publication Date
- 2026-03-27
AI Technical Summary
In existing technologies, signal changes in the right-hand expression of a forced assignment statement that varies with the driver cause repeated calculations, consuming a lot of time and reducing system performance.
During the compilation phase, a corresponding forced assignment module is set up for each forced assignment statement that changes with the driver. The target object and the assignment content are recorded in the module. The assignment update is controlled by a state machine, and the update operation is only performed when the signal changes and the state machine is active.
This reduces the number of times the right-hand expression in a forced assignment statement is evaluated, saving processing time and improving system performance.
Smart Images

Figure CN121580924B_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:
[0005] 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;
[0006] Step S2: During the compilation phase, for each An 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.
[0007] 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;
[0008] 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.
[0009] 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.
[0010] 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.
[0011] The present application has obvious advantages and beneficial effects compared with the prior art. By means of the above technical scheme, the present application provides a processing method of a driven change forced assignment statement, an electronic device and a medium, which can achieve considerable technical progress and practicability, and have wide industrial utilization value, and at least have the following beneficial effects:
[0012] The present application sets a corresponding forced assignment module for each driven change forced assignment statement, records the corresponding target object and assignment content in the forced assignment module, and sets a state machine in the forced assignment module. Only when the signal in the assignment content changes and the corresponding state machine is in an active state, the corresponding forced assignment update operation is executed. The forced assignment module does not execute the forced assignment update operation in an inactive state. The present application can reduce the calculation frequency of the right side expression of the driven change forced assignment statement, reduce the time consumption, and improve the system performance. BRIEF DESCRIPTION OF DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0014] Figure 1 The present application provides a processing method of a driven change forced assignment statement. DETAILED DESCRIPTION
[0015] The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings of the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0016] The present application provides a processing method of a driven change forced assignment statement, as shown in Figure 1 , which comprises:
[0017] Step S1, in the compilation phase, a set of driven change forced assignment statements {A1, A2,..., An,..., AN} in the chip design code is obtained, An is the nth driven change forced assignment statement in the chip design code, the value range of n is 1 to N, N is the total number of driven change forced assignment statements in the chip design code, and An comprises A1 n ,...,A N} is obtained, An is the nth driven change forced assignment statement in the chip design code, the value range of n is 1 to N, N is the total number of driven change forced assignment statements in the chip design code, and An comprises A1 n n A1n 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.
[0018] 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}
[0019] 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.
[0020] 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 designed for simulation is not a real physical connection. Taking a forced assignment statement Force a[3] = b + c + d as an example, a forced assignment module is set for the forced assignment statement, the forced assignment module is set as a load of b, c and d, and changes of b, c and d can drive the forced assignment module to run. The forced assignment module is set as a driver of the signal a[3], and the modification of the signal value of a[3] can be driven.
[0021] In step S3, in the simulation stage, when any A1 n occurs, the state machine in the corresponding B1 n is updated to the active state.
[0022] In step S4, in the simulation stage, when any A2 n driving signal changes and the state machine in the corresponding B2 n is in the active state, a forced assignment update operation is performed on A1 n in the corresponding B2 n based on A2 n .
[0023] It should be noted that through step S4, when the state machine in B2 n is in the inactive state, the forced assignment update operation is not performed, and the calculation of the assignment content in the forced assignment statement is not required, thereby reducing useless calculations before the forced assignment statement takes effect.
[0024] The forced assignment statement is dynamically updated through the state machine, effectively solving the problem that changes in the signals in the right side expression of the forced assignment statement may cause repeated calculations of the expression. In the scene where the right side driving signal changes frequently and the expression is complex and time-consuming to calculate, a large amount of time can be saved.
[0025] It should be noted that steps S1-S2 are operations performed in the compilation stage, and steps S3-S4 are operations performed in the simulation stage.
[0026] As an embodiment, in step S3, in the simulation stage, when any A1 n occurs, the state machine in the corresponding B1 n is updated to the active state, including:
[0027] In step S31, in the simulation stage, when any A1 n occurs, the current occurrence A1 n corresponding to the current occurrence B1 n is obtained.
[0028] In step S32, the state machine in the current occurrence B1 n is updated to the initial state, and the current occurrence B1 nCalculate the corresponding A2 n 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.
[0029] 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.
[0030] 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.
[0031] 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:
[0032] Step C31: Obtain the currently occurring A n Corresponding A1 n And the corresponding current occurrence B n .
[0033] 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.
[0034] 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.
[0035] Step C34: Directly convert the currently occurring A n Corresponding A1 n And the corresponding current occurrence BThe mapping relationship of A1 n is recorded in the dynamic database, and step S4 is executed.
[0036] It should be noted that in one design, the same target object can correspond to multiple forced assignment statements, but only one forced assignment statement can take effect on the target object at the same time. Through steps C31-C34, the dynamic database is accurately and quickly maintained based on A1 n and the mapping relationship of B n currently acting on A1 n , based on the dynamic database, only the forced assignment update operation based on B n currently acting on A1 n is executed, further reducing the execution of useless forced assignment update operations, reducing processing time, and improving system performance.
[0037] As an embodiment, in step S2, a corresponding forced assignment module B n is set for each A n , including:
[0038] Step S21, an index number is set for each A n .
[0039] Step S22, a corresponding forced assignment module B n is set for each A n , and the same index number is set for B n and A n .
[0040] It should be noted that each A n and the corresponding B n have the same index number, and the association between A n and the corresponding B n is established based on the same index number.
[0041] Based on steps S21-S22, as an embodiment, step S31 includes:
[0042] Step S311, in the simulation stage, when any A n occurs, the B n with the same index number as the current A n is obtained as the corresponding current B n .
[0043] As an embodiment, step S4 includes:
[0044] Step S41, in the simulation stage, when any A2 nWhen the drive signal in B changes, if the corresponding B n If the state machine is in an inactive state, then the corresponding B n 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.
[0045] 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;
[0046] 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.
[0047] 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 .
[0048] 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.
[0049] For example, the simulation of the forced assignment statement Force a[3] = b + c + d is normal, the state machine in the forced assignment module corresponding to Force a[3] = b + c + d is in the default inactive state, when the values of b, c and d change to 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 in the inactive state, the forced assignment module corresponding to Force a[3] = b + c + d does not work. When Force a[3] = b + c + d occurs, the forced assignment module corresponding to Force a[3] = b + c + d is found through the 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 work, the driving value of the expression b + c + d is calculated and is kept as the cached signal value in the forced assignment module corresponding to Force a[3] = b + c + d. The mapping relationship between a[3] and the forced assignment module corresponding to Force a[3] = b + c + d is recorded in the dynamic database, and the state machine of the forced assignment module corresponding to Force a[3] = b + c + d is modified to the active state. Next, when the values of b, c and d change to drive the forced assignment module corresponding to Force a[3] = b + c + d, since the state machine of the forced assignment module corresponding to Force a[3] = b + c + d is in the active state and the dynamic database records the mapping relationship between a[3] and the forced assignment module corresponding to Force a[3] = b + c + d, the forced assignment module corresponding to Force a[3] = b + c + d calculates the driving value of the expression b + c + d and compares the driving value 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.
[0050] 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 application belongs. The terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0051] It is to be understood that some of the example embodiments are described in terms of a process or method being performed at a location, such as an electronic device. Although a process or method can be described as being performed at a location, such as an electronic device, it is understood that such a process or method can be performed at one or more locations, such as an electronic device.
[0052] An electronic device is also provided, including at least one processor, and a memory connected with the at least one processor in communication; wherein the memory stores instructions executed by the at least one processor, the instructions are arranged to execute the method according to the embodiments of the application.
[0053] A computer readable storage medium is also provided, storing computer executable instructions, the computer executable instructions are used to execute the method according to the embodiments of the application.
[0054] The embodiments of the application set a corresponding forced assignment module for each forced assignment statement which changes with a drive, record the corresponding target object and assignment content in the forced assignment module, and set a state machine in the forced assignment module. Only when the signal in the assignment content changes and the corresponding state machine is in an active state, the corresponding forced assignment update operation is executed. The forced assignment module does not execute the forced assignment update operation in an inactive state. The application can reduce the calculation times of the right side expression of the forced assignment statement which changes with a drive, reduce the time consumption, and improve the system performance.
[0055] The above descriptions are only preferred embodiments of the present application and are not intended to limit the present application in any form. Although the present application has been disclosed as the above preferred embodiments, it is not intended to limit the present application. Any skilled person in the art can make some minor changes or modifications to the above disclosed technical contents to make equivalent embodiments without departing from the technical solution of the present application. Any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present application are still within the scope of the technical solution of the present application.
Claims
1. A method of processing a guarded assignment statement with drive variation, characterized by, Comprising: 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 of processing a driven varying assignment statement according to claim 1, wherein, 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 currently 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 of processing a driven varying assignment statement according to claim 1, wherein, 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 Comprising: 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 of processing a driven varying assignment statement according to claim 2, wherein, 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 B n is set up with the same index number as A n .
5. The method of processing a driven varying assignment statement according to claim 4, wherein, The step S31 comprises: 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 of processing a driven varying assignment statement according to claim 2, wherein, The step S4 comprises: Step S41, in the simulation stage, when the driving signal in any A2 n is changed, 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, if the state machine of the corresponding B n is in the active state, step S42 is executed; Step S42, if the current dynamic database recorded changes in the role of the current drive signal A2 n Corresponding A1 n B n With the current drive signal changes A2 n Corresponding B n The 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, will A n The corresponding drive value and A n The corresponding cache signal value comparison, if no change, then not A1 n Perform a forced assignment update operation, otherwise, execute step S44; Step S44, A n The corresponding drive value covers B n Mid A n The corresponding cache signal value, and A n The corresponding drive value is assigned to A1 n .
7. The method of processing a driven varying assignment statement according to claim 1, wherein, A n B n simulating a region of the chip design code where non-procedural blocks of the chip design code are located, the procedural blocks of the chip design code being code blocks that describe execution flow of sequential or combinational logic, the non-procedural blocks of the chip design code being code blocks that describe static connectivity of hardware structures.
8. An electronic device, comprising: Comprising: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores instructions executed by the at least one processor, the instructions configured to perform the method of any one of the preceding claims 1-7.
9. A computer-readable storage medium, characterized in that, Computer executable instructions are stored, the computer executable instructions being used to perform the method of any one of the preceding 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