-
Notifications
You must be signed in to change notification settings - Fork 49
D.2. Language differences handled by the port dml script
- PABSTRACT_TEMPLATE
-
When implementing methods
readorwritein a field or register, orhard_resetorsoft_resetin a bank, orget,set,read_field,write_fieldin a field, then this will have no effect unless a template named like the method is instantiated. The automatic converter will add e.g.is read;before an implementation ofread. - PAFTER
-
The syntax of
afterstatements changed: The delay should be followed bysto denote time unit; furthermore, thecallkeyword should no longer be used, and brackets around the delay are optional. Example:after (1.3) call send_frame(); // DML 1.2 syntax after 1.3 s: send_frame(); // DML 1.4 syntax - PANDOR
-
DML 1.2 permits the right operand of an
&&or||expression to contain errors, as long as the left operand evaluates to a constant that makes the right operand dead. DML 1.4 does not permit this, so the expressionA && Bmust be converted toA #? B #: false. One common use case is expressions like(defined X && X.y == ...). - PARRAY
-
The syntax for object arrays has changed: Instead of
register r[j in 0..size - 1], you writeregister r[j < size] - PARRAY_I
-
The syntax for object arrays has changed: Instead of
register r[12], you writeregister r[i < 12] - PATTRIBUTE
-
The
allocate_typeparameter is no longer valid for attributes. Integer, boolean and floating-point attributes instead use standard templates such asuint64_attr,int64_attr,bool_attranddouble_attr.The porting rule will remove
allocate_type, together with an explicit type parameter if present. All integer types will be changed to 64-bit types. Attributes withallocate_type="string"have to be manually rewritten. - PAUTO
-
The
autokeyword is deprecated; use the equivalentlocalinstead. - PBEFAFT
-
In objects of type attribute, register and connect, before/after methods (e.g.
before_write,after_read,after_set), are no longer called. They are transformed into an override of the corresponding base function (write_register,read_register,set). Note that when a before/after method is implemented by a template, then an additionalis registerdeclaration may be needed in 1.4; this is not automatically added. - PBITNEQ
-
DML 1.2 permits using 1-bit fields as boolean values. In DML 1.4, field values are 64 bit, and thus require an explicit
!= 0 - PCHANGE_INARGS
-
Many overridable methods in the standard library have changed, and method overrides must be changed accordingly. A method in 1.2 usually has a counterpart in 1.4, but its semantics may have changed slightly and quite often the set of arguments has changed as well. The automatic converter will adjust the names and signatures of a number of methods. Invocations, including
default(), are not updated and must be manually converted (compile errors). Some method arguments are removed by the converter; if these arguments are used, the implementation must be modified accordingly. In particular, thememoparg of various bank and register methods is no longer present. This has been replaced with an argumentvoid *aux, which is normally NULL. If some register in a bank needs a memop, then theio_memory_accessmethod can be updated to pass down the memop in theauxargument (just calldefaultwithmemopin the last arg). An explicit call to a bank method, e.g. a redirection of an access to a different bank, should normally be rewritten as a call toreadorwrite, usually with NULL in theauxargument.Bank methods are converted as follows:
access→io_memory_access;read_access,read_access_memop→read;write_access,write_access_memop→writeRegister methods are converted like so:
read_access→read_register,write_access→write_registerField methods are converted thusly:
read_access→read_field,write_access→write_fieldIn
registerandfieldobjects, thesetandwrite_register/write_fieldmethods will get an explicit typeuint64.The read and write methods on
bank,register, andfieldobjects all take a newuint64argument denoting enabled bytes or bits, depending on the context, which may mask an access.In
connectobjects,validate_portis converted tovalidate; named ports are deprecated in Simics 6, but the port name is available in theportsession variable.In
attributeobjects, thesetmethod will get an explicit argument typeattr_value_t, and athrowsannotation. - PCONSTANT
-
constantdeclarations are removed in 1.4 and should be replaced withparamdeclarations. Both are accessible from the top-level scope of a device. - PDOLLAR_QUALIFY
-
In DML 1.4, there is no separate scope for
$, so local variables can shadow object references. This conversion rule attempts to detect this, and addthis.or dev.path. where needed. - PEVENT
-
Event objects no longer have the
timebaseparameter; instead you must choose a standard template to instantiate. The conversion script will pickcustom_time_event,custom_cycle_event,simple_time_event, orsimple_cycle_event. - PEVENT_NO_ARG
-
When
PEVENTconverts an event tosimple_time_eventorsimple_cycle_event, thedatafunction argument to methodspost,posted,nextandremoveare removed. - PEVENT_REMOVE_INFO
-
When an event is converted to a
uint64_time_eventoruint64_cycle_event, theset_event_infoandget_event_infomethods are removed. - PEVENT_UINT64_ARG
-
When one of the methods
post,posted,nextandremoveis called with an integer value cast to a pointer in thedataarg, that event is converted to auint64_time_eventoruint64_cycle_event. The converter removes the cast and causes the event object to be converted to auint64_time_eventinstead ofuint64_custom_event. - PFIELDRANGE
-
In a field declaration, the field range declaration must be preceded by
@. In DML 1.4, the syntaxfield f[4]declares a field array of size 4, while in DML 1.2 it denotes a field occupying bit 4 in its parent register. - PHARD_RESET_VALUE
-
The
hard_reset_valueparameter is no longer recognized. The parameter is automatically renamed toinit_val, which has roughly the same effect. - PHASH
-
ifstatements on top level must be prefixed with a#character. The same applies toifstatement inside a method body if the condition is constant and the dead branch contains errors.Similarly, the conditional operator (
? :) is updated to #? #: when needed,selectis updated to#select, andforeachis updated to#foreach. - PHASHELSE
-
If an
ifis updated to#if, and there is a correspondingelseclause, then it must be updated to#else. The same applies to theelseclause inselectstatements. - PIFAND
-
If statements on the form
if (defined(X) && X.y) { ... }are converted to a nested#ifstatement - PIMPORT_DML12COMPAT
-
The
PTRAMPOLINEporting rule sometimes requires thatdml12-compatibility.dmlis imported. - PINARGTYPE
-
When overriding a method in DML 1.4, the overriding and default implementation must declare the same arguments as
inline. If the override has untyped arguments that are typed in the default method, then the conversion script will add a type to the override's argument.Note: The inserted type declaration uses C syntax, which in most cases matches DML syntax; however, there are exceptions where the inserted declaration will be broken and needs to be fixed manually.
- PINLINEDECL
-
Methods with untyped parameters must be explicitly marked 'inline' in DML 1.4, as in
inline method m(inline x) -> (int y) - PINPARAMLIST
-
If a method has no input arguments, the empty input parameter list
()is now required in method declarations andcall/inlinestatements. - PINT1
-
Integer types have different semantics in DML 1.2 and DML 1.4; the
int1type in DML 1.2 is converted touint1in DML 1.4 because that is a better match for some common operations. In particular, if the value 1 is assigned to variables of these types, then the value of the variable becomes 1, whereas forint1in DML 1.4 the value is -1. - PINVOKE
-
Method invocation syntax changed. Replace
call m(x) -> (a, b); inline n() -> (c); call o();with:
(a, b) = m(x); c = n(); o(); - PLOGKIND
-
In log statements, the old syntax where log type is denoted by a string has been removed. Use the new identifier-based syntax instead. E.g., instead of:
log "info": "foo"; log "spec_violation": "foo";you must now write:
log info: "foo"; log spec_viol: "foo"; - PMISS_PATTERN
-
The
miss_patternparameter is no longer recognized by banks, unless themiss_pattern_banktemplate, from utility.dml, is instantiated. An instantiation is automatically added. - PNODOLLAR
-
The
$character is no longer needed when referencing objects. - PNOTHROW
-
In DML 1.4, it is assumed by default that a method may not throw an exception. Any
nothrowannotations must be removed. - PNO_WUNUSED
-
Used in conjunction with PWUNUSED to signal that a piece of conditional code was indeed used. If using multiple runs of DMLC as input to the porting script, and a piece of code was used in some runs and unused in others, then no warning is shown.
- POUTARGRETURN
-
An assignment to an output argument directly followed by a return statement is more concisely written as a single return statement, without an intermediate assignment. For instance,
dml 1.2; method four() -> (int x) { x = 4; return; }can be expressed as:
dml 1.4; method four() -> (int) { return 4; } - POVERRIDE
-
If a method has exactly one default and one non-default declaration, and the non-default declaration resides in a template, then DML 1.4 requires that this template inherits from the template containing the default declaration. Conversion is done automatically for the most common case.
- POVERRIDE_IMPORT
-
Similar to POVERRIDE, but if a default method does not reside in a template, then the file that instantiates the non-default declaration must import the file containing the default declaration.
- PPARAMETER
-
The
parameterkeyword has been renamed toparam. - PRENAME_TEMPLATE
-
Some templates in
utility.dmlhave been renamed; in particular,unimplementedhas been renamed tounimpl. - PRETURNARGS
-
In methods with return values, return statements now take arguments:
method m() -> (int, int) { return (1, 4); } method n() -> (int) { return 3; } - PRETVAL
-
Method output parameters are not named in DML 1.4:
method m() -> (int, int) { ... }See also
PRETURNARGS. - PRETVAL_END
-
Methods with output arguments must end with an explicit return statement in DML 1.4; in DML 1.2, the method would return whatever value the output argument had upon exit. See also
PRETVAL. - PSESSION
-
The
dataandstatickeywords have both been replaced withsession:session uint32 x; - PSHA1
-
The
port-dmlscript requires that the DML file has not been changed since the tag file was generated. This is verified by a SHA1 checksum. - PSOFT_RESET_VALUE
-
The
soft_reset_valueparameter is renamed tosoft_reset_val, and requires the templatesoft_reset_valto be instantiated. - PSTRINGIFY
-
In DML 1.4,
#is changed to thestringifyoperator - PSTRUCTDECL
-
Struct type definitions can no longer be declared using the labeled struct syntax. The equivalent typedef declaration should be used instead. For example, the following is now disallowed:
struct xyz { ... }and should be replaced with the following:
typedef struct { ... } xyz; - PTHROWS
-
In DML 1.4, methods that can throw an exception must explicitly declare that with a 'throws' annotation. Such annotation is automatically added for methods that override a throwing method that was declared in a DML 1.4 file.
- PTRAMPOLINE
-
The methods
miss_read_accessandmiss_write_accessinbankobjects have been renamed tounmapped_readandunmapped_writein 1.4. The converter creates methods with the new names, which call the existing unmodified methods. - PTYPEDOUTPARAM
-
Method output parameters must have explicit types in DML 1.4. The automatic conversion script will convert untyped output parameters to
uint64. - PUNDEFOFFS
-
undefinedis no longer a valid offset for registers;unmapped_offsetshould be used instead. - PVAL
-
The value of a
register,fieldorattributeobject, and the interface struct of ainterfaceobject, is now accessed through the.valmember. - PVERSION
-
DML 1.4 files should start with
dml 1.4;instead ofdml 1.2; - PWUNUSED
-
This message is used to signal to the porting script that a piece of conditional code was not fully covered by the compile. Some portings are never applied on dead code. The porting script can signal a warning for this.