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

Generate SV code without comments #580

Closed
saturn77 opened this issue Mar 20, 2024 · 3 comments · Fixed by #585
Closed

Generate SV code without comments #580

saturn77 opened this issue Mar 20, 2024 · 3 comments · Fixed by #585
Labels
tools Tools feature

Comments

@saturn77
Copy link

The ability to generate documentation from the veryl code is extremely useful.

It would also be helpful to have an option to remove or strip away the comments that are in the veryl code when generating the SystemVerilog code. In cases where the veryl code is heavily documented, this would allow inspection of the SystemVerilog code in a plain format and make it easier to review the generated code.

This process to do this would simply be placing a "strip_comments" in the toml / veryl file as:

[format]
indent_width = 4
strip_comments = true 
@dalance
Copy link
Collaborator

dalance commented Mar 21, 2024

Looks good.
build may be more suitable because it relates code generation.

[build]
strip_comments = true

@saturn77
Copy link
Author

Yes, sounds good. Having the format as below makes more sense.

[build]
strip_comments = true

I also really like how the actual formatted code in the SystemVerilog mirrors the code formatting in Veryl. The only exception is in the case statement, but I can live with the way that it is now.

It would be nice to have an option, however.

For example

[build]
sv_case = column_case

Which would make this output code:

    always_ff @ (posedge clock) begin
        case (state)
            rx_IDLE : sample_counter <= CLOCKS_PER_BAUD / 2;
            rx_SHIFT: if ((sample_counter > 0)) begin
                sample_counter <= sample_counter - 1;
            end else begin
                sample_counter <= CLOCKS_PER_BAUD - 1;
            end
            rx_LOAD: sample_counter <= 0;
            rx_DONE: sample_counter <= 0;
        endcase
    end

being transformed to this output code instead: (what I call column case)

    always_ff @ (posedge clock) begin
        case (state)
            rx_IDLE :  sample_counter <= CLOCKS_PER_BAUD / 2;
            rx_SHIFT:  if ((sample_counter > 0)) begin
                           sample_counter <= sample_counter - 1;
                       end else begin
                           sample_counter <= CLOCKS_PER_BAUD - 1;
                       end
            rx_LOAD:   sample_counter <= 0;
            rx_DONE:   sample_counter <= 0;
        endcase
    end

@dalance
Copy link
Collaborator

dalance commented Mar 21, 2024

The column_case seems to be good too.
I think it may be better that it is by default for both Veryl and generated SV.

@dalance dalance added the tools Tools feature label Mar 21, 2024
This was referenced Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Tools feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants