How to cast integer to a bits-vector of a certain length?

In reply to dmitryl:

You don’t need to cast, you can use int type as normal 2 state bit vector with certain const length.
The difference between then is int supports 2 states (0, 1), and logic supports 4 states (0, 1, x, z).

So if you want to XOR 8 bits of int A and logic[7:0] B, you can:


A[7:0] ^ B