335
Unit 20 Design Solutions
Lab Design Problems 20.N, 20,O, 20.P, and 20.Q.
These problems require the design of a multiplier with a product that is 13 bits long. If your students are using a
board that has only 8 LEDs, two strategies could be used to display the product. One way is to add an extra state to
— The following module displays a 16-bit answer as four hexadecimal digits.
— The constant array converts each 4- bit pattern to a 7-bit pattern to drive the 7-segment indicators.
— The 7-bit LCD output drives all four indicators in parallel.
— The scan signal selects each of the four 7-segment indicators in turn
— and multiplexes the four digits from the bit_data input.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity hex_display is
port(bit_data: in std_logic_vector(15 downto 0);
LCD: out std_logic_vector( 6 downto 0);
signal digit: std_logic_vector(3 downto 0);
signal index: integer range 0 to 15;
signal scan: std_logic_vector(3 downto 0);
signal clk_count: std_logic_vector(8 downto 0):= “000000000”;
begin
digit <= bit_data(3 downto 0) when scan(0) = ‘0’
else bit_data(7 downto 4) when scan(1) = ‘0’
else bit_data(11 downto 8) when scan(2) = ‘0’
else bit_data(15 downto 12) when scan(3) = ‘0’
else “0000”;
index <= conv_integer(digit);
LCD <= not hex_display1(index);
enable_0 <= scan(3); enable_1 <= scan(2); enable_2 <= scan(1); enable_3 <= scan(0);
Note: For consistency with the input to this hex-display module, we have added three
initial 0’s to the 13-bit product in each of the solutions for Problems 20.N, 20.O, 20.P and
20.Q.