0

我有两个 163 位数,我想用乘数映射。但是对于乘数来说,a(162 down to 0)和b只有一位。那么我该怎么做呢?请帮忙。

entity demo_pointadd is
    Port ( x : in  STD_LOGIC_VECTOR (162 downto 0);
           y : in  STD_LOGIC_VECTOR(162 downto 0);
           p : out  STD_LOGIC_VECTOR (162 downto 0);
           q : out  STD_LOGIC_VECTOR (162 downto 0);
          clk : in  STD_LOGIC;
           reset : in  STD_LOGIC);
end demo_pointadd;

-- component declaration
component full_163bitmul
    Port ( a : in  STD_LOGIC_VECTOR (162 downto 0);
           b : in  STD_LOGIC;
           clk : in  STD_LOGIC;
           reset : in  STD_LOGIC;
           c : out  STD_LOGIC_VECTOR (162 downto 0));
end component;
begin
mul_1 :full_163bitmul 
                       port map (a => x,
                                 b => y, --- PROBLEM??
                                 clk => clk,
                                 reset => reset,
                                  c => p);
4

1 回答 1

0

这本身似乎没有乘数。当我猜测full_163bitmul的代码时,输​​出'c'将是'a'(如果b='1')或全零(如果b='0')或未定义(如果b是'Z' | 'X' | ...)。

如果你想用它构建一个完整的乘法器,你必须遍历'y'向量并将单个位带到'b'输入并对结果进行加法和移位。

sig_b<=y(i);

mul_1 :full_163bitmul 
port map 
    (a => s_x,
    b => sig_b, 
    clk => clk,
    reset => reset,
    c => temp);

...
于 2013-07-29T13:10:49.590 回答