Skip to content

Commit 3e45ec5

Browse files
micprogcolluca
authored andcommitted
treewide: Replace hjson and reggen with rdl and peakrdl
1 parent c757830 commit 3e45ec5

33 files changed

+1268
-3463
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
container:
7070
image: ${{ needs.build-docker.outputs.image_name }}
7171
steps:
72-
- uses: actions/checkout@v2
72+
- uses: actions/checkout@v4
7373
- name: Build docs
7474
run: make docs
7575

@@ -81,7 +81,7 @@ jobs:
8181
container:
8282
image: ${{ needs.build-docker.outputs.image_name }}
8383
steps:
84-
- uses: actions/checkout@v2
84+
- uses: actions/checkout@v4
8585
# For some reason, the checkout is done by a different user
8686
# than that deploying to Github (root, possibly due to Docker).
8787
# So we need to set the repository as a safe directory.
@@ -106,7 +106,7 @@ jobs:
106106
container:
107107
image: ${{ needs.build-docker.outputs.image_name }}
108108
steps:
109-
- uses: actions/checkout@v2
109+
- uses: actions/checkout@v4
110110
- name: Run pytest
111111
run: pytest
112112

@@ -121,7 +121,7 @@ jobs:
121121
container:
122122
image: ${{ needs.build-docker.outputs.image_name }}
123123
steps:
124-
- uses: actions/checkout@v2
124+
- uses: actions/checkout@v4
125125
with:
126126
submodules: 'recursive'
127127
- name: Hash Verilator prerequisites
@@ -133,7 +133,7 @@ jobs:
133133
flags: --recursive
134134
- name: Set up cache for Verilator build
135135
id: verilator-cache
136-
uses: actions/cache@v3
136+
uses: actions/cache@v4
137137
with:
138138
path: target/snitch_cluster/bin
139139
key: verilator-${{ steps.verilator-hash.outputs.hash }}

.github/workflows/gitlab-ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
github.repository == 'pulp-platform/snitch_cluster'
1717
steps:
1818
- name: Check Gitlab CI
19-
uses: pulp-platform/pulp-actions/gitlab-ci@v2.1.0
19+
uses: pulp-platform/pulp-actions/gitlab-ci@v2.4.3
2020
with:
2121
domain: iis-git.ee.ethz.ch
2222
repo: github-mirror/snitch_cluster

.github/workflows/lint.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
github.event_name != 'pull_request' ||
1919
github.event.pull_request.head.repo.full_name != github.repository
2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v4
2222
- uses: chipsalliance/verible-linter-action@main
2323
with:
2424
paths: |
@@ -53,9 +53,9 @@ jobs:
5353
github.event.pull_request.head.repo.full_name != github.repository
5454
steps:
5555
- name: Check License
56-
uses: pulp-platform/pulp-actions/lint-license@v2.1.0
56+
uses: pulp-platform/pulp-actions/lint-license@v2.4.3
5757
with:
58-
patches: 0001-Allow-hash-comments-in-assembly.patch
58+
linters_revision: 20250217_01
5959
# We cover ETH Zurich and lowRISC licenses and Apache 2.0
6060
# (mostly for SW) and Solderpad for the hardware.
6161
# yamllint disable rule:line-length
@@ -67,6 +67,9 @@ jobs:
6767
match_regex: true
6868
exclude_paths: |
6969
sw/snRuntime/src/omp/interface.h
70+
hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg_pkg.sv
71+
hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg.sv
72+
hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg.svh
7073
7174
##################
7275
# Lint YML Files #
@@ -78,7 +81,7 @@ jobs:
7881
github.event_name != 'pull_request' ||
7982
github.event.pull_request.head.repo.full_name != github.repository
8083
steps:
81-
- uses: actions/checkout@v3
84+
- uses: actions/checkout@v4
8285
- name: yaml-lint
8386
uses: ibiqlik/action-yamllint@v3
8487
with:
@@ -95,9 +98,9 @@ jobs:
9598
name: Lint Python Sources
9699
steps:
97100
- name: Check out source repository
98-
uses: actions/checkout@v3
101+
uses: actions/checkout@v4
99102
- name: Set up Python environment
100-
uses: actions/setup-python@v4
103+
uses: actions/setup-python@v5
101104
with:
102105
python-version: "3.11"
103106
- name: flake8 Lint
@@ -117,7 +120,7 @@ jobs:
117120
github.event_name != 'pull_request' ||
118121
github.event.pull_request.head.repo.full_name != github.repository
119122
steps:
120-
- uses: actions/checkout@v3
121-
- uses: DoozyX/clang-format-lint-action@v0.18.1
123+
- uses: actions/checkout@v4
124+
- uses: DoozyX/clang-format-lint-action@v0.18.2
122125
with:
123126
clangFormatVersion: 10

