Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect and disallow invalid connections in JSON #10

Open
tilk opened this issue Mar 23, 2020 · 6 comments
Open

Detect and disallow invalid connections in JSON #10

tilk opened this issue Mar 23, 2020 · 6 comments

Comments

@tilk
Copy link
Owner

tilk commented Mar 23, 2020

If the input JSON has a connection between different-sized ports, DigitalJS will happily connect them, with disastrous results. For example, yosys2digitaljs currently generates such a bad JSON for:

module test2(input [1:0] i, output o);
  assign o = i;
endmodule
module test(output o);
  test2 x(0'b1, o);
endmodule
@ShreyaPrasad1209

This comment has been minimized.

@tilk

This comment has been minimized.

@ShreyaPrasad1209

This comment has been minimized.

@ialokim

This comment has been minimized.

@ialokim
Copy link
Contributor

ialokim commented Jun 27, 2020

How would you like digitaljs to react in such a case? I would propose to show a warning/error (e.g. using a red shadow) on the affected wire (or port?), perhaps with a tooltip shown on mouseover stating the problem, and only allow circuit.start() in case there are no errors in the whole graph.

This would then also be another step towards #2 by handling invalid connections introduced by changing bit lengths after initialization.

@tilk
Copy link
Owner Author

tilk commented Jun 27, 2020

Your proposition is fine. The information about the circuit correctness should also be accessible by code, for example by a property on HeadlessCircuit.
Also, I worry about complexity of the solution. It should be simple (so that it's easy to see it's correct), and should not impact the performance for error-free circuits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants