Solution to the HEX Display Problem


This is my final solution to the HEX display problem. It was a rather enlightening step along the journey. The schematic symbol for the decoder is shown on the right.

The specification called for taking 4 bits of input and then generating the data pattern on the SEGS bus to display the numbers 0 through 9 and the letters A through F. (letters 'b' and 'd' are in lower case) Things I learned from this project:

  • There is a bug in WebPACK that prevents it from doing an AREA optimization (only Speed on the Spartan II)
  • The "generate schematic" option in WebPACK doesn't work on the other version :-)
  • Much can be gleaned from reading the synthesis report...
  • ... but don't panic until a real tool has verified there is an issue.
  • If you screw up the bit patterns (MSB -> LSB) you can "fix" it by setting the constraints to connect them to the right pins on the LED.

VHDL Source code for the HEX Decoder project.

-- HEX Decoder for 7 segment displays		Chuck McManis 8-Mar-2001
--
-- This is an alternate implementation of the HEX decoder. It uses concurrent
-- signal assignment rather than the process structure that the primary
-- implementation uses. On the freeware tools this uses one less "block" than
-- the first implementation but on the Synopsys tool it was the same.
--
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity hexc_display is
    Port ( test : in std_logic;
           blank : in std_logic;
	   data : in std_logic_vector(3 downto 0);
           segs : out std_logic_vector(6 downto 0));
end hexc_display;

architecture behavioral of hexc_display is

begin
    segs <= "0000000" when blank = '1' else
	    "1111111" when test = '1' else
	    "1111110" when data = "0000" else
	    "0110000" when data = "0001" else
	    "1101101" when data = "0010" else
	    "1111001" when data = "0011" else
	    "0110011" when data = "0100" else
	    "1011011" when data = "0101" else
	    "1011111" when data = "0110" else
	    "1110000" when data = "0111" else
	    "1111111" when data = "1000" else
	    "1110011" when data = "1001" else
	    "1110111" when data = "1010" else
	    "0011111" when data = "1011" else
	    "1001110" when data = "1100" else
	    "0111101" when data = "1101" else
  	    "1001111" when data = "1110" else
	    "1000111";
end behavioral;