0 Members and 1 Guest are viewing this topic.

#### tiofilo75

• Contributor
• Posts: 37
« on: June 24, 2012, 09:22:17 am »
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.
« Last Edit: June 24, 2012, 09:57:28 am by tiofilo75 »

#### chrome

• Regular Contributor
• Posts: 189
• Country:
##### Re: 4-bit leading one detector?
« Reply #1 on: June 24, 2012, 09:32:02 am »

#### Psi

• Super Contributor
• Posts: 6325
• Country:
##### Re: 4-bit leading one detector?
« Reply #2 on: June 24, 2012, 09:57:41 am »
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)
« Last Edit: June 24, 2012, 10:10:46 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)

#### olsenn

• Frequent Contributor
• Posts: 997
##### Re: 4-bit leading one detector?
« Reply #3 on: June 24, 2012, 10: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!

#### Tony R

• Regular Contributor
• Posts: 117
• Country:
##### Re: 4-bit leading one detector?
« Reply #4 on: June 25, 2012, 09:37:57 pm »
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.
Tony R.
Computer Engineering Student
Focus: Embedded Assembly Programming, Realtime Systems,  IEEE Student Member

#### tiofilo75

• Contributor
• Posts: 37
##### Re: 4-bit leading one detector?
« Reply #5 on: June 26, 2012, 02:25:25 pm »
I was able to figure it out. Thanks for the help everyone.

Smf