Line 162... |
Line 162... |
--
|
--
|
-- Combinatorial process
|
-- Combinatorial process
|
--
|
--
|
process (r, rstn, msti, ahbi) is
|
process (r, rstn, msti, ahbi) is
|
variable v: regs_type;
|
variable v: regs_type;
|
|
variable v_hrdata: std_logic_vector(31 downto 0);
|
variable v_burstreq: std_logic;
|
variable v_burstreq: std_logic;
|
variable v_burstack: std_logic;
|
variable v_burstack: std_logic;
|
variable v_rxfifo_read: std_logic;
|
variable v_rxfifo_read: std_logic;
|
variable v_txfifo_write: std_logic;
|
variable v_txfifo_write: std_logic;
|
variable v_txfifo_wdata: std_logic_vector(35 downto 0);
|
variable v_txfifo_wdata: std_logic_vector(35 downto 0);
|
begin
|
begin
|
v := r;
|
v := r;
|
|
|
|
-- Decode AHB data bus (64-bit AHB compatibility).
|
|
v_hrdata := ahbreadword(ahbi.hrdata);
|
|
|
-- Assume no burst request.
|
-- Assume no burst request.
|
v_burstreq := '0';
|
v_burstreq := '0';
|
|
|
-- Detect request from burst state machine for next data word.
|
-- Detect request from burst state machine for next data word.
|
v_burstack := ahbi.hready and
|
v_burstack := ahbi.hready and
|
Line 181... |
Line 185... |
|
|
-- Assume no fifo activity; take data for TX fifo from AHB bus.
|
-- Assume no fifo activity; take data for TX fifo from AHB bus.
|
v_rxfifo_read := '0';
|
v_rxfifo_read := '0';
|
v_txfifo_write := '0';
|
v_txfifo_write := '0';
|
v_txfifo_wdata(35 downto 32) := (others => '0');
|
v_txfifo_wdata(35 downto 32) := (others => '0');
|
v_txfifo_wdata(31 downto 0) := ahbi.hrdata;
|
v_txfifo_wdata(31 downto 0) := v_hrdata;
|
|
|
-- Reset registers for interrupts and descriptor updates.
|
-- Reset registers for interrupts and descriptor updates.
|
v.int_rxdesc := '0';
|
v.int_rxdesc := '0';
|
v.int_txdesc := '0';
|
v.int_txdesc := '0';
|
v.int_rxpacket := '0';
|
v.int_rxpacket := '0';
|
Line 259... |
Line 263... |
|
|
when st_rxgetdesc =>
|
when st_rxgetdesc =>
|
-- Read RX descriptor flags from memory.
|
-- Read RX descriptor flags from memory.
|
v_burstreq := '1';
|
v_burstreq := '1';
|
v.hwrite := '0';
|
v.hwrite := '0';
|
v.rxdes_len := ahbi.hrdata(15 downto 2);
|
v.rxdes_len := v_hrdata(15 downto 2);
|
v.rxdes_en := ahbi.hrdata(16);
|
v.rxdes_en := v_hrdata(16);
|
v.rxdes_wr := ahbi.hrdata(17);
|
v.rxdes_wr := v_hrdata(17);
|
v.rxdes_ie := ahbi.hrdata(18);
|
v.rxdes_ie := v_hrdata(18);
|
v.rxdes_eop := '0';
|
v.rxdes_eop := '0';
|
v.rxdes_eep := '0';
|
v.rxdes_eep := '0';
|
v.rxdes_pos := (others => '0');
|
v.rxdes_pos := (others => '0');
|
if v_burstack = '1' then
|
if v_burstack = '1' then
|
-- Got descriptor flags.
|
-- Got descriptor flags.
|
Line 274... |
Line 278... |
v.mstate := st_rxgetptr;
|
v.mstate := st_rxgetptr;
|
end if;
|
end if;
|
|
|
when st_rxgetptr =>
|
when st_rxgetptr =>
|
-- Read RX data pointer from memory.
|
-- Read RX data pointer from memory.
|
v.rxaddr := ahbi.hrdata(31 downto 2);
|
v.rxaddr := v_hrdata(31 downto 2);
|
v.haddr := ahbi.hrdata(31 downto 2);
|
v.haddr := v_hrdata(31 downto 2);
|
v.firstword := '1';
|
v.firstword := '1';
|
if v_burstack = '1' then
|
if v_burstack = '1' then
|
-- Got data pointer.
|
-- Got data pointer.
|
if r.rxdes_en = '1' then
|
if r.rxdes_en = '1' then
|
-- Start transfer.
|
-- Start transfer.
|
Line 381... |
Line 385... |
|
|
when st_txgetdesc =>
|
when st_txgetdesc =>
|
-- Read TX descriptor flags from memory.
|
-- Read TX descriptor flags from memory.
|
v_burstreq := '1';
|
v_burstreq := '1';
|
v.hwrite := '0';
|
v.hwrite := '0';
|
v.txdes_len := ahbi.hrdata(15 downto 0);
|
v.txdes_len := v_hrdata(15 downto 0);
|
v.txdes_en := ahbi.hrdata(16);
|
v.txdes_en := v_hrdata(16);
|
v.txdes_wr := ahbi.hrdata(17);
|
v.txdes_wr := v_hrdata(17);
|
v.txdes_ie := ahbi.hrdata(18);
|
v.txdes_ie := v_hrdata(18);
|
v.txdes_eop := ahbi.hrdata(20);
|
v.txdes_eop := v_hrdata(20);
|
v.txdes_eep := ahbi.hrdata(21);
|
v.txdes_eep := v_hrdata(21);
|
if v_burstack = '1' then
|
if v_burstack = '1' then
|
-- Got descriptor flags.
|
-- Got descriptor flags.
|
v_burstreq := '0';
|
v_burstreq := '0';
|
v.mstate := st_txgetptr;
|
v.mstate := st_txgetptr;
|
end if;
|
end if;
|
|
|
when st_txgetptr =>
|
when st_txgetptr =>
|
-- Read TX data pointer from memory.
|
-- Read TX data pointer from memory.
|
v.txaddr := ahbi.hrdata(31 downto 2);
|
v.txaddr := v_hrdata(31 downto 2);
|
if v_burstack = '1' then
|
if v_burstack = '1' then
|
-- Got data pointer.
|
-- Got data pointer.
|
if r.txdes_en = '1' then
|
if r.txdes_en = '1' then
|
-- Start transfer.
|
-- Start transfer.
|
if unsigned(r.txdes_len) = 0 then
|
if unsigned(r.txdes_len) = 0 then
|
Line 410... |
Line 414... |
v.txdesc_next := '1';
|
v.txdesc_next := '1';
|
v.mstate := st_txputdesc;
|
v.mstate := st_txputdesc;
|
else
|
else
|
v_burstreq := '1';
|
v_burstreq := '1';
|
v.hwrite := '0';
|
v.hwrite := '0';
|
v.haddr := ahbi.hrdata(31 downto 2);
|
v.haddr := v_hrdata(31 downto 2);
|
if unsigned(r.txdes_len) <= 4 then
|
if unsigned(r.txdes_len) <= 4 then
|
-- Transfer only one word.
|
-- Transfer only one word.
|
v.mstate := st_txfinal;
|
v.mstate := st_txfinal;
|
else
|
else
|
v.mstate := st_txtransfer;
|
v.mstate := st_txtransfer;
|
Line 681... |
Line 685... |
else
|
else
|
ahbo.htrans <= HTRANS_IDLE;
|
ahbo.htrans <= HTRANS_IDLE;
|
end if;
|
end if;
|
ahbo.haddr <= r.haddr & "00";
|
ahbo.haddr <= r.haddr & "00";
|
ahbo.hwrite <= r.hwrite;
|
ahbo.hwrite <= r.hwrite;
|
ahbo.hwdata <= r.hwdata;
|
ahbo.hwdata <= ahbdrivedata(r.hwdata);
|
ahbo.hlock <= '0'; -- never lock the bus
|
ahbo.hlock <= '0'; -- never lock the bus
|
ahbo.hsize <= HSIZE_WORD; -- always 32-bit words
|
ahbo.hsize <= HSIZE_WORD; -- always 32-bit words
|
ahbo.hburst <= HBURST_INCR; -- undetermined incremental burst
|
ahbo.hburst <= HBURST_INCR; -- undetermined incremental burst
|
ahbo.hprot <= "0011"; -- not cacheable, privileged, data
|
ahbo.hprot <= "0011"; -- not cacheable, privileged, data
|
ahbo.hirq <= (others => '0'); -- no interrupts via AHB bus
|
ahbo.hirq <= (others => '0'); -- no interrupts via AHB bus
|