specmane

Specman e: How to print a pointer to a struct?


I have the next message in my verification environment:

message(LOW, vt.text_style(LIGHT_PURPLE, " bla bla bla "), some_struct);

The output I get:

 bla bla bla  - some_struct-@405

I would like to add additional information to the message using appendf string routine, but then how can I print the address some_struct-@405 (or whatever it is called)?

I'v tried %x but it caused compilation error:

message(LOW, vt.text_style(LIGHT_PURPLE, appendf(" bla bla bla %s %x ", new_info, some_struct)));

How can I print the pointer to the struct inside appendf?

Thank you for you help


Solution

  • You should just use %s. It can be used with all types, even structs. It actually calls to_string() for the relevant parameter, no matter what's its type.

    %x means hexadecimal format, and can be used only with numeric types.