Verilog Binary to gray code conversion example.
A function is discussed below to convert binary number to gray code number. The function is then used in combinational RTL logic. This kind of conversions are widely used in digital design to implement asynchronous clock crossing interfaces. The gray code primarily used to convert counter values before sending across the async interface. With this technique
only one bit is allowed to change and it limits the error to +/-
Complete logic of program is to generate a
binary counter and then encode it into gray counter.