Skip to content
Merged
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
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Copyright lowRISC and contributors (COSMIC project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: CI

on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
merge_group:
branches: ["main"]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint-check:
runs-on: ubuntu-26.04

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0 # Required so we can lint commit messages and diffs.

- uses: actions/setup-python@v7
with:
python-version: '3.12'

- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install .
rm -r *.egg-info

- name: License check
run: reuse lint

- name: Commit metadata check
if: ${{ github.event_name == 'pull_request' }}
run: hw/vendor/lowrisc_ip/ci/scripts/lint-commits.sh "$GITHUB_BASE_REF"
1 change: 1 addition & 0 deletions LICENSES/Apache-2.0.txt
Comment thread
raylau1 marked this conversation as resolved.
Resolved
9 changes: 9 additions & 0 deletions REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Licenses and Copyright information for top-level files and directories that
# couldn't otherwise contain it.

version = 1

[[annotations]]
path = ["*", "doc/**"]
SPDX-FileCopyrightText = "lowRISC and contributors (COSMIC project)."
SPDX-License-Identifier = "Apache-2.0"
159 changes: 159 additions & 0 deletions flake.lock

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

124 changes: 124 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# Copyright lowRISC and contributors (COSMIC project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
{
description = "UART 16550 Hardware IP Block is part of the COSMIC project.";
inputs = {
lowrisc-nix.url = "github:lowRISC/lowrisc-nix";

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

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

outputs = {
nixpkgs,
flake-utils,
lowrisc-nix,
...
} @ inputs: let
system_outputs = system: let
pkgs = import nixpkgs {inherit system;};
lrPkgs = lowrisc-nix.outputs.packages.${system};

workspace = inputs.uv2nix.lib.workspace.loadWorkspace {workspaceRoot = ./.;};
overlay = workspace.mkPyprojectOverlay {
sourcePreference = "wheel";
};

pythonSet =
(pkgs.callPackage inputs.pyproject-nix.build.packages {
python = pkgs.python312;
}).overrideScope
(
pkgs.lib.composeManyExtensions [
inputs.pyproject-build-systems.overlays.default
overlay
(lowrisc-nix.lib.pyprojectOverrides {inherit pkgs;})
]
);

pythonEnv = pythonSet.mkVirtualEnv "python-env" workspace.deps.default;
in rec {
formatter = pkgs.alejandra;
devShells = rec {
default = dev;
# Development shell, built on lowrisc-nix's generic mkEdaShell. Commercial
# EDA tools (Xcelium, Jasper, Vivado) are declared via tool_data.json and
# resolved at runtime from the JSON file named by $LOWRISC_EDA_CONFIG.
# This execs a hermetic FHS sandbox and is not direnv-loadable.
dev = lowrisc-nix.lib.mkEdaShell {
inherit pkgs;
name = "dev";
tools = builtins.fromJSON (builtins.readFile ./tool_data.json);
extraDeps =
(with pkgs; [
bison
flex
gtkwave
uv
pythonEnv
autoconf
pkg-config
zlib
zlib.dev
])
++ (with lrPkgs; [
verilator_5_054
]);
# Project env, appended after the EDA setup (mkEdaShell has no `env`
# attr — buildFHSEnv takes a bash profile fragment instead).
profile = ''
# Prevent uv from managing Python downloads; force the nixpkgs interpreter.
export UV_PYTHON_DOWNLOADS=never
export UV_PYTHON=${pythonSet.python.interpreter}
'';
};
# Minimal CI shell without verilator to speed up build time
ci = lowrisc-nix.lib.mkEdaShell {
inherit pkgs;
name = "ci";
tools = builtins.fromJSON (builtins.readFile ./tool_data.json);
extraDeps =
(with pkgs; [
uv
pythonEnv
]);
# Project env, appended after the EDA setup (mkEdaShell has no `env`
# attr — buildFHSEnv takes a bash profile fragment instead).
profile = ''
# Prevent uv from managing Python downloads; force the nixpkgs interpreter.
export UV_PYTHON_DOWNLOADS=never
export UV_PYTHON=${pythonSet.python.interpreter}
'';
};
};

apps = {
# Non-interactive entry point into development shells
dev = devShells.dev.app;
ci = devShells.ci.app;
};
};
in
flake-utils.lib.eachDefaultSystem system_outputs;
}
8 changes: 8 additions & 0 deletions hw/ip/REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Licenses and Copyright for IPs

version = 1

[[annotations]]
path = ["uart16550/**"]
SPDX-License-Identifier = "Apache-2.0"
SPDX-FileCopyrightText = ["lowRISC and contributors (COSMIC project)."]
13 changes: 13 additions & 0 deletions hw/vendor/REUSE.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Licenses and Copyright for Vendored Projects

version = 1

[[annotations]]
path = ["lowrisc_ip/**"]
SPDX-License-Identifier = "Apache-2.0"
SPDX-FileCopyrightText = ["lowRISC contributors (OpenTitan project)."]

[[annotations]]
path = ["patches/**"]
SPDX-License-Identifier = "Apache-2.0"
SPDX-FileCopyrightText = ["lowRISC and contributors (COSMIC project)."]
8 changes: 6 additions & 2 deletions hw/vendor/lowrisc_ip.vendor.hjson
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright lowRISC contributors.
// Copyright lowRISC and contributors (COSMIC project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
{
Expand All @@ -23,6 +23,10 @@
// Tool version checks used by the lint cores
{from: "hw/check_tool_requirements.core", to: "check_tool_requirements.core"},
{from: "hw/check_tool_requirements.py", to: "check_tool_requirements.py"},
{from: "hw/tool_requirements.py", to: "tool_requirements.py"},
{from: "hw/tool_requirements.py", to: "tool_requirements.py", patch_dir: "scripts"},

// Commit linting scripts
{from: "util/lint_commits.py", to: "util/lint_commits.py"},
{from: "ci/scripts/lint-commits.sh", to: "ci/scripts/lint-commits.sh", patch_dir: "ci"},
]
}
Loading