A Messages C Changes from DML 1.2 to DML 1.4
Device Modeling Language 1.4 Reference Manual  / 

B Managing deprecated language features

As the DML language evolves, we sometimes need to change the language in incompatible ways, which requires DML users to migrate their code. This appendix describes the mechanisms we provide to make this migration process smooth for users with large DML code bases.

In DML, deprecations can come in many forms. Deprecations in the form of removed or renamed symbols in libraries are rather easy to manage, since they give clear compile errors that often are straightforward to fix. A slightly harder type of deprecation is when some language construct or API function adjusts its semantics; this can make the model behave differently without signalling error messages. A third kind of deprecation is when DML changes how compiled models appear in Simics, typically to adjust changes in the Simics API. Such changes add another dimension because they typically affect the end-users of the DML models, rather than the authors of the models. Thus, as an author of a model you may need to synchronize your migration of such features with your end-users, to ease their transition to a new major version.

B.1 Deprecation mechanisms

The simplest deprecation mechanism is Simics API versions: Each deprecated DML feature is associated with a Simics API version, and each Simics version supports a number of such API versions. Features reach end-of-life when moving to a new Simics major version, the features belonging to a previous Simics API version are dropped. Since Simics is currently the primary distribution channel for DML, this deprecation scheme is used for DML features as well.

This scheme allows users with a large code base to smoothly migrate from one Simics major version, N, to the next, N+1:

In addition to the API version, DML offers some compiler flags for selectively disabling deprecated features that are normally part of the used API. This has some uses, in particular:

B.2 Controlling deprecation on the DML command-line

DMLC provides a command-line flag --api-version to specify the API version to be used for a model. When building with the standard Simics build system, this is controlled by the SIMICS_API_VERSION variable in make, or the SIMICS_API/MODULE_SIMICS_API variable in CMake.

DMLC also provides the --no-compat=tag flag, which disables the feature represented by tag. The available tags are listed in the next section. The tag also controls the name of a global boolean parameter that the DML program may use to check whether the feature is available. The parameter's name is the tag name preceded by _compat_.

B.3 List of deprecated features

B.3.1 Features available up to --simics-api=5

dml12_not

DML 1.2-specific: the operand of the ! operator is not type-checked; in particular, negation expressions on the form !$reg, where reg is a register, are permitted

port_obj_param

This compatibility feature changes the value of the obj parameter in bank and port objects: Before Simics 6 there were no dedicated port objects, so this parameter did not exist and if you wrote obj inside a bank, this would resolve to dev.obj. This feature preserves this legacy behaviour by making the obj parameter of banks and ports resolves to dev.obj rather than the port object.

B.3.2 Features available up to --simics-api=6

dml12_goto

The goto statement is deprecated; this compatibility feature preserves it. Most goto based control structures can be reworked by changing the goto into a throw, and its label into a catch block; since this is sometimes nontrivial, it can be useful to disable the goto statement separately.

dml12_inline

When using inline to inline a method in a DML 1.2 device, constant arguments passed in typed parameters are inlined as constants when this feature is enabled. This can improve compilation time in some cases, but has some unintuitive semantic implications.

dml12_int

This compatibility feature affects many semantic details of integer arithmetic. When this feature is enabled, DMLC translates most integer operations directly into C, without compensating for DML-specifics, like the support for odd-sized uintNN types; this can sometimes have unexpected consequences. The most immediate effect of disabling this feature is that DMLC will report errors on statements like assert 0; and while (1) { ... }, which need to change into assert false; and while (true) { ... }, respectively. Other effects include:

The dml12_int feature only applies to DML 1.2 files; if a DML 1.4 file is imported from a DML 1.2 file, then modern DML semantics is still used for operations in that file.

dml12_misc

This compatibility feature preserves a number of minor language quirks that were originally in DML 1.2, but were cleaned up in DML 1.4. When this feature is enabled, DML 1.2 will permit the following:

io_memory

The transaction interface was introduced in 6, and will eventually replace the io_memory interface. When this feature is enabled, the top-level parameter use_io_memory defaults to true, causing bank objects to implement io_memory instead of transaction by default.

shared_logs_on_device

This compatibility feature changes the semantics of log statements inside shared methods so that they always log on the device object, instead of the nearest enclosing configuration object like with non-shared methods. This behaviour was a bug present since the very introduction of shared methods, which has lead to plenty of script code having become reliant on it, especially in regards to how banks log. This feature preserves the bugged behaviour.

suppress_WLOGMIXUP

This compatibility feature makes it so the warning WLOGMIXUP is suppressed by default. WLOGMIXUP warns about usages of a common faulty pattern which results in broken log statements — for more information, see the documentation of WLOGMIXUP in the Messages section.

WLOGMIXUP is suppressed by default below Simics API version 7 in order to avoid overwhelming users with warnings, as the faulty pattern that WLOGMIXUP reports is very prevalent within existing code. Addressing applications of the faulty pattern should be done before or as part of migration to Simics API version 7.

Passing --no-compat=suppress_WLOGMIXUP to DMLC has almost the same effect as passing --warn=WLOGMIXUP; either will cause DMLC to report the warning even when the Simics API version in use is below 7. The only difference between these two options is that if --no-compat=suppress_WLOGMIXUP is used (and --warn=WLOGMIXUP is not), then WLOGMIXUP may still be explicitly suppressed via --no-warn=WLOGMIXUP. In contrast, --warn=WLOGMIXUP doesn't allow for WLOGMIXUP to be suppressed at all.

B.3.3 Features available up to --simics-api=7

port_proxy_attrs

In Simics 5, configuration attributes for connect, attribute and register objects inside banks and ports were registered on the device object, named like bankname_attrname. Such proxy attributes are only created When this feature is enabled. Proxy attributes are not created for all banks and ports, in the same manner as documented in the port_proxy_ifaces feature.

port_proxy_ifaces

Version 5 and earlier of Simics relied on interface ports (as registered by the SIM_register_port_interface API function) for exposing the interfaces of ports and banks. In newer versions of Simics, interfaces are instead exposed on separate configuration objects. When this feature is enabled, old-style interface ports are created as proxies to the interfaces on the respective port objects. Such proxies are not created for all banks and ports; e.g., banks inside groups were not allowed in Simics 5, so such banks do not need proxies for backward compatibility.

A Messages C Changes from DML 1.2 to DML 1.4