1
0
This commit is contained in:
Aiden
2026-05-27 21:37:50 +10:00
parent 21f0e455ee
commit 4364d0ed48
54 changed files with 30241 additions and 191 deletions

View File

@@ -494,6 +494,77 @@ class SerialPseudocodeTest(unittest.TestCase):
self.assertIn("MEM8[0xF9C6u] = (u8)(MEM8[0xF9C6u] - 1u);", text)
self.assertIn("candidate effect: table_write_candidate; target primary_value_table_candidate", text)
def test_panel_selector_semantics_are_emitted_as_comments_and_helper(self):
analysis = {
"protocol_semantics": [
{
"confidence": "medium",
"confidence_score": 0.7,
"commands": [],
"panel_selector_semantics": [
{
"selector": 0x0013,
"selector_hex": "0x0013",
"name": "slave_and_iris_mblack_link_lamps",
"summary": "Selector 0x0013 reads H'E826 and controls two lamp bits.",
"current_word_address_hex": "H'E826",
"dispatch_handler": "H'2E06",
"state_machine": {
"name_candidate": "iris_mblack_link_closed_loop_state_candidate",
"summary": "RCP reports local intent, CCU ACKs selector 0x0013, then mirrors accepted state back.",
"active_report_frame": "00 00 13 40 00 09",
"clear_report_frame": "00 00 13 00 00 49",
"ack_frame": "05 00 13 00 00 4C",
"active_mirror_frame": "00 00 13 40 00 09",
"clear_mirror_frame": "00 00 13 00 00 49",
},
"effects": [
{
"bit": 14,
"mask": 0x4000,
"mask_hex": "0x4000",
"name": "IRIS/M.BLACK LINK lamp",
"when_set": "sets F791.5 and F716.7",
"when_clear": "clears F791.5 and F716.7",
"ram_bits": ["F791.5", "F716.7"],
},
],
"local_triggers": [
{
"source": "F006.7 / F6DB.7",
"handler": "H'200E",
"name_candidate": "provisional_iris_mblack_link_button_toggle_report",
"summary": "H'200E toggles H'E826 bit14 and queues selector 0x0013.",
"gate": "F731 <= 3",
"current_state_bit": "F791.5",
"active_value": 0x4000,
"clear_value": 0x0000,
},
],
},
],
}
]
}
with patch("h8536.serial_pseudocode.analyze_serial_semantics", return_value=analysis):
text = generate_serial_pseudocode(candidate_payload())
self.assertIn("panel selector semantics:", text)
self.assertIn("0x0013 slave_and_iris_mblack_link_lamps", text)
self.assertIn("0x4000 -> IRIS/M.BLACK LINK lamp", text)
self.assertIn("F791.5", text)
self.assertIn("F716.7", text)
self.assertIn("F006.7 / F6DB.7", text)
self.assertIn("iris_mblack_link_closed_loop_state_candidate", text)
self.assertIn("ACK 05 00 13 00 00 4C", text)
self.assertIn("static void sci1_candidate_panel_selector_annotation", text)
self.assertIn("case 0x0013u:", text)
self.assertIn("void provisional_iris_mblack_link_button_toggle_report(void)", text)
self.assertIn("Source F006.7 / F6DB.7; gate F731 <= 3; current state F791.5.", text)
self.assertIn("Requests selector 0x0013=0x4000", text)
self.assertIn("CCU should ACK 05 00 13 00 00 4C, then mirror 00 00 13 40 00 09.", text)
def test_timer_source_models_emit_separate_tick_isrs(self):
analysis = {
"protocol_semantics": [