AVSBus Controller

1. Overview

The AVSBus Controller is a hardware IP that implements the AVSBus 1.3.1 specification for adaptive voltage scaling communication. It acts as a controller (master) that communicates with a single AVS target device (slave) to manage voltage rails, monitor power conditions, and perform real-time voltage adjustments for optimal performance and energy efficiency. This version supports 32-bit frame-based communication without multi-target addressing.

2. Description and Features

  • Single-Target Support: Communicates with a single AVS target device through a two-wire protocol interface

  • AXI4-Lite Register Interface: A 32-bit AXI4-Lite port, bridged internally to the APB4 register file

  • Command FIFO: 8-deep command queue, crossing from the register clock domain to the AVS clock domain

  • Readback FIFO: 8-deep response buffer with automatic hardware retry on a failed acknowledgment or a bad CRC

  • Flexible Clock Configuration: AVS clock generated from either the register clock or a reference clock, with a programmable divider and duty cycle

  • Maskable Interrupts: Nine sources covering FIFO overruns, retry exhaustion, an unresponsive target and target-signalled interrupts

  • Slave Resync Operation: Automatic periodic resynchronization at a configurable interval, or forced by software

  • CRC-3 Protection: Hardware generation on every command and checking on every response

3. Architecture

The AVSBus Controller implements an Adaptive Voltage Scaling Bus (AVSBus) 1.3.1 controller for dynamic voltage and frequency scaling (DVFS) in single-target systems, communicating with one AVS target device over a two-wire protocol interface.

The design is a register file, a pair of asynchronous FIFOs that carry commands and responses between the register and AVS clock domains, a protocol FSM that serializes and deserializes subframes, a CRC-3 engine shared between transmit and receive, and the AVS clock generation logic.

Figure 1 shows the FIFO, protocol-engine, and clock-generation paths. The two clock-domain boxes hold the logic clocked by clk_reg_i and by the generated avs_clk; the FIFOs and synchronizers that straddle the gap between them carry every crossing. The clock generation is drawn in full in Figure 3, and the protocol FSM in Figure 2.

AVSBus controller with the AXI-Lite to APB bridge, register file and interrupts in the register clock domain, command and readback FIFOs and synchronizers crossing to the AVS clock domain, the protocol FSM and CRC-3 engines, and the AVS clock generation and output clock gate
Figure 1. AVSBus controller block diagram

3.1. AVS Protocol Engine

Software queues commands by writing AVS_CMD, which pushes a 32-bit word into the command FIFO. The protocol FSM pops each command, prepends the fixed preamble, appends a calculated CRC-3, and shifts the resulting 32-bit subframe out on avs_mdata_o. The target’s reply arrives one subframe later: it is shifted in from avs_sdata_i during the 32 cycles that carry the next command, checked for a valid frame bit and a good CRC, and pushed into the readback FIFO.

Retries are automatic. A slave acknowledgment of 1 (resource unavailable) or 2 (bad CRC) causes the master to resend the command, up to AVS_CFG_0.MAX_RETRIES times after the original attempt. If the last retry also fails, the failing response is delivered to software and MAX_RETRIES_ATTEMPTED_INT is raised. Setting MAX_RETRIES to 0 suppresses both the retries and that interrupt; the failing response is delivered to software instead. A reply whose frame valid bit is set means the target did not respond at all and raises SLAVE_UNRESPONSIVE_INT. There is no separate programmable response timeout.

The master also issues periodic slave resync operations. The FSM stays in AVS_SLAVE_RESYNC for 35 avs_clk cycles, while its resync counter runs from 0 to 34, and holds avs_mdata_o high throughout. avs_mdata_o is also high in the cycles around that state, through idle or the receive half of a retry beforehand and through the launch cycle afterwards, so the high period on the pin is longer than the resync state itself.

AVS_CFG_0.RESYNC_INTERVAL is the number of clk_reg_i cycles the register domain counts, from when it observes the end of the previous resync, before it requests the next one. AVS_CFG_1.FORCE_SLAVE_RESYNC_OPERATION requests one immediately. Either request is registered in the clk_reg_i domain and crosses into the AVS domain through a three-stage avs_clk synchronizer. The master stops launching new commands once it sees the request, and starts the resync from idle after the frame in flight and its reply complete.

3.2. Clock Generation and Management

Table 1 identifies the register, reference, and generated AVS clocks.

Table 1. AVSBus clock sources
Clock Source Description

clk_reg_i

Register interface clock, synchronous with register access

clk_ref_i

Reference clock, independent of AVS bus timing

Selection

Software-configurable via AVS_CFG_1.AVS_CLOCK_SELECT

The selected source passes through an anti-glitch mux and then a programmable divider, whose ratio and duty cycle are both 8-bit values in AVS_CFG_1. Out of reset the controller runs on clk_ref_i divided by 4 at a 50% duty cycle. Both divider fields reset to 0, which is a sentinel: the divider keeps its hardware defaults until software writes a non-zero value.

Changing the clock configuration is not glitch-free on its own. Set AVS_CFG_1.TURN_OFF_ALL_PREMUX_CLOCKS to gate both source clocks before changing the source selection or the divider settings, then clear it afterwards.

Power is saved at two levels: AVS_CFG_1.STOP_AVS_CLOCK_ON_IDLE gates the AVS clock whenever the bus is idle, and TURN_OFF_ALL_PREMUX_CLOCKS gates the clocks entering the mux. Restarting a gated AVS clock always begins with a slave resync.

3.3. CRC Verification Engine

The avsbus_crc3 module computes a 3-bit CRC combinationally over a 32-bit subframe. Two instances are used. The generate instance is fed the outgoing master subframe with its CRC field zeroed, and its output becomes the three bits shifted out last. The check instance is fed the received slave subframe intact, including the CRC the target sent, and reports a good check when the result is zero. A failed check prevents the subframe from updating AVS_LATEST_SLAVE_SUBFRAME and AVS_SLAVE_STATUS, and the retry logic resends the command.

