Asynchronous Multiplexer

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
Post Reply
Eketek
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Mon Oct 19, 2015 9:04 pm
Contact:

Asynchronous Multiplexer

Post by Eketek »

Since they're fun and since I like to over-engineer my designs, I built an asynchronous multiplexer. For those less technically inclined, asynchronous multiplexing basically means everything on the network with something to transmit attempts to do so immediately after the network appears to be quiet and, whenever errors occur, re-transmitting and randomly yielding until it successfully transmits. If you want many transmitters but don't intend to have them transmit often, this will run a lot faster than a synchronous multiplexer. Under heavy traffic though, it will run a lot slower.

So, that in mind, this pile of combinators and wires is what I came up with:
async_multiplexer_transmitter.png
async_multiplexer_transmitter.png (930.79 KiB) Viewed 1755 times
The machine has four modes of operation:
Idle - Do nothing until a transmission is requested
Send - Wait for any collisions on the network to resolve, then enter "Contend" mode
Contend - Repeatedly attempt to transmit data
Yield - Temporarily suspend transmission attempts

Machine Components:
Output - Just a wire attached directly to every transmitter and receiver
Input - A wire attached to whatever provides the data (the current value will be what gets sent on a successful transmit and may differ from what it was when the transmission was initiated)
Transmitter - Combinator which pushes the data out
Initiator - Sets the transmitter into send mode if it is not already in send mode.
Memory - Single-entry Memory cells for easily storing "Send", "Contend", and "Yield" states
Repeater - Causes the transmitter to continue attempting to transmit
Finalizer - Detects successful transmission and resets the transmitter (return to Idle mode)
Arbiter - Causes the transmitter to Yield at pseudo-random intervals
Resumer - Cancel Yield state either if every Contending transmitter has Yielded or if any other transmitter has successfully transmitted.

Reserved signals are 'S', 'T', 'I', 'C', 'K', and 'Y'. 'I' is used as the transmitter's Unique ID, 'K' is for the clocK signal, 'T' is used to detect silence and collisions (number of simultaneous transmissions), and 'C' is used to detect network activity. The other two were just me being a lazy designer, letting internal control signals leak into the output. ('S' for Send, 'T' for Transmit, 'I' for Identifier, 'C' for Contend, 'K' for clocK, and 'Y' for Yield).

A unique ID for each transmitter is required and should be included with the input signal. It used the 'I' signal for this. The ID is used to by the arbiter for a pseudo-random backoff sequence that is guaranteed to differ if any pair of IDs within a valid range differ (ID + global clock signal modulo a set prime numbers, in parallel, yielding any time the result is a zero).

Collisions are detected by reading the 'T' signal to determine how many transmitters are attempting to transmit. If the value is one, then it's a valid transmission. Zero is silence. Anything greater than one is a collision.

Transmission within a reasonable time-frame is guaranteed: If the network is busy, all newly requested transmissions will be delayed until after the collision is fully resolved.


Receivers are much simpler: Just a standard component which forwards all valid signals to your signal handler (for convenience, the blueprint receiver includes the Transmitter ID and filters out all other control signals).

A global clock must be attached to the network somewhere. The one in my blueprints only increments during collisions, but a counter which simply increments once per cycle will also work.


Here is the blueprint book containing all three components.

