Jump to content

Complie-time resolution of parameters Vs. Elaboration-time resolution


Recommended Posts

Posted

I am using Compile-time resolution of parameters in my model. 

Since compile-time happens in the beginning itself, i.e before elaboration, I already have the parameters ready to be used. So what is the use of Elaboration or simulation-time resolutions?

What are some examples/scenarios when Elaboration and simulation time resolution of parameters need to be used?

Experts, please explain this.

Thank you

Posted

Can you give an example of what you mean by "compile-time parameter"? Is it, for example - a pre-processor macro (`#define PARAM value`) or a C++ const expression ?

If yes, any change to the compilation parameter would require the user to recompile the simulator executable. This may not be always desired or even possible. The user may not even access to the sources for a recompilation.

A "non-compile time" resolution can be implemented, for example, by reading a configuration file to figure out the value of the parameter. In this case, a change in the value of the parameter doesn't need a recompilation. Whether it has to resolved in elaboration time - or can be modified simulation time - depends a bit on what the parameter affects. If it modifies any part of the hierarchy (that needs to be fixed before end of elab), obviously, the value has to be resolved during elaboration. Otherwise, for example a parameter that controls the debug message verbosity, it can be "resolved" (or even changed many times) during simulation.

Posted

By compile-time resolution of parameter I mean using templates.

I am getting error during elaboration. So I was wondering if I should be using elaboration-time resolution like having parameters in the constructor.

As per your explanation, I am neither reading a config file nor passing parameters on command line. So I think I don't have to use elaboration-time resolution. Correct me if I'm wrong. 

Posted
5 hours ago, acc_sysC said:

I am getting error during elaboration. So I was wondering if I should be using elaboration-time resolution like having parameters in the constructor.

No.. that is the wrong path. If you are getting errors during elaboration, you should be wondering why you are getting errors during elaboration 🙂

I mentioned using a config file as one way to resolve parameters at elaboration time, using constructor parameters is also valid. But changing a template parameter to a constructor parameter is not going to fix elaboration errors. You need to debug that issue separately.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...