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

frontend: Fixes verific import around range order #4379

Merged
merged 3 commits into from
May 9, 2024

Conversation

QuantamHD
Copy link
Contributor

@QuantamHD QuantamHD commented May 8, 2024

Test Case

module packed_dimensions_range_ordering (
    input  wire [0:4-1] in,
    output wire [4-1:0] out
);
  assign out = in;
endmodule : packed_dimensions_range_ordering

module instanciates_packed_dimensions_range_ordering (
    input  wire [4-1:0] in,
    output wire [4-1:0] out
);
  packed_dimensions_range_ordering U0 (
      .in (in),
      .out(out)
  );
endmodule : instanciates_packed_dimensions_range_ordering
// with verific, does not pass formal
module instanciates_packed_dimensions_range_ordering(in, out);
  input [3:0] in;
  wire [3:0] in;
  output [3:0] out;
  wire [3:0] out;

  assign out = { in[0], in[1], in[2], in[3] };
endmodule

// with surelog, passes formal
module instanciates_packed_dimensions_range_ordering(in, out);
  input [3:0] in;
  wire [3:0] in;
  output [3:0] out;
  wire [3:0] out;

  assign out = in;
endmodule

Script

verific -sv test.sv
verific -import -vv instanciates_packed_dimensions_range_ordering
hierarchy -top instanciates_packed_dimensions_range_ordering
flatten
opt
clean -purge
write_verilog -simple-lhs -noattr -noexpr result3.v

QuantamHD added 2 commits May 8, 2024 01:00
Test Case
```
module packed_dimensions_range_ordering (
    input  wire [0:4-1] in,
    output wire [4-1:0] out
);
  assign out = in;
endmodule : packed_dimensions_range_ordering

module instanciates_packed_dimensions_range_ordering (
    input  wire [4-1:0] in,
    output wire [4-1:0] out
);
  packed_dimensions_range_ordering U0 (
      .in (in),
      .out(out)
  );
endmodule : instanciates_packed_dimensions_range_ordering
```

```
// with verific, does not pass formal
module instanciates_packed_dimensions_range_ordering(in, out);
  input [3:0] in;
  wire [3:0] in;
  output [3:0] out;
  wire [3:0] out;

  assign out = { in[0], in[1], in[2], in[3] };
endmodule

// with surelog, passes formal
module instanciates_packed_dimensions_range_ordering(in, out);
  input [3:0] in;
  wire [3:0] in;
  output [3:0] out;
  wire [3:0] out;

  assign out = in;
endmodule
```

Signed-off-by: Ethan Mahintorabi <[email protected]>
@nakengelhardt nakengelhardt requested a review from mmicko May 8, 2024 08:09
Copy link
Member

@mmicko mmicko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have tried different bit orders and ranges to make sure they do work as intended, and all looks good to me

Make sure that we correctly adjust the value to align it to a zero
indexed list with lsb = 0

Signed-off-by: Ethan Mahintorabi <[email protected]>
@QuantamHD
Copy link
Contributor Author

@mmicko I found another set of bugs where the index of the list is of the form [2:7] and [-12:7]. I had to add another term to the equation to make sure the indexes weren't offset from 0

@mmicko
Copy link
Member

mmicko commented May 9, 2024

Thanks @QuantamHD managed to reproduce issue and this indeed covers it

@mmicko mmicko merged commit 1a54e8d into YosysHQ:main May 9, 2024
18 checks passed
@QuantamHD QuantamHD deleted the fix_verific branch May 9, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants