# Ovm\_comparer doesn't print negative values

**URL:** <https://verificationacademy.com/forums/t/ovm-comparer-doesnt-print-negative-values/29442>\
**Category:** OVM\
**Tags:** signed, OVM, complement, negative, ovm\_comparer\
**Created:** [May 8, 2014, 7:16am UTC](https://verificationacademy.com/forums/t/ovm-comparer-doesnt-print-negative-values/29442 "2014-05-08T07:16:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vman\_joe](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/a87d85/32.png) [@vman\_joe](https://verificationacademy.com/forums/u/vman_joe)\
**Post date:** [May 8, 2014, 7:16am UTC](https://verificationacademy.com/forums/t/ovm-comparer-doesnt-print-negative-values/29442/1 "2014-05-08T07:16:20Z")

</div>

Because I couldn’t manage the ovm\_comparer to print negative values of object members, I’ve tested the following minimal example.

```verilog

my_comparer.compare_field_int("negative value test",3,-5,4,OVM_DEC);

```

I get the following unexpected output from Questa.

# OVM\_INFO @ 3220: reporter [MISCMP] Miscompare for negative value test: lhs = 3 : rhs = 11

Two’s complement is always printed for negative values, what I’m doing wrong?

BR,  
Steffen

---

<div class="post-metadata">

**Author:** ![dave\_59](https://verificationacademy.com/forums/user_avatar/verificationacademy.com/dave_59/32/4499_2.png) [@dave\_59](https://verificationacademy.com/forums/u/dave_59)\
**Post date:** [May 8, 2014, 3:13pm UTC](https://verificationacademy.com/forums/t/ovm-comparer-doesnt-print-negative-values/29442/2 "2014-05-08T15:13:05Z")

</div>

The problem is that some of the people that wrote the OVM/UVM have no idea what an **int** is. Sometimes it is a 4K bit unsigned vector, sometimes its a 64-bit unsigned integer. It is never a 32-bit signed integer, like it is supposed to be.

You options are:

1. Live wit h it.
2. use compare\_field\_real
3. override the the ovm\_comparer class
4. write your own compare method.

---

<div class="post-metadata">

**Author:** ![vman\_joe](https://verificationacademy.com/forums/letter_avatar_proxy/v4/letter/v/a87d85/32.png) [@vman\_joe](https://verificationacademy.com/forums/u/vman_joe)\
**Post date:** [May 9, 2014, 9:39am UTC](https://verificationacademy.com/forums/t/ovm-comparer-doesnt-print-negative-values/29442/3 "2014-05-09T09:39:19Z")

</div>

_In reply to [dave\_59](https://verificationacademy.com/forums/t/ovm-comparer-doesnt-print-negative-values/29442/2):_

Probably the reason why the case OVM\_UNSIGNED isn’t implemented for the compare\_field() and compare\_field\_int() functions in ovm\_comparer.

Thx.
