Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

convert hex string to bit vector in system verilog

2,175 views
Skip to first unread message

good...@gmail.com

unread,
Oct 15, 2008, 1:13:47 PM10/15/08
to
Hi,

Could anyone help me to get the hex value stored in the string back?
Please see the example code below

Thanks
Dev

string e;
e = "07";
logic [31:0] b;

b = e; // i would like to have equalent hexadecimal value
"00000000000000000000000000000111"

but the value of b it returns is "00000000000000000000000000110111"

mrfirmware

unread,
Oct 15, 2008, 2:07:09 PM10/15/08
to


Use the atio() method, try adding my 'c' binary to your example.

string e;
logic [31:0] b;
logic [31:0] c;

e = "07";


b = e; // i would like to have equalent hexadecimal value

c = e.atoi(); // and you will with the atoi() method.

- Mark

0 new messages