2023-01-11 10:13:09 +00:00
|
|
|
/**
|
|
|
|
* Demultiplexor:
|
|
|
|
* {a, b} = {in, 0} if sel == 0
|
|
|
|
* {0, in} if sel == 1
|
|
|
|
*/
|
|
|
|
|
|
|
|
`default_nettype none
|
|
|
|
module DMux(
|
2024-10-17 18:36:58 +00:00
|
|
|
input in,
|
|
|
|
input sel,
|
2023-01-11 10:13:09 +00:00
|
|
|
output a,
|
2024-10-17 18:36:58 +00:00
|
|
|
output b
|
2023-01-11 10:13:09 +00:00
|
|
|
);
|
|
|
|
|
2024-10-17 18:36:58 +00:00
|
|
|
// Put your code here:
|
|
|
|
wire nsel;
|
2023-01-11 10:13:09 +00:00
|
|
|
|
2024-10-17 18:36:58 +00:00
|
|
|
Not NOT1(sel, nsel);
|
|
|
|
And AND1(in, sel, b);
|
|
|
|
And AND2(in, nsel, a);
|
2023-01-11 10:13:09 +00:00
|
|
|
endmodule
|