-
Notifications
You must be signed in to change notification settings - Fork 29
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
Add B extension (Zba, Zbb, Zbs) #29
base: main
Are you sure you want to change the base?
Conversation
- Update `insn_shimm` and `insn_alu` to support unsigned words (`uwmode`). This is used when the result is of width XLEN but the lower 32 bits from one of the inputs (rs1) is zero-extended. - Update `isa_propagate` to match multi-letter extensions e.g. `Zba`. - Add Zba instructions and the beginnings of the rest of the B extension.
- Add B-type format. - Implement (most) Zbb instructions. - Add `insnt_count` and `insn_ext` for bit count and extension instructions. - Be unconvinced that the count checks will work as intended. - Be confused about `orc_b` and `rev8` instructions and leave them commented out for now.
Everything but `clz` `ctz` and `cpop` should work.
CLZ, CTZ, CPOP, ORC.B, and REV8.
Having the csr_spec option enables CSR testing, including the misa CSR which uses the define `RISCV_FORMAL_CSR_MISA`. If the CSR_MISA flag is defined then instructions from extensions will check the misa CSR includes the bit flag for the instruction. We don't want that, since NERV misa is all zeros.
isa_propagate_pair("rv32i"+ext, "rv32ib") | ||
isa_propagate_pair("rv64i"+ext, "rv64ib") | ||
isa_propagate_pair("rv32ib", "rv64ib") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to generate all variants of extensions here, you can do something like:
isa_suffixes = [
("m", []),
("c", []),
("b", ["Zba", "Zbb", "Zbs"])
]
for suffix, sub_suffixes in isa_suffixes:
for sub_suffix in sub_suffixes:
isa_propagate_pair("rv32i" + sub_suffix, "rv32i" + suffix)
isa_propagate_pair("rv64i" + sub_suffix, "rv64i" + suffix)
def propagate_isas(parts=isa_suffixes, suffix=""):
if not parts:
isa_propagate(suffix)
else:
propagate_isas(parts[1:], suffix)
propagate_isas(parts[1:], suffix + parts[0][0])
for part in parts[0][1]:
propagate_isas(parts[1:], suffix + part)
propagate_isas()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was thinking about this too. I think for a generic "any combination of extensions" it would be better to generate them during the core testing setup, rather than producing a file for each and every combination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the advantage of having each variation is that it makes it easier to use them in a testbench outside of the genchecks.py setup, like https://github.com/YosysHQ/riscv-formal/blob/7793823fe3c281205093b1c5ac7a3aa772f5e223/cores/picorv32/complete.sby
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spun this out as a new issue #35 so I can resolve (read: ignore) it here :)
Includes updated NERV demonstrator.