Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
743bca5
refactor: [utils] convert utils to a package
machshev Sep 9, 2025
f1c3146
refactor: [flow] module rename dvsim.FlowCfg -> dvsim.flow.base
machshev Mar 14, 2025
95c4499
refactor: [flow] module rename dvsim.FormalCfg -> dvsim.flow.formal
machshev Mar 14, 2025
086e6f7
refactor: [flow] module rename dvsim.LintCfg -> dvsim.flow.lint
machshev Mar 14, 2025
18b584a
refactor: [flow] module rename dvsim.SimCfg -> dvsim.flow.sim
machshev Mar 14, 2025
e6c88b3
refactor: [flow] module rename dvsim.CdcCfg -> dvsim.flow.cdc
machshev Mar 14, 2025
d51a34c
refactor: [flow] module rename dvsim.OneShotCfg -> dvsim.flow.one_shot
machshev Mar 14, 2025
7f4c615
refactor: [flow] module rename dvsim.SynCfg -> dvsim.flow.syn
machshev Mar 14, 2025
4a985d1
refactor: [flow] module rename dvsim.CfgFactory -> dvsim.flow.factory
machshev Mar 14, 2025
b0b2b89
refactor: [launcher] module rename dvsim.LauncherFactory -> dsvsim.la…
machshev Mar 17, 2025
83dc75d
refactor: [launcher] module rename dvsim.Launcher -> dsvsim.launcher.…
machshev Mar 17, 2025
e0c087a
refactor: [launcher] module rename dvsim.LocalLauncher -> dsvsim.laun…
machshev Mar 17, 2025
d05da9f
refactor: [launcher] module rename dvsim.LsfLauncher -> dsvsim.launch…
machshev Mar 17, 2025
3fc9607
refactor: [launcher] module rename dvsim.NcLauncher -> dsvsim.launche…
machshev Mar 17, 2025
22420a3
refactor: [launcher] module rename dvsim.SgeLauncher -> dsvsim.launch…
machshev Mar 17, 2025
5edd6d9
refactor: [launcher] module rename dvsim.SlurmLauncher -> dsvsim.laun…
machshev Mar 17, 2025
0dcd724
refactor: rename dvsim.Scheduler -> dvsim.scheduler
machshev Apr 3, 2025
d334744
refactor: rename dvsim.MsgBuckets -> dvsim.msg_buckets
machshev Apr 3, 2025
18137e4
refactor: rename dvsim.SimResults -> dvsim.sim_results
machshev Apr 3, 2025
4d2e202
refactor: rename dvsim.Regression -> dvsim.regression
machshev Apr 3, 2025
d52ac40
refactor: rename dvsim.MsgBucket -> dvsim.msg_bucket
machshev Apr 3, 2025
1509b15
refactor: rename dvsim.StatusPrinter -> dvsim.utils.status_printer
machshev Apr 3, 2025
752caf0
refactor: rename dvsim.Test/Testplan -> dvsim.utils.test/testplan
machshev Apr 3, 2025
0aa3bb3
refactor: rename dvsim.Timer -> dvsim.utils.timer
machshev Apr 3, 2025
a7ddbc5
refactor: rename remaining modules and enable N999 lint
machshev Sep 9, 2025
41342eb
linting: enforce space after license comment for python files
machshev Sep 9, 2025
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

use flake

# create the venv if it doesn't yet exist
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: Python application

on:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

