I have a few question related to regs hard/soft reset values. According to the documentation (in this case for soft reset value):
SOFT_RESET_VALUE The soft_reset_value parameter is renamed to soft_reset_val, and requires the template soft_reset_val to be instantiated. So, hard_reset_value is effectively init_val and soft_reset_value is now soft_reset_val. Except soft_reset must be overridden to provide a different value?
The hard_reset_value and soft_reset_value parameters in registers and fields are no longer recognized. Instead, the default implementations of the hard_reset and soft_reset methods invoke the init method, effectively replacing the hard_reset_value and soft_reset_value parameters with init_val. You must now override the soft_reset method explicitly in order to provide different reset values for hard and soft reset. Where is the method init() for the registers located?
Also, I suspect the answer is no but is there a list of all methods predefined somewhere along with all the magic variables and parameters?
Lastly, is it always necessary to use ‘is read’ to override an internal library function? The documentation suggests that putting a read method is sufficient but that does not work because:
warning: implementation of read() without 'is read' is ignored by the standard library
If ‘is read’ is always necessary, why is it there at all? Thanks in advance.
There are a number of questions here, so I'll separate and answer them in turn.
Re. soft reset. To provide an exhaustive explanation of how the mechanism surrounding soft-reset works:
soft_resettemplate (as long as the device is declared to support soft reset viais sreset;), and provides a default implementation of thesoft_reset()method, which callsinit()of the register/field. In turn, the default implementation ofinit()for register/fields leverage theinit_valparameter, which, if not specified, is by default 0 for registers; and for fields, by default dependent oninit_valof the parent register.soft_resetof a register/field is thus affected by any change of any link specified in the above chain. You can changeinit_val; or overrideinit(); or overridesoft_reset()soft_reset_valis a separate template fromsoft_reset, and is not instantiated automatically for registers/fields. It affects the first link the chain, i.e., it provides its own implementation ofsoft_reset(), which leverages thesoft_reset_valparam. This is relevant if you want the value that your register/field initializes/hard resets to to be different compared to the value that it soft resets to.Yes! The DML 1.4 reference manual! Sections 4 and 5 provides the answer to almost everything you're asking about -- although admittedly, its wording of the default behavior of
soft_resetimpliesinit_valis used directly in the default implementation ofsoft_reset(), rather than indirectly from the use ofinit(). We'll correct the wording to be more precise.That is not the case. What documentation suggests that? If it's anything non-public (i.e. not the DML 1.4 Reference Manual), then you'll have to raise that privately to Intel.
No; you misunderstand. It is not a question of having to instantiate a template to override an internal library function. In DML 1.4, the
read()andwrite()methods are not inherent to registers or fields. They are creatures of thereadandwritetemplates, which may be instantiated for registers/fields, and are meant to provide a simple means of customizing read/write behavior. If you make a definition ofread()orwrite()without instantiating thereadorwritetemplates, then no code is added to the register/field to actually make use of those methods; so they're dead, hence, "ignored by the standard library".Because it isn't always necessary -- only if you wish to have access to the simplified means of customizing read/write behavior -- and, more to the point, because instantiating
read/writefor a register/field will, by itself, change the semantics of reads/writes to the register/field. Most critically, if you instantiateread/writefor a register, then reading/writing to it will cause it to ignore any customized read/write behavior of its fields! This is noted in the reference manual.