2016-04-11 11:58:54 -04:00
|
|
|
//#############################################################################
|
2016-06-19 17:08:46 -04:00
|
|
|
//# Function: Achive high latch #
|
2016-04-11 11:58:54 -04:00
|
|
|
//#############################################################################
|
|
|
|
//# Author: Andreas Olofsson #
|
2021-07-24 23:29:50 -04:00
|
|
|
//# License: MIT (see LICENSE file in OH! repository) #
|
2016-04-11 11:58:54 -04:00
|
|
|
//#############################################################################
|
|
|
|
|
2021-07-26 12:01:50 -04:00
|
|
|
module oh_lat1
|
|
|
|
#(parameter N = 1, // number of sync stages
|
|
|
|
parameter SYN = "TRUE", // synthesizable (or not)
|
|
|
|
parameter TYPE = "DEFAULT" // scell type/size
|
|
|
|
)
|
|
|
|
(input clk, // clk
|
|
|
|
input [N-1:0] in, // input data
|
|
|
|
output [N-1:0] out // output data
|
|
|
|
);
|
2016-04-11 11:58:54 -04:00
|
|
|
|
2021-07-26 12:01:50 -04:00
|
|
|
generate
|
|
|
|
if(SYN == "TRUE") begin
|
|
|
|
reg [N-1:0] out_reg;
|
|
|
|
always @ (clk or in)
|
|
|
|
if (clk)
|
|
|
|
out_reg[N-1:0] <= in[N-1:0];
|
|
|
|
|
|
|
|
assign out[N-1:0] = out_reg[N-1:0];
|
|
|
|
end
|
|
|
|
else begin
|
|
|
|
for (i=0;i<N;i=i+1) begin
|
|
|
|
asic_lat1 #(.TYPE(TYPE))
|
|
|
|
asic_lat1 (.clk(clk),
|
|
|
|
.in(in[i]),
|
|
|
|
.out(out[i]));
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endgenerate
|
2021-07-24 23:29:50 -04:00
|
|
|
|
2016-04-11 11:58:54 -04:00
|
|
|
endmodule // oh_lat1
|