mux4to1.v (266B)
1 module mux4to1 (a, s, y); 2 input [3:0] a; 3 input [1:0] s; 4 output reg y; 5 6 /* run whenever a or s change */ 7 always @ (a, s) begin 8 case (s) 9 2'b00: y = a[0]; 10 2'b01: y = a[1]; 11 2'b10: y = a[2]; 12 2'b11: y = a[3]; 13 default: y = 0; 14 endcase 15 end 16 endmodule