p_index.vhd

来自「实现二进制长串的算术右移的操作。希望有点参考价值。可以直接运行」· VHDL 代码 · 共 26 行

VHD
26
字号
-- function Delta is actually an arithmatic shift right
-- This strange construction is needed for compatibility with Xilinx WebPack
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;
package p_index  is
function Delta(Arg : std_logic_vector; Cnt : natural) return std_logic_vector;
end p_index;

package body p_index is

function Delta(Arg : std_logic_vector; Cnt : natural) return std_logic_vector is
    variable tmp : std_logic_vector(Arg'range);
     constant lo : integer := Arg'high -cnt +1;
begin
  for n in Arg'high downto lo loop
      tmp(n) := Arg(Arg'high);
  end loop;
  for n in Arg'high -cnt downto 0 loop
      tmp(n) := Arg(n +cnt);
  end loop;
  return tmp;
end function Delta;
end p_index;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?