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
94 changes: 84 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "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";

Expand Down
4 changes: 2 additions & 2 deletions iob_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def setup(py_params: dict):
VERSION = "0.71"
VERSION = "0.7.1"

#
# List of supported python parameters
Expand Down Expand Up @@ -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"],
Expand Down