# How can i design this function using only NAND and XOR gates?

I have this initial function \begin{split}(\overline{A}+\overline{B})(\overline{D}+\overline{C})+AB\overline{(\overline{C}+\overline{D})}\end{split} Which i reduced to \begin{split}{\overline{AB}*\overline{CD}}+ABCD \end{split} The first part is easy to do with NAND but the OR ABCD part i have no ideia how to do...I suspect thats where the XOR comes in and i maybe shouldn't have reduced so much the function.

• You can express everything just with NANDs. Dec 30, 2017 at 10:29

I have assumed that only 2 input NAND gates are available.

For $\overline {AB}*\overline {CD}$

Take A and B as input and feed them to a NAND gate. U will get $\overline {AB}$. Similarly u can get $\overline {CD}$.

Now feed $\overline {AB}$ and $\overline {CD}$ as input to another NAND gate . U will get AB + CD using demorgan law.

For ABCD take $\overline {AB}$ and complement it using a NAND gate to get AB. Take $\overline {CD}$ and complement it to get CD. Now feed AB and CD to NAND gate. You will get $\overline {ABCD}$.

Now feed (AB+CD) and (ABCD)' to NAND gate. U will get $\overline{(AB+CD)\overline{(ABCD})}$.Apply demorgan law. U have ur answer.

The trick is to express the function as a sum of products which u already have. Now derive the complement of each product term. When all product terms have been derived then feed then to a NAND gate. This final NAND gate will complement the already complemented product terms and add them thus giving the desired answer.