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

[Feature Request] support "region" comments to allow collapsing blocks of code #463

Open
DeflateAwning opened this issue Jan 26, 2024 · 0 comments
Labels

Comments

@DeflateAwning
Copy link
Contributor

Most languages support collapsing blocks of code by wrapping that block of code in a comment like:

// C example

// region boring variable assignments
int a = 1;
float b = 2;
char somestr = "some string value";
// endregion <optionally repeat the name of the region>

This doesn't appear to be supported in this verilog plugin yet. It's supported in C, Python, Java, C#, etc., so I'd call it pretty standard.

In Verilog, it's reasonably common to generate long code using a scripting language, so it would be helpful to be able to collapse it.

Here is an example test case, in Verilog:

module sample_coefficients(
        input [7:0] index_to_request,
        output [4:0] requested_coefficient
    );

    // 255 coefficients, each 5 bits wide
    reg [255:0] coeffs_const [4:0];
    
    // region assign coeffs_const values
    assign coeffs_const[0] = 5'd0;
    assign coeffs_const[1] = 5'd2;
    assign coeffs_const[2] = 5'd4;
    assign coeffs_const[3] = 5'd0;
    assign coeffs_const[4] = 5'd13;
    assign coeffs_const[5] = 5'd22;
    assign coeffs_const[6] = 5'd0;
    // .. many more assigns, up to 255 index
    // endregion assign coeffs_const values

    assign requested_coefficient = coeffs_const[index_to_request];
endmodule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant