Skip to content

Commit

Permalink
floogen: Improve use for non-flattened NoCs (#64)
Browse files Browse the repository at this point in the history
* 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
fischeti authored Sep 4, 2024
1 parent 7c218ee commit 455548c
Show file tree
Hide file tree
Showing 28 changed files with 501 additions and 311 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/floogen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
examples: ["single_cluster", "occamy_mesh", "occamy_tree"]
examples: ["single_cluster", "occamy_mesh", "occamy_tree", "occamy_mesh_src", "terapool"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added virtual channel router `floo_vc_router` and corresponding `floo_vc_narrow_wide_chimney`. Currently only supports XY-Routing and mesh topologies.
- Preliminary support for multiple local ports in the routers.
- Additional traffic pattern generation and visualization.
- Added option in `floogen` to define the direction of `connections` to/from routers with `dst_dir` and `src_dir` flags. This replaces the previous `id_offset` flag for that purpose. Specifying the direction of the connection is useful for mesh topologies with `XYRouting`, but also for tile-based implementation, where the order of the ports matters resp. needs to be known.
- `routers` in `floogen` can no be configured with `degree` to overwrite the number of ports. This is manily useful for tile-based implementations, where all tiles should have identical routers.

### Changed

Expand All @@ -24,6 +26,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Bumped `idma` dependency to `0.6`
- Renamed `rsvd` field in flits to `payload` to better reflect its purpose.
- Reordered directions in `route_direction_e` to better support multiple local ports.
- Moved all system related rendered parameters from the flit package to its own package in `my_system_floo_noc.sv`. This allows to use the auto-generated routing information for tile-based implementations, that are assembled by hand.
- The `bidirectional` flag for `connections` in `floogen` is set to `true` by default, since uni-directional links are currently not supported.
- The System Address now needs to be passed as a parameter in the `chimneys`, since it is not part of the flit packages anymore.

### Fixed

Expand Down
32 changes: 8 additions & 24 deletions floogen/examples/occamy_mesh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,16 @@ endpoints:
sbr_port_protocol:
- "narrow"
- "wide"
id_offset:
x: 0
y: 0
- name: "hbm"
array: [1, 8]
array: [8]
addr_range:
base: 0x0000_8000_0000
size: 0x0000_4000_0000
sbr_port_protocol:
- "narrow"
- "wide"
id_offset:
x: -1
y: 0
- name: "serial_link"
array: [3, 1]
array: [3]
addr_range:
base: 0x0100_0000_0000
size: 0x0010_000_0000
Expand All @@ -76,22 +70,13 @@ endpoints:
sbr_port_protocol:
- "narrow"
- "wide"
id_offset:
x: 0
y: -1
- name: "cva6"
mgr_port_protocol:
- "narrow"
id_offset:
x: 0
y: 8
- name: "peripherals"
addr_range:
start: 0x0000_0000_0000
end: 0x0000_0fff_ffff
id_offset:
x: 1
y: 8
mgr_port_protocol:
- "narrow"
sbr_port_protocol:
Expand All @@ -100,6 +85,7 @@ endpoints:
routers:
- name: "router"
array: [3, 8]
degree: 5

connections:
- src: "cluster"
Expand All @@ -110,30 +96,28 @@ connections:
dst_range:
- [0, 2]
- [0, 7]
bidirectional: true
dst_dir: "Eject"
- src: "hbm"
dst: "router"
src_range:
- [0, 0]
- [0, 7]
dst_range:
- [0, 0]
- [0, 7]
bidirectional: true
dst_dir: "West"
- src: "serial_link"
dst: "router"
src_range:
- [0, 2]
- [0, 0]
dst_range:
- [0, 2]
- [0, 0]
bidirectional: true
dst_dir: "South"
- src: "cva6"
dst: "router"
dst_idx: [0, 7]
bidirectional: true
dst_dir: "North"
- src: "peripherals"
dst: "router"
dst_idx: [1, 7]
bidirectional: true
dst_dir: "North"
8 changes: 2 additions & 6 deletions floogen/examples/occamy_mesh_src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0

name: occamy_mesh
name: occamy_mesh_src
description: "Occamy mesh configuration for FlooGen with source-based routing"

routing:
Expand Down Expand Up @@ -85,6 +85,7 @@ endpoints:
routers:
- name: "router"
array: [3, 8]
degree: 5

connections:
- src: "cluster"
Expand All @@ -95,28 +96,23 @@ connections:
dst_range:
- [0, 2]
- [0, 7]
bidirectional: true
- src: "hbm"
dst: "router"
src_range:
- [0, 7]
dst_range:
- [0, 0]
- [0, 7]
bidirectional: true
- src: "serial_link"
dst: "router"
src_range:
- [0, 2]
dst_range:
- [0, 2]
- [0, 0]
bidirectional: true
- src: "cva6"
dst: "router"
dst_idx: [0, 7]
bidirectional: true
- src: "peripherals"
dst: "router"
dst_idx: [1, 7]
bidirectional: true
4 changes: 0 additions & 4 deletions floogen/examples/occamy_tree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,15 @@ connections:
- [0, 3]
dst_lvl: 1
allow_multi: true
bidirectional: true
- src: "router"
dst: "hbm"
dst_range:
- [0, 7]
src_lvl: 0
allow_multi: true
bidirectional: true
- src: "router"
dst: "serial_link"
src_lvl: 0
bidirectional: true
- src: "router"
dst: "peripherals"
src_lvl: 0
bidirectional: true
5 changes: 0 additions & 5 deletions floogen/examples/single_cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,11 @@ routers:
connections:
- src: "cluster"
dst: "router"
bidirectional: true
- src: "hbm"
dst: "router"
bidirectional: true
- src: "serial_link"
dst: "router"
bidirectional: true
- src: "cva6"
dst: "router"
bidirectional: true
- src: "peripherals"
dst: "router"
bidirectional: true
125 changes: 125 additions & 0 deletions floogen/examples/terapool.yml
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"
25 changes: 22 additions & 3 deletions floogen/model/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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
Expand All @@ -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
Loading

0 comments on commit 455548c

Please sign in to comment.