extends htif for 32bit systems

This commit is contained in:
Eyck Jentzsch 2025-02-13 13:39:47 +01:00
parent f4718c6de3
commit 9f5326c110
3 changed files with 12 additions and 6 deletions

View File

@ -1072,9 +1072,11 @@ iss::status riscv_hart_m_p<BASE, FEAT, LOGCAT>::write_mem(phys_addr_t paddr, uns
if(paddr.val == tohost) {
reg_t cur_data = *reinterpret_cast<const reg_t*>(data);
// Extract Device (bits 63:56)
uint8_t device = traits<BASE>::XLEN == 32 ? 0 : (cur_data >> 56) & 0xFF;
uint8_t device = traits<BASE>::XLEN == 32 ? *reinterpret_cast<uint32_t*>(p.data() + ((tohost + 4) & mem.page_addr_mask)) >> 24
: (cur_data >> 56) & 0xFF;
// Extract Command (bits 55:48)
uint8_t command = traits<BASE>::XLEN == 32 ? 0 : (cur_data >> 48) & 0xFF;
uint8_t command = traits<BASE>::XLEN == 32 ? *reinterpret_cast<uint32_t*>(p.data() + ((tohost + 4) & mem.page_addr_mask)) >> 16
: (cur_data >> 48) & 0xFF;
// Extract payload (bits 47:0)
uint64_t payload_addr = cur_data & 0xFFFFFFFFFFFFULL;
if(payload_addr & 1) {

View File

@ -1001,9 +1001,11 @@ template <typename BASE> iss::status riscv_hart_msu_vp<BASE>::write_mem(phys_add
if(paddr.val == tohost) {
reg_t cur_data = *reinterpret_cast<const reg_t*>(data);
// Extract Device (bits 63:56)
uint8_t device = traits<BASE>::XLEN == 32 ? 0 : (cur_data >> 56) & 0xFF;
uint8_t device = traits<BASE>::XLEN == 32 ? *reinterpret_cast<uint32_t*>(p.data() + ((tohost + 4) & mem.page_addr_mask)) >> 24
: (cur_data >> 56) & 0xFF;
// Extract Command (bits 55:48)
uint8_t command = traits<BASE>::XLEN == 32 ? 0 : (cur_data >> 48) & 0xFF;
uint8_t command = traits<BASE>::XLEN == 32 ? *reinterpret_cast<uint32_t*>(p.data() + ((tohost + 4) & mem.page_addr_mask)) >> 16
: (cur_data >> 48) & 0xFF;
// Extract payload (bits 47:0)
uint64_t payload_addr = cur_data & 0xFFFFFFFFFFFFULL;
if(payload_addr & 1) {

View File

@ -1293,9 +1293,11 @@ iss::status riscv_hart_mu_p<BASE, FEAT, LOGCAT>::write_mem(phys_addr_t paddr, un
if(paddr.val == tohost) {
reg_t cur_data = *reinterpret_cast<const reg_t*>(data);
// Extract Device (bits 63:56)
uint8_t device = traits<BASE>::XLEN == 32 ? 0 : (cur_data >> 56) & 0xFF;
uint8_t device = traits<BASE>::XLEN == 32 ? *reinterpret_cast<uint32_t*>(p.data() + ((tohost + 4) & mem.page_addr_mask)) >> 24
: (cur_data >> 56) & 0xFF;
// Extract Command (bits 55:48)
uint8_t command = traits<BASE>::XLEN == 32 ? 0 : (cur_data >> 48) & 0xFF;
uint8_t command = traits<BASE>::XLEN == 32 ? *reinterpret_cast<uint32_t*>(p.data() + ((tohost + 4) & mem.page_addr_mask)) >> 16
: (cur_data >> 48) & 0xFF;
// Extract payload (bits 47:0)
uint64_t payload_addr = cur_data & 0xFFFFFFFFFFFFULL;
if(payload_addr & 1) {