-
-
Notifications
You must be signed in to change notification settings - Fork 27
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] Generics for code block #793
Labels
lang
Language design
Comments
A syntax idea about generic block rggen_connect_bit_field_if::<RIF, FIF, LSB, WIDTH> {
assign FIF.valid = RIF.valid;
assign FIF.read_mask = RIF.read_mask[LSB+:WIDTH];
assign FIF.write_mask = RIF.write_mask[LSB+:WIDTH];
assign FIF.write_data = RIF.write_data[LSB+:WIDTH];
assign RIF.read_data[LSB+:WIDTH] = FIF.read_data;
assign RIF.value[LSB+:WIDTH] = FIF.value;
}
module ModuleA {
inst u_block: rggen_connect_bit_field_if::<bit_field_if, bit_field_sub_if, 0, 8>;
} |
It looks good. |
Yes. And adding name-less instantiation increases syntax and name-resolver complexity. if (1) begin: u_block
assign FIF.valid = RIF.valid;
assign FIF.read_mask = RIF.read_mask[LSB+:WIDTH];
assign FIF.write_mask = RIF.write_mask[LSB+:WIDTH];
assign FIF.write_data = RIF.write_data[LSB+:WIDTH];
assign RIF.read_data[LSB+:WIDTH] = FIF.read_data;
assign RIF.value[LSB+:WIDTH] = FIF.value;
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
SV's text macro is useful feature to reduce coding cost for repeated code blocks.
I need this kind of feature to import code below to Very.
https://github.com/rggen/rggen-sample/blob/b0439abf7d5fa6086c4d0aef0ffcdc6836506f06/uart_csr.sv#L1-L9
I think it can be achieved if the generics feature handle code blocks.
The text was updated successfully, but these errors were encountered: