Open
Description
In riscv_insts_base.sail:311-317 , we have:
function is_aligned(vaddr : xlenbits, width : word_width) -> bool =
match width {
BYTE => true,
HALF => vaddr[0..0] == zeros(),
WORD => vaddr[1..0] == zeros(),
DOUBLE => vaddr[2..0] == zeros(),
}
but in riscv_mem.sail:42-43 , we have:
function is_aligned_addr forall 'n. (addr : xlenbits, width : int('n)) -> bool =
unsigned(addr) % width == 0
Obviously the latter can implement the former, and there is code implementation redundancy between the two, of course we can implement is_aligned using is_aligned(vaddr, width) = is_aligned(vaddr, size_bytes(width))
to avoid somehow different definitions or duplicated definitions