{"id":17188989,"url":"https://github.com/proppy/tinytapeout-xls-test","last_synced_at":"2025-09-12T10:34:50.346Z","repository":{"id":58417104,"uuid":"530908253","full_name":"proppy/tinytapeout-xls-test","owner":"proppy","description":null,"archived":false,"fork":false,"pushed_at":"2022-09-23T00:26:32.000Z","size":630,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T05:13:24.575Z","etag":null,"topics":["tinytapeout"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/proppy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"custom":["https://zerotoasiccourse.com"]}},"created_at":"2022-08-31T02:30:38.000Z","updated_at":"2022-09-01T18:50:36.000Z","dependencies_parsed_at":"2023-01-18T17:36:25.966Z","dependency_job_id":null,"html_url":"https://github.com/proppy/tinytapeout-xls-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":"mattvenn/wokwi-verilog-gds-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proppy%2Ftinytapeout-xls-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proppy%2Ftinytapeout-xls-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proppy%2Ftinytapeout-xls-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proppy%2Ftinytapeout-xls-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proppy","download_url":"https://codeload.github.com/proppy/tinytapeout-xls-test/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245401398,"owners_count":20609167,"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":["tinytapeout"],"created_at":"2024-10-15T01:10:29.272Z","updated_at":"2025-03-25T04:53:01.906Z","avatar_url":"https://github.com/proppy.png","language":"Jupyter Notebook","funding_links":["https://zerotoasiccourse.com"],"categories":[],"sub_categories":[],"readme":"![](../../workflows/wokwi/badge.svg)\n\n# XLS template for TinyTapeout\n\nTemplate for submitting [TinyTapeout](https://tinytapeout.com) designs based on [XLS: Accelerated HW Synthesis](https://github.com/google/xls) toolkit.\n\n## Usage\n\n1. [Generate](https://github.com/proppy/tinytapeout-xls-test/generate) a new project based on this template\n\n2. Create a new [Wokwi](https://wokwi.com/) project ID and update [WOKWI_PROJECT_ID](Makefile#L1).\n\n3. Modify [src/user_module.x](src/user_module.x) ([DSLX language reference](https://google.github.io/xls/dslx_reference/))\n\n\t```\n\tpub fn user_module(io_in: u8) -\u003e u8 {\n\t  io_in\n\t}\n\n\t#![test]\n\tfn user_module_test() {\n\t  let _= assert_eq(user_module(u8:0b0010_1010), u8:42);\n\t  _\n\t}\n\t```\n\n4. Push and check the [![wokwi](https://github.com/proppy/tinytapeout-xls-test/actions/workflows/wokwi.yaml/badge.svg)](https://github.com/proppy/tinytapeout-xls-test/actions/workflows/wokwi.yaml) action artefacts.\n\n    - `src/user_module.v`: generated verilog\n\t\n\t\t```\n\t\tmodule user_module_USER_MODULE_ID(\n\t\t  input wire [7:0] io_in,\n\t\t  output wire [7:0] out\n\t\t);\n\t\t  assign out = io_in;\n\t\tendmodule\n\t\t```\n\t\n\t- `gds_render.svg`: GDS preview\n\t\n        ![gds](images/noop.svg)\n\n5. Goto 3 until satisfied\n\n6. Submit the TinyTapeout [form](https://docs.google.com/forms/d/e/1FAIpQLSc3ZF0AHKD3LoZRSmKX5byl-0AzrSK8ADeh0DtkZQX0bbr16w/viewform)\n\n### Examples\n\n#### 8-bit inverter\n\n[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/proppy/tinytapeout-xls-test/blob/main/notebooks/inverter.ipynb)\n\n```\nfn inverter(n: u8) -\u003e u8 {\n  !n\n}\n\n#![test]\nfn inverter_test() {\n  let _= assert_eq(inverter(u8:0b0000_0000), u8:0b1111_1111);\n  let _= assert_eq(inverter(u8:0b0000_0001), u8:0b1111_1110);\n  let _= assert_eq(inverter(u8:0b1111_0000), u8:0b0000_1111);\n  let _= assert_eq(inverter(u8:0b0101_0101), u8:0b1010_1010);\n  let _= assert_eq(inverter(u8:0b1111_1111), u8:0b0000_0000);\n  _\n}\n\npub fn user_module(io_in: u8) -\u003e u8 {\n  inverter(io_in)\n}\n```\n\n![gds](images/inverter.svg)\n\n#### 8-bit population count\n\n[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/proppy/tinytapeout-xls-test/blob/main/notebooks/popcount.ipynb)\n\n```\nfn popcount(n: u8) -\u003e u8 {\n  for (i, c): (u8, u8) in u8:0..u8:8 {\n    c + ((n \u003e\u003e i) \u0026 u8:1)\n  }(u8:0)\n}\n\n#![test]\nfn popcount_test() {\n  let _= assert_eq(popcount(u8:0b0000_0000), u8:0);\n  let _= assert_eq(popcount(u8:0b0000_0001), u8:1);\n  let _= assert_eq(popcount(u8:0b1111_0000), u8:4);\n  let _= assert_eq(popcount(u8:0b0101_0101), u8:4);\n  let _= assert_eq(popcount(u8:0b1111_1111), u8:8);\n  _\n}\n\npub fn user_module(io_in: u8) -\u003e u8 {\n  popcount(io_in)\n}\n```\n\n![gds](images/popcount.svg)\n\n#### 8-bit population count with [bit twiddling hacks](https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel)\n\n[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/proppy/tinytapeout-xls-test/blob/main/notebooks/popcount_bithacks.ipynb) \n\n```\n// https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel\nfn popcount(v: u8) -\u003e u8 {\n  let v = v - ((v \u003e\u003e 1) \u0026 u8:0x55);\n  let v = (v \u0026 u8:0x33) + ((v \u003e\u003e 2) \u0026 u8:0x33);\n  (v + (v \u003e\u003e 4) \u0026 u8:0x0F)\n}\n\n#![test]\nfn popcount_test() {\n  let _= assert_eq(popcount(u8:0b0000_0000), u8:0);\n  let _= assert_eq(popcount(u8:0b0000_0001), u8:1);\n  let _= assert_eq(popcount(u8:0b1111_0000), u8:4);\n  let _= assert_eq(popcount(u8:0b0101_0101), u8:4);\n  let _= assert_eq(popcount(u8:0b1111_1111), u8:8);\n  _\n}\n\npub fn user_module(io_in: u8) -\u003e u8 {\n  popcount(io_in)\n}\n```\n\n![gds](images/popcount_bithacks.svg)\n\n# How to change the Wokwi project\n\nEdit the [Makefile](Makefile) and change the WOKWI_PROJECT_ID to match your project.\n\n# What is this about?\n\nThis repo is a template you can make a copy of for your own [ASIC](https://www.zerotoasiccourse.com/terminology/asic/) design using [Wokwi](https://wokwi.com/).\n\nWhen you edit the Makefile to choose a different ID, the [GitHub Action](.github/workflows/wokwi.yaml) will fetch the digital netlist of your design from Wokwi.\n\nThe design gets wrapped in some extra logic that builds a 'scan chain'. This is a way to put lots of designs onto one chip and still have access to them all. You can see [all of the technical details here](https://github.com/mattvenn/scan_wrapper).\n\nAfter that, the action uses the open source ASIC tool called [OpenLane](https://www.zerotoasiccourse.com/terminology/openlane/) to build the files needed to fabricate an ASIC.\n\n# What files get made?\n\nWhen the action is complete, you can [click here](https://github.com/mattvenn/wokwi-verilog-gds-test/actions) to see the latest build of your design. You need to download the zip file and take a look at the contents:\n\n* gds_render.svg - picture of your ASIC design\n* gds.html - zoomable picture of your ASIC design\n* runs/wokwi/reports/final_summary_report.csv  - CSV file with lots of details about the design\n* runs/wokwi/reports/synthesis/1-synthesis.stat.rpt.strategy4 - list of the [standard cells](https://www.zerotoasiccourse.com/terminology/standardcell/) used by your design\n* runs/wokwi/results/final/gds/user_module.gds - the final [GDS](https://www.zerotoasiccourse.com/terminology/gds2/) file needed to make your design\n\n# What next?\n\n* Share your GDS on twitter, tag it #tinytapeout and [link me](https://twitter.com/matthewvenn)!\n* [Submit it to be made](https://docs.google.com/forms/d/e/1FAIpQLSc3ZF0AHKD3LoZRSmKX5byl-0AzrSK8ADeh0DtkZQX0bbr16w/viewform?usp=sf_link)\n* [Join the community](https://discord.gg/rPK2nSjxy8)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproppy%2Ftinytapeout-xls-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproppy%2Ftinytapeout-xls-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproppy%2Ftinytapeout-xls-test/lists"}