mirror of https://github.com/YosysHQ/yosys.git
add more DFF to sim lib
This commit is contained in:
parent
5168b6ffa4
commit
1b9f7f49b5
|
@ -32,8 +32,8 @@ module \$__DFFS_PN0_ (input D, C, R, output Q); DFFR _TECHMAP_REPLACE_ (.D(D),
|
||||||
module \$__DFFS_PP0_ (input D, C, R, output Q); DFFR _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .RESET(R)); endmodule
|
module \$__DFFS_PP0_ (input D, C, R, output Q); DFFR _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .RESET(R)); endmodule
|
||||||
|
|
||||||
// DFFS D Flip-Flop with Synchronous Set
|
// DFFS D Flip-Flop with Synchronous Set
|
||||||
module \$__DFFS_PN1_ (input D, C, S, output Q); DFFS _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .SET(!S)); endmodule
|
module \$__DFFS_PN1_ (input D, C, R, output Q); DFFS _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .SET(!R)); endmodule
|
||||||
module \$__DFFS_PP1_ (input D, C, S, output Q); DFFS _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .SET(S)); endmodule
|
module \$__DFFS_PP1_ (input D, C, R, output Q); DFFS _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .SET(R)); endmodule
|
||||||
|
|
||||||
// DFFP D Flip-Flop with Asynchronous Preset
|
// DFFP D Flip-Flop with Asynchronous Preset
|
||||||
module \$_DFF_PP1_ (input D, C, R, output Q); DFFP _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .PRESET(R)); endmodule
|
module \$_DFF_PP1_ (input D, C, R, output Q); DFFP _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .PRESET(R)); endmodule
|
||||||
|
@ -43,11 +43,11 @@ module \$_DFF_PP0_ (input D, C, R, output Q); DFFC _TECHMAP_REPLACE_ (.D(D), .Q
|
||||||
module \$_DFF_PN0_ (input D, C, R, output Q); DFFC _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .CLEAR(!R)); endmodule
|
module \$_DFF_PN0_ (input D, C, R, output Q); DFFC _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .CLEAR(!R)); endmodule
|
||||||
|
|
||||||
// DFFPE D Flip-Flop with Clock Enable and Asynchronous Preset
|
// DFFPE D Flip-Flop with Clock Enable and Asynchronous Preset
|
||||||
module \$__DFFE_PP1_ (input D, C, R, E, output Q); DFFPE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .PRESET(R), .CE(E)); endmodule
|
module \$__DFFE_PP1 (input D, C, R, E, output Q); DFFPE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .PRESET(R), .CE(E)); endmodule
|
||||||
module \$__DFFE_PN1_ (input D, C, R, E, output Q); DFFPE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .PRESET(!R), .CE(E)); endmodule
|
module \$__DFFE_PN1 (input D, C, R, E, output Q); DFFPE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .PRESET(!R), .CE(E)); endmodule
|
||||||
// DFFCE D Flip-Flop with Clock Enable and Asynchronous Clear
|
// DFFCE D Flip-Flop with Clock Enable and Asynchronous Clear
|
||||||
module \$__DFFE_PP0_ (input D, C, R, E, output Q); DFFCE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .CLEAR(R), .CE(E)); endmodule
|
module \$__DFFE_PP0 (input D, C, R, E, output Q); DFFCE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .CLEAR(R), .CE(E)); endmodule
|
||||||
module \$__DFFE_PN0_ (input D, C, R, E, output Q); DFFCE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .CLEAR(!R), .CE(E)); endmodule
|
module \$__DFFE_PN0 (input D, C, R, E, output Q); DFFCE _TECHMAP_REPLACE_ (.D(D), .Q(Q), .CLK(C), .CLEAR(!R), .CE(E)); endmodule
|
||||||
|
|
||||||
|
|
||||||
module \$_MUX_ (input A, B, S, output Y); MUX2 _TECHMAP_REPLACE_ (.I0(A), .I1(B), .S0(S), .O(Y)); endmodule
|
module \$_MUX_ (input A, B, S, output Y); MUX2 _TECHMAP_REPLACE_ (.I0(A), .I1(B), .S0(S), .O(Y)); endmodule
|
||||||
|
|
|
@ -62,6 +62,111 @@ module DFFR (output reg Q, input D, CLK, RESET);
|
||||||
end
|
end
|
||||||
endmodule // DFFR (positive clock edge; synchronous reset)
|
endmodule // DFFR (positive clock edge; synchronous reset)
|
||||||
|
|
||||||
|
module DFFE (output reg Q, input D, CLK, CE);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK) begin
|
||||||
|
if (CE)
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFE (positive clock edge; clock enable)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFS (output reg Q, input D, CLK, SET);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK) begin
|
||||||
|
if (SET)
|
||||||
|
Q <= 1'b1;
|
||||||
|
else
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFS (positive clock edge; synchronous set)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFSE (output reg Q, input D, CLK, CE, SET);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK) begin
|
||||||
|
if (SET)
|
||||||
|
Q <= 1'b1;
|
||||||
|
else if (CE)
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFSE (positive clock edge; synchronous set takes precedence over clock enable)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFR (output reg Q, input D, CLK, RESET);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK) begin
|
||||||
|
if (RESET)
|
||||||
|
Q <= 1'b0;
|
||||||
|
else
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFR (positive clock edge; synchronous reset)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFRE (output reg Q, input D, CLK, CE, RESET);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK) begin
|
||||||
|
if (RESET)
|
||||||
|
Q <= 1'b0;
|
||||||
|
else if (CE)
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFRE (positive clock edge; synchronous reset takes precedence over clock enable)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFP (output reg Q, input D, CLK, PRESET);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK or posedge PRESET) begin
|
||||||
|
if(PRESET)
|
||||||
|
Q <= 1'b1;
|
||||||
|
else
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFP (positive clock edge; asynchronous preset)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFPE (output reg Q, input D, CLK, CE, PRESET);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK or posedge PRESET) begin
|
||||||
|
if(PRESET)
|
||||||
|
Q <= 1'b1;
|
||||||
|
else if (CE)
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFPE (positive clock edge; asynchronous preset; clock enable)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFC (output reg Q, input D, CLK, CLEAR);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK or posedge CLEAR) begin
|
||||||
|
if(CLEAR)
|
||||||
|
Q <= 1'b0;
|
||||||
|
else
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFC (positive clock edge; asynchronous clear)
|
||||||
|
|
||||||
|
|
||||||
|
module DFFCE (output reg Q, input D, CLK, CE, CLEAR);
|
||||||
|
parameter [0:0] INIT = 1'b0;
|
||||||
|
initial Q = INIT;
|
||||||
|
always @(posedge CLK or posedge CLEAR) begin
|
||||||
|
if(CLEAR)
|
||||||
|
Q <= 1'b0;
|
||||||
|
else if (CE)
|
||||||
|
Q <= D;
|
||||||
|
end
|
||||||
|
endmodule // DFFCE (positive clock edge; asynchronous clear; clock enable)
|
||||||
|
|
||||||
// TODO add more DFF sim cells
|
// TODO add more DFF sim cells
|
||||||
|
|
||||||
module VCC(output V);
|
module VCC(output V);
|
||||||
|
|
Loading…
Reference in New Issue