Line 130... |
Line 130... |
signal Reg_Wr_En_q : std_logic := '0';
|
signal Reg_Wr_En_q : std_logic := '0';
|
signal TX_Ctl_Clk : std_logic := '0';
|
signal TX_Ctl_Clk : std_logic := '0';
|
signal TX_Ctl_Len : std_logic := '0';
|
signal TX_Ctl_Len : std_logic := '0';
|
|
|
-- Dual-port memory
|
-- Dual-port memory
|
signal DP_Addr : std_logic_vector(8 downto 0);
|
signal DP_B_Addr : std_logic_vector(8 downto 0);
|
signal DP_Wr_Data : DATA_TYPE;
|
signal DP_B_Wr_Data : DATA_TYPE;
|
signal DP_Wr_En : std_logic;
|
signal DP_B_Wr_En : std_logic;
|
signal DP_Rd_Data : DATA_TYPE;
|
signal DP_B_Rd_Data : DATA_TYPE;
|
|
|
alias DP_B_Addr is DP_Addr;
|
|
alias DP_B_Wr_Data is DP_Wr_Data;
|
|
alias DP_B_Wr_En is DP_Wr_En;
|
|
alias DP_B_Rd_Data is DP_Rd_Data;
|
|
|
|
-- Internal definitions
|
-- Internal definitions
|
constant SDLC_Flag : DATA_TYPE := x"7E";
|
constant SDLC_Flag : DATA_TYPE := x"7E";
|
|
|
constant CK_REGISTER : DATA_TYPE := x"FE";
|
constant CK_REGISTER : DATA_TYPE := x"FE";
|
Line 394... |
Line 389... |
RAM_Arbitration_proc: process( Clock, Reset )
|
RAM_Arbitration_proc: process( Clock, Reset )
|
begin
|
begin
|
if( Reset = Reset_Level )then
|
if( Reset = Reset_Level )then
|
DP_Arb_State <= IDLE;
|
DP_Arb_State <= IDLE;
|
DP_Last_Port <= '0';
|
DP_Last_Port <= '0';
|
DP_Addr <= (others => '0');
|
DP_B_Addr <= (others => '0');
|
DP_Wr_Data <= x"00";
|
DP_B_Wr_Data <= x"00";
|
DP_Wr_En <= '0';
|
DP_B_Wr_En <= '0';
|
DP_Port0_RdData <= x"00";
|
DP_Port0_RdData <= x"00";
|
DP_Port0_Ack <= '0';
|
DP_Port0_Ack <= '0';
|
DP_Port1_RdData <= x"00";
|
DP_Port1_RdData <= x"00";
|
DP_Port1_Ack <= '0';
|
DP_Port1_Ack <= '0';
|
elsif( rising_edge(Clock) )then
|
elsif( rising_edge(Clock) )then
|
DP_Port0_Ack <= '0';
|
DP_Port0_Ack <= '0';
|
DP_Port1_Ack <= '0';
|
DP_Port1_Ack <= '0';
|
DP_Wr_En <= '0';
|
DP_B_Wr_En <= '0';
|
|
|
case( DP_Arb_State )is
|
case( DP_Arb_State )is
|
when IDLE =>
|
when IDLE =>
|
if( DP_Port0_Req = '1' and (DP_Port1_Req = '0' or DP_Last_Port = '1') )then
|
if( DP_Port0_Req = '1' and (DP_Port1_Req = '0' or DP_Last_Port = '1') )then
|
DP_Arb_State <= PORT0_AD;
|
DP_Arb_State <= PORT0_AD;
|
Line 416... |
Line 411... |
DP_Arb_State <= PORT1_AD;
|
DP_Arb_State <= PORT1_AD;
|
end if;
|
end if;
|
|
|
when PORT0_AD =>
|
when PORT0_AD =>
|
DP_Last_Port <= '0';
|
DP_Last_Port <= '0';
|
DP_Addr <= '0' & DP_Port0_Addr;
|
DP_B_Addr <= '0' & DP_Port0_Addr;
|
DP_Wr_Data <= DP_Port0_WrData;
|
DP_B_Wr_Data <= DP_Port0_WrData;
|
DP_Wr_En <= not DP_Port0_RWn;
|
DP_B_Wr_En <= not DP_Port0_RWn;
|
if( DP_Port0_RWn = '1' )then
|
if( DP_Port0_RWn = '1' )then
|
DP_Arb_State <= PORT0_RD0;
|
DP_Arb_State <= PORT0_RD0;
|
else
|
else
|
DP_Port0_Ack <= '1';
|
DP_Port0_Ack <= '1';
|
DP_Arb_State <= PORT0_WR;
|
DP_Arb_State <= PORT0_WR;
|
Line 434... |
Line 429... |
when PORT0_RD0 =>
|
when PORT0_RD0 =>
|
DP_Arb_State <= PORT0_RD1;
|
DP_Arb_State <= PORT0_RD1;
|
|
|
when PORT0_RD1 =>
|
when PORT0_RD1 =>
|
DP_Port0_Ack <= '1';
|
DP_Port0_Ack <= '1';
|
DP_Port0_RdData <= DP_Rd_Data;
|
DP_Port0_RdData <= DP_B_Rd_Data;
|
DP_Arb_State <= PAUSE;
|
DP_Arb_State <= PAUSE;
|
|
|
when PORT1_AD =>
|
when PORT1_AD =>
|
DP_Last_Port <= '1';
|
DP_Last_Port <= '1';
|
DP_Addr <= '1' & DP_Port1_Addr;
|
DP_B_Addr <= '1' & DP_Port1_Addr;
|
DP_Wr_Data <= DP_Port1_WrData;
|
DP_B_Wr_Data <= DP_Port1_WrData;
|
DP_Wr_En <= not DP_Port1_RWn;
|
DP_B_Wr_En <= not DP_Port1_RWn;
|
if( DP_Port0_RWn = '1' )then
|
if( DP_Port0_RWn = '1' )then
|
DP_Arb_State <= PORT1_RD0;
|
DP_Arb_State <= PORT1_RD0;
|
else
|
else
|
DP_Port1_Ack <= '1';
|
DP_Port1_Ack <= '1';
|
DP_Arb_State <= PORT1_WR;
|
DP_Arb_State <= PORT1_WR;
|
Line 457... |
Line 452... |
when PORT1_RD0 =>
|
when PORT1_RD0 =>
|
DP_Arb_State <= PORT1_RD1;
|
DP_Arb_State <= PORT1_RD1;
|
|
|
when PORT1_RD1 =>
|
when PORT1_RD1 =>
|
DP_Port1_Ack <= '1';
|
DP_Port1_Ack <= '1';
|
DP_Port1_RdData <= DP_Rd_Data;
|
DP_Port1_RdData <= DP_B_Rd_Data;
|
DP_Arb_State <= PAUSE;
|
DP_Arb_State <= PAUSE;
|
|
|
when PAUSE =>
|
when PAUSE =>
|
DP_Arb_State <= IDLE;
|
DP_Arb_State <= IDLE;
|
|
|