用VHDL生成端口?

时间:2014-04-28 18:58:57

标签: vhdl

有没有办法在VHDL中生成端口声明?我想做一些类似于#IFDEF的调试信号到oscope的引脚。这样我就可以快速启用或禁用调试逻辑。例如:

entity my_entity is
port (  

    debug_label: if debug_on = 1 generate
    debug1: out;
    end debug_label;

    ....

    );
end component;  

当我尝试这样的事情时,这是行不通的。有没有办法使它工作?或者做类似事情的另一种方法?

1 个答案:

答案 0 :(得分:3)

端口不能是有条件的,但是例如a的长度 std_logic_vector可以通过通用配置,长度可以 甚至为0,导致零范围。显示此内容的实体是:

entity mdl is
  generic(
    DEBUG_LEN : natural := 0);
  port(
    ...
    debug_o : out std_logic_vector(DEBUG_LEN - 1 downto 0));
end entity;

您应该运行测试合成以查看所选合成工具的方式 分配到引脚时处理空范围。

相关问题