-
Notifications
You must be signed in to change notification settings - Fork 39
Add generative IOs #380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: FABulous2.0-development
Are you sure you want to change the base?
Add generative IOs #380
Changes from all commits
d2e7880
3668642
f9bb95d
c0889c7
bd743b5
816129a
5a6e0bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,12 @@ class Fabric: | |
A dictionary of tiles used in the fabric. The key is the name of the tile and the value is the tile. | ||
superTileDic : dict[str, SuperTile] | ||
A dictionary of super tiles used in the fabric. The key is the name of the super tile and the value is the super tile. | ||
unusedTileDic: dict[str, Tile] | ||
A dictionary of tiles that are not used in the fabric, but defined in the fabric.csv. | ||
The key is the name of the tile and the value is the tile. | ||
unusedSuperTileDic: dict[str, Tile] | ||
A dictionary of super tiles that are not used in the fabric, but defined in the fabric.csv. | ||
The key is the name of the tile and the value is the tile. | ||
""" | ||
|
||
tile: list[list[Tile]] = field(default_factory=list) | ||
|
@@ -76,6 +82,8 @@ class Fabric: | |
|
||
tileDic: dict[str, Tile] = field(default_factory=dict) | ||
superTileDic: dict[str, SuperTile] = field(default_factory=dict) | ||
unusedTileDic: dict[str, Tile] = field(default_factory=dict) | ||
unusedSuperTileDic: dict[str, SuperTile] = field(default_factory=dict) | ||
# wires: list[Wire] = field(default_factory=list) | ||
commonWirePair: list[tuple[str, str]] = field(default_factory=list) | ||
|
||
|
@@ -252,10 +260,16 @@ def __repr__(self) -> str: | |
return fabric | ||
|
||
def getTileByName(self, name: str) -> Tile | None: | ||
return self.tileDic.get(name) | ||
ret = self.tileDic.get(name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you will need the |
||
if ret is None: | ||
ret = self.unusedTileDic.get(name) | ||
return ret | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of returning |
||
|
||
def getSuperTileByName(self, name: str) -> SuperTile | None: | ||
return self.superTileDic.get(name) | ||
ret = self.superTileDic.get(name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
if ret is None: | ||
ret = self.unusedSuperTileDic.get(name) | ||
return ret | ||
|
||
def getAllUniqueBels(self) -> list[Bel]: | ||
bels = list() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from dataclasses import dataclass, field | ||
from FABulous.fabric_definition.define import IO | ||
|
||
|
||
@dataclass | ||
class Gen_IO: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can make this can inherit the Bel class, which will allow this to treat it as normal bel as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about this, but currently all Gen_IO of a tile get assembled together to one Bel. I could split this, that one Gen_IO creates on Bel, but it felt more robust and easier to handle if you have one big IO Bel instead of a plenty small one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will still be a single Bel. It will just have a special attribute. So rather than:
and you have lot of them,
but still a single bel. |
||
""" | ||
Contains all the information about a generated IO port (GEN_IO). | ||
The information are parsed from the GEN_IO definitions in | ||
the tile CSV file. | ||
|
||
Attributes | ||
---------- | ||
prefix : str | ||
The prefix of the GEN_IO given in the CSV file. | ||
pins : int | ||
Number of IOs. | ||
IO : IO | ||
Direction of the IOs, either INPUT or OUTPUT, seen from the fabric side. | ||
This means a fabric INPUT is an OUTPUT globally and vice versa. | ||
configBit : int | ||
The number of accessible config bits for config access GEN_IO. | ||
configAccess : bool | ||
Whether the GEN_IO is config access. | ||
Routes access to config bits, directly to TOP. | ||
This GEN_IOs are not connected to the switchmatrix, | ||
Can only be used as an OUTPUT. | ||
inverted : bool | ||
GEN_IO will be inverted. | ||
clocked : bool | ||
Adds a register to GEN_IO. | ||
clockedComb: bool | ||
Creates two signals for every GEN_IO. | ||
<prefix><Number>_Q: The clocked signal. | ||
<prefix><Number>: The original combinatorial signal. | ||
If the GEN_IO is an INPUT, then there will be created | ||
two signals to the top, <prefix><Number>_Q_top is the clocked input | ||
signal and <prefix><Number>_top is the combinatorial input signal. | ||
If the GEN_IO is an OUTPUT, then there will be two signals connected | ||
to the switch matrix, <prefix><Number>_Q is the clocked output signal | ||
and <prefix><Number> is the combinatorial output signal. | ||
clockedMux: bool | ||
GEN_IO will be multiplexed between the combinatorial and clocked signal. | ||
The multiplexer can be switched via config bits. | ||
""" | ||
|
||
prefix: str | ||
pins: int | ||
IO: IO | ||
configBit: int = 0 | ||
|
||
# Parameters for GEN_IO: | ||
configAccess: bool = False | ||
inverted: bool = False | ||
clocked: bool = False | ||
clockedComb: bool = False | ||
clockedMux: bool = False |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
from dataclasses import dataclass, field | ||
from FABulous.fabric_definition.define import IO, Direction, Side | ||
from FABulous.fabric_definition.Bel import Bel | ||
from FABulous.fabric_definition.Gen_IO import Gen_IO | ||
from FABulous.fabric_definition.Port import Port | ||
from FABulous.fabric_definition.Wire import Wire | ||
from typing import Any | ||
|
@@ -21,6 +22,8 @@ class Tile: | |
The list of ports of the tile | ||
matrixDir : str | ||
The directory of the tile matrix | ||
gen_ios : List[Gen_IO] | ||
The list of GEN_IOs of the tile | ||
globalConfigBits : int | ||
The number of config bits the tile has | ||
withUserCLK : bool | ||
|
@@ -35,6 +38,7 @@ class Tile: | |
portsInfo: list[Port] | ||
bels: list[Bel] | ||
matrixDir: pathlib.Path | ||
gen_ios: list[Gen_IO] | ||
globalConfigBits: int = 0 | ||
withUserCLK: bool = False | ||
wireList: list[Wire] = field(default_factory=list) | ||
|
@@ -48,12 +52,14 @@ def __init__( | |
bels: list[Bel], | ||
tileDir: pathlib.Path, | ||
matrixDir: pathlib.Path, | ||
gen_ios: list[Gen_IO], | ||
userCLK: bool, | ||
configBit: int = 0, | ||
) -> None: | ||
self.name = name | ||
self.portsInfo = ports | ||
self.bels = bels | ||
self.gen_ios = gen_ios | ||
self.matrixDir = matrixDir | ||
self.withUserCLK = userCLK | ||
self.globalConfigBits = configBit | ||
|
@@ -63,6 +69,10 @@ def __init__( | |
for b in self.bels: | ||
self.globalConfigBits += b.configBit | ||
|
||
for gio in self.gen_ios: | ||
if gio.configAccess: | ||
self.globalConfigBits += gio.configBit | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might lead to a problem. Since if we use Gen IO after tile creation, this will not be updated. We should make the global config bit a class attribute, and compute the result every time this is used. Less efficient, but always right. Something like: @property
def globalConfigBits() -> int:
configBit = 0
configBit += sum([...]) #bel sum
configBit += sum(...) #switch matrix sum
return configBit
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, I'll implement this. :) |
||
|
||
def __eq__(self, __o: Any) -> bool: | ||
if __o is None or not isinstance(__o, Tile): | ||
return False | ||
|
Uh oh!
There was an error while loading. Please reload this page.