2017-06-24 08:59:20 -05:00
|
|
|
module IBUF(input I, output O);
|
|
|
|
assign O = I;
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module IOBUFE(input I, input E, output O, inout IO);
|
|
|
|
assign O = IO;
|
|
|
|
assign IO = E ? I : 1'bz;
|
|
|
|
endmodule
|
|
|
|
|
2017-06-24 10:51:24 -05:00
|
|
|
module ANDTERM(IN, IN_B, OUT);
|
|
|
|
parameter TRUE_INP = 0;
|
|
|
|
parameter COMP_INP = 0;
|
2017-06-24 08:59:20 -05:00
|
|
|
|
2017-06-24 10:51:24 -05:00
|
|
|
input [TRUE_INP-1:0] IN;
|
|
|
|
input [COMP_INP-1:0] IN_B;
|
2017-06-24 08:59:20 -05:00
|
|
|
output reg OUT;
|
|
|
|
|
|
|
|
integer i;
|
|
|
|
|
|
|
|
always @(*) begin
|
|
|
|
OUT = 1;
|
2017-06-24 10:51:24 -05:00
|
|
|
for (i = 0; i < TRUE_INP; i=i+1)
|
|
|
|
OUT = OUT & IN[i];
|
|
|
|
for (i = 0; i < COMP_INP; i=i+1)
|
|
|
|
OUT = OUT & ~IN_B[i];
|
2017-06-24 08:59:20 -05:00
|
|
|
end
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module ORTERM(IN, OUT);
|
|
|
|
parameter WIDTH = 0;
|
|
|
|
|
|
|
|
input [WIDTH-1:0] IN;
|
|
|
|
output reg OUT;
|
|
|
|
|
|
|
|
integer i;
|
|
|
|
|
|
|
|
always @(*) begin
|
|
|
|
OUT = 0;
|
|
|
|
for (i = 0; i < WIDTH; i=i+1) begin
|
|
|
|
OUT = OUT | IN[i];
|
|
|
|
end
|
|
|
|
end
|
|
|
|
endmodule
|
2017-06-25 04:20:42 -05:00
|
|
|
|
|
|
|
module MACROCELL_XOR(IN_PTC, IN_ORTERM, OUT);
|
|
|
|
parameter INVERT_OUT = 0;
|
|
|
|
|
|
|
|
input IN_PTC;
|
|
|
|
input IN_ORTERM;
|
|
|
|
output wire OUT;
|
|
|
|
|
|
|
|
wire xor_intermed;
|
|
|
|
|
|
|
|
assign OUT = INVERT_OUT ? ~xor_intermed : xor_intermed;
|
2017-06-25 04:56:45 -05:00
|
|
|
assign xor_intermed = IN_ORTERM ^ IN_PTC;
|
2017-06-25 04:20:42 -05:00
|
|
|
endmodule
|
2017-06-25 22:16:43 -05:00
|
|
|
|
|
|
|
module FDCP (C, PRE, CLR, D, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, D;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
else
|
|
|
|
Q <= D;
|
|
|
|
end
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FDCP_N (C, PRE, CLR, D, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, D;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(negedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
else
|
|
|
|
Q <= D;
|
|
|
|
end
|
|
|
|
endmodule
|
2017-06-25 22:58:45 -05:00
|
|
|
|
|
|
|
module LDCP (G, PRE, CLR, D, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input G, PRE, CLR, D;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @* begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (G == 1)
|
|
|
|
Q <= D;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
end
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module LDCP_N (G, PRE, CLR, D, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input G, PRE, CLR, D;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @* begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (G == 0)
|
|
|
|
Q <= D;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
end
|
|
|
|
endmodule
|
2017-06-26 01:56:16 -05:00
|
|
|
|
|
|
|
module BUFG(I, O);
|
|
|
|
input I;
|
|
|
|
output O;
|
|
|
|
|
|
|
|
assign O = I;
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module BUFGSR(I, O);
|
2017-08-07 06:01:18 -05:00
|
|
|
parameter INVERT = 0;
|
|
|
|
|
2017-06-26 01:56:16 -05:00
|
|
|
input I;
|
|
|
|
output O;
|
|
|
|
|
2017-08-07 06:01:18 -05:00
|
|
|
assign O = INVERT ? ~I : I;
|
2017-06-26 01:56:16 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module BUFGTS(I, O);
|
2017-08-07 06:01:18 -05:00
|
|
|
parameter INVERT = 0;
|
|
|
|
|
2017-06-26 01:56:16 -05:00
|
|
|
input I;
|
|
|
|
output O;
|
|
|
|
|
2017-08-07 06:01:18 -05:00
|
|
|
assign O = INVERT ? ~I : I;
|
2017-06-26 01:56:16 -05:00
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FDDCP (C, PRE, CLR, D, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, D;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge C, negedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
else
|
|
|
|
Q <= D;
|
|
|
|
end
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FTCP (C, PRE, CLR, T, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, T;
|
|
|
|
output wire Q;
|
|
|
|
reg Q_;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q_ <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q_ <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q_ <= 1;
|
|
|
|
else if (T == 1)
|
|
|
|
Q_ <= ~Q_;
|
|
|
|
end
|
|
|
|
|
|
|
|
assign Q = Q_;
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FTCP_N (C, PRE, CLR, T, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, T;
|
|
|
|
output wire Q;
|
|
|
|
reg Q_;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q_ <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(negedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q_ <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q_ <= 1;
|
|
|
|
else if (T == 1)
|
|
|
|
Q_ <= ~Q_;
|
|
|
|
end
|
|
|
|
|
|
|
|
assign Q = Q_;
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FTDCP (C, PRE, CLR, T, Q);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, T;
|
|
|
|
output wire Q;
|
|
|
|
reg Q_;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q_ <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge C, negedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q_ <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q_ <= 1;
|
|
|
|
else if (T == 1)
|
|
|
|
Q_ <= ~Q_;
|
|
|
|
end
|
|
|
|
|
|
|
|
assign Q = Q_;
|
|
|
|
endmodule
|
2017-08-01 13:58:01 -05:00
|
|
|
|
|
|
|
module FDCPE (C, PRE, CLR, D, Q, CE);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, D, CE;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
else if (CE == 1)
|
|
|
|
Q <= D;
|
|
|
|
end
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FDCPE_N (C, PRE, CLR, D, Q, CE);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, D, CE;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(negedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
else if (CE == 1)
|
|
|
|
Q <= D;
|
|
|
|
end
|
|
|
|
endmodule
|
|
|
|
|
|
|
|
module FDDCPE (C, PRE, CLR, D, Q, CE);
|
|
|
|
parameter INIT = 0;
|
|
|
|
|
|
|
|
input C, PRE, CLR, D, CE;
|
|
|
|
output reg Q;
|
|
|
|
|
|
|
|
initial begin
|
|
|
|
Q <= INIT;
|
|
|
|
end
|
|
|
|
|
|
|
|
always @(posedge C, negedge C, posedge PRE, posedge CLR) begin
|
|
|
|
if (CLR == 1)
|
|
|
|
Q <= 0;
|
|
|
|
else if (PRE == 1)
|
|
|
|
Q <= 1;
|
|
|
|
else if (CE == 1)
|
|
|
|
Q <= D;
|
|
|
|
end
|
|
|
|
endmodule
|