How does this hardware increment register addresses for 32-bit values only by one via communication bus?

266 views Asked by At

I have a question regarding memory layout in hardware.

I am currently reading the datasheet for the device Ade7978 (Isolated Energy Metering Chipset).
In its register list for communication via I²C or SPI (Table 39, p. 105), it lists the register addresses for all data. Here is an excerpt of the first three numbers:

┌─────────┬─────────┬──────────────────────────────────┬─────────────────────────────────┐
│ Address │ Name    │ Description                      │ Bit Length During Communication │
├─────────┼─────────┼──────────────────────────────────┼─────────────────────────────────┤
│ 0x4380  │ AIGAIN  │ Phase A current gain adjust.     │ 32                              │
│ 0x4381  │ AVGAIN  │ Phase A voltage gain adjust.     │ 32                              │
│ 0x4382  │ AV2GAIN │ Phase A V2P channel gain adjust. │ 32                              │
└─────────┴─────────┴──────────────────────────────────┴─────────────────────────────────┘

How is the value 32 bits long and the address values only grows by 1?
The registers are not directly mapped to memory, how so?
Are they an arbitrary number that just gets decided to be whatever and internally maps to different parts of memory? Is that just put in place so I cannot accidentally access the middle of a 32-bit number or is there a hardware reason?

If you have a general answer, by all means. If you happen to know why the Ade7978 specifically does this, that's good for me as well.
Thanks for your time.

1

There are 1 answers

0
Light On BEST ANSWER

Though it looks different from the common byte address system, actually there's nothing to do between the address assignment and the bit length of data that is pointed to by the address. The data which is accessed is called a 'word'. The serial ports of the ADE7978 can work with 32-, 16-, or 8-bit words. Continuing reading the register table, you'll find different registers that have 32- or 16- or 8-bit length, and still their addresses are incremented by 1.

The register table in a programmer's model is somewhat like this:

ADDR1  :  |-----REGISTER 1-----|
ADDR2  :  |--REGISTER 2--|
ADDR3  :  |-------REGISTER 3-------|

While in the circuit, after the register address decode logic inside the serial port receives a legal register address, it will assert one of those register select signals, and then only enables the corresponding register to be written/read. It's like:

16-BIT_REG_ADDR --+---- =ADDR1? --ENABLE-->  |----16-BIT_REG1----|
                  +---- =ADDR2? --ENABLE-->  |--8-BIT_REG2--|
                  +---- =ADDR3? --ENABLE-->  |--------32-BIT_REG3--------|

Each register is treated (accessed) as a whole, no matter how many bits it has.

Certainly, when using serial ports to access registers with different bit length, the program at the controller side should provide/read the corresponding number of bits with the timing shown in the serial ports operation chart.

In a word, this is an agreement between the design provider and the user. As long as the user is accessing registers in accordance with the manual, there will be no issues.