I was proposed a project that sounds like this.
Consider a set of logical gates like AND, OR, XOR or NOT. Allow for building any logical circuit by connecting such gates.
Provide input (0/1) to a number of gates and collect the results at the output of some of the gates.
Be able to read the description of the circuit from a file.
Has anyone done anything of this kind? What would you do, how would you start/shape this problem? I am looking for any help as much as possible, open to hints and solutions, anything is helpful.
I was suggested an idea like the one below, for a single AND gate, 2 inputs and a single output. Is this a good approach?
Thanks.
Consider a set of logical gates like AND, OR, XOR or NOT. Allow for building any logical circuit by connecting such gates.
Provide input (0/1) to a number of gates and collect the results at the output of some of the gates.
Be able to read the description of the circuit from a file.
Has anyone done anything of this kind? What would you do, how would you start/shape this problem? I am looking for any help as much as possible, open to hints and solutions, anything is helpful.
I was suggested an idea like the one below, for a single AND gate, 2 inputs and a single output. Is this a good approach?
public class LogicAnd extends Gate
{
public LogicAnd(int a, int b, int q) {
a_ = a; b_ =b; q_ = q;
}
public void Evaluate(int[] signals) {
signals[q_] = signals[a_]&signals[b_];
}
}
Thanks.