-------------------------------------------------- -- EE 552 Project, Automatic Volume Control -- -- Mark Mielke, Mar 14, 2000 -- Revisions: -- Kreshka Niehaus, March 24, 2000 -- Amplification Calculation Block -- Rev 3, Adding the display -- -- inputs are clk and: -- ** MS 8-bits from Integrator (Noise Out Block) -- This will indicate the level of the ambient noise. -- ** Two 8-bit vectors from the Max_Min Block -- One vector represents the Max Volume, the other vector -- represents the minimum volume. -- -- outputs are: -- ** An 8-bit vector to the Amp Display Block -- This will indicate the level of amplification performed. -- ** An 8-bit vector to the Gain Controller -- These may be the same output? -> assume so for now. -------------------------------------------------- library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_arith.all; use ieee.std_logic_unsigned.all; entity amp_calc is port( clk: in std_logic; noise_in: in std_logic_vector(7 downto 0); maxvol, minvol: in std_logic_vector(7 downto 0); ampcalc_out: buffer std_logic_vector(7 downto 0); count_out: out std_logic_vector(13 downto 0) ); end amp_calc; architecture mixed of amp_calc is --from ssdisplay.vhd component ssdisplay port( level : in std_logic_vector(3 downto 0); seg1: out std_logic_vector(6 downto 0) ); end component; --split 8 bit binary number into 4s to convert to hex signal upper_count_in,lower_count_in: std_logic_vector(3 downto 0); signal upper_count_out,lower_count_out: std_logic_vector(6 downto 0); signal count_in: std_logic_vector(7 downto 0); begin ac: process (clk) begin if rising_edge(clk) then if noise_in <= minvol then ampcalc_out <= minvol; elsif noise_in >= maxvol then ampcalc_out <= maxvol; else ampcalc_out <= noise_in; end if; count_in<=ampcalc_out; end if; end process ac; --split count_in into 4 bit segments upper_count_in <= count_in(7 downto 4); lower_count_in <= count_in(3 downto 0); count_upper: ssdisplay port map( level => upper_count_in, seg1 => upper_count_out); count_lower: ssdisplay port map( level => lower_count_in, seg1 => lower_count_out); -- put count_out parts together with concatenation count_out <= upper_count_out & lower_count_out; end mixed;