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 templated classes #1189

Closed
veripoolbot opened this issue Aug 6, 2017 · 1 comment
Closed

Generate templated classes #1189

veripoolbot opened this issue Aug 6, 2017 · 1 comment
Labels
resolution: wontfix Closed; work won't continue on an issue or pull request

Comments

@veripoolbot
Copy link
Contributor


Author Name: Maciej Piechotka
Original Redmine Issue: 1189 from https://www.veripool.org


Currently the Verilog can be compiled in a way that ignores the parameters as compile-time constructs. That makes testing generic components harder as I cannot just parametrize test to test edge cases for IP block.

It would be nice if verilog could compile code to templated class:

module(clk, out);
     parameter WIDTH = 32;
     parameter MAX = 64;
     input bit clk;
     output bit [WIDTH-1:0] out;
     initial out = 0;
     always_ff @(posedge clk) begin
         out <= (out == MAX - 1) ? 0 : out + 1;
     end
endmodule

Would compile to:

template<size_t WIDTH = 32, size_t MAX = 64>
VL_MODULE(...) {
     // ...
};

(This is an example - using functions would require using C++ constexpr functions or something similar)

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2017-08-06T19:33:50Z


Converting parameters to templates is generally not possible given how the SystemVerilog language itself was designed. See e.g. https://www.veripool.org/boards/2/topics/276?r=2231

@veripoolbot veripoolbot added the resolution: wontfix Closed; work won't continue on an issue or pull request label Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: wontfix Closed; work won't continue on an issue or pull request
Projects
None yet
Development

No branches or pull requests

1 participant