1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/common/hdl/oh_clockmux.v
Andreas.Olofsson 9e9d323025 Changing the CFG_ASIC approach
-Should be ifdef, since this is a global. You will never be doing and not an asic at the same time!
2020-02-04 23:04:52 -05:00

37 lines
1.1 KiB
Verilog

//#############################################################################
//# Function: Clock mux #
//#############################################################################
//# Author: Andreas Olofsson #
//# License: MIT (see LICENSE file in OH! repository) #
//#############################################################################
module oh_clockmux #(parameter N = 1) // number of clock inputs
(
input [N-1:0] en, // one hot enable vector (needs to be stable!)
input [N-1:0] clkin,// one hot clock inputs (only one is active!)
output clkout
);
`ifdef CFG_ASIC
generate
if((N==2))
begin : asic
asic_clockmux2 imux (.clkin(clkin[N-1:0]),
.en(en[N-1:0]),
.clkout(clkout));
end
else if((N==4))
begin : asic
asic_clockmux4 imux (.clkin(clkin[N-1:0]),
.en(en[N-1:0]),
.clkout(clkout));
end
endgenerate
`else // !`ifdef CFG_ASIC
assign clkout = |(clkin[N-1:0] & en[N-1:0]);
`endif
endmodule // oh_clockmux