📄 dsu3x.vhd
字号:
v.en(i) := r.dsuen(2) and dbgi(i).dsu; end loop; rawindex := conv_integer(r.slv.haddr(PROC_H downto PROC_L)); if ncpu = 1 then index := 0; else if rawindex > ncpu then index := ncpu-1; else index := rawindex; end if; end if; hasel1 := r.slv.haddr(AREA_H-1 downto AREA_L); hasel2 := r.slv.haddr(6 downto 2); if r.slv.hsel = '1' then case hasel1 is when "000" => -- DSU registers if r.cnt(2 downto 0) = "110" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; hrdata := (others => '0'); case hasel2 is when "00000" => if (r.slv.hwrite and hclken) = '1' then v.te(index) := ahbsi2.hwdata(0); v.be(index) := ahbsi2.hwdata(1); v.bw(index) := ahbsi2.hwdata(2); v.bs(index) := ahbsi2.hwdata(3); v.bx(index) := ahbsi2.hwdata(4); v.bz(index) := ahbsi2.hwdata(5); v.reset(index) := ahbsi2.hwdata(9); v.halt(index) := ahbsi2.hwdata(10); else hrdata(0) := r.te(index); hrdata(1) := r.be(index); hrdata(2) := r.bw(index); hrdata(3) := r.bs(index); hrdata(4) := r.bx(index); hrdata(5) := r.bz(index); hrdata(6) := dbgi(index).dsumode; hrdata(7) := r.dsuen(2); hrdata(8) := r.dsubre(2); hrdata(9) := not dbgi(index).error; hrdata(10) := dbgi(index).halt; hrdata(11) := dbgi(index).pwd; end if; when "00010" => -- timer if (r.slv.hwrite and hclken) = '1' then v.timer := ahbsi2.hwdata(tbits-1 downto 0); else hrdata(tbits-1 downto 0) := r.timer; end if; when "01000" => if (r.slv.hwrite and hclken) = '1' then v.bn := ahbsi2.hwdata(NCPU-1 downto 0); v.ss := ahbsi2.hwdata(16+NCPU-1 downto 16); else hrdata(NCPU-1 downto 0) := r.bn; hrdata(16+NCPU-1 downto 16) := r.ss; end if; when "01001" => if (r.slv.hwrite and hclken) = '1' then v.bmsk(NCPU-1 downto 0) := ahbsi2.hwdata(NCPU-1 downto 0); v.dmsk(NCPU-1 downto 0) := ahbsi2.hwdata(NCPU-1+16 downto 16); else hrdata(NCPU-1 downto 0) := r.bmsk; hrdata(NCPU-1+16 downto 16) := r.dmsk; end if; when "10000" => if TRACEN then hrdata((TBUFABITS + 15) downto 16) := tr.delaycnt; hrdata(2 downto 0) := tr.break & tr.dcnten & tr.enable; if (r.slv.hwrite and hclken) = '1' then tv.delaycnt := ahbsi2.hwdata((TBUFABITS+ 15) downto 16); tv.break := ahbsi2.hwdata(2); tv.dcnten := ahbsi2.hwdata(1); tv.enable := ahbsi2.hwdata(0); end if; end if; when "10001" => if TRACEN then hrdata((TBUFABITS - 1 + 4) downto 4) := tr.aindex; if (r.slv.hwrite and hclken) = '1' then tv.aindex := ahbsi2.hwdata((TBUFABITS - 1 + 4) downto 4); end if; end if; when "10100" => if TRACEN then hrdata(31 downto 2) := tr.tbreg1.addr; if (r.slv.hwrite and hclken) = '1' then tv.tbreg1.addr := ahbsi2.hwdata(31 downto 2); end if; end if; when "10101" => if TRACEN then hrdata := tr.tbreg1.mask & tr.tbreg1.read & tr.tbreg1.write; if (r.slv.hwrite and hclken) = '1' then tv.tbreg1.mask := ahbsi2.hwdata(31 downto 2); tv.tbreg1.read := ahbsi2.hwdata(1); tv.tbreg1.write := ahbsi2.hwdata(0); end if; end if; when "10110" => if TRACEN then hrdata(31 downto 2) := tr.tbreg2.addr; if (r.slv.hwrite and hclken) = '1' then tv.tbreg2.addr := ahbsi2.hwdata(31 downto 2); end if; end if; when "10111" => if TRACEN then hrdata := tr.tbreg2.mask & tr.tbreg2.read & tr.tbreg2.write; if (r.slv.hwrite and hclken) = '1' then tv.tbreg2.mask := ahbsi2.hwdata(31 downto 2); tv.tbreg2.read := ahbsi2.hwdata(1); tv.tbreg2.write := ahbsi2.hwdata(0); end if; end if; when others => end case; when "010" => -- AHB tbuf if TRACEN then if r.cnt(2 downto 0) = "101" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; vabufi.enable := not (tr.enable and not r.act); case tr.haddr(3 downto 2) is when "00" => hrdata := tbo.data(127 downto 96); if (r.slv.hwrite and hclken) = '1' then vabufi.write(3) := vabufi.enable and v.slv.hready; end if; when "01" => hrdata := tbo.data(95 downto 64); if (r.slv.hwrite and hclken) = '1' then vabufi.write(2) := vabufi.enable and v.slv.hready; end if; when "10" => hrdata := tbo.data(63 downto 32); if (r.slv.hwrite and hclken) = '1' then vabufi.write(1) := vabufi.enable and v.slv.hready; end if; when others => hrdata := tbo.data(31 downto 0); if (r.slv.hwrite and hclken) = '1' then vabufi.write(0) := vabufi.enable and v.slv.hready; end if; end case; else if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; when "011" | "001" => -- IU reg file, IU tbuf iuacc := '1'; hrdata := dbgi(index).data; if r.cnt(2 downto 0) = "101" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; when "100" => -- IU reg access iuacc := '1'; hrdata := dbgi(index).data; if r.cnt(1 downto 0) = "11" then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; when "111" => -- DSU ASI if r.cnt(2 downto 1) = "11" then iuacc := '1'; else iuacc := '0'; end if; if (dbgi(index).crdy = '1') or (r.cnt = "000") then if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end if; hrdata := dbgi(index).data; when others => if hclken = '1' then v.slv.hready := '1'; else v.slv.hready2 := '1'; end if; end case; if (r.slv.hready and hclken and not v.slv.hsel) = '1' then v.slv.hready := '0'; end if; if (clk2x /= 0) and (r.slv.hready2 and hclken) = '1' then v.slv.hready := '1'; end if; end if; if r.slv.hsel = '1' then if (r.slv.hwrite and hclken) = '1' then v.slv.hwdata := ahbsi2.hwdata; end if; if (clk2x = 0) or ((r.slv.hready or r.slv.hready2) = '0') then v.slv.hrdata := hrdata; end if; end if; if ((ahbsi2.hready and ahbsi2.hsel(hindex)) = '1') and (ahbsi2.htrans(1) = '0') then if (clk2x = 0) or (r.slv.hsel = '0') then v.slv.hready := '1'; end if; end if; if (clk2x /= 0) and (r.slv.hready = '1') then v.slv.hready2 := '0'; end if; if v.slv.hsel = '0' then v.slv.hready := '1'; end if; vh.oen := '0'; if (clk2x /= 0) then if (hclken and r.slv.hsel and (r.slv.hready2 or v.slv.hready)) = '1' then vh.oen := '1'; end if; if (r.slv.hsel = '1') and (r.cnt = "111") and (hclken = '0') then iuacc := '0'; end if; end if; if rst = '0' then v.bn := (others => r.dsubre(2)); v.bmsk := (others => '0'); v.dmsk := (others => '0'); v.ss := (others => '0'); v.timer := (others => '0'); v.slv.hsel := '0'; for i in 0 to NCPU-1 loop v.bw(i) := r.dsubre(2); v.be(i) := r.dsubre(2); v.bx(i) := r.dsubre(2); v.bz(i) := r.dsubre(2); v.bs(i) := '0'; v.te(i) := '0'; end loop; tv.ahbactive := '0'; tv.enable := '0'; tv.hsel := '0'; tv.dcnten := '0'; tv.tbreg1.read := '0'; tv.tbreg1.write := '0'; tv.tbreg2.read := '0'; tv.tbreg2.write := '0'; v.slv.hready := '1'; v.halt := (others => '0'); end if; vabufi.enable := vabufi.enable and not ahbsi.scanen; vabufi.diag := ahbsi.testen & "000"; rin <= v; trin <= tv; tbi <= vabufi; for i in 0 to NCPU-1 loop dbgo(i).tenable <= r.te(i); dbgo(i).dsuen <= r.en(i); dbgo(i).dbreak <= r.bn(i); -- or (dbgmode and r.bmsk(i)); if conv_integer(r.slv.haddr(PROC_H downto PROC_L)) = i then dbgo(i).denable <= iuacc; else dbgo(i).denable <= '0'; end if; dbgo(i).step <= r.ss(i); dbgo(i).berror <= r.be(i); dbgo(i).bsoft <= r.bs(i); dbgo(i).bwatch <= r.bw(i); dbgo(i).btrapa <= r.bx(i); dbgo(i).btrape <= r.bz(i); dbgo(i).daddr <= r.slv.haddr(PROC_L-1 downto 2); dbgo(i).ddata <= r.slv.hwdata; dbgo(i).dwrite <= r.slv.hwrite; dbgo(i).halt <= r.halt(i); dbgo(i).reset <= r.reset(i); dbgo(i).timer(tbits-1 downto 0) <= r.timer; dbgo(i).timer(30 downto tbits) <= (others => '0'); end loop; ahbso.hconfig <= hconfig; ahbso.hresp <= HRESP_OKAY; ahbso.hready <= r.slv.hready; if (clk2x = 0) then ahbso.hrdata <= r.slv.hrdata; else ahbso.hrdata <= hrdata2x; end if; ahbso.hsplit <= (others => '0'); ahbso.hcache <= '0'; ahbso.hirq <= hirq; ahbso.hindex <= hindex; dsuo.active <= r.act; dsuo.tstop <= tstop; dsuo.pwd <= cpwd; rhin <= vh; end process; comb2gen0 : if (clk2x /= 0) generate ag0 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hmastlock, hclken, ahbsi2.hmastlock); ag1 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hwrite, hclken, ahbsi2.hwrite); ag2 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hready, hclken, ahbsi2.hready); gen3 : for i in ahbsi.haddr'range generate ag3 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.haddr(i), hclken, ahbsi2.haddr(i)); end generate; gen4 : for i in ahbsi.htrans'range generate ag4 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.htrans(i), hclken, ahbsi2.htrans(i)); end generate; gen5 : for i in ahbsi.hwdata'range generate ag5 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hwdata(i), hclken, ahbsi2.hwdata(i)); end generate; gen6 : for i in ahbsi.hsize'range generate ag6 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hsize(i), hclken, ahbsi2.hsize(i)); end generate; gen7 : for i in ahbsi.hburst'range generate ag7 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hburst(i), hclken, ahbsi2.hburst(i)); end generate; gen8 : for i in ahbsi.hmaster'range generate ag8 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hmaster(i), hclken, ahbsi2.hmaster(i)); end generate; gen9 : for i in ahbsi.hsel'range generate ag9 : clkand generic map (tech => 0, ren => 0) port map (ahbsi.hsel(i), hclken, ahbsi2.hsel(i)); end generate; gen10 : for i in hrdata2x'range generate ag10 : clkand generic map (tech => 0, ren => 0) port map (r.slv.hrdata(i), rh.oen, hrdata2x(i)); end generate; reg2 : process(hclk) begin if rising_edge(hclk) then rh <= rhin; end if; end process; end generate; comb2gen1 : if (clk2x = 0) generate ahbsi2 <= ahbsi; rh.irq <= '0'; rh.oen <= '0'; hrdata2x <= (others => '0'); end generate; reg : process(cpuclk) begin if rising_edge(cpuclk) then r <= rin; end if; end process; tb0 : if TRACEN generate treg : process(cpuclk) begin if rising_edge(cpuclk) then tr <= trin; end if; end process; mem0 : tbufmem generic map (tech => tech, tbuf => kbytes) port map (cpuclk, tbi, tbo);-- pragma translate_off bootmsg : report_version generic map ("dsu3_" & tost(hindex) & ": LEON3 Debug support unit + AHB Trace Buffer, " & tost(kbytes) & " kbytes");-- pragma translate_on end generate; notb : if not TRACEN generate-- pragma translate_off bootmsg : report_version generic map ("dsu3_" & tost(hindex) & ": LEON3 Debug support unit");-- pragma translate_on end generate;end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -