module dec2to4 ( d, y); input [1:0] d; output [3:0] y; wire [1:0] w; not g1(w[0], d[0]); not g2 (w[1], d[1]); // not (w[0], din[0]), (w[1], din [1]); and g3 (y[0], w[1], w[0]); and g4 (y[1], w[1], d[0]); and g5 (y[2], d[1], w); and g6 (y[3], d[1], d[0]); endmodule `timescale 1ns / 1ns module dec2to4_tb; reg [1:0] din; wire [3:0] dout; dec2to4 uut ( .d(din), .y(dout) ); //dec2to4 uut ( din, dout) ; initial begin din = 2'b00; #10 din = 2'b01; #10 din = 2'b10; #10 din = 2'b11; #10 $stop; end initial $monitor($time, "ns, din=%b, dout=%b", din, dout); endmodule