2023-08-26 00:11:05 +01:00
|
|
|
def _make_output_cache(vm) -> dict:
|
2023-08-22 02:04:00 +01:00
|
|
|
match vm.kind.name:
|
|
|
|
case "basic":
|
|
|
|
return {
|
2023-08-26 00:11:05 +01:00
|
|
|
**{f"STRIP {i}||A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)},
|
2023-08-22 02:04:00 +01:00
|
|
|
}
|
|
|
|
case "banana":
|
|
|
|
return {
|
2023-08-26 00:11:05 +01:00
|
|
|
**{f"STRIP {i}||A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||A2": vm.strip[i].A2 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||A3": vm.strip[i].A3 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||B2": vm.strip[i].B2 for i in range(vm.kind.num_strip)},
|
2023-08-22 02:04:00 +01:00
|
|
|
}
|
|
|
|
case "potato":
|
|
|
|
return {
|
2023-08-26 00:11:05 +01:00
|
|
|
**{f"STRIP {i}||A1": vm.strip[i].A1 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||A2": vm.strip[i].A2 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||A3": vm.strip[i].A3 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||A4": vm.strip[i].A4 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||A5": vm.strip[i].A5 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||B1": vm.strip[i].B1 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||B2": vm.strip[i].B2 for i in range(vm.kind.num_strip)},
|
|
|
|
**{f"STRIP {i}||B3": vm.strip[i].B3 for i in range(vm.kind.num_strip)},
|
2023-08-22 02:04:00 +01:00
|
|
|
}
|
2023-08-22 20:41:44 +01:00
|
|
|
|
|
|
|
|
2023-08-26 20:22:46 +01:00
|
|
|
def _make_bus_mode_cache(vm) -> dict:
|
2023-08-28 21:21:26 +01:00
|
|
|
return {**{f"BUS {i}||MODE": vm.bus[i].mode.get() for i in range(vm.kind.num_bus)}}
|
2023-09-02 04:23:15 +01:00
|
|
|
|
|
|
|
|
|
|
|
def _make_label_cache(vm) -> dict:
|
|
|
|
return {
|
|
|
|
"strip": {
|
|
|
|
**{
|
|
|
|
f"STRIP {i}||LABEL": vm.strip[i].label if vm.strip[i].label else f"Hardware Input {i + 1}"
|
|
|
|
for i in range(vm.kind.phys_in)
|
|
|
|
},
|
|
|
|
**{
|
|
|
|
f"STRIP {i}||LABEL": vm.strip[i].label
|
|
|
|
if vm.strip[i].label
|
|
|
|
else f"Virtual Input {i - vm.kind.phys_in + 1}"
|
|
|
|
for i in range(vm.kind.phys_in, vm.kind.phys_in + vm.kind.virt_in)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"bus": {
|
|
|
|
**{
|
|
|
|
f"BUS {i}||LABEL": vm.bus[i].label if vm.bus[i].label else f"Physical Bus {i + 1}"
|
|
|
|
for i in range(vm.kind.phys_out)
|
|
|
|
},
|
|
|
|
**{
|
|
|
|
f"BUS {i}||LABEL": vm.bus[i].label if vm.bus[i].label else f"Virtual Bus {i - vm.kind.phys_out + 1}"
|
|
|
|
for i in range(vm.kind.phys_out, vm.kind.phys_out + vm.kind.virt_out)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|