q <= d;
endmodule
-module dffsr
+module dffs
( input d, clk, pre, clr, output reg q );
initial begin
q = 0;
end
- always @( posedge clk, posedge pre, posedge clr )
- if ( clr )
- q <= 1'b0;
- else if ( pre )
+ always @( posedge clk )
+ if ( pre )
q <= 1'b1;
else
q <= d;
endmodule
-module ndffnsnr
+module ndffnr
( input d, clk, pre, clr, output reg q );
initial begin
q = 0;
end
- always @( negedge clk, negedge pre, negedge clr )
+ always @( negedge clk )
if ( !clr )
q <= 1'b0;
- else if ( !pre )
- q <= 1'b1;
else
q <= d;
endmodule
output b,b1,b2,b3
);
-dffsr u_dffsr (
+dffs u_dffs (
.clk (clk ),
.clr (clr),
.pre (pre),
.q (b )
);
-ndffnsnr u_ndffnsnr (
+ndffnr u_ndffnr (
.clk (clk ),
.clr (clr),
.pre (pre),
read_verilog adffs.v
proc
-async2sync # converts async flops to a 'sync' variant clocked by a 'super'-clock
flatten
-equiv_opt -assert -map +/ecp5/cells_sim.v synth_ecp5 # equivalency check
+equiv_opt -multiclock -assert -map +/ecp5/cells_sim.v synth_ecp5 # equivalency check
design -load postopt # load the post-opt design (otherwise equiv_opt loads the pre-opt design)
cd top # Constrain all select calls below inside the top module
select -assert-count 4 t:TRELLIS_FF
-select -assert-count 7 t:LUT4
+select -assert-count 3 t:LUT4
select -assert-none t:TRELLIS_FF t:LUT4 %% t:* %D
cd top # Constrain all select calls below inside the top module
select -assert-count 28 t:CCU2C
-select -assert-count 48 t:L6MUX21
-select -assert-count 194 t:LUT4
-select -assert-count 84 t:PFUMX
+select -assert-count 26 t:L6MUX21
+select -assert-count 138 t:LUT4
+select -assert-count 60 t:PFUMX
select -assert-none t:LUT4 t:CCU2C t:L6MUX21 t:PFUMX %% t:* %D