drom / reqack

🔁 elastic circuit toolchain
https://observablehq.com/collection/@drom/reqack
MIT License
29 stars 5 forks source link

multigraph support #42

Open drom opened 6 years ago

drom commented 6 years ago

The following example creates multiple connections from edge:1 to node:2

c1 = {
  const g = reqack.circuit();
  const n = {a: g(), b: g(), c: g('+'), d: g()};
  n.a()(n.b);
  const eb = n.b();
  [0, 1, 2].map(_ => eb(n.c));
  n.c()(n.d);
  g.edges.map(e => Object.assign(e.label, {width: 8}));
  return g;
}

Generated Verilog has multiple asignements to ack1_0

...
// node:2 join +
// join:3, fork:1
assign req2 = req1_0 & req1_0 & req1_0;
assign ack1_0 = ack2 & req1_0 & req1_0;
assign ack1_0 = ack2 & req1_0 & req1_0;
assign ack1_0 = ack2 & req1_0 & req1_0;
// node:3 initiator
...

Dagre renderer renders only one connection:

image

Full test case:

https://beta.observablehq.com/@drom/reqack-multigraph