Design a circuit to detect when 3 and only 3 bits are set
out of 8 bits.(eg. o0101100)
Answers were Sorted based on User's Feedback
Answer / xyz
You fools...the question is to design a circuit
(hardware)..not writing a program.
Is This Answer Correct ? | 31 Yes | 0 No |
Answer / esther
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.
Is This Answer Correct ? | 31 Yes | 2 No |
Answer / jayasuriya
Use a 8 bit parallel in serial out shift register. Use the
serial out bit to increment a counter(a 3 bit register), if
its one. After 8 shifts, compare the counter with 011b to
detect 3.
Is This Answer Correct ? | 21 Yes | 1 No |
Answer / priya
keep the number in A reg and ratate it 8 times if carry
generates more than 3 it will indicate a non desired numer
Is This Answer Correct ? | 12 Yes | 5 No |
Answer / aiyush
The first guy's got it write, every other answer is more
complicated than needed. Also, we cannot use a 3-input AND
like the second guy said b/c we are given 8 bits, not 3. A
3-bit adder and a comparator is all you need.
Is This Answer Correct ? | 5 Yes | 2 No |
Answer / ravichandra
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
Is This Answer Correct ? | 6 Yes | 4 No |
Answer / arnab kumar biswas
2 bit adder will do the trick.give 0 to one i/p.and transmit
the bits serially one by one to the other i/p.o/p of the
adder goes to latch,where it will stay until 8 bits have
come.then use comparator to compare if answer is 3 or not.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kalyanpa
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.
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / gautam bhattacharya
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
Is This Answer Correct ? | 0 Yes | 3 No |
Tell me significance of watchdog timer in embedded systems?
Tell me what is the purpose of using critical sections?
What is an embedded system and why it is used?
Tell me can a pointer be volatile?
What is inversion of control?
Why is java mostly used in embedded systems?
What value do daily builds, automated testing, and peer reviews add to a project? What disadvantages are there?
Tell me can include files be nested?
What is the difference between a web server, web farm and web garden? How would your web application need to change for each?
What is the size of the int, char and float data types?
Tell me what are the 4 types of inheritance relationship?
What is mutex precisely used for?