feat(L08): add subroutines and ABI card
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# L08 · Subroutines and ABI
|
||||
|
||||
Karta pokazuje, co musi wydarzyć się przy wywołaniu funkcji. Uczeń oblicza
|
||||
cel oraz adres powrotu dla `JAL/JALR`, klasyfikuje wszystkie rejestry według
|
||||
ABI RV32I i obserwuje dwa zagnieżdżone wywołania na małym stosie powrotów.
|
||||
|
||||
## Taski
|
||||
|
||||
| Task | PASS |
|
||||
| --- | --- |
|
||||
| `task01_link_address` | JAL: `target=0x118 link=0x104`; JALR: `target=0x200` |
|
||||
| `task02_abi_registers` | 8 argumentów, 12 saved, 7 temporaries, 5 fixed |
|
||||
| `task03_call_stack` | powroty `0x204`, `0x104`, underflow po trzecim return |
|
||||
|
||||
```bash
|
||||
stemctl card use rv32i-asm L08
|
||||
stemctl test native-amd64 rv32i-asm L08 1
|
||||
stemctl test hazard3-sim rv32i-asm L08 2
|
||||
stemctl debug hazard3-sim rv32i-asm L08 3
|
||||
```
|
||||
|
||||
Model AMD64 i RTL są niezależne. `debug` generuje VCD. Wyniki należy zapisać
|
||||
w [answers/subroutines-abi-evidence.md](answers/subroutines-abi-evidence.md).
|
||||
|
||||
Inwarianty:
|
||||
|
||||
- link zawsze wskazuje `pc+4`;
|
||||
- `JALR` zeruje bit 0 celu;
|
||||
- `x10..x17` to argumenty, `x8..x9` oraz `x18..x27` są callee-saved;
|
||||
- wywołanie odkłada link, return zdejmuje ostatni link (LIFO);
|
||||
- overflow i underflow są jawne i nie uszkadzają głębokości stosu.
|
||||
|
||||
L09 wykorzysta zasady adresowania do pełnej semantyki load/store.
|
||||
Reference in New Issue
Block a user