A Simon-style memory game implemented in RISC-V assembly language. This project demonstrates low-level programming with hardware interaction, controlling LEDs and reading input from a D-pad.
- Classic Simon gameplay with random sequence generation
- Progressive difficulty - sequences get longer as you succeed
- Visual feedback through LED colors
- Interactive input via D-pad controls
The Simon game is implemented in RISC-V assembly with a focus on efficient memory usage and hardware interaction. The core components include:
- Memory Management: Uses a combination of static data segment for constants and heap memory for dynamically growing sequences.
- I/O Handling: Direct hardware interaction with the LED matrix (output) and D-pad controller (input).
- Game Logic: Implements the classic Simon gameplay with sequence generation, display, and validation.
- Implements an enhanced Linear Congruential Generator (LCG) algorithm for better randomness
- Formula:
x₁ = (a·x₀ + b) mod mwhere:- a = 1103515245
- b = 12345
- m = 1073741824
- System time is used as the initial seed for unpredictability
- Dynamic sequence storage using the heap
- Sequence length tracking for difficulty progression
- Efficient memory allocation for growing sequences
- Direct hardware access to LED matrix through memory-mapped I/O
- Visual feedback for player actions and game states (success/failure)
- Timed LED patterns with configurable delays
- D-pad polling with debouncing for reliable input capture
- Mapping of physical inputs to game actions
- Wait-for-release mechanism to prevent multiple triggers
- Initial sequence display phase
- User input and validation phase
- Feedback phase (success/failure)
- Difficulty progression (sequence length increases with each success)
The program demonstrates efficient low-level programming techniques while delivering an engaging gameplay experience through direct hardware interaction.
Please refer to documentation.pdf
This project was developed incrementally, with several enhancements:
- Basic sequence generation and display
- User input validation
- Improved randomization algorithm
- Progressive difficulty levels