Bender.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ packages:
8383
- obi
8484
- register_interface
8585
obi:
86-
revision: 8097928cf1b43712f93d5356f336397879b4ad2c
87-
version: 0.1.6
86+
revision: 0155fc34e900c7c884e081c0a1114a247937ff69
87+
version: 0.1.7
8888
source:
8989
Git: https://github.com/pulp-platform/obi.git
9090
dependencies:
@@ -94,7 +94,7 @@ packages:
9494
revision: 5daa85d164cf6b54ad061ea1e4c6f3624556e467
9595
version: 0.4.5
9696
source:
97-
Git: https://github.com/pulp-platform/register_interface
97+
Git: https://github.com/pulp-platform/register_interface.git
9898
dependencies:
9999
- apb
100100
- axi

Bender.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ dependencies:
2222
axi: { git: https://github.com/colluca/axi, rev: multicast }
2323
axi_riscv_atomics: { git: https://github.com/pulp-platform/axi_riscv_atomics, version: 0.6.0 }
2424
common_cells: { git: https://github.com/pulp-platform/common_cells, rev: snitch }
25+
apb: { git: https://github.com/pulp-platform/apb.git, version: 0.2.2 }
2526
FPnew: { git: https://github.com/pulp-platform/cvfpu.git, rev: pulp-v0.1.3 }
26-
register_interface: { git: https://github.com/pulp-platform/register_interface, version: 0.4.2 }
2727
tech_cells_generic: { git: https://github.com/pulp-platform/tech_cells_generic, version: 0.2.13 }
2828
riscv-dbg: { git: https://github.com/pulp-platform/riscv-dbg, version: 0.8.0 }
2929
cluster_icache: { git: https://github.com/pulp-platform/cluster_icache.git, rev: 64e21ae455bbdde850c4df13bef86ea55ac42537 }
@@ -155,7 +155,7 @@ sources:
155155
# Level 0
156156
- hw/snitch_cluster/src/snitch_amo_shim.sv
157157
- hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg_pkg.sv
158-
- hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg_top.sv
158+
- hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg.sv
159159
- hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral.sv
160160
- hw/snitch_cluster/src/snitch_fpu.sv
161161
- hw/snitch_cluster/src/snitch_sequencer.sv
@@ -180,7 +180,6 @@ sources:
180180
# target/common
181181
- target: any(simulation, verilator)
182182
files:
183-
- target/common/test/tb_memory_regbus.sv
184183
- target/common/test/tb_memory_axi.sv
185184
- target: test
186185
files:

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
###############
88

99
BENDER ?= bender
10-
REGGEN = $(shell $(BENDER) path register_interface)/vendor/lowrisc_opentitan/util/regtool.py
10+
PEAKRDL ?= peakrdl
1111

1212
#########################
1313
# Files and directories #
@@ -80,8 +80,8 @@ clean-docs:
8080
$(GENERATED_DOCS_DIR):
8181
mkdir -p $@
8282

83-
$(GENERATED_DOCS_DIR)/peripherals.md: hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg.hjson | $(GENERATED_DOCS_DIR)
84-
$(REGGEN) -d $< > $@
83+
$(GENERATED_DOCS_DIR)/peripherals.md: hw/snitch_cluster/src/snitch_cluster_peripheral/snitch_cluster_peripheral_reg.rdl | $(GENERATED_DOCS_DIR)
84+
$(PEAKRDL) markdown $< -o $@
8585

8686
$(DOXYGEN_DOCS_DIR): $(DOXYFILE) $(DOXYGEN_INPUTS)
8787
doxygen $<

hw/snitch_cluster/src/snitch_cluster.sv

Lines changed: 69 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
`include "common_cells/registers.svh"
1313

1414
`include "mem_interface/typedef.svh"
15-
`include "register_interface/typedef.svh"
15+
`include "apb/typedef.svh"
1616
`include "reqrsp_interface/typedef.svh"
1717
`include "tcdm_interface/typedef.svh"
1818

@@ -426,16 +426,17 @@ module snitch_cluster
426426
`AXI_TYPEDEF_ALL(axi_mst_dma, addr_t, id_dma_mst_t, data_dma_t, strb_dma_t, user_dma_t)
427427
`AXI_TYPEDEF_ALL(axi_slv_dma, addr_t, id_dma_slv_t, data_dma_t, strb_dma_t, user_dma_t)
428428

429+
`AXI_LITE_TYPEDEF_ALL(axi_lite, addr_t, data_t, strb_t)
430+
431+
`APB_TYPEDEF_ALL(apb, addr_t, data_t, strb_t)
432+
429433
`REQRSP_TYPEDEF_ALL(reqrsp, addr_t, data_t, strb_t)
430434

431435
`MEM_TYPEDEF_ALL(mem, tcdm_mem_addr_t, data_t, strb_t, tcdm_user_t)
432436
`MEM_TYPEDEF_ALL(mem_dma, tcdm_mem_addr_t, data_dma_t, strb_dma_t, logic)
433437

434438
`TCDM_TYPEDEF_ALL(tcdm, tcdm_addr_t, data_t, strb_t, tcdm_user_t)
435439

436-
`REG_BUS_TYPEDEF_REQ(reg_req_t, addr_t, data_t, strb_t)
437-
`REG_BUS_TYPEDEF_RSP(reg_rsp_t, data_t)
438-
439440
// Event counter increments for the TCDM.
440441
typedef struct packed {
441442
/// Number requests going in
@@ -602,8 +603,10 @@ module snitch_cluster
602603
reqrsp_rsp_t [NrHives-1:0] ptw_rsp;
603604

604605
// 5. Peripheral Subsystem
605-
reg_req_t reg_req;
606-
reg_rsp_t reg_rsp;
606+
axi_lite_req_t axi_lite_req;
607+
axi_lite_resp_t axi_lite_resp;
608+
apb_req_t apb_req;
609+
apb_resp_t apb_resp;
607610

608611
// 5. Misc. Wires.
609612
logic icache_prefetch_enable;
@@ -1372,26 +1375,59 @@ module snitch_cluster
13721375
);
13731376

13741377
// 2. Peripherals
1375-
axi_to_reg #(
1376-
.ADDR_WIDTH (PhysicalAddrWidth),
1377-
.DATA_WIDTH (NarrowDataWidth),
1378-
.AXI_MAX_WRITE_TXNS (1),
1379-
.AXI_MAX_READ_TXNS (1),
1380-
.DECOUPLE_W (0),
1381-
.ID_WIDTH (NarrowIdWidthOut),
1382-
.USER_WIDTH (NarrowUserWidth),
1383-
.axi_req_t (axi_slv_req_t),
1384-
.axi_rsp_t (axi_slv_resp_t),
1385-
.reg_req_t (reg_req_t),
1386-
.reg_rsp_t (reg_rsp_t)
1387-
) i_axi_to_reg (
1388-
.clk_i,
1389-
.rst_ni,
1390-
.testmode_i (1'b0),
1391-
.axi_req_i (narrow_axi_slv_req[ClusterPeripherals]),
1392-
.axi_rsp_o (narrow_axi_slv_rsp[ClusterPeripherals]),
1393-
.reg_req_o (reg_req),
1394-
.reg_rsp_i (reg_rsp)
1378+
axi_to_axi_lite #(
1379+
.AxiAddrWidth (PhysicalAddrWidth),
1380+
.AxiDataWidth (NarrowDataWidth),
1381+
.AxiIdWidth (NarrowIdWidthOut),
1382+
.AxiUserWidth (NarrowUserWidth),
1383+
.AxiMaxWriteTxns(1),
1384+
.AxiMaxReadTxns (1),
1385+
.full_req_t (axi_slv_req_t),
1386+
.full_resp_t (axi_slv_resp_t),
1387+
.lite_req_t (axi_lite_req_t),
1388+
.lite_resp_t (axi_lite_resp_t)
1389+
) i_axi_to_axi_lite (
1390+
.clk_i (clk_i),
1391+
.rst_ni (rst_ni),
1392+
.test_i (1'b0),
1393+
.slv_req_i (narrow_axi_slv_req[ClusterPeripherals]),
1394+
.slv_resp_o(narrow_axi_slv_rsp[ClusterPeripherals]),
1395+
.mst_req_o (axi_lite_req),
1396+
.mst_resp_i(axi_lite_resp)
1397+
);
1398+
1399+
// There is only one APB slave in the cluster, at index 0.
1400+
localparam int unsigned NumApbSlaves = 1;
1401+
localparam int unsigned NumApbConvRules = (1 + AliasRegionEnable) * NumApbSlaves;
1402+
xbar_rule_t [NumApbConvRules-1:0] apb_conv_rules;
1403+
1404+
assign apb_conv_rules[0] = '{
1405+
idx: 0, start_addr: cluster_periph_start_address, end_addr: cluster_periph_end_address
1406+
};
1407+
if (AliasRegionEnable) begin : gen_apb_alias
1408+
assign apb_conv_rules[1] = '{
1409+
idx: 0, start_addr: PeriphAliasStart, end_addr: PeriphAliasEnd
1410+
};
1411+
end
1412+
1413+
axi_lite_to_apb #(
1414+
.NoApbSlaves (NumApbSlaves),
1415+
.NoRules (NumApbConvRules),
1416+
.AddrWidth (PhysicalAddrWidth),
1417+
.DataWidth (NarrowDataWidth),
1418+
.axi_lite_req_t (axi_lite_req_t),
1419+
.axi_lite_resp_t (axi_lite_resp_t),
1420+
.apb_req_t (apb_req_t),
1421+
.apb_resp_t (apb_resp_t),
1422+
.rule_t (xbar_rule_t)
1423+
) i_axi_lite_to_apb (
1424+
.clk_i (clk_i),
1425+
.rst_ni (rst_ni),
1426+
.axi_lite_req_i (axi_lite_req),
1427+
.axi_lite_resp_o(axi_lite_resp),
1428+
.apb_req_o (apb_req),
1429+
.apb_resp_i (apb_resp),
1430+
.addr_map_i (apb_conv_rules)
13951431
);
13961432

13971433
if (IntBootromEnable) begin : gen_bootrom
@@ -1440,17 +1476,20 @@ module snitch_cluster
14401476
end
14411477

14421478
snitch_cluster_peripheral #(
1443-
.reg_req_t (reg_req_t),
1444-
.reg_rsp_t (reg_rsp_t),
1479+
.addr_t (addr_t),
1480+
.data_t (data_t),
1481+
.strb_t (strb_t),
1482+
.apb_req_t (apb_req_t),
1483+
.apb_resp_t (apb_resp_t),
14451484
.tcdm_events_t (tcdm_events_t),
14461485
.dma_events_t (dma_events_t),
14471486
.NrCores (NrCores),
14481487
.DMANumChannels (DMANumChannels)
14491488
) i_snitch_cluster_peripheral (
14501489
.clk_i,
14511490
.rst_ni,
1452-
.reg_req_i (reg_req),
1453-
.reg_rsp_o (reg_rsp),
1491+
.apb_req_i (apb_req),
1492+
.apb_resp_o (apb_resp),
14541493
.icache_prefetch_enable_o (icache_prefetch_enable),
14551494
.cl_clint_o (cl_interrupt),
14561495
.core_events_i (core_events),

0 commit comments

Comments
 (0)