Home Aufgabenstellung Pflichtenheft Implementierung Spezifikation Dokumentation

Implementierung
---------------------------------------------------------------------------------------------------
--
-- Title       : converter
-- Design      : Converter
-- Author      : Ferdi
-- Company     : TUM
--
---------------------------------------------------------------------------------------------------
--
-- File        : converter.vhd
-- Generated   : Sun Feb  6 12:57:27 2005
-- From        : interface description file
-- By          : Itf2Vhdl ver. 1.20
--
---------------------------------------------------------------------------------------------------
--
-- Description : Parallel/Seriell Converter
--				   
---------------------------------------------------------------------------------------------------



library IEEE;
use IEEE.STD_LOGIC_1164.all;  
use IEEE.std_logic_unsigned.all;

entity converter is	   
	port (
	Reset			: in STD_LOGIC;					-- Asynchroner Reset
	FSYNC			: in STD_LOGIC;					-- Worttakt
	SCLK			: in STD_LOGIC;					-- Bittakt
	MONO			: in STD_LOGIC_VECTOR(0 to 15);			-- 16 Bit Mono Signal
	READY			: in STD_LOGIC;					-- Ready Signal

	
	FSYNC_OUT       : out STD_LOGIC;				-- Worttakt
	SDATA_OUT       : out STD_LOGIC;				-- Bittakt
	SCLK_OUT        : out STD_LOGIC;				-- Serielles Datum	
	);
end converter;



architecture converter of converter is 

-- interne Signale
signal OLD_FSYNC	: STD_LOGIC;				

signal M_1		: STD_LOGIC_VECTOR(0 to 15);
signal M_2		: STD_LOGIC_VECTOR(0 to 15); 
signal S		: INTEGER;					  	  -- Zustände

signal Z_B		: INTEGER;						  -- Zähler Bit
signal Z_D		: INTEGER;						  -- Zähler Durchgang
signal Z_M		: INTEGER;						  -- Zähler geladene MONO Signale

begin  
		
	system_mode: process (SCLK, Reset, FSYNC, M_1, M_2, Z_B, Z_D, Z_M, OLD_FSYNC, S)
    begin
        if (Reset = '1') then 
		M_1 <= "0000000000000000";
		M_2 <= "0000000000000000";
            	S   <= 0;				-- Ein asynchroner Reset ist aufgetreten, dann
		Z_B <= 0;				-- werden alle fuer diesen Prozess relevanten
            	Z_D <= 0;                   		-- Signale in den Initialzustand zurueckgesetzt.
		Z_M <= 0;				-- Ansonsten, bei jeder steigenden Taktflanke,
			
			
        elsif (SCLK'event and SCLK = '1') then     
		                              
									
            if (S = 0 and READY = '1') then  
				M_1 <= MONO;
				Z_M <= 1;
				Z_D <= 1;
				Z_B <= 15; 
				S <= 1;
            end if;
			
            if ( S = 1 and FSYNC = OLD_FSYNC) then
				S <= 1;
            end if;	
						
            if (S = 1 and FSYNC /= OLD_FSYNC) then  
				FSYNC_OUT <= FSYNC;
				SDATA_OUT <= M_1(15);
				Z_B <= Z_B-1;
				S <= 2;
            end if;	  	   
			
	        if (S >= 2 and S <=(15)) then  
				FSYNC_OUT <= FSYNC;
				SDATA_OUT <= M_1(Z_B);
				Z_B <= Z_B-1;
				if (READY = '1') then
					M_2 <= MONO;
					Z_M <= 2;
				end if;
				S <= S+1;
            end if;
			
	        if (S = (16) and Z_D = 1) then  
				FSYNC_OUT <= FSYNC;
				Z_B <= (15);
				Z_D <= 2;
				SDATA_OUT <= M_1(0);
				S <= 1;
            end if;	
			
	        if (S = (16) and Z_M = 2) then  			
				SDATA_OUT <= M_1(0);
				M_1 <= M_2;
				Z_D <= 1;
				Z_B <= (15);
				S <= 1;
            end if;	
			
	        if (S = (16) and READY = '1') then  
				SDATA_OUT <= M_1(0);
				M_1 <= MONO;
				Z_D <= 1;
				Z_M <= 1;
				Z_B <= (15);
				S <= 1;
            end if;
			
	        if (S = (16) and Z_D = 2 and Z_M = 1and READY = '0') then  				
				S <= 0;
            end if;
			
			SCLK_OUT <= SCLK;
			OLD_FSYNC <= FSYNC;
			
        end if;	
		
    end process system_mode;

	 

end converter;

DOWNLOAD


Home Aufgabenstellung Pflichtenheft Implementierung Spezifikation Dokumentation