Version 1.13 – released on October 2, 2015

This release introduces the possibility of process introspection at run-time: it is now possible to query the pid, period, offset, activation time of the current and previous instance of any process at run-time. It also correct some regressions on the Win32 version of the CPAL-Editor and improve the consistency amongst platforms by the use of the same embedded browser.

If you experience issues that are not listed here, or simply need help with CPAL, you are much welcome to contact us.

What is new

  • Added measurement-based Worst-Case Execution Time (WCET) analyzer for CPAL code
  • Added process instrospection at run-time (#70)

    
    /* Introspection can serve to implement adaptive behaviours, 
    such as algorithms that depend on the rate of execution 
    or the execution jitter of the process */
    
    processdef aProcess()
    {
      state Main {
        println("pid %u", self.pid);
        println("period %t",self.period);
        println("offset %t",self.offset);
        println("curr %t",self.current_activation);
        println("last %t",self.previous_activation);
        if (self.current_activation > 0ms) {
          assert((self.current_activation-self.previous_activation) == self.period);
        }
      }
    }
    
    process aProcess: p1[100ms]();
    
  • Added functions to re-interpret a memory area storing a variable x into another type, x in the following can be of an arbitrary type: uint8.cast(x), uint16.cast(x), uint32.cast(x), uint64.cast(x), int8.cast(x), int16.cast(x), int32.cast(x), int64.cast(x), time64.cast(x), bool.cast(x) (#197) Warning: binary re-interpretation is different from conversion between types available through type.as(x)

    
    init() {
      assert(uint8.cast(time64.FIRST) == 0);
      assert(int32.cast(uint64.FIRST) == 0);
      assert(time64.cast(true)  == 1ps);
      assert(time64.cast(false) == 0ps);
      assert(bool.cast(0) == false);
      assert(bool.cast(int64.LAST)  == true);
      println("assert() successfully executed");
    }
    
  • Added modulo between time64 and (u)intX (#222)

    
    processdef UnderTest()
    {
      state Main {
        /* 
    	This assert will fail in real-time mode if other processes 
    	delay the activation of this one. Activation is the first time
    	when the process instance obtains the CPU. 
    	*/ 
        assert((self.current_activation mod self.period) == 0ms);
        println("before sleep: %t", self.current_activation mod 13ms);
        sleep(2ms);
        println("after sleep: %t", time() mod 111us);
      }
    }
    
    process UnderTest: mainTask[10ms]();
    
  • [CPAL-editor] New: use XULRunner as embedded browser on all desktop platforms (#227)
  • Added help command in the interpreter when running in interactive mode (#229)
  • Added float32.min(a,b) and float32.max(a,b) functions (#247)

What has been fixed or improved

  • Fixed: tasks2tsv crashes on Win32 when loading file which does not parse (#208)
  • Fixed: Parser does not know how to deal with enumerations having same enumerators (#221). Enumerators can now be prefixed by the enum name

    
    enum aFirstEnum {red, blue, yellow};
    enum aSecondEnum {red, green, black};
    
    init() {
      var aFirstEnum: i = aFirstEnum.red;
      var aSecondEnum: j = aSecondEnum.red;
      println("%u %u",i,j);
    }
    
  • Added ‘%b’format specifier to print booleans (#226)
  • Fixed: step command in interactive mode of the interpreter (#228)
  • Fixed: time() function on Windows platforms (#236)
  • Added ‘%c’ format specifier to print an (u)intX as a character (#245)
  • Added ‘%x’ format specifier to print an (u)intX in hexadecimal (#246)
  • Improved: assert messages now report filename and line number which is convenient for included files (#247)

Code metrics and overhead data

  • Test code coverage for the execution engine: 88.8% (loc), 93.2% (functions)
  • Tests: parser=3594, interpreter=670, embedded targets=236
  • Timing overhead (Cortex M4 at 120MHz with floating point unit): timer interrupt = 0.6us, scheduler overhead at process activation = 1.6us + n x 4.6 us where n is the number of active processes, process switching time = 2us