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

$readmemb and +verilator+rand+reset incompatible #5070

Closed
sifferman opened this issue Apr 26, 2024 · 2 comments · Fixed by #5078
Closed

$readmemb and +verilator+rand+reset incompatible #5070

sifferman opened this issue Apr 26, 2024 · 2 comments · Fixed by #5078
Labels
resolution: fixed Closed; fixed

Comments

@sifferman
Copy link
Contributor

Hello.

I discovered that +verilator+rand+reset will change the x values in $readmemb files to hex digits instead of binary digits. I would be happy to look into this in the next couple weeks.

// test.sv
module test;
    logic m [1];
    initial begin
       $readmemb("x.memb", m);
       $finish;
    end
endmodule
// x.memb
x
$ verilator test.sv --binary --x-initial unique

$ ./obj_dir/Vtest +verilator+rand+reset+0

$ ./obj_dir/Vtest +verilator+rand+reset+1
%Error: x.memb:0: $readmemb (binary) file contains hex characters

$ ./obj_dir/Vtest +verilator+rand+reset+2
%Error: x.memb:0: $readmemb (binary) file contains hex characters
@sifferman sifferman added the new New issue not seen by maintainers label Apr 26, 2024
@wsnyder wsnyder added status: ready Issue is ready for someone to fix; then goes to 'status: assigned' and removed new New issue not seen by maintainers labels Apr 26, 2024
@wsnyder
Copy link
Member

wsnyder commented Apr 26, 2024

Probably this line in verilated.cpp instead to vary on which base is used. If you'd like to make a pull it would be appreciated.

            const int value
                = (c >= 'a' ? (c == 'x' ? VL_RAND_RESET_I(4) : (c - 'a' + 10)) : (c - '0'));

@wsnyder wsnyder added resolution: fixed Closed; fixed and removed status: ready Issue is ready for someone to fix; then goes to 'status: assigned' labels May 21, 2024
@wsnyder
Copy link
Member

wsnyder commented May 21, 2024

Appreciate your work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants