Code with function bodies in architecture declaration fails to compile. Function declaration is treated as a syntax error
library ieee; use ieee.std_logic_1164.all; entity e is port ( clk : in std_logic; rst : in std_logic; q : out std_logic); end e; architecture a of e is signal r : std_logic; function invert ( i : std_logic) return std_logic is begin return not i; end invert; begin q <= r; process(clk) begin if rising_edge(clk) then if rst = '1' then r <= '0'; else r <= invert(r); end if; end if; end process; end a;
I did some happy hacking on lex/bison/yacc whatever sources and found that the following was missing. This doesn't do the whole job though.
This should get you the rest of the way:
But expect to find many other things that are not yet implemented - VHDL support in Icarus is a work in progress, and not that high up the priority list.
N.B. If you want to see the intermediate Verilog produced by the VHDL pre-processor, you can just run it on its own, e.g.
Works like a charm. What's the preferred way of submitting patches btw? github pull requests, e-mailed diffs or something else? I'll try to summon patches for a few other issues as well when I have time
Most previous patches have been diff files generated using git format-patch. Steve may allow pull requests, but he will have to reply on that. If you submit a patch generated using git format-patch to our SourceForge patch tracker or attached it to the appropriate report here in the bug tracker either Martin or I can apply and push the patch to the master repository once we have reviewed it.
No need to submit a patch for this particular bug, as I already have the changes in my local repository. I'll push them shortly, once I've written a regression test.
I've pushed the fix for this and a regression test to github.
This is unfortunately broken again in the master branch
We have added a test for this problem to the test suite and it is now working again and will be caught if we accidentally break it in the future.