Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
202 changes: 202 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 109 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
{
description = "OpenTitan EDA development environment";

inputs = {
# Pinned to nixos-26.05 to match lowrisc-nix and because that channel ships
# Verilator 5.048.
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
flake-utils.url = "github:numtide/flake-utils";

# uv2nix builds the Python environment straight from this repo's
# pyproject.toml + uv.lock
pyproject-nix = {
url = "github:nix-community/pyproject.nix";
inputs.nixpkgs.follows = "nixpkgs";
};

uv2nix = {
url = "github:pyproject-nix/uv2nix";
inputs = {
pyproject-nix.follows = "pyproject-nix";
nixpkgs.follows = "nixpkgs";
};
};

pyproject-build-systems = {
url = "github:pyproject-nix/build-system-pkgs";
inputs = {
pyproject-nix.follows = "pyproject-nix";
uv2nix.follows = "uv2nix";
nixpkgs.follows = "nixpkgs";
};
};

# Provides mkEdaShell (the EDA devshell builder)
lowrisc-nix.url = "github:lowRISC/lowrisc-nix";
};

nixConfig = {
extra-substituters = ["https://nix-cache.lowrisc.org/public/"];
extra-trusted-public-keys = ["nix-cache.lowrisc.org-public-1:O6JLD0yXzaJDPiQW1meVu32JIDViuaPtGDfjlOopU7o="];
};

outputs = {
nixpkgs,
flake-utils,
pyproject-nix,
uv2nix,
pyproject-build-systems,
lowrisc-nix,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
python = pkgs.python312;

# OpenTitan's Python environment, built from this repo's own pyproject.toml
# + uv.lock. It bundles fusesoc and dvsim along with every other OpenTitan
# Python dependency, so the sim flow's `gen_sv_flist` step (which shells out
# to fusesoc) and dvsim itself are both on PATH inside the shell.
workspace = uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
# Prefer prebuilt wheels: they need no per-package build-system overrides
# and are auto-patchelfed by pyproject.nix, which avoids building native
# deps (rpds-py/libcst's Rust, libclang, ...) from source.
overlay = workspace.mkPyprojectOverlay {sourcePreference = "wheel";};
pythonSet = (pkgs.callPackage pyproject-nix.build.packages {inherit python;})
.overrideScope (
lib.composeManyExtensions [
pyproject-build-systems.overlays.default
overlay
# Declares build systems for the sdist-only stragglers (crcmod, ...).
# Inert for deps that resolve to a prebuilt wheel above.
(lowrisc-nix.lib.pyprojectOverrides {inherit pkgs;})
]
);
pythonEnv = pythonSet.mkVirtualEnv "opentitan-env" workspace.deps.default;

# Commercial EDA tool shell, built on lowrisc-nix's generic mkEdaShell.
# Enter with `nix develop .`. It execs into a hermetic FHS sandbox, so
# it is not direnv-loadable and must be entered explicitly.
#
# Tool install paths and license servers are supplied at *runtime* from the
# JSON file named by $LOWRISC_EDA_CONFIG (the flake only declares which
# vendor tools + versions are wanted); without that config the shell still
# works and just warns. See lowrisc-nix lib/README-eda.md.
eda = lowrisc-nix.lib.mkEdaShell {
inherit pkgs;
name = "opentitan-eda";
tools = builtins.fromJSON (builtins.readFile ./tool_data.json);
# OpenTitan Python env (fusesoc, dvsim, ...) plus the open-source tools
# that ship in nixpkgs. Verilator 5.048 is the nixos-26.05 version, so no
# override is needed.
extraDeps = [pythonEnv];
extraPkgs = [pkgs.verilator];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add verible

};
in {
packages.pythonEnv = pythonEnv;

devShells = {
inherit eda;
default = eda;
};

formatter = pkgs.alejandra;
});
}
44 changes: 44 additions & 0 deletions tool_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[
{
"name": "AscentLint",
"vendor": "RealIntent",
"version": "2022.A.P23.1.2026_01_29",
"comment": "RTL lint (Real Intent Ascent Lint)."
},
{
"name": "Jasper",
"vendor": "Cadence",
"version": "2025.09",
"comment": "Formal verification."
},
{
"name": "MeridianCDC",
"vendor": "RealIntent",
"version": "2022.A.P24.3.2025_12_16",
"comment": "Clock-domain-crossing (CDC) analysis."
},
{
"name": "MeridianRDC",
"vendor": "RealIntent",
"version": "2022.A.P14.4.RDC_.2025_12_16",
"comment": "Reset-domain-crossing (RDC) analysis."
},
{
"name": "VCS",
"vendor": "Synopsys",
"version": "X-2025.06-SP2-1",
"comment": "RTL simulator."
},
{
"name": "Vivado",
"vendor": "Xilinx",
"version": "2025.1",
"comment": "Used to build FPGA bitstreams."
},
{
"name": "Xcelium",
"vendor": "Cadence",
"version": "24.03-s007",
"comment": "Provides xrun for simulations and is used to run our full UVM verification environment."
}
]
Loading
Loading