1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/stdlib/rtl/oh_lat1.v
Andreas.Olofsson e631bfe3f1 Fixing naming error
-The directory should contain rtl only.
-HDL is too broad a term
2022-06-22 11:04:54 -04:00

38 lines
1.1 KiB
Verilog

//#############################################################################
//# Function: Achive high latch #
//#############################################################################
//# Author: Andreas Olofsson #
//# License: MIT (see LICENSE file in OH! repository) #
//#############################################################################
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
);
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
endmodule // oh_lat1