Coder Social home page Coder Social logo

drom / reqack Goto Github PK

View Code? Open in Web Editor NEW
29.0 4.0 4.0 280 KB

πŸ” elastic circuit toolchain

Home Page: https://observablehq.com/collection/@drom/reqack

License: MIT License

JavaScript 92.92% Verilog 6.77% HTML 0.31%
hardware-description-language verilog hdl hacktoberfest

reqack's Introduction

NPM version Linux MacOS Windows TUTORIAL

REQuest ⇄ ACKnowledge

JavaScript Tool set to construct, transform and analyze digital circuits based on elastic transactional protocol and Request-Acknowledge handshake.

User describes circuit JavaScript API, add standard components from the library, or create new componets.

Several standard controllers provided.

User can transform constructed circuit by changing buffer capacity or performing other correct by construction transformations.

Usage

The package can be installed from npm:

npm i reqack

and imported into your JavaScript code:

const reqack = require('reqack');

A circuit can be constructed this way:

const g = reqack.circuit('circuit_name');

A node can be constructed by calling the circuit function. Optional node_label string will be used as standard or custom operation or as a root of a signal name.

const node1 = g('node_label');

A edge can be constructed by calling the node function. Optional argument is an Object with two major properties (width, capacity).

const edge1 = node1({width: 32, capacity: 1});

One node can be connected to another node by calling edge with a destination node.

edge1(node2); // -> edge1

Resulted Verilog RTL can be produced by calling

const verilogString = reqack.verilog(g, {});

SVG image can be rendered by calling

const svg = reqack.svg(g);

Testing

npm i
npm test

License

MIT LICENSE

reqack's People

Contributors

ameetgohil avatar drom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

reqack's Issues

multigraph support

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

equality node

node with:

  • no label
  • 1 target socket
  • 1 initiator socket
  • same with?

need to create edge trees

5 year plan

  • Good Front End
    • graph API
    • ???
    • HLS
  • Key Example [#9]
    • pipeline-able
    • memories
    • cyclic
  • transformation API
    • low level
    • graph wide
      • algo
      • feedback
  • simulate graph
  • auto tb [#10]
  • back end
    • verilog
    • graphviz

Auto TB

Generate Testbench with each design.

node object type

Similar to React Components, reqack should be able to take primitive component types or complex component types. Complex component provided as the factory function.

wire test fail

https://github.com/drom/elastic/blob/master/test/basic.js#L11

drom@drom:~/work/github/drom/elastic> verilator --lint-only build/wire.v 
%Error-ASSIGNIN: build/wire.v:16: Assigning to input variable: i_1_dat
%Error: Exiting due to 1 error(s)
%Error: See the manual and http://www.veripool.org/verilator for more assistance.
%Error: Command Failed /usr/local/bin/verilator_bin --lint-only build/wire.v

ac_types

Add support for ac_types

ac_int<W,S>

  • W - width of the number (non-negative interger number)
  • S - signed number (bool flag)
Type Numerical range Quantum
{W: 1, S: false} 0..1 1
{W: 1, S: true} -1..0 1
{W: 4, S: false} 0..15 1
{W: 4, S: true} -8..7 1

ac_int<W, S> === ac_fixed<W, W, S>

ac_fixed<W, I, S, Q, O>

  • W - width of the number (non-negative interger number)
  • I - integer width (non-negative interger number)
  • S - signed number (bool flag)
  • Q - rounding (bool flag)
  • O - overflow (bool flag)
Type Numerical range Quantum
{W: 4, I: 4, S: false} 0..15 1
{W: 4, I: 4, S: true} -8..7 1
{W: 4, I: 6, S: false} 0..60 4
{W: 4, I: 6, S: true} -32..28 4
{W: 4, I: 0, S: false} 0..15/16 1/16
{W: 4, I: 0, S: true} -1/2..7/16 1/16
{W: 4, I: -1, S: false} 0..15/32 1/32
{W: 4, I: -1, S: true} -0.25..7/32 1/32

ac_float<W, I, E, Q>

  • W - width of mantissa (non-negative interger number)
  • I - integer width (non-negative interger number)
  • E - exponent (non-negative interger number)
  • Q - rounding (bool flag)
Type Numerical range Quantum
{W: 54, I: 2, E: 11} IEEE 754 double
{W: 25, I: 2, E: 8} IEEE 754 float
{W: 12, I: 2, E: 5} IEEE 754 half

❓ should width be W+E-1 ❓

ac_complex

C: true flag makes two part complex number.

Type Numerical range Quantum
{W: 8, I: 4, S: false, C: true} 0..15 1

Directed- Cyclic- Multi- Hyper- Graph

Graph

A graph is an ordered pair G := (V, E) where:

  • V is set of nodes;
  • E is set of edges.

Digraph (Directed graph)

In Digraph edges have direction.

Directed Cyclic Graph

A directed cyclic graph is a digraph that may have directed cycles.

Multigraph

Multigraph permits multiple edges with the same source and target nodes.

Hypergraph

In Hypergraph hyperedge (edge) is set of nodes.

Broadcast Directed- Hyper- Graph

1 source node s and set of (1 or more) target nodes T.

References

Directed hypergraphs: Introduction and fundamental algorithmsβ€”A survey. Giorgio Ausiello, Luigi Laura

name prefix

Ability to specify name prefix to the group of signals.
Good way to query, select, constraint elements with different properties

references

@incollection{peeters2005implementation,
  title={Implementation of handshake components},
  author={Peeters, Ad},
  booktitle={Communicating Sequential Processes. The First 25 Years},
  pages={98--132},
  year={2005},
  publisher={Springer}
}

ftp://nozdr.ru/biblio/kolxo3/Cs/CsLn/Communicating%20Sequential%20Processes..%20The%201th%2025%20Years,%20Symposium%20on%20the%20Occasion%20of%2025%20Years%20of%20CSP(LNCS3525,%20Springer,%202005)(ISBN%203540258132)(334s)_CsLn_.pdf#page=111

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.