Skip to content

Commit

Permalink
Add PORT_PROXY_ATTRS deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
mandolaerik committed Sep 22, 2023
1 parent 1583486 commit 37be595
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/1.2/dml-builtins.dml
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ template device {
parameter simics_api_version auto;

parameter _deprecate_port_proxy_ifaces auto;
parameter _deprecate_port_proxy_attrs auto;

// automatic parameters
parameter obj auto;
Expand Down
1 change: 1 addition & 0 deletions lib/1.4/dml-builtins.dml
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ template device {
param _api_6_or_older = simics_api_version == "6" || _api_5_or_older;

param _deprecate_port_proxy_ifaces auto;
param _deprecate_port_proxy_attrs auto;

// automatic parameters
param obj auto;
Expand Down
15 changes: 15 additions & 0 deletions py/dml/deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,18 @@ class port_proxy_ifaces(DeprecatedFeature):
'''
short = "Don't generate proxy port interfaces for banks and ports"
last_api_version = "6"


@deprecation
class port_proxy_attrs(DeprecatedFeature):
'''In Simics 5, configuration attributes for `connect`,
`attribute` and `register` objects inside banks and ports were
register on the device object, named like
<code><em>bankname</em>_<em>attrname</em></code>. Such proxy
attributes are only created When this deprecation is not enabled.
Proxy attributes are not created for all banks and ports, in the
same manner as documented in the `port_proxy_ifaces` deprecation.
'''
short = ("Don't generate top-level proxy attributes"
+ " for attributes in banks and ports")
last_api_version = "6"
4 changes: 3 additions & 1 deletion py/dml/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2605,7 +2605,9 @@ def need_port_proxy_attrs(port):
assert port.objtype in {'port', 'bank', 'subdevice'}
return (port.objtype in {'port', 'bank'}
and port.dimensions <= 1
and port.parent is dml.globals.device)
and port.parent is dml.globals.device
and (deprecations.port_proxy_attrs
not in dml.globals.enabled_deprecations))

class ConfAttrParentObjectProxyInfoParamExpr(objects.ParamExpr):
'''The _parent_obj_proxy_info parameter of a attribute, register, or
Expand Down
16 changes: 16 additions & 0 deletions test/1.4/legacy/T_port_proxy_attrs_disabled.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
© 2023 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/
dml 1.4;

device test;

/// DMLC-FLAG --simics-api=6
/// DMLC-FLAG --deprecate=port_proxy_attrs

import "port_proxy_attrs.dml";

method init() {
test(true);
}
15 changes: 15 additions & 0 deletions test/1.4/legacy/T_port_proxy_attrs_enabled.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
© 2023 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/
dml 1.4;

device test;

/// DMLC-FLAG --simics-api=6

import "port_proxy_attrs.dml";

method init() {
test(false);
}
19 changes: 19 additions & 0 deletions test/1.4/legacy/port_proxy_attrs.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
© 2023 Intel Corporation
SPDX-License-Identifier: MPL-2.0
*/
dml 1.4;

import "simics/simulator/conf-object.dml";

saved bool raised = false;

port p {
attribute a is uint64_attr;
}

method test(bool proxies_deprecated) {
assert _deprecate_port_proxy_attrs == proxies_deprecated;
assert SIM_class_has_attribute(SIM_object_class(dev.obj), "p_a")
== !proxies_deprecated;
}

0 comments on commit 37be595

Please sign in to comment.