rvemu

RISC-V RV32I execution engine
git clone git://mcdim.xyz/revemu.git
Log | Files | Refs

mem.h (308B)


      1 #ifndef MEMORY_H
      2 #define MEMORY_H
      3 
      4 static inline uint32_t
      5 load_u32_le(uint8_t *mem, uint32_t index)
      6 {
      7 	uint32_t inst = 0;
      8 	inst |= (uint32_t)(mem[index+0]) << 0;
      9 	inst |= (uint32_t)(mem[index+1]) << 8;
     10 	inst |= (uint32_t)(mem[index+2]) << 16;
     11 	inst |= (uint32_t)(mem[index+3]) << 24;
     12 	return inst;
     13 }
     14 
     15 #endif