3.4. Command and Response FIFO System

Table 2 compares the command and readback FIFO roles and operation.

Table 2. AVSBus command and readback FIFOs
FIFO Command FIFO Readback FIFO

Depth

COMMAND_FIFO_DEPTH, 8 entries by default

READBACK_FIFO_DEPTH, 8 entries by default

Direction

Register clock domain to AVS clock domain

AVS clock domain to register clock domain

Occupancy

AVS_FIFOS_STATUS.CMD_FIFO_*

AVS_FIFOS_STATUS.READBACK_FIFO_*

Overrun behaviour

A write to AVS_CMD when full is dropped, completes with an error response and raises CMD_FIFO_OVERFLOW_INT

A response received when full is dropped and raises READBACK_OVERFLOW_INT

Both are instances of avsbus_async_fifo, which requires a power-of-two depth. Pointers cross between the two clock domains as Gray codes through three-stage synchronizers.

While the readback FIFO is full the master launches no further commands, but replies to commands already launched are still pushed as they arrive. A reply that meets a full FIFO is dropped and raises READBACK_OVERFLOW_INT, so a software reader that stops draining AVS_READBACK stalls new commands and can lose the responses to commands already on the bus.

3.5. Reset and Initialization

The controller takes three resets. rst_clk_div_ni resets the programmable clock divider, rst_reg_ni resets the register file and the protocol logic, and rst_ref_ni resets the clk_ref_i leg of the anti-glitch clock mux.

rst_clk_div_ni must be deasserted before rst_reg_ni. The divider has to be producing a clock before the logic it feeds leaves reset, otherwise the AVS clock domain never starts.

Because the divider defaults to divide-by-4 on clk_ref_i and the protocol FSM starts as soon as reset is released, the controller begins issuing slave resync operations without any software configuration. Configuration is therefore a matter of adjusting defaults rather than enabling the block. The AVSBus configuration sequence is in the Programmer’s Guide.

3.6. Data Flow and Control Path

3.6.1. Command Path

  1. Software writes AVS_CMD; the 32-bit word enters the command FIFO. If the FIFO is full, the write is dropped and completes with an error response.

  2. The protocol FSM pops a command, builds the master subframe as preamble, AVS_CMD[29:3] and CRC-3, and shifts it out on avs_mdata_o.

  3. The target’s reply shifts in on avs_sdata_i during the following subframe.

  4. A reply that is valid and passes CRC updates AVS_SLAVE_STATUS and AVS_LATEST_SLAVE_SUBFRAME and is pushed into the readback FIFO; otherwise the retry logic resends the command.

  5. Software reads AVS_READBACK, which pops the readback FIFO.

A dropped write also raises CMD_FIFO_OVERFLOW_INT. AVS_NORMAL_STATUS.CMD_FIFO_FULL and AVS_FIFOS_STATUS.CMD_FIFO_VACANT_SLOTS report the command FIFO’s space.

3.6.2. Response Inspection

AVS_READBACK is the normal path and advances the FIFO on every read that finds it non-empty; a read of an empty FIFO returns 0 with an error response. AVS_DEBUG_READBACK mirrors the top of the FIFO without advancing it, and reads 0xFFFFFFFF when the FIFO is empty. AVS_LATEST_SLAVE_SUBFRAME holds the most recent valid subframe regardless of FIFO state, which is what to read when the question is what the target is doing now rather than what it said several commands ago.

3.7. Clock Domain Architecture

Two domains carry functional logic. The register domain, clocked by clk_reg_i, holds the AXI4-Lite bridge, the register file, the command FIFO write side, the readback FIFO read side and interrupt generation. The AVS domain, clocked by the generated avs_clk, holds the protocol FSM, the shift registers and the CRC engines. avs_clock_o is avs_clk after the idle clock gate, so the FSM keeps running while STOP_AVS_CLOCK_ON_IDLE holds the pin clock stopped.

FIFO pointers cross between the domains as Gray codes. Individual control and status bits cross through prim_sync3 three-stage synchronizers, and pulses through prim_sync3_pulse. The reset synchronizers are six stages deep and take their scan bypass from scan_rst_ni.

3.8. Protocol State Machine

cur_state_debug_o exposes the FSM state as a 17-bit one-hot vector, resynchronized to clk_reg_i. The states, in bit order from 0, are (Table 3).

Table 3. AVSBus protocol state encodings
Bit State Meaning

0

AVS_RESET

Out of reset, before the first resync

1

AVS_SLAVE_RESYNC

Holding avs_mdata_o high for 35 cycles while the resync counter runs from 0 to 34

2

AVS_LAUNCH_FRAME_POST_RESYNC

First command launch after a resync

3

AVS_IDLE

No command queued; the AVS clock may be gated

4, 5

AVS_SHIFT_1ST_SUBFRAME, AVS_END_1ST_SUBFRAME

First subframe after idle or resync, launching a command

6, 7

AVS_SHIFT_MID_SUBFRAME, AVS_END_MID_SUBFRAME

Transmitting one command while receiving the reply to the previous one

8, 9

AVS_SHIFT_LAST_SUBFRAME, AVS_END_LAST_SUBFRAME

Final subframe, draining the last reply with no new command to send

10-15

AVS_RETRY_*

The same shift and end pairs used while retrying a failed command, split into transmit-and-receive, transmit-only and receive-only variants

16

AVS_PROCESS_PREVIOUS_SDATA

Evaluating a received subframe

Command transmission and response reception overlap: the reply to a command arrives during the subframe that carries the next command, which is why the mid-subframe states do both at once.

Figure 2 shows the transitions between these states, grouping the 17 states into 11 boxes. Each subframe box stands for a SHIFT state, which holds for the 32 bits of a subframe, and the END state that follows it, where the transition is decided; the three retry boxes pair the six AVS_RETRY_* states the same way. The figure omits the self-loops of states that wait: idle, the resync and each SHIFT state. Resync done means that the resync counter has reached 34. RDY means that a command is waiting, the readback FIFO has room and no resync is due. Stop on idle is AVS_CFG_1.STOP_AVS_CLOCK_ON_IDLE: with it set, a command waiting in idle restarts the AVS clock through a resync instead of launching directly. A retry transition is taken when the received subframe has a bad CRC, a resource-unavailable or bad-CRC acknowledgment, or no response, and MAX_RETRIES is above zero; with MAX_RETRIES at zero the RDY and not-RDY transitions apply instead. A reply that arrives during a retry of the preceding command is held and processed after the retries finish. Every retry sequence ends with a slave resync.

AVSBus protocol state machine from reset through slave resync, idle and the first, middle and last subframes, with the retry transmit, transmit-and-receive and receive states and the held-reply processing state returning to the slave resync
Figure 2. AVSBus protocol state machine

3.9. Error Handling and Diagnostics

Table 4 describes the controller response to each error condition.

Table 4. AVSBus error handling
Condition Handling

Bad CRC from the target

Automatic retry, up to AVS_CFG_0.MAX_RETRIES

Resource unavailable acknowledgment

Automatic retry, up to AVS_CFG_0.MAX_RETRIES

Bad data, data type or selector acknowledgment

No retry; the response is delivered to software

Retry budget exhausted

MAX_RETRIES_ATTEMPTED_INT once the last of MAX_RETRIES retries also fails, and the failing response is delivered to software; not raised while MAX_RETRIES is 0. AVS_NORMAL_STATUS.TOTAL_RETRIES counts every retry attempted

Target not responding

SLAVE_UNRESPONSIVE_INT

Command FIFO overrun

Write dropped with an error response, CMD_FIFO_OVERFLOW_INT

Readback FIFO overrun

Response dropped, READBACK_OVERFLOW_INT

Read of an empty readback FIFO

Returns 0 with an error response, READBACK_UNDERFLOW_INT

For diagnosis, AVS_NORMAL_STATUS reports bus idle, resync, retry-in-progress and FIFO states; AVS_FIFOS_STATUS reports occupied and vacant slots in both FIFOs; AVS_SLAVE_STATUS and AVS_LATEST_SLAVE_SUBFRAME report the target’s most recent acknowledgment and status response; and cur_state_debug_o exposes the FSM state to the surrounding system.

4. Interface

The AVSBus Controller presents an AXI4-Lite register interface, a two-wire AVSBus protocol interface, and clock, reset, interrupt and DFT interfaces for system integration. The register file itself is APB4; the controller contains an axi_lite_to_apb bridge, so APB4 is not exposed at the module boundary.

The parameters and ports of avsbus_controller are listed in avsbus_controller.

4.1. AVSBus Frame Format

Both subframes are 32 bits: 29 bits of payload followed by a 3-bit CRC. The master subframe carries a fixed 2’b01 preamble in its two most significant bits; the remaining fields occupy the same bit positions as the AVS_CMD register, so software writes a command in wire order.

Table 5 defines the fields transmitted in a master subframe.

Table 5. AVSBus Master Subframe
Field Name Bit Range Width Description

Preamble

[31:30]

2

Fixed 2’b01, inserted by hardware

Command Type

[29:28]

2

AVS_CMD.R_OR_W: 0 = commit write, 1 = hold write, 2 = reserved, 3 = read

Command Group

[27]

1

AVS_CMD.CMD_GRP: 0 = standard, 1 = manufacturer-specific

Command Code

[26:23]

4

AVS_CMD.CMD_CODE, see Table 6

Rail Select

[22:19]

4

AVS_CMD.RAIL_SEL: rail index, 0xF = broadcast

Command Data

[18:3]

16

AVS_CMD.CMD_DATA; 0xFFFF for read commands

CRC-3

[2:0]

3

Calculated by hardware over bits [31:3]

Table 6 lists the command-group-zero data types, resolutions, and access modes.

Table 6. AVSBus Command Codes (Command Group 0)
Code Data Type Resolution Description

0x0

Target Rail Voltage

1 mV

16-bit unsigned, read or write

0x1

Vout Transition Rate

1 mV/us

MSByte rise rate, LSByte fall rate

0x2

Rail Current

10 mA

16-bit unsigned, read only

0x3

Temperature

0.1 degC

16-bit signed, read only

0x4

Force Voltage Reset

N/A

Requires a command data field of 0x0000

0x5

Power Mode

N/A

3 bits, LSB aligned: 0x0 maximum efficiency, 0x3 maximum power, 0x4-0x7 manufacturer-specific

0xE

AVSBus Status

N/A

16 bits, encoded per the AVS specification

0xF

AVSBus Version

N/A

4 bits, LSB aligned, read only

With command group 1 the command code is manufacturer-specific and Table 7 above does not apply.

Table 7. AVSBus Slave Subframe
Field Name Bit Range Width Description

Slave Acknowledgment

[31:30]

2

0 = action performed, 1 = good CRC but resource unavailable, 2 = bad CRC received, 3 = good CRC but bad data, data type or selector. Codes 1 and 2 trigger a hardware retry

Frame Valid

[29]

1

0 in a valid frame. A 1 means the target did not respond and raises SLAVE_UNRESPONSIVE_INT

Status Response

[28:24]

5

Per the AVS specification: bit 4 VDone, bit 3 StatusAlert, bit 2 AVS_Control, bits 1-0 manufacturer-specific

