sourcelibs/Datapath/demos/pipeline.xtl
1⍝!/usr/bin/env xetal
2⍝ The acceptance pipeline: multiply, add, select, reduce, as one
3⍝ expression on eight 16-bit numbers: the sum of the positive items
4⍝ of x + x * k. Run with "just demo-lib Datapath pipeline".
5ᵈᵖ⁼u̲se< "Datapath"
6x ← 1 2 3 4 5 6 7 8
7k ← 1 -1 1 -1 1 -1 1 -1
8x + x × k ⍝ the elementwise part
9ᵈᵖr̲elu x + x × k ⍝ after the select
10ᵘp̲ipeline ← ᵈᵖp̲ipeline 16
11x ᵘp̲ipeline k ⍝ the reduce