OpenCores
URL https://opencores.org/ocsvn/mblite/mblite/trunk

Subversion Repositories mblite

[/] [mblite/] [trunk/] [hw/] [core/] [fetch.vhd] - Diff between revs 6 and 8

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 6 Rev 8
Line 12... Line 12...
--                           the instructions. The next instruction is computed in the decode
--                           the instructions. The next instruction is computed in the decode
--                           stage.
--                           stage.
--
--
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
 
 
LIBRARY ieee;
library ieee;
USE ieee.std_logic_1164.ALL;
use ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.ALL;
use ieee.std_logic_unsigned.all;
 
 
LIBRARY mblite;
library mblite;
USE mblite.config_Pkg.ALL;
use mblite.config_Pkg.all;
USE mblite.core_Pkg.ALL;
use mblite.core_Pkg.all;
USE mblite.std_Pkg.ALL;
use mblite.std_Pkg.all;
 
 
ENTITY fetch IS PORT
entity fetch is port
(
(
    fetch_o : OUT fetch_out_type;
    fetch_o : out fetch_out_type;
    imem_o  : OUT imem_out_type;
    imem_o  : out imem_out_type;
    fetch_i : IN fetch_in_type;
    fetch_i : in fetch_in_type;
    rst_i   : IN std_logic;
    rst_i   : in std_logic;
    ena_i   : IN std_logic;
    ena_i   : in std_logic;
    clk_i   : IN std_logic
    clk_i   : in std_logic
);
);
END fetch;
end fetch;
 
 
ARCHITECTURE arch OF fetch IS
architecture arch of fetch is
    SIGNAL r, rin   : fetch_out_type;
    signal r, rin   : fetch_out_type;
BEGIN
begin
 
 
    fetch_o.program_counter <= r.program_counter;
    fetch_o.program_counter <= r.program_counter;
    imem_o.adr_o <= rin.program_counter;
    imem_o.adr_o <= rin.program_counter;
    imem_o.ena_o <= ena_i;
    imem_o.ena_o <= ena_i;
 
 
    fetch_comb: PROCESS(fetch_i, r, rst_i)
    fetch_comb: process(fetch_i, r, rst_i)
        VARIABLE v : fetch_out_type;
        variable v : fetch_out_type;
    BEGIN
    begin
        v := r;
        v := r;
        IF fetch_i.hazard = '1' THEN
        if fetch_i.hazard = '1' then
            v.program_counter := r.program_counter;
            v.program_counter := r.program_counter;
        ELSIF fetch_i.branch = '1' THEN
        elsif fetch_i.branch = '1' then
            v.program_counter := fetch_i.branch_target;
            v.program_counter := fetch_i.branch_target;
        ELSE
        else
            v.program_counter := increment(r.program_counter(CFG_IMEM_SIZE - 1 DOWNTO 2)) & "00";
            v.program_counter := increment(r.program_counter(CFG_IMEM_SIZE - 1 downto 2)) & "00";
        END IF;
        end if;
        rin <= v;
        rin <= v;
    END PROCESS;
    end process;
 
 
    fetch_seq: PROCESS(clk_i)
    fetch_seq: process(clk_i)
    BEGIN
    begin
        IF rising_edge(clk_i) THEN
        if rising_edge(clk_i) then
            IF rst_i = '1' THEN
            if rst_i = '1' then
                r.program_counter <= (OTHERS => '0');
                r.program_counter <= (others => '0');
            ELSIF ena_i = '1' THEN
            elsif ena_i = '1' then
                r <= rin;
                r <= rin;
            END IF;
            end if;
        END IF;
        end if;
    END PROCESS;
    end process;
 
 
END arch;
end arch;
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.