nand2/01_Boolean_Logic/DMux.v

22 lines
317 B
Verilog

/**
* Demultiplexor:
* {a, b} = {in, 0} if sel == 0
* {0, in} if sel == 1
*/
`default_nettype none
module DMux(
input in,
input sel,
output a,
output b
);
// Put your code here:
wire nsel;
Not NOT1(sel, nsel);
And AND1(in, sel, b);
And AND2(in, nsel, a);
endmodule