首页 > 解决方案 > # ** 致命:(vsim-3807)端口的组件和实体之间的类型不匹配

问题描述

我的 VHDL 文件有一些问题:
我想乘以 14 位值。为此,我只是使用了 Quartus prime 中提供的模板并稍作修改。
编译我的代码工作正常,但如果我尝试使用 .vwf 文件模拟它,我总是会得到Error (vsim-3807).

这是我的代码:

    library ieee;
    use ieee.std_logic_1164.all;
    use ieee.numeric_std.all;
    
    entity MultiplierAndCut is
    
        port 
        ( 
            a       : in signed (13 downto 0);
            b       : in signed (13 downto 0);
            clk     : in std_logic;
            clear       : in std_logic;
            result  : out signed (27 downto 0)
        );
    
    end entity;
    
    architecture rtl of MultiplierAndCut is
    
        -- Declare I/O registers
        signal a_reg, b_reg : signed (13 downto 0);
        signal out_reg    : signed (27 downto 0);
    
    begin
    
        process (clk, clear)
        begin
            if (clear = '1') then
    
                -- Reset all register data to 0
                a_reg <= (others => '0');
                b_reg <= (others => '0');
                out_reg <= (others => '0');
    
            elsif (rising_edge(clk)) then
    
                -- Store input and output values in registers
                a_reg <= a;
                b_reg <= b;
                out_reg <= a_reg * b_reg;
    
            end if;
        end process;
    
        -- Output multiplication result
        result <= out_reg;
    
    end rtl;

对于我使用的模拟a = [0 0 0 0 0 0 0 1 0 0 0 0 0 0] (在我的系统中应该代表小数点 1)b = [0 0 0 0 0 0 0 0 0 1 0 0 0 0] (应该代表小数点 0.25)
我在 .vwf 文件中的模拟如下所示:

在此处输入图像描述

预先感谢您的帮助。

标签: vhdlmodelsim

解决方案


推荐阅读