Search code examples
simicsdml-lang

apply init_val template to the uint64_attr


​Hi all,

I want to apply the init_val template to several attributes in my model to reset them by sreset template.

Attribute definition below can't be compiled by 166 base, any suggestions?

attribute attr1[10] is (uint64_attr, init_val) {
    param init_val = 100;
}

Solution

  • init_val is a template meant to be applied on registers or fields, not generic attributes (in addition, for registers and fields the template is implicitly provided by the object template and there is no need to explicitly instantiate it)

    That said, uint64_attr does provide you with an overrideable init_val parameter as well, just disconnected from the init_val template. So in your case just removing the init_val instantiation should make the code compile.

    However, this will not be enough to tie the attributes into the soft reset mechanisms. The recommended way to do that would be to instantiate soft_reset template in each attribute, and override the soft_reset method and have it call into init. This should make the attributes re-run their init code (which, if you have not modified it, will set their values to init_val).