nand2/01_Boolean_Logic/Mux.v

25 lines
356 B
Coq
Raw Permalink Normal View History

/**
2023-01-11 10:13:09 +00:00
* Multiplexor:
* out = a if sel == 0
* b otherwise
*/
`default_nettype none
module Mux(
input a,
input b,
input sel,
output out
2023-01-11 10:13:09 +00:00
);
// Put your code here:
wire nsel;
wire outx;
wire outy;
2023-01-11 10:13:09 +00:00
Not NOT1(sel, nsel);
And AND1(b, sel, outx);
And AND2(a, nsel, outy);
Or OR(outx, outy, out);
2023-01-11 10:13:09 +00:00
endmodule