Skip to content
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

RFC: Split wire/node mapping into a new schema #54

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion cmake/cxx_static/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
find_package(CapnProto REQUIRED)
set(PROTOS LogicalNetlist.capnp PhysicalNetlist.capnp DeviceResources.capnp References.capnp)
set(PROTOS LogicalNetlist.capnp PhysicalNetlist.capnp DeviceResources.capnp DedupWiresNodes.capnp FlatWiresNodes.capnp References.capnp)

set(INTERCHANGE_SCHEMA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../interchange)

Expand Down
61 changes: 61 additions & 0 deletions interchange/DedupWiresNodes.capnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright 2020-2021 Xilinx, Inc. and Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

@0x9d262c6ba6512325;
using Java = import "/capnp/java.capnp";
using Ref = import "References.capnp";
$Java.package("com.xilinx.rapidwright.interchange");
$Java.outerClassname("DedupWiresNodes");

using Cxx = import "/capnp/c++.capnp";
$Cxx.namespace("DedupWiresNodes");

struct StringRef {
type @0 :Ref.ReferenceType = rootValue;
field @1 :Text = "strList";
}
annotation stringRef(*) :StringRef;
using StringIdx = UInt32;

struct NodeShapeRef {
type @0 :Ref.ReferenceType = parent;
field @1 :Text = "nodeShapes";
depth @2 :Int32 = 1;
}
annotation nodeShapeRef(*) :NodeShapeRef;
using NodeShapeIdx = UInt32;

# This structure describes a deduplicated wire-node mapping, as an interim step between a flat graph and a fully folded graph.
# It requires a full list of nodes in the device and their "shape", but not a full list of wires within those nodes as nodes
# with the same "shape", using relative coordinates, only have their list of constituent wires stored once.
struct DedupWiresNodes {
nodes @0 : List(Node);
nodeShapes @1 : List(NodeShape);

struct Node {
rootTile @0 : StringIdx $stringRef();
shape @1 : NodeShapeIdx $nodeShapeRef();
}

struct NodeWire {
dx @0 : Int16; # wire.x = rootTile.x + dx
dy @1 : Int16; # wire.y = rootTile.y + dy
wire @2 : StringIdx $stringRef();
}

struct NodeShape {
wires @0 : List(NodeWire);
}

}
23 changes: 3 additions & 20 deletions interchange/DeviceResources.capnp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,6 @@ struct BELPinRef {
annotation belPinRef(*) :BELPinRef;
using BELPinIdx = UInt32;

struct WireRef {
type @0 :Ref.ReferenceType = parent;
field @1 :Text = "wires";
depth @2 :Int32 = 1;
}
annotation wireRef(*) :WireRef;
using WireIdx = UInt32;

struct WireTypeRef {
type @0 :Ref.ReferenceType = parent;
field @1 :Text = "wireTypes";
Expand Down Expand Up @@ -86,8 +78,8 @@ struct Device {
siteTypeList @2 : List(SiteType);
tileTypeList @3 : List(TileType);
tileList @4 : List(Tile);
wires @5 : List(Wire);
nodes @6 : List(Node);
deleted0 @5 : Void;
deleted1 @6 : Void;
primLibs @7 : Dir.Netlist; # Netlist libraries of Unisim primitives and macros
exceptionMap @8 : List(PrimToMacroExpansion); # Prims to macros expand w/same name, except these
cellBelMap @9 : List(CellBelMapping);
Expand Down Expand Up @@ -141,6 +133,7 @@ struct Device {
wires @2 : List(StringIdx) $stringRef();
pips @3 : List(PIP);
constants @4 : List(WireConstantSources);
wireTypes @5 : List(WireTypeIdx);
}

#######################################
Expand Down Expand Up @@ -213,12 +206,6 @@ struct Device {
# Inter-site routing resources
######################################

struct Wire {
tile @0 : StringIdx $stringRef();
wire @1 : StringIdx $stringRef();
type @2 : WireTypeIdx $wireTypeRef();
}

enum WireCategory {
# general interconnect, usually with many uphill and downhill pips and spanning multiple tiles
general @0;
Expand All @@ -237,10 +224,6 @@ struct Device {
category @1 : WireCategory;
}

struct Node {
wires @0 : List(WireIdx) $wireRef();
}

struct PIP {
wire0 @0 : WireIDInTileType;
wire1 @1 : WireIDInTileType;
Expand Down
53 changes: 53 additions & 0 deletions interchange/FlatWiresNodes.capnp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2020-2021 Xilinx, Inc. and Google, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

@0x9d262c6ba6512325;
using Java = import "/capnp/java.capnp";
using Ref = import "References.capnp";
$Java.package("com.xilinx.rapidwright.interchange");
$Java.outerClassname("FlatWiresNodes");

using Cxx = import "/capnp/c++.capnp";
$Cxx.namespace("FlatWiresNodes");

struct StringRef {
type @0 :Ref.ReferenceType = rootValue;
field @1 :Text = "strList";
}
annotation stringRef(*) :StringRef;
using StringIdx = UInt32;

struct WireRef {
type @0 :Ref.ReferenceType = parent;
field @1 :Text = "wires";
depth @2 :Int32 = 1;
}
annotation wireRef(*) :WireRef;
using WireIdx = UInt32;

# This structure describes a flat wire-node mapping with no folding or deduplication
struct FlatWiresNodes {
wires @0 : List(Wire);
nodes @1 : List(Node);

struct Wire {
tile @0 : StringIdx $stringRef();
wire @1 : StringIdx $stringRef();
}

struct Node {
wires @0 : List(WireIdx) $wireRef();
}

}