1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-02-07 06:44:09 +08:00
oh/stdlib/rtl/oh_mux2.v

22 lines
787 B
Coq
Raw Normal View History

//#############################################################################
//# Function: 2:1 one hot mux #
//#############################################################################
//# Author: Andreas Olofsson #
//# License: MIT (see LICENSE file in OH! repository) #
//#############################################################################
module oh_mux2 #(parameter N = 1 ) // width of mux
(
input sel1,
input sel0,
input [N-1:0] in1,
input [N-1:0] in0,
output [N-1:0] out //selected data output
);
assign out[N-1:0] = ({(N){sel0}} & in0[N-1:0] |
{(N){sel1}} & in1[N-1:0]);
endmodule // oh_mux2