Embedded Software

Embedded Software

Topics related to SCADE Suite, SCADE Display, SCADE One and more.

How to use `$@$` as input operator of iterator(e.g. map)?

    • fdtsaid
      Subscriber

      Some predefined operator can be used as input operator of iterator. Such as the following example 
       

      function test(a,b: int8 ^ 3) returns (c: int8 ^ 3)
        c = (map $+$ << 3 >>) (a, b); 
       
      But I am trying to figure out how to use $@$ as input operator correctly. In the following program:  
       
      function mapOp(arr1,arr2: int8 ^ 2 ^ 3) returns (oarr: int8 ^ 4 ^ 3)
      let
        oarr = (map $@$ <<3>>) (arr1,arr2);
      tel 
       
      The intention of the above program is to concatenate each element of type int8^2 in arr1 and arr2 to value of type int8^4. But I got the following error:
      Prefix operator $@$ expects 2 size parameters but is here used with 0
       
      How to use $@$ as input operator of iterator in a correct way? 
    • Benjamin Descorps
      Ansys Employee

      Hello,

      It is not possible to use directly the concatenation operator through an iterator. But you can through an intermediate operator. Here is the piece of code that should match your need:

      function mapOp(arr1,arr2: int8 ^ 2 ^ 3) returns (oarr: int8 ^ 4 ^ 3)
            oarr = (map Op <<3>>)(arr1, arr2);
       
      function #pragma kcg expand #end Op(i1, i2 : int8 ^2) returns (o : int8 ^4)
            o = i1 @ i2;
       
      Hope this helps,
       
      Benjamin
    • fdtsaid
      Subscriber

      The solution is very inspired, thank you!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.