util_mmio: test bitsets with a width of 64bit

ref #1095
This commit is contained in:
Martin Stein 2014-03-13 17:59:36 +01:00 committed by Norman Feske
parent 6476cb3bbd
commit 9a9d093e01

View File

@ -63,11 +63,15 @@ struct Test_mmio : public Mmio
struct Reg_64 : Register<0x00, 64>
{
struct Bits_0 : Bitfield<48,12> { };
struct Bits_0 : Bitfield<48,12> { };
struct Bits_1 : Bitfield<24,20> { };
struct Bits_2 : Bitfield<44,4> { };
struct Bits_2 : Bitfield<44,4> { };
struct Bits_3 : Bitfield<0,24> { };
struct Bits_4 : Bitfield<60,4> { };
};
struct Bitset_64_0 : Bitset_2<Reg_64::Bits_0, Reg_64::Bits_1> { };
struct Bitset_64_1 : Bitset_3<Reg_64::Bits_4, Reg_64::Bits_3, Reg_64::Bits_2> { };
struct Bitset_64 : Bitset_2<Bitset_64_0, Bitset_64_1> { };
struct Reg : Register<0x04, 8>
{
@ -469,6 +473,14 @@ int main()
if (mmio.read<Reg::Bits_2>() != BITS_2) { error(__LINE__); }
if (mmio.read<Reg::Bits_3>() != BITS_3) { error(__LINE__); }
if (compare_mem(mmio_mem, cmp_mem, MMIO_SIZE)) { error(__LINE__); }
/* bitsets */
typedef Test_mmio::Bitset_64 Bitset;
enum { BITSET = 0x4abcdef056789123 };
zero_mem(mmio_mem, MMIO_SIZE);
mmio.write<Bitset>(BITSET);
if (mmio.read<Bitset>() != BITSET) { error(__LINE__); }
if (compare_mem(mmio_mem, cmp_mem, MMIO_SIZE)) { error(__LINE__); }
}
printf("Test done\n");