Skip to content

Commit

Permalink
Merge pull request #1559 from ved-rivos/bext
Browse files Browse the repository at this point in the history
Add B extension
  • Loading branch information
aswaterman authored Jan 10, 2024
2 parents d6f622e + 075af7f commit de24759
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions disasm/isa_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ isa_parser_t::isa_parser_t(const char* str, const char *priv)
extension_table[EXT_INTERNAL_ZFH_MOVE] = true;
}

if (extension_table['B']) {
extension_table[EXT_ZBA] = true;
extension_table[EXT_ZBB] = true;
extension_table[EXT_ZBS] = true;
}

if (extension_table['C']) {
extension_table[EXT_ZCA] = true;
if (extension_table['F'] && max_xlen == 32)
Expand Down
7 changes: 6 additions & 1 deletion riscv/csrs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,9 +622,10 @@ bool sstatus_csr_t::enabled(const reg_t which) {
misa_csr_t::misa_csr_t(processor_t* const proc, const reg_t addr, const reg_t max_isa):
basic_csr_t(proc, addr, max_isa),
max_isa(max_isa),
write_mask(max_isa & (0 // allow MAFDQCHV bits in MISA to be modified
write_mask(max_isa & (0 // allow MABFDQCHV bits in MISA to be modified
| (1L << ('M' - 'A'))
| (1L << ('A' - 'A'))
| (1L << ('B' - 'A'))
| (1L << ('F' - 'A'))
| (1L << ('D' - 'A'))
| (1L << ('Q' - 'A'))
Expand Down Expand Up @@ -666,6 +667,10 @@ bool misa_csr_t::unlogged_write(const reg_t val) noexcept {
proc->set_extension_enable(EXT_ZVFH, (new_misa & (1L << ('V' - 'A'))) && proc->extension_enabled(EXT_ZFHMIN));
proc->set_extension_enable(EXT_ZVFHMIN, new_misa & (1L << ('V' - 'A')));

proc->set_extension_enable(EXT_ZBA, (new_misa & (1L << ('B' - 'A'))) || !proc->get_isa().extension_enabled('B'));
proc->set_extension_enable(EXT_ZBB, (new_misa & (1L << ('B' - 'A'))) || !proc->get_isa().extension_enabled('B'));
proc->set_extension_enable(EXT_ZBS, (new_misa & (1L << ('B' - 'A'))) || !proc->get_isa().extension_enabled('B'));

// update the hypervisor-only bits in MEDELEG and other CSRs
if (!new_h && prev_h) {
reg_t hypervisor_exceptions = 0
Expand Down

0 comments on commit de24759

Please sign in to comment.