Skip to content

Commit

Permalink
Implement the TODOs in the Harvard Architecture PR (#711)
Browse files Browse the repository at this point in the history
In the [Harvard Architecture
PR](#688) we left a few TODOs.
Here we make good on them.

There's a few things happening in this PR:

- We remove the fake instruction `EANY`. `EANY` was only ever an
artifact of Risc0's incredible 'interesting' approach to decoding. We
use the real instructions `ECALL` and `EBREAK` instead.

- Remove `AUIPC` and `LUI`. Both of them are now implemented as
pseudo-instructions, that translate to `ADDI` during decoding.

- Use the same library as SP1 for RiscV decoding, instead of
copy-and-pasting-and-editing Risc0's 'interesting' decoder. That
simplifies our code, and comes with a lot more tests than we ever had.
Both because of explicit tests in the library, and because of the usage
in SP1 and other projects. This gets rid of much error prone bit
manipulating code.

- Use `struct Instruction` throughout the code when handling and testing
instructions, instead of `u32`. That makes specifying tests a lot
simpler and more readable. No more
`0b_000000001010_00000_000_00001_0010011, // addi x1, x0, 10` in the
code.

- Remove the notion of executable vs non-executable ROM. This is only
necessary for a von-Neumann architecture: everything that's in our
instruction-cache is meant to be executable already. (We can
re-implement this restriction later by controlling what is allowed to
make it into the instruction cache when we eg decode the ELF. But it's
unnecessary: we already honour the executable flag for memory sections
in the ELF.)
  • Loading branch information
matthiasgoergens authored Dec 13, 2024
1 parent 027f7b0 commit b58ef82
Show file tree
Hide file tree
Showing 36 changed files with 959 additions and 1,360 deletions.
75 changes: 75 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ceno_emul/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ elf = "0.7"
itertools.workspace = true
num-derive.workspace = true
num-traits.workspace = true
rrs_lib = { package = "rrs-succinct", version = "0.1.0" }
strum.workspace = true
strum_macros.workspace = true
tracing.workspace = true
Expand Down
Loading

0 comments on commit b58ef82

Please sign in to comment.