SHL, SHR, ROTL, ROTR, INC, DEC, COMPL,AND, OR, XOR and many others.
3
LINEAR CHECKING METHOD
This method can be used to test and verify, notonly the functionality of a microprocessor (morespecifically ALU), but the memories as well. Linearchecking is based on computing the value of ‘K’using the equation 3.1:
iiii
K = f(x, y) + f(x, y) + f(x, y) + f(x, y)
(1)
Equation 1 is called the ‘basic equation’. Thevariables x and y are the operands, ‘i’ is theinstruction. The value of K does not depend on thevalues of x and y, but only depends on the instructionand on the size of operands (number of bits in theoperands). It means the value of K is unique forevery instruction. The chances are very little that thetwo instructions may have the same constant value of K. An 8 and 16-bit ALUs have different values of K,for the same instruction. Hence, in this method, K isused as a reference value to verify the functionalityof an individual instruction.
3.1 Examples of functional verifications
Consider a 4-bit ALU. The value of ‘K’ can becomputed as follows:Suppose the instruction is ADD(x, y) = x + yHere, n = 4. Let x = 5 (0101) and y = 3 (0011)Therefore
x
= 1010 and
y
= 1100The value of K can be obtained from Equation 1,as follows:ADD(5,3)+ADD(5,12)+ADD(10,3)+ADD(10,12) = K8 + 17 + 13 + 22 = 60Hence, for a 4-bit ALU, the ADD instructionwill always be tested with respect to its referencevalue of 60, regardless what values of x and y aretaken, i.e. instead of 5 and 3 as in the above example,now these values are taken as 9 and 10 respectively.Still the value of K remains the same, as provedbelow:i.e. for x = 9 (1001) and y = 10 (1010)
x
= 6 (0110) and
y
= 5 (0101)ADD(9,10)+ADD(9,5)+ADD(10,6)+ADD(6,5)=60The generalized formula can also be developed tofind the value of K for the ADD instruction, for anysize of ALU, as follows:K
+
(n) = 4(2
n
– 1)Where, the subscript with K represents thefunction. Hence from the generalized form, weobtain the same value of K i.e. if n = 4, then K
+
(4) =4(15) = 60.Similarly, the value of K for any instruction canbe obtained, provided its functional description isknown. The value of K, for the various otherfrequently used instructions, can be obtainedsimilarly, as follows:Again assume a 4-bit ALU. Taking x = 10 and y= 12 then
x
= 5 and
y
= 3 in all the computations.3.1.1
Multiply instruction (f(x,y) = X * Y)
f
i
(x,y) = MPY(x,y) = X * YHence, from equation 3.1, the value of K can beobtained as follows:MPY(12,10)+MPY(10,3)+MPY(5,12)+MPY(5,3)120 + 30 + 60 + 15 = 225Generalized form
K
*
= (2
n
– 1)
2
3.1.2
Transfer instruction (f(x) = x)
This is a single valued function, hence only onevariable is taken in computation of K, thus ‘y’ isignored in equation 1.Thusi
f(x) = x
= x + x +
x
+
x
= 10 + 10 + 5 + 5 = 30Generalized form
K = 2(2
n
– 1)3.1.3
Shift-Right instruction (f(x) = SHR(x))
It is also a single valued function. With x = 1010:(a)i
f(x, y)
&
i
f(x,y)
reduce to
i
f(x)
and(b)
i
f(x, y)
&
i
f(x, y)
reduce to
i
f(x)
Now
i
f(x)
represents the value of x, after SHRoperation i.e. 1010
0101 andi
f(x)
represents thevalue of
x
after SHR operation i.e. 0101
0010.Hence, K = 0101 + 0101 + 0010 + 0010or K = 5 + 5 + 2 + 2 = 14Generalized form
K = 2(2
n-1
– 1)3.1.4
Shift-Left instruction (f(x) = SHL(x))
With the same explanation as in section 3.1.3,the equation 1 becomes:iiii
K = f(x) + f(x) + f(x) + f(x)
UbiCC Journal - Volume 3
3
Leave a Comment