Skip to content

Commit c36d038

Browse files
committed
fix: csrs test fixes
1 parent 7166f84 commit c36d038

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

backends/cpp_hart_gen/cpp/include/udb/bits.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,10 @@ namespace udb {
694694
}
695695
}
696696

697+
constexpr std::conditional_t<Signed, SignedStorageType, const StorageType &> get_ignore_unknown() const {
698+
return m_val;
699+
}
700+
697701
constexpr const _Bits& to_defined() const { return *this; }
698702

699703
// cast to other Bits types
@@ -3467,7 +3471,7 @@ struct fmt::formatter<BitsClass<N, Signed>>
34673471
: formatter<typename BitsClass<N, Signed>::StorageType> {
34683472
template <typename CONTEXT_TYPE>
34693473
auto format(BitsClass<N, Signed> value, CONTEXT_TYPE &ctx) const {
3470-
return fmt::formatter<typename BitsClass<N, Signed>::StorageType>::format(value.get(), ctx);
3474+
return fmt::formatter<typename BitsClass<N, Signed>::StorageType>::format(value.get_ignore_unknown(), ctx);
34713475
}
34723476
};
34733477

backends/cpp_hart_gen/templates/csrs.hxx.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ namespace udb {
254254
} else {
255255
udb_assert(xlen == 64_b, "Bad xlen");
256256
<%-
257-
field_cpp = fields_for_xlen32.map do |field|
257+
field_cpp = fields_for_xlen64.map do |field|
258258
if field.dynamic_location?
259259
"((m_#{field.name}._hw_read() & 0x#{((1 << field.location(64).size) - 1).to_s(16)}_b).template widening_sll<#{field.location(64).begin}>())"
260260
else

spec/std/isa/csr/sstatus.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fields:
3333
UXL:
3434
location: 33-32
3535
base: 64
36-
alias: mstatus.MXR
36+
alias: mstatus.UXL
3737
description: |
3838
*U-mode XLEN*
3939

0 commit comments

Comments
 (0)