The execution of AWL/STL programs by Awlsim is supposed to be fully compatible with the execution of compiled AWL/STL programs on the real Siemens S7 CPU. However, there currently are some known differences. These are listed below. Any undocumented difference between Awlsim and STEP 7 is considered to be a bug that should be reported.
-
Awlsim does not implement all features of STEP 7, yet. See TODO.md for a list of missing features.
-
Changing a symbol's address or data type in Awlsim does change the AWL/STL semantics of the code that uses this symbol. This is due to source text being the first class program object in Awlsim. (In STEP 7 first class program objects are the compiled blocks.) Awlsim compiles and reinterpretes the symbol information of the plain source text on each download to the CPU. The same thing happens in STEP 7, if a source text is imported.
-
Awlsim does not compile AWL/STL to MC7 code and it cannot execute MC7 code. On startup Awlsim translates the AWL/STL code to an Awlsim specific in-memory representation of the code. There is no byte-code representation of this code.
-
Some key concepts, such as
CALL
or memory indirect addressing are implemented natively in Awlsim. This means to improve runtime performance in AwlsimCALL
is not a macro. From a user's perspective there should not be any functional difference visible inCALL
. Any such difference is a bug. However, due to these constraints, it is not possible to callFBs
orFCs
with an interface (IN/OUT/INOUT
variables) viaUC
orCC
instructions. -
Undefined behavior is not emulated. For example: If reading uninitialized L-stack space in STEP 7 always yields a certain reproducible result, that does not mean that this AWL/STL code does the same thing in Awlsim. Reading uninitialized
TEMP
-memory is undefined.
Extensions are features that Awlsim supports, but STEP 7 does not support.
-
Semicolons: AWL/STL requires semicolons (;) after each declaration, initialization and statement. As an Awlsim convenience service, terminating semicolons can be omitted in AWL/STL statements. Data declarations and initializations (in
DBs
andFB/FC
interfaces), however, must end with a semicolon. -
Awlsim supports
DATE_AND_TIME
immediate constants (for exampleDT#2012-01-02-13:37:00.000
) toFC
andFB
DATE_AND_TIME
IN
-variables. InFC
calls theDATE_AND_TIME
constant is copied toVL
memory and passed viaDB
-pointer (that is itself stored inVL
). -
Awlsim supports passing
STRING
immediate constants (for example 'Test') toFC
andFB
STRING
IN
-variables. InFC
calls theSTRING
constant is copied toVL
memory and passed viaDB
-pointer (that is itself stored inVL
). The maximum length of theSTRING
immediate is casted up to the parameter's maximum length and added characters are filled with zero-bytes. The actual length of the string does not change. -
Awlsim supports
STRING
parameters inFCs
with sizes unequal to 254 characters. Only actual-parameters with exactly the specified max-size as specified in theFC
interface are allowed in theCALL
assignment. (One exception beingSTRING
immediates. See above.) -
Awlsim supports pointer immediates to named
DB
variables. Whether a 32 bit pointer (area spanning), a 48 bitDB
pointer or a 80 bitANY
pointer is generated, depends on the context. For example:
// Load a pointer to VARIABLE with DBX area code into accu 1. // Note that the DB number information is lost (32 bit pointer). L P#DB1.VARIABLE // Pass pointer immediates as actual values in calls. // Values are passed as DB pointer or ANY pointer, according to the // parameter type. CALL FC 1 ( POINTER_VAR := P#DB1.VARIABLE, ANY_VAR := P#DB1.VARIABLE, )
However, for the pointer parameter passing in CALL
you could just write it in an S7 compatible way without the P#
prefix.