Case (In) Equality Operators === '&! == 'like Verilog in C

I have a simple C code that does an integer comparison.

void evaluate_comparison (int addr, int expected, int got)
{
    if (got == expected) tunnel_pass (addr, got);
    else                 tunnel_fail (addr, expected, got);
}

expectedand gotare actually 24-bit values ​​corresponding to the values ​​written / read to the 24-bit DSP core. (This C code is compiled for assembly and loaded into the DSP core)

In Simulation, sometimes (especially if some are addrnot supported by DSP), the DSP core reads got = 24'hxxxxxx(undefined 24-bit value). In this case, the above comparison passes, but I do not want this.

I tried using operators ===and !==Case Equality (similar to Verilog), but the code will not compile. Is there any way to do this in C?

+3
source share
1

, - :

if (IsSupported(addr) && got == expected)
   tunnel_pass (addr, got);
else
   tunnel_fail (addr, expected, got);

, IsSupported() .
, , .

+1

All Articles