ghdl / ghdl-yosys-plugin

VHDL synthesis (based on ghdl)
GNU General Public License v3.0
295 stars 32 forks source link

Yosys assert: is_fully_const() && GetSize(chunks_) <= 1 failed in kernel/rtlil.cc:4532 #160

Closed antonblanchard closed 2 years ago

antonblanchard commented 2 years ago

Starting with commit a0b84cc52e26 ("ghdl.cc: always create a wire for signal/isignal. Fix #158"), we are seeing an assertion in yosys when building Microwatt. A cut down test case:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity fpu is
    port (
        clk         : in std_ulogic;
        addr        : in std_ulogic_vector(1 downto 0);
        inverse_est : out std_ulogic_vector(17 downto 0)
        );
end entity fpu;

architecture behaviour of fpu is
    type lookup_table is array(0 to 3) of std_ulogic_vector(17 downto 0);

    signal inverse_table : lookup_table := (
        18x"3fc01", 18x"3f411", 18x"3ec31", 18x"3e460"
        );
begin
    lut_access: process(clk)
    begin
        if rising_edge(clk) then
            inverse_est <= inverse_table(to_integer(unsigned(addr)));
        end if;
    end process;

end architecture behaviour;

With a0b84cc52e26 applied I get:

Importing module fpu.
ERROR: Assert `is_fully_const() && GetSize(chunks_) <= 1' failed in kernel/rtlil.cc:4532.
tgingold commented 2 years ago

Do you modify inverse_table ? There is no crash if it is a constant.

I am investigating.

tgingold commented 2 years ago

Should now be fixed. Thank you for the reduced reproducer.