Excess-3 to BCD Converter

Design a combinational converter from a 4-bit Excess-3 code back to the BCD digit. Excess-3 is the BCD value plus 3, so 0011 decodes to 0 and 1100 decodes to 9.

Input: ex3, a 4-bit Excess-3 code (only the legal codes 3 to 12 are tested).
Output: bcd, the 4-bit BCD digit.

The testbench applies all ten legal codes and compares bcd with the expected digit.

Contributed by Indicore

Compiler Output
Waveform Viewer