4 Libraries and Built-ins A Known Limitations
Device Modeling Language 1.2 Reference Manual  / 

5 Standard Templates

This chapter describes the standard templates included the DML library. The templates can be used for both registers and fields. The templates can be accessed after importing utility.dml.

The most common device register functionality is included in the standard templates.

Note that many standard templates has the same functionality and only differ by name or log-messages printed when writing or reading them. The name of the template help developers to get a quick overview of the device functionality. An example are the undocumented and reserved templates. Both have the same functionality. However, the undocumented template hints that something in the device documentation is unclear or missing, and the reserved template that the register or field should not be used by software.

The sub-sections use object as a combined name for registers and fields. The sub-sections refers to software and hardware reads and writes. Software reads and writes are defined as accesses using the io_memory interface (write/reads to memory/io mapped device). Software reads and writes use the DML built-in read and write methods. Hardware read writes are defined as accesses using Simics configuration attributes, using the DML built-in set and get methods. Device code can still modify a register or device even if hardware modification is prohibited.

5.1 _read_unimplemented

5.1.1 Description

The object functionality associated to a read access is unimplemented. Write access is using default implementation and can be overridden (for instance by the read_only template).

5.1.2 Log Output

First software read to a register results in an unimplemented log-message on log-level 1, remaining reads on log-level 2. Software reads to fields does not result in a log-message.

5.1.3 Parameters

log_level_high: sets the high log-level (default is 1, see LOG-OUTPUT)

log_level_low: sets the low log-level (default is 2, see LOG-OUTPUT)

unimplemented, _write_unimplemented, silent_unimplemented, design_limitation

5.2 _write_unimplemented

5.2.1 Description

The object functionality associated to a write access is unimplemented. Read access is using default implementation and can be overridden (for instance by the write_only template).

5.2.2 Log Output

First software write to registers results in an unimplemented log-message on log-level 1, remaining writes on log-level 2. First write to a field (if field value is not equal to write value) results in an unimplemented log-message on log-level 1, remaining writes on log-level 2.

5.2.3 Parameters

log_level_high: sets the high log-level (default is 1, see LOG-OUTPUT)

log_level_low: sets the low log-level (default is 2, see LOG-OUTPUT)

unimplemented, _read_unimplemented, silent_unimplemented, design_limitation

5.3 checkreserved

5.3.1 Description

Check if the value written to a register matches the bits in the reserved parameter, and log a spec_violation when it does.

5.3.2 Log Output

A spec_violation message.

5.4 clear_on_read

5.4.1 Description

Software reads return the object value. The object value is then reset to 0 as a side-effect of the read.

5.4.2 Log Output

None.

5.5 constant

5.5.1 Description

The object value will remain constant. Software and hardware writes does not update the object value. If this template is used on a register, it will not be checkpointed.

5.5.2 Log Output

First software write to register or field (if field value is not equal to write value) results in a spec_violation log-message on log-level 1, remaining writes on log-level 2.

5.5.3 Parameters

value: the constant value

init_val: can be set instead of value, for forward compatibility with DML 1.4

hard_reset_value: if value is undefined, this parameter is used instead

read_constant, silent_constant

5.6 design_limitation

5.6.1 Description

The object's functionality is not in the model's scope and has been left unimplemented as a design decision. Software and hardware writes and reads are implemented as default writes and reads. Debug registers are a prime example of when to use this template. This is different from unimplemented which is intended to be implement (if required) but is a limitation in the current model.

unimplemented, silent_unimplemented

5.7 ignore

5.7.1 Description

The objects functionality is unimportant for both hardware and software. Software and hardware reads return 0. Software and hardware writes are ignored.

5.7.2 Log Output

None.

5.8 ignore_write

5.8.1 Description

Software writes are ignored. This template might also be useful for read-only fields inside an otherwise writable register. See the documentation for the read_only template for more information.

5.8.2 Log Output

None.

5.9 no_reset

5.9.1 Description

The register's or field's value will not be changed on a hard or soft reset.

5.10 noalloc

5.10.1 Description

Do not allocate any storage for the object value, i.e. sets the object's allocate parameter to false.

5.10.2 Log Output

None.

5.11 ones

5.11.1 Description

The object is constant all 1's. Software and hardware writes does not update the object value. The object value is all 1's.

5.11.2 Log Output

First software write to register or field (if field value is not equal to write value) results in a spec_violation log-message on log-level 1, remaining writes on log-level 2.

5.12 read_constant

5.12.1 Description

Software reads return a constant value. No storage is allocated for the object value. If this template is used on a register, it will not be checkpointed.

5.12.2 Log Output

None.

5.12.3 Parameters

value: the constant value

read_val: can be set instead of value, for forward compatibility with DML 1.4

hard_reset_value: if value is undefined, this parameter is used instead

constant, silent_constant

