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

Subversion Repositories usb11_phy_translation

[/] [usb11_phy_translation/] [trunk/] [usb_rx_phy.vhdl] - Diff between revs 2 and 3

Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 38... Line 38...
--          //  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          //         --
--          //  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE          //         --
--          //  POSSIBILITY OF SUCH DAMAGE.                                  //         --
--          //  POSSIBILITY OF SUCH DAMAGE.                                  //         --
--          //                                                               //         --
--          //                                                               //         --
--          ///////////////////////////////////////////////////////////////////         --
--          ///////////////////////////////////////////////////////////////////         --
--======================================================================================--
--======================================================================================--
 
--                                                                                      --
 
-- Change history                                                                       --
 
-- +-------+-----------+-------+------------------------------------------------------+ --
 
-- | Vers. | Date      | Autor | Comment                                              | --
 
-- +-------+-----------+-------+------------------------------------------------------+ --
 
-- |  1.0  |04 Feb 2011|  MN   | Initial version                                      | --
 
-- |  1.1  |23 Apr 2011|  MN   | Added 'rst' to most latched signals.                 | --
 
-- |       |           |       | Added ELSE construct in fs_next_state process to     | --
 
-- |       |           |       |   prevent an undesired latch implementation.         | --
 
--======================================================================================--
 
 
library ieee;
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_unsigned.all;
Line 121... Line 131...
    if rising_edge(clk) then
    if rising_edge(clk) then
      rx_en <= RxEn_i;
      rx_en <= RxEn_i;
    end if;
    end if;
  end process;
  end process;
 
 
  p_sync_err: process (clk)
  p_sync_err: process (clk, rst)
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      sync_err <= '0';
 
    elsif rising_edge(clk) then
      sync_err <= not rx_active and sync_err_d;
      sync_err <= not rx_active and sync_err_d;
    end if;
    end if;
  end process;
  end process;
 
 
  --====================================================================================--
  --====================================================================================--
Line 174... Line 186...
 
 
  j   <=     rxdp_s and not rxdn_s;
  j   <=     rxdp_s and not rxdn_s;
  k   <= not rxdp_s and     rxdn_s;
  k   <= not rxdp_s and     rxdn_s;
  se0 <= not rxdp_s and not rxdn_s;
  se0 <= not rxdp_s and not rxdn_s;
 
 
  p_se0_s: process (clk)
  p_se0_s: process (clk, rst)
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      se0_s <= '0';
 
    elsif rising_edge(clk) then
      if fs_ce ='1' then
      if fs_ce ='1' then
        se0_s   <= se0;
        se0_s   <= se0;
      end if;
      end if;
    end if;
    end if;
  end process;
  end process;
Line 277... Line 291...
    if fs_ce='1' and  rx_active='0' and se0='0' and se0_s='0' then
    if fs_ce='1' and  rx_active='0' and se0='0' and se0_s='0' then
      case fs_state is
      case fs_state is
        when FS_IDLE => if k ='1' and rx_en ='1' then -- 0
        when FS_IDLE => if k ='1' and rx_en ='1' then -- 0
                          fs_next_state <= K1;
                          fs_next_state <= K1;
                          sync_err_d    <= '0';
                          sync_err_d    <= '0';
 
                        else
 
                          fs_next_state <= FS_IDLE;
 
                          sync_err_d    <= '0';
                        end if;
                        end if;
        when K1      => if j ='1' and rx_en ='1' then -- 1
        when K1      => if j ='1' and rx_en ='1' then -- 1
                          fs_next_state <= J1;
                          fs_next_state <= J1;
                          sync_err_d    <= '0';
                          sync_err_d    <= '0';
                        else
                        else
Line 358... Line 375...
        rx_active <= '0';
        rx_active <= '0';
      end if;
      end if;
    end if;
    end if;
  end process;
  end process;
 
 
  p_rx_valid_r: process (clk)
  p_rx_valid_r: process (clk, rst)
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      rx_valid_r <= '0';
 
    elsif rising_edge(clk) then
      if rx_valid ='1' then
      if rx_valid ='1' then
        rx_valid_r      <= '1';
        rx_valid_r      <= '1';
      elsif fs_ce ='1' then
      elsif fs_ce ='1' then
        rx_valid_r      <= '0';
        rx_valid_r      <= '0';
      end if;
      end if;
Line 373... Line 392...
 
 
  --====================================================================================--
  --====================================================================================--
  -- NRZI Decoder                                                                       --
  -- NRZI Decoder                                                                       --
  --====================================================================================--
  --====================================================================================--
 
 
  p_sd_r: process (clk)
  p_sd_r: process (clk, rst)
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      sd_r <= '0';
 
    elsif rising_edge(clk) then
      if fs_ce ='1' then
      if fs_ce ='1' then
        sd_r <= rxd_s;
        sd_r <= rxd_s;
      end if;
      end if;
    end if;
    end if;
  end process;
  end process;
Line 418... Line 439...
    end if;
    end if;
  end process;
  end process;
 
 
  drop_bit <= '1' when one_cnt ="110" else '0';
  drop_bit <= '1' when one_cnt ="110" else '0';
 
 
  p_bit_stuff_err: process (clk) -- Bit Stuff Error
  p_bit_stuff_err: process (clk, rst) -- Bit Stuff Error
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      bit_stuff_err <= '0';
 
    elsif rising_edge(clk) then
      bit_stuff_err <= drop_bit and sd_nrzi and fs_ce and not se0 and rx_active;
      bit_stuff_err <= drop_bit and sd_nrzi and fs_ce and not se0 and rx_active;
    end if;
    end if;
  end process;
  end process;
 
 
  --====================================================================================--
  --====================================================================================--
  -- Serial => Parallel converter                                                       --
  -- Serial => Parallel converter                                                       --
  --====================================================================================--
  --====================================================================================--
 
 
  p_shift_en: process (clk)
  p_shift_en: process (clk, rst)
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      shift_en <= '0';
 
    elsif rising_edge(clk) then
      if fs_ce ='1' then
      if fs_ce ='1' then
        shift_en <= synced_d or rx_active;
        shift_en <= synced_d or rx_active;
      end if;
      end if;
    end if;
    end if;
  end process;
  end process;
Line 477... Line 502...
        rx_valid1 <= '0';
        rx_valid1 <= '0';
      end if;
      end if;
    end if;
    end if;
  end process;
  end process;
 
 
  p_rx_valid: process (clk)
  p_rx_valid: process (clk, rst)
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      rx_valid <= '0';
 
    elsif rising_edge(clk) then
      rx_valid <= not drop_bit and rx_valid1 and fs_ce;
      rx_valid <= not drop_bit and rx_valid1 and fs_ce;
    end if;
    end if;
  end process;
  end process;
 
 
  p_se0_r: process (clk)
  p_se0_r: process (clk)
Line 491... Line 518...
    if rising_edge(clk) then
    if rising_edge(clk) then
      se0_r <= se0;
      se0_r <= se0;
    end if;
    end if;
  end process;
  end process;
 
 
  p_byte_err: process (clk)
  p_byte_err: process (clk, rst)
  begin
  begin
    if rising_edge(clk) then
    if rst ='0' then
 
      byte_err <= '0';
 
    elsif rising_edge(clk) then
      byte_err <= se0 and not se0_r and (bit_cnt(1) or bit_cnt(2)) and rx_active;
      byte_err <= se0 and not se0_r and (bit_cnt(1) or bit_cnt(2)) and rx_active;
    end if;
    end if;
  end process;
  end process;
 
 
end RTL;
end RTL;

powered by: WebSVN 2.1.0

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