- cleaned up
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@859 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
+58
-58
@@ -67,18 +67,18 @@ ARCHITECTURE behavior OF emac_rx IS
|
||||
signal ram_en_b : std_logic;
|
||||
signal ram_addr_b : word_ptr_t;
|
||||
|
||||
signal sipo_32bit_dout : unsigned(31 downto 0);
|
||||
signal sipo_32bit_dout_be : unsigned(3 downto 0);
|
||||
signal sipo_32bit_dout_vld : std_logic;
|
||||
signal sipo_32bit_dout_en : std_logic;
|
||||
signal sipo_32bit_en : std_logic;
|
||||
signal sipo_32bit_rst : std_logic;
|
||||
signal sipo32_dout : unsigned(31 downto 0);
|
||||
signal sipo32_dout_be : unsigned(3 downto 0);
|
||||
signal sipo32_dout_vld : std_logic;
|
||||
signal sipo32_dout_en : std_logic;
|
||||
signal sipo32_en : std_logic;
|
||||
signal sipo32_rst : std_logic;
|
||||
|
||||
signal sipo_8bit_dout : unsigned(7 downto 0);
|
||||
signal sipo_8bit_rst : std_logic;
|
||||
signal sipo_8bit_dout_vld : std_logic;
|
||||
signal sipo_8bit_dout_en : std_logic;
|
||||
signal sipo_8bit_en : std_logic;
|
||||
signal sipo8_dout : unsigned(7 downto 0);
|
||||
signal sipo8_rst : std_logic;
|
||||
signal sipo8_dout_vld : std_logic;
|
||||
signal sipo8_dout_en : std_logic;
|
||||
signal sipo8_en : std_logic;
|
||||
|
||||
signal byte_count_en : std_logic;
|
||||
signal byte_count : word_ptr_t;
|
||||
@@ -134,9 +134,9 @@ begin
|
||||
ram_addr_b <= fill_ptr;
|
||||
|
||||
ram_en_a <= '1';
|
||||
ram_din_a <= sipo_32bit_dout;
|
||||
ram_din_a <= sipo32_dout;
|
||||
ram_addr_a <= xfer_ptr;
|
||||
ram_we_a <= xfer_en and sipo_32bit_dout_vld;
|
||||
ram_we_a <= xfer_en and sipo32_dout_vld;
|
||||
|
||||
xfer_vld <= not xfer_ram_full and (mac_chk_OK or mac_chk_BC or ctrl_in.promiscious);
|
||||
cmd_fifo_we <= commit_en;
|
||||
@@ -212,7 +212,7 @@ xfer_ram_full_detect:
|
||||
if rising_edge(mii_rx_clk) then
|
||||
if xfer_set = '1' or reset_en = '1' then
|
||||
xfer_ram_full <= '0';
|
||||
elsif xfer_en = '1' and sipo_32bit_dout_vld = '1' then
|
||||
elsif xfer_en = '1' and sipo32_dout_vld = '1' then
|
||||
if xfer_ptr = xfer_ram_limit then
|
||||
xfer_ram_full <= '1';
|
||||
end if;
|
||||
@@ -239,7 +239,7 @@ xfer_pointer:
|
||||
if rising_edge(mii_rx_clk) then
|
||||
if xfer_set = '1' then
|
||||
xfer_ptr <= xfer_base;
|
||||
elsif xfer_en = '1' and sipo_32bit_dout_vld = '1' then
|
||||
elsif xfer_en = '1' and sipo32_dout_vld = '1' then
|
||||
xfer_ptr <= xfer_ptr + 1;
|
||||
end if;
|
||||
end if;
|
||||
@@ -251,9 +251,9 @@ byte_counter:
|
||||
process(mii_rx_clk)
|
||||
begin
|
||||
if rising_edge(mii_rx_clk) then
|
||||
if sipo_8bit_rst = '1' then
|
||||
if sipo8_rst = '1' then
|
||||
byte_count <= (others => '0');
|
||||
elsif byte_count_en = '1' and sipo_8bit_dout_vld = '1' then
|
||||
elsif byte_count_en = '1' and sipo8_dout_vld = '1' then
|
||||
byte_count <= byte_count + 1;
|
||||
end if;
|
||||
end if;
|
||||
@@ -263,7 +263,7 @@ byte_count_register:
|
||||
process(mii_rx_clk)
|
||||
begin
|
||||
if rising_edge(mii_rx_clk) then
|
||||
if sipo_8bit_rst = '1' then
|
||||
if sipo8_rst = '1' then
|
||||
byte_count_reg <= byte_count;
|
||||
end if;
|
||||
end if;
|
||||
@@ -277,13 +277,13 @@ preamble_sync_logic:
|
||||
preamble_rdy <= '0';
|
||||
preamble_bsy <= '0';
|
||||
preamble_OK <= '0';
|
||||
elsif sipo_8bit_dout_vld = '1' then
|
||||
elsif sipo8_dout_vld = '1' then
|
||||
if preamble_bsy = '1' then
|
||||
if sipo_8bit_dout = X"D5" then
|
||||
if sipo8_dout = X"D5" then
|
||||
preamble_OK <= '1';
|
||||
end if;
|
||||
end if;
|
||||
if sipo_8bit_dout /= X"55" then
|
||||
if sipo8_dout /= X"55" then
|
||||
preamble_bsy <= '0';
|
||||
preamble_rdy <= preamble_bsy;
|
||||
else
|
||||
@@ -312,11 +312,11 @@ mac_check_logic:
|
||||
if mac_chk_num_BC = 6 then
|
||||
mac_chk_BC <= '1';
|
||||
end if;
|
||||
elsif sipo_8bit_dout_vld = '1' then
|
||||
if sipo_8bit_dout = mac_chk_addr(mac_chk_cnt) then
|
||||
elsif sipo8_dout_vld = '1' then
|
||||
if sipo8_dout = mac_chk_addr(mac_chk_cnt) then
|
||||
mac_chk_num_OK <= mac_chk_num_OK + 1;
|
||||
end if;
|
||||
if sipo_8bit_dout = X"FF" then
|
||||
if sipo8_dout = X"FF" then
|
||||
mac_chk_num_BC <= mac_chk_num_BC + 1;
|
||||
end if;
|
||||
if mac_chk_cnt /= 5 then
|
||||
@@ -342,68 +342,68 @@ xfer_state_next:
|
||||
end process;
|
||||
|
||||
xfer_state:
|
||||
process(xfer_s, reset_en, sipo_8bit_dout_en, sipo_8bit_dout, sipo_32bit_dout_en, sipo_32bit_dout_vld, preamble_rdy, preamble_OK, xfer_ram_full, xfer_vld)
|
||||
process(xfer_s, reset_en, sipo8_dout_en, sipo8_dout, sipo32_dout_en, sipo32_dout_vld, preamble_rdy, preamble_OK, xfer_ram_full, xfer_vld)
|
||||
begin
|
||||
|
||||
commit_en <= '0';
|
||||
xfer_set <= '0';
|
||||
xfer_en <= '0';
|
||||
sipo_32bit_en <= '0';
|
||||
sipo_32bit_rst <= reset_en;
|
||||
sipo_8bit_rst <= reset_en;
|
||||
sipo32_en <= '0';
|
||||
sipo32_rst <= reset_en;
|
||||
sipo8_rst <= reset_en;
|
||||
byte_count_en <= '0';
|
||||
preamble_rst <= reset_en;
|
||||
mac_chk_rst <= reset_en;
|
||||
|
||||
sipo_32bit_en <= sipo_8bit_dout_en;
|
||||
sipo32_en <= sipo8_dout_en;
|
||||
|
||||
xfer_sn <= xfer_s;
|
||||
|
||||
case xfer_s is
|
||||
|
||||
when xfer_init =>
|
||||
if sipo_8bit_dout_en = '0' then
|
||||
if sipo8_dout_en = '0' then
|
||||
xfer_sn <= xfer_reset;
|
||||
end if;
|
||||
|
||||
when xfer_reset =>
|
||||
sipo_32bit_rst <= '1';
|
||||
sipo_8bit_rst <= '1';
|
||||
sipo32_rst <= '1';
|
||||
sipo8_rst <= '1';
|
||||
preamble_rst <= '1';
|
||||
xfer_sn <= xfer_idle;
|
||||
|
||||
when xfer_idle =>
|
||||
sipo_32bit_en <= '0';
|
||||
sipo32_en <= '0';
|
||||
if preamble_rdy = '1' then
|
||||
xfer_sn <= xfer_init;
|
||||
if preamble_OK = '1' then
|
||||
byte_count_en <= '1';
|
||||
mac_chk_rst <= '1';
|
||||
sipo_32bit_rst <= '1';
|
||||
sipo32_rst <= '1';
|
||||
xfer_sn <= xfer_setup;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
when xfer_setup =>
|
||||
xfer_set <= '1';
|
||||
xfer_en <= sipo_32bit_dout_en;
|
||||
byte_count_en <= sipo_8bit_dout_en;
|
||||
xfer_en <= sipo32_dout_en;
|
||||
byte_count_en <= sipo8_dout_en;
|
||||
xfer_sn <= xfer_active;
|
||||
|
||||
when xfer_active =>
|
||||
xfer_en <= sipo_32bit_dout_en;
|
||||
byte_count_en <= sipo_8bit_dout_en;
|
||||
xfer_en <= sipo32_dout_en;
|
||||
byte_count_en <= sipo8_dout_en;
|
||||
if xfer_ram_full = '1' then
|
||||
xfer_sn <= xfer_finish;
|
||||
elsif sipo_8bit_dout_en = '0' then
|
||||
elsif sipo8_dout_en = '0' then
|
||||
xfer_sn <= xfer_stop;
|
||||
sipo_8bit_rst <= '1';
|
||||
sipo8_rst <= '1';
|
||||
end if;
|
||||
|
||||
when xfer_stop =>
|
||||
xfer_en <= sipo_32bit_dout_en;
|
||||
byte_count_en <= sipo_8bit_dout_en;
|
||||
if sipo_32bit_dout_en = '0' then
|
||||
xfer_en <= sipo32_dout_en;
|
||||
byte_count_en <= sipo8_dout_en;
|
||||
if sipo32_dout_en = '0' then
|
||||
xfer_sn <= xfer_finish;
|
||||
end if;
|
||||
|
||||
@@ -460,7 +460,7 @@ inst_ram : entity work.dpram_1w1r
|
||||
dout_b => ram_dout_b
|
||||
);
|
||||
|
||||
inst_sipo : entity work.sipo
|
||||
inst_sipo32 : entity work.sipo
|
||||
GENERIC MAP
|
||||
(
|
||||
data_width_in => 8,
|
||||
@@ -469,15 +469,15 @@ inst_sipo : entity work.sipo
|
||||
)
|
||||
PORT MAP
|
||||
(
|
||||
rst => sipo_32bit_rst,
|
||||
rst => sipo32_rst,
|
||||
clk => mii_rx_clk,
|
||||
din_vld => sipo_8bit_dout_vld,
|
||||
din_en => sipo_32bit_en,
|
||||
din => sipo_8bit_dout,
|
||||
dout_be => sipo_32bit_dout_be,
|
||||
dout_vld => sipo_32bit_dout_vld,
|
||||
dout => sipo_32bit_dout,
|
||||
dout_en => sipo_32bit_dout_en
|
||||
din_vld => sipo8_dout_vld,
|
||||
din_en => sipo32_en,
|
||||
din => sipo8_dout,
|
||||
dout_be => sipo32_dout_be,
|
||||
dout_vld => sipo32_dout_vld,
|
||||
dout => sipo32_dout,
|
||||
dout_en => sipo32_dout_en
|
||||
|
||||
);
|
||||
|
||||
@@ -491,17 +491,17 @@ inst_sipo_8bit : entity work.sipo
|
||||
)
|
||||
PORT MAP
|
||||
(
|
||||
rst => sipo_8bit_rst,
|
||||
rst => sipo8_rst,
|
||||
clk => mii_rx_clk,
|
||||
din_vld => mii_rx_dv,
|
||||
din_en => sipo_8bit_en,
|
||||
din_en => sipo8_en,
|
||||
din => mii_rx(3 downto 0),
|
||||
dout_be => open,
|
||||
dout_vld => sipo_8bit_dout_vld,
|
||||
dout => sipo_8bit_dout,
|
||||
dout_en => sipo_8bit_dout_en
|
||||
dout_vld => sipo8_dout_vld,
|
||||
dout => sipo8_dout,
|
||||
dout_en => sipo8_dout_en
|
||||
|
||||
);
|
||||
sipo_8bit_en <= mii_rx_dv;
|
||||
sipo8_en <= mii_rx_dv;
|
||||
|
||||
end behavior;
|
||||
|
||||
Reference in New Issue
Block a user