feat(L08): add subroutines and ABI card

This commit is contained in:
user
2026-07-21 17:19:51 +02:00
commit ea50415a5e
42 changed files with 7250 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
{
"$schema": "../../../../tools/card-layouts/schemas/card-source.schema.json", "schema": "esc-card-source.v1",
"card": {"id": "mpabi-inf-rv32i-asm-08-subroutines-abi", "series": "rv32i-asm", "series_title": "ASM · RV32I From Blinker to RISC-V", "number": "08", "count": "09", "slug": "subroutines-abi", "title": "L08 · Subroutines and ABI", "topic": "JAL/JALR, role rejestrów i zagnieżdżone powroty", "project": "Kontrakt wywołań RV32I", "subject": "Informatyka", "level": "Rok 1 · RTL · RV32I", "revision_date": "2026-07-21T00:00:00+02:00", "status": "Gotowa do symulacji", "version": "v00.01", "uuid": "c6b74348-02ea-56ae-bea1-357935bf1b49", "author": "M. Pabiszczak", "year": "2026"},
"generated": {"tex": "doc/generated/main.tex", "html": "web/index.html", "html_css": "web/style.css", "react_app": true, "html_tree_inspector": false}, "template": "templates/karta-klasyczna.json",
"title_block": {"category": "KARTA PRACY · INFORMATYKA · RTL", "standard": "ISO 7200", "prepared_by": "M. Pabiszczak", "prepared_on": "21.07.2026", "checked_by": "testy automatyczne", "approved_by": "—", "url": "http://localhost:8080", "repository_url": "https://gitea.local/edu-inf/lab-rv32i-asm-subroutines-abi", "revision": "1", "issued_on": "21.07.2026", "series": "RV32I-ASM-08", "document_type": "karta pracy", "tool": "card-layouts", "sheet": "1 / 1", "show_qr": false, "show_repository_qr": false, "height_cm": 3, "repeat_on_every_page": true, "replace_front_matter": true},
"front_page_scope": {"title": "Cel karty", "content_tex": "Uczeń wyznacza cel i link skoku, mapuje 32 rejestry ABI oraz śledzi zagnieżdżone wywołania LIFO.", "scope_title": "Zakres tasków", "scope_table": {"headers": ["Krok", "Numer tasku", "Najważniejsza idea", "Priorytet", "Status", "Version"], "rows": [{"chapter": "10", "task": "Task01", "idea_tex": "target i link JAL/JALR", "priority": "obowiązkowe", "status": "ready", "version": "v00.01"}, {"chapter": "10", "task": "Task02", "idea_tex": "mapa rejestrów ABI", "priority": "obowiązkowe", "status": "ready", "version": "v00.01"}, {"chapter": "10", "task": "Task03", "idea_tex": "zagnieżdżony stos powrotów", "priority": "obowiązkowe", "status": "ready", "version": "v00.01"}]}},
"side_margin_tree_layout": {"columns": [{"id": "zawodowe", "label": "TECH", "side": "left", "tree": "WE -> EK -> KW", "description": "JAL/JALR, ABI i stos powrotów."}, {"id": "ogolne", "label": "OG", "side": "right", "tree": "WE -> EN -> KW", "description": "Analiza kontraktu i LIFO."}]},
"learning_effects": {"RV08.EN01": {"bloom_level": "Analiza", "label": "Kontrakt", "text": "Uczeń rozróżnia role caller/callee i kolejność LIFO.", "assessment_criteria": ["RV08.KW01"]}, "RV08.EK01": {"bloom_level": "Tworzenie", "label": "Wywołanie", "text": "Uczeń implementuje target/link, klasy ABI i stos powrotów.", "assessment_criteria": ["RV08.KW01"]}},
"assessment_criteria": {"RV08.KW01": {"text": "Cele JAL/JALR, klasy wszystkich rejestrów i dwa zagnieżdżone powroty są zgodne w modelu i RTL.", "learning_effects": ["RV08.EN01", "RV08.EK01"]}},
"educational_requirements": {"RV08.WE01": {"text": "Zbudowanie mierzalnego kontraktu wywołań RV32I.", "label": "Podprogramy i ABI", "learning_effects": ["RV08.EN01", "RV08.EK01"], "learning_tree": {"schema": "we-learning-tree.v1", "policy": "Overflow i underflow nie zmieniają poprawnej głębokości.", "ogolne": [{"effect_ref": "RV08.EN01", "display": "EN IP WO RV08.01", "source": "IP", "official": "RV08.01", "local": "01", "text": "Uczeń analizuje role ABI i LIFO.", "kind": "WO", "tree_id": "RV08.WE01.OG.IP.01", "kw": [{"criterion_ref": "RV08.KW01", "display": "KW IP WS RV08.01", "source": "IP", "kind": "WS", "official": "RV08.01", "local": "01", "text": "Adresy powrotu pojawiają się w odwrotnej kolejności."}] }], "zawodowe": [{"effect_ref": "RV08.EK01", "display": "EK INF04 RV08.01", "source": "I4", "official": "RV08.01", "local": "01", "text": "Uczeń tworzy tor wywołań.", "kind": "EK", "tree_id": "RV08.WE01.TECH.I4.01", "kw": [{"criterion_ref": "RV08.KW01", "display": "KW INF04 RV08.01", "source": "I4", "kind": "KW", "official": "RV08.01", "local": "01", "text": "Target, link, klasy ABI i flagi stosu są poprawne."}] }]}}},
"sections": [
{"title": "Task01 · JAL i JALR", "order": 10, "content_kind": "prose", "content_tex": "Dla obu instrukcji link wynosi \texttt{pc+4}. JAL jest PC-relative, JALR dodaje immediate do rs1 i zeruje bit 0 celu.", "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_refs": ["RV08.KW01"], "area_tree_refs": ["RV08.WE01.OG.IP.01", "RV08.WE01.TECH.I4.01"], "steps": [{"id": "T01-PREDICT", "title": "Wyznacz cele 118 i 200 hex oraz link 104 hex.", "tree_refs": ["RV08.WE01.OG.IP.01"], "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01"], "assessment_criterion_refs": ["RV08.KW01"]}, {"id": "T01-TRACE", "title": "Zmierz target/link i zapisz VCD.", "tree_refs": ["RV08.WE01.TECH.I4.01"], "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EK01"], "assessment_criterion_refs": ["RV08.KW01"]}], "assets": [{"path": "assets/subroutines-abi.png", "html_path": "assets/subroutines-abi.svg", "caption": "JAL/JALR tworzy link, a stos odtwarza adresy powrotu w kolejności LIFO.", "label": "fig:subroutines-abi", "alt": "Diagram JAL, ra, call stack i return.", "kind": "diagram", "width": 0.9}]},
{"title": "Task02 · Rejestry ABI", "order": 20, "content_kind": "prose", "content_tex": "Sklasyfikuj wszystkie 32 rejestry: argumenty, callee-saved, temporaries oraz pięć rejestrów o stałych rolach.", "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_refs": ["RV08.KW01"], "area_tree_refs": ["RV08.WE01.OG.IP.01", "RV08.WE01.TECH.I4.01"], "steps": [{"id": "T02-MAP", "title": "Potwierdź liczności 8, 12, 7 i 5.", "tree_refs": ["RV08.WE01.OG.IP.01", "RV08.WE01.TECH.I4.01"], "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_refs": ["RV08.KW01"]}]},
{"title": "Task03 · Zagnieżdżone wywołania", "order": 30, "content_kind": "prose", "content_tex": "Odłóż link 104, potem 204 hex. Dwa return muszą zwrócić 204, potem 104; trzeci return sygnalizuje underflow.", "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_refs": ["RV08.KW01"], "area_tree_refs": ["RV08.WE01.OG.IP.01", "RV08.WE01.TECH.I4.01"], "steps": [{"id": "T03-STACK", "title": "Zmierz max depth 2, kolejność powrotów i underflow.", "tree_refs": ["RV08.WE01.OG.IP.01", "RV08.WE01.TECH.I4.01"], "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_refs": ["RV08.KW01"]}]}
],
"tasks": {"task01": {"prompt_tex": "Zweryfikuj target i link JAL/JALR.", "criterion": "jal_target=00000118 link=00000104 jalr_target=00000200", "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_ref": "RV08.KW01", "links": {"equations": [], "figures": ["fig:subroutines-abi"]}}, "task02": {"prompt_tex": "Sklasyfikuj wszystkie rejestry ABI.", "criterion": "args=8 saved=12 temporaries=7 fixed=5", "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_ref": "RV08.KW01", "links": {"equations": [], "figures": ["fig:subroutines-abi"]}}, "task03": {"prompt_tex": "Wykonaj dwa zagnieżdżone call i trzy return.", "criterion": "returns=00000204,00000104 underflow=1 max_depth=2", "educational_requirement_refs": ["RV08.WE01"], "learning_effect_refs": ["RV08.EN01", "RV08.EK01"], "assessment_criterion_ref": "RV08.KW01", "links": {"equations": [], "figures": ["fig:subroutines-abi"]}}},
"tasks_order": ["task01", "task02", "task03"], "mission": "Połącz mechanikę JAL/JALR z kontraktem ABI i kolejnością powrotów.", "objectives": ["Wyznaczysz target i link.", "Sklasyfikujesz 32 rejestry ABI.", "Prześledzisz zagnieżdżone wywołania LIFO."],
"agenda": [{"time": "0--20 min", "work": "JAL i JALR."}, {"time": "20--45 min", "work": "Mapa ABI."}, {"time": "45--70 min", "work": "Stos powrotów i VCD."}],
"tech_stack": {"software": [{"name": "SystemVerilog", "use": "target, klasyfikator i stos"}, {"name": "Verilator", "use": "test i VCD"}, {"name": "stemctl", "use": "profile wykonania"}], "hardware": [{"name": "Brak wymaganego FPGA", "use": "deterministyczna symulacja RTL"}]},
"theory_refs": {"intro": "ABI określa role rejestrów i odpowiedzialność za ich zachowanie między wywołaniami.", "known_refs": [], "new_concepts": [{"term": "link address", "definition": "Adres następnej instrukcji zapisany jako miejsce powrotu."}, {"term": "callee-saved", "definition": "Rejestr, którego wartość funkcja wywołana musi odtworzyć."}]},
"container_test": {"title": "Test bez płytki", "commands": ["stemctl test native-amd64 rv32i-asm L08 1", "stemctl test hazard3-sim rv32i-asm L08 2", "stemctl debug hazard3-sim rv32i-asm L08 3"], "pass_condition": "Modele i RTL zwracają trzy komunikaty PASS, a debug zapisuje VCD."},
"safety_rules": [{"title": "JALR alignment", "body": "Bit 0 obliczonego celu jest zawsze zerowany."}, {"title": "Stack fail-closed", "body": "Overflow i underflow nie zmieniają depth."}],
"hardware_procedure": [{"step": "1", "action": "Oblicz target i link.", "condition": "Wyniki zapisane przed RTL."}, {"step": "2", "action": "Policz klasy ABI.", "condition": "Łącznie sklasyfikowano 32 rejestry."}, {"step": "3", "action": "Wykonaj nested calls i zapisz VCD.", "condition": "Powroty 204/104, potem underflow."}], "references": []
}