• 沒有找到結果。

CEFSM-Based Framework

4.3 CEFSM-based Stimulus Generator

In this section, we introduce the CEFSM-based stimulus generation scheme. The primary function of the stimulus generator is to assign valid values to IDU V according to the ob-served values of ODU V. Before describing the details, we use the example in Fig. 4.3 to give the idea of our stimulus generation. In this example, Ia, Ib, and Id belong to IDU V, and Or belongs to ODU V. That is, the valuses of Ia, Ib, and Idare produced by the stimu-lus generator while the value of Or is driven by the DUV. Consider the state transition of the corresponding CEFSM at C2. After evaluating the transition conditions with Or= 0, Ib = 1, and x1 = 3, the CEFSM takes a transition t6to move to S2and retains the value of x1simultaneously. The updated variable value is exactly the evaluation value for the state

Cycle

CLK

Ib

Ia[7:0]

Id[2:0]

Or

X1

Scurrent

Fail

20

19 21 22

2 1 3

S1

S0 S2 S1 S3 Vio

C0 C1 C2 C3 C4 C5 C6

3

0 2 1

Figure 4.3: A simulation example.

CEFSM M=( Q, ∑, ∑´, X, q0, x0, T ) Fail Checker

Constraint Solver σ Scurrent x

IDUV

ODUV

Constraint Producer

Stimulus Constraint

Figure 4.4: CEFSM to stimulus generator.

transition at C3. Since the updated variable value can determine the results of those pred-icate functions of transitions in Tnext, some impossible next transitions can be eliminated in advance according to the variable value. The set of remaining transitions is the next transition candidate set (NTCS). In this example, Tnext(S2) is {t8, t9, t10, t11} while the NTCS of S2 at C2 is {t8, t10, t11}. Identifying the NTCS of the current state is the prepro-cess of the stimulus generation in our approach. Subsequently, the generator must assign values to IDU V at C2 for interacting with the DUV. These values become the evaluation values of Ia, Ib, and Idfor state transition at C3. Note that arbitrary stimulus assignments may cause certain protocol violations. For example, if we make the assignments Ia= 19 at C2, the embedded CEFSM can not find any valid transition at C3, and thus a protocol violation occurs. In other words, to generate a valid stimulus, the relation functions in NTCS must be taken into consideration.

The CEFSM-based stimulus generator consists of a CEFSM-based checker, a con-straint producer, and a concon-straint solver as shown in Fig. 4.4. In the first stage, the checker

performs certain state transition and updates the values of all variables. In addition, the checker passes necessary information to the constraint producer. The information includes the current signals’ values (σ), the current state (Scurrent), and the current variables’ values (x).

In the second stage, the constraint producer generates the constraint indicating a valid solution space for the stimulus generation. The constraint can be obtained by applying three operations over the relation functions of transitions in Tnext(Scurrent) as shown in Fig. 4.5. Since the values of ODU V are determined by the DUV, the existential quan-tification operations are first performed to make those relation functions of transitions in Tnext(Scurrent) independent of ODU V. Suppose the relation function of the transition t is shown as Equation (4.1). In the beginning, the input of the relation function rt is the union of Σ0 and Σt. Illustrated in Equation (4.2), the simplified relation function (SR) of the transition t is the result after performing the existential quantification operation of rt with respect to ODU V. Since the dependence of ODU V is eliminated, the input of SRt

reduces to the union of Σ0 and Σt∩ IDU V (note that Σt ∩ IDU V = Σt - ODU V). The sec-ond operation is the constraint evaluation. This operation applies σ and x to the SRs and the predicate functions of the transitions in Tnext(Scurrent), respectively. On the one hand, since the SRs regard the next state transition, σ are treated as the previous values at the next state transition. The evaluation of SR can further simplify the original function into the stimulus constraint function (SC) as shown in Equation (4.3). The remaining input in

Existential Quantification

Constraint Evaluation

Constraint Selection σ , x

Tnext(Scurrent)

Figure 4.5: The operation flow of a constraint producer.

SCt further reduces to the set of Σt ∩ IDU V, which is only a subset of IDU V. The SCt is exactly the constraint for IDU V when the transition t is selected as the next transition.

On the other hand, the evaluation of the predicate functions can discard some invalid next transitions and obtain the NTCS.

rt0, Σt) = ^

f or each bi∈ Σt

(bi == fti0)) (4.1)

SRt0, Σt∩ IDU V) = ∃ODU V (rt0, Σt))

= ^

f or each bi∈ Σt∩IDU V

(bi == fti0)) (4.2)

SCtt∩ IDU V) = SRt(σ, Σt∩ IDU V)

= ^

f or each bi∈ Σt∩IDU V

(bi == fti(σ)) (4.3)

Actually, the entire solution space for the current generated stimulus is the conjunction

of SCs in the NTCS of the current state: W

ti∈N T CSSCti. Intuitively, we could directly solve this constraint to obtain a valid stimulus. However, in our approach, only one SC from the NTCS is picked and passed to the constraint solver. This strategy comes with the following two benefits:

Simplify the constraint solving process.

Enable the transition biasing (discuss later).

In the last stage, the constraint solver receives an SC from the constraint producer and then generates a valid stimulus accordingly. As described, the SC is in the form:

