如何使用1位数的163位数映射?

时间:2013-07-28 22:12:13

标签: vhdl

我有两个163位数字,我想用乘数映射。但对于乘数来说,a(162 downto 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);

1 个答案:

答案 0 :(得分: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);

...