ghdl-yosys-plugin icon indicating copy to clipboard operation
ghdl-yosys-plugin copied to clipboard

wire not found for $posedge

Open GyrosGeier opened this issue 1 year ago • 3 comments

Completely different code for the other issue with the same title, so a separate issue. At least this one is nice and minimal.

library ieee;
use ieee.std_logic_1164.all;

entity test is
        port(
                clk, set, clear, reset : in std_logic;
                o : out std_logic
        );
end entity;

architecture rtl of test is
begin
        o <=
                '0'     when ?? reset else
                '1'     when (?? set) and rising_edge(clk) else
                '0'     when (?? clear) and rising_edge(clk);
end architecture;

This falls over with "wire not found for $posedge", while trying to connect the rising_edge as an input to an and, because the get_src function does not handle Id_PosEdge.

Writing this as

        o <=
                '0'                      when ?? reset else
                set or (o and not clear) when rising_edge(clk);

works, as do normal enables like

        addr_r <= addr when (?? valid) and rising_edge(clk);

so at least some variants of this are resolved by GHDL before they reach the GHDL YoSYS plugin.

GyrosGeier avatar Nov 12 '23 09:11 GyrosGeier