[project]
name = "dvsim"
version = "0.1.0"
Expand Down
1 change: 0 additions & 1 deletion ruff-ci.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ ignore = [
"TD",

# High priority fixes
"N999",
"N803",
"N818",
"N816",
Expand Down
11 changes: 9 additions & 2 deletions scripts/license_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

"""Check all files for license header."""

import subprocess
Expand All @@ -25,8 +26,10 @@

IGNORE_SUFFIXES = [".lock"]

OPTIONAL_TRAILING_NEWLINE = [".nix", ".md"]


def check_header(text: str) -> bool:
def check_header(*, text: str, trailing_newline_optional: bool = False) -> bool:
"""Check header complies with license requirmeents."""
lines = text.splitlines()

Expand All @@ -37,6 +40,7 @@ def check_header(text: str) -> bool:
LICENSE[0] in lines[i],
LICENSE[1] in lines[i + 1],
LICENSE[2] in lines[i + 2],
trailing_newline_optional or lines[i + 3] == "",
]
):
return True
Expand Down Expand Up @@ -75,7 +79,10 @@ def check_header(text: str) -> bool:

logger.debug("Checking: %s", path)

if not check_header(text):
if not check_header(
text=text,
trailing_newline_optional=path.suffix in OPTIONAL_TRAILING_NEWLINE,
):
failed.append(path)

for path in failed:
Expand Down
1 change: 1 addition & 0 deletions src/dvsim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

"""DVSim."""
29 changes: 15 additions & 14 deletions src/dvsim/cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
"""dvsim is a command line tool to deploy ASIC tool flows such as regressions
for design verification (DV), formal property verification (FPV), linting and
synthesis.

"""dvsim is a command line tool to deploy ASIC tool flows.

Examples of a supported flow is regressions for design verification (DV),
formal property verification (FPV), linting and synthesis.

