-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnoxfile.py
More file actions
94 lines (80 loc) · 2.79 KB
/
noxfile.py
File metadata and controls
94 lines (80 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : noxfile.py
# License : MIT license <Check LICENSE>
# Author : Anderson I. da Silva (aignacio) <anderson@aignacio.com>
# Date : 08.10.2023
# Last Modified Date: 30.09.2024
import nox
import os
TOP_MODULE = "jtag_axi_wrapper"
SRC_DIR = "rtl"
BUS_ARCH_DIR = "rtl/bus_arch_sv_pkg"
INCLUDE_DIR = "rtl/include"
SLANG_CMD = "slang"
@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10", "3.12"], reuse_venv=True)
def run(session):
session.env["DUT"] = TOP_MODULE
session.env["SIM"] = "verilator"
session.env["TIMEPREC"] = "1ps"
session.env["TIMEUNIT"] = "1ns"
session.install(
"pytest",
"pytest-sugar",
"pytest-xdist",
"pytest-split",
"cocotb >= 1.9.0",
"cocotbext-axi",
"pyftdi"
)
session.run("py.test",
"-n", "auto", "-rP", "tests", *session.posargs)
@nox.session(reuse_venv=True)
def sv_lint(session):
slang_command = get_sv()
slang_command.append("--lint-only")
# session.log(f"Running: {' '.join(slang_command)}")
session.run(*slang_command, external=True)
@nox.session(reuse_venv=True)
def sv_pre(session):
slang_command = get_sv()
slang_command.append("--preprocess")
slang_command.append("--comments")
slang_command += [">", "RM_ME_rtl_pp.sv"]
# session.log(f"Running: {' '.join(slang_command)}")
session.run("bash", "-c", " ".join(slang_command), external=True)
@nox.session(reuse_venv=True)
def sv_run(session):
slang_command = get_sv()
# session.log(f"Running: {' '.join(slang_command)}")
session.run(*slang_command, external=True)
def get_sv():
"""Gather all SystemVerilog files and run slang with an include directory."""
# Recursively find all .sv files in the SRC_DIR
sv_files = []
for root, _, files in os.walk(BUS_ARCH_DIR):
for file in files:
if file.endswith(".sv"):
sv_files.append(os.path.join(root, file))
for root, _, files in os.walk(INCLUDE_DIR):
for file in files:
if file.endswith(".sv"):
sv_files.append(os.path.join(root, file))
for root, _, files in os.walk(SRC_DIR):
for file in files:
if file.endswith(".sv"):
sv_files.append(os.path.join(root, file))
# Check if there are any SystemVerilog files found
if not sv_files:
session.error("No SystemVerilog files found in the source directory.")
# Construct the slang command with include directory
slang_command = [
SLANG_CMD,
"--include-directory",
INCLUDE_DIR,
"--top",
TOP_MODULE,
"-Weverything",
# ] + sv_files
] + sv_files + ["--single-unit", "--libraries-inherit-macros"]
return slang_command