-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
floogen: Improve use for non-flattened NoCs (#64)
* floogen(utils): Support rendering of multi-dimensional arrays * floogen(utils): Add enum render function * floogen(routing): Allow rendering of route rules without declaration * floogen(network): Render System address map in top-level package * hw(chimney): Pass system address map as parameter * hw(pkg): Regenerate sources * floogen: Format python sources * floogen(router): Allow overwritting the degree of the router * floogen(network): Only copy addr range for subordinate nodes * floogen(connection)!: Use `bidirectional` as default non-bidirectional are not yet supported * floogen(connection): Move error to pydantic model * floogen(graph): Fix order of filters in helper functions * floogen(connection): Introduce `dst_dir` and `src_dir` options * floogen(connection): Remove unused `coord_offset` attribute * floogen(connection): Allow entering connection direction as string * floogen(router): Handle user-provided link directions * Allows the user can provide link directions with `src_dir` and `dst_dir` * Merges `XYRouter` and `Router` together * floogen(tpl): Merge XY and generic router template * floogen(tpl): Fix top-level rendering for XYRouting The endpoint enum is not used for XYRouting * floogen(routing): Use integer enum for `XYDirections` * floogen(examples): Replace `id_offset` in favor of `dst_dir` * floogen(examples): Use 1D-arrays where appropriate * floogen(examples): Specify 5-degree router * floogen: Clean up & whitespaces changes * floogen(examples): Add terapool example * floogen(pylint): Lint sources * floogen(pylint): Waive warning * ci: Add more floogen examples to CI * doc: Update CHANGELOG * ci: Fix CI
- Loading branch information
Showing
28 changed files
with
501 additions
and
311 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
# Copyright 2023 ETH Zurich and University of Bologna. | ||
# Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: terapool | ||
description: "Terapool AXI NoC" | ||
|
||
routing: | ||
route_algo: "SRC" | ||
use_id_table: true | ||
|
||
protocols: | ||
- name: "narrow" | ||
type: "AXI4" | ||
direction: "manager" | ||
data_width: 64 | ||
addr_width: 48 | ||
id_width: 4 | ||
user_width: 1 | ||
- name: "narrow" | ||
type: "AXI4" | ||
direction: "subordinate" | ||
data_width: 64 | ||
addr_width: 48 | ||
id_width: 2 | ||
user_width: 1 | ||
- name: "wide" | ||
type: "AXI4" | ||
direction: "manager" | ||
data_width: 512 | ||
addr_width: 48 | ||
id_width: 3 | ||
user_width: 1 | ||
- name: "wide" | ||
type: "AXI4" | ||
direction: "subordinate" | ||
data_width: 512 | ||
addr_width: 48 | ||
id_width: 1 | ||
user_width: 1 | ||
|
||
endpoints: | ||
- name: "group" | ||
array: [4, 4] | ||
mgr_port_protocol: | ||
- "wide" | ||
- name: "hbm" | ||
array: [16] | ||
addr_range: | ||
base: 0x0000_8000_0000 | ||
size: 0x0000_4000_0000 | ||
sbr_port_protocol: | ||
- "wide" | ||
- name: "peripherals" | ||
addr_range: | ||
start: 0x0000_0000_0000 | ||
end: 0x0000_0fff_ffff | ||
mgr_port_protocol: | ||
- "wide" | ||
sbr_port_protocol: | ||
- "wide" | ||
|
||
routers: | ||
- name: "group_router" | ||
array: [4, 4] | ||
degree: 5 | ||
- name: "periph_router" | ||
|
||
connections: | ||
- src: "group" | ||
dst: "group_router" | ||
src_range: | ||
- [0, 3] | ||
- [0, 3] | ||
dst_range: | ||
- [0, 3] | ||
- [0, 3] | ||
dst_dir: "Eject" | ||
# HBM West | ||
- src: "hbm" | ||
dst: "group_router" | ||
src_range: | ||
- [0, 3] | ||
dst_range: | ||
- [0, 0] | ||
- [0, 3] | ||
dst_dir: "West" | ||
# HBM South | ||
- src: "hbm" | ||
dst: "group_router" | ||
src_range: | ||
- [4, 7] | ||
dst_range: | ||
- [0, 3] | ||
- [0, 0] | ||
dst_dir: "South" | ||
# HBM East | ||
- src: "hbm" | ||
dst: "group_router" | ||
src_range: | ||
- [8, 11] | ||
dst_range: | ||
- [3, 3] | ||
- [0, 3] | ||
dst_dir: "East" | ||
# HBM North | ||
- src: "hbm" | ||
dst: "group_router" | ||
src_range: | ||
- [12, 14] | ||
dst_range: | ||
- [0, 2] | ||
- [3, 3] | ||
dst_dir: "North" | ||
# Attach special peripheral/HBM router to the mesh | ||
- src: "periph_router" | ||
dst: "group_router" | ||
dst_idx: [3, 3] | ||
dst_dir: "North" | ||
# Attach last HBM channel and peripherals to the special router | ||
- src: "periph_router" | ||
dst: "hbm" | ||
dst_idx: [15] | ||
- src: "periph_router" | ||
dst: "peripherals" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,11 @@ | |
# | ||
# Author: Tim Fischer <[email protected]> | ||
|
||
from typing import Optional, List, Tuple, Dict | ||
from typing import Optional, List, Tuple | ||
from pydantic import BaseModel, field_validator, model_validator | ||
|
||
from floogen.model.routing import XYDirections | ||
|
||
|
||
class ConnectionDesc(BaseModel): | ||
"""Connection class to describe a connection between routers and endpoints.""" | ||
|
@@ -21,9 +23,10 @@ class ConnectionDesc(BaseModel): | |
dst_idx: Optional[List[int]] = None | ||
src_lvl: Optional[int] = None | ||
dst_lvl: Optional[int] = None | ||
coord_offset: Optional[Dict] = None | ||
dst_dir: Optional[int] = None | ||
src_dir: Optional[int] = None | ||
allow_multi: Optional[bool] = False | ||
bidirectional: Optional[bool] = False | ||
bidirectional: Optional[bool] = True | ||
|
||
@field_validator("src_idx", "dst_idx", mode="before") | ||
@classmethod | ||
|
@@ -41,3 +44,19 @@ def check_indexing(self): | |
if self.dst_idx and self.dst_lvl: | ||
raise ValueError("dst_idx and dst_lvl are mutually exclusive") | ||
return self | ||
|
||
@field_validator("src_dir", "dst_dir", mode="before") | ||
@classmethod | ||
def str_to_int(cls, v): | ||
"""Convert str to int.""" | ||
if isinstance(v, str): | ||
return XYDirections[v.upper()].value | ||
return v | ||
|
||
@field_validator("bidirectional", mode="after") | ||
@classmethod | ||
def check_bidirectional(cls, v): | ||
"""Check if bidirectional is valid.""" | ||
if not v: | ||
raise NotImplementedError("Unidirectional connections are not supported yet.") | ||
return v |
Oops, something went wrong.