Skip to content

Commit c413e1e

Browse files
micprogcolluca
authored andcommitted
treewide: Replace hjson and reggen with rdl and peakrdl
1 parent 79844e3 commit c413e1e

33 files changed

+1270
-3465
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/[email protected].1
123+
- uses: actions/checkout@v4
124+
- uses: DoozyX/[email protected].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: 4 additions & 5 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:
@@ -189,10 +188,10 @@ sources:
189188
# target/snitch_cluster
190189
- target: snitch_cluster_wrapper
191190
files:
192-
- target/snitch_cluster/.generated/snitch_cluster_pkg.sv
191+
- target/snitch_cluster/generated/snitch_cluster_pkg.sv
193192
- target: all(snitch_cluster_wrapper, not(postlayout))
194193
files:
195-
- target/snitch_cluster/.generated/snitch_cluster_wrapper.sv
194+
- target/snitch_cluster/generated/snitch_cluster_wrapper.sv
196195
- target: all(snitch_cluster_wrapper, postlayout)
197196
files:
198197
- nonfree/gf12/fusion/runs/0/out/15/snitch_cluster_wrapper.v

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

@@ -428,16 +428,17 @@ module snitch_cluster
428428
`AXI_TYPEDEF_ALL(axi_mst_dma, addr_t, id_dma_mst_t, data_dma_t, strb_dma_t, user_dma_t)
429429
`AXI_TYPEDEF_ALL(axi_slv_dma, addr_t, id_dma_slv_t, data_dma_t, strb_dma_t, user_dma_t)
430430

431+
`AXI_LITE_TYPEDEF_ALL(axi_lite, addr_t, data_t, strb_t)
432+
433+
`APB_TYPEDEF_ALL(apb, addr_t, data_t, strb_t)
434+
431435
`REQRSP_TYPEDEF_ALL(reqrsp, addr_t, data_t, strb_t)
432436

433437
`MEM_TYPEDEF_ALL(mem, tcdm_mem_addr_t, data_t, strb_t, tcdm_user_t)
434438
`MEM_TYPEDEF_ALL(mem_dma, tcdm_mem_addr_t, data_dma_t, strb_dma_t, logic)
435439

436440
`TCDM_TYPEDEF_ALL(tcdm, tcdm_addr_t, data_t, strb_t, tcdm_user_t)
437441

438-
`REG_BUS_TYPEDEF_REQ(reg_req_t, addr_t, data_t, strb_t)
439-
`REG_BUS_TYPEDEF_RSP(reg_rsp_t, data_t)
440-
441442
// Event counter increments for the TCDM.
442443
typedef struct packed {
443444
/// Number requests going in
@@ -604,8 +605,10 @@ module snitch_cluster
604605
reqrsp_rsp_t [NrHives-1:0] ptw_rsp;
605606

606607
// 5. Peripheral Subsystem
607-
reg_req_t reg_req;
608-
reg_rsp_t reg_rsp;
608+
axi_lite_req_t axi_lite_req;
609+
axi_lite_resp_t axi_lite_resp;
610+
apb_req_t apb_req;
611+
apb_resp_t apb_resp;
609612

610613
// 5. Misc. Wires.
611614
logic icache_prefetch_enable;
@@ -1374,26 +1377,59 @@ module snitch_cluster
13741377
);
13751378

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

13991435
if (IntBootromEnable) begin : gen_bootrom
@@ -1442,17 +1478,20 @@ module snitch_cluster
14421478
end
14431479

14441480
snitch_cluster_peripheral #(
1445-
.reg_req_t (reg_req_t),
1446-
.reg_rsp_t (reg_rsp_t),
1481+
.addr_t (addr_t),
1482+
.data_t (data_t),
1483+
.strb_t (strb_t),
1484+
.apb_req_t (apb_req_t),
1485+
.apb_resp_t (apb_resp_t),
14471486
.tcdm_events_t (tcdm_events_t),
14481487
.dma_events_t (dma_events_t),
14491488
.NrCores (NrCores),
14501489
.DMANumChannels (DMANumChannels)
14511490
) i_snitch_cluster_peripheral (
14521491
.clk_i,
14531492
.rst_ni,
1454-
.reg_req_i (reg_req),
1455-
.reg_rsp_o (reg_rsp),
1493+
.apb_req_i (apb_req),
1494+
.apb_resp_o (apb_resp),
14561495
.icache_prefetch_enable_o (icache_prefetch_enable),
14571496
.cl_clint_o (cl_interrupt),
14581497
.core_events_i (core_events),

0 commit comments

Comments
 (0)