Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
27 changes: 11 additions & 16 deletions util/top_gen/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ def pin_direction(pin: Pin) -> Direction:
def block_io_to_pin_map(
blocks: list[BlockIoFlat], pins: list[PinFlat]
) -> BlockIoToPinsMap:
mapping: BlockIoToPinsMap = {block_io.uid: [] for block_io in blocks}
mapping: BlockIoToPinsMap = {}
for pin in pins:
for link in pin.block_io_links:
mapping[link].append(pin)
mapping.setdefault(link, []).append(pin)
return mapping


Expand All @@ -242,16 +242,12 @@ def output_block_ios_iter(
):
continue

possible_pins = block_io_to_pins[block_io.uid]

if len(possible_pins) == 0:
continue

yield OutputBlockIo(
block_io,
possible_pins,
max(len(possible_pins) + 1, 2),
)
if possible_pins := block_io_to_pins.get(block_io.uid):
yield OutputBlockIo(
block_io,
possible_pins,
max(len(possible_pins) + 1, 2),
)


def output_pins_iter(
Expand Down Expand Up @@ -325,10 +321,9 @@ def block_port_definitions(block: Block) -> Iterator[str]:
def generate_top(config: TopConfig) -> None:
"""Generate a top from a top configuration."""

block_ios = list(flatten_block_ios(config.blocks))
pins = list(flatten_pins(config.pins, block_ios))

block_io_to_pins = block_io_to_pin_map(block_ios, pins)
block_ios: list[BlockIoFlat] = list(flatten_block_ios(config.blocks))
pins: list[PinFlat] = list(flatten_pins(config.pins, block_ios))
block_io_to_pins: BlockIoToPinsMap = block_io_to_pin_map(block_ios, pins)

template_variables = {
"config": config,
Expand Down
2 changes: 1 addition & 1 deletion vendor/lowrisc_ip/util/tlgen/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
# by inspecting the base addresses. Note that the validation
# script also ensures that base addresses are aligned with
# to this granularity.
MIN_DEVICE_SPACING = 0x1000
MIN_DEVICE_SPACING = 0x4

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this increase size of tilelink bus?



def check_keys(obj: Dict[Any, Any],
Expand Down
13 changes: 13 additions & 0 deletions vendor/patches/lowrisc_ip/tlgen/0002-min_device_spacing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/validate.py b/validate.py
index d492d3e..6c3cb6d 100644
--- a/validate.py
+++ b/validate.py
@@ -116,7 +116,7 @@ Crossbar configuration format.
# by inspecting the base addresses. Note that the validation
# script also ensures that base addresses are aligned with
# to this granularity.
-MIN_DEVICE_SPACING = 0x1000
+MIN_DEVICE_SPACING = 0x4


def check_keys(obj: Dict[Any, Any],