<?xml version="1.0" encoding="UTF-8"?>
<Operator xmlns="http://www.esterel-technologies.com/ns/scade/6" xmlns:ed="http://www.esterel-technologies.com/ns/scade/pragmas/editor/5" xmlns:kcg="http://www.esterel-technologies.com/ns/scade/pragmas/codegen/3" kind="function" name="TruthTableIdx">
	<sizeParameters>
		<SizeParameter name="Ncond">
			<pragmas>
				<ed:SizeParameter oid="!ed/299d/5C75/1654/58f8aeb571af"/>
			</pragmas>
		</SizeParameter>
		<SizeParameter name="Nlines">
			<pragmas>
				<ed:SizeParameter oid="!ed/299e/5C75/1654/58f8aeb56192"/>
			</pragmas>
		</SizeParameter>
	</sizeParameters>
	<inputs>
		<Variable name="Conditions">
			<type>
				<Table>
					<type>
						<NamedType>
							<type>
								<TypeRef name="bool"/>
							</type>
						</NamedType>
					</type>
					<size>
						<IdExpression>
							<path>
								<ConstVarRef name="Ncond"/>
							</path>
						</IdExpression>
					</size>
					<pragmas>
						<ed:Table oid="!ed/29a4/5C75/1654/58f8aeb5383d"/>
					</pragmas>
				</Table>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/29a3/5C75/1654/58f8aeb53988"/>
			</pragmas>
		</Variable>
		<Variable name="Ttable">
			<type>
				<Table>
					<type>
						<Table>
							<type>
								<NamedType>
									<type>
										<TypeRef name="truthTablesValues_t"/>
									</type>
								</NamedType>
							</type>
							<size>
								<IdExpression>
									<path>
										<ConstVarRef name="Ncond"/>
									</path>
								</IdExpression>
							</size>
							<pragmas>
								<ed:Table oid="!ed/29a1/5C75/1654/58f8aeb51835"/>
							</pragmas>
						</Table>
					</type>
					<size>
						<IdExpression>
							<path>
								<ConstVarRef name="Nlines"/>
							</path>
						</IdExpression>
					</size>
					<pragmas>
						<ed:Table oid="!ed/29a0/5C75/1654/58f8aeb53c16"/>
					</pragmas>
				</Table>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/299f/5C75/1654/58f8aeb543d0" hidden="true"/>
			</pragmas>
		</Variable>
	</inputs>
	<outputs>
		<Variable name="LineIdx">
			<type>
				<NamedType>
					<type>
						<TypeRef name="int16"/>
					</type>
				</NamedType>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/29a2/5C75/1654/58f8aeb5f36"/>
			</pragmas>
		</Variable>
	</outputs>
	<locals>
		<Variable name="_L1">
			<type>
				<Table>
					<type>
						<NamedType>
							<type>
								<TypeRef name="bool"/>
							</type>
						</NamedType>
					</type>
					<size>
						<IdExpression>
							<path>
								<ConstVarRef name="Ncond"/>
							</path>
						</IdExpression>
					</size>
				</Table>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/2995/5C75/1654/58f8aeb52deb"/>
			</pragmas>
		</Variable>
		<Variable name="_L2">
			<type>
				<Table>
					<type>
						<Table>
							<type>
								<NamedType>
									<type>
										<TypeRef name="truthTablesValues_t"/>
									</type>
								</NamedType>
							</type>
							<size>
								<IdExpression>
									<path>
										<ConstVarRef name="Ncond"/>
									</path>
								</IdExpression>
							</size>
						</Table>
					</type>
					<size>
						<IdExpression>
							<path>
								<ConstVarRef name="Nlines"/>
							</path>
						</IdExpression>
					</size>
				</Table>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/2996/5C75/1654/58f8aeb5568e"/>
			</pragmas>
		</Variable>
		<Variable name="_L6">
			<type>
				<NamedType>
					<type>
						<TypeRef name="int16"/>
					</type>
				</NamedType>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/2997/5C75/1654/58f8aeb53f4c"/>
			</pragmas>
		</Variable>
		<Variable name="_L8">
			<type>
				<Table>
					<type>
						<Table>
							<type>
								<NamedType>
									<type>
										<TypeRef name="bool"/>
									</type>
								</NamedType>
							</type>
							<size>
								<IdExpression>
									<path>
										<ConstVarRef name="Ncond"/>
									</path>
								</IdExpression>
							</size>
						</Table>
					</type>
					<size>
						<IdExpression>
							<path>
								<ConstVarRef name="Nlines"/>
							</path>
						</IdExpression>
					</size>
				</Table>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/2998/5C75/1654/58f8aeb533d1"/>
			</pragmas>
		</Variable>
		<Variable name="_L9">
			<type>
				<Table>
					<type>
						<Table>
							<type>
								<NamedType>
									<type>
										<TypeRef name="truthTablesValues_t"/>
									</type>
								</NamedType>
							</type>
							<size>
								<IdExpression>
									<path>
										<ConstVarRef name="Ncond"/>
									</path>
								</IdExpression>
							</size>
						</Table>
					</type>
					<size>
						<IdExpression>
							<path>
								<ConstVarRef name="Nlines"/>
							</path>
						</IdExpression>
					</size>
				</Table>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/2999/5C75/1654/58f8aeb55f7"/>
			</pragmas>
		</Variable>
		<Variable name="_L10">
			<type>
				<NamedType>
					<type>
						<TypeRef name="int16"/>
					</type>
				</NamedType>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/299a/5C75/1654/58f8aeb5c94"/>
			</pragmas>
		</Variable>
		<Variable name="_L11">
			<type>
				<NamedType>
					<type>
						<TypeRef name="int16"/>
					</type>
				</NamedType>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/299b/5C75/1654/58f8aeb51cfd"/>
			</pragmas>
		</Variable>
		<Variable name="_L12">
			<type>
				<NamedType>
					<type>
						<TypeRef name="int16"/>
					</type>
				</NamedType>
			</type>
			<pragmas>
				<ed:Variable oid="!ed/299c/5C75/1654/58f8aeb56cb3"/>
			</pragmas>
		</Variable>
	</locals>
	<data>
		<!-- _L1 = Conditions; -->
		<Equation>
			<lefts>
				<VariableRef name="_L1"/>
			</lefts>
			<right>
				<IdExpression>
					<path>
						<ConstVarRef name="Conditions"/>
					</path>
				</IdExpression>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/298b/5C75/1654/58f8aeb5387d"/>
			</pragmas>
		</Equation>
		<!-- _L2 = Ttable; -->
		<Equation>
			<lefts>
				<VariableRef name="_L2"/>
			</lefts>
			<right>
				<IdExpression>
					<path>
						<ConstVarRef name="Ttable"/>
					</path>
				</IdExpression>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/298c/5C75/1654/58f8aeb51518"/>
			</pragmas>
		</Equation>
		<!-- LineIdx = _L10; -->
		<Equation>
			<lefts>
				<VariableRef name="LineIdx"/>
			</lefts>
			<right>
				<IdExpression>
					<path>
						<ConstVarRef name="_L10"/>
					</path>
				</IdExpression>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/298d/5C75/1654/58f8aeb54ecd"/>
			</pragmas>
		</Equation>
		<!-- _L6 =  - (1 : int16); -->
		<Equation>
			<lefts>
				<VariableRef name="_L6"/>
			</lefts>
			<right>
				<!--  - (1 : int16) -->
				<UnaryOp name="1" operator="-">
					<operand>
						<!-- (1 : int16) -->
						<NumericCastOp name="1">
							<type>
								<TypeRef name="int16"/>
							</type>
							<flow>
								<ConstValue value="1"/>
							</flow>
						</NumericCastOp>
					</operand>
				</UnaryOp>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/298e/5C75/1654/58f8aeb5724d"/>
			</pragmas>
		</Equation>
		<!-- _L8 = _L1 ^ Nlines; -->
		<Equation>
			<lefts>
				<VariableRef name="_L8"/>
			</lefts>
			<right>
				<!-- _L1 ^ Nlines -->
				<ScalarToVectorOp name="1">
					<flow>
						<ListExpression>
							<items>
								<IdExpression>
									<path>
										<ConstVarRef name="_L1"/>
									</path>
								</IdExpression>
							</items>
						</ListExpression>
					</flow>
					<size>
						<IdExpression>
							<path>
								<ConstVarRef name="Nlines"/>
							</path>
						</IdExpression>
					</size>
				</ScalarToVectorOp>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/298f/5C75/1654/58f8aeb51862"/>
			</pragmas>
		</Equation>
		<!-- _L9 = reverse _L2; -->
		<Equation>
			<lefts>
				<VariableRef name="_L9"/>
			</lefts>
			<right>
				<!-- reverse _L2 -->
				<UnaryOp name="1" operator="reverse">
					<operand>
						<IdExpression>
							<path>
								<ConstVarRef name="_L2"/>
							</path>
						</IdExpression>
					</operand>
				</UnaryOp>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/2990/5C75/1654/58f8aeb52d10"/>
			</pragmas>
		</Equation>
		<!-- _L10 = _L11 - _L12; -->
		<Equation>
			<lefts>
				<VariableRef name="_L10"/>
			</lefts>
			<right>
				<!-- _L11 - _L12 -->
				<BinaryOp name="1" operator="-">
					<operands>
						<IdExpression>
							<path>
								<ConstVarRef name="_L11"/>
							</path>
						</IdExpression>
						<IdExpression>
							<path>
								<ConstVarRef name="_L12"/>
							</path>
						</IdExpression>
					</operands>
				</BinaryOp>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/2991/5C75/1654/58f8aeb57031"/>
			</pragmas>
		</Equation>
		<!-- _L11 = (Nlines : int16) - (1 : int16); -->
		<Equation>
			<lefts>
				<VariableRef name="_L11"/>
			</lefts>
			<right>
				<!-- (Nlines : int16) - (1 : int16) -->
				<BinaryOp name="2" operator="-">
					<operands>
						<!-- (Nlines : int16) -->
						<NumericCastOp name="2">
							<type>
								<TypeRef name="int16"/>
							</type>
							<flow>
								<IdExpression>
									<path>
										<ConstVarRef name="Nlines"/>
									</path>
								</IdExpression>
							</flow>
						</NumericCastOp>
						<!-- (1 : int16) -->
						<NumericCastOp name="3">
							<type>
								<TypeRef name="int16"/>
							</type>
							<flow>
								<ConstValue value="1"/>
							</flow>
						</NumericCastOp>
					</operands>
				</BinaryOp>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/2992/5C75/1654/58f8aeb52182"/>
			</pragmas>
		</Equation>
		<!-- _L12 = (foldi (TruthTableLineIdx<<Ncond>>) <<Nlines>>)(_L6, _L8, _L9); -->
		<Equation>
			<lefts>
				<VariableRef name="_L12"/>
			</lefts>
			<right>
				<!-- (foldi (TruthTableLineIdx<<Ncond>>) <<Nlines>>)(_L6, _L8, _L9) -->
				<CallExpression>
					<operator>
						<IteratorOp name="2" iterator="foldi">
							<operator>
								<OpCall name="1">
									<operator>
										<OperatorRef name="TruthTableLineIdx"/>
									</operator>
									<instanceParameters>
										<IdExpression>
											<path>
												<ConstVarRef name="Ncond"/>
											</path>
										</IdExpression>
									</instanceParameters>
								</OpCall>
							</operator>
							<size>
								<IdExpression>
									<path>
										<ConstVarRef name="Nlines"/>
									</path>
								</IdExpression>
							</size>
						</IteratorOp>
					</operator>
					<callParameters>
						<IdExpression>
							<path>
								<ConstVarRef name="_L6"/>
							</path>
						</IdExpression>
						<IdExpression>
							<path>
								<ConstVarRef name="_L8"/>
							</path>
						</IdExpression>
						<IdExpression>
							<path>
								<ConstVarRef name="_L9"/>
							</path>
						</IdExpression>
					</callParameters>
				</CallExpression>
			</right>
			<pragmas>
				<ed:Equation oid="!ed/2993/5C75/1654/58f8aeb562e6"/>
			</pragmas>
		</Equation>
	</data>
	<pragmas>
		<ed:Operator oid="!ed/298a/5C75/1654/58f8aeb5617" xmlns="http://www.esterel-technologies.com/ns/scade/pragmas/editor/5">
			<comment>Implements a truth table. Outputs the index</comment>
			<comment>of the first line of Ttable of Nlines lines that matches Conditions.</comment>
			<comment>Index Nlines is produced when no line matches.</comment>
			<comment>Element 'T' from Ttable matches true, 'F' matches false, 'X' matches both.</comment>
			<diagrams>
				<NetDiagram name="diagram_TruthTableIdx" landscape="true" format="A4 (210 297)" oid="!ed/2994/5C75/1654/58f8aeb5e61">
					<presentationElements>
						<EquationGE presentable="!ed/298b/5C75/1654/58f8aeb5387d">
							<position>
								<Point x="2420" y="4022"/>
							</position>
							<size>
								<Size width="251" height="502"/>
							</size>
						</EquationGE>
						<EquationGE presentable="!ed/298c/5C75/1654/58f8aeb51518">
							<position>
								<Point x="2473" y="5106"/>
							</position>
							<size>
								<Size width="251" height="503"/>
							</size>
						</EquationGE>
						<EquationGE presentable="!ed/298d/5C75/1654/58f8aeb54ecd">
							<position>
								<Point x="18203" y="3366"/>
							</position>
							<size>
								<Size width="326" height="503"/>
							</size>
						</EquationGE>
						<EquationGE kind="OBJ_LIT" presentable="!ed/298e/5C75/1654/58f8aeb5724d">
							<position>
								<Point x="5292" y="3043"/>
							</position>
							<size>
								<Size width="53" height="264"/>
							</size>
						</EquationGE>
						<EquationGE presentable="!ed/298f/5C75/1654/58f8aeb51862">
							<position>
								<Point x="4305" y="3881"/>
							</position>
							<size>
								<Size width="1259" height="810"/>
							</size>
						</EquationGE>
						<Edge leftVarIndex="1" rightExprIndex="1" srcEquation="!ed/298b/5C75/1654/58f8aeb5387d" dstEquation="!ed/298f/5C75/1654/58f8aeb51862">
							<positions>
								<Point x="2667" y="4276"/>
								<Point x="4318" y="4276"/>
								<Point x="4297" y="4276"/>
								<Point x="4297" y="4276"/>
							</positions>
						</Edge>
						<EquationGE presentable="!ed/2990/5C75/1654/58f8aeb52d10">
							<position>
								<Point x="4331" y="4913"/>
							</position>
							<size>
								<Size width="1233" height="889"/>
							</size>
						</EquationGE>
						<Edge leftVarIndex="1" rightExprIndex="1" srcEquation="!ed/298c/5C75/1654/58f8aeb51518" dstEquation="!ed/2990/5C75/1654/58f8aeb52d10">
							<positions>
								<Point x="2731" y="5355"/>
								<Point x="4339" y="5355"/>
								<Point x="4339" y="5376"/>
								<Point x="4339" y="5355"/>
							</positions>
						</Edge>
						<EquationGE presentable="!ed/2991/5C75/1654/58f8aeb57031">
							<position>
								<Point x="15896" y="3281"/>
							</position>
							<size>
								<Size width="1022" height="677"/>
							</size>
						</EquationGE>
						<Edge leftVarIndex="1" rightExprIndex="1" srcEquation="!ed/2991/5C75/1654/58f8aeb57031" dstEquation="!ed/298d/5C75/1654/58f8aeb54ecd">
							<positions>
								<Point x="16912" y="3620"/>
								<Point x="17209" y="3620"/>
								<Point x="17209" y="3620"/>
								<Point x="18246" y="3620"/>
							</positions>
						</Edge>
						<EquationGE kind="OBJ_LIT" presentable="!ed/2992/5C75/1654/58f8aeb52182">
							<position>
								<Point x="15050" y="2752"/>
							</position>
							<size>
								<Size width="170" height="317"/>
							</size>
						</EquationGE>
						<Edge leftVarIndex="1" rightExprIndex="1" srcEquation="!ed/2992/5C75/1654/58f8aeb52182" dstEquation="!ed/2991/5C75/1654/58f8aeb57031">
							<positions>
								<Point x="15219" y="2921"/>
								<Point x="15558" y="2921"/>
								<Point x="15558" y="3514"/>
								<Point x="15896" y="3514"/>
							</positions>
						</Edge>
						<EquationGE presentable="!ed/2993/5C75/1654/58f8aeb562e6">
							<position>
								<Point x="6580" y="1024"/>
							</position>
							<size>
								<Size width="5070" height="5440"/>
							</size>
						</EquationGE>
						<Edge leftVarIndex="1" rightExprIndex="3" srcEquation="!ed/2990/5C75/1654/58f8aeb52d10" dstEquation="!ed/2993/5C75/1654/58f8aeb562e6">
							<positions>
								<Point x="5567" y="5355"/>
								<Point x="6244" y="5355"/>
								<Point x="6244" y="5355"/>
								<Point x="6583" y="5355"/>
							</positions>
						</Edge>
						<Edge leftVarIndex="1" rightExprIndex="2" srcEquation="!ed/298f/5C75/1654/58f8aeb51862" dstEquation="!ed/2993/5C75/1654/58f8aeb562e6">
							<positions>
								<Point x="5567" y="4297"/>
								<Point x="6244" y="4297"/>
								<Point x="6244" y="4297"/>
								<Point x="6583" y="4297"/>
							</positions>
						</Edge>
						<Edge leftVarIndex="1" rightExprIndex="1" srcEquation="!ed/298e/5C75/1654/58f8aeb5724d" dstEquation="!ed/2993/5C75/1654/58f8aeb562e6">
							<positions>
								<Point x="5355" y="3196"/>
								<Point x="6244" y="3196"/>
								<Point x="6244" y="3196"/>
								<Point x="6583" y="3196"/>
							</positions>
						</Edge>
						<Edge leftVarIndex="1" rightExprIndex="2" srcEquation="!ed/2993/5C75/1654/58f8aeb562e6" dstEquation="!ed/2991/5C75/1654/58f8aeb57031">
							<positions>
								<Point x="11642" y="3747"/>
								<Point x="12996" y="3747"/>
								<Point x="12996" y="3747"/>
								<Point x="15896" y="3747"/>
							</positions>
						</Edge>
					</presentationElements>
				</NetDiagram>
			</diagrams>
		</ed:Operator>
	</pragmas>
</Operator>
