Bdog
Bdog

Reputation: 35

Vivado 2016.2 Simulator doesn't support System Verilog $cast or $sformatf

Using the Vivado 2016.2 simulator I need to cast an int to a string in System Verilog but $cast and $sformatf are not supported. What other functions or methods are available to me in order to successfully typecast an int to a string?

Upvotes: 2

Views: 799

Answers (1)

dave_59
dave_59

Reputation: 42698

There are the following other ways

string s;
int i;

s.itoa(i); // converts int to decimal string
$swrite(s,"%d",i);
$sformat(s,"%d",i);

If none of those work for you, then you'll need to write a binary to decimal conversion routine yourself.

Upvotes: 2

Related Questions