Skip to main content

Demultiplexer

Inputs: i1
Controls: c1...cN where N is defined by numPorts
Outputs: o1...oN where N is defined by numPorts

A Demultiplexer is an operator that routes its incoming data through its possible output ports. The choice of the output port is controlled by the messages received through its control ports.

The Demultiplexer operator holds a message buffer on i1 and c1...cN respectivily. A message received on i1 with time tnt_n will be routed through ok if a message with time tnt_n and value 1 is recieved on ck and a message with time tnt_n and value 0 is received on all controls different that ck. A message received on i1 with time tnt_n will be dropped if a message with time tnt_n and value 0 is recieved on all of the control ports c1...cN respectively. It is important to notice that a Demultiplexer operator expects instructions on the control ports for all messages received on i1.

1kN1 \leq k \leq N

Parameters

id: The id of the operator.

numPorts: The number of output ports through which data will be routed. Default value: 1. Minimum value: 1.

Usage

import { Program, Demultiplexer } from "@rtbot-dev/rtbot";

const id = "id";
const numPorts = 2;

const program = new Program();
program.addOperator(new Demultiplexer(id, numPorts));