diff options
| -rw-r--r-- | examples/sum.th | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/sum.th b/examples/sum.th new file mode 100644 index 0000000..dd79876 --- /dev/null +++ b/examples/sum.th @@ -0,0 +1,15 @@ +and = 0; +xor = 1; +bits = 4; +a = [bits]node(xor, 0); +b = [bits]node(xor, 1); +c = node(and) <- node(xor, 2); +out = [bits+1]node(xor); +p = [bits]node(xor) <- a <- b; +g = [bits]node(and) <- a <- b; +out[0:bits] <- ([bits]node(and) <- p); +foreach (out) { + @ <- (node(and) <- p[0:@0] <- c); + for (i = 0; i < @0; ++i) + @ <- (node(and) <- p[i+1:@0] <- g[i]); +} |