Response Data

[23:8]

16

Read data; 0xFFFF when the master issued a write

Reserved

[7:3]

5

Reserved

CRC-3

[2:0]

3

CRC received from the target, checked by hardware

A received subframe reaches software by two paths. It is pushed into the readback FIFO and read out of AVS_READBACK, which pops the FIFO, or inspected without popping through AVS_DEBUG_READBACK. Independently of the FIFO, a subframe whose frame valid bit is 0 and whose CRC checks also latches into AVS_LATEST_SLAVE_SUBFRAME and AVS_SLAVE_STATUS, so the current target status is visible without waiting for the FIFO to drain.

4.2. Clock Architecture

The AVS clock is derived from one of two sources, optionally divided, and optionally gated while the bus is idle.

AVS_CFG_1.AVS_CLOCK_SELECT[1:0] selects both the source and whether the divider is used: bit 1 picks the source (0 = clk_reg_i, 1 = clk_ref_i) and bit 0 picks the divider (0 = bypass, 1 = divided). The reset value is 2’b11, so the controller comes up on a divided clk_ref_i.

Figure 3 shows the clock path. Each source passes a clock gate that TURN_OFF_ALL_PREMUX_CLOCKS closes, then the anti-glitch mux u_refclk_apbclk_mux selects one of them, choosing clk_ref_i while in reset. The test mux substitutes clk_test_i in test mode. Inside u_clk_div, the glitch-free post-divider mux selects either the undivided clock or the divider output. The result, avs_clk, clocks the AVS domain and reaches avs_clock_o through u_avs_bus_clkgate, which the protocol FSM closes while the bus is idle if STOP_AVS_CLOCK_ON_IDLE is set. Each mux passes its input 0 when its select is 0. Table 8 lists the four settings.

clk_reg_i and clk_ref_i through their clock gates into the anti-glitch source mux, the test mux for clk_test_i, the programmable divider with its bypass and post-divider mux, and the AVS clock gate driving avs_clock_o
Figure 3. AVSBus clock selection
Table 8. AVS_CLOCK_SELECT settings
AVS_CLOCK_SELECT Source mux Post-divider mux AVS clock

2’b00

0

0, bypass

clk_reg_i

2’b01

0

1, divided

clk_reg_i divided by CLK_DIVIDER_VALUE

2’b10

1

0, bypass

clk_ref_i

2’b11 (reset)

1

1, divided

clk_ref_i divided by CLK_DIVIDER_VALUE, by 4 until software writes a non-zero value

Table 9 defines the source-selection and divider configuration fields.

Table 9. AVS Clock Configuration Fields
Field Reset Description

AVS_CFG_1.AVS_CLOCK_SELECT[1:0]

0x3

Clock source and divider bypass

AVS_CFG_1.CLK_DIVIDER_VALUE[23:16]

0x0

Division ratio. A value below 2 is treated as 2. The reset value 0 is a sentinel that leaves the divider at its hardware default of 4

AVS_CFG_1.CLK_DIVIDER_DUTY_CYCLE_NUMERATOR[31:24]

0x0

High-pulse fraction in 1/256 units, so 128 is 50%. A 50% duty cycle is only reachable with an even divider. The reset value 0 is a sentinel that leaves the numerator at its hardware default of 0x80

AVS_CFG_1.STOP_AVS_CLOCK_ON_IDLE[8]

0x0

Gate the AVS clock while the bus is idle. The master issues a slave resync whenever the clock restarts

AVS_CFG_1.TURN_OFF_ALL_PREMUX_CLOCKS[10]

0x0

Gate both clocks feeding the source mux

Gate the clocks with TURN_OFF_ALL_PREMUX_CLOCKS before changing AVS_CLOCK_SELECT, CLK_DIVIDER_VALUE or CLK_DIVIDER_DUTY_CYCLE_NUMERATOR, then release the gate afterwards.

While test_en_i is high the source and divider-bypass muxes ignore AVS_CLOCK_SELECT, and clk_test_i drives the AVS clock directly.

4.3. Reset Architecture

Table 10 identifies the logic reset by each AVSBus reset input.

Table 10. AVSBus Reset Domains
Reset Scope

rst_clk_div_ni

The programmable clock divider

rst_reg_ni

The register file, the protocol FSM and the reset synchronizers for the register, pre-divider and AVS clock domains

rst_ref_ni

The clk_ref_i leg of the anti-glitch source mux

rst_clk_div_ni must be deasserted before rst_reg_ni. The divider has to be producing a clock before the logic it feeds leaves reset, otherwise the AVS clock domain never starts.

4.4. Interrupt Interface

interrupt_o is a level output, asserted while any AVS_INTERRUPT bit is set and its corresponding AVS_INTERRUPT_MASK bit is clear.

Table 11 maps AVS_INTERRUPT bits to the events that set them.

Table 11. AVSBus Interrupt Sources
Bit Field Raised when

8

READBACK_OVERFLOW_INT

A target response was dropped because the readback FIFO was full

7

READBACK_UNDERFLOW_INT

AVS_READBACK was read while the readback FIFO was empty; the read returned 0 with an error response

6

CMD_FIFO_OVERFLOW_INT

AVS_CMD was written while the command FIFO was full, so the command was dropped and the write completed with an error response

5

MAX_RETRIES_ATTEMPTED_INT

A command still failed after AVS_CFG_0.MAX_RETRIES retries, MAX_RETRIES + 1 attempts in all. Never raised while MAX_RETRIES is 0

4

SLAVE_UNRESPONSIVE_INT

The target did not drive a valid subframe

3

READBACK_HAS_DATA_INT

The readback FIFO holds data for software

2

READBACK_FIFO_FULL_INT

The readback FIFO is full; no further commands launch until it drains

1

CMD_FIFO_FULL_INT

