- on your diagram, did you confuse
PE2
and PE3
outputs?
- for
1111111
, PE1..PE7
are all going to be 1
, so the last diagram would be wrong.
NAND
is a much easier function to play with for consecutive 1
s.
here's how I would do it:
LEN1 = AND(OR(a,b,c,d,e,f,g),NOR(NAND(a,b),NAND(b,c),NAND(c,d),NAND(d,e),NAND(e,f),NAND(f,g)))
LEN2 = AND(OR(NAND(a,b),NAND(b,c),NAND(c,d),NAND(d,e),NAND(e,f),NAND(f,g)),
NOR(NAND(a,b,c),NAND(b,c,d),NAND(c,d,e),NAND(d,e,f),NAND(e,f,g)))
LEN3 = AND(OR(NAND(a,b,c),NAND(b,c,d),NAND(c,d,e),NAND(d,e,f),NAND(e,f,g)),
NOR(NAND(a,b,c,d),NAND(b,c,d,e),NAND(c,d,e,f),NAND(d,e,f,g)))
LEN4 = AND(OR(NAND(a,b,c,d),NAND(b,c,d,e),NAND(c,d,e,f),NAND(d,e,f,g)),
NOR(NAND(a,b,c,d,e),NAND(b,c,d,e,f),NAND(c,d,e,f,g)))
LEN5 = AND(OR(NAND(a,b,c,d,e),NAND(b,c,d,e,f),NAND(c,d,e,f,g)),
NOR(NAND(a,b,c,d,e,f),NAND(b,c,d,e,f,g))
LEN6 = AND(OR(NAND(a,b,c,d,e,f),NAND(b,c,d,e,f,g)),
NOT(NAND(a,b,c,d,e,f,g)))
LEN7 = NOT(NAND(a,b,c,d,e,f,g))
ANS1 = OR(LEN1,LEN3,LEN5,LEN7)
ANS2 = OR(LEN2,LEN3,LEN6,LEN7)
ANS3 = OR(LEN4,LEN5,LEN6,LEN7)
Best Answer
I'm not sure how to give you a hint without giving you the complete answer.
But consider the difference between these two situations: