diff options
| author | Nakidai <nakidai@disroot.org> | 2026-04-22 16:11:33 +0300 |
|---|---|---|
| committer | Nakidai <nakidai@disroot.org> | 2026-04-22 16:11:33 +0300 |
| commit | 0f84b003914e2d9f14ef787c6e45db4fdc0a9929 (patch) | |
| tree | 5447065ea465fa4911713db1ad5ee0d37fa6290f | |
| parent | 956b50a00167ed073375e0213e022ea0fb177309 (diff) | |
| download | thac-0f84b003914e2d9f14ef787c6e45db4fdc0a9929.tar.gz thac-0f84b003914e2d9f14ef787c6e45db4fdc0a9929.zip | |
| -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]); +} |