VHDL警告:(vcom-1263)配置规范“all:bcd”不适用于组件实例化语句

时间:2017-01-25 20:06:18

标签: vhdl compiler-warnings bcd

我一直坚持这个问题。如果有人能提供帮助,我将非常感激。在没有任何解决方案的情况下重复完成了大部分代码。有几组代码正在使用中;这个bcd计数器在我的项目的其余部分进一步使用。我在下面添加了必要的代码:

1位数的BCD计数器:

    LIBRARY IEEE;
    USE IEEE.STD_LOGIC_1164.ALL;
    USE IEEE.NUMERIC_STD.ALL;
    USE WORK.mypackage_p.ALL;

    ENTITY bcd_e IS
    PORT(
    res_i, clk_i, enable_i, counter_res_i   : IN STD_LOGIC;
    bcd_o                   : OUT STD_LOGIC_VECTOR(bcd_width_c-1 DOWNTO 0);
    carry_o                 : OUT STD_LOGIC
    );
    END bcd_e;
    ARCHITECTURE bcd_a OF bcd_e IS

    SIGNAL count_s  : INTEGER RANGE bcd_cnt_c DOWNTO 0;

    BEGIN

    PROCESS(res_i, clk_i)
    BEGIN
    IF (res_i = '1') THEN
        count_s <= 0;
    ELSIF (clk_i = '1' AND clk_i'EVENT) THEN
        IF (enable_i = '1') THEN
            IF(count_s >= bcd_cnt_c) THEN
                count_s <= 0;
            ELSE
                count_s <= count_s + 1;
            END IF;
        END IF;
        IF (counter_res_i = '1') THEN
            count_s <= 0;
        END IF;
    END IF;
    END PROCESS;

    bcd_o <= STD_LOGIC_VECTOR(to_unsigned(count_s, bcd_width_c));
    carry_o <= '1' WHEN (count_s = bcd_cnt_c) ELSE '0';

    END bcd_a;

使用上述bcd计数器的8位BCD创建8位数

    LIBRARY IEEE;
    USE IEEE.STD_LOGIC_1164.ALL;
    USE IEEE.NUMERIC_STD.ALL;
    USE WORK.mypackage_p.ALL;

    ENTITY bcd_8counter_e IS
    PORT(
    res_i, clk_i, enable_i, counter_res_i       : IN STD_LOGIC;
        bcd_array_o                     : OUT bcd_array_t
    );
    END bcd_8counter_e;

    ARCHITECTURE bcd_8counter_a OF bcd_8counter_e IS

    COMPONENT bcd   
    PORT(
        res_i, clk_i, enable_i, counter_res_i   : IN STD_LOGIC;
        bcd_o                   : OUT STD_LOGIC_VECTOR(bcd_width_c-1 DOWNTO 0);
        carry_o                 : OUT STD_LOGIC
    );
    END COMPONENT;

    SIGNAL bcd_array_s  : bcd_array_t;
    SIGNAL enable_s     : STD_LOGIC_VECTOR(no_of_digits_c-1 DOWNTO 0);
    SIGNAL carry_s  : STD_LOGIC_VECTOR(no_of_digits_c-1 DOWNTO 0);

    FOR ALL : bcd USE ENTITY WORK.bcd_e (bcd_a);

    BEGIN  

    carry_s(0) <= enable_i;

    gen_carry : FOR i IN 1 TO (no_of_digits_c-1) GENERATE
        carry_s(i) <= carry_s((i-1)) AND enable_s((i-1));
    END GENERATE gen_carry;

    gen_bcd : FOR i IN 0 TO (no_of_digits_c-1) GENERATE
    digitx : bcd PORT MAP(res_i, clk_i, carry_s(i), counter_res_i, bcd_array_s(i), enable_s(i));
    END GENERATE gen_bcd;

    bcd_array_o <= bcd_array_s

    END bcd_8counter_a;

我的常量包文件:

    LIBRARY IEEE;
    USE IEEE.STD_LOGIC_1164.ALL;
    USE IEEE.NUMERIC_STD.ALL;

    PACKAGE mypackage_p IS

    CONSTANT freq_20k_c         : INTEGER := 2500;
    CONSTANT bcd_cnt_c      : INTEGER := 9;
    CONSTANT bcd_width_c        : INTEGER := 4;
    CONSTANT no_of_digits_c     : INTEGER := 8;

    TYPE bcd_array_t IS ARRAY(7 DOWNTO 0) OF STD_LOGIC_VECTOR(3 DOWNTO 0);
    END PACKAGE;

我一直收到以下警告:

  

警告:/home/stud/mr-131416/Desktop/VHDL_Project_Latest/src/bcd_counter8_a.vhd(15):( vcom-1263)配置规范“all:bcd”不适用于组件实例化语句。

由于此警告,代码未通过测试平台的测试/模拟。帮助将非常感激。

1 个答案:

答案 0 :(得分:2)

这是一个范围问题。组件配置配置组件实例化。 generate语句生成一个块语句(或提供端口映射时的嵌套块语句)。

块语句(对于内部或外部块)使用块配置,该配置仅在配置声明中找到。

绑定指示不是分层的,没有能够到达块来指定组件实例化,您可以使用配置声明或移动配置规范:

    -- for all : bcd use entity work.bcd_e (bcd_a);

begin  

    carry_s(0) <= enable_i;

gen_carry : 
    for i in 1 to (no_of_digits_c-1) generate
        carry_s(i) <= carry_s((i-1)) and enable_s((i-1));
    end generate gen_carry;

gen_bcd : 
    for i in 0 to (no_of_digits_c-1) generate
        for all: bcd use entity work.bcd_e (bcd_a);
    begin

    digitx : bcd port map (res_i, clk_i, carry_s(i), 
                           counter_res_i, bcd_array_s(i), enable_s(i));
    end generate gen_bcd;

    bcd_array_o <= bcd_array_s;  -- CHANGED WAS MISSING SEMICOLON

end bcd_8counter_a;

请注意,已添加bcd_array_o赋值语句中缺少的分号。

通过这些更改,您的设计可以在没有警告的情况下进行分析和阐述。

您可以注意到,并非所有综合工具都支持配置声明,而大多数支持配置规范。

参见IEEE Std 1076-2008 7.3配置规范,3.4配置声明,3.4.2块配置

模拟或合成失败的原因是distx组件实例化是未绑定的,因为在工作目录中找不到bcd实体。

编写一个不调用同步复位的简单测试平台,使用周期为10 ns的时钟并运行10 ms:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.mypackage_p.all;

entity tb is
end entity;

architecture foo of tb is
    signal reset:       std_logic;          -- '1' for RESET
    signal clk:         std_logic := '0';
    signal en:          std_logic;          -- '1' for ENABLE
    signal syn_reset:   std_logic;          -- '1' for SYNCHRONOUS RESET
    signal bcd_array:   bcd_array_t;

begin
DUT:
    entity work.bcd_8counter_e
        port map (
            res_i => reset,
            clk_i => clk,
            enable_i => en,
            counter_res_i => syn_reset,
            bcd_array_o => bcd_array
        );
CLOCK:
    process
    begin
        wait for 5 ns;
        clk <= not clk;
        if now > 10 ms then
            wait;
        end if;
    end process;
STIMULI:
    process
    begin
        wait for 10 ns;
        reset <= '0';
        en  <= '0';
        syn_reset <= '0';
        wait for 10 ns;
        reset <= '1';
        wait for 20 ns;
        reset <= '0';
        wait for 20 ns;
        en <= '1';
        wait;
    end process;
end architecture;

显示计数器取决于启用并显示前6位数字起作用:

bcd_8counter_e_tb.png