I want to do synthesizable always block, that would execute code by d1 signal changing (posedge and negedge both). I did attempt to create such block:
`timescale 1ns / 1ps module device(d1, reset, clk, out); input d1, clk, reset; output reg out; reg tmp_d1; always @ (posedge clk) begin if(!reset) begin if(tmp_d1 != d1) begin out = ~out; end tmp_d1 = d1; end else begin out <= 0; tmp_d1 <= 0; end end endmodule It works while behavioral simulation in Vivado:
The testbench:
`timescale 1ns/1ps module tb_device; reg d1, rst, clk; wire out; device device1(clk, rst, d1, out); initial begin rst = 1; clk = 0; d1 = 0; #50 rst = 0; #50 d1 = 1; #70 d1 = 0; #50 d1 = 1; #70 d1 = 0; end always #10 clk = ~clk; endmodule But behavioral simulation result don't match to the tests on programmed FPGA. See the video of programmed FPGA tests on Google drive: https://drive.google.com/file/d/1IemI0XfxICa0hTU312HD8HoI65PG-0Zi/view?usp=sharing
"Not matching" in missing reaction on switching the switcher in some times. In one time led inverts by switching the DE0 board switch (reacts on d1 switching as in simulation) and another time any reaction have occured. Also, by one switching, led can be starting to light but immediately fades away (I'm seeing only blink and nothing after).
Was used Terasic FPGA board DE0 is equipped by the Intel/Altera FPGA Cyclone III (EP3C16F484C6) and Quartus II 9.0 (Build 132 02/25/2009 SJ Web Edition).
Contraints (qsf file) on Google drive: https://drive.google.com/file/d/111kRlpXRi5njfn2kFEx5hefyj3QEykL_/view?usp=sharing
Problem isn't related to the switch debouncing becouse I already tested this switch after progmming more simple Verilog project and all was match to corresponded Vivado simulation.
The SDC file:
create_clock -name CLK27 -period "27MHz" -waveform {0 18.519} [get_ports clk] derive_pll_clocks derive_clock_uncertainty Wasn't occured any critial warning while the Quartus compilation.
But was occured the ordinary warnings:
- Feature LogicLock is not available with your current license;
- Some pins have incomplete I/O assignments. Refer to the I/O Assignment Warnings report for details.
Referring to 2), incomplete set of assignments reason is reporting:

