Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
-
name: Build hardware
run: |
uv run --locked make -B idma_hw_all \
uv run --locked make -B idma_hw_all idma_sw_all \
IDMA_BACKEND_IDS="${{ inputs.IDMA_BACKEND_IDS }}" \
IDMA_REG_CPUIF="${{ inputs.IDMA_REG_CPUIF }}"
-
Expand Down
54 changes: 52 additions & 2 deletions idma.mk
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ IDMA_FE_IDS ?= $(IDMA_BASE_FE_IDS) $(IDMA_ADD_FE_IDS)
# iDMA paths
IDMA_UTIL_DIR := $(IDMA_ROOT)/util
IDMA_RTL_DIR := $(IDMA_ROOT)/target/rtl
IDMA_SW_DIR := $(IDMA_ROOT)/target/sw

# job file
IDMA_JOBS_JSON := jobs/jobs.json
Expand Down Expand Up @@ -191,6 +192,10 @@ regwidth = $(word 1,$(subst _, ,$1))
dimension = $(word 2,$(subst _, ,$1))
log2dimension = $(shell echo $$(( $$( echo "obase=2;$$(($(1)-1))" | bc | wc -c ) - 1 )) )

# Shared SPDX license header (raw-header takes plain text; c-header gets the //-prefixed variant)
IDMA_LICENSE := Copyright 2026 ETH Zurich and University of Bologna.\nSolderpad Hardware License, Version 0.51, see LICENSE for details.\nSPDX-License-Identifier: SHL-0.51
IDMA_C_HDR_LIC := // $(subst \n,\n// ,$(IDMA_LICENSE))\n

$(IDMA_RTL_DIR)/idma_reg%d_reg_pkg.sv $(IDMA_RTL_DIR)/idma_reg%d_reg_top.sv $(IDMA_RTL_DIR)/idma_reg%d_addrmap_pkg.sv:
$(PEAKRDL) regblock $(IDMA_FE_DIR)/reg/idma_reg.rdl -o $(IDMA_RTL_DIR) \
--default-reset arst_n --cpuif $(IDMA_REG_CPUIF) \
Expand Down Expand Up @@ -233,6 +238,40 @@ $(IDMA_HTML_DIR)/regs/idma_reg%d_reg/index.html:
$(IDMA_HTML_DIR)/regs/idma_desc64_reg/index.html:
$(PEAKRDL) html $(IDMA_FE_DIR)/desc64/idma_desc64_reg.rdl -o $(IDMA_HTML_DIR)/regs/idma_desc64_reg

# C header

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding license to generated files

Suggested change
# C header
# C header
IDMA_LICENSE := Copyright 2026 ETH Zurich and University of Bologna.\nSolderpad Hardware License, Version 0.51, see LICENSE for details.\nSPDX-License-Identifier: SHL-0.51
IDMA_C_HDR_LIC := // $(subst \n,\n// ,$(IDMA_LICENSE))\n

$(IDMA_SW_DIR)/idma_reg%d_regs.h :
$(PEAKRDL) c-header $(IDMA_FE_DIR)/reg/idma_reg.rdl -o $@ \
-b ltoh --type-style hier --rename idma_reg$*d \
-P SysAddrWidth=$(call regwidth,$*) \
-P NumDims=$(call dimension,$*) \
-P Log2NumDims=$(call log2dimension,$(call dimension,$*))
sed -i '1i$(IDMA_C_HDR_LIC)' $@

$(IDMA_SW_DIR)/idma_reg%d_regs_unpacked.h : $(IDMA_SW_DIR)/idma_reg%d_regs.h
# with `packed` structs, the compiler may get confused and generate byte loads/stores to access fields.
sed -e "s/__attribute__ ((__packed__)) //" $^ > $@


$(IDMA_SW_DIR)/idma_reg%d_raw_regs.h:
$(PEAKRDL) raw-header $(IDMA_FE_DIR)/reg/idma_reg.rdl -o $@ \
--format c \
Comment on lines +256 to +257

@DanielKellerM DanielKellerM Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add licensing to the raw header too.

Suggested change
$(PEAKRDL) raw-header $(IDMA_FE_DIR)/reg/idma_reg.rdl -o $@ \
--format c \
$(PEAKRDL) raw-header $(IDMA_FE_DIR)/reg/idma_reg.rdl -o $@ \
--format c \
--license_str="$(IDMA_LICENSE)" \

--license_str="$(IDMA_LICENSE)" \
-P SysAddrWidth=$(call regwidth,$*) \
-P NumDims=$(call dimension,$*) \
-P Log2NumDims=$(call log2dimension,$(call dimension,$*))

@DanielKellerM DanielKellerM Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the desc64 rules

Suggested change
$(IDMA_SW_DIR)/idma_desc64_regs.h:
$(PEAKRDL) c-header $(IDMA_FE_DIR)/desc64/idma_desc64_reg.rdl -o $@ \
-b ltoh --type-style hier --rename idma_desc64
sed -i '1i$(IDMA_C_HDR_LIC)' $@
$(IDMA_SW_DIR)/idma_desc64_regs_unpacked.h: $(IDMA_SW_DIR)/idma_desc64_regs.h
sed -e "s/__attribute__ ((__packed__)) //" $< > $@
$(IDMA_SW_DIR)/idma_desc64_raw_regs.h:
$(PEAKRDL) raw-header $(IDMA_FE_DIR)/desc64/idma_desc64_reg.rdl -o $@ \
--format c --base_name idma_desc64 \
--license_str="$(IDMA_LICENSE)"


$(IDMA_SW_DIR)/idma_desc64_regs.h:
$(PEAKRDL) c-header $(IDMA_FE_DIR)/desc64/idma_desc64_reg.rdl -o $@ \
-b ltoh --type-style hier --rename idma_desc64
sed -i '1i$(IDMA_C_HDR_LIC)' $@
$(IDMA_SW_DIR)/idma_desc64_regs_unpacked.h: $(IDMA_SW_DIR)/idma_desc64_regs.h
sed -e "s/__attribute__ ((__packed__)) //" $< > $@
$(IDMA_SW_DIR)/idma_desc64_raw_regs.h:
$(PEAKRDL) raw-header $(IDMA_FE_DIR)/desc64/idma_desc64_reg.rdl -o $@ \
--format c --base_name idma_desc64 \
--license_str="$(IDMA_LICENSE)"

idma_reg_clean:
rm -rf $(IDMA_HTML_DIR)/regs
rm -f $(IDMA_RTL_DIR)/*_reg_top.sv
Expand All @@ -247,6 +286,12 @@ IDMA_RTL_ALL += $(foreach Y,$(IDMA_FE_REGS),$(IDMA_RTL_DIR)/idma_$Y_addrmap_
IDMA_RTL_ALL += $(foreach Y,$(IDMA_FE_REGS),$(IDMA_RTL_DIR)/idma_$Y_top.sv)
IDMA_RTL_DOC_ALL += $(foreach Y,$(IDMA_FE_REGS),$(IDMA_HTML_DIR)/regs/idma_$Y_reg/index.html)

# C headers
IDMA_SW_ALL += $(foreach Y,$(IDMA_FE_REGS),$(IDMA_SW_DIR)/idma_$Y_regs.h)
IDMA_SW_ALL += $(foreach Y,$(IDMA_FE_REGS),$(IDMA_SW_DIR)/idma_$Y_regs_unpacked.h)

# C headers with the "raw-header" plugin
IDMA_SW_ALL += $(foreach Y,$(IDMA_FE_REGS),$(IDMA_SW_DIR)/idma_$Y_raw_regs.h)

# ---------------
# RTL assembly
Expand Down Expand Up @@ -556,9 +601,9 @@ idma_nonfree_clean:
# Misc Clean
# --------------

.PHONY: idma_clean_all idma_clean idma_misc_clean
.PHONY: idma_clean_all idma_clean idma_misc_clean idma_sw_clean

idma_clean_all idma_clean: idma_rtl_clean idma_reg_clean idma_pickle_clean idma_sim_clean idma_vcs_clean idma_verilator_clean idma_spinx_doc_clean idma_trace_clean
idma_clean_all idma_clean: idma_rtl_clean idma_reg_clean idma_pickle_clean idma_sim_clean idma_vcs_clean idma_verilator_clean idma_spinx_doc_clean idma_trace_clean idma_sw_clean

idma_misc_clean:
rm -rf scripts/__pycache__
Expand All @@ -569,6 +614,9 @@ idma_misc_clean:
idma_nuke: idma_clean idma_nonfree_clean
rm -rf .bender

idma_sw_clean:
rm -rf $(IDMA_SW_DIR)/*.h


# --------------
# Phony Targets
Expand All @@ -582,6 +630,8 @@ idma_pickle_all: $(IDMA_PICKLE_ALL)

idma_hw_all: $(IDMA_FULL_RTL) $(IDMA_INCLUDE_ALL) $(IDMA_FULL_TB) $(IDMA_HJSON_ALL) $(IDMA_WAVE_ALL)

idma_sw_all: $(IDMA_SW_ALL)

idma_sim_all: $(IDMA_VCS_DIR)/compile.sh $(IDMA_VSIM_DIR)/compile.tcl

idma_all: idma_hw_all idma_sim_all idma_doc_all idma_pickle_all
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ dependencies = [
"pylint",
"peakrdl>=1.5.0",
"peakrdl-rawheader>=0.2.4",
"peakrdl-cheader>=1.1.0",
]
1 change: 1 addition & 0 deletions target/sw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.h
18 changes: 10 additions & 8 deletions util/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Repo configuration
ORIGIN = 'origin'

GITIGNORE_FILES = ['target/rtl/.gitignore', 'target/sw/.gitignore']
# Comment added to gitignore
GITIGNORE_COMMENT = '# Deactivated by deploy.py'

Expand Down Expand Up @@ -58,14 +59,15 @@ def get_current_branch():
git_run('checkout', '-b', deploy_branch, current_branch)

# selectively deactivate gitignore to check in generated files
with open('target/rtl/.gitignore', 'r', encoding='utf-8') as f:
content = f.read().split('\n')[:-1]

if content[0] != GITIGNORE_COMMENT:
with open('target/rtl/.gitignore', 'w', encoding='utf-8') as f:
f.write(f'{GITIGNORE_COMMENT}\n')
for line in content:
f.write(f'# {line}\n')
for gitignore_fn in GITIGNORE_FILES:
with open(gitignore_fn, 'r', encoding='utf-8') as f:
content = f.read().split('\n')[:-1]

if content[0] != GITIGNORE_COMMENT:
with open(gitignore_fn, 'w', encoding='utf-8') as f:
f.write(f'{GITIGNORE_COMMENT}\n')
for line in content:
f.write(f'# {line}\n')

# add and commit files
git_run('add', '.')
Expand Down
70 changes: 36 additions & 34 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.