AnnexF/delay_st.txt
author Catarina Boucinha <ccb@fe.up.pt>
Thu, 02 Jul 2009 11:26:25 +0100
changeset 201 e657008f43d0
parent 0 fb772792efd1
permissions -rwxr-xr-x
Introducing the search_il_operand_type files in the absyntax_utils folder.
The Makefile from absyntax_utils folder and the generate_c_il.cc from the stage4/generate_c
folder was also modified to work with the new search_il_operand_type file.
FUNCTION_BLOCK DELAY    (* N-sample delay *)
  VAR_INPUT
    RUN : BOOL ;     (* 1 = run, 0 = reset *)
    XIN : REAL ;
    N   : INT        (* 0 <= N < 128 or manufacturer- *)
  END_VAR            (*      specified maximum value  *)
  VAR_OUTPUT XOUT : REAL; END_VAR   (* Delayed output *)
  VAR X : ARRAY [0..127]     (* N-Element queue *)
               OF REAL;      (* with FIFO discipline *)
      I, IXIN, IXOUT : INT := 0;
  END_VAR
  IF RUN THEN IXIN := MOD(IXIN + 1, 128) ; X[IXIN] := XIN ;
              IXOUT := MOD(IXOUT + 1, 128) ; XOUT := X[IXOUT];
  ELSE XOUT := XIN ; IXIN := N ; IXOUT := 0;
       FOR I := 0 TO N DO X[I] := XIN; END_FOR;
  END_IF ;
END_FUNCTION_BLOCK