Logic Circuit - Find the first set bit in 4 bit number

Thread Starter

Mora

Joined Apr 26, 2017
2
Hello,

I need to design a logic circuit:

4 inputs
2 output of the place of the first set bit
1 output if there is any set bit (or between the inputs)

What can I do to find the place of the first set bit?

by the way, after that I need to design a circuit to find the place of the most left set bit, so I will be happy if you'll help with that too.
Thanks.
 

WBahn

Joined Mar 31, 2012
30,071
Since this is Homework Help and not Homework Done For You, YOU need to make some attempt to work YOUR homework. Show you best attempt and then we can provide hints and suggestions about where you are going wrong and how you might get back on track.

Consider if I gave you a random truth table for a function of four inputs. Could you design a logic circuit that implemented that truth table? If so, can you apply that concept to this problem?
 

Thread Starter

Mora

Joined Apr 26, 2017
2
Hey,

Sure I can do 2 truth tables for Y0 and Y1 (Yes?) , I thought maybe I can use other components (like mux,adder..) and not only logic gates.

Just to say, I don't want you to do my homework.. Hints will help me the solve it :) .
 

WBahn

Joined Mar 31, 2012
30,071
Hey,

Sure I can do 2 truth tables for Y0 and Y1 (Yes?)
What are Y0 and Y1? If you are going to use a term (or signal name), you really need to define what it is. Don't make your audience guess -- engineering is not about guessing.

I thought maybe I can use other components (like mux,adder..) and not only logic gates.
There are a number of ways to solve a problem like this, ranging from a look-up table to a sequential state machine and several approaches in between. For instance, if you want to consider using an adder, describe how the adder would be helpful in solving the problem.

Just to say, I don't want you to do my homework.. Hints will help me the solve it :) .
We have no idea what you have learned or what topics are fair game for this particular problem in this particular course, which is a big reason why it works best for you to show your best attempt -- it provides us with a lot of useful information about the context in which you are solving the problem and about the skill level you are bringing to the table.
 

dl324

Joined Mar 30, 2015
16,935
What can I do to find the place of the first set bit?
Start by drawing a truth table.


EDIT: And the complete text of the problem. How do you handle the situation where multiple bits are set?
 
Last edited:

WBahn

Joined Mar 31, 2012
30,071
Start by drawing a truth table.


EDIT: And the complete text of the problem. How do you handle the situation where multiple bits are set?
I think that's conceptually well defined -- he is to report the position of the "first" bit that is set.

But there is the question of which end the bit positions are numbered. Usually (and it's the guessing game, again) the lsb is considered position 0. The TS really needs to confirm that, though.
 

RBR1317

Joined Nov 13, 2010
714
Since the requirement is to design for indication of SET bits, if there are no bits set, ie. '0000', will that be considered a "don't care" condition?
 

WBahn

Joined Mar 31, 2012
30,071
Since the requirement is to design for indication of SET bits, if there are no bits set, ie. '0000', will that be considered a "don't care" condition?
More than likely, since the third output provides the information needed to know that whatever the other two bits say is meaningless.
 
Top