Scheduler TX Module
Overview
Scheduler_tx is a transmit scheduler that prepares address and payload pairs for the HotRIO master transmit datapath. The module supports two normal transmit modes:
Per-slave payload mode, where each slave has its own payload and valid input.
Single shared payload mode, where the same payload is transmitted to each slave address in a round-robin sequence.
The scheduler also supports a priority broadcast transaction. A broadcast request is latched on a rising edge and is transmitted before the next normal round-robin item when the downstream HotRIO master Tx Module requests new data.
The output interface is request driven. The scheduler only changes
tx_addr_o, tx_payload_o, tx_valid_o, and
tx_is_broadcast_o when next_data_req_i is asserted while the internal
FSM is in the RUN state.
This module provides address and payload to the HotRIO master Tx Module which periodically sends payloads to a configurable set of slave devices. The scheduler hides the address sequencing and payload selection logic from the transmit datapath.
It does the following functionalities :
Polling and addressing multiple slave devices using sequential addresses.
Sending the same command or payload to all slaves in a round-robin manner.
Sending slave-specific payloads after all slave payloads have been captured.
Inserting a broadcast message with priority over normal scheduled traffic.
The module is intended to sit between payload-producing logic and HotRIO Master Tx Module. The later consumes the current output transaction
and then pulses next_data_req_i to request the next transaction.
Detailed portlist
Generics
Name |
Description |
Type |
Default |
|---|---|---|---|
num_slaves_g | choose the number of slave addresses and the number of payload input ports to be generated |
|
|
single_payload_g | choose false if the same payload has to be sent to all the slaves |
|
|
Input signals
IN ports
Name |
Description |
Type |
|---|---|---|
clk_i | tx clock of the pcs |
|
rstn_i | active low reset, synchronous to `clk_i` |
|
en_i | module enable. when not asserted, the fsm is forced to idle and output valid flags are deasserted. |
|
next_data_req_i | request pulse from the hotrio master. |
|
first_slave_addr_i | base address used to generate the internal contiguous slave address table. |
|
addr_update_i | rising-edge controlled request to reload the internal address table |
|
tx_payload_arr_i | array of payload values, one payload per slave index. |
|
tx_payload_valid_arr_i | per-slave valid vector. |
|
shared_payload_i | shared payload input (used when single_payload_g = true) |
|
shared_payload_valid_i | valid signal for shared payload input |
|
broadcast_trigger_i | rising edge trigger to send broadcast packets |
|
broadcast_addr_i | address used for the pending broadcast transaction. |
|
broadcast_payload_i | payload used for the pending broadcast transaction. |
|
Output signals
OUT ports
Name |
Description |
Type |
|---|---|---|
tx_addr_o | scheduled transmit address. |
|
tx_payload_o | scheduled transmit payload. |
|
tx_valid_o | valid output for the the payload and address output |
|
tx_is_broadcast_o | broadcast indication output |
|
Source Dependencies
The design uses the following special packages:
Package |
Purpose |
|---|---|
|
Provides project-specific constants and types such as
|
Generics
Generic |
Type / Range |
Default |
Description |
|---|---|---|---|
|
|
|
Defines the number of slave entries handled by the scheduler. This generic sizes the address table, per-slave payload array, valid vector, and round-robin index range. |
|
|
|
Selects the normal payload scheduling mode. When |
Generic Use Cases
NUM_SLAVES_GUse this generic to scale the scheduler to the number of addressed slave endpoints in the system. For example, if the master must address eight slaves, set
NUM_SLAVES_G => 8. The module then generates eight sequential addresses starting fromfirst_slave_addr_i.The generated address for slave index
iis:slave_addrs_s(i) = first_slave_addr_i + i
SINGLE_PAYLOAD_GUse this generic to choose between two scheduling styles:
FALSE: each slave has a dedicated payload. This is suitable when every slave must receive different data.TRUE: all slaves receive the same payload. This is suitable for common commands, common configuration values, or repeated writes to a contiguous slave range.
Internal Architecture
Reset Behavior
When rstn_i = '0' on a rising clock edge:
fsm_sis set toIDLE.idx_sis reset to0.Per-slave payload registers are cleared.
valid_seen_sis cleared.broadcast_pending_sis cleared.Output registers are cleared and marked invalid.
Edge-detection history registers are cleared.
Enable Behavior
When en_i is not asserted:
The FSM is forced to
IDLE.tx_valid_sis deasserted.tx_is_broadcast_sis deasserted.
The design continues to sample edge-detection history at the end of the clocked process when not in reset. Broadcast latching and per-slave payload capture are evaluated before the enable check.
Address Table Generation
The address table is generated in the LOAD_ADDR state:
FOR i IN 0 TO NUM_SLAVES_G - 1 LOOP
slave_addrs_s(i) <= STD_LOGIC_VECTOR(
unsigned(first_slave_addr_i) + to_unsigned(i, HOTRIO_ADDR_WIDTH_C)
);
END LOOP;
After the table is loaded:
idx_sis reset to0.Outputs are marked invalid.
The FSM advances to
RUN.
Payload Capture
In per-slave payload mode, valid payloads are captured continuously whenever
SINGLE_PAYLOAD_G = FALSE:
IF tx_payload_valid_arr_i(i) = '1' THEN
payload_reg_s(i) <= tx_payload_arr_i(i);
valid_seen_s(i) <= '1';
END IF;
Once a payload has been seen for a slave, its corresponding valid_seen_s bit
remains asserted until reset. The module therefore waits for initial payload
availability from all slaves before transmitting normal per-slave traffic.
Finite State Machine
IDLE State
The IDLE state is the inactive entry point of the scheduler.
Actions performed:
Deasserts
tx_valid_s.Deasserts
tx_is_broadcast_s.Advances to
LOAD_ADDRwhen the module is enabled.
This state ensures that the scheduler does not emit a valid transaction before the address table has been initialized.
LOAD_ADDR State
The LOAD_ADDR state generates the internal address table. Each slave address
is derived from first_slave_addr_i plus the slave index.
Actions performed:
Generates
slave_addrs_s(0)throughslave_addrs_s(NUM_SLAVES_G - 1).Resets
idx_sto0.Deasserts
tx_valid_s.Deasserts
tx_is_broadcast_s.Advances to
RUN.
This state is entered after IDLE and whenever addr_update_i has a rising
edge while the FSM is in RUN.
RUN State
The RUN state is the active scheduling state. In this state, the scheduler
responds to address updates, transmit requests, broadcast requests, and normal
payload availability.
Priority order inside RUN:
Rising edge of
addr_update_i.next_data_req_ifrom the HotRIO Master Tx.Pending broadcast transaction.
Normal round-robin transaction.
Address Update Priority
If addr_update_i has a rising edge, the scheduler:
Moves to
LOAD_ADDR.Deasserts
tx_valid_s.Deasserts
tx_is_broadcast_s.
Address update has priority over both broadcast and normal traffic.
Broadcast Scheduling
A rising edge on broadcast_trigger_i sets broadcast_pending_s. The
pending broadcast is emitted on the next next_data_req_i request while the
FSM is in RUN and no address update is taking priority.
Broadcast output actions:
tx_addr_sis loaded frombroadcast_addr_i.tx_payload_sis loaded frombroadcast_payload_i.tx_valid_sis asserted.tx_is_broadcast_sis asserted.broadcast_pending_sis cleared.
Broadcast traffic does not advance the normal round-robin index.
Per-Slave Payload Scheduling
When SINGLE_PAYLOAD_G = FALSE, normal scheduling uses the internal
payload_reg_s array.
On next_data_req_i = '1':
If
all_valid_s = '1':tx_addr_sis loaded withslave_addrs_s(idx_s).tx_payload_sis loaded withpayload_reg_s(idx_s).tx_valid_sis asserted.tx_is_broadcast_sis deasserted.idx_sadvances to the next slave, wrapping to0after the last slave.
If
all_valid_s = '0':tx_valid_sis deasserted.tx_is_broadcast_sis deasserted.idx_sdoes not advance.
Round-Robin Index Operation
The round-robin index selects the current slave for normal traffic. It advances only after a normal transaction is emitted.
0 -> 1 -> 2 -> ... -> NUM_SLAVES_G - 1 -> 0
The index is reset to 0:
During reset.
When the address table is loaded in
LOAD_ADDR.
The index is not advanced by:
Broadcast transactions.
Invalid shared payload cycles.
Per-slave mode cycles where not all payloads have been seen.
Address update cycles.