It uses hjson as the format for specifying what to build and run. It is an
end-to-end regression manager that can deploy multiple builds (where some tests
Expand All @@ -29,17 +31,16 @@
import textwrap
from pathlib import Path

from dvsim.CfgFactory import make_cfg
from dvsim.Deploy import RunTest
from dvsim.Launcher import Launcher
from dvsim.LauncherFactory import set_launcher_type
from dvsim.LocalLauncher import LocalLauncher
from dvsim.LsfLauncher import LsfLauncher
from dvsim.NcLauncher import NcLauncher
from dvsim.SgeLauncher import SgeLauncher
from dvsim.SlurmLauncher import SlurmLauncher
from dvsim.Timer import Timer
from dvsim.utils import TS_FORMAT, TS_FORMAT_LONG, VERBOSE, rm_path, run_cmd_with_timeout
from dvsim.flow.factory import make_cfg
from dvsim.job.deploy import RunTest
from dvsim.launcher.base import Launcher
from dvsim.launcher.factory import set_launcher_type
from dvsim.launcher.local import LocalLauncher
from dvsim.launcher.lsf import LsfLauncher
from dvsim.launcher.nc import NcLauncher
from dvsim.launcher.sge import SgeLauncher
from dvsim.launcher.slurm import SlurmLauncher
from dvsim.utils import TS_FORMAT, TS_FORMAT_LONG, VERBOSE, Timer, rm_path, run_cmd_with_timeout

# TODO: add dvsim_cfg.hjson to retrieve this info
version = 0.1
Expand Down
1 change: 1 addition & 0 deletions src/dvsim/examples/testplanner/common_testplan.hjson
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

{
testpoints: [
{
Expand Down
1 change: 1 addition & 0 deletions src/dvsim/examples/testplanner/foo_sim_results.hjson
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

{
timestamp: 10/10/2019 1:55AM
test_results: [
Expand Down
1 change: 1 addition & 0 deletions src/dvsim/examples/testplanner/foo_testplan.hjson
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright lowRISC contributors (OpenTitan project).
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0

{
// 'name' is mandatory field
name: "foo"
Expand Down
5 changes: 5 additions & 0 deletions src/dvsim/flow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

"""Tool flow."""
Comment thread
machshev marked this conversation as resolved.
6 changes: 3 additions & 3 deletions src/dvsim/FlowCfg.py → src/dvsim/flow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

import hjson

from dvsim.CfgJson import set_target_attribute
from dvsim.LauncherFactory import get_launcher_cls
from dvsim.flow.hjson import set_target_attribute
from dvsim.launcher.factory import get_launcher_cls
from dvsim.results_server import NoGCPError, ResultsServer
from dvsim.Scheduler import Scheduler
from dvsim.scheduler import Scheduler
from dvsim.utils import (
VERBOSE,
clean_odirs,
Expand Down
5 changes: 3 additions & 2 deletions src/dvsim/CdcCfg.py → src/dvsim/flow/cdc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Class describing lint configuration object."""

from dvsim.LintCfg import LintCfg
"""Class describing lint configuration object."""

from dvsim.flow.lint import LintCfg


class CdcCfg(LintCfg):
Expand Down
14 changes: 7 additions & 7 deletions src/dvsim/CfgFactory.py → src/dvsim/flow/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import os
import sys

from dvsim.CdcCfg import CdcCfg
from dvsim.CfgJson import load_hjson
from dvsim.FormalCfg import FormalCfg
from dvsim.LintCfg import LintCfg
from dvsim.RdcCfg import RdcCfg
from dvsim.SimCfg import SimCfg
from dvsim.SynCfg import SynCfg
from dvsim.flow.cdc import CdcCfg
from dvsim.flow.formal import FormalCfg
from dvsim.flow.hjson import load_hjson
from dvsim.flow.lint import LintCfg
from dvsim.flow.rdc import RdcCfg
from dvsim.flow.sim import SimCfg
from dvsim.flow.syn import SynCfg


def _load_cfg(path, initial_values):
Expand Down
2 changes: 1 addition & 1 deletion src/dvsim/FormalCfg.py → src/dvsim/flow/formal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import hjson
from tabulate import tabulate

from dvsim.OneShotCfg import OneShotCfg
from dvsim.flow.one_shot import OneShotCfg
from dvsim.results_server import ResultsServer
from dvsim.utils import subst_wildcards

Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions src/dvsim/LintCfg.py → src/dvsim/flow/lint.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Class describing lint configuration object."""

"""Class describing lint configuration object."""

import logging as log
from pathlib import Path

from tabulate import tabulate

from dvsim.MsgBuckets import MsgBuckets
from dvsim.OneShotCfg import OneShotCfg
from dvsim.flow.one_shot import OneShotCfg
from dvsim.msg_buckets import MsgBuckets
from dvsim.utils import check_bool, subst_wildcards


Expand Down
7 changes: 4 additions & 3 deletions src/dvsim/OneShotCfg.py → src/dvsim/flow/one_shot.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Class describing a one-shot build configuration object."""

"""Class describing a one-shot build configuration object."""

import logging as log
import os
from collections import OrderedDict

from dvsim.Deploy import CompileOneShot
from dvsim.FlowCfg import FlowCfg
from dvsim.flow.base import FlowCfg
from dvsim.job.deploy import CompileOneShot
from dvsim.modes import BuildMode, Mode
from dvsim.utils import rm_path

Expand Down
5 changes: 3 additions & 2 deletions src/dvsim/RdcCfg.py → src/dvsim/flow/rdc.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""RDC Configuration Class."""

from dvsim.LintCfg import LintCfg
"""RDC Configuration Class."""

from dvsim.flow.lint import LintCfg


class RdcCfg(LintCfg):
Expand Down
15 changes: 8 additions & 7 deletions src/dvsim/SimCfg.py → src/dvsim/flow/sim.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Class describing simulation configuration object."""

"""Class describing simulation configuration object."""

import collections
import fnmatch
Expand All @@ -16,14 +17,14 @@

from tabulate import tabulate

from dvsim.Deploy import CompileSim, CovAnalyze, CovMerge, CovReport, CovUnr, RunTest
from dvsim.FlowCfg import FlowCfg
from dvsim.flow.base import FlowCfg
from dvsim.job.deploy import CompileSim, CovAnalyze, CovMerge, CovReport, CovUnr, RunTest
from dvsim.modes import BuildMode, Mode, RunMode, find_mode
from dvsim.Regression import Regression
from dvsim.regression import Regression
from dvsim.results_server import ResultsServer
from dvsim.SimResults import SimResults
from dvsim.Test import Test
from dvsim.Testplan import Testplan
from dvsim.sim_results import SimResults
from dvsim.test import Test
from dvsim.testplan import Testplan
from dvsim.utils import TS_FORMAT, rm_path

# This affects the bucketizer failure report.
Expand Down
5 changes: 3 additions & 2 deletions src/dvsim/SynCfg.py → src/dvsim/flow/syn.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""Class describing synthesis configuration object."""

"""Class describing synthesis configuration object."""

import logging as log
from pathlib import Path

import hjson
from tabulate import tabulate

from dvsim.OneShotCfg import OneShotCfg
from dvsim.flow.one_shot import OneShotCfg
from dvsim.utils import print_msg_list, subst_wildcards


Expand Down
5 changes: 5 additions & 0 deletions src/dvsim/job/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

"""DVSim jobs."""
Comment thread
machshev marked this conversation as resolved.
4 changes: 2 additions & 2 deletions src/dvsim/Deploy.py → src/dvsim/job/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

from tabulate import tabulate

from dvsim.JobTime import JobTime
from dvsim.LauncherFactory import get_launcher
from dvsim.job.time import JobTime
from dvsim.launcher.factory import get_launcher
from dvsim.sim_utils import get_cov_summary_table, get_job_runtime, get_simulated_time
from dvsim.utils import (
VERBOSE,
Expand Down
3 changes: 2 additions & 1 deletion src/dvsim/JobTime.py → src/dvsim/job/time.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
r"""An abstraction for maintaining job runtime and its units."""

"""An abstraction for maintaining job runtime and its units."""

import unittest
from copy import copy
Expand Down
5 changes: 5 additions & 0 deletions src/dvsim/launcher/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

"""Job launcher."""
Comment thread
machshev marked this conversation as resolved.
File renamed without changes.
12 changes: 6 additions & 6 deletions src/dvsim/LauncherFactory.py → src/dvsim/launcher/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import logging as log
import os

from dvsim.Launcher import Launcher
from dvsim.LocalLauncher import LocalLauncher
from dvsim.LsfLauncher import LsfLauncher
from dvsim.NcLauncher import NcLauncher
from dvsim.SgeLauncher import SgeLauncher
from dvsim.SlurmLauncher import SlurmLauncher
from dvsim.launcher.base import Launcher
from dvsim.launcher.local import LocalLauncher
from dvsim.launcher.lsf import LsfLauncher
from dvsim.launcher.nc import NcLauncher
from dvsim.launcher.sge import SgeLauncher
from dvsim.launcher.slurm import SlurmLauncher

try:
from edacloudlauncher.EdaCloudLauncher import EdaCloudLauncher
Expand Down
3 changes: 2 additions & 1 deletion src/dvsim/LocalLauncher.py → src/dvsim/launcher/local.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

"""Launcher implementation to run jobs as subprocesses on the local machine."""

import datetime
Expand All @@ -9,7 +10,7 @@
import subprocess
from pathlib import Path

from dvsim.Launcher import ErrorMessage, Launcher, LauncherBusy, LauncherError
from dvsim.launcher.base import ErrorMessage, Launcher, LauncherBusy, LauncherError


class LocalLauncher(Launcher):
Expand Down
2 changes: 1 addition & 1 deletion src/dvsim/LsfLauncher.py → src/dvsim/launcher/lsf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import tarfile
from pathlib import Path

from dvsim.Launcher import ErrorMessage, Launcher, LauncherError
from dvsim.launcher.base import ErrorMessage, Launcher, LauncherError
from dvsim.utils import VERBOSE, clean_odirs


Expand Down
Loading
Loading