-
Notifications
You must be signed in to change notification settings - Fork 58
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
R-value casted structs don't get converted #305
Comments
Thank you for filing this issue! sv2v absolutely supports struct conversions, including the struct patterns demonstrated here. I would greatly appreciate it if you could narrow down the scale of this reproducer. Ideally, this reproducer would not require outside scripts or software, and would span at most a few files. Do you think that is doable here? |
Here's a simple example for which sv2v carries out the same behavior. sv2v_test_case.zip. |
@tarik-ibrahimovic Thank you for sharing this example! There are a couple issues I spotted in the example (pasted below). Note that these issues aren't specific to sv2v; commercial tools complain too.
module test(
input logic clk,
input logic rst_n,
input logic [7:0] data_in,
output logic data_out
);
typedef struct {
logic aw_ready;
logic w_ready;
logic b_valid;
} struct_name_t;
struct_name_t struct_name;
always_ff @(posedge clk or negedge rst_n) begin
if (!rst_n) begin
struct_name.aw_ready <= 1'b0;
struct_name.w_ready <= 1'b0;
struct_name.b_valid <= 1'b0;
end else begin
struct_name.aw_ready <= data_in[2];
struct_name.w_ready <= data_in[1];
struct_name.b_valid <= data_in[0];
end
end
assign data_out = '{
aw_ready: struct_name.aw_ready,
w_ready: struct_name.w_ready,
b_valid: '{b_valid: struct_name.b_valid}
};
endmodule All that said, it is of course still possible there is a bug in sv2v. (It wouldn't be the first!) However, I would still appreciate your help in creating a reproducer for the issue you've encountered. Thank you! |
To recreate the issue clone the following repo and follow the provided build steps. The error arises because the particular cast type used in the design is not supported by Yosys's Verilog frontend, leading Yosys to throw an error. Note that the sv2v tool is used as a pre-build hook in FuseSoC to preprocess the source files before they are passed to Yosys. For the exact command line invocation, please refer to the script at sw/sv2vpre.py.
The issue is reocurring and not limited to the example provided below. I'm not sure if this is only a missing feature or a bug.
Example input:
Example output:
The text was updated successfully, but these errors were encountered: