What you learn today
- Instructions of the level
- Tricky traps
- Practice questions
In three days is the final exam: 20 questions from months 10 to 12, 45 minutes, passed from 70 %. Today you go through the syllabus and work out the traps once yourself.
What is covered
| Area | check yourself |
|---|---|
| bits and data | and, or, xor, not, shifts, rotations, ext/ins, STR, HASH, 53 bits |
| chip networks | one writer per address, protocol with acknowledgement, watchdog |
| algorithms | lookup tables, lerp between points, sorting, statistics |
| optimisation | 128 lines, 4096 characters, 128 instructions per tick |
| debugging | error numbers, silent errors, test cases |
| systems | robustness, restart, rockets, big projects |
The hardest traps
| Trap | correct is |
|---|---|
not 0 | −1, all 64 bits set |
srl on negative numbers | becomes huge – sra keeps the sign |
sra -100 3 | −13, because sra rounds down, not −12 |
rol and ror | rotate within 54 bits |
ext/ins | field at most 53 bits |
STR | at most 6 ASCII characters |
| define with another define | gives NaN, without an error message |
lbn … Count | ignores the name |
lbn … Maximum without a match | −inf, not 0 |
| 130 lines | too long, 128 is the maximum |
300 instructions without yield | no error, the chip continues in the next tick |
| program end | chip stands still, without an error |
| error numbers | 16 ChipCatchingFire, 17 StackOverFlow, 18 StackUnderFlow, 9 UnrecognisedInstruction |
Clearing one bit on purpose is a typical exam task:
not tmp 1 # all bits except bit 0
and cleared wort tmp # bit 0 cleared, the rest stays
sra divided value 3 # -100 becomes -13: sra rounds down
Work out the bit questions on paper in binary. $F0 and $3C: 1111_0000 and 0011_1100 share 0011_0000, so 48. Whoever calculates in decimal in their head miscalculates.
Exercise
Task
Calculation exercise without devices. r0 holds a status word, r5 a value (set by the test).
r1= bits 4 to 7 of r0 as a numberr2= r0 with bit 2 setr3= r0 with bit 0 clearedr4= r5 divided by 8 keeping the sign, by shiftingr6= r5 limited to −50 to 50
Hints
Hint 1
r1: ext with start 4 and length 4.
Hint 2
r2: or with %100. r3: not tmp 1, then and.
Hint 3
r4: sra by 3 places. r6: clamp.
Quiz
5 questions. You pass from 60 % – the server does the grading.
Complete the day
- Passed the simulator exercise
- Passed the quiz with at least 60 %
Without an account progress is saved in this browser only.
Report a mistake in this lesson
Please sign in to report. Sign in