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

Reduce size of ternary expressions generated by Verilog backend #1373

Open
priyasrikumar opened this issue Feb 22, 2023 · 2 comments
Open

Reduce size of ternary expressions generated by Verilog backend #1373

priyasrikumar opened this issue Feb 22, 2023 · 2 comments
Assignees
Labels
Status: Needs Triage Issue needs some thinking

Comments

@priyasrikumar
Copy link
Contributor

Calyx has been generating Verilog code that way too big. The root cause of this, identified in Adrian's comment, is that assigns statements are amalgamated into one big ternary expression. We should break assignments into smaller chunks. (and maybe discuss the best way to do that here!)

@priyasrikumar priyasrikumar added the Status: Needs Triage Issue needs some thinking label Feb 22, 2023
@sampsyo
Copy link
Contributor

sampsyo commented Feb 23, 2023

To state the obvious, the straightforward way to make this into separate lines is to use Verilog if:

if (msp_go_out) begin
  assign depth_output_addr0 = 13'd0
end else if (msp0_go_out) begin
  assign depth_output_addr0 = 13'd1
...

But I recall that we stopped doing that (and switched to the ternary expression style) for some reason… but I can't recall why. Maybe just testing that out to see if something goes obviously wrong would be informative?

@rachitnigam
Copy link
Contributor

I think there is was a problem with the semantics of assign and always_comb ... if not being exactly the same causing various problems. I think #1177 is the other approach we can consider.

@priyasrikumar priyasrikumar self-assigned this Feb 24, 2023
@rachitnigam rachitnigam added this to the Quality of Results milestone Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue needs some thinking
Projects
None yet
Development

No branches or pull requests

3 participants