⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p_index.vhd

📁 实现二进制长串的算术右移的操作。希望有点参考价值。可以直接运行
💻 VHD
字号:
-- 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -