beautypg.com

Digilent DIO2 User Manual

Page 19

background image

Digilab DIO2 Reference Manual

Digilent, Inc.

www.digilentinc.com

page 19 of 19

Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.

--
process(clk256)
begin

if clk256'event and clk256 = '1' then

count <= count + 1;

end

if;

end

process;


with count select

digit <= sseg_reg(7 downto 4) when "00",

sseg_reg(3

downto

0)

when

"01",

sseg_reg(15

downto

12)

when

"10",

sseg_reg(11

downto

8)

when

others;


with digit select

sseg1 <=

"1001111" when "0001", --1

"0010010"

when

"0010",

--2

"0000110"

when

"0011",

--3

"1001100"

when

"0100",

--4

"0100100"

when

"0101",

--5

"0100000"

when

"0110",

--6

"0001111"

when

"0111",

--7

"0000000"

when

"1000",

--8

"0000100"

when

"1001",

--9

"0001000"

when

"1010",

--A

"1100000"

when

"1011",

--b

"0110001"

when

"1100",

--C

"1000010"

when

"1101",

--d

"0110000"

when

"1110",

--E

"0111000"

when

"1111",

--F

"0000001"

when

others;

--0


with count select

ssegsel1 <= "1000" when "00",

"0100"

when

"01",

"0010"

when

"10",

"0001"

when

others;

--
-- Test mode
--
testentry <= switchs(0) and not switchs(7) and btns(14) and btns(7);

process (btns(0))
begin

if (btns(0)'event and btns(0) = '1') then testmode <= testentry;

end

if;

end process;


leds <= not(leds_i) when testmode = '0' else not(btns(14)&btns(14 downto
1)&btns(1));
sseg <= sseg1 when testmode = '0' else switchs (6 downto 0);
ssegdp <= '1' when testmode = '0' else switchs(7);
ssegsel <= ssegsel1 when testmode = '0' else "1111";

end rtl;