2016-06-24 22:11:23 -04:00
|
|
|
//#############################################################################
|
|
|
|
//# Function: Clock 'OR' gate #
|
|
|
|
//#############################################################################
|
|
|
|
//# Author: Andreas Olofsson #
|
|
|
|
//# License: MIT (see LICENSE file in OH! repository) #
|
|
|
|
//#############################################################################
|
|
|
|
|
2016-08-17 15:06:01 +01:00
|
|
|
module oh_clockor #(parameter N = 1) // number of clock inputs
|
2016-06-24 22:11:23 -04:00
|
|
|
(
|
|
|
|
input [N-1:0] clkin,// one hot clock inputs (only one is active!)
|
|
|
|
output clkout
|
|
|
|
);
|
|
|
|
|
2020-02-04 23:04:52 -05:00
|
|
|
`ifdef CFG_ASIC
|
2016-06-24 22:11:23 -04:00
|
|
|
generate
|
2020-02-04 23:04:52 -05:00
|
|
|
if((N==4))
|
2016-06-24 22:11:23 -04:00
|
|
|
begin : asic
|
2016-09-03 14:40:51 -04:00
|
|
|
asic_clockor4 ior (/*AUTOINST*/
|
|
|
|
// Outputs
|
|
|
|
.clkout (clkout),
|
|
|
|
// Inputs
|
|
|
|
.clkin (clkin[3:0]));
|
|
|
|
|
|
|
|
end // block: g0
|
2020-02-04 23:04:52 -05:00
|
|
|
else if((N==2))
|
2016-09-03 14:40:51 -04:00
|
|
|
begin : asic
|
|
|
|
asic_clockor2 ior (/*AUTOINST*/
|
|
|
|
// Outputs
|
|
|
|
.clkout (clkout),
|
|
|
|
// Inputs
|
|
|
|
.clkin (clkin[1:0]));
|
2016-06-24 22:11:23 -04:00
|
|
|
end
|
2020-02-04 23:04:52 -05:00
|
|
|
endgenerate
|
|
|
|
`else
|
|
|
|
assign clkout = |(clkin[N-1:0]);
|
|
|
|
`endif
|
|
|
|
|
2016-06-24 22:11:23 -04:00
|
|
|
endmodule // oh_clockmux
|
|
|
|
|
|
|
|
|