Programmer Guide/SPU Reference/SELECTAB: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====SELECTAB - 2 channel multiplexer====
Two channel multiplexer.
 
==<code>[SPU SELECTAB <var>A B SEL</var> OUT <var>Y</var>]</code>==
=====Usage:=====
{|class="einrahmen"
 
!input !!description !!data type !!value type!!default value
<code>SELECTAB <var>A B SEL</var></code>
 
=====Inputs:=====
 
{|
|-
|-
|<var>A, B</var>
|<var>A, B</var>||input data ||number, vector ||variable
|data input <var>A</var> and <var>B</var> (number or vector, see I/O configuration table)
|-
|-
|<var>SEL</var>
|<var>SEL</var>||select switch ||number (int.), string||variable ||<code>0</code>
|selection and/or condition
|}
 
=====Outputs:=====
 
{|
|-
|-
|<var>Y</var>
!output !!description !!data type !!value type!!comment
|output for selected data input (same type as <var>A</var>)
|}
 
=====Function:=====
 
This atom implements a direct or conditional 2-channel multiplexer controlled via the input <var>SEL</var>. The input <var>SEL</var> is checked at the beginning of each evaluation cycle.
 
Table 23: Multiplexer method selected by input <var>SEL</var>
 
{|
|-
|value of SEL
|value copied to Y
|-
|0 or A
|input A is copied to output Y
|-
|1 or B
|input B is copied to output Y
|-
|2 or MINIMUM
|Min(A, B) is copied to Yfor vectors, the operation is applied element by element!
|-
|-
|3 or MAXIMUM
|<var>Y</var>||selected data ||same type as <var>A</var> ||variable
|Max(A, B) is copied to Yfor vectors, the operation is applied element by element!
|}
|}


Table 24: Possible I/O configurations:
;Description:
 
{|class="einrahmen"
{|
!SEL
! <var>Y<sub>number</sub></var>=f(<var>A<sub>number</sub></var>,<var>B<sub>number</sub></var>)
! <var>Y<sub>vector</sub></var>=f(<var>A<sub>vector</sub></var>,<var>B<sub>number</sub></var>)
! <var>Y<sub>number</sub></var>=f(<var>A<sub>vector</sub></var>,<var>B<sub>vector</sub></var>)
|-
|-
|type of input A
|<code>0</code> or <code>A</code>
|type of input B
|<var>Y</var> = <var>A</var>
|type of output Y
|<var>Y</var>[i] = <var>A</var>[i]
|assignment
|<var>Y</var>[i] = <var>A</var>[i]
|-
|-
|Number
|<code>1</code> or <code>B</code>
|number
|<var>Y</var> = <var>B</var>
|number
|<var>Y</var>[i] = <var>B</var>
|Y is set to A or B
|<var>Y</var>[i] = <var>B</var>[i]
|-
|-
|Vector
|<code>2</code> or <code>minimum</code>
|number
|<var>Y</var> = min(<var>A</var>,<var>B</var>)
|vector
|<var>Y</var>[i] = min(<var>A</var>[i],<var>B</var>)
|Y[i] is set to A[i] or B
|<var>Y</var>[i] = min(<var>A</var>[i],<var>B</var>[i])
|-
|-
|vector
|<code>3</code> or <code>maximum</code>
|vector
|<var>Y</var> = max(<var>A</var>,<var>B</var>)
|vector
|<var>Y</var>[i] = max(<var>A</var>[i],<var>B</var>)
|Y[i] is set to A[i] or B[i]
|<var>Y</var>[i] = max(<var>A</var>[i],<var>B</var>[i])
|}
|}
with: 0 &le; i &lt; length of <var>A<sub>vector</sub></var>
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->

Latest revision as of 13:59, 6 May 2011

Two channel multiplexer.

[SPU SELECTAB A B SEL OUT Y]

input description data type value type default value
A, B input data number, vector variable
SEL select switch number (int.), string variable 0
output description data type value type comment
Y selected data same type as A variable
Description
SEL Ynumber=f(Anumber,Bnumber) Yvector=f(Avector,Bnumber) Ynumber=f(Avector,Bvector)
0 or A Y = A Y[i] = A[i] Y[i] = A[i]
1 or B Y = B Y[i] = B Y[i] = B[i]
2 or minimum Y = min(A,B) Y[i] = min(A[i],B) Y[i] = min(A[i],B[i])
3 or maximum Y = max(A,B) Y[i] = max(A[i],B) Y[i] = max(A[i],B[i])

with: 0 ≤ i < length of Avector

See also

<SP-atoms>

Navigation menu

Personal tools