[spoiler=Async Multiplexer v0.1.0]0eNrtXd1uo0YUfhek3rR2xPwAttWuVPmqWvUmzk1UVRa2JwlaDBZga6PKD9D36JP1STrAOv4bmHPGgJ1mbzbC4MN4vvP7zczZv6xZuBarJIiy6SyOv1ijv/afpNboj4PL/F4wj6Py4zR4jvww/yx7XQlrZAWZWFo9K/KX+dVCzIOFSPrzeDkLIj+LE2vbs4JoIb5aI7LtaQX4SZC9LEUWzNUy6PbPniWiLMgCUY6ouHidRuvlTCTyJW+ilmIRrJd9EYp5lkh5qzgU8kWrOJVfjqN8CFJgn/esV/lnsM1HdyKMasZ1Lo3cOTt5PWsRJPLdxV0pSc5hlsThdCZe/E0gvy2/shc7lbcXhag0v/EUJGk2PZusTZBka/nJ27jKJ/qf8ylKRS4jF5Rmfg4cYT0rXonEL8dg/SC/F6+z1Roh+dHaypnJBx+Vv6UYHsn/ScTiEIFAXrnyySCZr4OsuCQ5Ws+JEJH+QfkSmktVPs7OH1fhxeoU8QwsG4fVN5GXAfVolZP5DSE7v1iu/KQY4cj6xQyhXMrqVY5sLQ36KYmX0yCSMqzRkx+mogo/5UzT45mme2AUcA/OHq6A+/xBJX4caby0xnYdtO2yUppz52zbtdbflNZqHxvrTwaq8BllrNTWWJ0HszrX3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Zf+rYNu/C0h7I3nLbSLU6LFXGzavWuFXV0tFrBEWvVa8PnlMcPaOowYlpiUM6LXEmrZU4WKpcy2ggd72fF6/18iqRpKZI0k6RHLeG5BiL5LDZYhVajHKGLH4KlHiXmZpm5fffv/+5dq6G4g255qQKBx474xyHHDtA7lrbLH9uOP1Csnh8gMuNwLmLY1Lu8CtuNr898p5zbBJxcv4LZ4TAYwTcNThG0LKNTZqnzJvdw+TYl5YgFWB4JrHKvSKrQK9ZfgLVvsZIgKwAHxieNXc/zDEojjrnxjlw4s3omA7PH45vPezUhA2wb1O2XzCjM973iZiGMwLNZnY+RJZELk5eJbTYbSPluoO3zQmU4jDB6KC9UM8K/ZmQs2s95NsMl0FWbs3ciCQtKa2BR23uDD3P3fcBsvNxmfUo0rUYIk23GGL7Xd7QQ6NAI6NNba1smWYQ/vylrZ4npWxMKKpvnIBsRUR1bRh0nYqgyNlX2RRbiVwTKUQldBTTnqi+kRDgNF7f3bGoqNN4sBTFMVtbf99HQu6bXFvHmaeGike3NEqXfhj2Q3+5qlxP39YfD3gDp8V9KPL2OhXyVWGcpG+0UE3vHpAy2t0r4/0NnmpT58EX9O3QN9MBBgVy7LY+Rvz2UAe262kwdJ8bVJuT9oG5yvoNRMF7mtP6l3S5sdtqTsM6Qu2hNdQeUKght2UjTelEmHbPt7aPDRBF3hGKV1kFN2iFQVC7HnT9MEhrPW6cjnC7bw23exxuyE5PGtxIQy290JWp2xFun1vDDdc2Vdd3gHAUbpqChXB0Axogbl5HuN1qJzYNLkp7qScw78VcBBsAe0nM2ctzPuNqDdaRfZWv5SE676us8cS4PleaHY1aYhixNcZud9lesxT2yQyXtngmTf8KTQjAtqsHsJRvB14xJCXBO7FxGM+/aD0YVUnpF/+XxF7Ur+lrNJ/+vg6zYBWKr1KBNvYdubPlI74c+0ZMd6s5Fa/b/gfO09Lb[/spoiler]

The components from the blueprint book should be wired up like so:
Async-Multiplexer Test Setup
Disclaimer #1: Special care should be taken when extending the network. The arbiter uses modular arithmetic with prime numbers to desynchronize contending transmitters. If you have more than 5005 transmitters and don't adjust the arbiter (either by using larger primes or by adding extra pulse generators with different primes), it will be unable to desynchronize transmitters with IDs which are separated by the product of all prime numbers used (which would completely lock up the network if any pair of them should generate a collision).

Disclaimer #2: My design was hacked together very quickly from memory, has not been tested thoroughly, and may contain subtle defects which may cause problems which Eketek refuses to be blamed for. Please do not use it to dispatch ambulances... unless it's an emergency.


EDIT: Upon further review, it turned out that the above multiplexer is flawed: I forgot to implement logic to prevent all unyielded transmitters from yielding simultaneously. That slows the network down unnecessarily and causes large collisions to deadlock. Here is a reworked version with the correct logic:
Async Multiplexer v0.2.1

Post Reply

Return to “Combinator Creations”