A better way...
module and_gate (out, in1, in2); input in1, in2; output out;
assign out = myfunction(in1, in2);
? Compiler will fail if function does not
If you build a function wrong, the circuit
? If you build an always block wrong,
Use functions for complex combinational logic
- Functions can’t have state