| Question |
Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
|
Question Submitted By :: Newbie |
|
I also faced this Question!! |
Rank |
Answer Posted By |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 1 | Add the digits and check the sum. It would imply a 3-bit
adder (max. value = 8 can be represented with three bits)
and compare the result to 011.
| | Esther |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 2 | 3 input AND those 3 bits. No adder needed...
| | Josh |
| |
|
|
| |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 3 | for serially arriving stream:
use a 2 bit accumulator( S1 and S2) with outputs O1 and O2.
Final Output will be Y = ~O1 . O2
For parallel,
use combinational logic , probably priority encoder to
reduce delay.
| | Kalyanpa |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 4 | keep the number in A reg and ratate it 8 times if carry
generates more than 3 it will indicate a non desired numer
| | Priya |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 5 | step1: start
step2: mov the byte to accumulator
step3: intialize length = 0 , count = 0
step4: rotate acc. to right through carry.
step5: if carry = 1 , increment count
step6: increment length
step7: if length < 8 , goto step3
step8: if count = 3 , (do required action)
step9: end
| | Ravichandra |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 6 | Step 1: Store the 8 bit value in a accumulator
Step 2: Store 0x1 in a register0, initialize two counter
with 0 i.e. store zero in a reg1 and reg2.
LOOP:
Step 3: Check if AND operation between the value in
register0 and accumulator is set i.e. 1
if yes, increment reg1 and reg2
If no, increment only reg2
step 4: Left shift the value of register0 by 1
step 5: if ( reg2 >=8), exit LOOP
if ( reg1 >= 3), show that 3 bit is set
Else Go To LOOP
MOV XAR1, #Data
MOV XAR0, #0
MOV XAR2, #0
Loop:
TBIT *XAR1, #Count
BF Loop1, NTC
INR *XAR0
Loop1:
INR *XAR2
MOV AL, *XAR1
CMP AL, #0x03
BF Loop3, EQ
MOV AL, *XAR2
CMP AL, #0x80
BF Loop, NEQ
Loop3:
EXIT
| | Gautam Bhattacharya |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 7 | Sorry thr was a bit mistake. Corrected :
MOV XAR1, #Data
MOV XAR0, #0
MOV XAR2, #0
Loop:
TBIT *XAR1, *XAR2
BF Loop1, NTC
INR *XAR0
Loop1:
INR *XAR2
MOV AL, *XAR0
CMP AL, #0x03
BF Loop3, EQ
MOV AL, *XAR2
CMP AL, #0x80
BF Loop, NEQ
Loop3:
EXIT
| | Gautam |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 8 | I have modified it a bit,
MOVL XAR1, #Data
MOVL XAR0, #0x00
MOVL XAR2, #0x00
Loop:
TBIT *XAR1,#XAR2
BF Loop1, NTC
INR AR0
Loop1:
INR AR2
MOV AL, *XAR0
CMP AL, @0x03
BF Action, EQ
MOV AL, *XAR2
CMP AL, @0x08
BF Loop, NEQ
Loop3:
EXIT
Action:
| | Gautam |
| |
|
Re: Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100) |
Answer
# 9 | You fools...the question is to design a circuit
(hardware)..not writing a program.
| | Xyz |
| |
| |