cores/jtag: Add more Altera part numbers

This commit is contained in:
stone3311 2022-12-31 13:45:01 +01:00
parent e8322587a0
commit f8d2f1adde
1 changed files with 36 additions and 25 deletions

View File

@ -238,40 +238,51 @@ class AlteraJTAG(Module):
@staticmethod @staticmethod
def get_primitive(device): def get_primitive(device):
# TODO: Add support for all devices. # TODO: Add support for Stratix 10, Arria 10 SoC and Agilex devices.
prim_dict = { prim_dict = {
# Primitive Name Ðevice (startswith) # Primitive Name Ðevice (startswith)
"arriaii_jtag" : [], "arriaii_jtag" : ["ep2a"],
"arriaiigz_jtag" : [], "arriaiigz_jtag" : ["ep2agz"],
"arriav_jtag" : [], "arriav_jtag" : ["5a"],
"arriavgz_jtag" : [], "arriavgz_jtag" : ["5agz"],
"cyclone_jtag" : [], "cyclone_jtag" : ["ep1c"],
"cyclone10lp_jtag" : ["10cl"], "cyclone10lp_jtag" : ["10cl"],
"cycloneii_jtag" : [], "cycloneii_jtag" : ["ep2c"],
"cycloneiii_jtag" : [], "cycloneiii_jtag" : ["ep3c"],
"cycloneiiils_jtag" : [], "cycloneiiils_jtag" : ["ep3cls"],
"cycloneiv_jtag" : [], "cycloneiv_jtag" : ["ep4cgx"],
"cycloneive_jtag" : ["ep4c"], "cycloneive_jtag" : ["ep4ce"],
"cyclonev_jtag" : ["5c"], "cyclonev_jtag" : ["5c"],
"fiftyfivenm_jtag" : ["10m"], "fiftyfivenm_jtag" : ["10m"], # MAX 10 series
"maxii_jtag" : [], "maxii_jtag" : ["epm1", "epm2", "epm5"],
"maxv_jtag" : [], "maxv_jtag" : ["5m"],
"stratix_jtag" : [], "stratix_jtag" : ["ep1s"],
"stratixgx_jtag" : [], "stratixgx_jtag" : ["ep1sgx"],
"stratixii_jtag" : [], "stratixii_jtag" : ["ep2s"],
"stratixiigx_jtag" : [], "stratixiigx_jtag" : ["ep2sgx"],
"stratixiii_jtag" : [], "stratixiii_jtag" : ["ep3s"],
"stratixiv_jtag" : [], "stratixiv_jtag" : ["ep4s"],
"stratixv_jtag" : [], "stratixv_jtag" : ["5s"],
"twentynm_jtagblock" : [], "twentynm_jtagblock" : [], # Arria 10 series
"twentynm_jtag" : [], "twentynm_jtag" : ["10a"],
"twentynm_hps_interface_jtag" : [], "twentynm_hps_interface_jtag" : [],
} }
matching_prims = {}
for prim, prim_devs in prim_dict.items(): for prim, prim_devs in prim_dict.items():
for prim_dev in prim_devs: for prim_dev in prim_devs:
if device.lower().startswith(prim_dev): if device.lower().startswith(prim_dev):
return prim matching_prims[prim_dev] = prim
return None
# get the closest match
best_device = ""
for dev, prim in matching_prims.items():
if len(dev) > len(best_device):
best_device = dev
return matching_prims.get(best_device)
# Xilinx JTAG -------------------------------------------------------------------------------------- # Xilinx JTAG --------------------------------------------------------------------------------------