Reputation: 1
I'm a software developer, and I'm trying to model a function using only AND
or OR
gates. I remember having similar subjects in my undergraduates, but I don't recall it. f(x,y,z,w)
is a function of four variables, and gets True
when AT LEAST two of the variables gets true
. How can I visually construct it using only AND
or OR
gates?
UPDATE: I think f= xy+xz+xw+yz+yw+zw
if I'm correct!
Upvotes: 1
Views: 249
Reputation: 521289
The following expression is logically what you want:
(xy) + (xz) + (xw) + (yz) + (yw) + (zw)
x (y + z + w) + y (z + w) + (zw)
Note that you don't need to check for cases of three or four TRUE
values, because they are already included in the check for two TRUE
values.
I represent AND
gates with scalar multiplication, and OR
gates using the addition operator (+
). Note that when you wire up the actual circuit you might even be able to simplify even more than I have by reusing pieces (e.g. z + w
).
Upvotes: 1