#!/usr/bin/env ruby buffer = STDOUT def task2fsp(name, min, max) <<-FSP #{name}(MIN=#{min},MAX=#{max}) = #{name}_INIT, #{name}_INIT = (tick -> #{name}_INIT | evt_#{name}_start -> #{name}[0]), #{name}[i:0..MAX] = ( when (i #{name}[i+1] |when (i>=MIN & i #{name}[i+1] |when (i>=MIN) evt_#{name}_end -> #{name}_END), #{name}_END = (tick -> #{name}_END). FSP end puts task2fsp("A", 2, 3) puts puts task2fsp("B", 5, 6) puts puts task2fsp("C", 1, 1) # A(MIN=2,MAX=3) = A_INIT, # A_INIT = (tick -> A_INIT | evt_A_start -> A[0]), # A[i:0..MAX] = ( # when (i A[i+1] # |when (i>=MIN & i A[i+1] # |when (i>=MIN) evt_A_end -> A_END), # A_END = (tick -> A_END). # # C(MIN=1,MAX=1) = C_INIT, # C_INIT = (tick -> C_INIT | evt_C_start -> C[0]), # C[i:0..MAX] = ( # when (i C[i+1] # |when (i>=MIN & i C[i+1] # |when (i>=MIN) evt_C_end -> C_END), # C_END = (tick -> C_END). # # B(MIN=5,MAX=6) = B_INIT, # B_INIT = (tick -> B_INIT | evt_B_start -> B[0]), # B[i:0..MAX] = ( # when (i B[i+1] # |when (i>=MIN & i B[i+1] # |when (i>=MIN) evt_B_end -> B_END), # B_END = (tick -> B_END). # # AC_SEQ = (tick->AC_SEQ | evt_A_end -> evt_C_start -> AC_SEQ_END), # AC_SEQ_END = (tick -> AC_SEQ_END). # # STARTING = (evt_A_start -> evt_B_start -> END). # # deterministic ||MAIN = (STARTING || A || B || C || AC_SEQ)\{tick}.