-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Variable length generics arguments #1158
Comments
https://x.com/n_hatta/status/1869504448370008366 I thought it's true. The "for" keyword is worst for implementation side and may be confused with the syntax of System verilog side. So how about "foreach" keyword and it just expand each items and indices in veryl. https://gist.github.com/MurakamiShun/ed7e3b3603aa598c772784b5ae9d7dd6 |
|
How aboud adding module RVDecoder<DecModules: {DecProto}>(
i_inst : input logic<32>,
o_uop : output MicroOP,
){
var uops : MicroOP[DecModules::size];
generic_for i, dec_module in DecModules : g_decoder {
inst decoder: dec_module (
.i_inst,
.o_uop(uops[i])
);
} // for decode_modules
inst reduction : Reduction::<DecModules::size, MicroOP, SelMicroOP>(
i: uops,
o: o_uop
);
} |
I didn't know System verilog has "foreach" keyword. I agree that "generic_for" is a better. And we must discuss default parameter too.
Instantiation:
|
Instead of |
"generic for" is just expand generics, but "generic if" must evaluate the condition statements at veryl side. I thought that are there any implementation issues? |
Yes. So all operands of condition expression should be known by Veryl like literal and index of |
I think we don't have to introduce For example, consider the Veryl code below.
Iterator variables if (1) begin: g_inst_module_0
if (0 == 0) begin : g
module_0 u_mod (
.o_result(result[0])
);
end else begin : g
assign result[0] = 0;
end
end
if (1) begin: g_inst_module_1
if (1 == 0) begin : g
module_1 u_mod (
.o_result(result[0])
);
end else begin : g
assign result[1] = 0;
end
end As a result of evaluating condition of if (1) begin: g_inst_module_0
if (1) begin : g
module_0 u_mod (
.o_result(result[0])
);
end
end
if (1) begin: g_inst_module_1
if (1) begin : g
assign result[1] = 0;
end
end I think this SV code matches with the orignal Veryl code. |
Certainly, the benefit of "generic if" is only the emitted code is slightly easier to read. For this issue, we should target only "generic for".
|
Here is summary of the Variable length generics arguments up to now. Declaration
Unpack list of generics
Instantiation
|
Variable length arguments unpackable and computed on the veryl side.
https://twitter.com/taichi600730/status/1869312671746752842
The text was updated successfully, but these errors were encountered: