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
9 changes: 1 addition & 8 deletions .github/workflows/analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@
name: analyze

on:
push:
branches-ignore:
- '__deploy__**'
pull_request:
branches-ignore:
- '__deploy__**'
workflow_call:
workflow_dispatch:
branches-ignore:
- '__deploy__**'

jobs:

Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@
name: build

on:
push:
branches-ignore:
- '__deploy__**'
pull_request:
branches-ignore:
- '__deploy__**'
workflow_call:
workflow_dispatch:
branches-ignore:
- '__deploy__**'

jobs:

Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copyright 2026 ETH Zurich and University of Bologna.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

# Author:
# - Daniel Keller <dankeller@iis.ee.ethz.ch>

name: ci

on:
push:
branches-ignore:
- '__deploy__**'
pull_request:
branches-ignore:
- '__deploy__**'
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:

lint:
uses: ./.github/workflows/lint.yml
secrets: inherit

build:
needs: lint
uses: ./.github/workflows/build.yml
secrets: inherit

analyze:
needs: lint
uses: ./.github/workflows/analyze.yml
secrets: inherit

gitlab-ci:
needs: build
uses: ./.github/workflows/gitlab-ci.yml
secrets: inherit

deploy:
needs: build
if: github.event_name == 'push'
uses: ./.github/workflows/deploy.yml
secrets: inherit
5 changes: 2 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
name: deploy

on:
push:
branches-ignore:
- '__deploy__**'
workflow_call:
workflow_dispatch:

jobs:

Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@
name: gitlab-ci

on:
push:
branches-ignore:
- '__deploy__**'
pull_request:
branches-ignore:
- '__deploy__**'
workflow_call:
workflow_dispatch:
branches-ignore:
- '__deploy__**'

jobs:

check:
runs-on: ubuntu-latest
timeout-minutes: 200
steps:
-
name: Mirror and check
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,8 @@
name: lint

on:
push:
branches-ignore:
- '__deploy__**'
pull_request:
branches-ignore:
- '__deploy__**'
workflow_call:
workflow_dispatch:
branches-ignore:
- '__deploy__**'

jobs:

Expand Down
6 changes: 4 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ init:
idma:
stage: idma
needs: [ init ]
except:
- /^__deploy__.*$/
rules:
- if: $CI_COMMIT_BRANCH =~ /^__deploy__/
when: never
- when: always
trigger:
include:
- artifact: nonfree/ci/ci.yml
Expand Down
25 changes: 25 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2026 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

# Matches rules enforced by util/lint-commits.py in CI.

[general]
ignore=body-is-missing

# Subject line: max 100 characters
[title-max-length]
line-length=100

# Subject line: no trailing period
[title-trailing-punctuation]

# Subject line: must be capitalized, with optional "area: " prefix
# Valid: "Fix bug in backend"
# Valid: "backend: Fix bug in AXI read path"
# Invalid: "fixup! something" "lowercase start"
[title-match-regex]
regex=^([a-zA-Z_\-]+(/[a-zA-Z_\-]+)*: )?[A-Z]

# Body: second line must be blank
[body-first-line-empty]
29 changes: 29 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2026 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

# Run `pre-commit install && pre-commit install --hook-type commit-msg` to enable locally.

default_language_version:
python: python3.11

repos:
- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
- id: gitlint
stages: [commit-msg]

- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
args: ['--max-line-length=100', '--extend-ignore=E128']
files: ^util/

- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: ['-c', '.github/yamllint-conf.yml']
files: (^Bender\.yml$|^src/db/.*\.yml$)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
GitPython
pre-commit
hjson
tabulate
pyyaml
Expand All @@ -8,4 +9,3 @@ sphinx-rtd-theme
recommonmark
sphinxcontrib-svg2pdfconverter
pylint
flatdict
18 changes: 15 additions & 3 deletions util/mario/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@
# - Thomas Benz <tbenz@iis.ee.ethz.ch>

""" MARIO tracer interaction"""
import flatdict
from mako.template import Template


def _flatten_dict(d, parent_key='', delimiter='_'):
"""Flatten a nested dict, joining keys with *delimiter*."""
items = []
for k, v in d.items():
new_key = f'{parent_key}{delimiter}{k}' if parent_key else k
if isinstance(v, dict):
items.extend(_flatten_dict(v, new_key, delimiter).items())
else:
items.append((new_key, v))
return dict(items)


TRACER_BODY = '''
// The tracer for the ${identifier} iDMA
`define IDMA_TRACER_${identifier_cap}(__backend_inst, __out_f) <%text>\\</%text>
Expand Down Expand Up @@ -110,14 +122,14 @@ def render_tracer(prot_ids: dict, db: dict, tpl_file: str) -> str:

# handle read ports
for read_prot in prot_ids[prot_id]['ar']:
sig_dict = flatdict.FlatDict(db[read_prot]['trace_signals']['read'], delimiter='_')
sig_dict = _flatten_dict(db[read_prot]['trace_signals']['read'])
for signal in sig_dict:
signals += ' '
signals += f'"{read_prot}_{signal}": __backend_inst``.{sig_dict[signal]}'
signals += ', \\\n'

for write_prot in prot_ids[prot_id]['aw']:
sig_dict = flatdict.FlatDict(db[write_prot]['trace_signals']['write'], delimiter='_')
sig_dict = _flatten_dict(db[write_prot]['trace_signals']['write'])
for signal in sig_dict:
signals += ' '
signals += f'"{write_prot}_{signal}": __backend_inst``.{sig_dict[signal]}'
Expand Down