2020-11-16 14:07:32 -06:00
|
|
|
module LUT4 #(
|
|
|
|
parameter [15:0] INIT = 0
|
|
|
|
) (
|
|
|
|
input A, B, C, D,
|
2020-11-20 17:53:09 -06:00
|
|
|
output Z
|
2020-11-16 14:07:32 -06:00
|
|
|
);
|
|
|
|
wire [3:0] I;
|
|
|
|
wire [3:0] I_pd;
|
|
|
|
|
|
|
|
genvar ii;
|
|
|
|
generate
|
|
|
|
for (ii = 0; ii < 4; ii = ii + 1'b1)
|
|
|
|
assign I_pd[ii] = (I[ii] === 1'bz) ? 1'b0 : I[ii];
|
|
|
|
endgenerate
|
|
|
|
|
|
|
|
assign I = {D, C, B, A};
|
2020-11-20 17:53:09 -06:00
|
|
|
assign Z = INIT[I_pd];
|
2020-11-16 14:07:32 -06:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FACADE_FF #(
|
|
|
|
parameter GSR = "ENABLED",
|
|
|
|
parameter CEMUX = "1",
|
|
|
|
parameter CLKMUX = "0",
|
|
|
|
parameter LSRMUX = "LSR",
|
|
|
|
parameter LSRONMUX = "LSRMUX",
|
|
|
|
parameter SRMODE = "LSR_OVER_CE",
|
|
|
|
parameter REGSET = "SET"
|
|
|
|
) (
|
2020-11-17 11:49:15 -06:00
|
|
|
input CLK, DI, LSR, CE,
|
2020-11-16 14:07:32 -06:00
|
|
|
output reg Q
|
|
|
|
);
|
|
|
|
|
|
|
|
wire muxce;
|
|
|
|
generate
|
|
|
|
case (CEMUX)
|
|
|
|
"1": assign muxce = 1'b1;
|
|
|
|
"0": assign muxce = 1'b0;
|
|
|
|
"INV": assign muxce = ~CE;
|
|
|
|
default: assign muxce = CE;
|
|
|
|
endcase
|
|
|
|
endgenerate
|
|
|
|
|
|
|
|
wire muxlsr = (LSRMUX == "INV") ? ~LSR : LSR;
|
|
|
|
wire muxclk = (CLKMUX == "INV") ? ~CLK : CLK;
|
2020-11-17 13:22:44 -06:00
|
|
|
wire srval = (REGSET == "SET") ? 1'b1 : 1'b0;
|
2020-11-16 14:07:32 -06:00
|
|
|
|
|
|
|
generate
|
|
|
|
if (SRMODE == "ASYNC") begin
|
|
|
|
always @(posedge muxclk, posedge muxlsr)
|
|
|
|
if (muxlsr)
|
|
|
|
Q <= srval;
|
|
|
|
else if (muxce)
|
|
|
|
Q <= DI;
|
|
|
|
end else begin
|
|
|
|
always @(posedge muxclk)
|
|
|
|
if (muxlsr)
|
|
|
|
Q <= srval;
|
|
|
|
else if (muxce)
|
|
|
|
Q <= DI;
|
|
|
|
end
|
|
|
|
endgenerate
|
|
|
|
endmodule
|