AT vars in PROGRAM

This test case it part of the test suite proposed for new devices.

Test case ID: R0007
Language: ST

Code:
tests2/t0007.st
(* checks that AT vars are read/written and properly shared *)
(* this requires a DRV implementation that works in memory *)  
 
PROGRAM T0007  
    VAR
     B : BOOL;
     X : INT;
     M8 AT %MW63.8 : INT; 
     M9 AT %MW63.9 : INT;
     X8 AT %QW62.8 : INT; 
     I3 AT %MX66.3 : BOOL; 
     I8 AT %IW61.1 : INT; 
      
     // I4 AT %MX10.2.3.1 : BOOL; // invalid address, would give error at code generation time 
     fb1 : FB1_T0007;
    END_VAR
    VAR_EXTERNAL 
        _T_PARAMS : TEST_PARAMS;
    END_VAR

    X8 := I8 + 1;
   // I8 := 3; // error I8 is read only
    M9 := M9 + 2;
    M9 := ADD_INT(M9,-1);
    fb1( in:= 20); //  m8 = 21
    M8 := M8 + 30;  //  M8 = 51
    X8 := 2 + M8;   //     X8 = 53
    I3 := NOT(I3);
    (* X := X8; *) (* this fails : output var should not be read *)


  IF _T_PARAMS.cycle = _T_PARAMS.timestorun THEN  // last iter
      _GEB_ASSERT_( M8 = 51);
      _GEB_ASSERT_( M9 = 12);
      _GEB_ASSERT_( X8 = 53);
      _GEB_ASSERT_( I3 = 1);
//    _GEB_MSG_('last iter');      
  END_IF;
END_PROGRAM

FUNCTION_BLOCK FB1_T0007
  VAR_INPUT  
    in:INT;
  END_VAR
  VAR_OUTPUT  
    out:INT;
  END_VAR  
  VAR
     I2 AT %MW63.8 : INT;
     AT %MW63.9 : INT; // anonymous AT now supported
  END_VAR
  I2 := in + 1;
  %MW63.9 := %MW63.9 +3 ; 
END_FUNCTION_BLOCK