# Copyright (c) 2023 - 2026 Chair for Design Automation, TUM
# Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH
# All rights reserved.
#
# SPDX-License-Identifier: MIT
#
# Licensed under the MIT License
"""Module to manage IBM devices."""
from __future__ import annotations
import logging
from typing import TYPE_CHECKING
from ._registry import register_device
if TYPE_CHECKING:
from qiskit.transpiler import Target
from qiskit.providers.fake_provider import GenericBackendV2
from ..gatesets import get_gateset
logger = logging.getLogger(__name__)
DEFAULT_SEED = 42
[docs]
@register_device("ibm_falcon_27")
def get_ibm_falcon_27() -> Target:
"""Get the target for a 27-qubit IBM Falcon architecture."""
cmap = [
[0, 1],
[1, 0],
[1, 2],
[1, 4],
[2, 1],
[2, 3],
[3, 2],
[3, 5],
[4, 1],
[4, 7],
[5, 3],
[5, 8],
[6, 7],
[7, 4],
[7, 6],
[7, 10],
[8, 5],
[8, 9],
[8, 11],
[9, 8],
[10, 7],
[10, 12],
[11, 8],
[11, 14],
[12, 10],
[12, 13],
[12, 15],
[13, 12],
[13, 14],
[14, 11],
[14, 13],
[14, 16],
[15, 12],
[15, 18],
[16, 14],
[16, 19],
[17, 18],
[18, 15],
[18, 17],
[18, 21],
[19, 16],
[19, 20],
[19, 22],
[20, 19],
[21, 18],
[21, 23],
[22, 19],
[22, 25],
[23, 21],
[23, 24],
[24, 23],
[24, 25],
[25, 22],
[25, 24],
[25, 26],
[26, 25],
]
backend = GenericBackendV2(
num_qubits=27,
coupling_map=cmap,
basis_gates=get_gateset("ibm_falcon"),
noise_info=True,
seed=DEFAULT_SEED,
control_flow=True,
)
target = backend.target
target.description = "ibm_falcon_27"
return target
def _get_127_qubit_cmap() -> list[list[int]]:
"""Get the default 127-qubit IBM architecture."""
return [
[0, 1],
[0, 14],
[1, 0],
[1, 2],
[2, 1],
[2, 3],
[3, 2],
[3, 4],
[4, 3],
[4, 5],
[4, 15],
[5, 4],
[5, 6],
[6, 5],
[6, 7],
[7, 6],
[7, 8],
[8, 7],
[8, 16],
[9, 10],
[10, 9],
[10, 11],
[11, 10],
[11, 12],
[12, 11],
[12, 13],
[12, 17],
[13, 12],
[14, 0],
[14, 18],
[15, 4],
[15, 22],
[16, 8],
[16, 26],
[17, 12],
[17, 30],
[18, 14],
[18, 19],
[19, 18],
[19, 20],
[20, 19],
[20, 21],
[20, 33],
[21, 20],
[21, 22],
[22, 15],
[22, 21],
[22, 23],
[23, 22],
[23, 24],
[24, 23],
[24, 25],
[24, 34],
[25, 24],
[25, 26],
[26, 16],
[26, 25],
[26, 27],
[27, 26],
[27, 28],
[28, 27],
[28, 29],
[28, 35],
[29, 28],
[29, 30],
[30, 17],
[30, 29],
[30, 31],
[31, 30],
[31, 32],
[32, 31],
[32, 36],
[33, 20],
[33, 39],
[34, 24],
[34, 43],
[35, 28],
[35, 47],
[36, 32],
[36, 51],
[37, 38],
[37, 52],
[38, 37],
[38, 39],
[39, 33],
[39, 38],
[39, 40],
[40, 39],
[40, 41],
[41, 40],
[41, 42],
[41, 53],
[42, 41],
[42, 43],
[43, 34],
[43, 42],
[43, 44],
[44, 43],
[44, 45],
[45, 44],
[45, 46],
[45, 54],
[46, 45],
[46, 47],
[47, 35],
[47, 46],
[47, 48],
[48, 47],
[48, 49],
[49, 48],
[49, 50],
[49, 55],
[50, 49],
[50, 51],
[51, 36],
[51, 50],
[52, 37],
[52, 56],
[53, 41],
[53, 60],
[54, 45],
[54, 64],
[55, 49],
[55, 68],
[56, 52],
[56, 57],
[57, 56],
[57, 58],
[58, 57],
[58, 59],
[58, 71],
[59, 58],
[59, 60],
[60, 53],
[60, 59],
[60, 61],
[61, 60],
[61, 62],
[62, 61],
[62, 63],
[62, 72],
[63, 62],
[63, 64],
[64, 54],
[64, 63],
[64, 65],
[65, 64],
[65, 66],
[66, 65],
[66, 67],
[66, 73],
[67, 66],
[67, 68],
[68, 55],
[68, 67],
[68, 69],
[69, 68],
[69, 70],
[70, 69],
[70, 74],
[71, 58],
[71, 77],
[72, 62],
[72, 81],
[73, 66],
[73, 85],
[74, 70],
[74, 89],
[75, 76],
[75, 90],
[76, 75],
[76, 77],
[77, 71],
[77, 76],
[77, 78],
[78, 77],
[78, 79],
[79, 78],
[79, 80],
[79, 91],
[80, 79],
[80, 81],
[81, 72],
[81, 80],
[81, 82],
[82, 81],
[82, 83],
[83, 82],
[83, 84],
[83, 92],
[84, 83],
[84, 85],
[85, 73],
[85, 84],
[85, 86],
[86, 85],
[86, 87],
[87, 86],
[87, 88],
[87, 93],
[88, 87],
[88, 89],
[89, 74],
[89, 88],
[90, 75],
[90, 94],
[91, 79],
[91, 98],
[92, 83],
[92, 102],
[93, 87],
[93, 106],
[94, 90],
[94, 95],
[95, 94],
[95, 96],
[96, 95],
[96, 97],
[96, 109],
[97, 96],
[97, 98],
[98, 91],
[98, 97],
[98, 99],
[99, 98],
[99, 100],
[100, 99],
[100, 101],
[100, 110],
[101, 100],
[101, 102],
[102, 92],
[102, 101],
[102, 103],
[103, 102],
[103, 104],
[104, 103],
[104, 105],
[104, 111],
[105, 104],
[105, 106],
[106, 93],
[106, 105],
[106, 107],
[107, 106],
[107, 108],
[108, 107],
[108, 112],
[109, 96],
[110, 100],
[110, 118],
[111, 104],
[111, 122],
[112, 108],
[112, 126],
[113, 114],
[114, 113],
[114, 115],
[115, 114],
[115, 116],
[116, 115],
[116, 117],
[117, 116],
[117, 118],
[118, 110],
[118, 117],
[118, 119],
[119, 118],
[119, 120],
[120, 119],
[120, 121],
[121, 120],
[121, 122],
[122, 111],
[122, 121],
[122, 123],
[123, 122],
[123, 124],
[124, 123],
[124, 125],
[125, 124],
[125, 126],
[126, 112],
[126, 125],
]
[docs]
@register_device("ibm_falcon_127")
def get_ibm_falcon_127() -> Target:
"""Get the target for a 127-qubit IBM Falcon architecture."""
cmap = _get_127_qubit_cmap()
backend = GenericBackendV2(
num_qubits=127,
coupling_map=cmap,
basis_gates=get_gateset("ibm_falcon"),
noise_info=True,
seed=DEFAULT_SEED,
control_flow=True,
)
target = backend.target
target.description = "ibm_falcon_127"
return target
[docs]
@register_device("ibm_eagle_127")
def get_ibm_eagle_127() -> Target:
"""Get the target for a 127-qubit IBM Eagle architecture."""
cmap = _get_127_qubit_cmap()
backend = GenericBackendV2(
num_qubits=127,
coupling_map=cmap,
basis_gates=get_gateset("ibm_eagle"),
noise_info=True,
seed=DEFAULT_SEED,
control_flow=True,
)
target = backend.target
target.description = "ibm_eagle_127"
return target
[docs]
@register_device("ibm_heron_133")
def get_ibm_heron_133() -> Target:
"""Get the target for a 127-qubit IBM Heron architecture."""
cmap = [
[0, 1],
[0, 15],
[1, 0],
[1, 2],
[2, 1],
[2, 3],
[3, 2],
[3, 4],
[4, 3],
[4, 5],
[4, 16],
[5, 4],
[5, 6],
[6, 5],
[6, 7],
[7, 6],
[7, 8],
[8, 7],
[8, 9],
[8, 17],
[9, 8],
[9, 10],
[10, 9],
[10, 11],
[11, 10],
[11, 12],
[12, 11],
[12, 13],
[12, 18],
[13, 12],
[13, 14],
[14, 13],
[15, 0],
[15, 19],
[16, 4],
[16, 23],
[17, 8],
[17, 27],
[18, 12],
[18, 31],
[19, 15],
[19, 20],
[20, 19],
[20, 21],
[21, 20],
[21, 22],
[21, 34],
[22, 21],
[22, 23],
[23, 16],
[23, 22],
[23, 24],
[24, 23],
[24, 25],
[25, 24],
[25, 26],
[25, 35],
[26, 25],
[26, 27],
[27, 17],
[27, 26],
[27, 28],
[28, 27],
[28, 29],
[29, 28],
[29, 30],
[29, 36],
[30, 29],
[30, 31],
[31, 18],
[31, 30],
[31, 32],
[32, 31],
[32, 33],
[33, 32],
[33, 37],
[34, 21],
[34, 40],
[35, 25],
[35, 44],
[36, 29],
[36, 48],
[37, 33],
[37, 52],
[38, 39],
[38, 53],
[39, 38],
[39, 40],
[40, 34],
[40, 39],
[40, 41],
[41, 40],
[41, 42],
[42, 41],
[42, 43],
[42, 54],
[43, 42],
[43, 44],
[44, 35],
[44, 43],
[44, 45],
[45, 44],
[45, 46],
[46, 45],
[46, 47],
[46, 55],
[47, 46],
[47, 48],
[48, 36],
[48, 47],
[48, 49],
[49, 48],
[49, 50],
[50, 49],
[50, 51],
[50, 56],
[51, 50],
[51, 52],
[52, 37],
[52, 51],
[53, 38],
[53, 57],
[54, 42],
[54, 61],
[55, 46],
[55, 65],
[56, 50],
[56, 69],
[57, 53],
[57, 58],
[58, 57],
[58, 59],
[59, 58],
[59, 60],
[59, 72],
[60, 59],
[60, 61],
[61, 54],
[61, 60],
[61, 62],
[62, 61],
[62, 63],
[63, 62],
[63, 64],
[63, 73],
[64, 63],
[64, 65],
[65, 55],
[65, 64],
[65, 66],
[66, 65],
[66, 67],
[67, 66],
[67, 68],
[67, 74],
[68, 67],
[68, 69],
[69, 56],
[69, 68],
[69, 70],
[70, 69],
[70, 71],
[71, 70],
[71, 75],
[72, 59],
[72, 78],
[73, 63],
[73, 82],
[74, 67],
[74, 86],
[75, 71],
[75, 90],
[76, 77],
[76, 91],
[77, 76],
[77, 78],
[78, 72],
[78, 77],
[78, 79],
[79, 78],
[79, 80],
[80, 79],
[80, 81],
[80, 92],
[81, 80],
[81, 82],
[82, 73],
[82, 81],
[82, 83],
[83, 82],
[83, 84],
[84, 83],
[84, 85],
[84, 93],
[85, 84],
[85, 86],
[86, 74],
[86, 85],
[86, 87],
[87, 86],
[87, 88],
[88, 87],
[88, 89],
[88, 94],
[89, 88],
[89, 90],
[90, 75],
[90, 89],
[91, 76],
[91, 95],
[92, 80],
[92, 99],
[93, 84],
[93, 103],
[94, 88],
[94, 107],
[95, 91],
[95, 96],
[96, 95],
[96, 97],
[97, 96],
[97, 98],
[97, 110],
[98, 97],
[98, 99],
[99, 92],
[99, 98],
[99, 100],
[100, 99],
[100, 101],
[101, 100],
[101, 102],
[101, 111],
[102, 101],
[102, 103],
[103, 93],
[103, 102],
[103, 104],
[104, 103],
[104, 105],
[105, 104],
[105, 106],
[105, 112],
[106, 105],
[106, 107],
[107, 94],
[107, 106],
[107, 108],
[108, 107],
[108, 109],
[109, 108],
[109, 113],
[110, 97],
[110, 116],
[111, 101],
[111, 120],
[112, 105],
[112, 124],
[113, 109],
[113, 128],
[114, 115],
[114, 129],
[115, 114],
[115, 116],
[116, 110],
[116, 115],
[116, 117],
[117, 116],
[117, 118],
[118, 117],
[118, 119],
[118, 130],
[119, 118],
[119, 120],
[120, 111],
[120, 119],
[120, 121],
[121, 120],
[121, 122],
[122, 121],
[122, 123],
[122, 131],
[123, 122],
[123, 124],
[124, 112],
[124, 123],
[124, 125],
[125, 124],
[125, 126],
[126, 125],
[126, 127],
[126, 132],
[127, 126],
[127, 128],
[128, 113],
[128, 127],
[129, 114],
[130, 118],
[131, 122],
[132, 126],
]
backend = GenericBackendV2(
num_qubits=133,
coupling_map=cmap,
basis_gates=get_gateset("ibm_heron"),
noise_info=True,
seed=DEFAULT_SEED,
control_flow=True,
)
target = backend.target
target.description = "ibm_heron_133"
return target
[docs]
@register_device("ibm_heron_156")
def get_ibm_heron_156() -> Target:
"""Get the target for a 156-qubit IBM Heron architecture."""
cmap = [
[0, 1],
[1, 0],
[1, 2],
[2, 1],
[2, 3],
[3, 2],
[3, 4],
[3, 16],
[4, 3],
[4, 5],
[5, 4],
[5, 6],
[6, 5],
[6, 7],
[7, 6],
[7, 8],
[7, 17],
[8, 7],
[8, 9],
[9, 8],
[9, 10],
[10, 9],
[10, 11],
[11, 10],
[11, 12],
[11, 18],
[12, 11],
[12, 13],
[13, 12],
[13, 14],
[14, 13],
[14, 15],
[15, 14],
[15, 19],
[16, 3],
[16, 23],
[17, 7],
[17, 27],
[18, 11],
[18, 31],
[19, 15],
[19, 35],
[20, 21],
[21, 20],
[21, 22],
[21, 36],
[22, 21],
[22, 23],
[23, 16],
[23, 22],
[23, 24],
[24, 23],
[24, 25],
[25, 24],
[25, 26],
[25, 37],
[26, 25],
[26, 27],
[27, 17],
[27, 26],
[27, 28],
[28, 27],
[28, 29],
[29, 28],
[29, 30],
[29, 38],
[30, 29],
[30, 31],
[31, 18],
[31, 30],
[31, 32],
[32, 31],
[32, 33],
[33, 32],
[33, 34],
[33, 39],
[34, 33],
[34, 35],
[35, 19],
[35, 34],
[36, 21],
[36, 41],
[37, 25],
[37, 45],
[38, 29],
[38, 49],
[39, 33],
[39, 53],
[40, 41],
[41, 36],
[41, 40],
[41, 42],
[42, 41],
[42, 43],
[43, 42],
[43, 44],
[43, 56],
[44, 43],
[44, 45],
[45, 37],
[45, 44],
[45, 46],
[46, 45],
[46, 47],
[47, 46],
[47, 48],
[47, 57],
[48, 47],
[48, 49],
[49, 38],
[49, 48],
[49, 50],
[50, 49],
[50, 51],
[51, 50],
[51, 52],
[51, 58],
[52, 51],
[52, 53],
[53, 39],
[53, 52],
[53, 54],
[54, 53],
[54, 55],
[55, 54],
[55, 59],
[56, 43],
[56, 63],
[57, 47],
[57, 67],
[58, 51],
[58, 71],
[59, 55],
[59, 75],
[60, 61],
[61, 60],
[61, 62],
[61, 76],
[62, 61],
[62, 63],
[63, 56],
[63, 62],
[63, 64],
[64, 63],
[64, 65],
[65, 64],
[65, 66],
[65, 77],
[66, 65],
[66, 67],
[67, 57],
[67, 66],
[67, 68],
[68, 67],
[68, 69],
[69, 68],
[69, 70],
[69, 78],
[70, 69],
[70, 71],
[71, 58],
[71, 70],
[71, 72],
[72, 71],
[72, 73],
[73, 72],
[73, 74],
[73, 79],
[74, 73],
[74, 75],
[75, 59],
[75, 74],
[76, 61],
[76, 81],
[77, 65],
[77, 85],
[78, 69],
[78, 89],
[79, 73],
[79, 93],
[80, 81],
[81, 76],
[81, 80],
[81, 82],
[82, 81],
[82, 83],
[83, 82],
[83, 84],
[83, 96],
[84, 83],
[84, 85],
[85, 77],
[85, 84],
[85, 86],
[86, 85],
[86, 87],
[87, 86],
[87, 88],
[87, 97],
[88, 87],
[88, 89],
[89, 78],
[89, 88],
[89, 90],
[90, 89],
[90, 91],
[91, 90],
[91, 92],
[91, 98],
[92, 91],
[92, 93],
[93, 79],
[93, 92],
[93, 94],
[94, 93],
[94, 95],
[95, 94],
[95, 99],
[96, 83],
[96, 103],
[97, 87],
[97, 107],
[98, 91],
[98, 111],
[99, 95],
[99, 115],
[100, 101],
[101, 100],
[101, 102],
[101, 116],
[102, 101],
[102, 103],
[103, 96],
[103, 102],
[103, 104],
[104, 103],
[104, 105],
[105, 104],
[105, 106],
[105, 117],
[106, 105],
[106, 107],
[107, 97],
[107, 106],
[107, 108],
[108, 107],
[108, 109],
[109, 108],
[109, 110],
[109, 118],
[110, 109],
[110, 111],
[111, 98],
[111, 110],
[111, 112],
[112, 111],
[112, 113],
[113, 112],
[113, 114],
[113, 119],
[114, 113],
[114, 115],
[115, 99],
[115, 114],
[116, 101],
[116, 121],
[117, 105],
[117, 125],
[118, 109],
[118, 129],
[119, 113],
[119, 133],
[120, 121],
[121, 116],
[121, 120],
[121, 122],
[122, 121],
[122, 123],
[123, 122],
[123, 124],
[123, 136],
[124, 123],
[124, 125],
[125, 117],
[125, 124],
[125, 126],
[126, 125],
[126, 127],
[127, 126],
[127, 128],
[127, 137],
[128, 127],
[128, 129],
[129, 118],
[129, 128],
[129, 130],
[130, 129],
[130, 131],
[131, 130],
[131, 132],
[131, 138],
[132, 131],
[132, 133],
[133, 119],
[133, 132],
[133, 134],
[134, 133],
[134, 135],
[135, 134],
[135, 139],
[136, 123],
[136, 143],
[137, 127],
[137, 147],
[138, 131],
[138, 151],
[139, 135],
[139, 155],
[140, 141],
[141, 140],
[141, 142],
[142, 141],
[142, 143],
[143, 136],
[143, 142],
[143, 144],
[144, 143],
[144, 145],
[145, 144],
[145, 146],
[146, 145],
[146, 147],
[147, 137],
[147, 146],
[147, 148],
[148, 147],
[148, 149],
[149, 148],
[149, 150],
[150, 149],
[150, 151],
[151, 138],
[151, 150],
[151, 152],
[152, 151],
[152, 153],
[153, 152],
[153, 154],
[154, 153],
[154, 155],
[155, 139],
[155, 154],
]
backend = GenericBackendV2(
num_qubits=156,
coupling_map=cmap,
basis_gates=get_gateset("ibm_heron"),
noise_info=True,
seed=DEFAULT_SEED,
control_flow=True,
)
target = backend.target
target.description = "ibm_heron_156"
return target