nickg / nvc

VHDL compiler and simulator
https://www.nickg.me.uk/nvc/
GNU General Public License v3.0
634 stars 79 forks source link

PSL default clock in comment #1019

Open avelure opened 1 week ago

avelure commented 1 week ago

Hi, I have been fiddling a bit with fuzzing of the parser in GHDL with aflplusplus, and have now moved the setup over to also work for NVC. I'm not sure how interested you will be in the results as the cases it finds might not be cases a user might hit upon, but I'm just testing this for fun.

Anyway, I'm using MWEs from the GHDL repo as input corpus and some of them fail off the block. I'll post them as subsequent issues.

This issue is, I guess, related to #993, there is no related GHDL issue as far as I can see. From your last comment in that issue, it seems it should or will be allowed. This parses ok in GHDL and modelsim.

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

entity assume2 is
 port (clk, rst: std_logic;
       cnt : out unsigned(3 downto 0));
end assume2;

architecture behav of assume2 is
 signal val : unsigned (3 downto 0);
begin
 process(clk)
 begin
   if rising_edge(clk) then
     if rst = '1' then
       val <= (others => '0');
     else
       val <= val + 1;
     end if;
   end if;
 end process;
 cnt <= val;

 --psl default clock is (clk'event and clk = '1');
 --psl assume always val < 50;
end behav;
$ nvc --std=08 --messages=compact -a --psl 0b662bb9bd64ccb8b7a96398df2fbd1082e5ab971e485a6087681f776504e4c4
0b662bb9bd64ccb8b7a96398df2fbd1082e5ab971e485a6087681f776504e4c4:25:8: error: unexpected default while parsing verification directive, expecting one of assert, assume or cover
0b662bb9bd64ccb8b7a96398df2fbd1082e5ab971e485a6087681f776504e4c4:25:50: error: unexpected ; while parsing conditional signal assignment, expecting <=
nickg commented 1 week ago

This one parses ok for me on the latest master, but crashes later for a similar reason to #1026. Could you retest?

Thanks for reporting all these BTW.

I have been fiddling a bit with fuzzing of the parser in GHDL with aflplusplus, and have now moved the setup over to also work for NVC.

I did try afl before but couldn't get it to find anything useful. Perhaps I didn't set up the corpus right, hopefully you have more luck!