0

I am thinking compare each bits of a 32 bits number with another 32 bits number.

eg.    check that ins.dout_1 == (ins.din1_1 + ins.din2_1)

Which dout_1, din1_1 and din2_1 are all unsigned integer of 32 bits. I want to check for each bits from 12 bit to 7 bit of dout_1 equals to each bits from 12 bit to 7 bit of the result of (ins.din1_1 + ins.din2_1) or not.

How can i do this?

1 Answers1

0

You can probably use the bit-slice operation. For example, to compare bits 12 to 7 of some x with bits 12 to 7 of some y:

check that x[12:7] == y[12:7]

Or in your specific example, it could be:

check that ins.dout_1[12:7] == (ins.din1_1 + ins.din2_1)[12:7]
Yuri Tsoglin
  • 963
  • 4
  • 7