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

x-assign and x-initial 'unique' setting appears not to work #1399

Closed
veripoolbot opened this issue Feb 16, 2019 · 4 comments
Closed

x-assign and x-initial 'unique' setting appears not to work #1399

veripoolbot opened this issue Feb 16, 2019 · 4 comments
Labels
area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: no fix needed Closed; no fix required (not a bug)

Comments

@veripoolbot
Copy link
Contributor


Author Name: Stan Sokorac
Original Redmine Issue: 1399 from https://www.veripool.org


In this simple example, x-assign unique and x-initial unique do not appear to work... both X assignment and uninitialized variable get all zeros.

Verilog:

module foo();
  wire[31:0] uninit;
  reg[31:0] assignx;
  initial begin
     $display("uininit: 0x%x", uninit);
     assignx = 32'hx;
     $display("assignx: 0x%x", uninit);
  end 
endmodule
</code>

Testbench:

#include "Vinitial.h"
int main(int argc, char *argv[])
{ 
  Vinitial S;
  S.eval();
  return 0;
}
</code>

Verilator command:

verilator --cc --Mdir out --x-assign unique --x-initial unique initial.sv

Output:

uininit: 0x00000000
assignx: 0x00000000

I tried throwing in new Verilated:randSeed(123), +verilator+seed, srand48(), just in case there was some default path when no seed is provided, but none of those had any effect.

This is on the latest version from git.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-02-26T23:58:59Z


Running the model with "+verilator+seed+50 +verilator+rand+reset+2" this seems to print random values for me, perhaps you aren't calling the C++ call to parse parameters? If you still have problems please attach an example. (BTW you probably wanted to use assignx in your second display.)

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Stan Sokorac
Original Date: 2019-02-28T14:19:05Z


I've fixed the second display... assignx does indeed work (I was printing the uninit value twice), but uninitialized value is still all zeros. I've attached the full example - unpack and run 'make build; make run'. I get the following output:

out/sim +verilator+seed+14934534 +verilator+rand+reset+2
uininit: 0x00000000
assignx: 0x01c7c40c

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2019-03-02T01:08:42Z


You need to call Verilated::commandArgs before you construct the model, I'll clarify this in the docs.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Stan Sokorac
Original Date: 2019-03-02T01:19:17Z


Got it! I can confirm that it works now. Thanks!

@veripoolbot veripoolbot added area: wrong runtime result Issue involves an incorrect runtine result from Verilated model resolution: nofixneeded resolution: no fix needed Closed; no fix required (not a bug) and removed resolution: nofixneeded labels Dec 22, 2019
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: no fix needed Closed; no fix required (not a bug)
Projects
None yet
Development

No branches or pull requests

1 participant