The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+12 votes
806 views
  1. Assume that a CPU has only two registers $R_1$ and $R_2$ and that only the following instruction is available $XOR \: R_i, R_j;\{R_j \leftarrow R_i \oplus R_j, \text{ for } i, j =1, 2\}$

    Using this XOR instruction, find an instruction sequence in order to exchange the contents of the registers $R_1$ and $R_2$

  2. The line p of the circuit shown in figure has stuck at 1 fault. Determine an input test to detect the fault.

asked in CO & Architecture by Veteran (59.7k points)
edited by | 806 views
+2
Editors,please correct the diagram given, as answer points out that both gates are NAND gate.please check and verify.

3 Answers

+11 votes
Best answer

$R$1 $\leftarrow$ R1 XOR $R2$

$R2$ $\leftarrow$ R2 XOR $R1$

$R1$ $\leftarrow$ R1 XOR $R2$

Stuck at $0$ fault :: A stuck-at fault is a particular fault model used by fault simulators and automatic test pattern generation (ATPG) tools to mimic a manufacturing defect within an integrated circuit. Individual signals and pins are assumed to be stuck at Logical '1', '0' and 'X'.

Stuck at line $1$ means no matter whatever input we provide to the line the output is always $1.$
Now, when we take $A=1 ,B=1,C=1$ the required output ,if no fault is there should be $1.$

But, since line p is stuck at logic $1$ final output of A NAND B will be $1$ only .So, final circuit output becomes $0.($which is wrong$)$

REFERENCE : https://www.tutorialspoint.com/digital_electronics/stuckat1_fault_in_logic_circuit.asp

answered by Loyal (9.5k points)
edited by
+1
given gates are and or nand ?
0
I think Nand :P
0
for Part (a)

R2<- R1 XOR R2

R1<- R2 XOR R1

R2<- R1 XOR R2

this is correct or not?
0

@Vidhi &@shikha 

At

A=1 , B=1 C=1

the required output ,if no fault is there should be 0 and not 1.

(   (  (A=1).(B=1)  )    .  (C=1)    )'

(    (          1          )    .   (  1   )   )'

( 1)' =0

0
Here is how I solved this question

NAND table

1 NAND 0 -> 1  

0 NAND 0 -> 1

1 NAND 1 -> 0

If we provide 0 to C. And even if output of AND gate is 0 or 1 (stuck at 1) , output of NAND gate will still be 1.

Hence no use of providing 0 to C. Hence we provide 1 to C.

Now if output of AND is 1 then output of NAND will be 0

 &    if output of AND is 0  then output of NAND will be 1

       But if output of AND is stuck at 1 then output of NAND will be never be 1

Hence to test this we intentionally make output of AND 0, either by (A=0 & B=0) or (A=1 & B=0) or (A=0 & B=1)
0

What does this symbol represents??

0

CHIRAG CHAWLA 
It means there is fault either 0 ,1 or X.

+7 votes
(a)
R2 $\impliedby$ R1 $\oplus$ R2
R1 $\impliedby$ R2 $\oplus$ R1
R2 $\impliedby$ R1 $\oplus$ R2

(b) A=1, B=1, C=1 should give output as 1 but as p is struck at 1 fault the output comes out to be 0.
answered by Boss (34.1k points)
0
What is stuck at 1 fault???
0

Rajarshi Sarkar At

R2 ⟸ R1 ⊕ R2
R1 ⟸ R2 ⊕ R1
R2 ⟸ R1 ⊕ R2

Why R2 is written two times?

0

@Utkarsh Anand

How to swap two number using XOR? You can check here, a very beautiful explanation is given.

https://betterexplained.com/articles/swap-two-variables-using-xor/

0
We can swap two variables (a,b) in c language as:

a=a-b

b=a+b

a=b-a

Now here a and b will be having one bit only. So one bit addition of two numbers can be done by half adder.

Sum=diff=a exor b

a=a exor  b

b=a exor  b

a=b exor  a
+2 votes
stuck at 1 fault means we have doubt that p is always giving one , so we should give input (test vector ) such a way that it will pass input through the p as we have given for that input of A*B=0 for that three vectors (a=0,b=0),(a=1,b=0),(a=0,b=1) , now, how we will make sure that p is passing right input given by us or not when we put C=1 , and final output =0 it means yess , p has not stucked at 1

 

so test vector will be (a=0,b=0,c=1)(a=0,b=1,c=1)(a=1,b=0,c=1) so three test vectors are there for this question
answered by Active (4.9k points)
0
you are assuming and gate ?

i think they are nand

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,458 questions
49,915 answers
165,405 comments
65,897 users