Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MODULEINFO
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Make: dmlc
$(HOST)/bin/dml/python/__main__.py
$(HOST)/bin/dml/python/dml/__init__.py
$(HOST)/bin/dml/python/dml/ast.py
$(HOST)/bin/dml/python/dml/breaking_changes.py
$(HOST)/bin/dml/python/dml/c_backend.py
$(HOST)/bin/dml/python/dml/g_backend.py
$(HOST)/bin/dml/python/dml/codegen.py
$(HOST)/bin/dml/python/dml/compat.py
$(HOST)/bin/dml/python/dml/crep.py
$(HOST)/bin/dml/python/dml/ctree.py
$(HOST)/bin/dml/python/dml/dmllex.py
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ LIBDIR := $(SIMICS_PROJECT)/$(HOST_TYPE)/bin

PYFILES := dml/__init__.py \
dml/ast.py \
dml/breaking_changes.py \
dml/c_backend.py \
dml/g_backend.py \
dml/codegen.py \
dml/compat.py \
dml/crep.py \
dml/ctree.py \
dml/template.py \
Expand Down
29 changes: 15 additions & 14 deletions deprecations_to_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,33 @@
[path_to_dml, header, outfile] = sys.argv[1:]
sys.path.append(path_to_dml)

from dml import compat
from dml import breaking_changes
from dml.env import api_versions, default_api_version

by_version = {}
for feature in compat.features.values():
if (feature.last_api_version.str in api_versions()
# don't document features that are unconditionally disabled in
for bc in breaking_changes.changes.values():
if (bc.required_after.str in api_versions()
# don't document breaking changes that are unconditionally disabled in
# this Simics version
or feature.last_api_version > compat.apis[default_api_version()]):
by_version.setdefault(feature.last_api_version, []).append(feature)
or bc.required_after > breaking_changes.apis[default_api_version()]):
by_version.setdefault(bc.required_after, []).append(bc)

with open(outfile, 'w') as f:
f.write(Path(header).read_text())
for (ver, features) in sorted(by_version.items()):
for (ver, bcs) in sorted(by_version.items()):
f.write(fr"""
### Features available up to and including -\-simics-api={ver.str}
These features correspond to functionality removed when compiling using
### Changes for migrating from -\-simics-api={ver.str}
These changes are enabled automatically when compiling using
Simics API {ver.ordinal + 1} or newer. With older Simics API versions, these
features can be disabled individually by passing <tt>-\-no-compat=<em>TAG</em></tt>
features can be disabled individually by passing
<code>-\-breaking-change=<em>TAG</em></code>
to the `dmlc` compiler.
""")
f.write("<dl>\n")
for feature in sorted(features, key=lambda f: f.tag()):
assert feature.__doc__
f.write(f" <dt>{feature.tag()}</dt>\n")
for bc in sorted(bcs, key=lambda f: f.tag()):
assert bc.__doc__
f.write(f" <dt>{bc.tag()}</dt>\n")
doc = '\n'.join(line[4:] if line.startswith(' ') else line
for line in feature.__doc__.strip().splitlines())
for line in bc.__doc__.strip().splitlines())
f.write(f" <dd>\n\n{doc}\n</dd>\n")
f.write("</dl>\n")
6 changes: 3 additions & 3 deletions dmlast.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ def create_dmlasts(dmlc_path, dmlast_path, dml_path, depfile):
from dml.toplevel import produce_dmlast
from dml.logging import ignore_warning
import dml.globals
from dml import compat
from dml import breaking_changes

ignore_warning('WEXPERIMENTAL')
dml.globals.enabled_compat.add(compat.warning_statement)
# disable breaking change dml_forbid_warning_statement
breaking_changes.BreakingChange.enabled_breaking_changes = set()
dml_files_abs = list(dml_path.rglob('*.dml'))
dml_files = [p.relative_to(dml_path) for p in dml_files_abs]
assert dml_files
Expand All @@ -35,4 +36,3 @@ def create_dmlasts(dmlc_path, dmlast_path, dml_path, depfile):
[dmlc_path, dmlast_path, dml_path, depfile] = map(Path, sys.argv[1:])
create_dmlasts(dmlc_path.resolve(), dmlast_path.resolve(),
dml_path.resolve(), depfile)

