Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparing vhdl to verilog fails #75

Open
Topi-ab opened this issue Jan 11, 2025 · 0 comments
Open

Comparing vhdl to verilog fails #75

Topi-ab opened this issue Jan 11, 2025 · 0 comments

Comments

@Topi-ab
Copy link

Topi-ab commented Jan 11, 2025

When comparing tester.vhdl to tester.sv, the eqy cannot prove full, unless I make full initial value on vhdl side "UU".

Do I have correct initialization syntax for verilog?

Any other explanation for the fail other than tool failing?

Executed with https://github.com/YosysHQ/oss-cad-suite-build/releases/tag/2025-01-11 (linux x86) within ubuntu:24.04 docker container.

The command to run
eqy -j $(nproc) -f eqy_tester.eqy

tester.vhdl =>

library ieee;
use ieee.std_logic_1164.all;

entity tester is
	port(
		clk_in: in std_logic;
		sreset_in: in std_logic;
		
		sink_valid_in: in std_logic;
		src_ready_in: in std_logic;
		
		full_out: out std_logic_vector(1 downto 0)
	);
end;

architecture rtl of tester is
	-- Enabling this line makes the eqy test fail
	signal full: std_logic_vector(1 downto 0) := (others => '0');
	

	-- Enabling this line makes the eqy test pass
	-- signal full: std_logic_vector(1 downto 0) := (others => 'U');
	


	signal head: integer range 0 to 1;
	signal tail: integer range 0 to 1;
begin
	process(clk_in)
	begin
		if rising_edge(clk_in) then
			if sink_valid_in = '1' and full(tail) = '0' then
				full(tail) <= '1';
				tail <= (tail + 1) mod 2;
			end if;
			if src_ready_in = '1' and full(head) = '1' then
				full(head) <= '0';
				head <= (head + 1) mod 2;
			end if;
			if sreset_in = '1' then
				tail <= 0;
				head <= 0;
				full <= (others => '0');
			end if;
		end if;
	end process;
	
	full_out <= full;
end;

tester.sv =>

module tester (
	input logic clk_in,
	input logic sreset_in,

	input logic sink_valid_in,
	input logic src_ready_in,
	
	output logic [1:0] full_out
);

	(* init = "00" *)logic[1:0] full = '0;
	logic[0:0] head;
	logic[0:0] tail;

	always_ff @(posedge clk_in) begin
		if ((sink_valid_in == 1) && (full[tail] == 0)) begin
			full[tail] = 1;
			tail = (tail + 1) % 2;
		end
		if (src_ready_in && full[head]) begin
			full[head] = 0;
			head = (head + 1) % 2;
		end
		if (sreset_in) begin
			tail = 0;
			head = 0;
			full = '0;
		end
	end

	assign full_out = full;

endmodule

eqy_tester.eqy =>

[gold]
plugin -i ghdl 

ghdl --std=08 tester.vhdl -e tester
prep -top tester
#synth
#memory_map
#abc -lut 8
#opt

[gate]
plugin -i ghdl 

read_verilog -sv tester.sv
prep -top tester
#synth
#memory_map
#abc -lut 8
#abc
#opt

[collect *]

[strategy induction_strategy]
use sat
depth 40

output =>

EQY  9:02:37 [eqy_tester] read_gold: starting process "yosys -ql eqy_tester/gold.log eqy_tester/gold.ys"
EQY  9:02:37 [eqy_tester] read_gold: finished (returncode=0)
EQY  9:02:37 [eqy_tester] read_gate: starting process "yosys -ql eqy_tester/gate.log eqy_tester/gate.ys"
EQY  9:02:37 [eqy_tester] read_gate: finished (returncode=0)
EQY  9:02:37 [eqy_tester] combine: starting process "yosys -ql eqy_tester/combine.log eqy_tester/combine.ys"
EQY  9:02:37 [eqy_tester] combine: finished (returncode=0)
EQY  9:02:37 [eqy_tester] partition: starting process "cd eqy_tester; yosys -ql partition.log partition.ys"
EQY  9:02:37 [eqy_tester] partition: finished (returncode=0)
EQY  9:02:37 [eqy_tester] Warning: Partition tester.head contains 2 unused gold inputs.
EQY  9:02:37 [eqy_tester] run: starting process "make -j12 -C eqy_tester -f strategies.mk"
EQY  9:02:37 [eqy_tester] run: make: Entering directory '/prj/formal/eqy_tester'
EQY  9:02:37 [eqy_tester] run: Running strategy 'induction_strategy' on 'tester.full'..
EQY  9:02:37 [eqy_tester] run: Running strategy 'induction_strategy' on 'tester.full_out.0'..
EQY  9:02:37 [eqy_tester] run: Running strategy 'induction_strategy' on 'tester.full_out.1'..
EQY  9:02:37 [eqy_tester] run: Running strategy 'induction_strategy' on 'tester.head'..
EQY  9:02:37 [eqy_tester] run: Running strategy 'induction_strategy' on 'tester.tail'..
EQY  9:02:37 [eqy_tester] run: Proved equivalence of partition 'tester.full_out.1' using strategy 'induction_strategy'
EQY  9:02:37 [eqy_tester] run: Proved equivalence of partition 'tester.full_out.0' using strategy 'induction_strategy'
EQY  9:02:37 [eqy_tester] run: Could not prove equivalence of partition 'tester.full' using strategy 'induction_strategy'
EQY  9:02:37 [eqy_tester] run: Proved equivalence of partition 'tester.tail' using strategy 'induction_strategy'
EQY  9:02:38 [eqy_tester] run: Proved equivalence of partition 'tester.head' using strategy 'induction_strategy'
EQY  9:02:38 [eqy_tester] run: make -f strategies.mk summary
EQY  9:02:38 [eqy_tester] run: make[1]: Entering directory '/prj/formal/eqy_tester'
EQY  9:02:38 [eqy_tester] run: make[1]: Leaving directory '/prj/formal/eqy_tester'
EQY  9:02:38 [eqy_tester] run: make: Leaving directory '/prj/formal/eqy_tester'
EQY  9:02:38 [eqy_tester] run: finished (returncode=0)
EQY  9:02:38 [eqy_tester] Successfully proved equivalence of partition tester.tail
EQY  9:02:38 [eqy_tester] Successfully proved equivalence of partition tester.head
EQY  9:02:38 [eqy_tester] Successfully proved equivalence of partition tester.full_out.1
EQY  9:02:38 [eqy_tester] Successfully proved equivalence of partition tester.full_out.0
EQY  9:02:38 [eqy_tester] Warning: Failed to prove equivalence for 1/5 partitions:
EQY  9:02:38 [eqy_tester] Failed to prove equivalence of partition tester.full
EQY  9:02:38 [eqy_tester] summary: Elapsed clock time [H:MM:SS (secs)]: 0:00:00 (0)
EQY  9:02:38 [eqy_tester] summary: Elapsed process time [H:MM:SS (secs)]: 0:00:00 (0)
EQY  9:02:38 [eqy_tester] DONE (FAIL, rc=2)
/prj/formal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant