{"id":20901552,"url":"https://github.com/rtfb/tt09-collatz-rev1","last_synced_at":"2026-05-27T18:31:38.170Z","repository":{"id":260896705,"uuid":"862799782","full_name":"rtfb/tt09-collatz-rev1","owner":"rtfb","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-03T14:11:17.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-12T21:36:17.510Z","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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-25T07:59:01.000Z","updated_at":"2024-11-03T14:11:20.000Z","dependencies_parsed_at":"2025-03-12T20:45:01.228Z","dependency_job_id":null,"html_url":"https://github.com/rtfb/tt09-collatz-rev1","commit_stats":null,"previous_names":["rtfb/tt09-collatz-rev1"],"tags_count":0,"template":false,"template_full_name":"TinyTapeout/tt09-verilog-template","purl":"pkg:github/rtfb/tt09-collatz-rev1","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt09-collatz-rev1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt09-collatz-rev1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt09-collatz-rev1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt09-collatz-rev1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rtfb","download_url":"https://codeload.github.com/rtfb/tt09-collatz-rev1/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rtfb%2Ftt09-collatz-rev1/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33579665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-27T02:00:06.184Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-18T11:35:57.409Z","updated_at":"2026-05-27T18:31:38.153Z","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) ![](../../workflows/fpga/badge.svg)\n\n# Collatz conjecture brute-forcer, revision 1\n\nThis is a revised tapeout of [tt05-collatz][6]. It contains a few design fixes\ndiscovered while testing the original:\n\n* Fix for `compute_busy` pin: keep the pin firmly pulled down after computations\n  are done.\n* Reset `orbit_len` register when starting computations on a new input. This\n  allows feeding the ASIC a new input without cycling through reset.\n* Reset iterator register: similarly to `orbit_len`, reset the iterator register\n  as well. This does not affect functionality when all the bytes of input are\n  transmitted (including the zero bytes), but from the software perspective,\n  it's more intuitive to skip the zero bytes, and it's easy to accommodate that.\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\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://tinytapeout.com/discord)\n- [Build your design locally](https://www.tinytapeout.com/guides/local-hardening/)\n\n### What next?\n\n- [Submit your design to the next shuttle](https://app.tinytapeout.com/).\n- Edit [this README](README.md) and explain your design, how it works, and how to test it.\n- Share your project on your social network of choice:\n  - LinkedIn [#tinytapeout](https://www.linkedin.com/search/results/content/?keywords=%23tinytapeout) [@TinyTapeout](https://www.linkedin.com/company/100708654/)\n  - Mastodon [#tinytapeout](https://chaos.social/tags/tinytapeout) [@matthewvenn](https://chaos.social/@matthewvenn)\n  - Twitter [#tinytapeout](https://twitter.com/hashtag/tinytapeout) [@tinytapeout](https://twitter.com/tinytapeout)\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/tt09-collatz-rev1/blob/main/test/test.py#L291\n[4]: https://github.com/rtfb/tt09-collatz-rev1/blob/main/test/test.py#L306\n[5]: https://github.com/rtfb/tt09-collatz-rev1/blob/main/test/test.py#L312\n[6]: https://github.com/rtfb/tt05-collatz\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfb%2Ftt09-collatz-rev1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frtfb%2Ftt09-collatz-rev1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frtfb%2Ftt09-collatz-rev1/lists"}