vhdl - select/when 语句 vhdl 中的多条指令
问题描述
我有一个作业,我必须使用 vhdl 来描述一个 alu,我们的老师要求我们使用select/when语句。
我几乎已经完成了,但是在某些操作码中,alu 必须“返回”两个输入的有符号和无符号乘法和除法的 msb 和 lsb。
现在我的问题是我无法为一个 when编写多条指令。当我尝试编译时,我得到某种“语法错误”。
你们中的任何人都知道如何做到这一点?
这是我的实体
entity alu is
port (
a : in std_logic_vector(15 downto 0);
b : in std_logic_vector(15 downto 0);
opcode: in std_logic_vector(3 downto 0);
res : out std_logic_vector(15 downto 0)
);
end entity alu;
这是架构。
architecture RTL of alu is
signal um : std_logic_vector(31 downto 0);
begin
-- Implémenter le fonctionnement
with opcode select res <=
std_logic_vector(unsigned(a) + unsigned(b)) when "0000",
std_logic_vector(unsigned(a) - unsigned(b)) when "0001",
not a when "0010",
a or b when "0011",
a and b when "0100",
a xor b when "0101",
a when "0110", -- yet todo
(um <= std_logic_vector(signed(a) * signed(b)); res <= um(31 downto 16)) when "0111", -- at this line
std_logic_vector(signed(a) * signed(b))(15 downto 0) when "1000", -- at this line
std_logic_vector(unsigned(a) * unsigned(b))(31 downto 16) when "1001", -- at this line
std_logic_vector(unsigned(a) * unsigned(b))(15 downto 0) when "1010", -- at this line
a when "1011",
b when "1100",
x"DEAD" when others;
非常感谢您的时间。
解决方案
推荐阅读
- haskell - 约束中的非类型变量参数:Enum A => Ord A
- php - 在 cPanel 中实例化新的 PHPMailer 类时 PHP 代码中断
- c# - 尝试使用启动文件中的 GetSection 访问配置值时为空。(IOptions-config 检索)
- d3.js - D3 每个轴上不同的缩放系数
- sql - 删除另一个表没有指向的重复记录
- javascript - Fat Arrow 函数/回调函数的类型是什么?
- google-smart-home - action.devices.traits.Modes 上的某些模式似乎不起作用
- c - 如何识别特定文件是否在C中第一次被调用
- discord - Discord bot 检查我的世界服务器是否在线
- for-loop - 推后是否影响标量值...(Raku)