beautypg.com

Kontron COMe Starterkit Eval T2 User Manual

Page 211

background image

Appendix B: Sourcecode for Port 80 Decoder

LPC_State <= IDLE; -- abort cycle, bad frame
-- or address mismatch

else
-- Write address valid. Subsequent Data displays.

LPC_State <= WDATN0;

-- Next state will get

-- first data nibble

end if;

when WDATN0 => -- Data LSN (Least Significant Nibble)is
-- sent first

W_Data(3 downto 0) <= lad_rin; -- latch data (LSN)
if (lframe_nreg = '1') then

LPC_State <= WDATN1; ¬¬¬-- Next state gets
-- 2nd data nibble

else

LPC_State <= IDLE;

end if;

when WDATN1 => -- Data MSN (Most Significant Nibble)

W_Data(7 downto 4) <= lad_rin; -- latch data (MSN)
if (lframe_nreg = '1') then

LPC_State <= WHTAR0;

else

LPC_State <= IDLE;

end if;

when WHTAR0 => -- Write Data Turn Around Cycle 0

if (lframe_nreg = '1') and (lad_rin = "1111") then

LPC_State <= WHTAR1;

else

LPC_State <= IDLE;

end if;

when WHTAR1 => -- Write Data Turn Around Cycle 1

if (lframe_nreg = '1') then

LPC_State <= WSYNC;

else

LPC_State <= IDLE;

end if;

when WSYNC => -- Write Data Sync Cycle

-- Note: No device to respond with a synch at I\O addr
-- 080h. Therefore bus should time out and abort.
-- State ==> to IDLE

if (lframe_nreg = '1') then

LPC_State <= WPTAR;

else

LPC_State <= IDLE;

end if;

when WPTAR =>

-- Write Data Final Turn Around Cycle

-- (not needed -- see WSYNC)

LPC_State <= IDLE;

-- I/O write cycle end

when others =>

LPC_State <= IDLE;

-- all other cases

end case;

end if;

end if;

end process;

P_sseg_decode: process(lclk)

-- decode section for 7 seg displays

begin

if (lclk'event and lclk='1') then

case W_Data(7 downto 4) is

-- Most sig digit for display

when

"0000" => seven_seg_H <= "00000011";

-- Hex 03 displays a 0

when

"0001" => seven_seg_H <= "10011111";-- Hex 9f displays a 1

when

"0010" => seven_seg_H <= "00100101";

-- Hex 25 displays a 2

when

"0011" => seven_seg_H <= "00001101";

-- Hex 0d displays a 3

when

"0100" => seven_seg_H <= "10011001";

-- Hex 99 displays a 4

when

"0101" => seven_seg_H <= "01001001";

-- Hex 49 displays a 5

when

"0110" => seven_seg_H <= "01000001";

-- Hex 41 displays a 6

PICMG

®

COM Express

®

Carrier Board Design Guide

Rev. 2.0 / December 6, 2013

211/218