The command FIFO is full

0

AVS_SLAVE_ISSUED_INTERRUPT

The target signalled an interrupt

AVS_INTERRUPT_MASK is a disable mask and every bit resets to 1, so all sources are masked after reset and software must clear a bit to enable that source. Interrupt bits are cleared by writing 1 to the matching bit of AVS_INTERRUPT_CLEAR; those bits self-clear.

4.5. Pad Enable Interface

AVS_CONFIG.AVS_GPIO_ENABLE drives avs_gpio_enable_o, which enables the pads carrying the AVSBus signals: output enable for the avs_clock and avs_mdata pins and input enable for the avs_sdata pin. It resets to 1, because the protocol FSM begins running as soon as reset is deasserted.

4.6. Timing

Table 12 summarises the subframe and clock timing.

Table 12. AVSBus Protocol Timing
Parameter Value

Subframe length

32 avs_clock_o cycles

Slave resync

35 avs_clk cycles in AVS_SLAVE_RESYNC with avs_mdata_o held high; the pin stays high for longer, through the cycles around that state

Minimum AVS clock division

2, when the divider is selected

Resync interval

AVS_CFG_0.RESYNC_INTERVAL clk_reg_i cycles, counted from when the register domain observes the end of the previous resync, plus one clk_reg_i cycle to register the request, three avs_clk cycles to synchronize it, and the time for any frame in flight to complete

The resync counts are avs_clk cycles at the protocol FSM’s state register. Pin-level setup, hold and propagation figures are a function of the implementation and are not specified by this IP.

4.7. Integration Example

The register port takes the AXI4-Lite structs from avsbus_controller_pkg.

avsbus_controller #(
    .COMMAND_FIFO_DEPTH  (8),
    .READBACK_FIFO_DEPTH (8)
) u_avs_ctrl (
    // Clocks and resets
    .clk_reg_i      (reg_clk),
    .clk_ref_i      (ref_clk),
    .rst_ref_ni     (ref_rst_n),
    .rst_reg_ni     (reg_rst_n),
    .rst_clk_div_ni (clk_div_rst_n),  // deassert before rst_reg_ni

    // AVSBus interface
    .avs_sdata_i       (avs_sdata),
    .avs_mdata_o       (avs_mdata),
    .avs_clock_o       (avs_clock),
    .avs_gpio_enable_o (avs_pad_enable),

    // AXI4-Lite register interface
    .axil_req_i  (avs_axil_req),
    .axil_resp_o (avs_axil_resp),

    .interrupt_o (avs_irq),

    // DFT
    .scan_rst_ni (scan_rst_n),
    .test_en_i   (test_en),
    .clk_test_i  (test_clk),

    .cur_state_debug_o (avs_fsm_state)
);

5. Memory Map and Register Reference

5.1. Memory Map

The AVSBus Controller occupies a 128-byte address space (0x00-0x7F) reached through its AXI4-Lite port. The register map holds the command and readback FIFO windows, status registers for monitoring the bus and the target, interrupt status, mask and clear registers, and configuration registers for the clock, the retry budget and the resync interval.

5.1.1. Address Alignment and Access Requirements

All registers are 32 bits wide and aligned to a 4-byte boundary. The highest allocated offset is 0x58; offsets 0x5C through 0x7F are unallocated and reserved.

The controller decodes only the low 7 address bits, so the integrating address decoder is responsible for confining the block to its 128-byte window. The SMC memory map states how the SMC answers an access outside it.

Stored registers honour byte strobes, so a partial write updates only the addressed byte lanes. The two FIFO windows do not:

  • AVS_CMD ignores write strobes and pushes the whole 32-bit write data word into the command FIFO, so it must be written with a single full-width access. A partial write enqueues a malformed command.

  • AVS_READBACK pops the readback FIFO on any read, whatever the access width, so it must be read exactly once per response. AVS_DEBUG_READBACK returns the same data without popping.

Neither FIFO window back-pressures the bus; both report a failed access instead. A write to AVS_CMD while the command FIFO is full is dropped, and a read of AVS_READBACK while the readback FIFO is empty returns 0 without popping. Each case raises its interrupt and completes the access with an error response, so software can detect the condition from the bus response alone. An all-zero word is also a well-formed target response, so the read data does not identify an empty read; only the error response or READBACK_UNDERFLOW_INT does. AVS_DEBUG_READBACK reads 0xFFFFFFFF when the FIFO is empty and never errors, which makes it the safer register to poll.

5.2. Detailed Register Map

AVSBus Controller Address Map

Command, readback, status, and interrupt registers for the AVSBus (V1.3.1) controller.

Register List:

Table 13. AVSBus Controller Address Map register list
AddressNameAccessDescription
0x0AVS_CMDWThe command+data to be transferred to the AVS bus
0x4AVS_READBACKRResponse data from AVS slave device (updated in response to both AVS read and write commands). Reading
this register causes the AVS response readback fifo pointer to advance.
0x8AVS_DEBUG_READBACKRThis register mirrors the AVS_READBACK register, but reading it does NOT affect the
AVS readback fifo pointer. Provided for debug purposes.
0xCAVS_LATEST_SLAVE_SUBFRAMERThis register contains the most recently received subframe from the AVS slave, bypassing the
AVS readback fifo. It is provided so that APB can see the current slave StatusResponse and SlaveAck
settings in a timely fashion, since the status data from the next entry in the readback fifo might
have considerable latency relative to when it was initially received from the AVS Slave.
0x20AVS_NORMAL_STATUSRVarious Status bits indicating normal operating conditions for APB2AVS bridge block.
These all have corresponding maskable bits in the AVS_INTERRUPT register
0x24AVS_SLAVE_STATUSRContains the most recent status feedback from the AVS slave device
0x28AVS_FIFOS_STATUSRContains the number of occupied and vacant slots in the AVS master's command and readback FIFOs
0x30AVS_INTERRUPTRInterrupt register - A '1' indicates an interrupt has occurred for that bit. To clear the
interrupt bit, write to the corresponding field in the AVS_INTERRUPT_CLEAR register.
0x34AVS_INTERRUPT_MASKRWInterrupt mask register - Determines which AVS_INTERRUPT bits can trigger an interrupt
0x38AVS_INTERRUPT_CLEARWWrite 1 to clear corresponding interrupt bit
0x50AVS_CFG_0RWConfiguration register for APB2AVS bridge block
0x54AVS_CFG_1RWConfiguration register for APB2AVS bridge block
0x58AVS_CONFIGRWAVS Configuration Register

