{"id":16833385,"url":"https://github.com/rejunity/tt07-analog-dac-ay8913","last_synced_at":"2026-01-04T01:33:30.112Z","repository":{"id":240264919,"uuid":"801924668","full_name":"rejunity/tt07-analog-dac-ay8913","owner":"rejunity","description":"Logarithmic DAC for AY8913 and SN76489 programmable sound generators (Done as part of Zero To ASIC Analog course)","archived":false,"fork":false,"pushed_at":"2024-06-01T16:49:44.000Z","size":49566,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T15:54:35.454Z","etag":null,"topics":["ay-3-8910","ay-3-8912","ay-3-8913","dac","digital-to-analog-converter","open-source","silicon","tapeout"],"latest_commit_sha":null,"homepage":"","language":"Tcl","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/rejunity.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-05-17T07:26:34.000Z","updated_at":"2025-02-01T03:43:05.000Z","dependencies_parsed_at":"2024-05-22T19:44:33.939Z","dependency_job_id":null,"html_url":"https://github.com/rejunity/tt07-analog-dac-ay8913","commit_stats":null,"previous_names":["rejunity/tt07-analog-dac-ay8193","rejunity/tt07-analog-dac-ay8913"],"tags_count":0,"template":false,"template_full_name":"TinyTapeout/tt07-analog-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejunity%2Ftt07-analog-dac-ay8913","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejunity%2Ftt07-analog-dac-ay8913/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejunity%2Ftt07-analog-dac-ay8913/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rejunity%2Ftt07-analog-dac-ay8913/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rejunity","download_url":"https://codeload.github.com/rejunity/tt07-analog-dac-ay8913/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244135905,"owners_count":20403797,"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":["ay-3-8910","ay-3-8912","ay-3-8913","dac","digital-to-analog-converter","open-source","silicon","tapeout"],"created_at":"2024-10-13T11:53:16.076Z","updated_at":"2026-01-04T01:33:30.085Z","avatar_url":"https://github.com/rejunity.png","language":"Tcl","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](../../workflows/gds/badge.svg) ![](../../workflows/docs/badge.svg)\n\n# Analog DAC for AY-891x family of Programmable Sound Generators\n\nRecreation of the logarithmic 4-bit current steering DAC from AY-8910/AY-8912/AY-8913. Inspired and informed by silicon [reverse engineering](https://github.com/lvd2/ay-3-8910_reverse_engineered) of the orginal chip.\n\nThis work was done as excercise for [Zero To ASIC Analog course](https://zerotoasiccourse.com/#asic-def) and will be part of the open-source silicon for [AY-8913](https://github.com/rejunity/tt07-psg-ay8913-with-analog-dac) and potentially [SN76489](https://github.com/rejunity/tt05-psg-sn76489) unless I manage BJT DAC for it. Also check open-source silicon effort for [Z80](https://github.com/rejunity/z80-open-silicon) CPU.\n\n### Silicon\n\n\u003cp align=\"center\" width=\"100%\"\u003e\n    \u003cimg width=\"70%\" src=\"./docs/dac_16nfet.png\"\u003e\n\u003c/p\u003e\n\n- [Inspect chip in 3D](https://gds-viewer.tinytapeout.com/?model=https://rejunity.github.io/tt07-analog-dac-ay8913/tinytapeout.gds.gltf)\n- [Inspect schematics](https://xschem-viewer.com/?file=https%3A%2F%2Fgithub.com%2Frejunity%2Ftt07-analog-dac-ay8913%2Fblob%2Fmain%2Fxschem%2Fdac_16nfet.sch)\n- [Read the documentation for the project](docs/info.md)\n\n### Simulation with parasytics extracted\n![](/docs/simulation_with_parasytics.png)\n\n\n## The original DAC from the 80ies\n4-bit to 16 lines decoder on the left side. 16 current steering transistors of the different size form the DAC on the right. Output is in the top right corner.\n\u003cp align=\"center\" width=\"100%\"\u003e\n    \u003cimg width=\"50%\" src=\"./docs/original_dac_from_8910.png\"\u003e\n\u003c/p\u003e\n\n### Reverse engineered schematics by lvd2\nYeah, it is just bunch of transistors connected in parallel. The real magic is in the **width** \u0026 **length** of their gates.\n\u003cp align=\"center\" width=\"100%\"\u003e\n    \u003cimg width=\"50%\" src=\"./docs/original_dac_from_8910_reverse_engineered_schematics_by_lvd2.png\"\u003e\n\u003c/p\u003e\n\n### Compare old and new\n\n![](docs/new_vs_old.png)\n\n## Magic\n![](docs/magic.png)\n![](docs/xschem.png)\n\u003cp align=\"center\" width=\"100%\"\u003e\n    \u003cimg width=\"32%\" src=\"./docs/dac_16nfet_3d_metal1.png\"\u003e\n    \u003cimg width=\"32%\" src=\"./docs/dac_16nfet_3d_metal2.png\"\u003e\n    \u003cimg width=\"32%\" src=\"./docs/dac_16nfet_3d.png\"\u003e\n\u003c/p\u003e\n\n# What did I learn?\n\n## Sizing transistors to produce exact currents: 2mA, 1.4mA, 1mA, 0.7mA, 0.5mA...\n\nFirst of all, it turns out that there are so many secondary effects, that the theoretical formula `W/L=2 * Id / (uCox * (Vdd-Vth)^2)` often presented in books becomes practically useless!\n\nThe W/L ratio of the gate is non-linear in regards to desired current. 4/2 != 2/1 != 1/0.25 in terms of current. Thinner the gate (in absolute values), stronger are various secondary effects and more resulting current deviates from the theory.\n\nI could not find SKY130 documentation how to model these effects, but I could find some clues in:\n* https://skywater-pdk.readthedocs.io/en/main/rules/device-details.html -- (bit cryptic) tables are very illustrative about non-linear effect of W/L on Vth.\n* `sky130A/libs.tech/combined/continuous/models_fet.spice`  -- Vth0 depends on W/L in some weird ways, perhaps Cox as well.\n\nSee how Vth (threshold voltage) depends on W/L, ranging from 0.434V to 0.64V.\n![image](https://github.com/rejunity/tt07-analog-dac-ay8913/assets/1733077/228ebf3b-1e65-493f-8c67-ee34ed11fe1b)\n\nCheck out what they have in models_fet.spice though, even weirder: \n![image](https://github.com/rejunity/tt07-analog-dac-ay8913/assets/1733077/95127b0c-80f8-422e-8032-0443e556939f)\n\nFrom my experiments it is very likely that W/L affects not only Vth, but Cox as well.\n\n## Short channel effects\n\nThe behaviors above are actually called [Short chanel effects](https://en.wikipedia.org/wiki/Short-channel_effect) and [Reverlse short-channel effect](https://en.wikipedia.org/wiki/Reverse_short-channel_effect)!\n\n## Practical solution\nI started using gates that are much larger (fatter and longer) than the theory would give me. Making gates larger significantly reduced the secondary effects!\n\nI picked, partially through calculation, partially through experimentation, the sizes for my maxmimum (2mA) and minimum currents (16uA). Which turned out to be really nice numbers 12/1 and 1/12 😎 and used super simple Python script to fit exponential curve through them: ```for i in range(8): print(12*(0.707**i)```\n\nI thought I would have to wiggle the gate sizes in the middle, but it just worked out as is.\n\nIf I had my transistors even slightly smaller, it would not be that easy! Right now they are approximately x3 larger than theoretically necessary.\n\n## Some observation on the original DAC in AY-8913\n\u003cimg width=\"521\" alt=\"image\" src=\"https://github.com/rejunity/tt07-analog-dac-ay8913/assets/1733077/109d5797-06a2-4d62-8df7-9e472bd766b3\"\u003e\n\n1) Now I see that the 3 \"middle\" transistors don't exactly follow the pattern and perhaps original designers had to wiggle their W/L ratio.\n2) Even the smallest current steering DAC gate is significantly larger than the logic gates next to them (see the image below), even if they control relatively tiny currents. I assume the original designers might have done the same - just make all DAC transistors larger to make it easier to \"fit\" in the exponential curve without significant distortions.\n3) It also could explain why couple of \"steps\" are bit off from the spec in the original chip.\n\n\u003cimg width=\"324\" alt=\"image\" src=\"https://github.com/rejunity/tt07-analog-dac-ay8913/assets/1733077/99d202c6-912f-466d-8b85-420324f4dc97\"\u003e\n\n\n# What is Tiny Tapeout?\n\nTiny Tapeout is an educational project that aims to make it easier and cheaper than ever to get your digital designs manufactured on a real chip.\n\nTo learn more and get started, visit https://tinytapeout.com.\n\n## Analog projects\n\nFor specifications and instructions, see the [analog specs page](https://tinytapeout.com/specs/analog/).\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://docs.google.com/document/d/1aUUZ1jthRpg4QURIIyzlOaPWlmQzr-jBn3wZipVUPt4)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frejunity%2Ftt07-analog-dac-ay8913","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frejunity%2Ftt07-analog-dac-ay8913","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frejunity%2Ftt07-analog-dac-ay8913/lists"}