Vhdl 函数重载';高/';低的

Vhdl 函数重载';高/';低的,vhdl,Vhdl,我的许多VHDL设计都依赖于“for ____; generate”循环,其中我使用generate来实例化具有泛型的组件。这些组件的端口宽度通常取决于在generate循环中传递给它们的泛型 在这些组件块中,我通常必须使用信号分配和逻辑中的属性(例如my_sig'high和my_sig'low)。这意味着,如果我的信号名很长,这项技术将变得非常麻烦 是否有人对“运算符”执行过函数重载?(注意,我知道它不是操作员,我只是记不起它的技术术语) 假设我有移位寄存器的以下代码 signal my_sh

我的许多VHDL设计都依赖于“for ____; generate”循环,其中我使用
generate
来实例化具有泛型的组件。这些组件的端口宽度通常取决于在generate循环中传递给它们的泛型

在这些组件块中,我通常必须使用信号分配和逻辑中的属性(例如
my_sig'high
my_sig'low
)。这意味着,如果我的信号名很长,这项技术将变得非常麻烦

是否有人对
运算符”执行过函数重载?(注意,我知道它不是操作员,我只是记不起它的技术术语)

假设我有移位寄存器的以下代码

signal my_shift_reg : std_logic_vector(my_generic_high_number downto my_generic_low_number);

...

my_shift_reg(my_shift_reg'high downto my_shift_reg'low + 1) <= my_shift_reg(my_shift_reg'hig -1 downto my_shift_reg'low);

如果能做到这一点,那将是惊人的!对于未来的VHDL更新,这可能是一个很好的QOL工具。

alias语句可能会有所帮助,例如

alias m is my_shift_reg;

my_shift_reg(m'high downto m'low + 1) <= my_shift_reg(m'high -1 downto m'low);
别名m是我的移位寄存器;

my_shift_reg(m'high down to m'low+1)我确实认为别名可能是实现这一点的一种方式,但是,我更多地是从
'high
中查看它,指的是特定行上的shift_reg,即,如果我有多个移位寄存器,我将不得不写入越来越多的别名。我想我更喜欢这样的东西。。。。第1行:
shift_reg1('high downto'low+1)我很喜欢在process语句中创建移位寄存器的别名,这是保持名称空间清晰的好方法!好主意@诵读困难有点像Matlab中的
end
,如果你碰巧知道这种语言:在Matlab中,
myu数组(2:end)
myu数组(2:length(myu数组))的缩写。这将是一个很好的特性,但我认为您要求的是一个额外的语言特性,而不是在当前的语言定义中实现的特性……您要查找的名称是attribute。语言中内置了“高”和“低”属性。它们不是函数,但理论上你可以重写它们,但它们可能不会像你期望的那样工作,因为你必须为每个对象重新定义高和低,最终会比你想要的工作多得多。VHDL是一种正式的表示法。数组的预定义属性high
是一个函数,它从描述属性名称前缀的依赖于实现的模拟内核结构返回一个值,没有历史记录,也不能没有前缀。用户定义的属性是与命名实体关联的任意类型的常量,其名称也不能包含撇号。推测性问题征求意见,而不是询问有关实际编程问题的问题。
alias m is my_shift_reg;

my_shift_reg(m'high downto m'low + 1) <= my_shift_reg(m'high -1 downto m'low);
alias index is my_shift_reg;

my_shift_reg(index'high downto index'low + 1) <= my_shift_reg(index'high -1 downto index'low);
alias high is my_generic_high_number;
alias low is my_generic_low_number;

my_shift_reg(high downto low + 1) <= my_shift_reg(high -1 downto low);
  process (clock) is
    alias index is my_shift_reg;
  begin
    if rising_edge(clock) then
      my_shift_reg(index'high downto index'low + 1) <= my_shift_reg(index'high -1 downto index'low);
    end if;
  end process;
  process (clock) is
    alias high is my_generic_high_number;
    alias low is my_generic_low_number;
  begin
    if rising_edge(clock) then
      my_shift_reg(high downto low + 1) <= my_shift_reg(high -1 downto low);
    end if;
  end process;
library IEEE;
use IEEE.std_logic_1164.all;

entity E is
  generic (
    my_generic_high_number : integer := 7;
    my_generic_low_number  : integer := 0
  );
end entity ;

architecture A of E is
  signal my_shift_reg : std_logic_vector(my_generic_high_number downto my_generic_low_number);
  signal clock : std_logic;
begin
  process (clock) is
    alias m is my_shift_reg;
  begin
    if rising_edge(clock) then
      my_shift_reg(m'high downto m'low + 1) <= my_shift_reg(m'high -1 downto m'low);
    end if;
  end process;

  process (clock) is
    alias index is my_shift_reg;
  begin
    if rising_edge(clock) then
      my_shift_reg(index'high downto index'low + 1) <= my_shift_reg(index'high -1 downto index'low);
    end if;
  end process;

  process (clock) is
    alias high is my_generic_high_number;
    alias low is my_generic_low_number;
  begin
    if rising_edge(clock) then
      my_shift_reg(high downto low + 1) <= my_shift_reg(high -1 downto low);
    end if;
  end process;
end architecture A;