在VHDL/ModelSim中使用配置规范

在VHDL/ModelSim中使用配置规范,vhdl,modelsim,Vhdl,Modelsim,我正在尝试使用VHDL配置规范来预先设置 这应该是可能的,如IEEE1076-2008第7.3.2.1节所示,该节给出了以下示例: entity AND_GATE is generic (I1toO, I2toO: DELAY_LENGTH := 4 ns); port (I1, I2: in BIT; O: out BIT); end entity AND_GATE; entity XOR_GATE is generic (I1toO, I2toO: DELAY_LE

我正在尝试使用VHDL配置规范来预先设置

这应该是可能的,如IEEE1076-2008第7.3.2.1节所示,该节给出了以下示例:

entity AND_GATE is
    generic (I1toO, I2toO: DELAY_LENGTH := 4 ns);
    port (I1, I2: in BIT; O: out BIT);
end entity AND_GATE;

entity XOR_GATE is
    generic (I1toO, I2toO: DELAY_LENGTH := 4 ns);
    port (I1, I2: in BIT; O: out BIT);
end entity XOR_GATE;

package MY_GATES is
    component AND_GATE is
        generic (I1toO, I2toO: DELAY_LENGTH := 4 ns);
        port (I1, I2: in BIT; O: out BIT);
    end component AND_GATE;
    component XOR_GATE is
        generic (I1toO, I2toO: DELAY_LENGTH := 4 ns);
        port (I1, I2: in BIT; O: out BIT);
    end component XOR_GATE;
end package MY_GATES;

entity Half_Adder is
    port (X, Y: in BIT; Sum, Carry: out BIT);
end entity Half_Adder;

use WORK.MY_GATES.all;

architecture Structure of Half_Adder is
    for L1: XOR_GATE use
        entity WORK.XOR_GATE(Behavior) -- The primary binding
            generic map (3 ns, 3 ns) -- indication for instance L1.
            port map (I1 => I1, I2 => I2, O => O);
    for L2: AND_GATE use
        entity WORK.AND_GATE(Behavior) -- The primary binding
            generic map (3 ns, 4 ns) -- indication for instance L2.
            port map (I1, open, O);
begin
    L1: XOR_GATE port map (X, Y, Sum);
    L2: AND_GATE port map (X, Y, Carry);
end architecture Structure;

use WORK.GLOBAL_SIGNALS.all;

configuration Different of Half_Adder is
    for Structure
        for L1: XOR_GATE
            generic map (2.9 ns, 3.6 ns); -- The incremental binding
        end for; -- indication of L1; rebinds its generics.
        for L2: AND_GATE
            generic map (2.8 ns, 3.25 ns) -- The incremental binding
            port map (I2 => Tied_High); -- indication of L2; rebinds
        end for; -- its generics and binds its open port.
    end for;
end configuration Different;
即使我自己添加了示例中缺少的包

package GLOBAL_SIGNALS is
    constant Tied_High : bit := '1';
end package GLOBAL_SIGNALS;
Modelsim中的精化仍然失败

错误:[……]/half_adder.vhd(36):(vcom-1035)正式端口“I2”已打开或没有实际关联

由线路引起的

port map (I1, open, O);
这似乎已经表明Modelsim不正确支持这些配置语句

我想使用此配置规范来简化我的设计入门

例如:

entity comp is
    generic(step : time; defined: boolean);
    port(clk, data : in bit);
end entity;

entity e is end entity e;

architecture a of e is
    component comp is
        generic(step : time; defined: boolean);
        port(clk, data : in bit);
    end component;
    
    signal clk1, clk2 : bit;
    
    for a : comp use
        entity work.comp
            generic map(step => 1 ns)
            port map(clk => clk1);
    for b : comp use
        entity work.comp
            generic map(step => 100 ns)
            port map(clk => clk2);
    for all : comp use
        entity work.comp
            generic map(defined => true);

    signal sig_a, sig_b : bit;
    
begin
    a: comp
        port map(data => sig_a);

    b_gen : for i in 0 to 2 generate
        b: comp
            port map(data => sig_b);
    end generate;
end architecture;
此代码引发大量错误:

错误:[……]/e.vhd(19):(vcom-1031)正式泛型“已定义”已打开或没有实际关联

错误:[……]/e.vhd(19):(vcom-1035)正式端口“数据”已打开或没有实际关联

错误:[……]/e.vhd(23):(vcom-1031)正式泛型“已定义”已打开或没有实际关联

错误:[……]/e.vhd(23):(vcom-1035)正式端口“数据”已打开或没有实际关联

错误:[……]/e.vhd(26):(vcom-1031)正式通用“步骤”已打开或没有实际关联

错误:[……]/e.vhd(24):组件“comp”的所有配置规范都试图重新绑定已绑定的实例

错误:[……]/e.vhd(24):组件“comp”的所有配置规范都试图重新绑定已绑定的实例

错误:[……]/e.vhd(32):(vcom-1031)正式的通用“步骤”已打开或没有实际关联

错误:[……]/e.vhd(32):(vcom-1031)正式泛型“已定义”已打开或没有实际关联

错误:[……]/e.vhd(32):(vcom-1035)正式端口“clk”已打开或没有实际关联

错误:[……]/e.vhd(36):(vcom-1031)正式通用“步骤”已打开或没有实际关联

错误:[……]/e.vhd(36):(vcom-1031)正式泛型“已定义”已打开或没有实际关联

错误:[……]/e.vhd(36):(vcom-1035)正式端口“clk”已打开或没有实际关联

警告:[……]/e.vhd(24):(vcom-1263)配置规范“all:comp”不适用于任何组件实例化语句

错误:[……]/e.vhd(20):未找到标签为“b”的语句

因此,这似乎不是使用配置规范的受支持方式。太糟糕了,因为这会让我的设计更容易进入


我认为这只是Modelsim的一个bug,或者配置规范不会以这种方式帮助这些默认绑定吗?

问题已经改变,答案也改变了

Modelsim中的精化仍然失败。

错误:[……]/half_adder.vhd(36):(vcom-1035)正式端口“I2”已打开或没有实际关联

由线路引起的

port map (I1, open, O);
这似乎已经表明Modelsim不正确支持这些配置语句。

没有“适当的”可以应用于您的结论,这是VHDL标准不支持的

该错误似乎是由于在I2未绑定时试图详细说明
Half_Adder
。配置规范将I2与
open
关联,这是不允许的

如果您创建了一个:

除了缺少配置声明外,该示例还通过Modelsim错误和警告以及ghdl说明了这些缺点:


综合工具通常支持配置规范,但不支持配置声明。增量绑定在应用于面向硅的设计时没有实际用途。

谢谢。嗯,这意味着我不能对组件的不同默认分配使用配置规范,正如IEEE1076-2008第7.3.2.1节所指出的(有关更详细的示例,请参阅问题中的编辑)这样,我实际上看不到配置规范的附加值:默认分配可以添加到de组件声明中,实体/体系结构可以在实例化
label:entity work.ent\u name(arch\u name)
中选择。这样,我认为配置规范的使用非常有限。(使用时非常精细)是的,你说得对。然而,通过使用默认绑定,您可能会错过忘记指定的绑定(这可能发生在大型VLSI设计中)。如果让它保持打开状态,您将得到一个错误。我想使用
定义的
泛型来检查配置是否已成功解析。但我似乎不能。我只是尝试在Modelsim(-2008模式)中运行IEEE1076-2008第7.3.2.1节中的示例。但Modelsim似乎没有计算。“正式端口“I2”已打开或没有实际关联。”在架构
结构
L2
的配置规范行。Modelsim错了,还是示例错了?在任何情况下,配置的附加值似乎都不算高,因为他们没有投入足够的精力使其正常工作。配置声明中的配置规范可能非常强大——它们不需要更改原始设计描述。例如,您可以将一个库中的实体替换为另一个库中的实体,并提供一个允许使用不同实际名称的接口。例如,使用不同供应商的单元库。部分原因是合成供应商不支持将其视为零和竞争的配置声明,而他们可以在测试台上用于验证不同抽象级别的配置声明。如对L2:和_GATE的端口图的回答I2的评论所述,来自未提供的包global_signals的信号描述为在库工作中通过use子句找到的信号。它将是bit类型包中的一个信号,带有
-- IEEE Std 1076-1993 5.2.1 Binding Indication (example)
-- -2008 7.3.2.1

package global_signals is   -- THIS PACKAGE MISSING IN THE EXAMPLE
    signal Tied_High:   bit := '1';
end package;

entity AND_GATE is           -- ADDED entity and architecture
    generic (I1toO, I2toO: DELAY_LENGTH := 4 ns);
    port        (I1, I2: in BIT;   O: out BIT);
end entity AND_GATE;

architecture Behavior of AND_GATE is  -- ADDED
    signal In1, In2:    BIT;
begin
    In1 <= I1 after I1toO;
    In2 <= I2 after I2toO;

    O <= In1 and In2;

    process
    begin
        report
            LF & HT & "I1to0 = " & time'image(I1toO) &
            LF & HT & "I2to0 = " & time'image(I2toO);
        wait;
    end process;
end architecture Behavior;

entity XOR_GATE is            -- ADDED entity and architecture
    generic (I1toO, I2toO : DELAY_LENGTH := 4 ns);
    port        (I1, I2: in BIT;    O : out BIT);
end entity XOR_GATE;

architecture Behavior of XOR_GATE is  -- ADDED
    signal In1, In2:    BIT;
begin
    In1 <= I1 after I1toO;
    In2 <= I2 after I2toO;

    O <= In1 xor In2;

    process
    begin
        report
            LF & HT & "I1to0 = " & time'image(I1toO) &
            LF & HT & "I2to0 = " & time'image(I2toO);
        wait;
    end process;
end architecture Behavior;

package MY_GATES is
   component AND_GATE is
      generic  (I1toO, I2toO: DELAY_LENGTH := 4 ns);
      port       (I1, I2: in BIT;   O: out BIT);
   end component AND_GATE;

   component XOR_GATE is
      generic  (I1toO, I2toO: DELAY_LENGTH := 4 ns);
      port       (I1, I2: in BIT;   O : out BIT);
   end component XOR_GATE;
end package MY_GATES;

entity Half_Adder is
    port    (X, Y: in BIT;
               Sum, Carry: out BIT);
end entity Half_Adder;

use WORK.MY_GATES.all;
architecture Structure of Half_Adder is
    signal O:   bit;            -- Added
    for L1: XOR_GATE use
        entity WORK.XOR_GATE(Behavior)      --  The primary binding indication
             generic map (3 ns, 3 ns)       --  for instance L1.
             port map (I1 => I1, I2 => I2, O => O);

    for L2: AND_GATE use
        entity WORK.AND_GATE(Behavior)      --  The primary binding indication
             -- generic map (3 ns, 4 ns)       --  for instance L2.
             port map (I1, open, O);

begin
    L1: XOR_GATE    port map (X, Y, Sum);
    L2: AND_GATE    port map (X, Y, Carry);
end architecture Structure;

use WORK.GLOBAL_SIGNALS.all;

configuration Different of Half_Adder is
    for Structure
        for L1: XOR_GATE
            generic map (2.9 ns, 3.6 ns); --  The  incremental binding
        end for;               --  indication of L1; rebinds its generics.

        for L2: AND_GATE
            generic map (2.8 ns, 3.25 ns)  -- The incremental binding
            port map (I2 => Tied_High); -- indication L2; rebinds its generics
        end for;                          -- and binds its open port.
    end for;
end configuration Different;
entity comp is
    generic(step : time; defined: boolean);
    port(clk, data : in bit);
end entity;

entity e is end entity e;

architecture a of e is
    component comp is
        generic(step : time; defined: boolean);
        port(clk, data : in bit);
    end component;

    signal clk1, clk2 : bit;

    for a : comp use                          -- Line 15
        entity work.comp
            generic map(step => 1 ns)
            port map(clk => clk1);
    for b : comp use                          -- Line 20
        entity work.comp
            generic map(step => 100 ns)
            port map(clk => clk2);
    for all : comp use                        -- Line 24
        entity work.comp
            generic map(defined => true);

    signal sig_a, sig_b : bit;

begin
    a: comp                                   -- Line 31
        port map(data => sig_a);

    b_gen : for i in 0 to 2 generate
        b: comp                              -- Line 35
            port map(data => sig_b);
    end generate;
end architecture;
ghdl -a e.vhdl
e.vhdl:31:5:error: no actual for constant interface "step"
e.vhdl:35:9:error: no actual for constant interface "step"
e.vhdl:20:9:error: no component instantation with label "b"
e.vhdl:24:5:error: component instance "a" is already bound by a configuration specification
e.vhdl:16:5:error: (previous is configuration specification)
ghdl:error: compilation error