Register Details:

AVS_CMD

Table 14. avsbus_controller.AVS_CMD fields
BitsFieldAccessResetDescription
31:30Reserved--Reserved
29:28R_OR_WW0x0Read or write type: [list]
[*]0x0 - Commit Write
[*]0x1 - Hold Write
[*]0x2 - Reserved
[*]0x3 - Read
[/list]
27CMD_GRPW0x0Command group:
Set to 1 for manufacturer-specific Command Code (cmd_code), otherwise 0
26:23CMD_CODEW0x0Command Code (For cmd_group=0. For cmd_group=1, this is manufacturer-specific): [list]
[*]0x0 - Target Rail Voltage Read/Write
[*]0x1 - Vout Transition Rate Read/Write
[*]0x2 - Rail Current Read
[*]0x3 - Temperature Read
[*]0x4 - Force Voltage Reset (Requires wr_cmd_data=0x0)
[*]0x5 - Power Mode Read/Write
[*]0xe - AVSBus Status Read/Write
[*]0xf - AVSBus Version Read
[/list]
22:19RAIL_SELW0x0Rail Select:
0x0 - Rail 0
0x1 - Rail 1
0xf - Broadcast
18:3CMD_DATAW0x0Write Cmd Data. Formats: [list]
[*]Voltage (cmd_code 0x0): 16-bit unsigned int, 1LSB=1mV
[*]Transition Rate (cmd_code 0x1): [list]
[*]MSByte: Rise Rate, 8-bit unsigned int, 1LSB=1mV/us
[*]LSByte: Fall Rate, 8-bit unsigned int, 1LSB=1mV/us [/list]
[*]Reset Voltage (cmd_code 0x4): 16-bits, all zeroes
[*]Power Mode (cmd_code 0x5): 3-bits, LSB aligned: [list]
[*]0x0 - Maximum Efficiency
[*]0x3 - Maximum Power
[*]0x4-0x7 - Manufacturer-specific [/list]
[*]AVSBus Status (cmd_code 0xe): 16-bits, encoded per AVS Spec
[*]AVSBus Version (cmd_code 0xf): 4 bits encoded per AVS Spec, LSB-aligned
[*]For read cmd_code's, this is 0xffff
[/list]
2:0Reserved--Reserved

AVS_READBACK

Table 15. avsbus_controller.AVS_READBACK fields
BitsFieldAccessResetDescription
31:30SLAVE_ACKR RMOD0x0Indicates whether command executed or not - codes 0x1 and 0x2 trigger automatic retries by hardware: [list]
[*]0x0: Action Performed
[*]0x1: Good CRC received but resource unavailable - hardware will retry
[*]0x2: Bad CRC received - hardware will retry
[*]0x3: Good CRC received but bad data, data type or selector - no hardware retry
[/list]
29CONST0R RMOD0x0Always 0
28:24STATUS_RESPONSER RMOD0x05-bit field indicating general condition of the slave, per AVS spec StatusReponse field: [list]
[*]bit 4: VDone - AND of all VDone bits of active rails
[*]bit 3: StatusAlert - Indicates potential status issue, requiring AVSBus Status read cmd for details
[*]bit 2: AVS_Control - 1 if ABSBus is controlling at least 1 device output, 0 otherwise.
[*]bit 1: MfrSpcfc_Stts1 - Manufacturer-specific
[*]bit 0: MfrSpcfc_Stts2 - Manufacturer-specific
[/list]
23:8CMD_DATAR RMOD0x0Read Cmd Data. Format depends on cmd_code in previous master subframe:[list]
[*]Voltage (cmd_code 0x0): 16-bit unsigned int, 1LSB=1mV
[*]Transition Rate (cmd_code 0x1): [list]
[*]MSByte: Rise Rate, 8-bit unsigned int, 1LSB=1mV/us
[*]LSByte: Fall Rate, 8-bit unsigned int, 1LSB=1mV/us [/list]
[*]Current (cmd_mode 0x2): 16-bit unsigned, 1LSB=10mA
[*]Temperature (cmd_code 0x3): 16-bit signed, 1LSB=0.1degC
[*]Power Mode (cmd_code 0x5): 3-bits, LSB aligned: [list]
[*]0x0 - Maximum Efficiency
[*]0x3 - Maximum Power
[*]0x4-0x7 - Manufacturer-specific [/list]
[*]AVSBus Status (cmd_code 0xe): 16-bits, encoded per AVS Spec
[*]AVSBus Version (cmd_code 0xf): 4 bits encoded per AVS Spec, LSB-aligned
[*]If master issued a write (rw!=0x3) in previous master subframe, this field is 0xffff
[/list]
7:3Reserved--Reserved
2:0CRCR RMOD0x0The CRC-3 code received from slave

AVS_DEBUG_READBACK

Table 16. avsbus_controller.AVS_DEBUG_READBACK fields
BitsFieldAccessResetDescription
31:0AVS_SLAVE_SUBFRAMER0xFFFFFFFFThe current top-of-fifo AVS slave response sub-frame in the readback fifo

