Hello Martin,
Truth be told, I didn't want to probe the use of an object myself. But, if I want to create an array of registers that can be iteratively called, it saves a lot of effort as opposed to manually writing register by register. Since write <..> involves explicit 'register_name' here. I'm not sure (or I may not know how) if I can create an array of Mmio::Register's since declaration to Register necessitates an offset and access width.
Normally, my initial attempt was to create an array of addresses that pointed to the starting address of the registers. This gives us random access and ability to put R/W accesses in a loop. But it is very primitive and does not use the access_t concept.
But then, as you've said I looked into Register_array a bit deeper. Here is an approach I've thought of.
Define all registers with offset values. Then, define a Register_array, say R_array that has an offset to the first defined register, number of items = number of registers. This works given the registers in between are all of the same size (obviously). If there are N registers defined, then write<R_array>(value, idx) should write to the ith register defined, right? Not necessarily.
Consider this.