2019-10-18 05:50:24 -05:00
|
|
|
module adff( input d, clk, clr, output reg q );
|
2021-09-24 14:50:26 -05:00
|
|
|
`ifndef NO_INIT
|
2019-09-03 03:53:37 -05:00
|
|
|
initial begin
|
2019-10-18 05:50:24 -05:00
|
|
|
q = 0;
|
2019-09-03 03:53:37 -05:00
|
|
|
end
|
2021-09-24 14:50:26 -05:00
|
|
|
`endif
|
2019-10-18 05:50:24 -05:00
|
|
|
always @( posedge clk, posedge clr )
|
|
|
|
if ( clr )
|
|
|
|
q <= 1'b0;
|
|
|
|
else
|
|
|
|
q <= d;
|
2019-09-03 03:53:37 -05:00
|
|
|
endmodule
|
|
|
|
|
2019-10-18 05:50:24 -05:00
|
|
|
module adffn( input d, clk, clr, output reg q );
|
2021-09-24 14:50:26 -05:00
|
|
|
`ifndef NO_INIT
|
2019-09-03 03:53:37 -05:00
|
|
|
initial begin
|
|
|
|
q = 0;
|
|
|
|
end
|
2021-09-24 14:50:26 -05:00
|
|
|
`endif
|
2019-10-18 05:50:24 -05:00
|
|
|
always @( posedge clk, negedge clr )
|
|
|
|
if ( !clr )
|
|
|
|
q <= 1'b0;
|
|
|
|
else
|
|
|
|
q <= d;
|
2019-09-03 03:53:37 -05:00
|
|
|
endmodule
|
|
|
|
|
2019-10-18 05:50:24 -05:00
|
|
|
module dffs( input d, clk, pre, clr, output reg q );
|
2021-09-24 14:50:26 -05:00
|
|
|
`ifndef NO_INIT
|
2019-09-03 03:53:37 -05:00
|
|
|
initial begin
|
|
|
|
q = 0;
|
|
|
|
end
|
2021-09-24 14:50:26 -05:00
|
|
|
`endif
|
2019-10-18 05:50:24 -05:00
|
|
|
always @( posedge clk )
|
|
|
|
if ( pre )
|
|
|
|
q <= 1'b1;
|
|
|
|
else
|
|
|
|
q <= d;
|
2019-09-03 03:53:37 -05:00
|
|
|
endmodule
|
|
|
|
|
2019-10-18 05:50:24 -05:00
|
|
|
module ndffnr( input d, clk, pre, clr, output reg q );
|
2021-09-24 14:50:26 -05:00
|
|
|
`ifndef NO_INIT
|
2019-09-03 03:53:37 -05:00
|
|
|
initial begin
|
|
|
|
q = 0;
|
|
|
|
end
|
2021-09-24 14:50:26 -05:00
|
|
|
`endif
|
2019-10-18 05:50:24 -05:00
|
|
|
always @( negedge clk )
|
|
|
|
if ( !clr )
|
|
|
|
q <= 1'b0;
|
|
|
|
else
|
|
|
|
q <= d;
|
2019-09-03 03:53:37 -05:00
|
|
|
endmodule
|