这是我的VHDL代码错误的端口映射? (微处理器加法器)

时间:2014-02-22 11:35:53

标签: vhdl alu

我得到了这个microadder vhd top文件,我得到了端口映射的regs.vhd,ALUSuma.vhd和MemProgSuma.vhd(注册表,加法器和内存),所有这些都完全正常工作。我也得到了microadder测试台,也在工作。

澄清一下,它是这样运作的:screenshot http://oi59.tinypic.com/2e2m39d.jpg

(我认为问题不在于它的工作方式,而是我如何连接加法器的各个部分)

但是当谈到测试平台的模拟时,某些东西不能正常工作,大多数信号一直显示“U”,好像它们没有被默认...可能是一些不好的映射,但我只是看不到什么,那就是微观问题:

它就是这样的实体:

entity MicroSuma is
    port (
        Clk : in std_logic; -- clock
        NRst : in std_logic; -- reset active with '0'
        MemProgAddr : out std_logic_vector(31 downto 0); -- 
        MemProgData : in std_logic_vector(31 downto 0) -- 
    );
end MicroSuma;

架构:

architecture Practica of MicroSuma is


    component Regs is
        port (
            Clk      : in std_logic; -- clock
            NRst     : in std_logic; -- reset active with '0'
            RtIn    : in  std_logic_vector(31 downto 0); -- input data
            RtAddr  : in  std_logic_vector(4  downto 0); -- RT direction
            RsAddr  : in  std_logic_vector(4 downto 0); -- RS1 direction
            RsOut   : out std_logic_vector(31 downto 0)); -- RS1 output
    end component;


    component ALUSuma is
        port (
            Op1 : in std_logic_vector(31 downto 0); -- first operand
            Op2 : in std_logic_vector(31 downto 0); -- second operand
            Res : out std_logic_vector(31 downto 0) -- Op1 + Op2
        );
    end component;


    component MemProgSUMA is
        port(
            MemProgAddr : in std_logic_vector(31 downto 0); -- direction for the program's memory
            MemProgData : out std_logic_vector(31 downto 0) -- oepration code
        );
    end component;

我的中间信号:

    signal datoInmediato : std_logic_vector(15 downto 0);
    signal rs : std_logic_vector(4 downto 0);
    signal rt : std_logic_vector(4 downto 0);

    -- alu-regs comunication
    signal c : std_logic_vector(31 downto 0);
    signal op1 : std_logic_vector(31 downto 0);

    -- aux signals
    signal op2 : std_logic_vector(31 downto 0);
    signal instruccion : std_logic_vector(31 downto 0);

    -- counter PC signal
    signal contadorPC : std_logic_vector(31 downto 0);

    -- Clock period
    constant CLKPERIOD : time := 10 ns;

我像这样做端口映射:

begin

    U1: Regs port map(
        Clk => Clk,
        NRst => NRst,
        RtIn => c,
        RtAddr => rt,
        RsAddr => rs,
        RsOut => op1
    );

    U2: ALUSuma port map(
        Res => c,
        Op1 => op1,
        Op2 => op2
    );

    U3: MemProgSUMA port map(
        MemProgAddr => contadorPC,
        MemProgData => instruccion
    );

我的程序的简单代码是:

    -- PC Counter
    process (Clk, NRst)
        begin

            if NRst = '0' then
            contadorPC <= (others => '0');

            elsif Clk = '1' and Clk'event then
            contadorPC <= contadorPC + 4;
            end if;

        end process;    


    -- Sign extension
    process(instruccion, datoInmediato)
        begin

            datoInmediato <= instruccion (15 downto 0);


            op2(15 downto 0) <= datoInmediato;
            op2(31 downto 16) <= (others => datoInmediato(15));

            -- MemProgData - Regs comunication
            rs <= instruccion(25 downto 21);
            rt <= instruccion(20 downto 16);

    end process;

end Practica;

这就是全部,它真的会对此有所帮助,因为即时通讯尝试却没有看到我做错了什么......

0 个答案:

没有答案