TITLE "4-bit Code Converter Example";
%-----------------------------------------------------------
File: codeconv.tdf
Author: C. S. Tritt, Ph.D.
Last update: 4/3/97
This AHDL file describes a Gray code to BCD converter using
a truth table.
-----------------------------------------------------------%
SUBDESIGN codeconv
(
g[3..0] : INPUT;
b[3..0] : OUTPUT;
)
BEGIN
TABLE
g3, g2, g1, g0 => b3, b2, b1, b0;
0, 0, 1, 0 => 0, 0, 0, 0;
0, 1, 1, 0 => 0, 0, 0, 1;
0, 1, 1, 1 => 0, 0, 1, 0;
0, 1, 0, 1 => 0, 0, 1, 1;
0, 1, 0, 0 => 0, 1, 0, 0;
1, 1, 0, 0 => 0, 1, 0, 1;
1, 1, 0, 1 => 0, 1, 1, 0;
1, 1, 1, 1 => 0, 1, 1, 1;
1, 1, 1, 0 => 1, 0, 0, 0;
1, 0, 1, 0 => 1, 0, 0, 1;
END TABLE;
END;
Send comments and suggestions about this example to:
Dr. Charles S. Tritt
This page last updated 4/3/97