Line 56... |
Line 56... |
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use IEEE.std_logic_unsigned.all;
|
use IEEE.std_logic_unsigned.all;
|
use IEEE.std_logic_arith.all;
|
use IEEE.std_logic_arith.all;
|
|
|
entity design_top is
|
entity design_top_thincandbg is
|
port (
|
port (
|
--system signals
|
--system signals
|
sys_clk : in std_logic; --25 MHz clk
|
sys_clk : in std_logic; --25 MHz clk
|
resetn : in std_logic;
|
resetn : in std_logic;
|
hdr : inout std_logic_vector(9 downto 0);
|
hdr : inout std_logic_vector(9 downto 0);
|
Line 90... |
Line 90... |
usb_wr : inout std_logic; -- write performed on edge \ of signal
|
usb_wr : inout std_logic; -- write performed on edge \ of signal
|
usb_txe_n : in std_logic; -- transmit enable (redy for new data if low)
|
usb_txe_n : in std_logic; -- transmit enable (redy for new data if low)
|
usb_rxf_n : in std_logic; -- rx fifo has data if low
|
usb_rxf_n : in std_logic; -- rx fifo has data if low
|
usb_bd : inout std_logic_vector(7 downto 0) --bus data
|
usb_bd : inout std_logic_vector(7 downto 0) --bus data
|
);
|
);
|
end design_top;
|
end design_top_thincandbg;
|
|
|
|
|
|
|
architecture rtl of design_top is
|
architecture rtl of design_top_thincandbg is
|
|
|
component led_sys --toplevel for led system
|
component led_sys --toplevel for led system
|
generic(
|
generic(
|
msn_hib : std_logic_vector(7 downto 0); --Most signif. of hi byte
|
msn_hib : std_logic_vector(7 downto 0); --Most signif. of hi byte
|
lsn_hib : std_logic_vector(7 downto 0); --Least signif. of hi byte
|
lsn_hib : std_logic_vector(7 downto 0); --Least signif. of hi byte
|
Line 264... |
Line 264... |
signal dbg_wr : STD_LOGIC; --write not read
|
signal dbg_wr : STD_LOGIC; --write not read
|
signal dbg_full : STD_LOGIC; --write not read
|
signal dbg_full : STD_LOGIC; --write not read
|
signal dbg_almost_full : STD_LOGIC;
|
signal dbg_almost_full : STD_LOGIC;
|
signal dbg_usedw : STD_LOGIC_VECTOR (12 DOWNTO 0);
|
signal dbg_usedw : STD_LOGIC_VECTOR (12 DOWNTO 0);
|
|
|
|
signal force_4meg_n : std_logic;
|
signal dbg_usb_mode_en : std_logic;
|
signal dbg_usb_mode_en : std_logic;
|
signal usb_mode_en : std_logic;
|
signal usb_mode_en : std_logic;
|
signal mem_idle : std_logic;
|
signal mem_idle : std_logic;
|
signal umem_addr : std_logic_vector(23 downto 0);
|
signal umem_addr : std_logic_vector(23 downto 0);
|
signal umem_do : std_logic_vector(15 downto 0);
|
signal umem_do : std_logic_vector(15 downto 0);
|
Line 276... |
Line 277... |
signal umem_ack : std_logic;
|
signal umem_ack : std_logic;
|
signal umem_cmd : std_logic;
|
signal umem_cmd : std_logic;
|
signal enable_4meg: std_logic;
|
signal enable_4meg: std_logic;
|
signal dongle_con_n : std_logic;
|
signal dongle_con_n : std_logic;
|
|
|
constant dongle_ver : std_logic_vector(15 downto 0):=x"8605";
|
constant dongle_ver : std_logic_vector(15 downto 0):=x"8606";
|
--END USB signals
|
--END USB signals
|
|
|
begin
|
begin
|
|
|
--GPIO PINS START
|
--GPIO PINS START
|
Line 302... |
Line 303... |
-- when jumper on pins 7,8 then post code capture mode enabled
|
-- when jumper on pins 7,8 then post code capture mode enabled
|
hdr(4)<= '0';
|
hdr(4)<= '0';
|
dbg_usb_mode_en <= not hdr(5); --weak pullup on hdr(5) paired with hdr(4)
|
dbg_usb_mode_en <= not hdr(5); --weak pullup on hdr(5) paired with hdr(4)
|
usb_mode_en <= not dbg_usb_mode_en;
|
usb_mode_en <= not dbg_usb_mode_en;
|
|
|
|
-- when jumper on pins 9,10 then 4M window is forced
|
|
hdr(6)<= '0';
|
|
force_4meg_n <= hdr(7); --weak pullup on hdr(7) paired with hdr(6)
|
|
|
--GPIO PINS END
|
--GPIO PINS END
|
|
|
--LED SUBSYSTEM START
|
--LED SUBSYSTEM START
|
data_to_disp <= x"86"&lpc_debug(7 downto 0) when usb_mode_en='1' else --x"C0DE"; -- ASSIGN data to be displayed (should be regitered)
|
data_to_disp <= x"86"&lpc_debug(7 downto 0) when usb_mode_en='1' else --x"C0DE"; -- ASSIGN data to be displayed (should be regitered)
|
"000"&dbg_usedw; --show tx fifo state on leds when postcode capture mode
|
"000"&dbg_usedw; --show tx fifo state on leds when postcode capture mode
|
Line 319... |
Line 324... |
msn_hib => "01111111",--8 --Most signif. of hi byte
|
msn_hib => "01111111",--8 --Most signif. of hi byte
|
lsn_hib => "01111101",--6 --Least signif. of hi byte
|
lsn_hib => "01111101",--6 --Least signif. of hi byte
|
msn_lob => "10111111",--0 --Most signif. of hi byte This is version code
|
msn_lob => "10111111",--0 --Most signif. of hi byte This is version code
|
--lsn_lob => "01001111" --3 --Least signif. of hi byte This is version code
|
--lsn_lob => "01001111" --3 --Least signif. of hi byte This is version code
|
--lsn_lob => "01100110" --4 --Least signif. of hi byte This is version code
|
--lsn_lob => "01100110" --4 --Least signif. of hi byte This is version code
|
lsn_lob => "01101101" --5 --sync with dongle version const. Least signif. of hi byte This is version code
|
--lsn_lob => "01101101" --5 --sync with dongle version const. Least signif. of hi byte This is version code
|
|
lsn_lob => "01111101" --6 --sync with dongle version const. Least signif. of hi byte This is version code
|
|
|
)
|
)
|
port map(
|
port map(
|
clk => sys_clk , -- in std_logic;
|
clk => sys_clk , -- in std_logic;
|
reset_n => resetn, -- in std_logic;
|
reset_n => resetn, -- in std_logic;
|
Line 443... |
Line 449... |
elsif lpc_addr(7 downto 0)=x"88" and lpc_data_o=x"D1" then --Set Dongle not attached signal
|
elsif lpc_addr(7 downto 0)=x"88" and lpc_data_o=x"D1" then --Set Dongle not attached signal
|
dongle_con_n <='1'; -- pin 3 in GPIO make it 1
|
dongle_con_n <='1'; -- pin 3 in GPIO make it 1
|
elsif lpc_addr(7 downto 0)=x"88" and lpc_data_o=x"D0" then --Set Dongle attached signal
|
elsif lpc_addr(7 downto 0)=x"88" and lpc_data_o=x"D0" then --Set Dongle attached signal
|
dongle_con_n <='0'; -- pin 3 in GPIO make it 1
|
dongle_con_n <='0'; -- pin 3 in GPIO make it 1
|
end if;
|
end if;
|
|
else
|
|
if force_4meg_n='0' then -- active low (always force when jumper on)
|
|
enable_4meg <='1';
|
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process LATCHled;
|
end process LATCHled;
|
|
|
|
|