COMPATIBILITY.txt 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ===============================================================================
  2. Awlsim - STEP 7 compatibility
  3. ===============================================================================
  4. The execution of AWL/STL programs by Awlsim is supposed to be fully
  5. compatible with the execution of compiled AWL/STL programs on the real
  6. Siemens S7 CPU.
  7. However, there currently are some known differences. These are listed below.
  8. Any undocumented difference between Awlsim and STEP 7 is considered to be a
  9. bug that should be reported.
  10. - Awlsim does not implement all features of STEP 7, yet.
  11. See TODO.txt for a list of missing features.
  12. - Changing a symbol's address or data type in Awlsim does change the AWL/STL
  13. semantics of the code that uses this symbol.
  14. This is due to source text being the first class program object in Awlsim.
  15. (In STEP 7 first class program objects are the compiled blocks.)
  16. Awlsim compiles and reinterpretes the symbol information of the plain source
  17. text on each download to the CPU.
  18. The same thing happens in STEP 7, if a source text is imported.
  19. - Awlsim does not compile AWL/STL to MC7 code and it cannot execute MC7 code.
  20. On startup Awlsim translates the AWL/STL code to an Awlsim specific in-memory
  21. representation of the code. There is no byte-code representation of this
  22. code.
  23. - Some key concepts, such as CALL or memory indirect addressing are implemented
  24. natively in Awlsim. This means to improve runtime performance in Awlsim
  25. CALL is not a macro. From a user's perspective there should not be any
  26. functional difference visible in CALL. Any such difference is a bug.
  27. However, due to these constraints, it is not possible to call FBs or FCs
  28. with an interface (IN/OUT/INOUT variables) via UC or CC instructions.
  29. - Undefined behavior is not emulated.
  30. For example: If reading uninitialized L-stack space in STEP 7 always yields
  31. a certain reproducible result, that does not mean that this AWL/STL code does
  32. the same thing in Awlsim.
  33. Reading uninitialized TEMP-memory is undefined.
  34. ===============================================================================
  35. Awlsim extensions
  36. (Features that Awlsim supports, but STEP 7 does not support)
  37. ===============================================================================
  38. - Semicolons: AWL/STL requires semicolons (;) after each declaration,
  39. initialization and statement. As an Awlsim convenience service, terminating
  40. semicolons can be omitted in AWL/STL statements.
  41. Data declarations and initializations (in DBs and FB/FC interfaces), however,
  42. must end with a semicolon.
  43. - Awlsim supports DATE_AND_TIME immediate constants (for example
  44. DT#2012-01-02-13:37:00.000) to FC and FB DATE_AND_TIME IN-variables. In FC
  45. calls the DATE_AND_TIME constant is copied to VL memory and passed via
  46. DB-pointer (that is itself stored in VL).
  47. - Awlsim supports passing STRING immediate constants (for example 'Test') to
  48. FC and FB STRING IN-variables. In FC calls the STRING constant is copied to
  49. VL memory and passed via DB-pointer (that is itself stored in VL).
  50. The maximum length of the STRING immediate is casted up to the parameter's
  51. maximum length and added characters are filled with zero-bytes. The actual
  52. length of the string does not change.
  53. - Awlsim supports STRING parameters in FCs with sizes unequal to 254
  54. characters. Only actual-parameters with exactly the specified max-size as
  55. specified in the FC interface are allowed in the CALL assignment.
  56. (One exception being STRING immediates. See above.)
  57. - Awlsim supports pointer immediates to named DB variables.
  58. Whether a 32 bit pointer (area spanning), a 48 bit DB pointer or a 80 bit
  59. ANY pointer is generated, depends on the context.
  60. For example:
  61. // Load a pointer to VARIABLE with DBX area code into accu 1.
  62. // Note that the DB number information is lost (32 bit pointer).
  63. L P#DB1.VARIABLE
  64. // Pass pointer immediates as actual values in calls.
  65. // Values are passed as DB pointer or ANY pointer, according to the
  66. // parameter type.
  67. CALL FC 1 (
  68. POINTER_VAR := P#DB1.VARIABLE,
  69. ANY_VAR := P#DB1.VARIABLE,
  70. )
  71. However, for the pointer parameter passing in CALL you could just write it
  72. in an S7 compatible way without the P# prefix.