Skip to content
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

Towards complete pulpv3 coverage #5

Open
wants to merge 18 commits into
base: xpulp-dev
Choose a base branch
from

Conversation

phsauter
Copy link

Adds tests that cover almost all instructions in pulpv3 (elw is missing).
This was done as a SoCDAML miniproject in summer 2022.
The entire project consists of changes to:
pulp-platform/riscv-opcodes#8
pulp-platform/riscv-isa-sim#3
pulp-platform/riscv-tests

All are necessary for the goal of having definitions (riscv-opcodes), a reference (riscv-isa-sim) and tests (risv-tests) for the pulpv3 instruction set.

Attached is a slide from the presentation of the project, it shows which instructions were added.
presentation.pdf

phsauter added 18 commits July 26, 2022 17:32
Modified the Makefile to support the new split Xpulpimg extension.
Added the p.cnt instruction (part of bitops) to test the workflow
for adding further instructions.
pulp_test_gen is a Python package written to simplify the process of
creating future tests for (arithmetic) instructions.
It abstracts the assembler macros and provides different classes based
on the type of operands used in the instruction.
In order to use it, one needs to create an inherited class from the
correct type/class, set operand-limits and implement the operation.
Then this new instruction-specific class can be used to manually add
functional tests or generate a number of random tests.
At the end the testflow can be written to an assembler file.

gen_test_p_cnt.py serves as a rather simple example on how to
use the package.
The tests were automatically generated using pulp_test_gen.
All include non-exhaustive checks of some common edge cases and
a few dozen randomly generated tests.
The expected effects of endi, starti, count and counti are tested
directly (they should write to CSR, CSR is read-back to check).

Since setup and setupi immediately start a loop, this is not really
possible. Therefore they are tested by using them in a small loop.
This is not at all exhaustive.
In the future more complicated setups/loops should be added.
Fixes a number of minor mistakes and improperly generated tests
in untested classes of pulp_test_gen
- 1 register + 2 immediate operands (imm12, uimm5, uimm6, simm6)
- 1 register + 2 uimm5 operands where previous value of destination
  register also matters (effectively as if it had 'src3')
Also adds new test-macros of last commit to pulp_test_gen.
The tests were automatically generated using pulp_test_gen.
All include non-exhaustive checks of some common edge cases and
a few dozen randomly generated tests.
The tests were successfully run against the Spike implementation and
some generated assembly tests were manually verified.
This test did not yet run against the Spike implementation because
xpulpbitrev is not an extension in gcc and xgap9 throws an error.

The generated tests are partially verified by hand, additionally the
first three are examples from the docs and they are correct.
I am fairly certain the test is fine.
- Add to test_macro.h
- Add to pulp_test_gen scripts
The tests were automatically generated using pulp_test_gen.
All include non-exhaustive checks of some common edge cases and
a few dozen randomly generated tests.
The tests were automatically generated using pulp_test_gen.
All include non-exhaustive checks of some common edge cases and
a few dozen randomly generated tests.
The tests were automatically generated using pulp_test_gen.
All include non-exhaustive checks of some common edge cases and
a few dozen randomly generated tests.
Added macros to perform zero-reg tests for instructions
with only one source register, previously missing.

Re-generated the instruction-tests to include zero-reg testing.
Makes the scripts a bit less verbose and clearer to read.
The tests were automatically generated using pulp_test_gen.
All include non-exhaustive checks of some common edge cases and
a few dozen randomly generated test.
Old tests for the previously implemented instructions were replaced.
The tests were automatically generated using pulp_test_gen.
All include non-exhaustive checks of some common edge cases and
a few dozen randomly generated tests.
All xpulpimg subsets in xpulpv3 are included in this encoding.h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant