Quantcast
Channel: Cadence Functional Verification Forum
Viewing all articles
Browse latest Browse all 1069

SystemC Verification float representation using integer constraints

$
0
0

I'm trying to generate constrained random float value using the IEEE 754 representation.

I tried to represent the float values as a struct, such:

struct my_float {
    uint sign; // it could be sc_uint<> I know
    uint exponent;
    uint mantissa;
};

However at some point I want to be able to write a constraint as:

c->x21() - c->x20() == c->x11() - c->x10()

where x21, x20, x11 and x10 are my_float type.

The first try was to overload the - operator, for example:

my_float operator-(const my_float & lhs, const my_float& rhs) {

convert_to_float();

subtract();

convert_to_my_float();

return;

}


Viewing all articles
Browse latest Browse all 1069

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>