Browse Source

init uv, use nix for synthesized picorv32

master
stefan 1 week ago
parent
commit
18070f6537
  1. 2
      .gitmodules
  2. 1
      .python-version
  3. 1
      circuits/picorv32
  4. 2
      kyupy
  5. 24
      main.py
  6. 1
      picorv32
  7. 16
      pyproject.toml
  8. 38
      shell.nix

2
.gitmodules vendored

@ -3,5 +3,5 @@
url = https://git.vlab.cse.kyutech.ac.jp/stefan/kyupy.git url = https://git.vlab.cse.kyutech.ac.jp/stefan/kyupy.git
branch = devel branch = devel
[submodule "circuits/picorv32"] [submodule "circuits/picorv32"]
path = circuits/picorv32 path = picorv32
url = git@github.com:s-holst/picorv32.git url = git@github.com:s-holst/picorv32.git

1
.python-version

@ -0,0 +1 @@
3.12

1
circuits/picorv32

@ -1 +0,0 @@
Subproject commit d438ffd49054288dc6d025e0a0ad2ae3cc1cfe1f

2
kyupy

@ -1 +1 @@
Subproject commit f0b55eed271941db16687dbc625a18ef2e96f25d Subproject commit c4aecbd6c94e86a18a3a7faab14789e84af61280

24
main.py

@ -0,0 +1,24 @@
#!/usr/bin/env -S uv run
from pathlib import Path
from kyupy import verilog
from kyupy.techlib import SKY130
def path_for(circuit: str):
import subprocess
return Path(subprocess.check_output(
["nix", "build", "--print-out-paths", "--no-link",
f"github:s-holst/benchmark-circuits#{circuit}" ],
text=True,
).strip())
def verilog_nl_path_for(circuit: str):
return next(path_for(circuit).glob("*/nl/*.nl.v"))
def main():
c = verilog.load(verilog_nl_path_for("picorv32-sky130"), tlib=SKY130)
c.resolve_tlib_cells(SKY130)
for kind, count in sorted(c.stats.items()): print(f'{kind:10s} {count}')
if __name__ == "__main__":
main()

1
picorv32

@ -0,0 +1 @@
Subproject commit cf92946d63004dc398df307ef44adce5505f65e2

16
pyproject.toml

@ -0,0 +1,16 @@
[project]
name = "infield"
version = "0.1.0"
description = "Add your description here"
requires-python = ">=3.12,<3.14"
dependencies = [
"kyupy",
]
[tool.uv.workspace]
members = [
"kyupy",
]
[tool.uv.sources]
kyupy = { workspace = true, editable = true }

38
shell.nix

@ -0,0 +1,38 @@
#
# This file defines a development shell containing:
# - hardware synthesis and simulation tools
# - riscv32 cross-compiling toolchain
#
# Enable this shell by calling 'nix-shell' in the same directory as this file.
#
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/release-25.11";
pkgs = (import nixpkgs {}).pkgsCross.riscv32-embedded;
in
# callPackage is needed due to https://github.com/NixOS/nixpkgs/pull/126844
pkgs.pkgsStatic.callPackage ({ pkgs }: pkgs.mkShell {
# these tools run on the build platform, but are configured to target the host platform
nativeBuildInputs = with pkgs; [ pkg-config file ];
# libraries needed for the host platform
buildInputs = with pkgs; [ zlib ];
# tools running on build platform and target the build platform
depsBuildBuild = with pkgs; [
python3
gcc
yosys
sby
nextpnr
arachne-pnr
icestorm
z3
boolector
yices
iverilog
verilator
];
}) {}
Loading…
Cancel
Save