{"id":16829698,"url":"https://github.com/rtfb/tt05-collatz","last_synced_at":"2025-03-17T20:46:20.422Z","repository":{"id":196796778,"uuid":"697144236","full_name":"rtfb/tt05-collatz","owner":"rtfb","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-02T13:58:21.000Z","size":39,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-24T07:44:32.232Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rtfb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-27T06:33:26.000Z","updated_at":"2024-10-02T13:58:15.000Z","dependencies_parsed_at":"2023-10-03T13:38:16.041Z","dependency_job_id":"944730de-c66b-411a-887f-69dc5d8872ce","html_url":"https://github.com/rtfb/tt05-collatz","commit_stats":null,"previous_names":["rtfb/tt05-collatz"],"tags_count":0,"template":false,"template_full_name":"TinyTapeout/tt05-submission-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt05-collatz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt05-collatz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt05-collatz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt05-collatz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtfb","download_url":"https://codeload.github.com/rtfb/tt05-collatz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244110086,"owners_count":20399561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T11:35:13.051Z","updated_at":"2025-03-17T20:46:20.388Z","avatar_url":"https://github.com/rtfb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](../../workflows/gds/badge.svg) ![](../../workflows/docs/badge.svg) ![](../../workflows/test/badge.svg)\n\n# Collatz conjecture brute-forcer\n\nA hardware implementation of a brute-force checker for [Collatz conjecture][1].\nIt takes an integer number as an input and computes the Collatz sequence until\nit reaches 1. When it does, it allows reading back two numbers:\n1) The orbit length (i.e. the number of steps it took to reach 1)\n2) The highest recorded value of the upper 16 bits of the 144-bit internal iterator\n\nThe latter number is an indicator for good candidates for computing [path\nrecords][2]. The non-zero upper bits indicate that the highest iterator value\n`Mx(N)` is in the range of the previous path records and should be recomputed in\nthe full offline. (Holding on to the entire 144 bits of `Mx(N)` number would be\nmore obvious, but this almost doubles the footprint of the design, hence, this\noptimisation).\n\n## Using the chip\n\n(See [drivers README][6] for scripts that can utilize the chip).\n\nThe module can be in 2 states: IO and COMPUTE. After reset, the chip will be in\nIO mode. Since the input is intended to be much larger than the available pins,\nthe input number is uploaded one byte at a time, increasing the address of where\nin the internal 144-bit-wide register that byte should be stored.\n\nSame for reading the output, except that the output numbers are limited to\n16-bits each, so it takes much fewer operations to read them.\n\n### I/O pins should be used as follows:\n\n`ui_in`: an input byte when uploading an input number.\n\n`uo_out`: an output byte when downloading one of the results.\n\nBidirectional pins are mode-dependant.\n\nWhen in COMPUTE mode, `uio_out[7]` indicates whether the compute module is busy.\nWhen it becomes 0, the module will switch to the I/O mode, allowing to read\noutput and set a new input. All other bits are meaningless in this mode.\n\nWhen in IO mode, the pins act as follows:\n| PIN           | Description                                                |\n| ------------- | ---------------------------------------------------------- |\n| `uio_in[7]`   | pulse a 1 to write `ui_in` to the address in `uio_in[4:0]` |\n| `uio_in[6]`   | pulse a 1 to switch to COMPUTE mode                        |\n| `uio_in[5]`   | set to 0 to read orbit length, set to 1 to read the `Mx(N)` upper bits |\n| `uio_in[4:0]` | set to the address to write to or read from                |\n\nSee [`set_input()`][3], [`done_computing()`][4] and [`read_n_byte_num()`][5]\ntest functions for an example of using this I/O protocol.\n\n## What is Tiny Tapeout?\n\nTinyTapeout is an educational project that aims to make it easier and cheaper\nthan ever to get your digital designs manufactured on a real chip.\n\nTo learn more and get started, visit https://tinytapeout.com.\n\n### Resources\n\n- [FAQ](https://tinytapeout.com/faq/)\n- [Digital design lessons](https://tinytapeout.com/digital_design/)\n- [Learn how semiconductors work](https://tinytapeout.com/siliwiz/)\n- [Join the community](https://discord.gg/rPK2nSjxy8)\n\n### What next?\n\n- Submit your design to the next shuttle [on the website](https://tinytapeout.com/#submit-your-design). The closing date is **November 4th**.\n- Edit this [README](README.md) and explain your design, how it works, and how to test it.\n- Share your GDS on your social network of choice, tagging it #tinytapeout and linking Matt's profile:\n  - LinkedIn [#tinytapeout](https://www.linkedin.com/search/results/content/?keywords=%23tinytapeout) [matt-venn](https://www.linkedin.com/in/matt-venn/)\n  - Mastodon [#tinytapeout](https://chaos.social/tags/tinytapeout) [@matthewvenn](https://chaos.social/@matthewvenn)\n  - Twitter [#tinytapeout](https://twitter.com/hashtag/tinytapeout?src=hashtag_click) [@matthewvenn](https://twitter.com/matthewvenn)\n\n[1]: https://en.wikipedia.org/wiki/Collatz_conjecture\n[2]: http://www.ericr.nl/wondrous/pathrecs.html\n[3]: https://github.com/rtfb/tt05-collatz/blob/main/src/test.py#L191\n[4]: https://github.com/rtfb/tt05-collatz/blob/main/src/test.py#L206\n[5]: https://github.com/rtfb/tt05-collatz/blob/main/src/test.py#L212\n[6]: https://github.com/rtfb/tt05-collatz/blob/main/drivers/micropython/README.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfb%2Ftt05-collatz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtfb%2Ftt05-collatz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfb%2Ftt05-collatz/lists"}