CHAPTER 4: Mutation Analysis Directed Adaptive Random Simulation
4.2.3. Dynamic Mutation Schemata
We propose an extension to the original mutation schemata [63] which has been introduced in the background chapter. The resulting process is called dynamic mutation
schemata.
For the convenience of presentation, we first introduce several notations for basic HDL simulation and mutation schemata, as elementary constructs. We then define the dynamic mutation schemata process based on these notations.
Notations for Original Mutation Schemata
For a HDL design under verification π· to be simulated, we first use:
ο· π·0β ππππΌππΌπ(π·) to denote the execution of a HDL simulation initialization phase
for design π· , with the result notated as π·0, i.e. the whole state of π· after
initialization.
ο· π·π‘+1β πππ(π·π‘) , where π‘ = 0,1,2,3, β¦ is used to represent the execution of one
HDL simulation cycle at π‘ + 1, which changes the state of π· fron π·π‘ to π·π‘+1.
Note that ππππΌππΌπ and πππ represent a simulation with specific tests, without the tests
attached to the notation.
Recall that in mutation schemata, all mutants are encoded into one meta-mutant, each with a unique mutant ID. This ID should be designated to select the corresponding mutant for simulation. We use:
ο· ππ to denote the meta-mutant and πππ to represent mutant π by assigning the
mutant ID for ππ to be π β [0, #_ππ_ππ’π‘πππ‘π ]. During simulation of πππ, only
the mutated statement with ID π is used, with all the other mutations unmasked and the original statements executed.
ο· When mutant ID π is assigned 0, ππ0 represents the meta-mutant with all
mutation masked. Simulation of ππ0 has the same trace as the original design π·.
ο· πππ,0β ππππΌππΌπ(πππ) and πππ,π‘+1β πππ(πππ,π‘) according to the notation
above for HDL simulation, with πππ as the design.
Extension as Dynamic Mutation Schemata
We propose an extension to this original mutation schemata, as shown by Figure 4.6. We call it dynamic mutation schemata, since in the mutation analysis process, the meta- mutant is continuously simulated as a main thread and the simulations of individual mutants are dynamically forked and ended, if they are activated during meta-mutant simulation.
At the beginning, we have only ππ0 launched for simulation, with tests consistently
generated as input from our random test generator. After initialization, ππ0 is simulated
at each cycle. In the illustration of Figure 4.6, we assume that the design is synchronized at each clock rising edge.
Note that during πππ(ππ0,π‘), we are able to determine for each mutant whether it was
activated, and by which test it was activated. A list πΏππ π‘πππ‘ππ£ππ‘ππ can be recorded as
πΏππ π‘πππ‘ππ£ππ‘ππ = (β― , (πππ, π‘ππ π‘πππ), β― )
where π‘ππ π‘πππ represents the test that activated mutant πππ. This should be possible, if
Figure 4.6 Dynamic mutation schemata for HDL mutation analysis.
Dynamic Mutation Schemata:
β
At each cycle β‘
during which we obtain
(β© adapt test generation with ) For each running forked mutant simulation:
β₯
β¦compare ,
β§if no deviation found, delete and unmask in β¨if deviation at design output, delete as it is killed For each activated in
β’update β£
β€mask in as separate-running and no-check-for-activation
1
, during which and were activated by and , respectively 2 4 3 8 5 9 6 c t 7
during the meta-mutant simulation, i) we calculate a mutated statement in parallel to the original one, for a comparison to see whether the mutant is activated ii) for each design sub-unit, we maintain a record which test is currently resident at this unit. For example for a microprocessor design simulation, in each pipeline unit there should be a corresponding instruction that is currently executed by this unit. We assume that such a record can be maintained during simulation, for any pipelined design. Then, when a mutant is activated during meta-mutant simulation, we know the test that is responsible for the design unit containing this mutant.
For each activated πππ from πΏππ π‘πππ‘ππ£ππ‘ππ, we first update the record entry of that
mutant-activating test: ππππ‘ππ£ππ‘πππ in (π‘ππ π‘πππ,, ππππ‘ππ£ππ‘πππ) is increased by 1.
Then, we try to fork a continuing simulation for πππ, from the current meta-mutant
simulation. For this, we further assume the availability of a fork functionality: πππ,π‘β
πΉπππ(ππ0,π‘, π), which first creates a copy of ππ0,π‘ and then change the mutant ID of this
copy from 0 to π. Such a fork is possible, since mutant π has never been activated until π‘ and, therefore, ππ0,π‘ and πππ,π‘ should represent the same design state in such a case.
The activated and forked mutants are masked in the meta-mutant simulation, since they are now simulated in separate threads and no longer required to be checked for activation. Each such forked mutant simulation thread, say πππ, is simulated at every clock cycle:
πππ,π‘+1β πππ(ππ,π‘). The result πππ,π‘+1 is compared to ππ0,π‘+1 from meta-mutant
simulation. There are just two outcomes from this comparison:
ο· If no deviation is found between them, it means that the simulation of mutant πππ
has converged back to the meta-mutant simulation. That thread for simulating πππ can be aborted. We unmask it in ππ0 to resume the activation-checking for
πππ.
ο· If any deviation appears at design output, it means the activation has been successfully propagated and, by definition of mutation analysis, mutant πππ is
killed.
The main advantage of this dynamic mutation schemata is the saving of simulation time for HDL mutation analysis. Individual mutants are simulated in a dynamic, just-in-time manner, based on meta-mutant simulation.
At the end, we are able to compile the input for the adaptation heuristic: (π‘ππ π‘, ππππ‘ππ£ππ‘πππ) for each π‘ππ π‘, which are consistently updated during our dynamic
mutation schemata. Note that we should trigger the adaptation heuristic only when a π‘ππ π‘ will no longer receive any activation update.