(IDU V1 == k1) ∧ (IDU V2 == k2) ∧ . . . ∧ (IDU VN == kN),

kimaps to a specif ic value within the value set of IDU Vi

As a result, the constraint solver first performs a series of assignments, including “(IDU V1 = k1)”, “(IDU V2 = k2)”, . . . , and “(IDU VN = kN)”. This process assigns a set of valid val-ues for the constrained signals. After these assignments, remaining unconstrained signals in IDU V can be assigned with any values in their own value set by the constraint solver.

Like the GEFSM-based stimulus generator, the CEFSM-based stimulus generator also support various stimulus biasing options. Remind that the constraint producer only selects a single stimulus constraint instead of the union of all stimulus constraints derived from

the NTCS. For transition-level biasing, each transition ti is given an individual weight wti. Then, the probability of selecting a candidate constraint SCti is defined as:

PSCti =

A candidate constraint with a larger weight has a higher probability to be chosen. In other words, the transition trend can be biased by this mechanism. Moreover, if previ-ous simulation results do not exercise certain states or transitions, the related transition weights can be increased accordingly to raise their appearance probabilities. We can also define a meaningful transaction in terms of a sequence of transitions and then bias all these transitions simultaneously.

Note that even if a specific SCti is selected, it is not guaranteed that the correspond-ing transition ti is exactly the next transition. This is because the solution space of the selected SC may overlap with the solution spaces of other SCs. An example shown in Fig. 4.6 demonstrates two kind of relations of solution spaces shown in Fig. 4.3. SPi

denotes the solution space of SCti. Fig. 4.6(a) shows that the overlapping relation for solution spaces of SCs at C1. SP4 is a subset of SP6. That is, even if SCt4 is selected for stimulus generation, the next transition could be t6 instead of t4. Another example is shown in Fig. 4.6(b), the two non-overlapping solution spaces mean that the selected SC can directly determine the next transition. Obviously, in either case, the transition-level

SP6

SP4 SP7 SP12 SP13

(a) (b)

At C1, NTCS = {t4, t6, t7} SCt4= (Ia==Ia’+1) (Ib==1) SCt6= (Ia==Ia’+1)

SCt7= (Ia==Ia’+1) (Ib==0)

At C4, NTCS = {t12, t13} SCt12= (Ia==Ia’) (Ib==0) SCt13= (Ia==Ia’) (Ib==1)

Figure 4.6: Two different kinds of relations.

biasing can increase the probability of exercising certain transitions.

4.4 Automatic Translation

We implement a translator that can read in a CEFSM model and then automatically pro-duce the stimulus generator and correctness checker. To meet specific simulation require-ments, these components can be translated into either a high-level language or a native HDL. That is, it is possible to use only a native HDL simulator to simulate all the simula-tion components and the DUV. This can save a lot of simulasimula-tion time compared to those approaches using PLI.

Furthermore, our translator is capable of generating simulation components in synthe-sizable HDL on one condition – only synthesynthe-sizable operators are allowed in the transition conditions of the given CEFSM. In our experiences, the set of synthesizable operators are generally sufficient to model most interface protocols. Fig. 4.7 illustrates the block

diagram of the proposed CEFSM-based stimulus generator. The upper part is the embed-ded correctness checker. The checker consists of several Flip-Flops (FFs) and a transition evaluator which can be implemented as a combinational circuit. The architecture of the correctness checker is similar to the traditional FSM with extended variables. Unlike the traditional FSM that makes a state transition only depending on the current state and current input values, in our approach, the previous input values and current variable val-ues can also affect the state transition. The transition evaluator implements the transition conditions and action functions to determine the next state and update the values of the variables.

The lower part of Fig. 4.7 shows the elements for stimulus generation. The constraint evaluator and selector accomplish the flow in Fig. 4.5. Note that the existential quantifica-tion is done by our translator in the preprocess so that the stimulus generator does not need to do this operation during simulation. The constraint evaluator can determine the NTCS of the current state according to the predicate functions in Tnext(Scurrent). Since the NTCS may contain more than one transition, a constraint selector is required. The easiest way to build a constraint selector is to use the round-robin method. If the transition-level biasing is desired, the selector with a weighted random selection engine [40] can be adopted alter-natively. The weighted random selection engine can randomly choose one item from the candidates based on the candidates’ weights, and thus realize the transition-level biasing.

According to the selected constraint, the constraint solver can assign valid values to

Fail

Assignment Unit Round Robin Selector / Weighted Random

Selector Constraint Evaluator Correctness Checker

Figure 4.7: The block diagram of the proposed CEFSM-based stimulus generator.

IDU V. This solver contains two units for stimulus assignment. One unit makes a series of stimulus assignments with constrainted values, and the other one makes a series of stimulus assignments with random values. Typically, random numbers can be obtained from a software call provided by most HDL simulators. For hardware implementation, an LFSR circuit can be adopted to produce random numbers. Furthermore, if the word-level biasing is required, weighted random number generators can replace the pure random number generators. All the elements in our stimulus generator can be implemented with either behavioral or synthesizable HDL easily. Hence, our approach enables the truly hardware-based stimulus generator and correctness checker that can be realized in hard-ware acceleration environments.

相關文件