concatenation - 如何使用串联通过 std_logic_vector 移动 std_logic_vector

标签 concatenation vhdl shift

假设我有 2 个 std_logic_vectors:

inputA : std_logic_vector(31 downto 0)
inputB:  std_logic_vector(31 downto 0)

如何使用串联将 inputA 移动 inputB

我知道如何向左或向右移动 1 个位置,但不知道如何向右(或向左)移动 N 个位置。 注意:这是一个无时钟电路,不能使用标准的 vhdl 移位运算符。

除了连接之外的其他技术或想法也将受到赞赏。

最佳答案

最简单的方法是像这样:

library ieee;
use ieee.numeric_std.all;
...
output <= std_logic_vector(unsigned(inputA) srl to_integer(unsigned(inputB)));

(顺便说一句,作为一个无时钟电路与是否能够使用移位运算符无关。决定它的是数据类型。这种移位操作将由合成器转换为相同的逻辑,如果你用 case 语句写了一些更复杂的东西,都是手工展开的。)

关于concatenation - 如何使用串联通过 std_logic_vector 移动 std_logic_vector,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12447010/

相关文章:

c - 如何在 C 中连接两个字符串宏?

c - 请告诉为什么下面程序的输出是 JKLM??而不是 MLKJ?

vhdl - 有 VHDL-2008 标准类型保护类型实现吗?

c - 将数组向左或向右旋转一定数量的位置,复杂度为 o(n)

python - 有条件地在 pandas 中的一个数据框中移动多个部分

mysql - 在mysql中将不同的行连接成一行

javascript - 过滤、映射、排序和连接

c++ - GCC 如何连接多个 C++ std::string 变量?

java - FPGA与PC机通讯

comparison -/= 如何转换为 vhdl 中的实际硬件