0
\$\begingroup\$

In my VHDL design I have entities with port definitions similar to this:

entity dummy is
  port( cpl : cplxRecord_t )
end entity

type cplxRecord_t is record
   r1 : anotherRecord_t;
   vec: unsigned;
   lin: std_logic;
   ...
end record

in the architecture I use some standard functions for unsigned, e.g. to_integer(cpl.vec). These complain during simulation startup Metavalue detected. Returning .... I would like to eliminate the cause of these warnings. So far my only idea is to assign a default value to that port. However having to define each element feels like a bad solution, making htis a maintenance headache when elements are added to/removed from the record. Is there some way to initialize the port with all '0' (Zero)?

Q: How do I prevent Metavalue detected warnings, caused by unsigned ports being uninitialized U during design loading and processesd by to_integer?

P.S.: I am using modelsim. And this font makes it hard to differntiate between letter o and zero. O0o

\$\endgroup\$
8
  • \$\begingroup\$ What are you trying to program? What compiler are you using? Keywords aren't where most go to figure out whatyou're talking about. The question should stand alone \$\endgroup\$ Commented Aug 31, 2013 at 13:24
  • \$\begingroup\$ @ScottSeidman: I added the tool and tried to write the question as a sentence with its own paragraph, however I feel that this makes it worse in this case as there needs to be some explanation why I dont want to just initialize every port for design loading. I am trying to build a cache, but I do not see how this matters. And I do not understand what you are trying to tell me with " Keywords aren't where most go to figure out whatyou're talking about", would you mind to elaborate? \$\endgroup\$
    – ted
    Commented Aug 31, 2013 at 16:40
  • \$\begingroup\$ The usual way to do this is to write a function that converts things like H to a 1. Of course, other values like X and U should throw errors. \$\endgroup\$
    – user3624
    Commented Aug 31, 2013 at 16:46
  • \$\begingroup\$ @DavidKessner: well given that I am lazy, I think unsigned fits better than std_ulogic_vec and the problem occurs only during startup (first delta cycles after design is loaded) and is not a problem in operation since the other units drive the inputs only to valid levels (0,1) I think that adding a conversion function would a) be a bit over the top and b) the problem is caused by the port reading U during startup in the first place. \$\endgroup\$
    – ted
    Commented Aug 31, 2013 at 16:51
  • \$\begingroup\$ Also, it helps to initialize your signals at startup, when you declare them. For example "signal foo_bar :std_logic := '0';". That way they have valid levels even before the simulation starts. \$\endgroup\$
    – user3624
    Commented Aug 31, 2013 at 16:52

1 Answer 1

1
\$\begingroup\$

I'm pretty sure you have to assign the whole record. In the past I've created initialisation constants for my records which ease this problem.

As a workaround (in Modelsim at least, probably Aldec as well) you can use a small TCL function to start off your simulation. This function can disable those warnings, run for 1 ps, then re-enable the warnings and run the rest of the simulation.

\$\endgroup\$
1
  • \$\begingroup\$ I will look into both. It seems there is no silver bullet... (maybe a way to set defaults for records globally??) \$\endgroup\$
    – ted
    Commented Sep 2, 2013 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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