When working on the cpu, always stick to the following pattern:
-
Implement in JavaScript First
- Start with the JavaScript port (
js/main.js) - Strictly stick to the code style already present
- Test thoroughly with assembly files
- JavaScript provides easier debugging and faster iteration
- Start with the JavaScript port (
-
Test with Assembly Files
- Create comprehensive test cases in
tests/directory - Use binutils-riscv64-unknown-elf package for building tests
- Install with:
sudo apt-get install binutils-riscv64-unknown-elf - Build tests with:
make tests
- Create comprehensive test cases in
-
Port to C and Rust
- Only proceed after JavaScript implementation is working correctly
- Port to C (
c/main.c) - Port to Rust (
rust/main.rs) - Maintain 1:1 mapping with JavaScript implementation
-
Version bump
- For every pull request, update the version in
js/package.json - For new features, update the minor part
- For fixes/refactorings, update the patch part
- Copy that version to
rust/Cargo.toml
- For every pull request, update the version in
-
Unwanted files
- Do not create or commit codeql... or similar files without being explicitly asked for