Control the speed and size of a VGA animation
Online version: https://fpga.labsland.com/altera/computer-organization/lab-08/part-04/
Debugger setup
CPUlator simulatorC · DE1-SoC Nios V computer, simulated in your browser. No board or sign-in needed.
- Get the sourceDownload
main.c - Open the simulatorOpen CPUlator
Give the user control of a moving chain of squares. KEY0 doubles the distance traveled per frame and KEY1 halves it. KEY2 adds a square and KEY3 removes one. Raising any switch should hide the white links while leaving the colored squares moving.
In CPUlator choose C, use File → Open to load main.c, then Compile and Load (F5). Open the VGA pixel buffer device and use Continue (F3).
Try every control
Set a breakpoint on move. The arguments a0 and a1 contain the number of squares and the steps per frame. Use a button press and release between two stops; then press Continue. The first run starts with four squares and two steps. Raise SW9, change the number of squares and take a screenshot. Lower SW9 and compare the same scene. Which condition in main controls the white links?
Find the limits
From a fresh run, release KEY2 three times, KEY0 three times, then KEY1 four times. Finally release KEY3 until only one square is left and try one more time. Collect a0 and a1 at the lower and upper limits. Compare the displacement of the red square on two consecutive frames at different speeds.
| Control | Smallest observed | Largest observed | What happens on one more press? |
|---|---|---|---|
| Squares | |||
| Steps per frame |
Repair the switch condition. Submit the table and two screenshots that isolate the link control. Explain why the program checks for collisions on every single-pixel step when a fast frame advances eight positions.
Original LabsLand activity following FPGAcademy Computer Organization Lab 8, Part IV. FPGAcademy PDF · MIT
