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

Surelog sometimes discards last range select after access to struct member #3998

Open
Szelwiga opened this issue Oct 29, 2024 · 0 comments
Open

Comments

@Szelwiga
Copy link

Surelog sometimes discards last range select after access to struct member

SystemVerilog code (a1.sv):

typedef struct packed {
    logic [1:0][3:0] a;
} tier1;

module top();
    tier1 xx;
    assign xx.a[1][3:2] = 2;
    assign xx.a[1][1:0] = 3;
endmodule

parsed with: surelog -parse -elabuhdm a1.sv produces UHDM Tree which doesn't contain [3:2]
and [1:0] range selects. This is easily visible, because SystemVerilog code (a2.sv):

typedef struct packed {
    logic [1:0][3:0] a;
} tier1;

module top();
    tier1 xx;
    assign xx.a[1] = 2;
    assign xx.a[1] = 3;
endmodule

produces identical UHDM Tree (with accuracy to debug information). Here is UHDM Tree fragment that is responsible for one of those assignments:

  |vpiContAssign:
  \_cont_assign: , line:7:12, endln:7:28
    |vpiParent:
    \_module_inst: work@top (work@top), file:a1.sv, line:5:1, endln:9:10
    |vpiRhs:
    \_constant: , line:7:27, endln:7:28
    |vpiLhs:
    \_hier_path: (xx.a[1]), line:7:12, endln:7:24
      |vpiParent:
      \_cont_assign: , line:7:12, endln:7:28
      |vpiActual:
      \_ref_obj: (xx), line:7:15, endln:7:16
        |vpiParent:
        \_hier_path: (xx.a[1]), line:7:12, endln:7:24
        |vpiName:xx
      |vpiActual:
      \_bit_select: ([email protected][1].a), line:7:17, endln:7:18
        |vpiParent:
        \_hier_path: (xx.a[1]), line:7:12, endln:7:24
        |vpiName:a
        |vpiFullName:[email protected][1].a
        |vpiIndex:
        \_constant: , line:7:17, endln:7:18
          |vpiParent:
          \_bit_select: ([email protected][1].a), line:7:17, endln:7:18
          |vpiDecompile:1
          |vpiSize:64
          |UINT:1
          |vpiConstType:9
      |vpiName:xx.a[1]

This example is trimmed down version of code from OpenTitan.

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

No branches or pull requests

1 participant