A)
XOR R1 R2 ==> after excution R1 contains R1 $\oplus$ R2
XOR R2 R1 ==> after this original R1 value is stored in R2 and R1 contains R1 $\oplus$ R2 ( since R2 $\oplus$ (R1 $\oplus$ R2) = R1)
XOR R1 R2 ==> after this original value of stored in R1
Thus with above code R1 and R2 values will get exhanged
B)
Our aim is to make a input so that output will depend on stuck at 1 line.
PROCEDURE TO FIND TEST VECTOR
1.We have to inactivate all inputs to last level gate except stuck line.
- To inactivate input lines of AND and NAND gate put 1 for all inputs other than stuck at line so that output will depend on stuck at line.
- To inactivate input lines of ORand NOR gate put 0 for all inputs other than stuck at line so that output will depend on stuck at line input.
2.Now give the opposite input to stuck at line( If line is stuck at one 1, give 0 as input and viceversa)
All possible inputs which satisfies will be test vecotors for a circuit.
Coming to question
Last level gate is NAND, so we inactivte input C i.e we take C=1
Since the other input to NAND is stuck at 1, we want to give opposite value, If A =B= 1, then we get 0 as input to last level NAND gate’s stuck at 1 line.
Therefore A=1,B=1,C=1 will be the test vector for given circuit.
If the output is 1, Then the circuit is working fine, Otherwise the line is stuck at 1