147use ieee.std_logic_1164.
all;
148use ieee.numeric_std.
all;
358 end record bregs_type;
381 end record cregs_type;
435 report "assert(RTAWIDTH>=11 and RTAWIDTH<=15): unsupported RTAWIDTH"
449 ADDRA => R_LREGS.rtaddra,
450 ADDRB => R_LREGS.rtaddrb,
473 ICRC :
crc16 -- crc generator
for input data
482 OCRC :
crc16 -- crc generator
for output data
491 SEL :
rb_sel -- rbus address
select for config regs
509 variable sres : rb_sres_type := rb_sres_init;
510 variable datax01 : slv16 := (others=>'0');
511 variable data01 : slv16 := (others=>'0');
513 sres.ack := to_x01(RB_SRES.ack);
514 sres.busy := to_x01(RB_SRES.busy);
515 sres.err := to_x01(RB_SRES.err);
516 sres.dout := to_x01(RB_SRES.dout);
518 if sres.ack = '1' and sres.busy = '0' and is_x(sres.dout) then
519 report "rlink_core: seen 'x' in rb_sres.data"
521 sres.dout := (others=>'1');
525 end process proc_sres;
530 if rising_edge(CLK) then
542 end process proc_regs;
555 variable ival : slbit := '0';
556 variable ibusy : slbit := '0';
557 variable ido : slv9 := (others=>'0');
558 variable crcreset : slbit := '0';
559 variable icrcena : slbit := '0';
560 variable ocrcena : slbit := '0';
561 variable has_attn : slbit := '0';
562 variable idi8 : slv8 := (others=>'0');
563 variable is_comma : slbit := '0';
564 variable comma_typ : slv3 := "000";
565 variable idohold : slbit := '0';
566 variable cnt_iszero : slbit := '0';
567 variable bcnt_load : slbit := '0';
568 variable bcnt_val : slv(RTAWIDTH-1 downto 0) := (others=>'0');
569 variable bcnt_dec : slbit := '0';
570 variable bcnt_end : slbit := '0';
571 variable irtwea : slbit := '0';
572 variable irtreb : slbit := '0';
573 variable irtweb : slbit := '0';
574 variable addra_clear : slbit := '0';
575 variable addrb_load : slbit := '0';
576 variable addrb_sela : slbit := '0';
577 variable ibcmd : slv2 := (others=>'0');
578 variable ibgo : slbit := '0';
590 ido := (others=>'0');
613 if unsigned(r.bcnt) = 1 then
624 ibcmd := (others=>'0');
628 n.attn := r.attn or RB_LAM;
631 if unsigned(r.attn) /= 0 then
633 if R_CREGS.anena='1' and r.arpend='0' then
646 if r.arpend = '0' or r.anreq = '1' then
650 if unsigned(r.atocnt) = 0 then
653 n.atocnt := slv(unsigned(r.atocnt) - 1);
661 bcnt_val := r.rtaddra;
666 if r.anreq = '1' then
669 n.state := sl_txanot;
673 if is_comma = '1' then
679 n.state := sl_txanot;
697 ido := c_rlink_dat_attn;
701 n.state := sl_txcntl;
705 ido := c_rlink_dat_sop;
708 if r.doretra = '1' then
709 if r.rtaddra_zero = '1' then
710 if r.nakdone = '0' then
717 n.state := sl_txrtbuf;
726 ido := c_rlink_dat_nak;
729 n.state := sl_txnakcode;
733 ido := '0' & "10" & (not r.nakcode) & r.nakcode;
736 if r.doretra = '0' then
746 if is_comma = '1' and comma_typ = c_eop then
756 if bcnt_end = '0' then
759 if r.nakdone = '0' then
769 ido := c_rlink_dat_eop;
778 n.cnt := slv(to_unsigned(1,16));
781 if is_comma = '1' then
782 if comma_typ = c_eop then
785 n.nakcode := c_rlink_nakcode_frame;
789 if r.cmdseen = '0' then
795 case RL_DI(c_rlink_cmd_rbf_code) is
796 when c_rlink_cmd_rreg |
801 n.state := sl_rxaddrl;
802 when c_rlink_cmd_labo |
804 n.state := sl_rxccrcl;
806 n.nakcode := c_rlink_nakcode_cmd;
816 if is_comma = '1' then
817 n.nakcode := c_rlink_nakcode_frame;
821 n.state := sl_rxaddrh;
829 if is_comma = '1' then
830 n.nakcode := c_rlink_nakcode_frame;
834 case r.rcmd(c_rlink_cmd_rbf_code) is
835 when c_rlink_cmd_rreg =>
836 n.state := sl_rxccrcl;
837 when c_rlink_cmd_wreg |
839 n.state := sl_rxdatl;
841 n.state := sl_rxcntl;
850 if is_comma = '1' then
851 n.nakcode := c_rlink_nakcode_frame;
855 n.state := sl_rxdath;
863 if is_comma = '1' then
864 n.nakcode := c_rlink_nakcode_frame;
868 n.state := sl_rxccrcl;
876 if is_comma = '1' then
877 n.nakcode := c_rlink_nakcode_frame;
881 n.state := sl_rxcnth;
889 if is_comma = '1' then
890 n.nakcode := c_rlink_nakcode_frame;
894 if unsigned(idi8(7 downto cntawidth-8)) = 0 then
895 n.state := sl_rxccrcl;
897 n.nakcode := c_rlink_nakcode_cnt;
906 if is_comma = '1' then
907 n.nakcode := c_rlink_nakcode_frame;
911 n.nakcode := c_rlink_nakcode_ccrc;
914 n.state := sl_rxccrch;
922 if is_comma = '1' then
923 n.nakcode := c_rlink_nakcode_frame;
927 n.nakcode := c_rlink_nakcode_ccrc;
944 case r.rcmd(c_rlink_cmd_rbf_code) is
945 when c_rlink_cmd_rreg =>
946 n.state := sl_rstart;
947 when c_rlink_cmd_rblk =>
949 n.state := sl_txcntl;
950 when c_rlink_cmd_wreg =>
953 n.state := sl_wwait0;
954 when c_rlink_cmd_wblk =>
956 if cnt_iszero = '0' then
959 n.state := sl_rxdcrcl;
961 when c_rlink_cmd_labo =>
962 n.state := sl_txlabo;
963 when c_rlink_cmd_attn =>
965 when c_rlink_cmd_init =>
968 n.state := sl_txstat;
971 n.nakcode := c_rlink_nakcode_cmd;
980 irtwea := not r.anact;
982 n.state := sl_txcnth;
989 irtwea := not r.anact;
991 if r.anact = '1' then
992 n.state := sl_txcrcl;
993 elsif r.rcmd(c_rlink_cmd_rbf_code) = c_rlink_cmd_rblk then
994 if cnt_iszero = '0' then
995 n.state := sl_rstart;
997 n.state := sl_txdcntl;
1000 n.state := sl_txstat;
1009 n.state := sl_txdat;
1020 if bcnt_end = '1' then
1021 if r.rcmd(c_rlink_cmd_rbf_code) = c_rlink_cmd_rblk then
1022 n.state := sl_txdcntl;
1024 n.state := sl_txstat;
1035 n.state := sl_rxwblk;
1040 if is_comma = '1' then
1041 n.nakcode := c_rlink_nakcode_frame;
1042 n.state := sl_txnak;
1047 if bcnt_end = '1' then
1048 n.state := sl_rxdcrcl;
1058 if is_comma = '1' then
1059 n.nakcode := c_rlink_nakcode_frame;
1060 n.state := sl_txnak;
1063 n.nakcode := c_rlink_nakcode_dcrc;
1064 n.state := sl_txnak;
1066 n.state := sl_rxdcrch;
1076 if is_comma = '1' then
1077 n.nakcode := c_rlink_nakcode_frame;
1078 n.state := sl_txnak;
1081 n.nakcode := c_rlink_nakcode_dcrc;
1082 n.state := sl_txnak;
1086 if r.rtaddrb_bad = '0' then
1087 n.state := sl_wblk0;
1089 n.nakcode := c_rlink_nakcode_rtwblk;
1090 n.state := sl_txnak;
1097 if cnt_iszero = '0' then
1099 n.state := sl_wblk1;
1101 n.state := sl_txdcntl;
1108 n.state := sl_wblk2;
1115 if bcnt_end = '0' then
1117 n.state := sl_wblkl;
1119 n.state := sl_wwait0;
1126 n.state := sl_wblkh;
1132 if bcnt_end = '0' then
1134 n.state := sl_wblkl;
1136 n.state := sl_wwait0;
1142 if r.rcmd(c_rlink_cmd_rbf_code) = c_rlink_cmd_wblk then
1143 n.state := sl_wwait1;
1145 n.state := sl_txstat;
1150 n.state := sl_txdcntl;
1159 n.state := sl_txdcnth;
1163 ido := (others=>'0');
1169 n.state := sl_txstat;
1173 ido := '0' & "0000000" & r.babo;
1178 n.state := sl_txstat;
1186 n.state := sl_txcntl;
1189 ido(c_rlink_stat_rbf_stat) := R_BREGS.stat;
1190 ido(c_rlink_stat_rbf_attn) := has_attn;
1191 ido(c_rlink_stat_rbf_rbtout) := R_BREGS.rbtout;
1192 ido(c_rlink_stat_rbf_rbnak) := R_BREGS.rbnak;
1193 ido(c_rlink_stat_rbf_rberr) := R_BREGS.rberr;
1198 n.state := sl_txcrcl;
1205 irtwea := not r.anact;
1206 n.state := sl_txcrch;
1213 if r.rtaddra_red = '0' then
1217 irtwea := not r.anact;
1219 if r.anact = '1' then
1220 n.state := sl_txeop;
1222 elsif r.rcmd(c_rlink_cmd_rbf_code)=c_rlink_cmd_labo and
1224 n.state := sl_rxeop;
1226 n.state := sl_rxcmd;
1230 n.nakcode := c_rlink_nakcode_rtovfl;
1231 n.state := sl_txnak;
1234 when others => null;
1239 if addra_clear = '1' then
1240 n.rtaddra := (others=>'0');
1241 n.rtaddra_red := '0';
1242 n.rtaddra_bad := '0';
1244 if irtwea = '1' then
1245 if r.rtaddra_red = '1' then
1246 n. rtaddra_bad := '1';
1248 n.rtaddra := slv(unsigned(r.rtaddra) + 1);
1250 n. rtaddra_red := '1';
1256 n.rtaddra_zero := '1';
1258 n.rtaddra_zero := '0';
1262 if addrb_load = '1' then
1263 if addrb_sela = '1' then
1264 n.rtaddrb := r.rtaddra;
1265 n.rtaddrb_red := r.rtaddra_red;
1266 n.rtaddrb_bad := r.rtaddra_bad;
1268 n.rtaddrb := (others=>'0');
1269 n.rtaddrb_red := '0';
1270 n.rtaddrb_bad := '0';
1273 if irtreb = '1' or irtweb = '1' then
1274 if r.rtaddrb_red = '1' then
1275 n. rtaddrb_bad := '1';
1277 n.rtaddrb := slv(unsigned(r.rtaddrb) + 1);
1279 n. rtaddrb_red := '1';
1286 if bcnt_load = '1' then
1289 if bcnt_dec ='1' then
1290 n.bcnt := slv(unsigned(r.bcnt) - 1);
1320 end process proc_lnext;
1332 variable bto_go : slbit := '0';
1333 variable bto_end : slbit := '0';
1334 variable cnt_load : slbit := '0';
1335 variable cnt_dec : slbit := '0';
1336 variable cnt_end : slbit := '0';
1337 variable dcnt_clear : slbit := '0';
1338 variable dcnt_inc : slbit := '0';
1339 variable ival : slbit := '0';
1340 variable ido : slv8 := (others=>'0');
1341 variable iwdone : slbit := '0';
1350 if unsigned(r.btocnt) = 0 then
1357 if unsigned(r.cnt) = 0 then
1365 ido := (others=>'0');
1400 n.state := sb_rstart;
1403 n.state := sb_wstart;
1404 when others => null;
1411 n.state := sb_rreg0;
1416 if r.dathpend = '1' then
1436 n.state := sb_rreg1;
1445 dcnt_inc := not r.blkabo;
1446 if cnt_end = '0' then
1447 if r.blkabo = '0' then
1448 if r.wfifo = '0' then
1451 n.state := sb_rreg0;
1453 n.state := sb_rwait;
1456 n.state := sb_rabo1;
1463 if r.wfifo = '0' then
1465 n.state := sb_rstart;
1475 ido := (others=>'0');
1478 n.state := sb_rabo1;
1481 ido := (others=>'0');
1482 if r.wfifo = '0' then
1485 if cnt_end = '0' then
1486 n.state := sb_rabo0;
1495 n.state := sb_wreg0;
1515 n.state := sb_wreg1;
1521 dcnt_inc := not r.blkabo;
1522 if cnt_end = '0' then
1523 if r.blkabo = '0' then
1526 n.state := sb_wreg0;
1528 n.state := sb_wabo0;
1537 n.state := sb_wabo1;
1540 if cnt_end = '0' then
1541 n.state := sb_wabo0;
1546 when others => null;
1550 if bto_go = '0' then
1553 n.btocnt := slv(unsigned(r.btocnt) - 1);
1556 if cnt_load = '1' then
1559 if cnt_dec ='1' then
1560 n.cnt := slv(unsigned(r.cnt) - 1);
1564 if dcnt_clear = '1' then
1565 n.dcnt := (others=>'0');
1567 if dcnt_inc ='1' then
1568 n.dcnt := slv(unsigned(r.dcnt) + 1);
1579 end process proc_bnext;
1587 variable irb_ack : slbit := '0';
1588 variable irb_dout : slv16 := (others=>'0');
1596 irb_dout := (others=>'0');
1609 when others => null;
1625 irb_dout := SYSID(15 downto 0);
1627 irb_dout := SYSID(31 downto 16);
1628 when others => null;
1640 end process proc_cnext;
1655 end process proc_mreq;
out DO slv( DWIDTH- 1 downto 0)
in DI slv( DWIDTH- 1 downto 0)
out SIZE slv( AWIDTH downto 0)
in DIA slv( DWIDTH- 1 downto 0)
in ADDRB slv( AWIDTH- 1 downto 0)
in ADDRA slv( AWIDTH- 1 downto 0)
out DOB slv( DWIDTH- 1 downto 0)
in DIB slv( DWIDTH- 1 downto 0)
out DOA slv( DWIDTH- 1 downto 0)
ENAPIN integer := sbcntl_sbf_rbmon
in RB_LAM slv16 :=( others => '0')
in RB_SRES_2 rb_sres_type := rb_sres_init
out RB_SRES_OR rb_sres_type
in RB_SRES_1 rb_sres_type
slv16 :=( others => '0') OCRC_OUT
slv6 :=( others => '0') DOFIFO_SIZE
slv8 :=( others => '0') RTBUF_DIB
slv8 :=( others => '0') DOFIFO_DO
slv9 :=( others => '0') RL_DO_L
slv( RTAWIDTH- 1 downto 0) :=( 0=> '0', others => '1') rtaddr_tred
integer range 15 downto 8 f_byte1
integer range 15 downto 8 stat_rbf_lcmd
integer range 7 downto 0 d_f_data
slv8 :=( others => '0') RTBUF_DOB
slv( cntawidth- 1 downto 0) :=( others => '0') cnt_zero
positive := RTAWIDTH- 1 cntawidth
integer range 7 downto 0 f_byte0
cregs_type := cregs_init N_CREGS
rb_mreq_type := rb_mreq_init RB_MREQ_L
integer := 7 stat_rbf_babo
slv( RTAWIDTH- 1 downto 0) :=( others => '0') rtaddr_zero
slv8 :=( others => '0') RTBUF_DIA
integer range 7 downto 0 cntl_rbf_atoval
bregs_type := bregs_init R_BREGS
rb_sres_type := rb_sres_init RB_SRES_CLEAN
slv2 :=( others => '0') L2B_CMD
integer range 2 downto 0 stat_rbf_rbsize
rb_sres_type := rb_sres_init RB_SRES_TOT
slv( BTOWIDTH- 1 downto 0) :=( others => '1') btocnt_init
cregs_type := cregs_init R_CREGS
integer range 2 downto 0 d_f_ctyp
bregs_type :=( sb_idle, '0', '0', '0', '0',( others => '0'), '0', '0', '0', '0', cnt_zero, cnt_zero, btocnt_init, '0', '0',( others => '0')) bregs_init
rb_sres_type := rb_sres_init RB_SRES_CONF
lregs_type :=( sl_idle,( others => '0'),( others => '1'),( others => '0'),( others => '0'),( others => '0'), bcnt_zero,( others => '0'), '0', '0', '0',( others => '0'), '0', '0',( others => '0'), '0', '0',( others => '0'), rtaddr_zero, '0', '0', '0', rtaddr_zero, '0', '0', '0', '0') lregs_init
slv8 :=( others => '0') DOFIFO_DI
cregs_type :=( '0', '0',( others => '0')) cregs_init
integer := 14 cntl_rbf_atoena
(sb_idle,sb_rstart,sb_rreg0,sb_rreg1,sb_rwait,sb_rend,sb_rabo0,sb_rabo1,sb_wstart,sb_wreg0,sb_wreg1,sb_wabo0,sb_wabo1) bstate_type
integer range cntawidth- 1 downto 0 cnt_f_dat
integer := 6 stat_rbf_arpend
lregs_type := lregs_init R_LREGS
slv16 :=( others => '0') ICRC_OUT
slv8 :=( others => '0') OCRC_IN
integer := 15 cntl_rbf_anena
slv( RTAWIDTH- 1 downto 0) :=( others => '0') bcnt_zero
(sl_idle,sl_txanot,sl_txsop,sl_txnak,sl_txnakcode,sl_txrtbuf,sl_txeop,sl_rxeop,sl_rxcmd,sl_rxaddrl,sl_rxaddrh,sl_rxdatl,sl_rxdath,sl_rxcntl,sl_rxcnth,sl_rxccrcl,sl_rxccrch,sl_txcmd,sl_txcntl,sl_txcnth,sl_rstart,sl_txdat,sl_wblk,sl_rxwblk,sl_rxdcrcl,sl_rxdcrch,sl_wblk0,sl_wblk1,sl_wblk2,sl_wblkl,sl_wblkh,sl_wwait0,sl_wwait1,sl_txdcntl,sl_txdcnth,sl_txlabo,sl_attn,sl_txstat,sl_txcrcl,sl_txcrch) lstate_type
ENAPIN_RBMON integer :=- 1
ENAPIN_RLMON integer :=- 1
SYSID slv32 :=( others => '0')
in RL_DI slv( DWIDTH- 1 downto 0)
in RL_DO slv( DWIDTH- 1 downto 0)
ENAPIN integer := sbcntl_sbf_rlmon
std_logic_vector( 3 downto 0) slv4
std_logic_vector( 2 downto 0) slv3
std_logic_vector( 8 downto 0) slv9
std_logic_vector( 31 downto 0) slv32
std_logic_vector( 15 downto 0) slv16
std_logic_vector( 5 downto 0) slv6
std_logic_vector( 7 downto 0) slv8
std_logic_vector( 1 downto 0) slv2