AVS_LATEST_SLAVE_SUBFRAME

Table 17. avsbus_controller.AVS_LATEST_SLAVE_SUBFRAME fields
BitsFieldAccessResetDescription
31:0AVS_SLAVE_SUBFRAMER0xFFFFThe most recently received AVS slave response sub-frame

AVS_NORMAL_STATUS

Table 18. avsbus_controller.AVS_NORMAL_STATUS fields
BitsFieldAccessResetDescription
31:23Reserved--Reserved
22AVS_SLAVE_IS_IN_RESYNCR0x0Indicates that the AVS master is issuing a slave resync operation (35 AVS clock cycles of holding mdata high)
21AVS_BUS_IS_IDLER0x0Indicates that neither AVS master nor slave is currently driving a transaction on the AVS bus
20READBACK_HAS_DATAR0x0Indicates AVS_READBACK register has data ready to read on APB
19READBACK_FIFO_FULLR0x0Indicates read-back fifo is full - no new AVS commands will be launched until
space is freed by an AVS_READBACK access
18CMD_FIFO_FULLR0x0Indicates AVS_CMD fifo is full - any additional APB writes to AVS_CMD will be dropped until
the AVS bus can accept the next command, thus freeing space in the cmd fifo
17CMD_FIFO_EMPTYR0x0Indicates AVS_CMD fifo is empty
16AVS_MASTER_IS_RETRYINGR0x0Master is currently in the middle of retrying a failed command
15:0TOTAL_RETRIESR0x0Total number of retries attempted by the AVS Master

AVS_SLAVE_STATUS

Table 19. avsbus_controller.AVS_SLAVE_STATUS fields
BitsFieldAccessResetDescription
31:18Reserved--Reserved
17:16AVS_SLAVE_ACKR0x0The SlaveAck bits of the most recent slave subframe received: [list]
[*]00: Action Performed
[*]01:Good CRC received by resource unavailable. No action performed (triggers retry)
[*]10: Bad CRC received (triggers retry)
[*]11: Good CRC received bit bad data, data type, or selector. No action performed
[/list]
15:5Reserved--Reserved
4:0AVS_SLAVE_STATUS_RESPONSER0x0The 5-bit Slave StatusResponse of the most recent slave subframe received, indicating the
general condition of the slave, per AVS spec StatusReponse field: [list]
[*]bit 4: VDone - AND of all VDone bits of active rails
[*]bit 3: StatusAlert - Indicates potential status issue, requiring AVSBus Status read cmd for details
[*]bit 2: AVS_Control - 1 if ABSBus is controlling at least 1 device output, 0 otherwise.
[*]bit 1: MfrSpcfc_Stts1 - Manufacturer-specific
[*]bit 0: MfrSpcfc_Stts2 - Manufacturer-specific
[/list]

AVS_FIFOS_STATUS

Table 20. avsbus_controller.AVS_FIFOS_STATUS fields
BitsFieldAccessResetDescription
31:28Reserved--Reserved
27:24READBACK_FIFO_VACANT_SLOTSR0x8Number of vacant slots in the readback FIFO
23:20Reserved--Reserved
19:16READBACK_FIFO_OCCUPIED_SLOTSR0x0Number of occupied slots in the readback FIFO
15:12Reserved--Reserved
11:8CMD_FIFO_VACANT_SLOTSR0x8Number of vacant slots in the command FIFO
7:4Reserved--Reserved
3:0CMD_FIFO_OCCUPIED_SLOTSR0x0Number of occupied slots in the command FIFO

AVS_INTERRUPT

Table 21. avsbus_controller.AVS_INTERRUPT fields
BitsFieldAccessResetDescription
31:9Reserved--Reserved
8READBACK_OVERFLOW_INTR0x0Indicates that the response from AVS slave could not be written to readback FIFO due to it being
full => response was dropped
7READBACK_UNDERFLOW_INTR0x0Indicates that an APB read on the AVS_READBACK reg occurred when the readback fifo
was empty (AVS_NORMAL_STATUS:readback_has_data=0)
6CMD_FIFO_OVERFLOW_INTR0x0Indicates that an APB write to AVS_CMD was attempted when the the command fifo was already
full - the command is dropped
5MAX_RETRIES_ATTEMPTED_INTR0x0Indicates that the AVS Master failed to receive a non-failure acknowledgement from the Slave after a command was retried the maximum allowable number of times (as determined by AVS_CFG_0:max_retries)
4SLAVE_UNRESPONSIVE_INTR0x0Indicates the AVS Slave device is not responding to command subframes from the Master
3READBACK_HAS_DATA_INTR0x0Indicates AVS_READBACK register has data ready to read on APB
2READBACK_FIFO_FULL_INTR0x0Indicates read-back fifo is full - no new AVS commands will be launched until
space is freed by an AVS_READBACK access
1CMD_FIFO_FULL_INTR0x0Indicates AVS_CMD fifo is full - any additional APB writes to AVS_CMD will be dropped until
the AVS bus can accept the next command, thus freeing space in the cmd fifo
0AVS_SLAVE_ISSUED_INTERRUPTR0x0Indicates the AVS slave has signaled an interrupt

AVS_INTERRUPT_MASK

