Skip to content

Commit 797f2dc

Browse files
committed
Add control register file
1 parent 8b0d6a3 commit 797f2dc

7 files changed

Lines changed: 2641 additions & 1 deletion

File tree

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
paths: |
2424
./src
2525
./test
26+
exclude_paths: |
27+
./src/ctrl_unit/cluster_icache_ctrl_reg_top.sv
28+
./src/ctrl_unit/cluster_icache_ctrl_reg_pkg.sv
2629
github_token: ${{ secrets.GITHUB_TOKEN }}
2730
fail_on_error: true
2831
reviewdog_reporter: github-check

Bender.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies:
1616
tech_cells_generic: { git: "https://github.com/pulp-platform/tech_cells_generic.git", version: 0.2.11 }
1717
axi: { git: "https://github.com/pulp-platform/axi.git", version: 0.39.1 }
1818
scm: { git: "https://github.com/pulp-platform/scm.git", version: 1.1.0 }
19+
register_interface: { git: "https://github.com/pulp-platform/register_interface.git", version: 0.4.4 }
1920

2021
sources:
2122
# Source files grouped in levels. Files in level 0 have no dependencies on files in this
@@ -37,6 +38,11 @@ sources:
3738
# Level 3
3839
- src/snitch_icache.sv
3940
- src/snitch_read_only_cache.sv
41+
# Level 4
42+
- files: # ctrl_unit
43+
- src/ctrl_unit/cluster_icache_ctrl_reg_pkg.sv
44+
- src/ctrl_unit/cluster_icache_ctrl_reg_top.sv
45+
- src/ctrl_unit/cluster_icache_ctrl_unit.sv
4046
- target: test
4147
files:
4248
- test/snitch_icache_l0_tb.sv

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ VLOG_FLAGS += -svinputport=compat
99
VLOG_FLAGS += -suppress 2583
1010
VLOG_FLAGS += +cover=sbecft
1111

12+
CTRL_UNIT_DIR = src/ctrl_unit
13+
CTRL_UNIT = $(CTRL_UNIT_DIR)/cluster_icache_ctrl
14+
1215
Bender.lock:
1316
$(BENDER) update
1417

1518
.bender:
1619
$(BENDER) checkout
1720

18-
compile.tcl: .bender
21+
.PHONY: gen_hw
22+
gen_hw: .bender $(CTRL_UNIT)_reg_top.sv
23+
24+
$(CTRL_UNIT)_reg_top.sv: .bender $(CTRL_UNIT).hjson
25+
python $(shell $(BENDER) path register_interface)/vendor/lowrisc_opentitan/util/regtool.py $(CTRL_UNIT).hjson -t $(CTRL_UNIT_DIR) -r
26+
27+
compile.tcl: .bender Bender.yml Bender.lock
1928
$(BENDER) script vsim -t test \
2029
--vlog-arg="$(VLOG_FLAGS)" \
2130
> compile.tcl
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
// Copyright 2024 ETH Zurich and University of Bologna.
2+
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
3+
// SPDX-License-Identifier: SHL-0.51
4+
5+
{
6+
name: "cluster_icache_ctrl",
7+
clock_primary: "clk_i",
8+
reset_primary: "rst_ni",
9+
bus_interfaces: [
10+
{ protocol: "reg_iface",
11+
direction: "device"
12+
}
13+
],
14+
15+
param_list: [
16+
{ name: "NumCores",
17+
desc: "Number of cores",
18+
default: "8"
19+
},
20+
{ name: "NumAvailableCounters",
21+
desc: "Number of available counters",
22+
default: "44" // NumL1Events + NumCores * NumL0Events
23+
},
24+
],
25+
26+
regwidth: "32",
27+
registers: [
28+
{ name: "enable",
29+
desc: "",
30+
swaccess: "rw",
31+
hwaccess: "hro",
32+
fields: [
33+
{ bits: "0",
34+
name: "enable",
35+
desc: "",
36+
resval: 0x1
37+
}
38+
]
39+
},
40+
{ name: "flush",
41+
desc: "Flush all levels of the cache",
42+
swaccess: "rw",
43+
hwaccess: "hrw",
44+
hwqe: "true",
45+
hwext: "true",
46+
fields: [
47+
{ bits: "0",
48+
name: "flush",
49+
desc: "",
50+
resval: 0x0
51+
}
52+
]
53+
},
54+
{ name: "flush_l1_only",
55+
desc: "not yet functional",
56+
swaccess: "rw",
57+
hwaccess: "hrw",
58+
hwext: "true",
59+
hwqe: "true",
60+
fields: [
61+
{ bits: "0",
62+
name: "flush",
63+
desc: "",
64+
resval: 0x0
65+
}
66+
]
67+
},
68+
{ name: "sel_flush_icache",
69+
desc: "flush specified L0 banks (and currently the complete L1)",
70+
swaccess: "rw",
71+
hwaccess: "hrw",
72+
hwext: "true",
73+
hwqe: "true",
74+
fields: [
75+
{ bits: "NumCores-1:0",
76+
name: "flush",
77+
desc: "",
78+
resval: 0x0000_0000
79+
}
80+
]
81+
},
82+
{ name: "clear_counters",
83+
desc: "Clear all performance counters",
84+
swaccess: "rw",
85+
hwaccess: "hrw",
86+
hwqe: "true",
87+
hwext: "true",
88+
fields: [
89+
{ bits: "0",
90+
name: "clear",
91+
desc: "",
92+
resval: 0x0
93+
}
94+
]
95+
},
96+
{ name: "enable_counters",
97+
desc: "Enable performance counters",
98+
swaccess: "rw",
99+
hwaccess: "hro",
100+
fields: [
101+
{ bits: "0",
102+
name: "enable",
103+
desc: "",
104+
resval: 0x1
105+
}
106+
]
107+
},
108+
{ skipto: "0x1C" },
109+
{ name: "enable_prefetch",
110+
desc: "Enable prefetching",
111+
swaccess: "rw",
112+
hwaccess: "hro",
113+
fields: [
114+
{ bits: "0",
115+
name: "enable",
116+
desc: "",
117+
resval: 0x1
118+
}
119+
]
120+
},
121+
{ multireg: {
122+
name: "counters",
123+
desc: "Performance counters",
124+
count: "NumAvailableCounters",
125+
cname: "id",
126+
swaccess: "rw0c",
127+
hwaccess: "hrw",
128+
fields: [
129+
{ bits: "31:0",
130+
name: "counter",
131+
desc: "",
132+
resval: 0x0000_0000
133+
}
134+
]
135+
}
136+
},
137+
],
138+
}

0 commit comments

Comments
 (0)