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

Unsupported: little endian ordering for arrays #2499

Closed
phantom-killua opened this issue Aug 5, 2020 · 1 comment
Closed

Unsupported: little endian ordering for arrays #2499

phantom-killua opened this issue Aug 5, 2020 · 1 comment
Labels
area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed

Comments

@phantom-killua
Copy link

Verilator version

Verilator 4.038 2020-07-11 rev v4.036-114-g0cd4a57ad

Testcase

typedef struct packed {
  logic [9:0] a;
} t1;

typedef struct packed {
  logic [6:0] b;
  /* verilator lint_off LITENDIAN */
  t1 [0:4] c;
  /* verilator lint_on LITENDIAN */
  logic d;
} t2;

/* verilator lint_off DECLFILENAME */
module our;
/* verilator lint_on DECLFILENAME */
  t2 t;
  initial begin
    //1111111 1000010000 1000011000 1000011100 1000011110 1000011111 0
    assign t = 58'b1111111100001000010000110001000011100100001111010000111110; 
    $displayb(t.b);
    $displayb(t.c[0].a);
    $displayb(t.d);
    $finish;
  end
endmodule

Simulation Result

1111111
1000011111
0
- t/t_little_endian_err.v:25: Verilog $finish

I think the value of "t.c[0].a" is 1000010000, not 1000011111, Because c ("t1 [0:4] c;") is little endian. I think it's a bug, What do you all think?

@phantom-killua phantom-killua added the new New issue not seen by maintainers label Aug 5, 2020
@wsnyder wsnyder added area: data-types Issue involves data-types status: ready Issue is ready for someone to fix; then goes to 'status: assigned' and removed new New issue not seen by maintainers labels Aug 10, 2020
@wsnyder
Copy link
Member

wsnyder commented Aug 10, 2020

Confirmed, needs some effort to fix, if you or someone has time a pull request for a fix would be appreciated.

As the array can be seen via a "different" mechanism all bits must be reversed. This is annoying and once fixed will greatly slow down any code using little endian, but I don't see an alternative. Yet another reason to not use little endian ;)

@wsnyder wsnyder added area: runtime result resolution: fixed Closed; fixed and removed area: data-types Issue involves data-types status: ready Issue is ready for someone to fix; then goes to 'status: assigned' labels Dec 13, 2020
@wsnyder wsnyder closed this as completed Dec 13, 2020
@wsnyder wsnyder added area: wrong runtime result Issue involves an incorrect runtine result from Verilated model and removed area: runtime result labels Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: fixed Closed; fixed
Projects
None yet
Development

No branches or pull requests

2 participants