无法将类型 STD_Logic 转换为类型 unsigned

问题描述 投票:0回答:1

我正在尝试在 32 位 MIPS 单周期处理器的 ALU 中创建无符号加法逻辑,但不断出现此错误:

cannot convert type logic to type unsigned

这就是我到目前为止所拥有的:

with ALUCntl select
    add_result <= std_logic_vector(unsigned(A_u) + unsigned(B_u) + unsigned(Carryin)) when "0010",
                  std_logic_vector(unsigned(A_u) + unsigned(B_u)) when "0101",
                  (others => '0') when others;
ALU_Result <= add_result(31 downto 0);

我尝试在一个过程中使用它,但仍然出现错误。我的 SLT 逻辑中有同样的错误,它通过将它放在流程语句中来工作。我不确定我在这里做错了什么。

syntax vhdl alu
1个回答
0
投票

我猜是进位导致了问题,它只有 1 位,所以将其转换为无符号或有符号都没有意义。

© www.soinside.com 2019 - 2024. All rights reserved.