Skip to content

Add initial PVM test vectors #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e285daa
Add initial PVM test vectors
koute Jun 24, 2024
19d2ad8
Pre-clobber the output reg in `inst_div_unsigned_with_overflow`
koute Jun 25, 2024
9ba4b5b
Replace underscores with hypens, because ASN.1 doesn't like underscores
koute Jun 25, 2024
e89f6b7
Add JSON Schema and ASN.1 schema
koute Jun 25, 2024
96025c7
Add comments to the ASN.1 schema, reference the paper, update README
koute Jun 25, 2024
1d43b7d
Add the instruction/program counter to the tests
koute Jun 25, 2024
9b35cf4
Correct the expected PC for when the program halts
koute Jun 25, 2024
f4c9f3f
Add tests involving memory
koute Jun 25, 2024
dbbfbd4
Remove accidental `OPTIONAL` from the ASN.1 schema
koute Jun 25, 2024
3e18a7f
Add gas
koute Jun 26, 2024
e267a75
Rename `code` -> `program`
koute Jun 26, 2024
5581280
Fix some typos in the ASN.1 schema
koute Jun 26, 2024
a2b1870
Align reg3 serialization with the GP and add extra testcases
koute Jun 28, 2024
0a4c99b
PVM tests v0.2: add 'invalid' to disassemblies to mark implicit traps
koute Oct 4, 2024
8659541
PVM tests v0.2: bitmask paddings are now filled with zeros
koute Oct 4, 2024
fb4de8a
PVM tests v0.2: `inst_rem_signed`: make output non-zero
koute Oct 4, 2024
fa6cf0a
PVM tests v0.2: `inst_rem_signed_with_overflow`: non-zero initial val…
koute Oct 4, 2024
83596b5
PVM tests v0.2: `inst_set_*`: non-zero initial value of output reg
koute Oct 4, 2024
51e134e
PVM tests v0.2: add more load/store tests
koute Oct 4, 2024
30ba85a
PVM tests v0.2: update README
koute Oct 4, 2024
a54d7cf
PVM tests v0.3: remove tests which expose gas precharging
koute Oct 10, 2024
bf3c81a
PVM tests v0.4
koute Jan 24, 2025
cd85648
PVM tests v0.4: remove read-only panicking tests
koute Jan 27, 2025
e231523
PVM tests v0.4: remove `inst_load_u8_nok` and `inst_store_u8_trap_ina…
koute Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 26 additions & 0 deletions pvm/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
The `programs/riscv_*` test files are licensed under the following terms:

Copyright (c) 2012-2015, The Regents of the University of California (Regents).
All Rights Reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the Regents nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
78 changes: 78 additions & 0 deletions pvm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# PVM Test Vectors, version 0.4

## How to use this

The [`programs`](./programs) directory contains `.json` files, each containing a single test.

These are meant to test the PVM function Ψ from the Graypaper's Appendix A (equation 203 from v0.2.1 of the paper).

See [schema.asn](./schema.asn) for a human-readable schema of what each of the fields mean.

See [schema.json](./schema.json) for a JSON Schema.

See [TESTCASES.md](./TESTCASES.md) for a human-readable index of all of the test cases.

## TODO

* 100% instruction coverage
* Tests for abnormal skip values for each instruction type
* Tests involving host calls
* Tests for invalid/malformed program blobs
* More gas metering tests; proper gas cost model (current one is a placeholder)

## Changelog

### v0.4

* The tests now target 64-bit PVM, in alignment with GP 0.5.4.
* The `trap` exit status is now called `panic` to align with the GP.
* Added new exit status: `page-fault`; tests which previously panicked when accessing unpaged memory now generate page faults.
* Added 106 new tests from the [RISC-V test suite](https://github.com/riscv-software-src/riscv-tests) transpiled into PVM.

### v0.3

* Removed tests which were testing gas behavior that is not yet described in the GP:
- `inst_load_u8_trap`
- `inst_store_u8_trap_inaccessible`
- `inst_store_u8_trap_read_only`

### v0.2

* Bitmask paddings are now filled with zeros, in alignment with the GP.
* Disassemblies now end with an `invalid` instruction to signify places where
the execution traps when going out of bounds. This is a purely cosmetic change
to the reference disassemblies and doesn't affect the test vectors themselves.
* The `inst_rem_signed` test was changed to make the output value non-zero.
(The behavior is unchanged; the instruction still works the same as before.)
* Set the initial value of the output register to a non-zero for the following tests:
(The behavior is unchanged; the instructions still work the same as before.)
- `inst_rem_signed_with_overflow`
- `inst_set_greater_than_signed_imm_0`
- `inst_set_greater_than_unsigned_imm_0`,
- `inst_set_less_than_signed_0`
- `inst_set_less_than_signed_imm_0`
- `inst_set_less_than_unsigned_0`,
- `inst_set_less_than_unsigned_imm_0`
* Add new tests:
- `inst_load_i16`
- `inst_load_i8`
- `inst_load_imm_and_jump`
- `inst_load_indirect_i16_with_offset`
- `inst_load_indirect_i16_without_offset`
- `inst_load_indirect_i8_with_offset`
- `inst_load_indirect_i8_without_offset`
- `inst_load_indirect_u16_with_offset`
- `inst_load_indirect_u16_without_offset`
- `inst_load_indirect_u32_with_offset`
- `inst_load_indirect_u32_without_offset`
- `inst_load_indirect_u8_with_offset`
- `inst_load_indirect_u8_without_offset`
- `inst_load_u16`
- `inst_load_u32`
- `inst_store_imm_u16`
- `inst_store_imm_u32`
- `inst_store_imm_u8`

### v0.1

* Initial test vectors.
Loading