-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup
- Loading branch information
Showing
173 changed files
with
218 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[flake8] | ||
max-line-length = 100 | ||
extend-exclude = build | ||
extend-ignore = |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: CI | ||
on: | ||
# Runs on all pushes to branches | ||
push: | ||
# Runs on all PRs | ||
pull_request: | ||
# Manual Dispatch | ||
workflow_dispatch: | ||
|
||
jobs: | ||
lint_python: | ||
name: Lint Python Code | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
- name: Lint with Flake8 | ||
run: | | ||
pip install --upgrade pip | ||
pip install .[dev] | ||
flake8 --statistics . | ||
check_paths: | ||
name: Run CI | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
- name: Run tests | ||
run: | | ||
pip install --upgrade pip | ||
pip install -e .[dev] | ||
pytest |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Wheels | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
build_wheels: | ||
name: Wheels lambdalib | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: hynek/build-and-inspect-python-package@v1 | ||
|
||
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@v3 | ||
with: | ||
name: Packages | ||
path: dist | ||
|
||
- name: Publish | ||
uses: pypa/[email protected] | ||
|
||
save: | ||
needs: [publish] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
with: | ||
name: Packages | ||
path: dist | ||
|
||
- name: Add wheels to GitHub release artifacts | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: dist/*.whl |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,6 @@ a.out | |
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
lambdalib.egg-info/ | ||
build/ | ||
dist/ |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import os | ||
import pkg_resources | ||
try: | ||
__version__ = pkg_resources.get_distribution('lambdalib').version | ||
except: # noqa E722 | ||
__version__ = None | ||
|
||
|
||
def register_data_source(chip): | ||
# check if local | ||
root_path = os.path.dirname(os.path.dirname(__file__)) | ||
test_path = os.path.join(root_path, 'lambdalib', 'iolib', 'rtl', 'la_ioanalog.v') | ||
if os.path.exists(test_path): | ||
path = root_path | ||
ref = None | ||
else: | ||
path = 'git+https://github.com/siliconcompiler/lambdalib.git' | ||
ref = f'v{__version__}' | ||
|
||
chip.register_package_source(name='lambdalib', | ||
path=path, | ||
ref=ref) |
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.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
import siliconcompiler | ||
from lambdalib import register_data_source | ||
from siliconcompiler import Library | ||
import os | ||
|
||
|
||
######################## | ||
# SiliconCompiler Setup | ||
######################## | ||
|
||
def setup(target=None): | ||
def setup(chip): | ||
'''Lambdalib library setup script''' | ||
|
||
# Create chip object | ||
chip = siliconcompiler.Chip('lambdalib') | ||
|
||
# Project sources | ||
root = os.path.realpath(os.path.join(os.path.dirname(__file__), '..')) | ||
root = os.path.dirname(__file__) | ||
|
||
dependencies = { | ||
'iolib': ['stdlib'], | ||
'stdlib': [], | ||
'ramlib': ['stdlib'], | ||
'padring': ['stdlib'], | ||
'syslib': ['stdlib'], | ||
'vectorlib': ['stdlib'] | ||
} | ||
|
||
register_data_source(chip) | ||
|
||
libs = [] | ||
# Iterate over all libs | ||
for item in ['iolib', 'stdlib', 'ramlib', 'padring']: | ||
chip.add('option', 'ydir', f"{root}/{item}/rtl") | ||
chip.add('option', 'idir', f"{root}/{item}/rtl") | ||
for name, dep in dependencies.items(): | ||
lib = Library(chip, f'la_{name}', package='lambdalib') | ||
|
||
for path in [name, *dep]: | ||
lib.add('option', 'ydir', f"{root}/{path}/rtl") | ||
lib.add('option', 'idir', f"{root}/{path}/rtl") | ||
|
||
libs.append(lib) | ||
|
||
return chip | ||
return libs |
This file contains 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
This file contains 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
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.
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.
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.
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.
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.
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.
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.
This file contains 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
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] | ||
include-package-data = false | ||
packages = [ | ||
"lambdalib" | ||
] | ||
|
||
[project] | ||
name = "lambdalib" | ||
authors = [{name = "Zero ASIC"}] | ||
description = "Standardized ASIC design libraries" | ||
readme = "README.md" | ||
urls = {Homepage = "https://github.com/siliconcompiler/lambdalib"} | ||
requires-python = ">= 3.8" | ||
license = {file = "LICENSE"} | ||
dependencies = [ | ||
"siliconcompiler >= 0.17.0" | ||
] | ||
version = "0.1.0" | ||
|
||
[tool.pytest.ini_options] | ||
testpaths = "tests" | ||
timeout = "60" | ||
|
||
[project.optional-dependencies] | ||
# Dev dependencies. | ||
dev = [ | ||
"flake8 >= 5.0.0", | ||
"pytest >= 6.2.4", | ||
"pytest-timeout >= 2.1.0" | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from siliconcompiler import Chip | ||
from lambdalib import register_data_source | ||
|
||
|
||
def test_local_install_detection(): | ||
chip = Chip('<test>') | ||
register_data_source(chip) | ||
assert 'git+https' not in chip.get('package', 'source', 'lambdalib', 'path') |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from siliconcompiler import Chip | ||
|
||
from lambdalib import lambdalib | ||
|
||
|
||
def test_pdk_paths(): | ||
chip = Chip('<lib>') | ||
chip.use(lambdalib) | ||
assert chip.check_filepaths() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from siliconcompiler import Chip | ||
|
||
from lambdalib import lambdalib | ||
|
||
|
||
def test_setup_without_depencency(): | ||
chip = Chip('<lib>') | ||
chip.use(lambdalib) | ||
|
||
assert 'la_stdlib' in chip.getkeys('library') | ||
|
||
assert len(chip.get('library', 'la_stdlib', 'option', 'ydir')) == 1 | ||
|
||
|
||
def test_setup_with_depencency(): | ||
chip = Chip('<lib>') | ||
chip.use(lambdalib) | ||
|
||
assert 'la_stdlib' in chip.getkeys('library') | ||
assert 'la_iolib' in chip.getkeys('library') | ||
assert 'la_ramlib' in chip.getkeys('library') | ||
|
||
assert len(chip.get('library', 'la_iolib', 'option', 'ydir')) == 2 | ||
assert len(chip.get('library', 'la_ramlib', 'option', 'ydir')) == 2 |