Last active
November 22, 2025 05:10
-
-
Save proppy/eaa809859b01eb90fd4d75ea7a49f775 to your computer and use it in GitHub Desktop.
xls.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "nbformat": 4, | |
| "nbformat_minor": 0, | |
| "metadata": { | |
| "colab": { | |
| "provenance": [], | |
| "include_colab_link": true | |
| }, | |
| "kernelspec": { | |
| "name": "python3", | |
| "display_name": "Python 3" | |
| }, | |
| "language_info": { | |
| "name": "python" | |
| } | |
| }, | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": { | |
| "id": "view-in-github", | |
| "colab_type": "text" | |
| }, | |
| "source": [ | |
| "<a href=\"https://colab.research.google.com/gist/proppy/eaa809859b01eb90fd4d75ea7a49f775/xls.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "source": [ | |
| "#@title Install dependencies {display-mode: \"form\"}\n", | |
| "#@markdown - Click the ▷ button to install XLS and its dependencies\n", | |
| "\n", | |
| "xls_version = 'v0.0.0-9082-g9dfd5cb27' #@param {type:\"string\"}\n", | |
| "xls_colab_version = 'v0.0.0-9096-g203211f59'\n", | |
| "!echo '📦 downloading xls-{xls_version}'\n", | |
| "!curl --show-error -L https://github.com/google/xls/releases/download/{xls_version}/xls-{xls_version}-linux-x64.tar.gz | tar xzf - --strip-components=1\n", | |
| "!echo '🧪 setting up colab integration'\n", | |
| "import sys\n", | |
| "!{sys.executable} -m pip uninstall --yes grpcio-status tensorflow google-ai-generativelanguage google-generativeai\n", | |
| "!{sys.executable} -m pip install --no-cache-dir --ignore-installed https://github.com/proppy/xls/releases/download/{xls_colab_version}/xls_colab-0.0.0-py3-none-any.whl protobuf==6.31.1\n", | |
| "\n", | |
| "import xls.contrib.colab\n", | |
| "_ = xls.contrib.colab.register_dslx_magic()\n" | |
| ], | |
| "metadata": { | |
| "id": "qX4hIOZhQQar" | |
| }, | |
| "execution_count": null, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "<img src=https://google.github.io/xls/images/xls_logo.svg height=200>\n", | |
| "\n", | |
| "# 半導体デジタル設計を爆速にする" | |
| ], | |
| "metadata": { | |
| "id": "Q7KbCOfZM808" | |
| } | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# 自己紹介\n", | |
| "\n", | |
| "<img src=https://pbs.twimg.com/profile_images/2505273322/xoi195tc7mjg6tgbsoaf_400x400.png height=100 align=right>\n", | |
| "\n", | |
| "* <img src=https://upload.wikimedia.org/wikipedia/commons/thumb/9/91/Octicons-mark-github.svg/1200px-Octicons-mark-github.svg.png height=20><img src=https://upload.wikimedia.org/wikipedia/commons/c/ce/X_logo_2023.svg height=20> @proppy、<img src=https://upload.wikimedia.org/wikipedia/commons/thumb/a/a5/Instagram_icon.png/2048px-Instagram_icon.png height=20> @proppysh\n", | |
| "* 2011年:グーグルに入社\n", | |
| "* チューリヒ 🇨🇭✈️ サンフランシスコ 🌁 ✈️ 東京🗼\n", | |
| "* デベロッパーリレーションエンジニア\n", | |
| "\n", | |
| "<img src=\"https://upload.wikimedia.org/wikipedia/en/c/c6/Logo_of_Google_App_Engine.png\" height=50>\n", | |
| "<img src=\"https://dbdb.io/media/logos/Cloud_Datastore.png\" height=50>\n", | |
| "<img src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/3/39/Kubernetes_logo_without_workmark.svg/2109px-Kubernetes_logo_without_workmark.svg.png\" height=50>\n", | |
| "<img src=\"https://www.android.pk/images/android-ndk.jpg\" height=50>\n", | |
| "<img src=\"https://storage.googleapis.com/gweb-developer-goog-blog-assets/images_archive/original_images/weave_logo.png\" height=50>\n", | |
| "<img src=\"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSF9iKVskRb_NucPPBmGv96gd_m9SoJaVMB9w&s\" height=50>\n", | |
| "<img src=\"https://developers.home.google.com/static/images/home-logo-share.png?hl=ja\" height=50>\n", | |
| "<img src=\"https://developers.google.com/static/assistant/assistant.png?hl=ja\" height=50>\n", | |
| "\n", | |
| "* 2022年:**Hardware Toolchain**チームに参加\n" | |
| ], | |
| "metadata": { | |
| "id": "B7isrkccNXkD" | |
| } | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# Hardware Toolchainチームの紹介\n", | |
| "\n", | |
| "* ミッション:\n", | |
| "\n", | |
| "新しいハードウェアアクセラレータ開発を、誰でも早く、簡単に、スケーラブルに\n", | |
| "\n", | |
| "* カスタマーターゲット:\n", | |
| "\n", | |
| "ハードウェアチーム(TPU、YouTube、Pixelなど)\n", | |
| "\n", | |
| "* オープンソースツールのエコシステムを協力" | |
| ], | |
| "metadata": { | |
| "id": "0kTu6oiYhA47" | |
| } | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# XLSの紹介\n", | |
| "\n", | |
| "<img src=https://google.github.io/xls/images/xls_stack_diagram.png height=350 align=right>\n", | |
| "\n", | |
| "* XLS is not .xls📊\n", | |
| "* XLS is not HDL/RTL\n", | |
| "* XLS is not HLS\n", | |
| "* mid-level synthesis ツールキット\n", | |
| "* Apache 2.0 ライセンス 📜\n", | |
| "* 共同設計\n", | |
| " * ソフトウェア 🧑💻\n", | |
| " * ハードウェア 🧑🔧\n", | |
| "* [github.com/google/xls](https://github.com/google/xls)" | |
| ], | |
| "metadata": { | |
| "id": "eNsoMR0sPG2g" | |
| } | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# XLSの紹介\n", | |
| "\n", | |
| "* Rust風 🦀 のプログラミング言語\n", | |
| "* インタプリタ\n", | |
| "* ユニットテスト✅\n" | |
| ], | |
| "metadata": { | |
| "id": "F8bi8T5JPbkp" | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "source": [ | |
| "%%dslx --top=muladd --pdk=sky130 --clock_period_ps=2000 --flop_inputs=false --flop_outputs=false --tab=interpreter\n", | |
| "\n", | |
| "fn muladd(a: u8, b: u8, c: u8) -> u8 {\n", | |
| " a * b + c\n", | |
| "}\n", | |
| "\n", | |
| "#[test]\n", | |
| "fn muladd_test() {\n", | |
| " assert_eq(muladd(u8:1, u8:2, u8:3), u8:5);\n", | |
| " assert_eq(muladd(u8:4, u8:4, u8:4), u8:20);\n", | |
| " assert_eq(muladd(u8:127, u8:2, u8:2), u8:0);\n", | |
| "}" | |
| ], | |
| "metadata": { | |
| "id": "6qFgfnFyQzQE" | |
| }, | |
| "execution_count": null, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# XLSの紹介\n", | |
| "\n", | |
| "- ツール向け⚙️の中間言語\n", | |
| "- オプティマイザ 🎛️\n" | |
| ], | |
| "metadata": { | |
| "id": "Nia7pm31RJNm" | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "source": [ | |
| "%%dslx --top=muladd --pdk=sky130 --pipeline_stages=1 --flop_inputs=false --flop_outputs=false --tab=ir\n", | |
| "\n", | |
| "fn muladd(a: u8, b: u8, c: u8) -> u8 {\n", | |
| " a * b + c + 1 - 1\n", | |
| "}\n", | |
| "\n", | |
| "#[test]\n", | |
| "fn muladd_test() {\n", | |
| " assert_eq(muladd(u8:1, u8:2, u8:3), u8:5);\n", | |
| " assert_eq(muladd(u8:4, u8:4, u8:4), u8:20);\n", | |
| " assert_eq(muladd(u8:127, u8:2, u8:2), u8:0);\n", | |
| "}" | |
| ], | |
| "metadata": { | |
| "id": "L79j3_eIRPou" | |
| }, | |
| "execution_count": null, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# XLSの紹介\n", | |
| "\n", | |
| "- JIT シミュレーション 🏁\n", | |
| "- AOT コンピレーション🏎️\n" | |
| ], | |
| "metadata": { | |
| "id": "w-46EBM5Tj6c" | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "source": [ | |
| "TEST(Float32AddJitWrapperTest, CanAdd) {\n", | |
| " XLS_ASSERT_OK_AND_ASSIGN(auto adder, fp::Float32Add::Create());\n", | |
| " Value one = F32ToTuple(1.0f);\n", | |
| " Value two = F32ToTuple(2.0f);\n", | |
| "\n", | |
| " XLS_ASSERT_OK_AND_ASSIGN(Value expected, adder->Run(one, two));\n", | |
| " XLS_ASSERT_OK_AND_ASSIGN(float result, TupleToF32(expected));\n", | |
| " EXPECT_EQ(result, 3.0f);\n", | |
| "}" | |
| ], | |
| "metadata": { | |
| "id": "IREXGxezTsCc" | |
| }, | |
| "execution_count": null, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# XLSの紹介\n", | |
| "\n", | |
| "- プロセスノードに対応💡(ASAP7, SKY130)\n", | |
| "- 自動パイプライニング\n", | |
| "- リタイミング 🕒\n" | |
| ], | |
| "metadata": { | |
| "id": "hdIjDG05TuOM" | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "source": [ | |
| "%%dslx --top=muladd --pdk=sky130 --clock_period_ps=2000 --flop_inputs=false --flop_outputs=false --tab=schedule\n", | |
| "\n", | |
| "# 2000ps → 1200ps\n", | |
| "# 500MHZ → 883MHZ\n", | |
| "\n", | |
| "fn muladd(a: u8, b: u8, c: u8) -> u8 {\n", | |
| " a * b + c\n", | |
| "}\n", | |
| "\n", | |
| "#[test]\n", | |
| "fn muladd_test() {\n", | |
| " assert_eq(muladd(u8:1, u8:2, u8:3), u8:5);\n", | |
| " assert_eq(muladd(u8:4, u8:4, u8:4), u8:20);\n", | |
| " assert_eq(muladd(u8:127, u8:2, u8:2), u8:0);\n", | |
| "}" | |
| ], | |
| "metadata": { | |
| "id": "eW6_D_f-T621" | |
| }, | |
| "execution_count": null, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# XLSの紹介\n", | |
| "\n", | |
| "- SystemVerilog 出力🚀\n", | |
| "- フォーマルツール\n" | |
| ], | |
| "metadata": { | |
| "id": "kfAzDD45UDct" | |
| } | |
| }, | |
| { | |
| "cell_type": "code", | |
| "source": [ | |
| "%%dslx --top=muladd --pdk=sky130 --pipeline_stages=1 --flop_inputs=false --flop_outputs=false --tab=verilog\n", | |
| "\n", | |
| "fn muladd(a: u8, b: u8, c: u8) -> u8 {\n", | |
| " a * b + c\n", | |
| "}\n", | |
| "\n", | |
| "#[test]\n", | |
| "fn muladd_test() {\n", | |
| " assert_eq(muladd(u8:1, u8:2, u8:3), u8:5);\n", | |
| " assert_eq(muladd(u8:4, u8:4, u8:4), u8:20);\n", | |
| " assert_eq(muladd(u8:127, u8:2, u8:2), u8:0);\n", | |
| "}" | |
| ], | |
| "metadata": { | |
| "id": "9qNVRMeZULZV" | |
| }, | |
| "execution_count": null, | |
| "outputs": [] | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# XLSのまとめ\n", | |
| "\n", | |
| "<img src=https://google.github.io/xls/images/xls_stack_diagram.png height=350 align=right>\n", | |
| "\n", | |
| "- mid-level synthesis ツールキット\n", | |
| "- Apache 2.0 ライセンス 📜\n", | |
| "- 共同設計\n", | |
| " - ソフトウェア 🧑💻\n", | |
| " - ハードウェア 🧑🔧\n", | |
| "- Rust風 🦀 のプログラミング言語\n", | |
| "- インタプリタ、ユニットテスト✅\n", | |
| "- ツール向け⚙️の中間言語、オプティマイザ 🎛️\n", | |
| "- プロセスノードに対応💡(ASAP7, SKY130)\n", | |
| "- 自動パイプライニング、リタイミング 🕒\n", | |
| "- JIT ・シミュレーション 🏁、AOT コンピレーション🏎\n", | |
| "- SystemVerilog 出力🚀、フォーマルツール" | |
| ], | |
| "metadata": { | |
| "id": "70hXiK39Uqbn" | |
| } | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# もっと知りたい方へ\n", | |
| "\n", | |
| "<img src=https://google.github.io/xls/images/xls_logo.svg height=200 align=right>\n", | |
| "\n", | |
| "* [github.com/google/xls](https://github.com/google/xls)\n", | |
| " * XLSのプロジェクトに参加\n", | |
| "* [google.github.io/xls](https://google.github.io/xls)\n", | |
| " * XLSのドキュメンテーション\n", | |
| "* [bit.ly/xls-playground](https://bit.ly/xls-playground)\n", | |
| " * XLSからGDSまでの体験\n", | |
| "* [bit.ly/learn-xls](https://bit.ly/learn-xls)\n", | |
| " * XLSの言語をもっと詳しく" | |
| ], | |
| "metadata": { | |
| "id": "UfxmvyrpVhuB" | |
| } | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "source": [ | |
| "# 石を作りたい方へ\n", | |
| "\n", | |
| "<img src=https://companieslogo.com/img/orig/SKYT-abf61432.png height=60 align=right>\n", | |
| "<img src=https://companieslogo.com/img/orig/GFS-1a94c951.png height=60 align=right>\n", | |
| "\n", | |
| "\n", | |
| "* [gf.com](https://gf.com/), [skywatertechnology.com](https://www.skywatertechnology.com/)\n", | |
| " * 量産・130nm〜180nm(ウェーハ何枚/1500〜3000万円)\n", | |
| "\n", | |
| "\n", | |
| "<img src=https://umsousercontent.com/lib_lnlnuhLgkYnZdkSC/x3j7xgk85p0d4qzb.png height=60 align=right>\n", | |
| "<img src=https://wafer.space/assets/images/[email protected] height=60 align=right>\n", | |
| "\n", | |
| "* [wafer.space](http://wafer.space/)\n", | |
| " * 少量生産サービス(1000石/100万円)\n", | |
| "\n", | |
| "<img src=https://tinytapeout.com/ttlogo_400.png height=60 align=right>\n", | |
| "\n", | |
| "* [tinytapeout.com](http://tinytapeout.com/)\n", | |
| " * 自分のチップを安く作れる(1〜2万円)\n", | |
| "\n", | |
| "<img src=https://media.connpass.com/thumbs/a0/6e/a06e612dc60ef8e80eb46adaa6286406.png height=60 align=right>\n", | |
| "\n", | |
| "* [ishikai.connpass.com](https://ishikai.connpass.com/)\n", | |
| " * 自作半導体のコミュニティ" | |
| ], | |
| "metadata": { | |
| "id": "EUfrNLbIJI1G" | |
| } | |
| } | |
| ] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment