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

📄 svgactrl.vhd

📁 free hardware ip core about sparcv8,a soc cpu in vhdl
💻 VHD
📖 第 1 页 / 共 2 页
字号:
        if (dmao.haddr(burstlen+1 downto 0) = ((burstlen+1 downto 2 => '1') & "00")) then              v.start := '0';        end if;      end if;                          ----------------------------------------      v.sync_w := v.sync_w and read_status; ------------ Fifo sync part ------------      if v.level >= (part -1)  then        if read_status(r.status) = '1' and v.sync_w(r.status) = '0'  and v.level = part then          v.level := 0;          if r.status = 0 then            v.sync_w(2) := '1';          else            v.sync_w(r.status -1) := '1';          end if;          v.status := v.status + 1;          if v.status = 3  then            v.status := 0;          end if;        else          v.start := '0';        end if;      end if;    end if;                            ------------------------------------------                                       ------------ Write reset part ------------    if res_mod = '0' or write_en = '1' then      v.adress := r.int_reg(5);      v.start := '0';      v.sync_w := "000";      v.status := 1;      v.ram_address := 0;      v.write_pointer := 0;      v.level := 0;    end if;                              -------------------------------------------- Assertions     rin         <= v;    sync_c.s1    <= v.sync_c;    sync_w.s1    <= r.sync_w;    res_mod      <= sync_c.s3(1);    en_mod       <= sync_c.s3(0);    write_status <= sync_w.s3;    hvideo     <= r.int_reg(1)(15 downto 0);    vvideo     <= r.int_reg(1)(31 downto 16);        hfporch    <= r.int_reg(2)(15 downto 0);        vfporch    <= r.int_reg(2)(31 downto 16);        hsyncpulse <= r.int_reg(3)(15 downto 0);    vsyncpulse <= r.int_reg(3)(31 downto 16);        hmax       <= r.int_reg(4)(15 downto 0);        vmax       <= r.int_reg(4)(31 downto 16);    apbo.prdata  <= rdata;    dmai.wdata  <= (others => '0');    dmai.burst  <= '1';    dmai.irq    <= '0';    dmai.size   <= "10";                        dmai.write  <= '0';    dmai.busy   <= '0';    dmai.start    <= r.start and r.enable;    dmai.address  <= r.adress;    write_pointer_fifo <= conv_std_logic_vector(v.ram_address,10);    write_pointer_clut <= r.write_pointer_clut;    datain_fifo   <= v.data;    datain_clut <= r.datain_clut;    write_en_clut <= r.write_en_clut;    clk_sel <= r.clk_sel;  end process;  read_proc : process(t,res_mod,en_mod,write_status,dataout_fifo,sync_rb,dataout_clut,    vmax, hmax, hvideo, hfporch, hsyncpulse, vvideo, vfporch, vsyncpulse, sync_ra)  variable v : read_type;  variable inc_pointer : std_logic;  begin        v := t;    v.vsync2 := t.vsync; v.hsync2 := t.hsync; v.csync2 := t.csync;    v.blank2 := t.blank;-- Syncsignals generation functions.--------------------------------------------------------------------------------------------------------------------------------------------------------------           if en_mod = '0' then      -- vertical counter      if (t.vcounter = vmax ) and (t.hcounter = hmax ) then        v.vcounter  := (others => '0');      elsif t.hcounter = hmax then        v.vcounter  := t.vcounter  +1;      end if;        -- horizontal counter      if t.hcounter < hmax then v.hcounter := t.hcounter +1;      else v.hcounter := (others => '0'); end if;            -- generate hsync      if t.hcounter < (hvideo+hfporch+hsyncpulse) and (t.hcounter > (hvideo+hfporch -1)) then        v.hsync := r.hpolarity;      else v.hsync := not r.hpolarity; end if;            -- generate vsync      if t.vcounter <= (vvideo+vfporch+vsyncpulse) and (t.vcounter > (vvideo+vfporch)) then        v.vsync := r.vpolarity;                   else v.vsync := not r.vpolarity; end if;            --generate csync & blank signal      v.csync := not (v.hsync xor v.vsync);      v.blank := not t.fifo_ren;        --generate fifo_ren -signal      if (t.hcounter = (hmax -1) and t.vcounter = vmax) or         (t.hcounter = (hmax -1 ) and t.vcounter < vvideo) then        v.fifo_ren := '0';      elsif t.hcounter = (hvideo -1) and t.vcounter <= vvideo then        v.fifo_ren := '1';      end if;        --generate fifo_en -signal      if t.vcounter = vmax then         v.fifo_en := '0';      elsif t.vcounter = vvideo and t.hcounter = (hvideo -1) then         v.fifo_en := '1';      end if;    end if;    if r.func /= "01" then -- do not delay strobes when not using CLUT      v.vsync2 := v.vsync; v.hsync2 := v.hsync; v.csync2 := v.csync;      v.blank2 := v.blank;    end if;   -- Sync reset part ---------    if res_mod = '0' then      v.hcounter := hmax;      v.vcounter := vmax - 1;      v.hsync := r.hpolarity;      v.vsync := r.vpolarity;      v.blank := '0';      v.fifo_ren := '1';      v.fifo_en := '1';    end if;-- Read from fifo.--------------------------------------------------------------------------------------------------------------------------------------------------------------    inc_pointer := '0';       if t.fifo_en = '0' then                                  ------------ Fifo sync part ------------       if (v.read_pointer_out = 0 or v.read_pointer_out = part or        v.read_pointer_out = (part + part)) and t.fifo_ren = '0'        and  v.index = "00"       then        case t.sync  is        when "111" | "011" =>          if write_status(0) = '1' then            v.sync := "110"; v.lock := '0';          else v.lock := '1'; end if;        when "110" =>          if write_status(1) = '1' then             v.sync := "101"; v.lock := '0';          else v.lock := '1'; end if;        when "101" =>          if write_status(2) = '1' then            v.sync := "011"; v.lock := '0';          else v.lock := '1'; end if;        when others => null;        end case;      end if;    ------------------------------------------  ------------ Fifo read part  -------------  ------------ and CLUT access -------------        if t.fifo_ren = '0' and v.lock = '0' then          case r.func is        when "01" =>          if t.index = "00" then            v.read_pointer_clut := dataout_fifo(31 downto 24);            v.index := "01";          elsif t.index = "01" then            v.read_pointer_clut := dataout_fifo(23 downto 16);            v.index := "10";          elsif t.index = "10" then            v.read_pointer_clut := dataout_fifo(15 downto 8);            v.index := "11";          else            v.read_pointer_clut := dataout_fifo(7 downto 0);            v.index := "00"; inc_pointer := '1';          end if;          v.data_out := dataout_clut;        when "10" =>          if t.index = "00" then            v.data_out := dataout_fifo(31 downto 27) & "000"  &            dataout_fifo(26 downto 21) & "00" & dataout_fifo(20 downto 16) & "000";             v.index := "01";          else            v.data_out := dataout_fifo(15 downto 11) & "000" &              dataout_fifo(10 downto 5)  & "00" & dataout_fifo(4 downto 0)   & "000";            v.index := "00"; inc_pointer := '1';          end if;        when "11" =>          v.data_out := dataout_fifo(23 downto 0);          v.index := "00"; inc_pointer := '1';        when others =>          v.data_out := (23 downto 0 => '1');          v.index := "00"; inc_pointer := '1';        end case;      else        v.data_out := (others => '0');      end if;        if inc_pointer = '1' then        v.read_pointer_out := t.read_pointer;        v.read_pointer := t.read_pointer + 1;          if v.read_pointer = length then          v.read_pointer := 0;        end if;        if v.read_pointer_out = length then          v.read_pointer_out := 0;        end if;          end if;    else      v.data_out := (others => '0');    end if;                           ------------------------------------------                                  ------------ Fifo read reset part  -------    if res_mod = '0' or t.fifo_en = '1' then      v.sync := "111";      v.read_pointer_out := 0;      v.read_pointer := 1;      v.data_out := (others => '0');      v.lock := '1';      v.index := "00";    end if;                           ------------------------------------------    tin <= v;    sync_ra.s1   <= t.sync;    sync_rb.s1   <= t.fifo_en & "00";    read_status  <= sync_ra.s3;    write_en     <= sync_rb.s3(2);    fifo_en      <= t.fifo_en;    read_pointer_clut <= v.read_pointer_clut;    read_pointer_fifo <= conv_std_logic_vector(v.read_pointer_out,10);    vgao.video_out_r <= t.data_out(23 downto 16);    vgao.video_out_g <= t.data_out(15 downto 8);    vgao.video_out_b <= t.data_out(7 downto 0);    vgao.hsync     <= t.hsync2;    vgao.vsync     <= t.vsync2;    vgao.comp_sync <= t.csync2;    vgao.blank     <= t.blank2;  end process;  proc_clk : process(clk)  begin    if rising_edge(clk) then      r <= rin;              -- Control      sync_ra.s2 <= sync_ra.s1;      -- Write      sync_ra.s3 <= sync_ra.s2;      -- Write      sync_rb.s2 <= sync_rb.s1;      -- Write      sync_rb.s3 <= sync_rb.s2;      -- Write    end if;  end process;           proc_vgaclk : process(vgaclk)  begin    if rising_edge(vgaclk) then      t <= tin;                    -- Read      sync_c.s2 <= sync_c.s1;      -- Control      sync_c.s3 <= sync_c.s2;      -- Control      sync_w.s2 <= sync_w.s1;      -- Read      sync_w.s3 <= sync_w.s2;      -- Read    end if;  end process;end ;

⌨️ 快捷键说明

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