|
24 | 24 | #include "trim_toa_scan.h" |
25 | 25 | #include "vt50_scan.h" |
26 | 26 |
|
| 27 | +// 12 bits, default 0x2 |
| 28 | +static const int ALIGNER_ORBSYN_CNT_SNAPSHOT = 0x0380 + 0x16; |
| 29 | + |
| 30 | +static const int CHALIGNER_BASE[12] = { |
| 31 | + 0x000, |
| 32 | + 0x040, |
| 33 | + 0x080, |
| 34 | + 0x0c0, |
| 35 | + 0x100, |
| 36 | + 0x140, |
| 37 | + 0x180, |
| 38 | + 0x1c0, |
| 39 | + 0x200, |
| 40 | + 0x240, |
| 41 | + 0x280, |
| 42 | + 0x2c0 |
| 43 | +}; |
| 44 | + |
| 45 | +// 1b, flag if pattern found |
| 46 | +static const int CHALIGNER_PATTERN_MATCH = 0x0; |
| 47 | + |
| 48 | +// snapshot location, 192b |
| 49 | +static const int CHALIGNER_SNAPSHOT = 0x2; |
| 50 | + |
| 51 | +void scan_l1a_offset(Target* tgt) { |
| 52 | + auto& econ{tgt->econ(0)}; |
| 53 | + for (int t_snapshot{3490}; t_snapshot < 3540; t_snapshot+=4) { |
| 54 | + econ.setValue(ALIGNER_ORBSYN_CNT_SNAPSHOT, t_snapshot, 3); |
| 55 | + // pause to make sure new snapshot is taken? |
| 56 | + usleep(1000); |
| 57 | + |
| 58 | + printf("%d:\n", t_snapshot); |
| 59 | + for (int ch{9}; ch < 11; ch++) { |
| 60 | + std::string channel = std::to_string(ch); |
| 61 | + std::string var_name_pm = channel + "_PATTERN_MATCH"; |
| 62 | + auto ch_pm = econ.readParameter("CHALIGNER", var_name_pm); |
| 63 | + bool pattern_match = (ch_pm == 1); |
| 64 | + |
| 65 | + std::string var_name_snapshot1 = channel + "_SNAPSHOT_0"; |
| 66 | + std::string var_name_snapshot2 = channel + "_SNAPSHOT_1"; |
| 67 | + std::string var_name_snapshot3 = channel + "_SNAPSHOT_2"; |
| 68 | + auto ch_snapshot_1 = econ.readParameter("CHALIGNER", var_name_snapshot1); |
| 69 | + auto ch_snapshot_2 = econ.readParameter("CHALIGNER", var_name_snapshot2); |
| 70 | + auto ch_snapshot_3 = econ.readParameter("CHALIGNER", var_name_snapshot3); |
| 71 | + printf(" %2d: %s %08x %08x %08x\n", |
| 72 | + ch, (pattern_match ? "*": " "), |
| 73 | + ch_snapshot_3, ch_snapshot_2, ch_snapshot_1); |
| 74 | + |
| 75 | + /* |
| 76 | + * attempting to do a quick mimic failed |
| 77 | + bool pattern_match = ((econ.getValues(CHALIGNER_BASE[ch]+CHALIGNER_PATTERN_MATCH, 1)[0] & 0x1)==1); |
| 78 | + auto snapshot = econ.getValues(CHALIGNER_BASE[ch]+CHALIGNER_SNAPSHOT, 24); |
| 79 | +
|
| 80 | + printf(" %2d: %s", ch, (pattern_match ? "*": " ")); |
| 81 | + // snapshot is little-endian |
| 82 | + printf("%2d", snapshot.size()); |
| 83 | + for (std::size_t i_byte{snapshot.size()}; i_byte > 0; i_byte--) { |
| 84 | + printf("%02x", static_cast<int>(snapshot[i_byte])); |
| 85 | + if (i_byte % 8 == 0) printf(" "); |
| 86 | + } |
| 87 | + printf("\n"); |
| 88 | + */ |
| 89 | + } |
| 90 | + } |
| 91 | +} |
| 92 | + |
27 | 93 | namespace { |
28 | 94 | auto menu_tasks = |
29 | 95 | pftool::menu("TASKS", |
30 | 96 | "tasks for studying the chip and tuning its parameters") |
| 97 | + ->line("SCAN_L1A_OFFSET", "scan L1A offset in ECON to try to find data", scan_l1a_offset) |
31 | 98 | ->line("CHARGE_TIMESCAN", "scan charge/calib pulse over time", |
32 | 99 | charge_timescan) |
33 | 100 | ->line("GEN_SCAN", "scan over file of input parameter points", gen_scan) |
|
0 commit comments