Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ tests/*.o
tests/*.bin
rust/target
rust/Cargo.lock
_codeql_*
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ rust:
cd rust && cargo build

%.o: %.s
riscv64-unknown-elf-as -march=rv32ima -o $@ $<
riscv64-unknown-elf-as -march=rv32imafd -o $@ $<

%.bin: %.o
riscv64-unknown-elf-objcopy -O binary $< $@

c/main: c/main.c
gcc -O2 -fno-strict-aliasing -o c/main c/main.c
gcc -O2 -fno-strict-aliasing -o c/main c/main.c -lm

clean:
rm -f $(OBJECTS) $(BINARIES) c/main
Expand Down
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ I wanted to do this for a long time, but never had the time to do it. Now I stil

## Supported Extensions

This CPU implements the **RV32I** base instruction set, the **RV32M** extension, and the **RV32A** extension:
This CPU implements the **RV32G** instruction set, which includes:
- **RV32I**: Base instruction set
- **RV32M**: Integer multiplication and division
- **RV32A**: Atomic instructions
- **RV32F**: Single-precision floating-point
- **RV32D**: Double-precision floating-point

### RV32I Base Instructions
- **Load Instructions**: `lb`, `lh`, `lw`, `lbu`, `lhu`
Expand All @@ -32,6 +37,26 @@ This CPU implements the **RV32I** base instruction set, the **RV32M** extension,
- **Atomic Memory Operations**: `amoadd.w`, `amoswap.w`, `amoxor.w`, `amoand.w`, `amoor.w`
- **Atomic Min/Max**: `amomin.w`, `amomax.w`, `amominu.w`, `amomaxu.w`

### RV32F Extension (Single-Precision Floating-Point)
- **Load/Store**: `flw`, `fsw`
- **Arithmetic**: `fadd.s`, `fsub.s`, `fmul.s`, `fdiv.s`, `fsqrt.s`
- **Fused Multiply-Add**: `fmadd.s`, `fmsub.s`, `fnmsub.s`, `fnmadd.s`
- **Conversion**: `fcvt.w.s`, `fcvt.wu.s`, `fcvt.s.w`, `fcvt.s.wu`, `fmv.x.w`, `fmv.w.x`
- **Comparison**: `feq.s`, `flt.s`, `fle.s`
- **Sign Injection**: `fsgnj.s`, `fsgnjn.s`, `fsgnjx.s`
- **Min/Max**: `fmin.s`, `fmax.s`
- **Classification**: `fclass.s`

### RV32D Extension (Double-Precision Floating-Point)
- **Load/Store**: `fld`, `fsd`
- **Arithmetic**: `fadd.d`, `fsub.d`, `fmul.d`, `fdiv.d`, `fsqrt.d`
- **Fused Multiply-Add**: `fmadd.d`, `fmsub.d`, `fnmsub.d`, `fnmadd.d`
- **Conversion**: `fcvt.w.d`, `fcvt.wu.d`, `fcvt.d.w`, `fcvt.d.wu`, `fcvt.s.d`, `fcvt.d.s`
- **Comparison**: `feq.d`, `flt.d`, `fle.d`
- **Sign Injection**: `fsgnj.d`, `fsgnjn.d`, `fsgnjx.d`
- **Min/Max**: `fmin.d`, `fmax.d`
- **Classification**: `fclass.d`

## How to use

To compile the test programs, run `make` or `make tests`.
Expand Down
Loading