Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using function signature in report statement #892

Closed
tmeissner opened this issue May 17, 2024 · 1 comment
Closed

Error when using function signature in report statement #892

tmeissner opened this issue May 17, 2024 · 1 comment
Labels

Comments

@tmeissner
Copy link

When a function signature is used in a report statement, nvc emits an error like this:

** Error: ambiguous use of name WAIT_LEVEL
    > test.vhd:23
    |
  6 |   procedure wait_level(signal    data   : in std_logic;
    |   ^ hidden declaration of WAIT_LEVEL as WAIT_LEVEL [STD_LOGIC, STD_LOGIC, TIME]
 ...
 10 |   procedure wait_level(signal    data   : in std_logic_vector;
    |   ^ visible declaration of WAIT_LEVEL as WAIT_LEVEL [STD_LOGIC_VECTOR, STD_LOGIC_VECTOR, TIME]
 ...
 19 |   procedure wait_level(signal    data   : in std_logic;
    |   ^ visible declaration of WAIT_LEVEL as WAIT_LEVEL [STD_LOGIC, STD_LOGIC, TIME]
 ...
 23 |     report wait_level[std_logic, std_logic, time]'instance_name & " timeout occurred";
    |            ^^^^^^^^^^ use of name WAIT_LEVEL here
** Error: unexpected [ while parsing report statement, expecting one of **, severity or ;
    > test.vhd:23
    |
 23 |     report wait_level[std_logic, std_logic, time]'instance_name & " timeout occurred";
    |                      ^ this token was unexpected

The first error is a subsequent error from the fact that nvc can't distinguish between the two function of same name. For that reason I give the signature of the function in line 23, however nvc can't parse that code.

$ nvc --version
nvc 1.13-devel (1.12.0.r41.g3edb4fec) (Using LLVM 14.0.6)
Copyright (C) 2011-2024  Nick Gasson
This program comes with ABSOLUTELY NO WARRANTY. This is free software, and
you are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.

Full MWE

library ieee;
  use ieee.std_logic_1164.all;

package test is

  procedure wait_level(signal    data   : in std_logic;
                       constant value   : in std_logic;
                       constant timeout : in time);

  procedure wait_level(signal    data   : in std_logic_vector;
                       constant value   : in std_logic_vector;
                       constant timeout : in time);

end package test;


package body test is

  procedure wait_level(signal    data   : in std_logic;
                       constant value   : in std_logic;
                       constant timeout : in time) is
  begin
    report wait_level[std_logic, std_logic, time]'instance_name & " timeout occurred";
  end procedure wait_level;

  procedure wait_level(signal    data   : in std_logic_vector;
                       constant value   : in std_logic_vector;
                       constant timeout : in time) is
  begin
    report wait_level[std_logic, std_logic, time]'instance_name & " timeout occurred";
  end procedure wait_level;

end package body;
@nickg nickg added the analysis label May 17, 2024
@nickg nickg closed this as completed in 4a567f2 May 19, 2024
@tmeissner
Copy link
Author

Thanks for fixing this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants