mirror of
https://github.com/YosysHQ/yosys
synced 2025-11-08 15:25:08 +00:00
39 lines
731 B
Text
39 lines
731 B
Text
module dff1 (D, CLK, Q);
|
|
reg "IQ", "IQN";
|
|
input D;
|
|
input CLK;
|
|
output Q;
|
|
assign Q = IQ; // IQ
|
|
always @(posedge CLK) begin
|
|
// !D
|
|
"IQ" <= (~D);
|
|
"IQN" <= ~((~D));
|
|
end
|
|
endmodule
|
|
module dff2 (D, CLK, Q);
|
|
reg IQ, IQN;
|
|
input D;
|
|
input CLK;
|
|
output Q;
|
|
assign Q = IQ; // "IQ"
|
|
always @(posedge CLK) begin
|
|
// D '
|
|
IQ <= (~D);
|
|
IQN <= ~((~D));
|
|
end
|
|
endmodule
|
|
module dffe (D, EN, CLK, Q, QN);
|
|
reg "IQ", "IQN";
|
|
input D;
|
|
input EN;
|
|
input CLK;
|
|
output Q;
|
|
assign Q = IQ; // "IQ"
|
|
output QN;
|
|
assign QN = IQN; // "IQN"
|
|
always @(posedge (~CLK)) begin
|
|
// ( D & EN ) | ( IQ & ! EN )
|
|
"IQ" <= ((D&EN)|(IQ&(~EN)));
|
|
"IQN" <= ~(((D&EN)|(IQ&(~EN))));
|
|
end
|
|
endmodule
|