154use ieee.std_logic_1164.
all;
155use ieee.numeric_std.
all;
361 report "assert(AWIDTH=17 or AWIDTH=18 or AWIDTH=22): unsupported AWIDTH"
372 ADDR => R_REGS.saddr,
385 ADDR => R_REGS.saddr,
401 ADDRA => R_REGS.saddr,
402 ADDRB => R_REGS.mrp_adr_dl,
420 ADDRA => R_REGS.saddr,
421 ADDRB => R_REGS.mrp_adr_dl,
441 end process proc_reset;
446 if rising_edge(CLK) then
454 end process proc_regs;
464 variable irb_ack : slbit := '0';
465 variable irb_busy : slbit := '0';
466 variable irb_err : slbit := '0';
467 variable irb_dout : slv16 := (others=>'0');
468 variable irbena : slbit := '0';
469 variable irbact : slbit := '0';
471 variable imem_reqr : slbit := '0';
472 variable imem_reqw : slbit := '0';
473 variable imem_be : slv4 := (others=>'0');
474 variable imem_addr : slv(AWIDTH-1 downto 0) := (others=>'0');
475 variable imem_di : slv32 := (others=>'0');
477 variable ixor_addr : slv(AWIDTH-1 downto 0) := (others=>'0');
478 variable ixor_data : slv32 := (others=>'0');
479 variable imaddr_chk: slv(AWIDTH-1 downto 0) := (others=>'0');
481 variable isblk_ok : slbit := '0';
482 variable isbank : slv2 := "11";
484 variable maddr_inc : slbit := '0';
485 variable saddr_inc : slbit := '0';
486 variable saddr_next : slbit := '0';
487 variable saddr_last : slbit := '0';
488 variable swcnt_inc : slbit := '0';
490 variable ilam : slbit := '0';
492 variable omux_sel : slv4 := "0000";
493 variable omux_dat : slv16 := (others=>'0');
495 constant c_maddr_ones
: slv(AWIDTH-1 downto 0) := (others=>'1');
505 irb_dout := (others=>'0');
512 imem_be := (others=>'1');
513 imem_addr := r.maddr;
516 ixor_addr := (others=>'0');
517 ixor_data := (others=>'0');
531 omux_dat := (others=>'0');
540 if r.saddr = r.slim then
544 if r.mrp_val_dl='1' and MEM_ACK_R='1' then
546 if r.sveri = '1' then
547 if r.mrp_dat_dl /= MEM_DO and
552 n.se_addr := r.mrp_adr_dl;
559 if r.mrp_val_al='1' and MEM_ACT_R='1' then
561 n.mrp_val_dl := r.mrp_val_al;
562 n.mrp_adr_dl := r.mrp_adr_al;
563 n.mrp_dat_dl := r.mrp_dat_al;
572 if r.rbsel='1' and irbena='1' then
581 if r.rbsel = '1' then
583 case RB_MREQ.addr(4 downto 0) is
634 imem_addr := r.maddr;
638 n.state := s_mblk_wr1;
645 n.state := s_mblk_rd1;
652 n.slim := RB_MREQ.din(r.slim'range);
658 n.saddr := RB_MREQ.din(r.saddr'range);
670 n.state := s_sblk_rd;
738 imem_addr := r.maddr;
752 n.state := s_mcmd_read;
777 n.state := s_mblk_wr2;
785 n.state := s_mblk_wr2;
787 imem_be := (others=>'1');
788 imem_addr := r.maddr;
808 n.state := s_mblk_rd2;
839 case RB_MREQ.addr(4 downto 0) is
842 if r.sbank = "00" then
843 saddr_next := irbact;
846 isbank := '1' & r.sbank(0);
847 if r.sbank(0) = '0' then
848 saddr_next := irbact;
851 isbank := '0' & r.sbank(0);
852 if r.sbank(0) = '0' then
853 saddr_next := irbact;
859 if isblk_ok='1' and RB_MREQ.we='1' then
878 if isblk_ok = '1' then
879 n.sbank := slv(unsigned(r.sbank) - 1);
880 if saddr_next = '1' then
883 n.state := s_sblk_rd;
897 n.saddr := (others=>'0');
898 n.se_addr := (others=>'0');
899 n.se_data := (others=>'0');
907 if saddr_last = '1' then
914 ixor_addr := r.maddr;
915 if r.sxora = '0' then
922 if r.swswap = '1' then
927 if r.sxord = '0' then
932 imem_addr := ixor_addr;
934 imem_di := ixor_data;
945 if imem_reqr = '1' then
947 n.mrp_adr_al := r.scaddr;
948 n.mrp_dat_al := ixor_data;
952 elsif r.slast = '1' then
958 if saddr_last = '1' then
970 imaddr_chk := r.maddr;
971 if AWIDTH = 22 and r.swloop = '0' then
975 if r.sfail='0' and r.sloop='1' and
976 imaddr_chk/=c_maddr_ones then
989 if maddr_inc = '1' then
990 n.maddr := slv(unsigned(r.maddr) + 1);
993 if saddr_inc = '1' then
994 n.saddr := slv(unsigned(r.saddr) + 1);
997 if swcnt_inc = '1' then
998 n.swcnt := slv(unsigned(r.swcnt) + 1);
1000 n.swcnt := (others=>'0');
1003 if irbact = '0' then
1004 omux_sel := SWI(7 downto 4);
1017 omux_dat := (others=>'0');
1022 omux_dat := (others=>'0');
1023 omux_dat(r.slim'range) := r.slim;
1025 omux_dat := (others=>'0');
1026 omux_dat(r.saddr'range) := r.saddr;
1028 omux_dat := (others=>'0');
1039 omux_dat := (others=>'0');
1040 omux_dat(r.se_addr'range) := r.se_addr;
1054 when others => null;
1057 if irbact = '1' then
1058 irb_dout := omux_dat;
1060 n.dispval := omux_dat;
1071 MEM_REQ <= imem_reqr or imem_reqw;
1079 end process proc_next;
in ADDR slv( AWIDTH- 1 downto 0)
out DO slv( DWIDTH- 1 downto 0)
in DI slv( DWIDTH- 1 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)
std_logic_vector( 10 downto 0) slv11
std_logic_vector( 3 downto 0) slv4
std_logic_vector( 4 downto 0) slv5
std_logic_vector( 31 downto 0) slv32
std_logic_vector( 15 downto 0) slv16
std_logic_vector( 7 downto 0) slv8
std_logic_vector( 1 downto 0) slv2
slv5 := "01001" rbaddr_saddr
integer := 14 mcmd_rbf_ld
integer range AWIDTH- 1- 16 downto 0 maddrh_rbf_h
slv5 := "10001" rbaddr_sedath
integer range 31 downto 16 df_word1
integer range IWIDTH- 1 downto 0 scmd_rbf_addr
slv5 := "00011" rbaddr_mdol
slv4 := "0011" omux_memdoh
integer range 15 downto 0 maddr_f_wl
slv5 := "01100" rbaddr_sblkd
slv5 := "10010" rbaddr_sedatl
integer range 15 downto 13 sstat_rbf_awidth
slv4 := "1110" omux_smemb2
slv4 := "1001" omux_seaddr
slv4 := "1100" omux_smemb0
integer := 5 sstat_rbf_xora
integer := 0 sstat_rbf_run
integer range 31 downto 28 scmd_rbf_wait
integer range AWIDTH- 1- 8 downto 0 maddr_f_bot
integer := 24 scmd_rbf_we
slv4 := "1011" omux_sedath
slv4 := "0100" omux_maddrl
integer := 1 sstat_rbf_fail
slv5 := "00010" rbaddr_mdoh
natural := imin( 18, AWIDTH) IWIDTH
integer range AWIDTH- 1- 16 downto 0 mcmd_rbf_addrh
slv5 := "01010" rbaddr_sblk
integer range AWIDTH- 1 downto 16 maddr_f_wh
integer := 7 sstat_rbf_loop
(s_idle,s_mcmd,s_mcmd_read,s_mblk_wr1,s_mblk_wr2,s_mblk_rd1,s_mblk_rd2,s_sblk_rd,s_sblk,s_sstart,s_sload,s_srun,s_sloop) state_type
slv32 :=( others => '0') SMEM_DATA
slv4 := "1000" omux_sstat
integer := 0 init_rbf_seq
slv5 := "01101" rbaddr_sstat
slv5 := "01111" rbaddr_sstop
integer range 11 downto 8 mcmd_rbf_be
slv5 := "00111" rbaddr_mblk
slv5 := "10000" rbaddr_seaddr
regs_type :=( s_idle, '0', maddrzero,( others => '0'),( others => '0'),( others => '0'),( others => '0'), '0', '0', '0',( others => '0'),( others => '0'), '0', '0', '0', '0', '0', '0', '0',( others => '0'),( others => '0'), '0',( others => '0'),( others => '0'),( others => '0'),( others => '0'),( others => '0')) regs_init
slv5 := "00101" rbaddr_maddrl
slv32 :=( others => '0') SMEM_CMD
integer range 23 downto 20 scmd_rbf_be
slv4 := "1010" omux_sedatl
slv5 := "00000" rbaddr_mdih
integer := 12 mcmd_rbf_we
integer := 8 sstat_rbf_wloop
slv5 := "00110" rbaddr_mcmd
slv5 := "01011" rbaddr_sblkc
regs_type := regs_init R_REGS
integer range 15 downto 0 df_word0
integer range IWIDTH- 1 downto 0 maddr_f_scmd
slv4 := "0111" omux_saddr
slv4 := "0010" omux_memdol
integer := 9 sstat_rbf_wswap
slv5 := "00100" rbaddr_maddrh
integer := 13 mcmd_rbf_inc
integer range AWIDTH- 1 downto AWIDTH- 1- 3 maddr_f_top4
integer := 6 sstat_rbf_xord
integer range AWIDTH- 1- 4 downto AWIDTH- 1- 7 maddr_f_mid4
slv4 := "0101" omux_maddrh
slv5 := "01110" rbaddr_sstart
integer := 1 init_rbf_mem
slv5 := "00001" rbaddr_mdil
slv4 := "1111" omux_smemb3
slv4 := "1101" omux_smemb1
slv5 := "01000" rbaddr_slim
integer := 4 sstat_rbf_veri
slv( AWIDTH- 1 downto 0) :=( others => '0') maddrzero
RB_ADDR slv16 := slv( to_unsigned( 2#0000000000000000#, 16) )
out MEM_ADDR slv( AWIDTH- 1 downto 0)