Skip to content

Commit

Permalink
Local OpenLane Installs + Colaboratory (#143)
Browse files Browse the repository at this point in the history
Co-authored-by: Donn <[email protected]>
  • Loading branch information
mohamedleithy and donn authored Mar 21, 2022
1 parent 3c0023d commit e4c5998
Show file tree
Hide file tree
Showing 5 changed files with 446 additions and 53 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# DFFRAM Compiler
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![CI Badge](https://github.com/Cloud-V/DFFRAM/actions/workflows/main.yml/badge.svg?branch=main) [![Slack Invite](https://img.shields.io/badge/Community-Skywater%20PDK%20Slack-ff69b4?logo=slack)](https://invite.skywater.tools) [![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Cloud-V/DFFRAM/blob/main/dffram.ipynb) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![CI Badge](https://github.com/Cloud-V/DFFRAM/actions/workflows/main.yml/badge.svg?branch=main) [![Slack Invite](https://img.shields.io/badge/Community-Skywater%20PDK%20Slack-ff69b4?logo=slack)](https://invite.skywater.tools)

Standard Cell Library based Memory Compiler using DFF/Latch cells.

Expand Down
333 changes: 333 additions & 0 deletions dffram.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "eukW5KG9kq7A"
},
"source": [
"# DFFRAM Compiler\n",
"\n",
"\n",
" Standard Cell Library based Memory Compiler using DFF/Latch cells.\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "hAbRRQMOYmTj"
},
"source": [
"# Overview: \n",
"DFFRAM is based around two Python modules: dffram and placeram.\n",
"\n",
"Dffram.py is a relatively self-contained flow that uses Openlane and other technologies to place, route and harden RAM. \n",
"\n",
"Placeram is a custom placer using OpenROAD's Python interface. It places DFFRAM RAM/RF designs in a predetermined structure to avoid a lengthy and inefficient manual placement process for RAM. "
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "weyU60-UZRw1"
},
"source": [
"\n",
"\n",
"---\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "xiMjKkZuZWGb"
},
"source": [
"Installing Conda Package Manager for Google Colab"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "UD8VRDFFi6eb",
"outputId": "27b443c5-5e83-42e8-a116-901d9b768672"
},
"outputs": [],
"source": [
"!pip install -q condacolab\n",
"import condacolab\n",
"\n",
"condacolab.install_from_url(\n",
" \"https://repo.anaconda.com/miniconda/Miniconda3-py37_4.11.0-Linux-x86_64.sh\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "YEu6EgWSjCbP",
"outputId": "a8ca9d23-80b3-4789-fcc4-fb9e956ad64e"
},
"outputs": [],
"source": [
"import condacolab\n",
"\n",
"condacolab.check()\n",
"!sed -i -e /cudatoolkit/d /usr/local/conda-meta/pinned"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Jo6qIrgwmIj5"
},
"source": [
"The conda-eda project maintains a collection of conda packages recipes that are used by DFFRAM namely: \n",
"\n",
"* Magic \n",
"* Openroad \n",
"* Netgen\n",
"* Yosys \n",
"* Gdstk\n",
"\n",
"\n",
"\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "oafmcNo7jGRU",
"outputId": "6bfe1fcd-6f47-4c5f-e048-4566faba703a"
},
"outputs": [],
"source": [
"!conda install -y -c litex-hub -c conda-forge open_pdks.sky130a=1.0.290 magic openroad netgen yosys gdstk"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "FuqN8wIVX3X5"
},
"source": [
"Cloning OpenLane and DFFRAM and Installing the required dependencies: 🔄\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "bVYWVZkTjKb_",
"outputId": "09735eff-c07e-45fe-c221-93bb2e9fe35f"
},
"outputs": [],
"source": [
"!apt-get update && apt-get install -yq tcllib\n",
"\n",
"!git clone https://github.com/The-OpenROAD-Project/OpenLane openlane\n",
"!python3 -m pip install -r /content/openlane/requirements.txt\n",
"\n",
"!git clone https://github.com/Cloud-V/DFFRAM --branch dffram-dockerless\n",
"%cd /content/DFFRAM\n",
"\n",
"%env NO_CHECK_INSTALL=1\n",
"%env TCLLIBPATH=/usr/share/tcltk"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "7JDT_oURah5w"
},
"source": [
"\n",
"\n",
"---\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "utNy5eoTamqs"
},
"source": [
"# Invoke for a full list of different options 🤔 "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "NlK414aZbbBZ",
"outputId": "6cb15cad-2b1a-404f-e983-aa6c0bcfb5dd"
},
"outputs": [],
"source": [
"!./dffram.py --help"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "p9rJi0GJevQL"
},
"source": [
"# Supported Sizes: \n",
"\n",
"RAM: \n",
"- 32 words with byte write enable (1RW and 1RW1R).\n",
"- 128 words with byte write enable (1RW and 1RW1R).\n",
"- 256 words with byte write enable (1RW and 1RW1R).\n",
"- 512 words with byte write enable (1RW and 1RW1R).\n",
"- 1024 words with byte write enable (1RW and 1RW1R).\n",
"- 2048 words with byte write enable (1RW and 1RW1R).\n",
"\n",
"\n",
"RF: \n",
"\n",
"- 32 x 32-bit words (2R1W)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "uboP45qzhel3"
},
"source": [
"# 32x32 with one read-write port and one read-only port 🚀 "
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "4XY-HFzUmV4M",
"outputId": "c4376e4f-a7d8-48bb-fe37-6b61343dd5b2"
},
"outputs": [],
"source": [
"!./dffram.py --using-local-openlane /content/openlane --pdk-root /usr/local/share/pdk -s 32x32"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "G8DDqTUshy9i"
},
"source": [
"# 32x32 with two read ports and one write port (a register file)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "cNiRHzHWgIjw"
},
"outputs": [],
"source": [
"!./dffram.py --using-local-openlane /content/openlane --pdk-root /usr/local/share/pdk -s 32x32 -b ::rf -v 2R1W"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "i4NNuMeTc5OQ"
},
"source": [
"# Check it out 🎉"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"id": "t9GQdQ_8Dtgr",
"outputId": "fec172c4-0d6c-428b-c260-87b3486114d5"
},
"outputs": [],
"source": [
"import pathlib\n",
"import gdstk\n",
"from IPython.display import SVG\n",
"\n",
"gds = sorted(\n",
" pathlib.Path(\"/content/DFFRAM/build/32x32_DEFAULT\").glob(\"*/gds/RAM32.gds\")\n",
")[0]\n",
"library = gdstk.read_gds(gds)\n",
"top_cells = library.top_level()\n",
"top_cells[0].write_svg(\"RAM32.svg\")\n",
"SVG(\"RAM32.svg\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "H-eZM4Xnbltv"
},
"source": [
"# The Secret Menu! 🤫\n",
"\n",
"DFFRAM supports a number of secret options you can use to further customize your experience. They are all passed as environment variables.\n",
"\n",
"Though do note using this variable is very likely to break things.\n",
"\n",
"\n",
"\n",
"| Environment Variable | Effect |\n",
"| - | - |\n",
"| FORCE_ACCEPT_SIZE | DFFRAM checks that you are not using a size not officially marked supported as available by a certain building block set. If this environment variable is set to any value, the check is bypassed. |\n",
"| FORCE_DESIGN_NAME | Design names are found based on the size. If you'd like to force dffram to use a specific design name instead, set this environment variable to that name. |"
]
}
],
"metadata": {
"colab": {
"collapsed_sections": [],
"name": "Copy of DFFRAM_dockerless.ipynb",
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading

0 comments on commit e4c5998

Please sign in to comment.