3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-04 17:17:43 +00:00

coolrunner2: Initial mapping of DFFs

All DFFs map to either FDCP (matches Xilinx) or a custom FDCP_N
(negative-edge triggered)
This commit is contained in:
Robert Ou 2017-06-25 20:16:43 -07:00
parent 1eb5dee799
commit 4af5baab21
4 changed files with 76 additions and 0 deletions

View file

@ -54,3 +54,43 @@ module MACROCELL_XOR(IN_PTC, IN_ORTERM, OUT);
assign OUT = INVERT_OUT ? ~xor_intermed : xor_intermed;
assign xor_intermed = IN_ORTERM ^ IN_PTC;
endmodule
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