Git Product home page Git Product logo

polychip's Introduction

polychip

Python program to extract a netlist of NMOS transistors from an Inkscape diagram, and recognize various gates.

Prerequisites

Python 3.6 or above

  • Windows: Get it here. Alternatively, run Bash on Ubuntu on Windows and follow the instructions for Ubuntu 14.04.
  • Ubuntu: Run lsb_release -a to determine your Ubuntu version. Then follow the advice given here under the appropriate version.
  • Debian: Follow the advice given here.
  • OSX: Get it here

Python packages: install with pip

$ pip3 -V

If the above doesn't show your version of python, then you'll have to read up on using virtual environments. If you never want to use a previous version of python again (and really, who does?), then feel free to overwrite pip like so: curl https://bootstrap.pypa.io/get-pip.py | sudo python3.6 (or whatever your python version is).

Then: $ sudo pip3 install -r requirements.txt

Usage

usage: polychip.py [-h] [--sch] [--nets] [--qs] <file>

Polychip, a program to help recognize transistors and gates in an Inkscape
file traced from an NMOS integrated circuit.

positional arguments:
  <file>      input Inkscape SVG file

optional arguments:
  -h, --help  show this help message and exit
  --sch       whether to generate a KiCAD .sch file (output to polychip.sch, use eeschema to view!)
  --nets      whether to print the netlist
  --qs        whether to print the transistor locations

Instructions

Open the polychip-template.svg file in Inkscape. Instructions on how to organize your drawing is in that file.

You can run the program like so:

$ python3.6 polychip/polychip.py <svg-file> --nets --qs

Try it out on polychip-template.svg!

The output will show you how many transistors, contacts, diff, poly, and metal were found. Errors are displayed for contacts only attaching one diff, poly, or metal, and for text that violates the requirements set forth in the template file. Errors are also displayed for poly, diff, or metal not connected to anything else, and for transistors with fewer than two electrodes detected.

The netlist is a dictionary. The key is the net name, or an anonymous numbered net if no net name was defined for the net on the SNames layer. The value is a set of transistor connections, of the format (Type.terminal>, qname, where <terminal> is GATE for the gate, and E0 and E1 for the two electrodes (N is meaningless), and qname is either the name of the transistor as defined on the QNames layer, or a unique number.

Tests and examples

You can run all tests like so:

$ python3.6 polychip/tests.py

There are many test files in the test directory that you can use as examples. You can run polychip on any of them to see what the output looks like.

Schematic output

Currently Polychip only outputs a KiCAD .sch file which you can open with KiCAD's eeschema program. It relies on the included project5474.lib file, and you will probably have to configure KiCAD to include that library in its global component libraries.

It will only place the transistors and some of the gate types it recognized, and will not (yet) wire them up.

polychip's People

Contributors

robertbaruch avatar

Stargazers

lol2302v0 avatar  avatar Uffe Jakobsen avatar Evgeny Kulev avatar Stéphane Petit avatar Amal Khailtash avatar kakuty avatar Dmytro avatar  avatar Anhang Li / Yukidama avatar Renaldas Zioma avatar Andres Mariscal avatar cano159 avatar Arild Velure avatar  avatar Myon (みょん) avatar Rafael Kaissi avatar Kevin.Y avatar  avatar Will Blayney avatar Adam Gibson avatar Dennis Kupec avatar Alexander Troosh avatar  avatar Amit Vitekar avatar  avatar Toni Klopfenstein avatar Harold avatar JaredYeah avatar Matt avatar James Lewis avatar Philippe Teuwen avatar apscomp avatar Matt Miano avatar  avatar Alexandre L. avatar Tim 'mithro' Ansell avatar Siddique Vally-Adam avatar S J avatar  avatar  avatar  avatar Fraxul avatar John Kelley avatar Andreas Olofsson avatar Lucas Teske avatar Carlos Santisteban avatar Massimiliano Minnella avatar Furrtek avatar  avatar  avatar Owais Tauqir avatar Jevin Sweval avatar Daniel Christiansen avatar  avatar William D. Jones avatar samy kamkar avatar

Watchers

Jevin Sweval avatar Siddique Vally-Adam avatar Eric Smith avatar James Cloos avatar  avatar  avatar edisno avatar gchiasso avatar Dmytro avatar

polychip's Issues

error line 322

what I tried:

python3 polychip.py polychip-template.svg

what I expected:

no error

complete output

12 contacts
5 diffs
3 metals
5 polys
Error: Metal contact rect14862 at [11869.0, 6094.0] has no second connection
Error: Poly contact rect14760 at [11596.49574755, 6262.2144661] has no second connection
Error: Poly contact rect14737 at [11614.21875, 6713.2138] has no second connection
Error: Poly contact rect14735 at [11888.438, 6711.80755] has no second connection
Error: Poly contact rect14746 at [11522.956854, 6361.9161255] has no second connection
Error: Poly contact rect14733 at [11537.34375, 6410.87005] has no second connection
4 transistors
Error: Transistor q_Q4 has only one electrode connection
Error: poly p_path14743 is isolated
Path m_path14864 is labeled signal SIGNAL1
Path p_path14741 is labeled signal SIGNAL2
Path m_path976 is labeled signal GND
Path m_path978 is labeled signal VCC
Traceback (most recent call last):
  File "polychip.py", line 322, in <module>
    node = G.nodes[c]
TypeError: 'method' object is not subscriptable

Edit: using python 3.5.3

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.