diff options
author | Tristan Gingold | 2014-01-16 03:28:06 +0100 |
---|---|---|
committer | Tristan Gingold | 2014-01-16 03:28:06 +0100 |
commit | 66da4588b0ba9e1d510bc11c648c990e54306deb (patch) | |
tree | 0233fc1df2ec0e63130f00257cfeec044a99a914 | |
parent | 5c7e4f5598ff7e2e3be0c2de8d2e4d4414b87f63 (diff) | |
download | ghdl-66da4588b0ba9e1d510bc11c648c990e54306deb.tar.gz ghdl-66da4588b0ba9e1d510bc11c648c990e54306deb.tar.bz2 ghdl-66da4588b0ba9e1d510bc11c648c990e54306deb.zip |
Fix bug21487: call resolution function at init if there is at least 1 source.
-rw-r--r-- | testsuite/gna/bug21487/repro.vhdl | 37 | ||||
-rwxr-xr-x | testsuite/gna/bug21487/testsuite.sh | 11 | ||||
-rw-r--r-- | translate/grt/grt-signals.adb | 2 |
3 files changed, 49 insertions, 1 deletions
diff --git a/testsuite/gna/bug21487/repro.vhdl b/testsuite/gna/bug21487/repro.vhdl new file mode 100644 index 0000000..0da0606 --- /dev/null +++ b/testsuite/gna/bug21487/repro.vhdl @@ -0,0 +1,37 @@ +entity top is +end top; + +use std.textio.all; + +architecture ARCH of TOP is + + type int_vector is array (integer range<>) of integer; + function driver_counter( values : int_vector ) return integer is + variable result : integer := 1; + variable l: line; + begin + for index in values'range loop + if values(index) /= 0 then + result := result + values (index); + write (l, integer'image(values(index)) & ","); + end if; + end loop; + report l.all & " count resolved => " & integer'image(result); + return result; + end function; + + signal S1: driver_counter integer := 6; + +begin + s1 <= 1 after 1 ns; + + check: process + begin + assert s1 = 7 report "resolution function not called at init" + severity failure; + wait for 1 ns; + assert s1 = 2 report "resolution function not called at 1 ns" + severity failure; + wait; + end process; +end architecture; diff --git a/testsuite/gna/bug21487/testsuite.sh b/testsuite/gna/bug21487/testsuite.sh new file mode 100755 index 0000000..df141ec --- /dev/null +++ b/testsuite/gna/bug21487/testsuite.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +. ../../testenv.sh + +analyze repro.vhdl + +elab_simulate top + +clean + +echo "Test successful" diff --git a/translate/grt/grt-signals.adb b/translate/grt/grt-signals.adb index 1acd675..494104f 100644 --- a/translate/grt/grt-signals.adb +++ b/translate/grt/grt-signals.adb @@ -3257,7 +3257,7 @@ package body Grt.Signals is when Net_One_Resolved => Sig.Has_Active := True; - if Sig.Nbr_Ports > 0 then + if Sig.S.Nbr_Drivers + Sig.Nbr_Ports > 0 then Compute_Resolved_Signal (Sig.S.Resolv); Sig.Value := Sig.Driving_Value; end if; |