diff options
Diffstat (limited to 'sample/process_networks')
| -rw-r--r-- | sample/process_networks/processnet1.in | 22 | ||||
| -rw-r--r-- | sample/process_networks/processnet_fib.in | 30 |
2 files changed, 52 insertions, 0 deletions
diff --git a/sample/process_networks/processnet1.in b/sample/process_networks/processnet1.in new file mode 100644 index 0000000..c648650 --- /dev/null +++ b/sample/process_networks/processnet1.in @@ -0,0 +1,22 @@ +// Rules +dup(a1,a2) >< (int i):xs => a1~(i:xs1), a2~(i:xs2), dup(xs1,xs2)~xs; +dup(a1,a2) >< [] => a1~[], a2~[]; + +inc(r) >< (int i):xs => r~(i+1):w, inc(w)~xs; +inc(r) >< [] => r~[]; + + +// Nets +dup(r,w)~r1, inc(r1) ~ (0:w); + +// r,w << dup(r1), r1 << inc(0:w) + +// +-----+ +-----+ +---+ +// r ----| | r1 | | | | +// | dup |--->---| inc |---><---| 0 |----+ +// +---| | | | | | | +// | +-----+ +-----+ +---+ | +// | | +// +-----------------------------------------+ +// w +
\ No newline at end of file diff --git a/sample/process_networks/processnet_fib.in b/sample/process_networks/processnet_fib.in new file mode 100644 index 0000000..ab19eec --- /dev/null +++ b/sample/process_networks/processnet_fib.in @@ -0,0 +1,30 @@ +// Rules +dup(a1,a2) >< (int i):xs => a1~(i:xs1), a2~(i:xs2), dup(xs1,xs2)~xs; +dup(a1,a2) >< [] => a1~[], a2~[]; + +add(r, ys) >< (int i):xs => addn(r, xs, i)~ys; +addn(r, xs, int i) >< (int j):ys => r~(i+j):w, add(w,ys)~xs; + + +// Nets +dup(r, r1)~(1:xs), r1~add(sum, w), dup(xs, w)~(1:sum); + +// r,r1 << dup(1:xs), +// xs,w << dup(1:sum), +// sum << add(r1,w); + +// +-----+ +---+ +// r ----| | | | xs +-----+ +---+ +// | dup |---><---| 1 |-----| | | | +// +---| | | | | dup |---><---| 1 |----+ +// | +-----+ +---+ +--| | | | | +// | | +-----+ +---+ | sum +// | | | +// | | +-----+ +// | | | add | +// | | +-----+ +// | | w | | +// | +------------------------+ v +// | r1 | +// +------------------------------------------------------+ +// |