5.13 read_only

5.13.1 Description

The object value is read-only for software, the object value can be modified by hardware.

5.13.2 Log Output

First software write results in a spec_violation log-message on log-level 1, remaining writes on log-level 2. Fields will only log if the written value is different from the old value.

If the register containing the read-only field also contains writable fields, it may be better to use the ignore_write template instead, since software often do not care about what gets written to a read-only field, causing unnecessary logging.

5.14 read_write

5.14.1 Description

The object value can be modified by both software and hardware. Uses the default read and write methods.

5.14.2 Log Output

None.

5.15 read_zero

5.15.1 Description

Software reads return 0.

5.15.2 Log Output

None.

5.16 reserved

5.16.1 Description

The object is marked reserved and should not be used by software. Software writes update the object value. Reads are not affected.

5.16.2 Log Output

First software write to register or field (if field value is not equal to write value) results in a spec_violation log-message on log-level 2. No logs on subsequent writes.

5.17 scratch

5.17.1 Description

The object is a data scratch area. Uses the default read and write methods.

5.17.2 Log Output

None.

5.18 signed

5.18.1 Description

Defines the object value to be treated as a signed integer, i.e. sets the object's signed parameter to true.

5.18.2 Log Output

None.

5.19 silent_constant

5.19.1 Description

The object value will remain constant. Software and hardware writes does not update the initial object value. If this template is used on a register, it will not be checkpointed.

5.19.2 Log Output

None.

5.19.3 Parameters

value: the constant value

init_val: can be set instead of value, for forward compatibility with DML 1.4

hard_reset_value: if value is undefined, this parameter is used instead

constant, read_constant

5.20 silent_unimplemented

5.20.1 Description

The object functionality is unimplemented, but do not print a lot of log-messages when reading or writing. Software and hardware writes and reads are implemented as default writes and reads.

5.20.2 Log Output

First software read to a register results in an unimplemented log-message on log-level 3, remaining reads on log-level 4. Software reads to fields does not result in a log-message. First software write to a register results in an unimplemented log-message on log-level 3, remaining writes on log-level 4. First write to a field (if field value is not equal to write value) results in an unimplemented log-message on log-level 3, remaining writes on log-level 4.

unimplemented

design_limitation

5.21 sticky

5.21.1 Description

Do not reset object value on soft-reset, keep current value.

5.21.2 Log Output

None.

5.22 undocumented

5.22.1 Description

The object functionality is undocumented or poorly documented. Software and hardware writes and reads are implemented as default writes and reads.

5.22.2 Log Output

First software write and read result in a spec_violation log-message on log-level 1, remaining on log-level 2.

5.23 unimplemented

5.23.1 Description

The object functionality is unimplemented. Warn when software is using the object. Software and hardware writes and reads are implemented as default writes and reads.

5.23.2 Log Output

First software read to a register results in an unimplemented log-message on log-level 1, remaining reads on log-level 2. Software reads to fields does not result in a log-message. First software write to registers results in an unimplemented log-message on log-level 1, remaining writes on log-level 2. First write to a field (if field value is not equal to write value) results in an unimplemented log-message on log-level 1, remaining writes on log-level 2.

5.23.3 Parameters

log_level_high: sets the high log-level (default is 1, see LOG-OUTPUT)

log_level_low: sets the low log-level (default is 2, see LOG-OUTPUT)

_read_unimplemented, _write_unimplemented, silent_unimplemented, design_limitation

5.24 unmapped

5.24.1 Description

Make the offset of a register undefined. This means that it is not mapped in the address space of the bank it is in.

5.24.2 Log Output

None.

5.25 write_0_only

5.25.1 Description

Software can only set bits to 0. The new object value is the bitwise AND of the old object value and the value written by software.

5.25.2 Log Output

None.

write_1_only

5.26 write_1_clears

5.26.1 Description

Software can only clear bits. This feature is often when hardware sets bits and software clears them to acknowledge. Software write 1's to clear bits. The new object value is a bitwise AND of the old object value and the bitwise complement of the value written by software.

5.26.2 Log Output

None.

5.27 write_1_only

5.27.1 Description

Software can only set bits to 1. The new object value is the bitwise OR of the old object value and the value written by software.

5.27.2 Log Output

None.

write_0_only

5.28 write_only

5.28.1 Description

The objects value can be modified by software but can't be read back, reads return 0.

5.28.2 Log Output

The first time the object is read there is a spec_violation log-message on log-level 1, remaining reads on log-level 2.

5.29 zeros

5.29.1 Description

The object is constant all 0's. Software and hardware writes does not update the object value. The object value is all 0's.

5.29.2 Log Output

First software write to register or field (if field value is not equal to write value) results in a spec_violation log-message on log-level 1, remaining writes on log-level 2.

4 Libraries and Built-ins A Known Limitations