-
Notifications
You must be signed in to change notification settings - Fork 243
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
Himbaechel GUI #1295
base: master
Are you sure you want to change the base?
Himbaechel GUI #1295
Changes from all commits
337f630
6cc0153
5d0df5c
669d271
4749794
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 |
---|---|---|
|
@@ -144,6 +144,7 @@ class TileWireData: | |
index: int | ||
name: IdString | ||
wire_type: IdString | ||
tile_wire: int | ||
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 should be given a name that makes it's very clear that it's gui-specific, otherwise it will be very unclear to anyone looking at the structures |
||
const_value: IdString = field(default_factory=list) | ||
flags: int = 0 | ||
timing_idx: int = -1 | ||
|
@@ -166,6 +167,7 @@ def serialise_lists(self, context: str, bba: BBAWriter): | |
def serialise(self, context: str, bba: BBAWriter): | ||
bba.u32(self.name.index) | ||
bba.u32(self.wire_type.index) | ||
bba.u32(self.tile_wire) | ||
bba.u32(self.const_value.index) | ||
bba.u32(self.flags) | ||
bba.u32(self.timing_idx) | ||
|
@@ -202,6 +204,7 @@ def serialise(self, context: str, bba: BBAWriter): | |
@dataclass | ||
class TileType(BBAStruct): | ||
strs: StringPool | ||
gfx_wire_ids: dict() | ||
tmg: "TimingPool" | ||
type_name: IdString | ||
bels: list[BelData] = field(default_factory=list) | ||
|
@@ -229,9 +232,13 @@ def add_bel_pin(self, bel: BelData, pin: str, wire: str, dir: PinType): | |
|
||
def create_wire(self, name: str, type: str="", const_value: str=""): | ||
# Create a new tile wire of a given name and type (optional) in the tile type | ||
tile_wire = 0 | ||
if ("TILE_WIRE_" + name) in self.gfx_wire_ids: | ||
tile_wire = self.gfx_wire_ids["TILE_WIRE_" + name] | ||
wire = TileWireData(index=len(self.wires), | ||
name=self.strs.id(name), | ||
wire_type=self.strs.id(type), | ||
tile_wire=tile_wire, | ||
const_value=self.strs.id(const_value)) | ||
self._wire2idx[wire.name] = wire.index | ||
self.wires.append(wire) | ||
|
@@ -691,8 +698,9 @@ def __init__(self, uarch: str, name: str, width: int, height: int): | |
self.packages = [] | ||
self.extra_data = None | ||
self.timing = TimingPool(self.strs) | ||
self.gfx_wire_ids = dict() | ||
def create_tile_type(self, name: str): | ||
tt = TileType(self.strs, self.timing, self.strs.id(name)) | ||
tt = TileType(self.strs, self.gfx_wire_ids, self.timing, self.strs.id(name)) | ||
self.tile_type_idx[name] = len(self.tile_types) | ||
self.tile_types.append(tt) | ||
return tt | ||
|
@@ -857,3 +865,18 @@ def write_bba(self, filename): | |
bba.ref('chip_info') | ||
self.serialise(bba) | ||
bba.pop() | ||
|
||
def read_gfx_h(self, filename): | ||
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 is kind of horrid |
||
with open(filename) as f: | ||
state = 0 | ||
for line in f: | ||
if state == 0 and line.startswith("enum GfxTileWireId"): | ||
state = 1 | ||
elif state == 1 and line.startswith("};"): | ||
state = 0 | ||
elif state == 1 and (line.startswith("{") or line.strip() == ""): | ||
pass | ||
elif state == 1: | ||
idx = len(self.gfx_wire_ids) | ||
name = line.strip().rstrip(",") | ||
self.gfx_wire_ids[name] = idx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if a wire spans multiple tiles, as it can in the himbaechel deduplication scheme, this would need to deal with all the constituent tile wires not just the index one