diff options
Diffstat (limited to 'control_lib/mux4.v')
-rw-r--r-- | control_lib/mux4.v | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/control_lib/mux4.v b/control_lib/mux4.v new file mode 100644 index 000000000..31c85c832 --- /dev/null +++ b/control_lib/mux4.v @@ -0,0 +1,16 @@ + + +module mux4 + #(parameter WIDTH=32, parameter DISABLED=0) + (input en, + input [1:0] sel, + input [WIDTH-1:0] i0, + input [WIDTH-1:0] i1, + input [WIDTH-1:0] i2, + input [WIDTH-1:0] i3, + output [WIDTH-1:0] o); + + assign o = en ? (sel[1] ? (sel[0] ? i3 : i2) : (sel[0] ? i1 : i0)) : + DISABLED; + +endmodule // mux4 |