Menu

#47 Error on missing generic default value even though one was set with -g flag.

1.0
closed
bug (29)
2015-05-11
2015-05-10
No

test.vhd:

entity ent is
  generic (str : string);
end entity;

architecture a of ent is
begin
  main : process
  begin
    report str;
    wait;
  end process;
end architecture;

command line output:

ghdl -a test.vhd && ghdl --elab-run ent -gstr="hello world"
error: entity "ent" cannot be at the top of a design
test.vhd:2:12: (generic "str" has no default value)
ghdl: compilation error

Discussion

  • Tristan Gingold

    Tristan Gingold - 2015-05-10
    • assigned_to: Tristan Gingold
     
  • Tristan Gingold

    Tristan Gingold - 2015-05-10

    I see. Make sense. Give me a couple of days :-)

     
  • Tristan Gingold

    Tristan Gingold - 2015-05-11

    Now implemented.

    Maybe the analyser should emit a warning for generics without a default value ???

    Thanks, Tristan.

     
  • Tristan Gingold

    Tristan Gingold - 2015-05-11
    • status: open --> closed
     
  • Olof Kraigher

    Olof Kraigher - 2015-05-11

    I think it better not warn about missing default values of generics on analysis.
    Personally I tend to avoid having default values for generics which really should be explicitly set by the instantiating code such as data_width : positive and set default values for stuff which are optional such as with_output_register : boolean := false

     
  • Tristan Gingold

    Tristan Gingold - 2015-05-11

    My idea was to warn only for the generics in the top-level unit. Still worth ?

    In any case, we will see at usage.

    Thanks,
    Tristan.

     

Log in to post a comment.