Line 31... |
Line 31... |
-- Not the one for Xilinx EDK (with PLB bus), for processor less designs.
|
-- Not the one for Xilinx EDK (with PLB bus), for processor less designs.
|
--
|
--
|
-- This core provides a simple FIFO and register interface to the
|
-- This core provides a simple FIFO and register interface to the
|
-- USB data transfer capabilities of the GECKO3COM/GECKO3main system.
|
-- USB data transfer capabilities of the GECKO3COM/GECKO3main system.
|
--
|
--
|
-- Look at GECKO3COM_loopback.vhd for an example how to use it.
|
-- Look at GECKO3COM_simple_test.vhd for an example how to use it.
|
--
|
--
|
-- Target Devices: general
|
-- Target Devices: general
|
-- Tool versions: 11.1
|
-- Tool versions: 11.1
|
-- Dependencies: Xilinx FPGA's Spartan3 and up or Virtex4 and up.
|
-- Dependencies: Xilinx FPGA's Spartan3 and up or Virtex4 and up.
|
--
|
--
|
Line 85... |
Line 85... |
o_send_fifo_full : out std_logic;
|
o_send_fifo_full : out std_logic;
|
i_send_fifo_data : in std_logic_vector(BUSWIDTH-1 downto 0);
|
i_send_fifo_data : in std_logic_vector(BUSWIDTH-1 downto 0);
|
i_send_fifo_reset : in std_logic;
|
i_send_fifo_reset : in std_logic;
|
i_send_transfersize : in std_logic_vector(31 downto 0);
|
i_send_transfersize : in std_logic_vector(31 downto 0);
|
i_send_transfersize_en : in std_logic;
|
i_send_transfersize_en : in std_logic;
|
|
i_send_have_more_data : in std_logic;
|
i_send_counter_load : in std_logic;
|
i_send_counter_load : in std_logic;
|
i_send_counter_en : in std_logic;
|
i_send_counter_en : in std_logic;
|
o_send_counter_zero : out std_logic;
|
o_send_counter_zero : out std_logic;
|
i_send_mux_sel : in std_logic_vector(2 downto 0);
|
i_send_mux_sel : in std_logic_vector(2 downto 0);
|
|
|
Line 147... |
Line 148... |
signal s_send_transfersize_count: std_logic_vector(31 downto 0);
|
signal s_send_transfersize_count: std_logic_vector(31 downto 0);
|
|
|
signal s_receive_fifo_empty : std_logic;
|
signal s_receive_fifo_empty : std_logic;
|
|
|
signal s_send_fifo_data : std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
|
signal s_send_fifo_data : std_logic_vector(SIZE_DBUS_GPIF-1 downto 0);
|
signal s_btag, s_nbtag : std_logic_vector(7 downto 0);
|
signal s_btag, s_nbtag, s_msg_id: std_logic_vector(7 downto 0);
|
|
|
begin -- behaviour
|
begin -- behaviour
|
|
|
receive_fifo_1 : receive_fifo
|
receive_fifo_1 : receive_fifo
|
generic map (
|
generic map (
|
Line 246... |
Line 247... |
-- type : sequential
|
-- type : sequential
|
-- inputs : i_sysclk, i_nReset, s_send_transfersize_reg,
|
-- inputs : i_sysclk, i_nReset, s_send_transfersize_reg,
|
-- i_send_transfersize_en
|
-- i_send_transfersize_en
|
-- outputs: s_send_transfersize_count
|
-- outputs: s_send_transfersize_count
|
send_counter : process (i_sysclk, i_nReset)
|
send_counter : process (i_sysclk, i_nReset)
|
begin -- process receive_counter
|
begin -- process send_counter
|
if i_nReset = '0' then -- asynchronous reset (active low)
|
if i_nReset = '0' then -- asynchronous reset (active low)
|
s_send_transfersize_count <= (others => '0');
|
s_send_transfersize_count <= (others => '0');
|
elsif i_sysclk'event and i_sysclk = '1' then -- rising clock edge
|
elsif i_sysclk'event and i_sysclk = '1' then -- rising clock edge
|
if i_send_counter_load = '1' then
|
if i_send_counter_load = '1' then
|
s_receive_transfersize_count <= s_send_transfersize_reg;
|
s_send_transfersize_count <= s_send_transfersize_reg;
|
end if;
|
end if;
|
if i_send_counter_en = '1' then
|
if i_send_counter_en = '1' then
|
s_send_transfersize_count <= s_send_transfersize_count - 1;
|
s_send_transfersize_count <= s_send_transfersize_count - 1;
|
end if;
|
end if;
|
end if;
|
end if;
|
Line 270... |
Line 271... |
-- type : sequential
|
-- type : sequential
|
-- inputs : i_sysclk, i_nReset, i_btag_reg_en, i_nbtag_reg_en
|
-- inputs : i_sysclk, i_nReset, i_btag_reg_en, i_nbtag_reg_en
|
-- i_rx_data
|
-- i_rx_data
|
-- outputs: s_btag, s_nbtag
|
-- outputs: s_btag, s_nbtag
|
btag_register : process (i_sysclk, i_nReset)
|
btag_register : process (i_sysclk, i_nReset)
|
begin -- process receive_counter
|
begin -- process btag_register
|
if i_nReset = '0' then -- asynchronous reset (active low)
|
if i_nReset = '0' then -- asynchronous reset (active low)
|
s_btag <= (others => '0');
|
s_btag <= (others => '0');
|
|
s_msg_id <= (others => '0');
|
s_nbtag <= (others => '0');
|
s_nbtag <= (others => '0');
|
elsif i_sysclk'event and i_sysclk = '1' then -- rising clock edge
|
elsif i_sysclk'event and i_sysclk = '1' then -- rising clock edge
|
if i_btag_reg_en = '1' then
|
if i_btag_reg_en = '1' then
|
s_btag <= i_rx_data(15 downto 8);
|
s_btag <= i_rx_data(15 downto 8);
|
|
s_msg_id <= i_rx_data(7 downto 0);
|
end if;
|
end if;
|
if i_nbtag_reg_en = '1' then
|
if i_nbtag_reg_en = '1' then
|
s_nbtag <= i_rx_data(7 downto 0);
|
s_nbtag <= i_rx_data(7 downto 0);
|
end if;
|
end if;
|
end if;
|
end if;
|
Line 290... |
Line 293... |
'1' when s_btag = not s_nbtag else
|
'1' when s_btag = not s_nbtag else
|
'0';
|
'0';
|
|
|
|
|
o_dev_dep_msg_out <=
|
o_dev_dep_msg_out <=
|
'1' when i_rx_data(7 downto 0) = x"01" else
|
'1' when s_msg_id(7 downto 0) = x"01" else
|
'0';
|
'0';
|
|
|
o_request_dev_dep_msg_in <=
|
o_request_dev_dep_msg_in <=
|
'1' when i_rx_data(7 downto 0) = x"02" else
|
'1' when s_msg_id(7 downto 0) = x"02" else
|
'0';
|
'0';
|
|
|
o_eom_bit_detected <=
|
o_eom_bit_detected <=
|
'1' when i_rx_data(15 downto 8) = b"00000001" else
|
'1' when i_rx_data(15 downto 8) = b"00000001" else
|
'0';
|
'0';
|
Line 315... |
Line 318... |
case i_send_mux_sel is
|
case i_send_mux_sel is
|
when "000" => o_tx_data <= x"02" & s_btag; -- MsgID and stored bTag
|
when "000" => o_tx_data <= x"02" & s_btag; -- MsgID and stored bTag
|
when "001" => o_tx_data <= s_nbtag & x"00"; -- inverted bTag and Reserved
|
when "001" => o_tx_data <= s_nbtag & x"00"; -- inverted bTag and Reserved
|
when "010" => o_tx_data <= s_send_transfersize_reg(15 downto 0);
|
when "010" => o_tx_data <= s_send_transfersize_reg(15 downto 0);
|
when "011" => o_tx_data <= s_send_transfersize_reg(31 downto 16);
|
when "011" => o_tx_data <= s_send_transfersize_reg(31 downto 16);
|
when "100" => o_tx_data <= x"0001"; -- TransferAttributes: EOM = 1
|
--TransferAttributes EOM bit:
|
|
when "100" => o_tx_data <= b"000000000000000" & i_send_have_more_data;
|
when "101" => o_tx_data <= x"0000"; -- Header byte 10 and 11, Reserved
|
when "101" => o_tx_data <= x"0000"; -- Header byte 10 and 11, Reserved
|
when "110" => o_tx_data <= s_send_fifo_data; -- message data
|
when "110" => o_tx_data <= s_send_fifo_data; -- message data
|
when others => o_tx_data <= s_send_fifo_data;
|
when others => o_tx_data <= s_send_fifo_data;
|
end case;
|
end case;
|
end process tx_data_mux;
|
end process tx_data_mux;
|
Line 330... |
Line 334... |
-- inputs : i_sysclk, i_nReset, i_receive_newdata_set,
|
-- inputs : i_sysclk, i_nReset, i_receive_newdata_set,
|
-- i_receive_end_of_message_set, s_send_data_request_set,
|
-- i_receive_end_of_message_set, s_send_data_request_set,
|
-- i_receive_fifo_rd_en, s_receive_fifo_empty, i_send_fifo_wr_en
|
-- i_receive_fifo_rd_en, s_receive_fifo_empty, i_send_fifo_wr_en
|
-- outputs: o_receive_newdata, o_receive_end_of_message, o_send_data_request
|
-- outputs: o_receive_newdata, o_receive_end_of_message, o_send_data_request
|
gecko3com_simple_flags: process (i_sysclk, i_nReset)
|
gecko3com_simple_flags: process (i_sysclk, i_nReset)
|
|
variable v_receive_fifo_empty_old : std_logic;
|
begin -- process gecko3com_simple_flags
|
begin -- process gecko3com_simple_flags
|
if i_nReset = '0' then -- asynchronous reset (active low)
|
if i_nReset = '0' then -- asynchronous reset (active low)
|
o_receive_newdata <= '0';
|
o_receive_newdata <= '0';
|
o_receive_end_of_message <= '0';
|
o_receive_end_of_message <= '0';
|
o_send_data_request <= '0';
|
o_send_data_request <= '0';
|
|
v_receive_fifo_empty_old := '0';
|
elsif i_sysclk'event and i_sysclk = '1' then -- rising clock edge
|
elsif i_sysclk'event and i_sysclk = '1' then -- rising clock edge
|
if i_receive_newdata_set = '1' then
|
if i_receive_newdata_set = '1' then
|
o_receive_newdata <= '1';
|
o_receive_newdata <= '1';
|
end if;
|
end if;
|
if i_receive_fifo_rd_en = '1' then
|
if i_receive_fifo_rd_en = '1' then
|
Line 346... |
Line 352... |
end if;
|
end if;
|
|
|
if i_receive_end_of_message_set = '1' then
|
if i_receive_end_of_message_set = '1' then
|
o_receive_end_of_message <= '1';
|
o_receive_end_of_message <= '1';
|
end if;
|
end if;
|
if s_receive_fifo_empty = '1' then
|
if s_receive_fifo_empty = '1' and v_receive_fifo_empty_old = '0' then
|
o_receive_end_of_message <= '0';
|
o_receive_end_of_message <= '0';
|
end if;
|
end if;
|
|
v_receive_fifo_empty_old := s_receive_fifo_empty;
|
|
|
if i_send_data_request_set = '1' then
|
if i_send_data_request_set = '1' then
|
o_send_data_request <= '1';
|
o_send_data_request <= '1';
|
end if;
|
end if;
|
if i_send_fifo_wr_en = '1' then
|
if i_send_fifo_wr_en = '1' then
|