prim_bin2gray

Convert an N-bit binary value to Gray code.

Drive each z_o[i] as a_i[i] XOR a_i[i+1], and copy the MSB. N must be positive at elaboration.

Parameters

Table 1. Parameters
NameTypeDefaultDescription
Nint-1Operand width.

Ports

Table 2. Ports
NameDirectionTypeDescription
a_iinputlogic [N-1:0]Binary input.
z_ooutputlogic [N-1:0]Gray-coded output.