peakrdl-busdecoder 0.4.0__py3-none-any.whl → 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- peakrdl_busdecoder/cpuif/apb3/apb3_cpuif_flat.py +10 -10
- peakrdl_busdecoder/cpuif/apb4/apb4_cpuif_flat.py +12 -12
- peakrdl_busdecoder/cpuif/interface.py +10 -1
- peakrdl_busdecoder/decode_logic_gen.py +3 -1
- peakrdl_busdecoder/sv_int.py +27 -0
- {peakrdl_busdecoder-0.4.0.dist-info → peakrdl_busdecoder-0.6.0.dist-info}/METADATA +4 -4
- {peakrdl_busdecoder-0.4.0.dist-info → peakrdl_busdecoder-0.6.0.dist-info}/RECORD +11 -11
- {peakrdl_busdecoder-0.4.0.dist-info → peakrdl_busdecoder-0.6.0.dist-info}/WHEEL +0 -0
- {peakrdl_busdecoder-0.4.0.dist-info → peakrdl_busdecoder-0.6.0.dist-info}/entry_points.txt +0 -0
- {peakrdl_busdecoder-0.4.0.dist-info → peakrdl_busdecoder-0.6.0.dist-info}/licenses/LICENSE +0 -0
- {peakrdl_busdecoder-0.4.0.dist-info → peakrdl_busdecoder-0.6.0.dist-info}/top_level.txt +0 -0
|
@@ -35,15 +35,15 @@ class APB3CpuifFlat(BaseCpuif):
|
|
|
35
35
|
|
|
36
36
|
def fanout(self, node: AddressableNode) -> str:
|
|
37
37
|
fanout: dict[str, str] = {}
|
|
38
|
-
fanout[self.signal("PSEL", node)] = (
|
|
39
|
-
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, '
|
|
38
|
+
fanout[self.signal("PSEL", node, "gi")] = (
|
|
39
|
+
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, 'gi')}|cpuif_rd_sel.{get_indexed_path(self.exp.ds.top_node, node, 'gi')}"
|
|
40
40
|
)
|
|
41
|
-
fanout[self.signal("PENABLE", node)] = self.signal("PENABLE")
|
|
42
|
-
fanout[self.signal("PWRITE", node)] = (
|
|
43
|
-
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, '
|
|
41
|
+
fanout[self.signal("PENABLE", node, "gi")] = self.signal("PENABLE")
|
|
42
|
+
fanout[self.signal("PWRITE", node, "gi")] = (
|
|
43
|
+
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, 'gi')}"
|
|
44
44
|
)
|
|
45
|
-
fanout[self.signal("PADDR", node)] = self.signal("PADDR")
|
|
46
|
-
fanout[self.signal("PWDATA", node)] = "cpuif_wr_data"
|
|
45
|
+
fanout[self.signal("PADDR", node, "gi")] = self.signal("PADDR")
|
|
46
|
+
fanout[self.signal("PWDATA", node, "gi")] = "cpuif_wr_data"
|
|
47
47
|
|
|
48
48
|
return "\n".join(map(lambda kv: f"assign {kv[0]} = {kv[1]};", fanout.items()))
|
|
49
49
|
|
|
@@ -53,8 +53,8 @@ class APB3CpuifFlat(BaseCpuif):
|
|
|
53
53
|
fanin["cpuif_rd_ack"] = "'0"
|
|
54
54
|
fanin["cpuif_rd_err"] = "'0"
|
|
55
55
|
else:
|
|
56
|
-
fanin["cpuif_rd_ack"] = self.signal("PREADY", node)
|
|
57
|
-
fanin["cpuif_rd_err"] = self.signal("PSLVERR", node)
|
|
56
|
+
fanin["cpuif_rd_ack"] = self.signal("PREADY", node, "i")
|
|
57
|
+
fanin["cpuif_rd_err"] = self.signal("PSLVERR", node, "i")
|
|
58
58
|
|
|
59
59
|
return "\n".join(map(lambda kv: f"{kv[0]} = {kv[1]};", fanin.items()))
|
|
60
60
|
|
|
@@ -63,6 +63,6 @@ class APB3CpuifFlat(BaseCpuif):
|
|
|
63
63
|
if node is None:
|
|
64
64
|
fanin["cpuif_rd_data"] = "'0"
|
|
65
65
|
else:
|
|
66
|
-
fanin["cpuif_rd_data"] = self.signal("PRDATA", node)
|
|
66
|
+
fanin["cpuif_rd_data"] = self.signal("PRDATA", node, "i")
|
|
67
67
|
|
|
68
68
|
return "\n".join(map(lambda kv: f"{kv[0]} = {kv[1]};", fanin.items()))
|
|
@@ -35,17 +35,17 @@ class APB4CpuifFlat(BaseCpuif):
|
|
|
35
35
|
|
|
36
36
|
def fanout(self, node: AddressableNode) -> str:
|
|
37
37
|
fanout: dict[str, str] = {}
|
|
38
|
-
fanout[self.signal("PSEL", node)] = (
|
|
39
|
-
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, '
|
|
38
|
+
fanout[self.signal("PSEL", node, "gi")] = (
|
|
39
|
+
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, 'gi')}|cpuif_rd_sel.{get_indexed_path(self.exp.ds.top_node, node, 'gi')}"
|
|
40
40
|
)
|
|
41
|
-
fanout[self.signal("PENABLE", node)] = self.signal("PENABLE")
|
|
42
|
-
fanout[self.signal("PWRITE", node)] = (
|
|
43
|
-
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, '
|
|
41
|
+
fanout[self.signal("PENABLE", node, "gi")] = self.signal("PENABLE")
|
|
42
|
+
fanout[self.signal("PWRITE", node, "gi")] = (
|
|
43
|
+
f"cpuif_wr_sel.{get_indexed_path(self.exp.ds.top_node, node, 'gi')}"
|
|
44
44
|
)
|
|
45
|
-
fanout[self.signal("PADDR", node)] = self.signal("PADDR")
|
|
46
|
-
fanout[self.signal("PPROT", node)] = self.signal("PPROT")
|
|
47
|
-
fanout[self.signal("PWDATA", node)] = "cpuif_wr_data"
|
|
48
|
-
fanout[self.signal("PSTRB", node)] = "cpuif_wr_byte_en"
|
|
45
|
+
fanout[self.signal("PADDR", node, "gi")] = self.signal("PADDR")
|
|
46
|
+
fanout[self.signal("PPROT", node, "gi")] = self.signal("PPROT")
|
|
47
|
+
fanout[self.signal("PWDATA", node, "gi")] = "cpuif_wr_data"
|
|
48
|
+
fanout[self.signal("PSTRB", node, "gi")] = "cpuif_wr_byte_en"
|
|
49
49
|
|
|
50
50
|
return "\n".join(map(lambda kv: f"assign {kv[0]} = {kv[1]};", fanout.items()))
|
|
51
51
|
|
|
@@ -55,8 +55,8 @@ class APB4CpuifFlat(BaseCpuif):
|
|
|
55
55
|
fanin["cpuif_rd_ack"] = "'0"
|
|
56
56
|
fanin["cpuif_rd_err"] = "'0"
|
|
57
57
|
else:
|
|
58
|
-
fanin["cpuif_rd_ack"] = self.signal("PREADY", node)
|
|
59
|
-
fanin["cpuif_rd_err"] = self.signal("PSLVERR", node)
|
|
58
|
+
fanin["cpuif_rd_ack"] = self.signal("PREADY", node, "i")
|
|
59
|
+
fanin["cpuif_rd_err"] = self.signal("PSLVERR", node, "i")
|
|
60
60
|
|
|
61
61
|
return "\n".join(map(lambda kv: f"{kv[0]} = {kv[1]};", fanin.items()))
|
|
62
62
|
|
|
@@ -65,6 +65,6 @@ class APB4CpuifFlat(BaseCpuif):
|
|
|
65
65
|
if node is None:
|
|
66
66
|
fanin["cpuif_rd_data"] = "'0"
|
|
67
67
|
else:
|
|
68
|
-
fanin["cpuif_rd_data"] = self.signal("PRDATA", node)
|
|
68
|
+
fanin["cpuif_rd_data"] = self.signal("PRDATA", node, "i")
|
|
69
69
|
|
|
70
70
|
return "\n".join(map(lambda kv: f"{kv[0]} = {kv[1]};", fanin.items()))
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"""Interface abstraction for handling flat and non-flat signal declarations."""
|
|
2
2
|
|
|
3
|
+
import re
|
|
3
4
|
from abc import ABC, abstractmethod
|
|
4
5
|
from typing import TYPE_CHECKING
|
|
5
6
|
|
|
6
7
|
from systemrdl.node import AddressableNode
|
|
7
8
|
|
|
9
|
+
from ..utils import get_indexed_path
|
|
10
|
+
|
|
8
11
|
if TYPE_CHECKING:
|
|
9
12
|
from .base_cpuif import BaseCpuif
|
|
10
13
|
|
|
@@ -93,7 +96,6 @@ class SVInterface(Interface):
|
|
|
93
96
|
indexer: str | int | None = None,
|
|
94
97
|
) -> str:
|
|
95
98
|
"""Generate SystemVerilog interface signal reference."""
|
|
96
|
-
from ..utils import get_indexed_path
|
|
97
99
|
|
|
98
100
|
# SVInterface only supports string indexers (loop variable names like "i", "gi")
|
|
99
101
|
if indexer is not None and not isinstance(indexer, str):
|
|
@@ -166,6 +168,13 @@ class FlatInterface(Interface):
|
|
|
166
168
|
|
|
167
169
|
# Is an array
|
|
168
170
|
if indexer is not None:
|
|
171
|
+
if isinstance(indexer, str):
|
|
172
|
+
indexed_path = get_indexed_path(node.parent, node, indexer, skip_kw_filter=True)
|
|
173
|
+
pattern = r"\[.*?\]"
|
|
174
|
+
indexes = re.findall(pattern, indexed_path)
|
|
175
|
+
|
|
176
|
+
return f"{base}_{signal}{''.join(indexes)}"
|
|
177
|
+
|
|
169
178
|
return f"{base}_{signal}[{indexer}]"
|
|
170
179
|
return f"{base}_{signal}[N_{node.inst_name.upper()}S]"
|
|
171
180
|
|
|
@@ -70,7 +70,9 @@ class DecodeLogicGenerator(BusDecoderListener):
|
|
|
70
70
|
# Avoid generating a redundant >= 0 comparison, which triggers Verilator warnings.
|
|
71
71
|
if not (l_bound.value == 0 and len(l_bound_comp) == 1):
|
|
72
72
|
predicates.append(lower_expr)
|
|
73
|
-
|
|
73
|
+
# Avoid generating a redundant full-width < max comparison, which triggers Verilator warnings.
|
|
74
|
+
if not (u_bound.value == (1 << addr_width) and len(u_bound_comp) == 1):
|
|
75
|
+
predicates.append(upper_expr)
|
|
74
76
|
|
|
75
77
|
return predicates
|
|
76
78
|
|
peakrdl_busdecoder/sv_int.py
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
class SVInt:
|
|
2
5
|
def __init__(self, value: int, width: int | None = None) -> None:
|
|
3
6
|
self.value = value
|
|
@@ -19,3 +22,27 @@ class SVInt:
|
|
|
19
22
|
return SVInt(self.value + other.value, max(self.width, other.width))
|
|
20
23
|
else:
|
|
21
24
|
return SVInt(self.value + other.value, None)
|
|
25
|
+
|
|
26
|
+
def __sub__(self, other: "SVInt") -> "SVInt":
|
|
27
|
+
if self.width is not None and other.width is not None:
|
|
28
|
+
return SVInt(self.value - other.value, max(self.width, other.width))
|
|
29
|
+
else:
|
|
30
|
+
return SVInt(self.value - other.value, None)
|
|
31
|
+
|
|
32
|
+
def __len__(self) -> int:
|
|
33
|
+
if self.width is not None:
|
|
34
|
+
return self.width
|
|
35
|
+
else:
|
|
36
|
+
return self.value.bit_length()
|
|
37
|
+
|
|
38
|
+
def to_bytes(self, byteorder: Literal["little", "big"] = "little") -> bytes:
|
|
39
|
+
byte_length = (self.value.bit_length() + 7) // 8
|
|
40
|
+
return self.value.to_bytes(byte_length, byteorder)
|
|
41
|
+
|
|
42
|
+
def __eq__(self, other: object) -> bool:
|
|
43
|
+
if not isinstance(other, SVInt):
|
|
44
|
+
return NotImplemented
|
|
45
|
+
return self.value == other.value and self.width == other.width
|
|
46
|
+
|
|
47
|
+
def __hash__(self) -> int:
|
|
48
|
+
return hash((self.value, self.width))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: peakrdl-busdecoder
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Generate a SystemVerilog bus decoder from SystemRDL for splitting CPU interfaces to multiple sub-address spaces
|
|
5
|
-
Author:
|
|
5
|
+
Author: Arnav Sacheti
|
|
6
6
|
License: LGPLv3
|
|
7
7
|
Project-URL: Source, https://github.com/arnavsacheti/PeakRDL-BusDecoder
|
|
8
8
|
Project-URL: Tracker, https://github.com/arnavsacheti/PeakRDL-BusDecoder/issues
|
|
@@ -20,8 +20,8 @@ Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA
|
|
|
20
20
|
Requires-Python: >=3.10
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: jinja2
|
|
24
|
-
Requires-Dist: systemrdl-compiler~=1.30
|
|
23
|
+
Requires-Dist: jinja2~=3.1
|
|
24
|
+
Requires-Dist: systemrdl-compiler~=1.30
|
|
25
25
|
Provides-Extra: cli
|
|
26
26
|
Requires-Dist: peakrdl-cli>=1.2.3; extra == "cli"
|
|
27
27
|
Dynamic: license-file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
peakrdl_busdecoder/__init__.py,sha256=zKSEa8EqCrZUtGoHCuZ0uNQVQMV2isVn47CgsDj5K48,75
|
|
2
2
|
peakrdl_busdecoder/__peakrdl__.py,sha256=76kLBbSWVlKkCI5ESiID1aWVcQHr4sK32ujP5kna8xU,4601
|
|
3
|
-
peakrdl_busdecoder/decode_logic_gen.py,sha256=
|
|
3
|
+
peakrdl_busdecoder/decode_logic_gen.py,sha256=q4qSmufJI28eX75A532BOoNfIufljq3gHNLdqKbRqio,6060
|
|
4
4
|
peakrdl_busdecoder/design_scanner.py,sha256=syD6IXAJWYdpq2PQPvUGflPjhR_pO35R46Ld5K5XZHQ,1562
|
|
5
5
|
peakrdl_busdecoder/design_state.py,sha256=_zqgn2dQH2ozK63NwqRvPV7Bty7G-BAESu3yux2cJmI,4926
|
|
6
6
|
peakrdl_busdecoder/exporter.py,sha256=ZkGBeK-c733a3Xyc2ZeiGbWgBnDDW_s9nc64QiEf6no,5356
|
|
@@ -10,7 +10,7 @@ peakrdl_busdecoder/module_tmpl.sv,sha256=Sjo05-g_oP48x0jCdEyOvpBjwYV3wiACESgaC7v
|
|
|
10
10
|
peakrdl_busdecoder/package_tmpl.sv,sha256=E0_jYmXx1nEMb78WApbCvMWYlrAuNfSWB7Jw23UkBYU,852
|
|
11
11
|
peakrdl_busdecoder/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
peakrdl_busdecoder/struct_gen.py,sha256=UGNdGg-S6u2JRoDExP6Mt5h3bu01fP-gQ15FcwD9gNw,2334
|
|
13
|
-
peakrdl_busdecoder/sv_int.py,sha256=
|
|
13
|
+
peakrdl_busdecoder/sv_int.py,sha256=D57h4sgqnQWQtPw80OeDZk_i2_t2aOTsihmASB4NkGo,1788
|
|
14
14
|
peakrdl_busdecoder/utils.py,sha256=Kdcee6bhubI5XVX20JQ3wo0qYJTknqrv4l8kxhSd7wI,2219
|
|
15
15
|
peakrdl_busdecoder/validate_design.py,sha256=91yuWEzj0aAZ0eqzF1TF4N17yqG-D5oK5yYxDINlPms,8857
|
|
16
16
|
peakrdl_busdecoder/body/__init__.py,sha256=ZFTs8xIxeLyasyabLtGp7kClmmLlJpqdKJ854pmvTJg,311
|
|
@@ -24,15 +24,15 @@ peakrdl_busdecoder/cpuif/base_cpuif.py,sha256=tSqBeV_eG5zvBaLltLY8qmJBhwuCym3rs_
|
|
|
24
24
|
peakrdl_busdecoder/cpuif/fanin_gen.py,sha256=ioCxjj3V3X8rHssqwuI4p_U-LKpBalATW_Qshtt8j9U,2425
|
|
25
25
|
peakrdl_busdecoder/cpuif/fanin_intermediate_gen.py,sha256=hfvMyyx5ajEzvop3dzV37dT6Jn9yjORFnUkMAT1034A,5271
|
|
26
26
|
peakrdl_busdecoder/cpuif/fanout_gen.py,sha256=0-6eMzYbf25csHaRUJCsiyFz7lxS2Mdu0bXNm6e6cFI,1850
|
|
27
|
-
peakrdl_busdecoder/cpuif/interface.py,sha256=
|
|
27
|
+
peakrdl_busdecoder/cpuif/interface.py,sha256=4NYJHv2rr50YLm_eB9I89Y4XUckMD42ZtHskU0_Nm8o,6448
|
|
28
28
|
peakrdl_busdecoder/cpuif/apb3/__init__.py,sha256=Uq82IJHzlITUvjTuETvPpSzvLEYoairzzPKfPz7kuC4,119
|
|
29
29
|
peakrdl_busdecoder/cpuif/apb3/apb3_cpuif.py,sha256=iQDpHpv9HQQiBm9zHlUuSCaUysraFvHA25kt2XlpKmM,4248
|
|
30
|
-
peakrdl_busdecoder/cpuif/apb3/apb3_cpuif_flat.py,sha256=
|
|
30
|
+
peakrdl_busdecoder/cpuif/apb3/apb3_cpuif_flat.py,sha256=az0u0YOIuB5Tk2Dq76hu1B_batkiE3phnJS8G4pGyho,2422
|
|
31
31
|
peakrdl_busdecoder/cpuif/apb3/apb3_interface.py,sha256=hU0GUCZGYnvskmZU6NznMGgRJFliD360WgwhsQh9rqY,2147
|
|
32
32
|
peakrdl_busdecoder/cpuif/apb3/apb3_tmpl.sv,sha256=6et25KbiNkZBD1hxjSx0XZFUP9NnvVpixMSGtwJuwdA,1967
|
|
33
33
|
peakrdl_busdecoder/cpuif/apb4/__init__.py,sha256=k4JCbIrKGT8hiRvWJDcqc5xx7j9i_xYgpXU70sNaLsc,119
|
|
34
34
|
peakrdl_busdecoder/cpuif/apb4/apb4_cpuif.py,sha256=SnQ1wERBkk1yc4ZiE4z__Sp2441ljFJ7b7mxGPKoiFQ,4457
|
|
35
|
-
peakrdl_busdecoder/cpuif/apb4/apb4_cpuif_flat.py,sha256=
|
|
35
|
+
peakrdl_busdecoder/cpuif/apb4/apb4_cpuif_flat.py,sha256=rTLOYGdHLGD6aPs18Wb7R7gASnX1QnVpYQCotbrhP5U,2564
|
|
36
36
|
peakrdl_busdecoder/cpuif/apb4/apb4_interface.py,sha256=Ln5jIBhCHbIYS5sxR5AjFVvcMYD_rw71VF6KqyyNUkg,2449
|
|
37
37
|
peakrdl_busdecoder/cpuif/apb4/apb4_tmpl.sv,sha256=jjzIbiNvsDeMQWOIo08TpeKbSP3NILQkP3gWdlcX9Ak,2310
|
|
38
38
|
peakrdl_busdecoder/cpuif/axi4lite/__init__.py,sha256=5XuWfPK2jDzr6egKUDJFr8l3k3lW-feLIh-lN7Mo8Ks,145
|
|
@@ -41,9 +41,9 @@ peakrdl_busdecoder/cpuif/axi4lite/axi4_lite_cpuif_flat.py,sha256=M9f6-2XloH1UCwH
|
|
|
41
41
|
peakrdl_busdecoder/cpuif/axi4lite/axi4_lite_interface.py,sha256=eBs3RLGGvvQen4C6MR9RUZIHuTQEidYHG4NGxlYY1Bc,3702
|
|
42
42
|
peakrdl_busdecoder/cpuif/axi4lite/axi4_lite_tmpl.sv,sha256=ketPrq715LSEs8Ar9ecXgnSe2AUAdQ70oNVmDbXc2Tc,3351
|
|
43
43
|
peakrdl_busdecoder/udps/__init__.py,sha256=gPc74OMVWTIr5vgtFArzbhEyi1OYjllR3ZFwHJ8APaY,106
|
|
44
|
-
peakrdl_busdecoder-0.
|
|
45
|
-
peakrdl_busdecoder-0.
|
|
46
|
-
peakrdl_busdecoder-0.
|
|
47
|
-
peakrdl_busdecoder-0.
|
|
48
|
-
peakrdl_busdecoder-0.
|
|
49
|
-
peakrdl_busdecoder-0.
|
|
44
|
+
peakrdl_busdecoder-0.6.0.dist-info/licenses/LICENSE,sha256=eAMIGRcnsTDZVr4qelHkJ49Rd_IiDY4_MVHU7N0UWSw,7646
|
|
45
|
+
peakrdl_busdecoder-0.6.0.dist-info/METADATA,sha256=GNPShOm8hPu8gRdvDCK6v5rQgKJIPuPUVeIyTfZf83U,2558
|
|
46
|
+
peakrdl_busdecoder-0.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
47
|
+
peakrdl_busdecoder-0.6.0.dist-info/entry_points.txt,sha256=7Xzgt-C2F4cQu1kRLpZa0MbXSFFMC1SWEDnZkY0GH7s,73
|
|
48
|
+
peakrdl_busdecoder-0.6.0.dist-info/top_level.txt,sha256=ZIYuTsl8cYby4g8tNR_JGzbYYTrG9mqYLSBqnY1Gpmk,19
|
|
49
|
+
peakrdl_busdecoder-0.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|