@@ -177,16 +177,26 @@ def bank_tiles(self):
177
177
# If suddenly a command is given to assign an already used wire to another
178
178
# node, then all the contents of this node are combined with the existing one,
179
179
# and the node itself is destroyed.
180
+ # To prevent further attempts to add wires to the destroyed node, we return the
181
+ # name of the node to which the connection was made
180
182
wire2node = {}
181
183
def add_node (dev , node_name , wire_type , row , col , wire ):
182
184
if (row , col , wire ) not in wire2node :
183
185
wire2node [row , col , wire ] = node_name
184
186
dev .nodes .setdefault (node_name , (wire_type , set ()))[1 ].add ((row , col , wire ))
187
+ return node_name
185
188
else :
186
- if node_name != wire2node [row , col , wire ] and node_name in dev .nodes :
187
- #print(f'{node_name} -> {wire2node[row, col, wire]} share ({row}, {col}, {wire})')
188
- dev .nodes [wire2node [row , col , wire ]][1 ].update (dev .nodes [node_name ][1 ])
189
- del dev .nodes [node_name ]
189
+ old_node_name = wire2node [row , col , wire ]
190
+ if node_name != old_node_name :
191
+ if node_name in dev .nodes :
192
+ #print(f'#0 {node_name} -> {wire2node[row, col, wire]} share ({row}, {col}, {wire})')
193
+ dev .nodes [old_node_name ][1 ].update (dev .nodes [node_name ][1 ])
194
+ del dev .nodes [node_name ]
195
+ else :
196
+ #print(f'#1 {node_name} -> {wire2node[row, col, wire]} share ({row}, {col}, {wire})')
197
+ dev .nodes [old_node_name ][1 ].add ((row , col , wire ))
198
+ return old_node_name
199
+ return node_name
190
200
191
201
# create bels for entry potints to the global clock nets
192
202
def add_buf_bel (dev , row , col , wire , buf_type = 'BUFG' ):
@@ -1036,6 +1046,24 @@ def fse_create_hclk_aliases(db, device, dat: Datfile):
1036
1046
1 : HCLK_PINS ((27 ,0 ), [("CALIB" ,27 ,0 ,"C5" ), ("RESETN" ,27 ,0 ,"B5" ) ], [("RESETN" ,27 ,0 ,"A1" ) ], [("RESETN" ,27 ,0 ,"C1" )])
1037
1047
}
1038
1048
},
1049
+ "GW1N-9" : {
1050
+ "TOPSIDE" :{
1051
+ 0 : HCLK_PINS ((0 ,0 ), [("CALIB" ,9 ,0 ,"A2" ), ("RESETN" ,9 ,0 ,"B0" )], [("RESETN" ,9 ,0 ,"B2" )], [("RESETN" ,9 ,0 ,"B4" )]),
1052
+ 1 : HCLK_PINS ((0 ,46 ), [("CALIB" ,9 ,0 ,"A3" ), ("RESETN" ,9 ,0 ,"B1" )], [("RESETN" ,9 ,0 ,"B3" )], [("RESETN" ,9 ,0 ,"B5" )])
1053
+ },
1054
+ "RIGHTSIDE" :{
1055
+ 0 : HCLK_PINS ((18 ,46 ), [("CALIB" ,18 ,46 ,"A2" ), ("RESETN" ,18 ,46 ,"B0" )], [("RESETN" ,18 ,46 ,"B2" )], [("RESETN" ,18 ,46 ,"B4" )]),
1056
+ 1 : HCLK_PINS ((18 ,46 ), [("CALIB" ,18 ,46 ,"A3" ), ("RESETN" ,18 ,46 ,"B1" )], [("RESETN" ,18 ,46 ,"B3" )], [("RESETN" ,18 ,46 ,"B5" )])
1057
+ },
1058
+ "BOTTOMSIDE" :{
1059
+ 0 : HCLK_PINS ((28 ,0 ), [("CALIB" ,28 ,0 ,"D0" ), ("RESETN" ,28 ,0 ,"D2" )], [("RESETN" ,28 ,0 ,"D4" )], [("RESETN" ,28 ,0 ,"C0" )]),
1060
+ 1 : HCLK_PINS ((28 ,46 ), [("CALIB" ,28 ,0 ,"D1" ), ("RESETN" ,28 ,0 ,"D3" )], [("RESETN" ,28 ,0 ,"D5" )], [("RESETN" ,28 ,0 ,"C1" )])
1061
+ },
1062
+ "LEFTSIDE" :{
1063
+ 0 : HCLK_PINS ((18 ,0 ), [("CALIB" ,18 ,0 ,"A2" ), ("RESETN" ,18 ,0 ,"B0" ) ], [("RESETN" ,18 ,0 ,"B2" ) ], [("RESETN" ,18 ,0 ,"B4" ) ]),
1064
+ 1 : HCLK_PINS ((18 ,0 ), [("CALIB" ,18 ,0 ,"A3" ), ("RESETN" ,18 ,0 ,"B1" ) ], [("RESETN" ,18 ,0 ,"B3" ) ], [("RESETN" ,18 ,0 ,"B5" ) ])
1065
+ }
1066
+ },
1039
1067
"GW1N-9C" : {
1040
1068
"TOPSIDE" :{
1041
1069
0 : HCLK_PINS ((0 ,0 ), [("CALIB" ,9 ,0 ,"A2" ), ("RESETN" ,9 ,0 ,"B0" )], [("RESETN" ,9 ,0 ,"B2" )], [("RESETN" ,9 ,0 ,"B4" )]),
@@ -1053,7 +1081,51 @@ def fse_create_hclk_aliases(db, device, dat: Datfile):
1053
1081
0 : HCLK_PINS ((18 ,0 ), [("CALIB" ,18 ,0 ,"A2" ), ("RESETN" ,18 ,0 ,"B0" ) ], [("RESETN" ,18 ,0 ,"B2" ) ], [("RESETN" ,18 ,0 ,"B4" ) ]),
1054
1082
1 : HCLK_PINS ((18 ,0 ), [("CALIB" ,18 ,0 ,"A3" ), ("RESETN" ,18 ,0 ,"B1" ) ], [("RESETN" ,18 ,0 ,"B3" ) ], [("RESETN" ,18 ,0 ,"B5" ) ])
1055
1083
}
1056
- }
1084
+ },
1085
+ "GW1N-1" : {
1086
+ "BOTTOMSIDE" :{
1087
+ 0 : HCLK_PINS ((10 , 0 ), [("CALIB" , 10 , 0 , "D2" ), ("RESETN" , 10 , 0 , "D0" )], [("RESETN" , 10 , 0 , "D4" )], [("RESETN" , 10 , 0 , "D6" )]),
1088
+ 1 : HCLK_PINS ((10 , 19 ), [("CALIB" , 10 , 0 , "D3" ), ("RESETN" , 10 , 0 , "D1" )], [("RESETN" , 10 , 0 , "D5" )], [("RESETN" , 10 , 0 , "D7" )])
1089
+ },
1090
+ },
1091
+ "GW1NZ-1" : {
1092
+ "TOPSIDE" :{
1093
+ 0 : HCLK_PINS ((0 , 5 ), [("CALIB" , 0 , 19 , "D3" ), ("RESETN" , 0 , 19 , "D1" )], [("RESETN" , 0 , 18 , "C2" )], [("RESETN" , 0 , 18 , "C4" )]),
1094
+ 1 : HCLK_PINS ((0 , 5 ), [("CALIB" , 0 , 19 , "D2" ), ("RESETN" , 0 , 19 , "D0" )], [("RESETN" , 0 , 18 , "C3" )], [("RESETN" , 0 , 18 , "C5" )])
1095
+ },
1096
+ "RIGHTSIDE" :{
1097
+ 0 : HCLK_PINS ((5 , 19 ), [("CALIB" , 10 , 19 , "D3" ), ("RESETN" , 10 , 19 , "D1" )], [("RESETN" , 10 , 18 , "C2" )], [("RESETN" , 10 , 18 , "C4" )]),
1098
+ 1 : HCLK_PINS ((5 , 19 ), [("CALIB" , 10 , 19 , "D2" ), ("RESETN" , 10 , 19 , "D1" )], [("RESETN" , 10 , 18 , "C3" )], [("RESETN" , 10 , 18 , "C5" )])
1099
+ },
1100
+ },
1101
+ "GW1NS-4" : {
1102
+ "TOPSIDE" :{
1103
+ 0 : HCLK_PINS ((0 , 18 ), [("CALIB" , 1 , 0 , "C0" ), ("RESETN" , 0 , 0 , "C5" )], [("RESETN" , 0 , 0 , "B1" )], [("RESETN" , 1 , 0 , "C6" )]),
1104
+ 1 : HCLK_PINS ((0 , 18 ), [("CALIB" , 1 , 0 , "D7" ), ("RESETN" , 0 , 0 , "B0" )], [("RESETN" , 1 , 0 , "C7" )], [("RESETN" , 1 , 0 , "C5" )])
1105
+ },
1106
+ "RIGHTSIDE" :{
1107
+ 0 : HCLK_PINS ((9 , 37 ), [("CALIB" , 0 , 37 , "D7" ), ("RESETN" , 0 , 37 , "D5" )], [("RESETN" , 0 , 37 , "C3" )], [("RESETN" , 0 , 37 , "C1" )]),
1108
+ 1 : HCLK_PINS ((9 , 37 ), [("CALIB" , 0 , 37 , "D6" ), ("RESETN" , 0 , 37 , "D6" )], [("RESETN" , 0 , 37 , "C2" )], [("RESETN" , 0 , 37 , "C0" )])
1109
+ },
1110
+ "BOTTOMSIDE" :{
1111
+ 0 : HCLK_PINS ((19 , 16 ), [("CALIB" , 19 , 0 , "D0" ), ("RESETN" , 19 , 0 , "D2" )], [("RESETN" , 19 , 0 , "D4" )], [("RESETN" , 19 , 0 , "C0" )]),
1112
+ 1 : HCLK_PINS ((19 , 17 ), [("CALIB" , 19 , 0 , "D1" ), ("RESETN" , 19 , 0 , "D3" )], [("RESETN" , 19 , 0 , "D5" )], [("RESETN" , 19 , 0 , "C1" )])
1113
+ },
1114
+ },
1115
+ "GW1N-4" : {
1116
+ "LEFTSIDE" :{
1117
+ 0 : HCLK_PINS ((9 , 0 ), [("CALIB" , 19 , 0 ,"B4" ), ("RESETN" , 19 , 0 , "B6" ) ], [("RESETN" , 19 , 0 , "A0" )], [("RESETN" , 19 , 0 , "A2" )]),
1118
+ 1 : HCLK_PINS ((9 ,0 ), [("CALIB" , 19 , 0 ,"B5" ), ("RESETN" , 19 , 0 , "B7" ) ], [("RESETN" , 19 , 0 , "A1" )], [("RESETN" , 19 , 0 , "A3" )])
1119
+ },
1120
+ "RIGHTSIDE" :{
1121
+ 0 : HCLK_PINS ((9 , 37 ), [("CALIB" , 0 , 37 , "B7" ), ("RESETN" , 0 , 37 , "B5" )], [("RESETN" , 0 , 37 , "C3" )], [("RESETN" , 0 , 37 , "C1" )]),
1122
+ 1 : HCLK_PINS ((9 , 37 ), [("CALIB" , 0 , 37 , "B6" ), ("RESETN" , 0 , 37 , "B6" )], [("RESETN" , 0 , 37 , "C2" )], [("RESETN" , 0 , 37 , "C0" )])
1123
+ },
1124
+ "BOTTOMSIDE" :{
1125
+ 0 : HCLK_PINS ((19 , 0 ), [("CALIB" , 19 , 0 , "D0" ), ("RESETN" , 19 , 0 , "D2" )], [("RESETN" , 19 , 0 , "D4" )], [("RESETN" , 19 , 0 , "C0" )]),
1126
+ 1 : HCLK_PINS ((19 , 37 ), [("CALIB" , 19 , 0 , "D1" ), ("RESETN" , 19 , 0 , "D3" )], [("RESETN" , 19 , 0 , "D5" )], [("RESETN" , 19 , 0 , "C1" )])
1127
+ },
1128
+ },
1057
1129
}
1058
1130
1059
1131
@@ -1075,7 +1147,7 @@ def _iter_edge_coords(dev):
1075
1147
1076
1148
def add_hclk_bels (dat , dev , device ):
1077
1149
#Stub for parts that don't have HCLK bel support yet
1078
- if device not in ("GW2A-18" , "GW2A-18C" , "GW1N-9C " ):
1150
+ if device not in ("GW2A-18" , "GW2A-18C" , "GW1N-9" , "GW1N-9C" , "GW1N-1" , "GW1NZ-1" , "GW1NS-4" , "GW1N-4 " ):
1079
1151
to_connect = ['HCLK0_SECT0_IN' , 'HCLK0_SECT1_IN' , 'HCLK1_SECT0_IN' , 'HCLK1_SECT1_IN' ]
1080
1152
for x in range (dev .cols ):
1081
1153
for y in range (dev .rows ):
@@ -1092,6 +1164,22 @@ def add_hclk_bels(dat, dev, device):
1092
1164
device = "GW2A-18"
1093
1165
device_hclk_pins = _device_hclk_pin_dict [device ]
1094
1166
1167
+ if device == 'GW1NS-4' :
1168
+ node_name = 'X16Y19/HCLK0_SECT0_IN'
1169
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 16 , 'HCLK0_SECT0_IN' )
1170
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 17 , 'HCLK0_SECT0_IN' )
1171
+ node_name = 'X17Y19/HCLK1_SECT0_IN'
1172
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 17 , 'HCLK1_SECT0_IN' )
1173
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 20 , 'HCLK1_SECT0_IN' )
1174
+ node_name = 'X17Y19/HCLK1_SECT1_IN'
1175
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 17 , 'HCLK1_SECT1_IN' )
1176
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 20 , 'HCLK1_SECT1_IN' )
1177
+ node_name = 'X17Y19/HCLK_IN2'
1178
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 17 , 'HCLK_IN2' )
1179
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 20 , 'HCLK_IN2' )
1180
+ node_name = 'X17Y19/HCLK_IN3'
1181
+ node_name = add_node (dev , node_name , 'HCLK' , 19 , 17 , 'HCLK_IN3' )
1182
+ add_node (dev , node_name , 'HCLK' , 19 , 20 , 'HCLK_IN3' )
1095
1183
1096
1184
#There is a sleight of hand going on here - there is likely only one physical CLKDIV bel per HCLK
1097
1185
#However because of how they are connected, and how I suspect that the muxes that utilize them are,
@@ -1132,7 +1220,7 @@ def add_hclk_bels(dat, dev, device):
1132
1220
dev .grid [tile_row ][tile_col ].bels [clkdiv2_name ] = clkdiv2
1133
1221
dev .grid [tile_row ][tile_col ].bels [clkdiv_name ] = clkdiv #We still create this so as not to break the PnR logic
1134
1222
1135
- if device in ( "GW1N-9C, GW1NR-9C" ) :
1223
+ if device == "GW1N-9C" :
1136
1224
clkdiv2_in = f"HCLK{ idx } _SECT{ section } _IN" if section == 0 else f"HCLK_IN{ idx * 2 + section } "
1137
1225
dev .hclk_pips [tile_row ,tile_col ][clkdiv2 .portmap ["HCLKIN" ]] = {clkdiv2_in :set ()}
1138
1226
sect_div2_mux = f"HCLK{ idx } _SECT{ section } _MUX_DIV2"
@@ -1150,7 +1238,6 @@ def add_hclk_bels(dat, dev, device):
1150
1238
1151
1239
else :
1152
1240
dev .hclk_pips [tile_row ,tile_col ][clkdiv2 .portmap ["HCLKIN" ]] = {f"HCLK{ idx } _SECT{ section } _IN" :set ()}
1153
- # sect_div2_mux = f"HCLK{idx}_SECT{section}_MUX_DIV2"
1154
1241
sect_div2_mux = f"HCLK{ idx } _SECT{ section } _MUX2"
1155
1242
dev .hclk_pips [tile_row ,tile_col ][sect_div2_mux ] = {f"HCLK{ idx } _SECT{ section } _IN" :set (), clkdiv2 .portmap ["CLKOUT" ]:set ()}
1156
1243
dev .hclk_pips [tile_row ,tile_col ][clkdiv .portmap ["HCLKIN" ]] = ({sect_div2_mux :set ()})
@@ -1204,7 +1291,8 @@ def fse_create_hclk_nodes(dev, device, fse, dat: Datfile):
1204
1291
add_node (dev , f'HCLKMUX{ src [- 1 ]} ' , "GLOBAL_CLK" , row , col , src )
1205
1292
# strange GW1N-9C input-input aliases
1206
1293
for i in {0 , 2 }:
1207
- dev .nodes .setdefault (f'X{ col } Y{ row } /HCLK9-{ i } ' , ('HCLK' , {(row , col , f'HCLK_IN{ i } ' )}))[1 ].add ((row , col , f'HCLK_9IN{ i } ' ))
1294
+ add_node (dev , f'X{ col } Y{ row } /HCLK9-{ i } ' , 'HCLK' , row , col , f'HCLK_IN{ i } ' )
1295
+ add_node (dev , f'X{ col } Y{ row } /HCLK9-{ i } ' , 'HCLK' , row , col , f'HCLK_9IN{ i } ' )
1208
1296
# GW1N-9C clock pin aliases
1209
1297
if side != 'B' : # it’s still unclear on this side, but the
1210
1298
# Tangnano9k external clock is not connected here, so we
0 commit comments