constant <clock>_period : time := 10 ns;

What is the error with this code ? it says syntax error near "<".

  • 1
    Using google I'd say: constant clk_period : time := 10 ns; would be correct – Alexander von Wernherr Jul 27 at 8:49
  • 1
    Why do you have the “<“ and “>”? – Blair Fonville Jul 27 at 8:52
up vote 1 down vote accepted

I think you generated a testbench-template in Vivado or ISE, as these programs generate code like this.

The idea is that you replace the <clock> with the name of your clock-signal: If your clock-signal is called clk, the line would become

 constant clk_period : time := 10 ns;

which is perfectly fine.

VHDL names can contain the following:

  • letters
  • numbers
  • underscores

They are also case insensitive, have to start with a letter and cannot contain two adjacent underscores (From the Doulos Golden Reference Guide).

< and > are not a letter, number or an underscore.

  • Names are a larger subject, see IEEE Std 1076-2008 8. Names. You're describing a basic identifier, a lexical element see 15.4.2. There's also the extended identifier (15.4.3). extended_identifier ::= \ graphic_character { graphic_character } \ where a backslash can be represented in the sequence of graphic characters by escaping it with a preceding backslash. constant \<clock>_period\ : time := 10 ns; would be a legal declaration with the object name \<clock>_period\ . – user8352 Jul 27 at 23:11

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.