OpenCores
URL https://opencores.org/ocsvn/artec_dongle_ii_fpga/artec_dongle_ii_fpga/trunk

Subversion Repositories artec_dongle_ii_fpga

[/] [artec_dongle_ii_fpga/] [trunk/] [src/] [usb/] [usb2mem.vhd] - Diff between revs 6 and 9

Show entire file | Details | Blame | View Log

Rev 6 Rev 9
Line 74... Line 74...
        usb_mode_en: in   std_logic;  -- enable this block 
        usb_mode_en: in   std_logic;  -- enable this block 
    usb_rd_n   : out  std_logic;  -- enables out data if low (next byte detected by edge / in usb chip)
    usb_rd_n   : out  std_logic;  -- enables out data if low (next byte detected by edge / in usb chip)
    usb_wr     : out  std_logic;  -- write performed on edge \ of signal
    usb_wr     : out  std_logic;  -- write performed on edge \ of signal
    usb_txe_n  : in   std_logic;  -- tx fifo empty (redy for new data if low)
    usb_txe_n  : in   std_logic;  -- tx fifo empty (redy for new data if low)
    usb_rxf_n  : in   std_logic;  -- rx fifo empty (data redy if low)
    usb_rxf_n  : in   std_logic;  -- rx fifo empty (data redy if low)
    usb_bd     : inout  std_logic_vector(7 downto 0) --bus data
    usb_bd_o   : out  std_logic_vector(7 downto 0); --bus data
 
         usb_bd     : in   std_logic_vector(7 downto 0) --bus data
    );
    );
end usb2mem;
end usb2mem;
 
 
 
 
architecture RTL of usb2mem is
architecture RTL of usb2mem is
Line 99... Line 100...
  signal cmd_cnt   : std_logic_vector(15 downto 0);
  signal cmd_cnt   : std_logic_vector(15 downto 0);
  signal state_cnt : std_logic_vector(3 downto 0);
  signal state_cnt : std_logic_vector(3 downto 0);
  --shyncro to USB
  --shyncro to USB
  signal usb_txe_nd  :    std_logic;  -- tx fifo empty (redy for new data if low)
  signal usb_txe_nd  :    std_logic;  -- tx fifo empty (redy for new data if low)
  signal usb_rxf_nd  :    std_logic;  -- rx fifo empty (data redy if low)
  signal usb_rxf_nd  :    std_logic;  -- rx fifo empty (data redy if low)
  signal internal_cmd  :    std_logic;  -- rx fifo empty (data redy if low)
  --signal internal_cmd  :    std_logic;  -- rx fifo empty (data redy if low)
 
 
  signal read_mode   : std_logic;
  signal read_mode   : std_logic;
  signal write_mode  : std_logic;
  --signal write_mode  : std_logic;
  signal write_count : std_logic;
  signal write_count : std_logic;
  signal first_word : std_logic;
  signal first_word : std_logic;
  signal mem_busy_nd : std_logic;
  signal mem_busy_nd : std_logic;
 
 
 
 
 
 
begin
begin
 
 
--define internal command codes
usb_wr <= usb_wr_d;
internal_cmd <='1' when data_reg_i(7 downto 0) = x"C5" else
 
                                        '1' when data_reg_i(7 downto 0) = x"CD" else
 
                                        '1' when data_reg_i(7 downto 0) = x"A0" else
 
                                        '1' when data_reg_i(7 downto 0) = x"A1" else
 
                                        '1' when data_reg_i(7 downto 0) = x"A2" else
 
                                        '1' when data_reg_i(7 downto 0) = x"3F" else
 
                                        --These are spechial attention Flash commands
 
                                        '1' when data_reg_i(7 downto 0) = x"E8" else
 
                                        '1' when data_reg_i(7 downto 0) = x"E9" else
 
                                        '0';
 
 
 
 
 
usb_wr <= usb_wr_d when usb_mode_en='1' else
 
                  'Z';
 
 
 
 
 
-- this goes to byte buffer for that reason send LSB first and MSB second
-- this goes to byte buffer for that reason send LSB first and MSB second
usb_bd <=data_reg_o(7 downto 0)when data_oe='1' and CS=TXCMD0s and usb_mode_en='1' else --LSB byte first
usb_bd_o <=data_reg_o(7 downto 0)when data_oe='1' and CS=TXCMD0s and usb_mode_en='1' else --LSB byte first
                        data_reg_o(15 downto 8) when data_oe='1' and CS=TXCMD1s and usb_mode_en='1' else --MSB byte second
                          data_reg_o(15 downto 8) when data_oe='1' and CS=TXCMD1s and usb_mode_en='1' else
                        (others=>'Z');
                          (others=>'0');
 
 
 
 
process (clk25,reset_n)  --enable the scanning while in reset (simulation will be incorrect)
process (clk25,reset_n)  --enable the scanning while in reset (simulation will be incorrect)
begin  -- process
begin  -- process
  if reset_n='0' then
  if reset_n='0' then
Line 144... Line 130...
        usb_wr_d <= '0';
        usb_wr_d <= '0';
        usb_txe_nd <= '1';
        usb_txe_nd <= '1';
        usb_rxf_nd <= '1';
        usb_rxf_nd <= '1';
        data_oe <='0';
        data_oe <='0';
        state_cnt <=(others=>'0'); --init command counter
        state_cnt <=(others=>'0'); --init command counter
        mem_do <= (others=>'Z');
        mem_do <= (others=>'0');
        mem_addr <= (others=>'Z');
        mem_addr <= (others=>'0');
        addr_reg <= (others=>'0');
        addr_reg <= (others=>'0');
        mem_val <= '0';
        mem_val <= '0';
        mem_wr <='0';
        mem_wr <='0';
        mem_cmd <='0';
        mem_cmd <='0';
        cmd_cnt <= (others=>'0');
        cmd_cnt <= (others=>'0');
        read_mode <='0';
        read_mode <='0';
        write_mode <='0';
 
        write_count <='0';
        write_count <='0';
        first_word <='0';
        first_word <='0';
        mem_idle <='1'; --set idle
        mem_idle <='1'; --set idle
        mem_busy_nd <='1';
        mem_busy_nd <='1';
        usb_buf_en <='1'; -- default mode (USB prog disabled, buffer with HiZ outputs)
        usb_buf_en <='1'; -- default mode (USB prog disabled, buffer with HiZ outputs)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.