Specman: How to print negative hexadecimals?

217 views Asked by At

is it possible to print negative hexadecimals in Specman?

For example:

var foo : int;
foo = -0x5;
print foo;

will print: foo = 0xfffffffb. How can I display the output as -0x5?

Really appreciate any help.

2

There are 2 answers

1
Yuri Tsoglin On BEST ANSWER

You can try a trick as follows:

if foo >= 0 then {
    out(foo);
} else {
    out("-", -foo);
};
0
Tudor Timi On

After having a look in the doc, I don't think this is possible. Hex notation is usually used to figure out the bit representation so it doesn't really make sense to show a -. If you want to see it in decimal format (regardless of the radix settings), do:

print foo using dec;

or:

print dec(foo);