yosys/tests/arch/common/adffs.v

52 lines
881 B
Verilog
Raw Permalink Normal View History

2019-10-18 05:50:24 -05:00
module adff( input d, clk, clr, output reg q );
`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
`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 );
`ifndef NO_INIT
2019-09-03 03:53:37 -05:00
initial begin
q = 0;
end
`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 );
`ifndef NO_INIT
2019-09-03 03:53:37 -05:00
initial begin
q = 0;
end
`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 );
`ifndef NO_INIT
2019-09-03 03:53:37 -05:00
initial begin
q = 0;
end
`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