⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 greth.vhd

📁 free hardware ip core about sparcv8,a soc cpu in vhdl
💻 VHD
📖 第 1 页 / 共 5 页
字号:
           if conv_integer(r.abufs) = wsz then             v.edclrstate := spill;           end if;         end if;         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;         end if;       when wrdsa =>         if rxwrite = '1' then           v.edclrstate := wrsa; swap := '1';           veri.writem := '1'; veri.writel := '1';           v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl - 2;           if (macaddr(15 downto 0) /= rr.dataout(31 downto 16)) and                           (X"FFFF" /= rr.dataout(31 downto 16)) then             v.edclrstate := spill;            elsif (X"FFFF" = rr.dataout(31 downto 16)) then             v.edclbcast := r.edclbcast;            end if;         end if;         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;         end if;       when wrsa =>         if rxwrite = '1' then           veri.writem := '1'; veri.writel := '1';           v.edclrstate := wrtype; swap := '1';           v.rcntm := r.rcntm + 2; v.rcntl := r.rcntl + 3;         end if;         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;         end if;       when wrtype =>         if rxwrite = '1' then           veri.writem := '1'; veri.writel := '1';           v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;           if X"0800" = rr.dataout(31 downto 16) and (r.edclbcast = '0') then             v.edclrstate := ip;           elsif X"0806" = rr.dataout(31 downto 16) and (r.edclbcast = '1') then             v.edclrstate := arp;           else             v.edclrstate := spill;           end if;         end if;         v.ecnt := (others => '0'); v.ipcrc := (others => '0');         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;         end if;       when ip =>         if rxwrite = '1' then           v.ecnt := r.ecnt + 1;           veri.writem := '1'; veri.writel := '1';           case vecnt is             when 0 =>               v.ipcrc :=               crcadder(not rr.dataout(31 downto 16), r.ipcrc);               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;             when 1 =>               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 2;             when 2 =>               v.ipcrc :=               crcadder(not rr.dataout(31 downto 16), r.ipcrc);               v.rcntm := r.rcntm + 2; v.rcntl := r.rcntl - 1;             when 3 =>               v.rcntm := r.rcntm - 1; v.rcntl := r.rcntl + 2;             when 4 =>               v.udpsrc := rr.dataout(15 downto 0);               v.rcntm := r.rcntm + 2; v.rcntl := r.rcntl + 1;              when 5 =>               setmz := '1';               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;              when 6 =>               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;              when 7 =>               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;               if (rr.dataout(31 downto 18) = r.seq) then                 v.seq := r.seq + 1; v.nak := '0';                else                 v.nak := '1';                  veri.datain(31 downto 18) := r.seq;               end if;               veri.datain(17) := v.nak; v.ewr := rr.dataout(17);               if (rr.dataout(17) or v.nak) = '1' then                 veri.datain(16 downto 7) := (others => '0');               end if;               v.oplen := rr.dataout(16 downto 7);               v.applength := "000000" & veri.datain(16 downto 7);               v.ipcrc :=               crcadder(v.applength + 38, r.ipcrc);               v.write(conv_integer(r.rpnt)) := rr.dataout(17);             when 8 =>               ipcrctmp := (others => '0');               ipcrctmp(1 downto 0) := r.ipcrc(17 downto 16);               ipcrctmp2 := "00" & r.ipcrc(15 downto 0);               v.ipcrc :=               crcadder(ipcrctmp, ipcrctmp2);               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;               v.edclrstate := ipdata;             when others =>               null;           end case;         end if;         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;         end if;       when ipdata =>         if (rxwrite and r.ewr and not r.nak) = '1' and                               (r.rcntm /= ebufmax) then           veri.writem := '1'; veri.writel := '1';           v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;         end if;         if rxdone = '1' then           v.edclrstate := ipcrc; v.rcntm := conv_std_logic_vector(6, bpbits);           ipcrctmp := (others => '0');           ipcrctmp(1 downto 0) := r.ipcrc(17 downto 16);           ipcrctmp2 := "00" & r.ipcrc(15 downto 0);           v.ipcrc := crcadder(ipcrctmp, ipcrctmp2);           if conv_integer(v.rxstatus) /= 0 then             v.edclrstate := idle;           end if;         end if;       when ipcrc =>         veri.writem := '1'; veri.datain(31 downto 16) := not r.ipcrc(15 downto 0);         v.edclrstate := udp; v.rcntm := conv_std_logic_vector(9, bpbits);         v.rcntl := conv_std_logic_vector(9, bpbits);       when udp =>         veri.writem := '1'; veri.writel := '1';         v.edclrstate := iplength;         veri.datain(31 downto 16) := r.udpsrc;         veri.datain(15 downto 0) := r.applength + 18;         v.rcntm := conv_std_logic_vector(4, bpbits);       when iplength =>         veri.writem := '1';         veri.datain(31 downto 16) := r.applength + 38;         v.edclrstate := oplength;         v.rcntm := conv_std_logic_vector(10, bpbits);         v.rcntl := conv_std_logic_vector(10, bpbits);       when oplength =>         if rxstart = '0' then           v.abufs := r.abufs + 1; v.rpnt := r.rpnt + 1;           veri.writel := '1'; veri.writem := '1';         end if;         v.edclrstate := idle;         veri.datain(31 downto 0) := (others => '0');         veri.datain(15 downto 0) := "00000" & r.nak & r.oplen;       when arp =>         if rxwrite = '1' then           v.ecnt := r.ecnt + 1;           veri.writem := '1'; veri.writel := '1';           case vecnt is             when 0 =>               v.rcntm := r.rcntm + 4;              when 1 =>               swap := '1'; veri.writel := '0';                v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 4;             when 2 =>               swap := '1';               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;             when 3 =>               swap := '1';               v.rcntm := r.rcntm - 4; v.rcntl := r.rcntl - 4;             when 4 =>               veri.datain := macaddr(31 downto 16) & macaddr(47 downto 32);               v.rcntm := r.rcntm + 1; v.rcntl := r.rcntl + 1;              when 5 =>               v.rcntl := r.rcntl + 1;               veri.datain(31 downto 16) := rr.dataout(15 downto 0);               veri.datain(15 downto 0) := macaddr(15 downto 0);               if rr.dataout(15 downto 0) /= r.edclip(31 downto 16) then                 v.edclrstate := spill;               end if;             when 6 =>               swap := '1'; veri.writem := '0';                v.rcntm := conv_std_logic_vector(5, bpbits);               v.rcntl := conv_std_logic_vector(1, bpbits);               if rr.dataout(31 downto 16) /= r.edclip(15 downto 0) then                 v.edclrstate := spill;               else                 v.edclactive := '1'; v.rxdstate := discard;                 v.rmsto.req := '0';               end if;             when 7 =>               veri.writem := '0';               veri.datain(15 downto 0) := macaddr(47 downto 32);               v.rcntl := r.rcntl + 1;               v.rcntm := conv_std_logic_vector(2, bpbits);             when 8 =>               v.edclrstate := arpop;               veri.datain := macaddr(31 downto 0);               v.rcntm := conv_std_logic_vector(5, bpbits);             when others =>               null;           end case;         end if;         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;         end if;       when arpop =>         veri.writem := '1'; veri.datain(31 downto 16) := X"0002";         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;           if conv_integer(v.rxstatus) = 0 and (rr.gotframe = '1') then             v.abufs := r.abufs + 1; v.rpnt := r.rpnt + 1;           end if;         end if;       when spill =>         if (rxdone and not rxstart) = '1' then           v.edclrstate := idle;         end if;     end case;               --edcl transmitter     case r.txdstate is       when getlen =>         v.tcnt := r.tcnt + 1;         if conv_integer(r.tcnt) = 10 then           v.txlength := '0' & ero.data(9 downto 0);           v.tnak := ero.data(10);           v.txcnt := v.txlength;           if (r.write(conv_integer(r.tpnt)) or v.tnak) = '1' then             v.txlength := (others => '0');           end if;         end if;         if conv_integer(r.tcnt) = 11 then           v.txdstate := readhdr;           v.tcnt := (others => '0');         end if;       when readhdr =>         v.tcnt := r.tcnt + 1; vtxfi.write := '1';         v.tfwpnt := r.tfwpnt + 1; v.tfcnt := v.tfcnt + 1;          vtxfi.datain := ero.data;         if conv_integer(r.tcnt) = 12 then           v.txaddr := ero.data(31 downto 2);         end if;         if conv_integer(r.tcnt) = 3 then           if ero.data(31 downto 16) = X"0806" then             v.tarp := '1'; v.txlength := conv_std_logic_vector(42, 11);           else             v.tarp := '0'; v.txlength := r.txlength + 52;           end if;         end if;         if r.tarp = '0' then           if conv_integer(r.tcnt) = 12 then             v.txdstate := start;           end if;         else           if conv_integer(r.tcnt) = 10 then             v.txdstate := start;           end if;         end if;         if (txrestart or txdone) = '1' then           v.txdstate := etdone;         end if;       when start =>         v.tmsto.addr := r.txaddr & "00";          v.tmsto.write := r.write(conv_integer(r.tpnt));         if (conv_integer(r.txcnt) = 0) or (r.tarp or r.tnak) = '1' then           v.tmsto.req := '0'; v.txdstate := etdone;           v.txstart_sync := not r.txstart_sync;         elsif r.write(conv_integer(r.tpnt)) = '0' then           v.txdstate := req; v.tedcl := '1';         else           v.txstart_sync := not r.txstart_sync;           v.txdstate := wrbus; v.tmsto.req := '1'; v.tedcl := '1';           v.tmsto.data := ero.data; v.tcnt := r.tcnt + 1;         end if;         if (txrestart or txdone) = '1' then           v.txdstate := etdone;         end if;       when wrbus =>         if tmsti.grant = '1' then           v.tmsto.addr := r.tmsto.addr + 4;           if ((conv_integer(r.txcnt) <= 4) and (tmsti.ready = '0')) or              ((conv_integer(r.txcnt) <= 8) and (tmsti.ready = '1')) then             v.tmsto.req := '0';           end if;         end if;         if (tmsti.ready or tmsti.error) = '1' then           v.tmsto.data := ero.data; v.tcnt := r.tcnt + 1;           v.txcnt := r.txcnt - 4;           if r.tmsto.req = '0' then             v.txdstate := etdone;           end if;         end if;         if tmsti.retry = '1' then           v.tmsto.addr := r.tmsto.addr - 4; v.tmsto.req := '1';         end if;         --if (txrestart or txdone) = '1' then          -- v.txdstate := etdone; v.tmsto.req := '0';         --end if;       when etdone =>         if txdone = '1' then           v.txdstate := idle; v.txdone(nsync) := r.txdone(nsync-1);           v.abufs := v.abufs - 1; v.tpnt := r.tpnt + 1;           v.tfcnt := (others => '0'); v.tfrpnt := (others => '0');           v.tfwpnt := (others => '0');         elsif txrestart = '1' then           v.txdstate := idle;         end if;       when others =>         null;     end case;     if swap = '1' then       veri.datain(31 downto 16) := rr.dataout(15 downto 0);        veri.datain(15 downto 0)  := rr.dataout(31 downto 16);     end if;     if setmz = '1' then       veri.datain(31 downto 16) := (others => '0');     end if;     veri.raddress := r.tpnt & v.tcnt;   end if;   --edcl duplex mode read   if (rmii = 1) or (edcl = 1) then     case r.duplexstate is       when start =>         v.mdio_ctrl.read := '1'; v.mdio_ctrl.busy := '1';         v.duplexstate := checkrst;       when checkrst =>         if r.mdio_ctrl.busy = '0' then           if r.mdio_ctrl.linkfail = '1' then             v.duplexstate := start;           else             v.duplexstate := readrstbit;           end if;         end if;       when readrstbit =>         v.mdio_ctrl.read := '1'; v.mdio_ctrl.busy := '1';         v.duplexstate := checkrstbit;       when checkrstbit =>         if r.mdio_ctrl.busy = '0' then           if r.mdio_ctrl.linkfail = '1' then             v.duplexstate := done;           else             if r.mdio_ctrl.data(15) = '1' then               v.duplexstate := readrstbit;             else               v.ctrl.full_duplex := r.mdio_ctrl.data(8);               v.ctrl.speed := r.mdio_ctrl.data(13);               v.duplexstate := done;             end if;           end if;         end if;       when done =>         null;     end case;   end if;   --transmitter retry   if tmsti.retry = '1' then     v.tmsto.req := '1'; v.tmsto.addr := r.tmsto.addr - 4;     v.txburstcnt := r.txburstcnt - 1;   end if;   --transmitter AHB error   if tmsti.error = '1' and (not ((edcl = 1) and (r.tedcl = '1'))) then     v.tmsto.req := '0'; v.txdstate := ahberror;   end if;       --receiver retry   if rmsti.retry = '1' then     v.rmsto.req := '1'; v.rmsto.addr := r.rmsto.addr - 4;     v.rxburstcnt := r.rxburstcnt - 1;   end if;-----------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -