Skip to content

Instantly share code, notes, and snippets.

@roguh
Last active April 24, 2023 18:22
Show Gist options
  • Save roguh/cd110ee563006c7aca4e15478efc9823 to your computer and use it in GitHub Desktop.
Save roguh/cd110ee563006c7aca4e15478efc9823 to your computer and use it in GitHub Desktop.
First shot at building a chip, connecting NAND gates
# See updates here: github.com/roguh/gdsfactory_nand2tetris.git
# python 3.11 support. unit tests seem ok, may need some reference GDS files
# download https://gdsfactory.github.io/skywater130/ (sky130 package) but make sure to use laatest version of gdsfactory, run `make install`
# `pip install gdsfactory[full,dev]`
# use https://github.com/gdsfactory/kweb for visualization
# put file x.gds into gds_files and navigate to localhost:8000/gds/x to see it
# TODO: list gds files at homepage /, route should be /gds_files/x with /gds_files/x.gds redirect
# gdsthing.plot_matplotlib() is slow
import matplotlib.pyplot as plt
import gdsfactory as gf
import sky130
# thanks to gdsfactory and Joqauin M.
# goal: connect two NAND gates and form a NOT or an AND, see nand2tetris
# goal: print these chips with Google Skywater / Efabless MPW shuttle?
# https://www.hackster.io/news/efabless-google-and-skywater-are-enabling-us-mere-mortal-makers-to-design-our-own-open-source-asics-28917eb5357a
# probably wrong
c = sky130.components.sky130_fd_sc_hd__nand2_2()
# c.plot_matplotlib()
# plt.show()
c2 = sky130.components.sky130_fd_sc_hd__nand2_2()
pc2 = c2 << gf.components.pad_array(orientation=270, columns=3)
route = gf.routing.get_route_electrical(c.ports['VPWR'], pc2.ports['VPWR1'])
c.add(route.references)
pc2.plot_matplotlib()
plt.show()
@roguh
Copy link
Author

roguh commented Apr 24, 2023

Joaquin Martel recommends using a top-level component to store everything. I could also define "entrypoints" so that the top-level component can be reused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment