EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: tiofilo75 on June 23, 2012, 11:22:17 pm

Title: 4-bit leading one detector?
Post by: tiofilo75 on June 23, 2012, 11:22:17 pm
Hello everyone. This is my first post. I am currently going to school and am having some trouble understanding one of my assignments. I have tried Google but I am still confused. So I am suppose to come up with a Boolean function that detects the leading ones in 4 bits. Can some one please shed me some light?

I know about kmaps, I just dont know how fill up the rest of the truth table. What exactly is a "leading one detector"? What exactly are my Z , L1 and L2 outputs?

Ok, I figured out that the L1 and L2 give the position of the leading 1 in binary. I just need to figure out what Z is.
Title: Re: 4-bit leading one detector?
Post by: chrome on June 23, 2012, 11:32:02 pm
http://en.wikipedia.org/wiki/Karnaugh_maps (http://en.wikipedia.org/wiki/Karnaugh_maps)
Title: Re: 4-bit leading one detector?
Post by: Psi on June 23, 2012, 11:57:41 pm
A leading one detector just provides the position of the first 1.
The word "leading" indicates your looking for the first one starting from the MSB and moving right towards LSB.
(A trailing one detector would look for the first 1 starting at LSB moving left to MSB)

So, using the existing middle line of the truth table as an example

B3 B2 B1 B0
0   1    1   1

Starting from the MSB, B3 (0) and looking for the first one we find it in the B2 position.
B2 = 2 which is 10 in binary, so (L1=1 L0=0)
Title: Re: 4-bit leading one detector?
Post by: olsenn on June 24, 2012, 12:01:43 am
It looks to me like what this system is described by the following relationship:

        If B0, B1, B2, and B3 are 0, Z=1, and L1/L2 don't matter. Otherwise, Z=0
        If Z=0, the number L1L0 = the most significant bit that is 1

So when B3 B2 B1 B0 == 0 0 0 1, B0 is the MSB that is 1, so L1 L0 == 0 0 (0 in decimal)
     when B3 B2 B1 B0 == 0 1 1 1, B2 is the MSB that is 1, so L1 L0 == 1 0 (2 in decimal)
     when B3 B2 B1 B0 == 1 1 1 0, B3 is the MSB that is 1, so L1 L0 == 1 1 (3 in decimal)
     when B3 B2 B1 B0 == 1 1 1 1, B3 is the MSB that is 1, so L1 L0 == 1 1 (3 in decimal)

... In theory, if B3 B2 B1 B0 == 0 0 1 0, or 0 0 1 1, B1 would be the MSB that is 1, so L1 L0 would be 0 1 (1 in decimal)


Hope this helps!
             
Title: Re: 4-bit leading one detector?
Post by: Tony R on June 25, 2012, 11:37:57 am
If we did this for you you would not learn...

so this here are some tips

1) complete the truth table with all 16 values. (by observing the truth table the L1 and L2 are your most significant one.) and z means zero.

0001 => 00
001x => 01
01xx => 02
1xxx => 03

now that I think about it it is a lot like a priority encoder.

2) Separate it out into 3 separate tables one for Z, L1 and L2 and then do the simplification.
Title: Re: 4-bit leading one detector?
Post by: tiofilo75 on June 26, 2012, 04:25:25 am
 I was able to figure it out. Thanks for the help everyone. :)