From 32df506f38e45103d35ce167aec77814d752943d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Thu, 26 Feb 2026 13:23:37 +0000 Subject: [PATCH 1/2] feat(fusesoc): Add fusesoc makefile targets; Update README.md, py2hwsw version, and core description; Use SemVer version format. --- Makefile | 94 ++++++++++++++++++++++++++++++++++++++++++++++------ README.md | 10 +++--- default.nix | 4 +-- iob_cache.py | 4 +-- 4 files changed, 94 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index aebbfb4..79dd91b 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ endif # ifndef PY_PARAMS BUILD_DIR ?= $(shell nix-shell --run "py2hwsw $(CORE) print_build_dir --py_params '$(PY_PARAMS)'") NAME ?= $(shell nix-shell --run "py2hwsw $(CORE) print_core_name --py_params '$(PY_PARAMS)'") VERSION ?= $(shell nix-shell --run "py2hwsw $(CORE) print_core_version --py_params '$(PY_PARAMS)'") - +CORE_NAME=$(shell nix-shell --run "py2hwsw $(CORE) print_core_name --py_params '$(PY_PARAMS)'") DOC ?= ug @@ -92,30 +92,104 @@ clean: .PHONY: clean +# +# FuseSoC Targets +# + fusesoc-export: clean setup nix-shell --run "py2hwsw $(CORE) export_fusesoc --build_dir '$(BUILD_DIR)' --py_params '$(PY_PARAMS)'" .PHONY: fusesoc-export -CORE_NAME=$(shell nix-shell --run "py2hwsw $(CORE) print_core_name --py_params '$(PY_PARAMS)'") +# Check if the target is `fusesoc-core-file` and define variables for it +ifneq ($(filter fusesoc-%,$(MAKECMDGOALS)),) + +FS_REPO_NAME := $(subst _,-,$(CORE))-fs +# Get the latest commit hash from the remote repository +# NOTE: If you do not have write permissions to the IObundle repo, change the REPO_URL to your fork +REPO_URL := https://github.com/IObundle/$(FS_REPO_NAME) +$(info FuseSoC repo URL $(REPO_URL)) + +LATEST_FS_COMMIT = $(shell git ls-remote $(REPO_URL) HEAD | awk '{print $$1}') + +# Using .tar.gz file from releases tab. Supported by fusesoc tool, but not yet supported by https://cores.fusesoc.net/ +# define MULTILINE_TEXT +# provider: +# name: url +# url: https://github.com/IObundle/$(subst _,-,$(CORE))/releases/latest/download/$(CORE)_V$(VERSION).tar.gz +# filetype: tar +# endef +# Alternative: Using sources from *-fs repo. Supported by fusesoc tool and https://cores.fusesoc.net/ define MULTILINE_TEXT provider: - name: url - url: https://github.com/IObundle/iob-cache/releases/latest/download/$(CORE_NAME)_V$(VERSION).tar.gz - filetype: tar + name: github + user: IObundle + repo: $(FS_REPO_NAME) + version: $(LATEST_FS_COMMIT) endef - -# Generate independent fusesoc .core file. FuseSoC will obtain the Verilog sources from remote url with a pre-built build directory. export MULTILINE_TEXT -fusesoc-core-file: fusesoc-export + +endif + +# NOTE: If you want to run this target from ghactions, you need to give it write permissions to the *-fs repo using a Personal Access Token (PAT). +# You need to generate a PAT to acces the *-fs repo: +# - As org owner/admin of the *-fs repo, go to Settings > Developer settings > Fine-grained tokens > Generate new token. +# - Select Repository access > Only select repositories (include both source and target repos). +# - Grant Contents > Read & write (minimum for commits). +# Then you need add that PAT as a secret of this one (so that secrets.TARGET_REPO_PAT) becomes available. +# - Add the PAT as a secret: Settings > Secrets and variables > Actions > New repository secret (name it e.g., TARGET_REPO_PAT). +# Finally, in the 'env' section of ci.yml, add: `PAT: ${{ secrets.TARGET_REPO_PAT }}` +# - You can now use this url to have write permissions: `git clone https://x-access-token:${PAT}@github.com/your-org/target-repo.git` +# +# Automatically update *-fs repo with latest sources +fusesoc-update-fs-repo: fusesoc-export + git clone $(REPO_URL) $(FS_REPO_NAME) + # Delete all contents except .git directory + #find $(FS_REPO_NAME) -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} + + # Copy fusesoc_exports contents to FS_REPO_NAME root + cp -r fusesoc_exports/* $(FS_REPO_NAME)/ + # Commit and push + export CUR_COMMIT=$(shell git rev-parse HEAD);\ + cd $(FS_REPO_NAME) && \ + git config user.name "ghactions[bot]" && \ + git config user.email "ci@iobundle.com" && \ + git add . && \ + git commit --allow-empty -m "Auto-update from main repo ($$CUR_COMMIT)" && \ + git push origin main; + @echo "FS repo updated successfully" + +.PHONY: fusesoc-core-file + +# Generate standalone FuseSoC .core file that references pre-built sources from a remote source using 'provider' section. +fusesoc-core-file: fusesoc-update-fs-repo # fusesoc-export cp fusesoc_exports/$(CORE_NAME).core . - # Append provider remote URL to .core file + # Append provider remote url to .core file printf "\n%s\n" "$$MULTILINE_TEXT" >> $(CORE_NAME).core - echo "Generated independent $(CORE_NAME).core file." + echo "Generated independent $(CORE_NAME).core file (with 'provider' section)." .PHONY: fusesoc-core-file +fusesoc-sign: fusesoc-core-file + mkdir -p fusesoc_sign/lib + cp $(CORE_NAME).core fusesoc_sign/lib + nix-shell --run "cd fusesoc_sign;\ + fusesoc library add lib;\ + fusesoc core sign $(CORE_NAME) ~/.ssh/iob-fusesoc-sign-key\ + " + +.PHONY: fusesoc-sign + +# Cores published must have a 'description' with less than 256 characters, otherwise it fails to publish to cores.fusesoc.net +fusesoc-publish: fusesoc-sign + nix-shell --run "cd fusesoc_sign;\ + fusesoc core show $(CORE_NAME);\ + fusesoc-publish $(CORE_NAME) https://cores.fusesoc.net/\ + " + +.PHONY: fusesoc-publish + + # Release Artifacts release-artifacts: diff --git a/README.md b/README.md index 24b2a8b..096a571 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,12 @@ To run in simulation, call the 'sim-run' Makefile target: make sim-run ``` -## Pre-built files +## FuseSoC -Two [FuseSoC](https://github.com/olofk/fusesoc)-compatible pre-built versions of iob-cache, with AXI4 and IOb back-end interfaces, are available in the [repository's release page](https://github.com/IObundle/iob-cache/releases). -The Cache's Verilog sources are available in the `iob_cache_*/hardware/src/` directory of the compressed tar.gz files in the release page. +A [FuseSoC](https://github.com/olofk/fusesoc)-compatible pre-built version of IOb-Cache is available in the official [FuseSoC Package Directory](https://cores.fusesoc.net/cores/?search=iob_cache). -To use these pre-built cores in FuseSoC, extract the compressed tar.gz files to a [FuseSoC library directory](https://fusesoc.readthedocs.io/en/stable/user/overview.html#discover-cores-the-package-manager). +There is also a [FuseSoC](https://github.com/olofk/fusesoc)-compatible pre-built version of IOb-Cache available in the [repository's release page](https://github.com/IObundle/iob-cache/releases) and in the [iob-cache-fs](https://github.com/IObundle/iob-cache-fs) repository. +The core's Verilog sources are available in the `iob_cache_*/hardware/src/` directory of the compressed tar.gz file in the release page. + +To use this pre-built core in FuseSoC, extract the compressed tar.gz file to a [FuseSoC library directory](https://fusesoc.readthedocs.io/en/stable/user/overview.html#discover-cores-the-package-manager). diff --git a/default.nix b/default.nix index f3bc5e1..91b9093 100644 --- a/default.nix +++ b/default.nix @@ -5,8 +5,8 @@ { pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/25.05.tar.gz") {} }: let - py2hwsw_commit = "e8dd704c57cc616f90e3fbbce75713a8cfbc9f9c"; # Replace with the desired commit. - py2hwsw_sha256 = "+FYO10yo6mIjLRXW3xLIgmOrrQMZu0HYQBKFzv2gTZI="; # Replace with the actual SHA256 hash. + py2hwsw_commit = "635fa6c0b4bfcd611a1a536115546f2a6282c5e3"; # Replace with the desired commit. + py2hwsw_sha256 = "Z/0TSIsHiNWXSU278D4UBLt6Avp2JrpnxD59xfWzdAw="; # Replace with the actual SHA256 hash. # Get local py2hwsw root from `PY2HWSW_ROOT` env variable py2hwswRoot = builtins.getEnv "PY2HWSW_ROOT"; diff --git a/iob_cache.py b/iob_cache.py index 71142a2..6682fa9 100644 --- a/iob_cache.py +++ b/iob_cache.py @@ -4,7 +4,7 @@ def setup(py_params: dict): - VERSION = "0.71" + VERSION = "0.7.1" # # List of supported python parameters @@ -43,7 +43,7 @@ def setup(py_params: dict): attributes_dict = { "name": NAME, "version": VERSION, - "description": "IOb-cache is a high-performance, configurable open-source Verilog cache. If you use or like this core, please cite the following article: Roque, J.V.; Lopes, J.D.; Véstias, M.P.; de Sousa, J.T. IOb-Cache: A High-Performance Configurable Open-Source Cache. Algorithms 2021, 14, 218. https://doi.org/10.3390/a14080218", + "description": "IOb-cache is a high-performance, configurable open-source Verilog cache. The original sources for this core and public key signature are available at: https://github.com/IObundle/iob-cache.", "build_dir": BUILD_DIR, "generate_hw": True, "board_list": ["iob_aes_ku040_db_g"], From e8b28126eedf4929bac871359cd99684679e0415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Artur=20N=C3=B3brega?= Date: Thu, 26 Feb 2026 13:58:21 +0000 Subject: [PATCH 2/2] chore(nix): Update py2hwsw version --- default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 91b9093..83b56d6 100644 --- a/default.nix +++ b/default.nix @@ -5,8 +5,8 @@ { pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/25.05.tar.gz") {} }: let - py2hwsw_commit = "635fa6c0b4bfcd611a1a536115546f2a6282c5e3"; # Replace with the desired commit. - py2hwsw_sha256 = "Z/0TSIsHiNWXSU278D4UBLt6Avp2JrpnxD59xfWzdAw="; # Replace with the actual SHA256 hash. + py2hwsw_commit = "6f89493ce14029c1b5a35a14037e1e9780b7a75b"; # Replace with the desired commit. + py2hwsw_sha256 = "o/tU0Vogv7bwSST4crhqm9rxEXuHXvASnhChG7NZoSk="; # Replace with the actual SHA256 hash. # Get local py2hwsw root from `PY2HWSW_ROOT` env variable py2hwswRoot = builtins.getEnv "PY2HWSW_ROOT";