80 changes: 59 additions & 21 deletions lib/1.2/dml-builtins.dml
Original file line number Diff line number Diff line change
Expand Up @@ -209,27 +209,65 @@ template device {

parameter simics_api_version auto;

parameter _compat_broken_unused_types auto;
parameter _compat_broken_conditional_is auto;
parameter _compat_port_proxy_ifaces auto;
parameter _compat_port_proxy_attrs auto;
parameter _compat_optional_version_statement auto;
parameter _compat_function_in_extern_struct auto;
parameter _compat_port_obj_param auto;
parameter _compat_io_memory auto;
parameter _compat_shared_logs_on_device auto;
parameter _compat_suppress_WLOGMIXUP auto;
parameter _compat_legacy_attributes auto;
parameter _compat_lenient_typechecking auto;
parameter _compat_no_method_index_asserts auto;
parameter _compat_meaningless_log_levels auto;
parameter _compat_dml12_inline auto;
parameter _compat_dml12_not auto;
parameter _compat_dml12_goto auto;
parameter _compat_dml12_misc auto;
parameter _compat_dml12_int auto;
parameter _compat_experimental_vect auto;
parameter _compat_warning_statement auto;
parameter _compat_broken_unused_types
= !$_breaking_change_dml_forbid_broken_unused_types;
parameter _compat_broken_conditional_is
= !$_breaking_change_dml_forbid_broken_conditional_is;
parameter _compat_port_proxy_ifaces
= !$_breaking_change_dml_remove_port_proxy_ifaces;
parameter _compat_port_proxy_attrs
= !$_breaking_change_dml_remove_port_proxy_attrs;
parameter _compat_function_in_extern_struct
= !$_breaking_change_dml_forbid_function_in_extern_struct;
parameter _compat_optional_version_statement
= !$_breaking_change_dml_require_version_statement;
parameter _compat_io_memory = !$_breaking_change_dml_transaction_by_default;
parameter _compat_port_obj_param
= !$_breaking_change_dml_remove_port_obj_param;
parameter _compat_shared_logs_on_device
= !$_breaking_change_dml_shared_logs_locally;
parameter _compat_suppress_WLOGMIXUP
= !$_breaking_change_dml_enable_WLOGMIXUP;
parameter _compat_legacy_attributes
= !$_breaking_change_dml_remove_legacy_attributes;
parameter _compat_lenient_typechecking
= !$_breaking_change_dml_strict_typechecking;
parameter _compat_no_method_index_asserts
= !$_breaking_change_dml_range_check_method_indices;
parameter _compat_meaningless_log_levels
= !$_breaking_change_dml_restrict_log_levels;
parameter _compat_dml12_inline
= !$_breaking_change_dml12_disable_inline_constants;
parameter _compat_dml12_not = !$_breaking_change_dml12_not_typecheck;
parameter _compat_dml12_misc = !$_breaking_change_dml12_remove_misc_quirks;
parameter _compat_dml12_goto = !$_breaking_change_dml12_remove_goto;
parameter _compat_dml12_int = !$_breaking_change_dml12_fix_int_quirks;
parameter _compat_experimental_vect
= !$_breaking_change_dml_forbid_experimental_vect;
parameter _compat_warning_statement
= !$_breaking_change_dml_forbid_warning_statement;

parameter _breaking_change_dml_forbid_broken_unused_types auto;
parameter _breaking_change_dml_forbid_broken_conditional_is auto;
parameter _breaking_change_dml_remove_port_proxy_ifaces auto;
parameter _breaking_change_dml_remove_port_proxy_attrs auto;
parameter _breaking_change_dml_forbid_function_in_extern_struct auto;
parameter _breaking_change_dml_require_version_statement auto;
parameter _breaking_change_dml_transaction_by_default auto;
parameter _breaking_change_dml_remove_port_obj_param auto;
parameter _breaking_change_dml_shared_logs_locally auto;
parameter _breaking_change_dml_enable_WLOGMIXUP auto;
parameter _breaking_change_dml_remove_legacy_attributes auto;
parameter _breaking_change_dml_strict_typechecking auto;
parameter _breaking_change_dml_range_check_method_indices auto;
parameter _breaking_change_dml_restrict_log_levels auto;
parameter _breaking_change_dml12_disable_inline_constants auto;
parameter _breaking_change_dml12_not_typecheck auto;
parameter _breaking_change_dml12_remove_misc_quirks auto;
parameter _breaking_change_dml12_remove_goto auto;
parameter _breaking_change_dml12_fix_int_quirks auto;
parameter _breaking_change_dml_forbid_experimental_vect auto;
parameter _breaking_change_dml_forbid_warning_statement auto;

// automatic parameters
parameter obj auto;
Expand Down
87 changes: 63 additions & 24 deletions lib/1.4/dml-builtins.dml
Original file line number Diff line number Diff line change
Expand Up @@ -635,27 +635,64 @@ template device {

param simics_api_version auto;

param _compat_broken_unused_types auto;
param _compat_broken_conditional_is auto;
param _compat_port_proxy_ifaces auto;
param _compat_port_proxy_attrs auto;
param _compat_function_in_extern_struct auto;
param _compat_optional_version_statement auto;
param _compat_port_obj_param auto;
param _compat_io_memory auto;
param _compat_shared_logs_on_device auto;
param _compat_suppress_WLOGMIXUP auto;
param _compat_legacy_attributes auto;
param _compat_lenient_typechecking auto;
param _compat_no_method_index_asserts auto;
param _compat_meaningless_log_levels auto;
param _compat_dml12_inline auto;
param _compat_dml12_not auto;
param _compat_dml12_goto auto;
param _compat_dml12_misc auto;
param _compat_dml12_int auto;
param _compat_experimental_vect auto;
param _compat_warning_statement auto;
// legacy aliases
param _compat_broken_unused_types
= !_breaking_change_dml_forbid_broken_unused_types;
param _compat_broken_conditional_is
= !_breaking_change_dml_forbid_broken_conditional_is;
param _compat_port_proxy_ifaces
= !_breaking_change_dml_remove_port_proxy_ifaces;
param _compat_port_proxy_attrs
= !_breaking_change_dml_remove_port_proxy_attrs;
param _compat_function_in_extern_struct
= !_breaking_change_dml_forbid_function_in_extern_struct;
param _compat_optional_version_statement
= !_breaking_change_dml_require_version_statement;
param _compat_io_memory = !_breaking_change_dml_transaction_by_default;
param _compat_port_obj_param = !_breaking_change_dml_remove_port_obj_param;
param _compat_shared_logs_on_device
= !_breaking_change_dml_shared_logs_locally;
param _compat_suppress_WLOGMIXUP = !_breaking_change_dml_enable_WLOGMIXUP;
param _compat_legacy_attributes
= !_breaking_change_dml_remove_legacy_attributes;
param _compat_lenient_typechecking
= !_breaking_change_dml_strict_typechecking;
param _compat_no_method_index_asserts
= !_breaking_change_dml_range_check_method_indices;
param _compat_meaningless_log_levels
= !_breaking_change_dml_restrict_log_levels;
param _compat_dml12_inline
= !_breaking_change_dml12_disable_inline_constants;
param _compat_dml12_not = !_breaking_change_dml12_not_typecheck;
param _compat_dml12_misc = !_breaking_change_dml12_remove_misc_quirks;
param _compat_dml12_goto = !_breaking_change_dml12_remove_goto;
param _compat_dml12_int = !_breaking_change_dml12_fix_int_quirks;
param _compat_experimental_vect
= !_breaking_change_dml_forbid_experimental_vect;
param _compat_warning_statement
= !_breaking_change_dml_forbid_warning_statement;

param _breaking_change_dml_forbid_broken_unused_types auto;
param _breaking_change_dml_forbid_broken_conditional_is auto;
param _breaking_change_dml_remove_port_proxy_ifaces auto;
param _breaking_change_dml_remove_port_proxy_attrs auto;
param _breaking_change_dml_forbid_function_in_extern_struct auto;
param _breaking_change_dml_require_version_statement auto;
param _breaking_change_dml_transaction_by_default auto;
param _breaking_change_dml_remove_port_obj_param auto;
param _breaking_change_dml_shared_logs_locally auto;
param _breaking_change_dml_enable_WLOGMIXUP auto;
param _breaking_change_dml_remove_legacy_attributes auto;
param _breaking_change_dml_strict_typechecking auto;
param _breaking_change_dml_range_check_method_indices auto;
param _breaking_change_dml_restrict_log_levels auto;
param _breaking_change_dml12_disable_inline_constants auto;
param _breaking_change_dml12_not_typecheck auto;
param _breaking_change_dml12_remove_misc_quirks auto;
param _breaking_change_dml12_remove_goto auto;
param _breaking_change_dml12_fix_int_quirks auto;
param _breaking_change_dml_forbid_experimental_vect auto;
param _breaking_change_dml_forbid_warning_statement auto;

// automatic parameters
param obj auto;
Expand All @@ -668,7 +705,7 @@ template device {
param be_bitorder default _be_bitorder;
param log_group = undefined;

param use_io_memory default _compat_io_memory;
param use_io_memory default !_breaking_change_dml_transaction_by_default;
// this was available in DML 1.2; defensively reserved in 1.4
param banks = undefined;
// this carried semantics in DML 1.2; deprecated in 1.4
Expand Down Expand Up @@ -1559,7 +1596,8 @@ template port is object {
param _is_simics_object = true;
// limitations for ports are not recognized
param limitations = undefined;
param obj = dev._compat_port_obj_param #? dev.obj #: _port_obj();
param obj = dev._breaking_change_dml_remove_port_obj_param
#? _port_obj() #: dev.obj;

#if (parent.objtype == "group"
#? parent._simics_namespace_clash #: false) {
Expand Down Expand Up @@ -1908,7 +1946,8 @@ template bank is (object, shown_desc) {
// compatibility: referencing 'obj' in a bank method must evaluate to
// dev.obj in code that can compile on both 5 and 6
// TODO: we should probably make obj an immutable session variable
param obj = dev._compat_port_obj_param #? dev.obj #: _bank_obj();
param obj = dev._breaking_change_dml_remove_port_obj_param
#? _bank_obj() #: dev.obj;
param partial : bool;
param overlapping : bool;
param _le_byte_order : bool;
Expand Down
2 changes: 1 addition & 1 deletion py/dead_dml_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def method_locations(path):
from dml.toplevel import parse_file, determine_version
from dml import logging, messages
import dml.globals
from dml import compat
from dml import breaking_changes as compat
# needed to parse 1.2/utility.dml
dml.globals.enabled_compat.add(compat.warning_statement)
for warning in messages.warnings:
Expand Down
Loading