-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into o1vm/extract-get-all-constraints-from-main
- Loading branch information
Showing
72 changed files
with
1,733 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: MIPS Build and Package | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
rust_toolchain_version: ["1.74"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Cache apt packages | ||
id: apt-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
/var/cache/apt/archives/*.deb | ||
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/mips-build.yml') }} | ||
|
||
- name: Install MIPS tools | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y binutils-mips-linux-gnu | ||
- name: Build MIPS programs | ||
run: make build-mips-programs | ||
|
||
- name: Use shared Rust toolchain setting up steps | ||
uses: ./.github/actions/toolchain-shared | ||
with: | ||
rust_toolchain_version: ${{ matrix.rust_toolchain_version }} | ||
|
||
- name: Test elf_loader against mips programs | ||
run: ./o1vm/test-gen-state-json.sh | ||
|
||
- name: Create tar archive | ||
run: | | ||
cd o1vm/resources/programs/mips | ||
tar -czf mips-binaries.tar.gz bin/ | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: mips-binaries | ||
path: o1vm/resources/programs/mips/mips-binaries.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
.section .text | ||
.globl _start | ||
|
||
_start: | ||
# Initialize registers | ||
li t0, 0 # t0 will hold the running total (initialize to 0) | ||
li t1, 1 # First number | ||
li t2, 2 # Second number | ||
li t3, 3 # Third number | ||
li t4, 4 # Fourth number | ||
li t5, 5 # Fifth number | ||
|
||
# Perform additions | ||
add t0, t0, t1 # t0 = t0 + t1 (0 + 1) | ||
add t0, t0, t2 # t0 = t0 + t2 (1 + 2) | ||
add t0, t0, t3 # t0 = t0 + t3 (3 + 3) | ||
add t0, t0, t4 # t0 = t0 + t4 (6 + 4) | ||
add t0, t0, t5 # t0 = t0 + t5 (10 + 5) | ||
|
||
# Custom exit syscall | ||
li a0, 0 # Set a0 to 0 | ||
li a1, 0 # Set a1 to 0 | ||
li a2, 0 # Set a2 to 0 | ||
li a3, 0 # Set a3 to 0 | ||
li a4, 0 # Set a4 to 0 | ||
li a5, 0 # Set a5 to 0 | ||
li a6, 0 # Set a6 to 0 | ||
li a7, 42 # Set a7 to 42 (custom ecall number) | ||
ecall # Trigger syscall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
.section .text | ||
.globl _start | ||
|
||
_start: | ||
# Initialize registers with some numbers | ||
li t0, 123 # First number | ||
li t1, 456 # Second number | ||
li t2, 789 # Third number | ||
|
||
# Perform first addition | ||
add t3, t0, t1 # t3 = t0 + t1 (123 + 456 = 579) | ||
|
||
# Perform second addition | ||
add t4, t3, t2 # t4 = t3 + t2 (579 + 789 = 1368) | ||
|
||
# Add all numbers in a more complex way for redundancy | ||
add t5, t0, t2 # t5 = t0 + t2 (123 + 789 = 912) | ||
add t6, t1, t5 # t6 = t1 + t5 (456 + 912 = 1368) | ||
|
||
# Ensure final result matches expectations | ||
add t6, t4, x0 # t6 = t4 + x0 (Copy t4 to t6 for validation) | ||
|
||
# Custom exit syscall | ||
li a0, 0 # Set a0 to 0 | ||
li a1, 0 # Set a1 to 0 | ||
li a2, 0 # Set a2 to 0 | ||
li a3, 0 # Set a3 to 0 | ||
li a4, 0 # Set a4 to 0 | ||
li a5, 0 # Set a5 to 0 | ||
li a6, 0 # Set a6 to 0 | ||
li a7, 42 # Set a7 to 42 (custom ecall number) | ||
ecall # Trigger syscall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# The addition performed by `add` is simply a bit-wise addition | ||
# The lowest 32 bits are kept, and no overflow bit is kept. | ||
.section .text | ||
.globl _start | ||
|
||
_start: | ||
# Large positive values | ||
# It is equal to | ||
# 0b01111111111111111111111111111111 + | ||
# 0b00000000000000000000000000000001 = | ||
# 0b10000000000000000000000000000000 = | ||
li t0, 2147483647 # t0 = 2147483647 (Max 32-bit signed int) | ||
li t1, 1 # t1 = 1 | ||
add t2, t0, t1 # t2 = t0 + t1 | ||
|
||
# 0b11111111111111111111111111111111 + | ||
# 0b00000000000000000000000000000001 = | ||
# 0b00000000000000000000000000000000 = | ||
li t3, 0b11111111111111111111111111111111 | ||
add t4, t3, t1 # t4 = t3 + t1 (Expected: overflow, wrap around) | ||
|
||
# Custom exit syscall | ||
li a0, 0 | ||
li a1, 0 | ||
li a2, 0 | ||
li a3, 0 | ||
li a4, 0 | ||
li a5, 0 | ||
li a6, 0 | ||
li a7, 42 | ||
ecall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.section .text | ||
.globl _start | ||
|
||
_start: | ||
li t0, 5 # t0 = 5 | ||
li t1, 10 # t1 = 10 | ||
|
||
# Swap t0 and t1 using add | ||
add t2, t0, t1 # t2 = t0 + t1 (t2 = 5 + 10 = 15) | ||
sub t0, t2, t0 # t0 = t2 - t0 (t0 = 15 - 5 = 10) | ||
sub t1, t2, t1 # t1 = t2 - t1 (t1 = 15 - 10 = 5) | ||
|
||
# Custom exit syscall | ||
li a0, 0 | ||
li a1, 0 | ||
li a2, 0 | ||
li a3, 0 | ||
li a4, 0 | ||
li a5, 0 | ||
li a6, 0 | ||
li a7, 42 | ||
ecall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.section .text | ||
.globl _start | ||
|
||
_start: | ||
# Initialize register | ||
li t0, 10 # Load immediate value 10 into t0 | ||
|
||
# Perform addition | ||
addi t0, t0, 5 # Add 5 to the value in t0 and store the result back in t0 | ||
|
||
# Custom exit syscall | ||
li a0, 0 # Set a0 to 0 | ||
li a1, 0 # Set a1 to 0 | ||
li a2, 0 # Set a2 to 0 | ||
li a3, 0 # Set a3 to 0 | ||
li a4, 0 # Set a4 to 0 | ||
li a5, 0 # Set a5 to 0 | ||
li a6, 0 # Set a6 to 0 | ||
li a7, 42 # Set a7 to 42 (custom ecall number) | ||
ecall |
20 changes: 20 additions & 0 deletions
20
o1vm/resources/programs/riscv32im/src/addi_boundary_immediate.S
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.section .text | ||
.globl _start | ||
|
||
_start: | ||
li t0, 100 # t0 = 100 | ||
addi t1, t0, 2047 # t1 = t0 + 2047 (Expected: t1 = 2147) | ||
|
||
li t2, 1000 # t2 = 1000 | ||
addi t3, t2, -2048 # t3 = t2 + (-2048) (Expected: t1 = -1048) | ||
|
||
# Custom exit syscall | ||
li a0, 0 | ||
li a1, 0 | ||
li a2, 0 | ||
li a3, 0 | ||
li a4, 0 | ||
li a5, 0 | ||
li a6, 0 | ||
li a7, 42 | ||
ecall |
Oops, something went wrong.