Crates.io | xbar |
lib.rs | xbar |
version | 1.0.1 |
source | src |
created_at | 2019-04-22 19:34:44.465599 |
updated_at | 2019-04-22 19:40:45.962379 |
description | An iterator-based implementation of the locality-preserving one-sided binary tree - crossbar switch wiring design algorithm. |
homepage | |
repository | https://github.com/kubuzetto/xbar |
max_upload_size | |
id | 129517 |
size | 912,278 |
Rust implementation of the algorithm described in the conference paper "A locality preserving one-sided binary tree - crossbar switch wiring design algorithm" published in 2015 49th Annual Conference on Information Sciences and Systems (CISS).
One-sided crossbar switches allow for a simple implementation of complete
K_n
graphs. However, designing these circuits is a cumbersome process and can be automated. We present an algorithm that allows designing automatic one-sided binary tree - crossbar switches which do not exceedfloor(n/2)
columns, and achievesK_n
graph without connecting any wires between any three adjacent blocks, thus preserving locality in connections.
I had previously implemented this algorithm in Java. The original paper simply proves that the output can be fit into floor(n/2)
columns, but does not provide a way to 'pack' connections into that many columns. In the Java code, the part that handles the packing is quite dirty and was not suitable for iterator-based implementations. I spent some time on how to implement packing efficiently for this implementation and managed to boil down the entire thing into very simple and elegant mathematical expressions.
Algorithms like this used to be useful in circuit switching. Frankly, I don't think that this crate will be used by anyone in 2019 and beyond.
extern crate xbar;
use xbar::Crossbar as X;
pub fn main() {
let n = 5;
println!("Crossbar for {} terminals has {} rows, \
formed into {} blocks; and {} columns",
n, X::rows(n), X::blocks(n), X::columns(n));
println!("Connections of the crossbar:");
for con in X::new(n) {
println!("{:#?}", con);
}
}
produces the output:
Crossbar for 5 terminals has 20 rows, formed into 4 blocks; and 2 columns
Connections of the crossbar:
Connection {
start: Position {
block_idx: 0,
row_idx: 0,
abs_idx: 0
},
end: Position {
block_idx: 0,
row_idx: 1,
abs_idx: 1
},
col_idx: 0
}
...
A more sophisticated example that generates .svg
images is present in the examples/
directory. You can execute it as follows:
cargo run --example svg_test -- --output test.svg --num_terms 15
Sahin, Devrim. "A locality preserving one-sided binary tree - crossbar switch wiring design algorithm." Information Sciences and Systems (CISS), 2015 49th Annual Conference on. IEEE, 2015.
@inproceedings{dsahin2015crossbar,
title={A locality preserving one-sided binary tree - crossbar switch wiring design algorithm},
author={{\c{S}}ahin, Devrim},
booktitle={Information Sciences and Systems (CISS), 2015 49th Annual Conference on},
pages={1--4},
year={2015},
organization={IEEE}
}
MIT.