Main BLOGGER
Google
WWW THIS BLOG
Monday, April 04, 2005
 
3-inv by two inverters
You have plenty of ANDs and ORs, but only 2 inverters. Can you invert more than 2 independent inputs?
•CHALLENGE: Come up with a combinational circuit using ANDs, ORs, and at most 2 inverters that inverts A, B, and C !
•Such a circuit exists. What does that mean?
-If we can invert 3 signals using 2 inverters, can we use 2 of the pseudo-inverters to invert 3 more signals?
-Do we need only 2 inverters to make ANY combinational circuit?


#include
void main(){
int a,b,c,x,y,z,g,h,a1,b1,c1,x1,y1,z1;
int i;
for(i=0;i<8;i++){ //a =" i" b =" (i">> 1;
c = (i & 4) >> 2;

x = a & b & c; // == three ones
y = a & b | a & c | b & c; // == at least two ones
z = a | b | c; // == at least single one

//Here are our 2 inverters
g = !(y); // zero or single one
h = !(x | g & z); //zero or two ones

x1 = g | h; //zero or single, or two ones
y1 = g; // zero or single one
z1 = g & h; // zero one
a1 = b & c & x1 | (b | c) & y1 | z1; //three zeros or ...
b1 = a & c & x1 | (a | c) & y1 | z1;
c1 = b & a & x1 | (b | a) & y1 | z1;

//print outputs to verify
printf("%d-->%d %d-->%d %d-->%d\n",a,a1,b,b1,c,c1);
printf("x1=%d,y1=%d,z1=%d\n",x1,y1,z1);
}
}

/*
Input output
a b c x1 y1 z1
0 0 0 1 1 1
0 0 1 1 1 0
0 1 0 1 1 0
1 0 0 1 1 0
1 0 1 1 0 0
0 1 1 1 0 0
1 1 0 1 0 0
1 1 1 0 0 0
*/



<< Home

Powered by Blogger

Google
WWW THIS BLOG