Table 22. avsbus_controller.AVS_INTERRUPT_MASK fields
BitsFieldAccessResetDescription
31:9Reserved--Reserved
8DISABLE_READBACK_OVERFLOW_INTRW0x1Disable readback_overflow interrupt
7DISABLE_READBACK_UNDERFLOW_INTRW0x1Disable readback_underflow interrupt
6DISABLE_CMD_FIFO_OVERFLOW_INTRW0x1Disable cmd_fifo_overflow interrupt
5DISABLE_MAX_RETRIES_ATTEMPTED_INTRW0x1Disable max_retries_attempted interrupt
4DISABLE_SLAVE_UNRESPONSIVE_INTRW0x1Disable slave_unresponsive interrupt
3DISABLE_READBACK_HAS_DATA_INTRW0x1Disable readback_has_data interrupt
2DISABLE_READBACK_FIFO_FULL_INTRW0x1Disable readback_fifo_full interrupt
1DISABLE_CMD_FIFO_FULL_INTRW0x1Disable cmd_fifo_full interrupt
0DISABLE_AVS_SLAVE_ISSUED_INTERRUPTRW0x1Disable notification of AVS slave interrupt

AVS_INTERRUPT_CLEAR

Table 23. avsbus_controller.AVS_INTERRUPT_CLEAR fields
BitsFieldAccessResetDescription
31:9Reserved--Reserved
8CLEAR_READBACK_OVERFLOW_INTW 1P0x0Clear readback_overflow interrupt
7CLEAR_READBACK_UNDERFLOW_INTW 1P0x0Clear readback_underflow interrupt
6CLEAR_CMD_FIFO_OVERFLOW_INTW 1P0x0Clear cmd_fifo_overflow interrupt
5CLEAR_MAX_RETRIES_ATTEMPTED_INTW 1P0x0Clear max_retries_attempted interrupt
4CLEAR_SLAVE_UNRESPONSIVE_INTW 1P0x0Clear slave_unresponsive interrupt
3CLEAR_READBACK_HAS_DATA_INTW 1P0x0Clear readback_has_data interrupt
2CLEAR_READBACK_FIFO_FULL_INTW 1P0x0Clear readback_fifo_full interrupt
1CLEAR_CMD_FIFO_FULL_INTW 1P0x0Clear cmd_fifo_full interrupt
0CLEAR_AVS_SLAVE_ISSUED_INTERRUPTW 1P0x0Clear avs_slave_issued_interrupt

AVS_CFG_0

Table 24. avsbus_controller.AVS_CFG_0 fields
BitsFieldAccessResetDescription
31:24Reserved--Reserved
23:16MAX_RETRIESRW0x5Maximum number of retries, after the original attempt, if an AVS command returns a fail
status (either due to targeted resource being busy or CRC failure). A value of 0 disables
retries and MAX_RETRIES_ATTEMPTED_INT.
15:0RESYNC_INTERVALRW0x1000Interval between periodic slave resync operations on the AVS bus, in APB clock cycles counted from the end of the previous resync. The resulting request then crosses a 3-stage AVS clock synchronizer, and the resync starts once any frame in flight has completed.

AVS_CFG_1

Table 25. avsbus_controller.AVS_CFG_1 fields
BitsFieldAccessResetDescription
31:24CLK_DIVIDER_DUTY_CYCLE_NUMERATORRW0x0Determines the desired duty cycle of the divided clock (when avs_clock_select is set to select the divided APB clock or refclk clock).
This value will be divided by 256 to determine the high-pulse percentage of the divided clock period. Depending on the clk_divider_value,
it may not be possible to precisely achieve the desired duty cycle - in that case, the closest possible fit is used. If this is set to 0,
a value of 1 will be assumed. This is set to 0 by default to trick the clock divider into maintaining the HW-default settings (numerator=0x80)
by matching the FF default in the resynced version of the signal.
23:16CLK_DIVIDER_VALUERW0x0Determines the divisor value used to generate the AVS clock (when avs_clock_select is set to select the divided APB clock or divided refclk clock).
The duty cycle of the divided clock depends both on the clk_divider_value together with the clk_divider_duty_cycle_numerator value. A 50%
duty cycle is only possible on even clk_divider_values with clk_divider_duty_cycle_numerator set to 128. This field requires a minimum value of
2 - for lower values, 2 will be assumed. This is set to 0 by default to trick the clock divider into maintaining the HW-default settings
(divider=0x4) by matching the FF default in the resynced version of the signal.
15:11Reserved--Reserved
10TURN_OFF_ALL_PREMUX_CLOCKSRW0x0Gate off all clocks entering the AVS clock mux - do this before changing the mux selection or changing the clock divider settings, then turn back on afterwards
9FORCE_SLAVE_RESYNC_OPERATIONRW 1P0x0Force master to issue a slave resync (35 AVS clock cycles of holding the mdata signal high) at the next possible opportunity. The request crosses a 3-stage AVS clock synchronizer before the master sees it.
8STOP_AVS_CLOCK_ON_IDLERW0x0When the AVS bus is idle, gate the avs_clock from running. Restart it when there are new commands to be run.
The master always issues a slave resync first when the clock restarts.
7:2Reserved--Reserved
1:0AVS_CLOCK_SELECTRW0x3Selects which clock to use for AVS Clock: [list]
[*] 00: Use the APB clock directly as the AVS clock
[*] 01: Use a divided version of APB clock as the AVS Clock. The clock divider settings are determined by AVS_CFG_1:clk_divider_value and AVS_CFG_1:clk_divider_duty_cycle_numerator
[*] 10: Use the refclk clock directly as the AVS clock
[*] 11: Use a divided version of refclk clock as the AVS Clock. The clock divider settings are determined by AVS_CFG_1:clk_divider_value and AVS_CFG_1:clk_divider_duty_cycle_numerator
[/list]

AVS_CONFIG

Table 26. avsbus_controller.AVS_CONFIG fields
BitsFieldAccessResetDescription
31:1Reserved--Reserved
0AVS_GPIO_ENABLERW0x1Enable AVSBus connection to GPIOs. The effective sets OE of the GPIOs dedicated to
avs_clock and avs_cdata to 1, sets IE of GPIO dedicated to avs_tdata to 1. By default,
this is enabled as the AVSBus state machine immediately starts after reset deassertion.