diff options
author | Marcus Comstedt <marcus@mc.pp.se> | 2020-10-17 13:40:01 +0200 |
---|---|---|
committer | Marcus Comstedt <marcus@mc.pp.se> | 2020-11-07 15:34:19 +0100 |
commit | 8e3bcb2eef7f195a9cd61f5b79c1e67a0c3c28ff (patch) | |
tree | 191a89f0adab760eddfd0cf4a3e6ee11fbfd1b0f /fesvr/memif.h | |
parent | ec2fd09fdbb7b7b490cacdc3818ca237f9f28593 (diff) | |
download | spike-8e3bcb2eef7f195a9cd61f5b79c1e67a0c3c28ff.zip spike-8e3bcb2eef7f195a9cd61f5b79c1e67a0c3c28ff.tar.gz spike-8e3bcb2eef7f195a9cd61f5b79c1e67a0c3c28ff.tar.bz2 |
Tag target endian values to help guide conversion code
Diffstat (limited to 'fesvr/memif.h')
-rw-r--r-- | fesvr/memif.h | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/fesvr/memif.h b/fesvr/memif.h index aaa9f05..001c425 100644 --- a/fesvr/memif.h +++ b/fesvr/memif.h @@ -5,6 +5,7 @@ #include <stdint.h> #include <stddef.h> +#include "byteorder.h" typedef uint64_t reg_t; typedef int64_t sreg_t; @@ -43,28 +44,28 @@ public: virtual void write(addr_t addr, size_t len, const void* bytes); // read and write 8-bit words - virtual uint8_t read_uint8(addr_t addr); - virtual int8_t read_int8(addr_t addr); - virtual void write_uint8(addr_t addr, uint8_t val); - virtual void write_int8(addr_t addr, int8_t val); + virtual target_endian<uint8_t> read_uint8(addr_t addr); + virtual target_endian<int8_t> read_int8(addr_t addr); + virtual void write_uint8(addr_t addr, target_endian<uint8_t> val); + virtual void write_int8(addr_t addr, target_endian<int8_t> val); // read and write 16-bit words - virtual uint16_t read_uint16(addr_t addr); - virtual int16_t read_int16(addr_t addr); - virtual void write_uint16(addr_t addr, uint16_t val); - virtual void write_int16(addr_t addr, int16_t val); + virtual target_endian<uint16_t> read_uint16(addr_t addr); + virtual target_endian<int16_t> read_int16(addr_t addr); + virtual void write_uint16(addr_t addr, target_endian<uint16_t> val); + virtual void write_int16(addr_t addr, target_endian<int16_t> val); // read and write 32-bit words - virtual uint32_t read_uint32(addr_t addr); - virtual int32_t read_int32(addr_t addr); - virtual void write_uint32(addr_t addr, uint32_t val); - virtual void write_int32(addr_t addr, int32_t val); + virtual target_endian<uint32_t> read_uint32(addr_t addr); + virtual target_endian<int32_t> read_int32(addr_t addr); + virtual void write_uint32(addr_t addr, target_endian<uint32_t> val); + virtual void write_int32(addr_t addr, target_endian<int32_t> val); // read and write 64-bit words - virtual uint64_t read_uint64(addr_t addr); - virtual int64_t read_int64(addr_t addr); - virtual void write_uint64(addr_t addr, uint64_t val); - virtual void write_int64(addr_t addr, int64_t val); + virtual target_endian<uint64_t> read_uint64(addr_t addr); + virtual target_endian<int64_t> read_int64(addr_t addr); + virtual void write_uint64(addr_t addr, target_endian<uint64_t> val); + virtual void write_int64(addr_t addr, target_endian<int64_t> val); // endianness virtual void set_target_endianness(memif_endianness_t endianness) { |