30use ieee.std_logic_1164.
all;
31use ieee.numeric_std.
all;
42 CNTL : in rlink_tba_cntl_type;
44 STAT : out rlink_tba_stat_type;
61 subtype f_byte1 is integer range 15 downto 8;
62 subtype f_byte0 is integer range 7 downto 0;
142 end record rxregs_type;
167 signal STAT_L : rlink_tba_stat_type := rlink_tba_stat_init;
174 if rising_edge(CLK) then
184 end process proc_regs;
192 variable itxbusy : slbit := '0';
193 variable icpdi : slv9 := (others=>'0');
194 variable iena : slbit := '0';
195 variable ibre : slbit := '0';
196 variable do_crc : slbit := '0';
204 icpdi := (others=>'0');
209 if CNTL.eop='1' and r.state/= s_txidle then
216 if CNTL.ena = '1' then
218 if CNTL.eop = '1' then
221 if r.sopdone = '0' then
222 n.snum := (others=>'0');
228 if CNTL.eop='1' and r.sopdone='1' then
235 icpdi := c_rlink_dat_sop;
238 n.crc := (others=>'0');
245 icpdi := c_rlink_dat_eop;
248 n.crc := (others=>'0');
254 n.braddr := (others=>'0');
255 icpdi(c_rlink_cmd_rbf_seq) := r.snum;
256 icpdi(c_rlink_cmd_rbf_code) := r.ccmd;
260 n.snum := slv(unsigned(r.snum) + 1);
262 when c_rlink_cmd_labo => n.state := s_txcrcl2;
263 when c_rlink_cmd_attn => n.state := s_txcrcl2;
264 when others => n.state := s_txal;
282 when c_rlink_cmd_rreg => n.state := s_txcrcl2;
283 when c_rlink_cmd_rblk => n.state := s_txcl;
284 when c_rlink_cmd_wblk => n.state := s_txcl;
285 when others => n.state := s_txdl;
302 if r.ccmd = c_rlink_cmd_wblk then
303 n.state := s_txcrcl1;
305 n.state := s_txcrcl2;
322 n.state := s_txcrcl2;
329 n.state := s_txcrch1;
345 n.tcnt := slv(unsigned(r.tcnt) - 1);
346 n.braddr := slv(unsigned(r.braddr) + 1);
347 if unsigned(r.tcnt) = 1 then
355 icpdi := '0' & r.bdata(f_byte0);
363 icpdi := '0' & r.bdata(f_byte1);
367 if r.bloop = '1' then
370 n.state := s_txcrcl2;
378 n.state := s_txcrch2;
385 if r.eoppend = '1' or unsigned(r.snum)=31 then
396 n.crc := crc16_update(r.crc, icpdi(d_f_data));
403 STAT_L.braddr <= r.braddr;
409 end process proc_txnext;
417 variable irxbusy : slbit := '0';
418 variable ibwe : slbit := '0';
419 variable do_crc : slbit := '0';
420 variable ido : slv16 := (others=>'0');
437 n.crc := (others=>'0');
441 if RL_DO = c_rlink_dat_attn then
443 elsif RL_DO = c_rlink_dat_sop then
452 if RL_DO = c_rlink_dat_eop then
455 n.bwaddr := (others=>'0');
457 n.ccmd := RL_DO(n.ccmd'range);
458 case RL_DO(n.ccmd'range) is
459 when c_rlink_cmd_rreg => n.state := s_rxdl;
460 when c_rlink_cmd_rblk => n.state := s_rxcl;
461 when c_rlink_cmd_wreg => n.state := s_rxstat;
462 when c_rlink_cmd_wblk => n.state := s_rxdcl;
463 when c_rlink_cmd_labo => n.state := s_rxbabo;
464 when c_rlink_cmd_attn => n.state := s_rxdl;
465 when c_rlink_cmd_init => n.state := s_rxstat;
490 n.data(15 downto 0) := (others=>'0');
506 n.tcnt := slv(unsigned(r.tcnt) - 1);
507 n.bwaddr := slv(unsigned(r.bwaddr) + 1);
508 if r.ccmd = c_rlink_cmd_rblk then
512 if r.ccmd /= c_rlink_cmd_rblk then
514 elsif unsigned(r.tcnt) = 1 then
539 n.apend := RL_DO(c_rlink_stat_rbf_attn);
606 STAT_L.bwaddr <= r.bwaddr;
615 end process proc_rxnext;
integer range 15 downto 8 f_byte1
integer range 7 downto 0 d_f_data
rlink_tba_stat_type := rlink_tba_stat_init STAT_L
txregs_type := txregs_init N_TXREGS
integer range 7 downto 0 f_byte0
txregs_type := txregs_init R_TXREGS
rxregs_type := rxregs_init R_RXREGS
txregs_type :=( s_txidle, "000", "00000",( others => '0'),( others => '0'),( others => '0'), '0',( others => '0'), '0', '0') txregs_init
(s_txidle,s_txsop,s_txeop,s_txcmd,s_txal,s_txah,s_txcl,s_txch,s_txdl,s_txdh,s_txcrcl1,s_txcrch1,s_txwbld,s_txwbdl,s_txwbdh,s_txcrcl2,s_txcrch2) txstate_type
rxregs_type :=( s_rxidle, "000",( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0'), '0', '0',( others => '0'), '0', '0',( others => '0')) rxregs_init
(s_rxidle,s_rxcmd,s_rxcl,s_rxch,s_rxbabo,s_rxdcl,s_rxdch,s_rxdl,s_rxdh,s_rxstat,s_rxcrcl,s_rxcrch,s_rxapl,s_rxaph,s_rxacl,s_rxach) rxstate_type
rxregs_type := rxregs_init N_RXREGS
in CNTL rlink_tba_cntl_type
out STAT rlink_tba_stat_type
std_logic_vector( 4 downto 0) slv5
std_logic_vector( 2 downto 0) slv3
std_logic_vector( 8 downto 0) slv9
std_logic_vector( 15 downto 0) slv16
std_logic_vector( 7 downto 0) slv8