50 legacyOccupation = [[32*[
None],32*[
None]],[32*[
None],32*[
None]]]
51 for boardNumber, board
in enumerate([legacyBoard0, legacyBoard1]):
52 for conn
in board[
"connectors"][0][
"algorithmGroups"]:
55 for topoAlgDef
in conn[
'algorithms']:
56 lines = topoAlgDef.outputlines
58 legacyOccupation[boardNumber][clock][ 16*fpga + topoAlgDef.outputbits] = lines[0]
60 for bit,line
in enumerate(lines):
61 legacyOccupation[boardNumber][clock][ 16*fpga + bit + topoAlgDef.outputbits[0]] = line
63 signals = [32*[
None], 32*[
None]]
66 algFromMapping = mc.signals[clock]
67 if algFromMapping
is None:
69 signals[clock][mc.target_bit] =
"R2TOPO_"+algFromMapping
70 algFromLegacyBoardDef = legacyOccupation[mc.topo_board][clock][mc.source_bit]
71 if algFromMapping != algFromLegacyBoardDef:
72 fpga = mc.source_bit // 16
73 bit = mc.source_bit % 16
74 msg = f
"Legacy board mapping expects line {algFromMapping} on LegacyBoard{mc.topo_board}, fpga {fpga}, " +\
75 f
"clock {clock}, bit {bit} but board defines {algFromLegacyBoardDef}"
77 raise RuntimeError(
"Mapping doesn't match LegacyBoard definition")
81 board[
"connectors"] = []
82 board[
"type"] =
"merger"
83 board[
"connectors"].
append({
84 "name" :
"LegacyTopoMerged",
87 "type" :
"electrical",
92 "signals" : signals[0]
96 "signals" : signals[1]
100 return odict( [(
"LegacyTopoMerger", board)] )