Code Monkey home page Code Monkey logo

tt07-analog-dac-ay8913's Introduction

Analog DAC for AY-891x family of Programmable Sound Generators

Recreation of the logarithmic 4-bit current steering DAC from AY-8910/AY-8912/AY-8913. Inspired and informed by silicon reverse engineering of the orginal chip.

This work was done as excercise for Zero To ASIC Analog course and will be part of the open-source silicon for AY-8913 and potentially SN76489 unless I manage BJT DAC for it. Also check open-source silicon effort for Z80 CPU.

Silicon

Simulation with parasytics extracted

The original DAC from the 80ies

4-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.

Reverse engineered schematics by lvd2

Yeah, it is just bunch of transistors connected in parallel. The real magic is in the width & length of their gates.

Compare old and new

Magic

What did I learn?

Sizing transistors to produce exact currents: 2mA, 1.4mA, 1mA, 0.7mA, 0.5mA...

First 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!

The 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.

I could not find SKY130 documentation how to model these effects, but I could find some clues in:

See how Vth (threshold voltage) depends on W/L, ranging from 0.434V to 0.64V. image

Check out what they have in models_fet.spice though, even weirder: image

From my experiments it is very likely that W/L affects not only Vth, but Cox as well.

Short channel effects

The behaviors above are actually called Short chanel effects and Reverlse short-channel effect!

Practical solution

I started using gates that are much larger (fatter and longer) than the theory would give me. Making gates larger significantly reduced the secondary effects!

I 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)

I thought I would have to wiggle the gate sizes in the middle, but it just worked out as is.

If I had my transistors even slightly smaller, it would not be that easy! Right now they are approximately x3 larger than theoretically necessary.

Some observation on the original DAC in AY-8913

image
  1. 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.
  2. 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.
  3. It also could explain why couple of "steps" are bit off from the spec in the original chip.
image

What is Tiny Tapeout?

Tiny 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.

To learn more and get started, visit https://tinytapeout.com.

Analog projects

For specifications and instructions, see the analog specs page.

Resources

tt07-analog-dac-ay8913's People

Contributors

rejunity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.