16 Commits

Author SHA1 Message Date
Byron Lathi
2df2a5554c Set language type to verilog
All checks were successful
Publish Package / Build Package (push) Successful in 8s
Publish Package / Deploy Package (push) Successful in 9s
hate vhdl
2025-11-22 16:56:02 -08:00
Byron Lathi
61360509b0 Catch exception
All checks were successful
Publish Package / Build Package (push) Successful in 8s
Publish Package / Deploy Package (push) Successful in 8s
2025-11-22 16:29:37 -08:00
Byron Lathi
f0bc193271 Fix verilator control files
All checks were successful
Publish Package / Build Package (push) Successful in 7s
Publish Package / Deploy Package (push) Successful in 9s
2025-11-22 16:24:40 -08:00
Byron Lathi
d4930c909a Fix for cocotb 2
All checks were successful
Publish Package / Build Package (push) Successful in 8s
Publish Package / Deploy Package (push) Successful in 9s
2025-11-22 16:12:57 -08:00
Byron Lathi
6cfa6ba36a Bump verison
All checks were successful
Publish Package / Build Package (push) Successful in 7s
Publish Package / Deploy Package (push) Successful in 8s
2025-11-09 14:10:22 -08:00
7e8e15932a Merge pull request 'dev/trace_fst' (#1) from dev/trace_fst into master
Some checks failed
Publish Package / Build Package (push) Successful in 8s
Publish Package / Deploy Package (push) Failing after 8s
Reviewed-on: #1
2025-11-09 14:09:57 -08:00
Byron Lathi
2d3d02eee9 Try 2
All checks were successful
Publish Package / Build Package (push) Successful in 7s
Publish Package / Deploy Package (push) Successful in 9s
2025-11-09 14:00:53 -08:00
Byron Lathi
de3205bda7 Trace FST
All checks were successful
Publish Package / Build Package (push) Successful in 7s
Publish Package / Deploy Package (push) Successful in 9s
2025-11-09 13:44:59 -08:00
Byron Lathi
775e16e3f7 Add actions
All checks were successful
Publish Package / Build Package (push) Successful in 9s
Publish Package / Deploy Package (push) Successful in 10s
2025-11-08 14:33:28 -08:00
Byron Lathi
c22bf1eb0b Add timing option
todo: add args from yaml
2025-07-16 22:30:16 -07:00
Byron Lathi
1addf6e52f Merge branch 'filter_verilog' into 'master'
Filter out only verilog sources (and verilator lint files)

See merge request bslathi19/fpga-sim!4
2025-03-30 04:37:30 +00:00
Byron Lathi
443a99e477 Filter out only verilog sources (and verilator lint files) 2025-03-29 19:39:35 -07:00
Byron Lathi
85d3435fe8 Merge branch 'experimental/incdirs' into 'master'
Experimental/incdirs

See merge request bslathi19/fpga-sim!3
2025-03-21 05:45:28 +00:00
Byron Lathi
1b1d3f8def Experimental/incdirs 2025-03-21 05:45:28 +00:00
Byron Lathi
934160d619 Limit number of jobs for verilator 2025-02-25 08:09:11 -08:00
Byron Lathi
75184afd8f Merge branch 'quote_compat' into 'master'
Fix quotes for old python compatibility

See merge request bslathi19/fpga-sim!2
2025-02-08 23:01:08 +00:00
4 changed files with 80 additions and 16 deletions

View File

@@ -0,0 +1,37 @@
name: Publish Package
on: [push]
jobs:
build:
name: Build Package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: python3 -m pip install build --user
- run: python -m build
- uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
deploy:
name: Deploy Package
needs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- run: python3 -m pip install twine --user
- uses: actions/download-artifact@v3
name: python-package-distributions
path: dist/ # Does this even do anything?
- run: ls -laR python-package-distributions
- run: TWINE_PASSWORD=${{ secrets.PYPI_PAT }} TWINE_USERNAME=bslathi19 python -m twine upload --repository-url ${{ vars.CI_API_URL }} python-package-distributions/*

View File

@@ -35,7 +35,7 @@ name = "fpga-sim" # REQUIRED, is the only field that cannot be marked as dynami
# https://packaging.python.org/guides/single-sourcing-package-version/
# dynamic = ["version"]
version = "0.2.1" # REQUIRED, although can be dynamic
version = "0.5.2" # REQUIRED, although can be dynamic
# This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field:
@@ -122,8 +122,8 @@ classifiers = [
# https://packaging.python.org/discussions/install-requires-vs-requirements/
dependencies = [
"pyyaml",
"cocotb",
"rtl-manifest"
"cocotb>=2",
"rtl-manifest>=0.3.1"
]
# List additional groups of dependencies here (e.g. development

View File

@@ -1,4 +1,8 @@
-i https://git.byronlathi.com/api/v4/projects/95/packages/pypi/simple
setuptools
wheel
build
twine
cocotb
rtl-manifest
pyyaml

View File

@@ -1,11 +1,11 @@
from ast import parse
from email.mime import base
import os
import sys
import argparse
from cocotb.runner import get_runner
import subprocess
from cocotb_tools.runner import get_runner, VerilatorControlFile
from rtl_manifest import rtl_manifest
@@ -22,6 +22,7 @@ def fpga_sim_main():
parser.add_argument("yaml")
parser.add_argument("test_name", nargs="?")
parser.add_argument("-j", "--jobs", default=1)
args = parser.parse_args()
@@ -78,7 +79,9 @@ def fpga_sim_main():
sim = os.getenv("SIM", "verilator")
runner = get_runner(sim)
os.environ["MAKEFLAGS"] = "-j"
jobs = args.jobs
print(jobs)
os.environ["MAKEFLAGS"] = f"-j{jobs}"
tests_to_run = []
@@ -92,18 +95,38 @@ def fpga_sim_main():
# Turn this into a multiprocessing pool
for test in tests_to_run:
sources = rtl_manifest.read_sources(f"{test['base_path']}/{test['sources']}")
sources, incdirs = rtl_manifest.parse(f"{test['base_path']}/{test['sources']}")
runner.build(
verilog_sources=sources,
hdl_toplevel=test["toplevel"],
build_dir=f"{test['base_path']}/sim_build",
waves=test["waves"],
defines=defines
)
verilog_sources = list(filter(lambda s: (s.endswith(".v") or s.endswith(".sv")), sources))
verilator_sources = [VerilatorControlFile(s) for s in list(filter(lambda s: (s.endswith(".vlt")), sources))]
sources = []
sources.extend(verilog_sources)
sources.extend(verilator_sources)
build_args = ["--timing"]
# By default, verilator only uses vcd instead of fst, but fst is better.
if test["waves"]:
build_args.append("--trace-fst")
try:
runner.build(
sources=sources,
includes=incdirs,
hdl_toplevel=test["toplevel"],
build_dir=f"{test['base_path']}/sim_build",
waves=test["waves"],
defines=defines,
build_args=build_args
)
except subprocess.CalledProcessError:
print("Failed to compile")
return
result_xml = f"../sim_build/{test['name']}_results.xml".replace(" ", "_")
sys.path.append(test["base_path"])
runner.test(hdl_toplevel=test["toplevel"], test_module=test["modules"], waves=test["waves"], results_xml=result_xml)
runner.test(hdl_toplevel_lang="verilog", hdl_toplevel=test["toplevel"], test_module=test["modules"], waves=test["waves"], results_xml=result_xml)