Skip to content

Commit

Permalink
adding packaged umi
Browse files Browse the repository at this point in the history
  • Loading branch information
gadfort committed Mar 1, 2024
1 parent 0232df3 commit 58d09ff
Show file tree
Hide file tree
Showing 74 changed files with 3,370 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
python3 -m venv .venv
. .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
python3 -m pip install .[test]
- name: Run ${{ matrix.testbench }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:
- name: Lint with Flake8
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install .[test]
flake8 --statistics .
49 changes: 49 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Wheels

on:
workflow_dispatch:
release:
types:
- published

jobs:
build_wheels:
name: Wheels UMI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: hynek/build-and-inspect-python-package@v2

publish:
needs: [build_wheels]
runs-on: ubuntu-latest
permissions:
id-token: write
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Publish
uses: pypa/[email protected]

save:
needs: [publish]
runs-on: ubuntu-latest

steps:
- uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Add wheels to GitHub release artifacts
uses: softprops/action-gh-release@v1
with:
files: dist/*.whl
37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[build-system]
requires = [
"setuptools >= 61.2",
"setuptools_scm[toml] >= 6.2"
]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
# Presence of this section activates setuptools_scm, even though it's empty

[project]
name = "umi"
authors = [{name = "Zero ASIC"}]
description = "Universal Memory Interface (UMI)"
readme = "README.md"
urls = {Homepage = "https://github.com/zeroasiccorp/umi"}
requires-python = ">= 3.8"
license = {file = "LICENSE"}
dependencies = [
"siliconcompiler",
"lambdalib==0.1.5"
]
dynamic = [
"version"
]

[project.optional-dependencies]
test = [
"switchboard-hw",
"flake8==6.0.0"
]

[tool.setuptools]
include-package-data = true
packages = [
"umi"
]
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.

26 changes: 26 additions & 0 deletions umi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from siliconcompiler import Library
import lambdalib


def _register_umi(lib):
lib.register_package_source("umi",
"python://umi")


def setup(chip):
libs = []

for name in ('umi', 'lumi'):
lib = Library(chip, name, package="umi")
_register_umi(lib)
lib.use(lambdalib)

lib.add("option", "idir", f"{name}/rtl")
lib.add("option", "ydir", f"{name}/rtl")

lib.add("option", "idir", "utils/rtl")
lib.add("option", "ydir", "utils/rtl")

libs.append(lib)

return libs
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 9 additions & 14 deletions lumi/testbench/test_lumi.py → umi/lumi/testbench/test_lumi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
import time
import random
import numpy as np
from pathlib import Path
from argparse import ArgumentParser
from switchboard import SbDut, UmiTxRx, delete_queue
from lambdalib import lambdalib
import lambdalib
import umi


def build_testbench(topo="2d", trace=False):
dut = SbDut('testbench', trace=True, trace_type='fst', default_main=True)

EX_DIR = Path('..')

# Set up inputs
dut.input('testbench_lumi.sv')
dut.input('lumi/testbench/testbench_lumi.sv', package='umi')
if topo == '2d':
print("### Running 2D topology ###")
elif topo == '3d':
Expand All @@ -28,17 +26,14 @@ def build_testbench(topo="2d", trace=False):
raise ValueError('Invalid topology')

dut.use(lambdalib)
dut.add('option', 'ydir', 'lambdalib/ramlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/stdlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/vectorlib/rtl', package='lambdalib')

for option in ['ydir', 'idir']:
dut.add('option', option, EX_DIR / 'rtl')
dut.add('option', option, EX_DIR / '..' / 'umi' / 'rtl')
dut.use(umi)
dut.add('option', 'library', ['lumi', 'umi'])
dut.add('option', 'library', 'la_stdlib')
dut.add('option', 'library', 'la_ramlib')
dut.add('option', 'library', 'la_vectorlib')

# Verilator configuration
vlt_config = EX_DIR / 'testbench' / 'config.vlt'
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', vlt_config)
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', 'lumi/testbench/config.vlt', package='umi')
# dut.set('option', 'relax', True)
dut.add('tool', 'verilator', 'task', 'compile', 'option', '--prof-cfuncs')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '-CFLAGS')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
import time
import random
import numpy as np
from pathlib import Path
from argparse import ArgumentParser
from switchboard import SbDut, UmiTxRx, delete_queue
from lambdalib import lambdalib
import lambdalib
import umi


def build_testbench(topo="2d", trace=False):
dut = SbDut('testbench', trace=True, trace_type='fst', default_main=True)

EX_DIR = Path('..')

# Set up inputs
dut.input('testbench_lumi.sv')
dut.input('lumi/testbench/testbench_lumi.sv', package='umi')
if topo == '2d':
print("### Running 2D topology ###")
elif topo == '3d':
Expand All @@ -28,17 +26,14 @@ def build_testbench(topo="2d", trace=False):
raise ValueError('Invalid topology')

dut.use(lambdalib)
dut.add('option', 'ydir', 'lambdalib/ramlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/stdlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/vectorlib/rtl', package='lambdalib')

for option in ['ydir', 'idir']:
dut.add('option', option, EX_DIR / 'rtl')
dut.add('option', option, EX_DIR / '..' / 'umi' / 'rtl')
dut.use(umi)
dut.add('option', 'library', ['lumi', 'umi'])
dut.add('option', 'library', 'la_stdlib')
dut.add('option', 'library', 'la_ramlib')
dut.add('option', 'library', 'la_vectorlib')

# Verilator configuration
vlt_config = EX_DIR / 'testbench' / 'config.vlt'
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', vlt_config)
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', 'lumi/testbench/config.vlt', package='umi')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '--prof-cfuncs')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '-CFLAGS')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '-DVL_DEBUG')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,27 @@
import multiprocessing
import random
import numpy as np
from pathlib import Path
from argparse import ArgumentParser
from switchboard import (
UmiTxRx, random_umi_packet, delete_queue,
verilator_run, SbDut)
from lambdalib import lambdalib
from switchboard import UmiTxRx, random_umi_packet, delete_queue, verilator_run, SbDut
import lambdalib
import umi


def build_testbench():
dut = SbDut('testbench', default_main=True)

EX_DIR = Path('..')
EX_DIR = EX_DIR.resolve()

# Set up inputs
dut.input('testbench_crossbar.sv')
dut.input('umi/testbench/testbench_crossbar.sv', package='umi')

dut.use(lambdalib)
dut.add('option', 'ydir', 'lambdalib/ramlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/stdlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/vectorlib/rtl', package='lambdalib')

for option in ['ydir', 'idir']:
dut.add('option', option, EX_DIR / 'rtl')
dut.use(umi)
dut.add('option', 'library', 'umi')
dut.add('option', 'library', 'la_stdlib')
dut.add('option', 'library', 'la_ramlib')
dut.add('option', 'library', 'la_vectorlib')

# Verilator configuration
vlt_config = EX_DIR / 'testbench' / 'config.vlt'
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', vlt_config)
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', 'umi/testbench/config.vlt', package='umi')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '--prof-cfuncs')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '-CFLAGS')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '-DVL_DEBUG')
Expand Down
24 changes: 8 additions & 16 deletions umi/testbench/test_fifo.py → umi/umi/testbench/test_fifo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,26 @@

import random
import numpy as np
from pathlib import Path
from argparse import ArgumentParser
from switchboard import SbDut, UmiTxRx, delete_queue, verilator_run
from lambdalib import lambdalib

THIS_DIR = Path(__file__).resolve().parent
import lambdalib
import umi


def build_testbench():
dut = SbDut('testbench', default_main=True)

EX_DIR = Path('..')
EX_DIR = EX_DIR.resolve()

# Set up inputs
dut.input('testbench_fifo.sv')
dut.input('umi/testbench/testbench_fifo.sv', package='umi')

dut.use(lambdalib)
dut.add('option', 'ydir', 'lambdalib/ramlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/stdlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/vectorlib/rtl', package='lambdalib')

for option in ['ydir', 'idir']:
dut.add('option', option, EX_DIR / 'rtl')
dut.use(umi)
dut.add('option', 'library', 'umi')
dut.add('option', 'library', 'la_stdlib')
dut.add('option', 'library', 'la_ramlib')

# Verilator configuration
vlt_config = EX_DIR / 'testbench' / 'config.vlt'
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', vlt_config)
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', 'umi/testbench/config.vlt', package='umi')
# dut.set('option', 'relax', True)
dut.add('tool', 'verilator', 'task', 'compile', 'option', '--prof-cfuncs')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '-CFLAGS')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,28 @@

import random
import numpy as np
from pathlib import Path
from argparse import ArgumentParser
from switchboard import SbDut, UmiTxRx, delete_queue, verilator_run
from lambdalib import lambdalib

THIS_DIR = Path(__file__).resolve().parent
import lambdalib
import umi


def build_testbench(split=False):
dut = SbDut('testbench', default_main=True)

EX_DIR = Path('..')
EX_DIR = EX_DIR.resolve()

# Set up inputs
dut.input('testbench_fifo_flex.sv')
dut.input('umi/testbench/testbench_fifo_flex.sv', package='umi')

dut.use(lambdalib)
dut.add('option', 'ydir', 'lambdalib/ramlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/stdlib/rtl', package='lambdalib')
dut.add('option', 'ydir', 'lambdalib/vectorlib/rtl', package='lambdalib')
dut.add('option', 'define', f'SPLIT={int(split)}')
dut.use(umi)
dut.add('option', 'library', 'umi')
dut.add('option', 'library', 'la_stdlib')
dut.add('option', 'library', 'la_ramlib')

for option in ['ydir', 'idir']:
dut.add('option', option, EX_DIR / 'rtl')
dut.add('option', 'define', f'SPLIT={int(split)}')

# Verilator configuration
vlt_config = EX_DIR / 'testbench' / 'config.vlt'
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', vlt_config)
dut.set('tool', 'verilator', 'task', 'compile', 'file', 'config', 'umi/testbench/config.vlt', package='umi')
# dut.set('option', 'relax', True)
dut.add('tool', 'verilator', 'task', 'compile', 'option', '--prof-cfuncs')
dut.add('tool', 'verilator', 'task', 'compile', 'option', '-CFLAGS')
Expand Down
Loading

0 comments on commit 58d09ff

Please sign in to comment.