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

Subversion Repositories mblite

[/] [mblite/] [trunk/] [hw/] [core/] [core_address_decoder.vhd] - Diff between revs 2 and 6

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

Rev 2 Rev 6
Line 29... Line 29...
(
(
    m_dmem_i : OUT dmem_in_type;
    m_dmem_i : OUT dmem_in_type;
    s_dmem_o : OUT dmem_out_array_type(G_NUM_SLAVES - 1 DOWNTO 0);
    s_dmem_o : OUT dmem_out_array_type(G_NUM_SLAVES - 1 DOWNTO 0);
    m_dmem_o : IN dmem_out_type;
    m_dmem_o : IN dmem_out_type;
    s_dmem_i : IN dmem_in_array_type(G_NUM_SLAVES - 1 DOWNTO 0);
    s_dmem_i : IN dmem_in_array_type(G_NUM_SLAVES - 1 DOWNTO 0);
    clk_i : std_ulogic
    clk_i : std_logic
);
);
END core_address_decoder;
END core_address_decoder;
 
 
ARCHITECTURE arch OF core_address_decoder IS
ARCHITECTURE arch OF core_address_decoder IS
 
 
    -- Decodes the address based on the memory map. Returns "1" if 0 or 1 slave is attached.
    -- Decodes the address based on the memory map. Returns "1" if 0 or 1 slave is attached.
    FUNCTION decode(adr : std_ulogic_vector) RETURN std_ulogic_vector IS
    FUNCTION decode(adr : std_logic_vector) RETURN std_logic_vector IS
        VARIABLE result : std_ulogic_vector(G_NUM_SLAVES - 1 DOWNTO 0);
        VARIABLE result : std_logic_vector(G_NUM_SLAVES - 1 DOWNTO 0);
    BEGIN
    BEGIN
        result := (OTHERS => '1');
        result := (OTHERS => '1');
        IF G_NUM_SLAVES > 1 AND notx(adr) THEN
        IF G_NUM_SLAVES > 1 AND notx(adr) THEN
            FOR i IN G_NUM_SLAVES - 1 DOWNTO 0 LOOP
            FOR i IN G_NUM_SLAVES - 1 DOWNTO 0 LOOP
                IF (adr >= G_MEMORY_MAP(i) AND adr < G_MEMORY_MAP(i+1)) THEN
                IF (adr >= G_MEMORY_MAP(i) AND adr < G_MEMORY_MAP(i+1)) THEN
Line 52... Line 52...
            END LOOP;
            END LOOP;
        END IF;
        END IF;
        RETURN result;
        RETURN result;
    END FUNCTION;
    END FUNCTION;
 
 
    FUNCTION demux(dmem_i : dmem_in_array_type; ce, r_ce : std_ulogic_vector) RETURN dmem_in_type IS
    FUNCTION demux(dmem_i : dmem_in_array_type; ce, r_ce : std_logic_vector) RETURN dmem_in_type IS
        VARIABLE dmem : dmem_in_type;
        VARIABLE dmem : dmem_in_type;
    BEGIN
    BEGIN
        dmem := dmem_i(0);
        dmem := dmem_i(0);
        IF notx(ce) THEN
        IF notx(ce) THEN
            FOR i IN G_NUM_SLAVES - 1 DOWNTO 0 LOOP
            FOR i IN G_NUM_SLAVES - 1 DOWNTO 0 LOOP
Line 69... Line 69...
            END LOOP;
            END LOOP;
        END IF;
        END IF;
        RETURN dmem;
        RETURN dmem;
    END FUNCTION;
    END FUNCTION;
 
 
    SIGNAL r_ce, ce : std_ulogic_vector(G_NUM_SLAVES - 1 DOWNTO 0) := (OTHERS => '1');
    SIGNAL r_ce, ce : std_logic_vector(G_NUM_SLAVES - 1 DOWNTO 0) := (OTHERS => '1');
 
 
BEGIN
BEGIN
 
 
    ce <= decode(m_dmem_o.adr_o);
    ce <= decode(m_dmem_o.adr_o);
    m_dmem_i <= demux(s_dmem_i, ce, r_ce);
    m_dmem_i <= demux(s_dmem_i, ce, r_ce);

powered by: WebSVN 2.1.0

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