1. Member
Join Date
Aug 2009
Posts
1
Rep Power
0

## Logical Gates

Hi, I'm struggling with the topic of logical gates so I hope someone can help me out.
I'm having trouble with the following:
- boolean expressions, De Morgan Law and expressing terms in NOR/NAND only.
- designing circuits
- implementing circuits with given inputs/outputs (4 bit adder?)

An example of the question I'm struggling on would be:

'Write boolean expressions and design a ciruit with three inputs and one output such that the output is 1 if and only if two or more inpurs are 1.'

Help appreciated, I'm finding this topic so confusing.

2. little sample:
Java Code:
```public static boolean andGate(boolean in1, boolean in2){
if(in1 && in2)
return true;
return false;
}

public static boolean orGate(boolean in1, boolean in2){
if(in1 || in2)
return true;
return false;
}```
the int version would be:
Java Code:
```public static int andGate(int in1, int in2){
if(in1==1 && in2==1)
return 1;
return 0;
}

public static int orGate(int in1, int in2){
if(in1==1 || in2==1)
return 1;
return 0;
}```
Now you would do something similar for NOR/NAND using three inputs.