0

嗨,我正在尝试通过 ispLEVER 从 vhdl 文件创建一个 .jed 文件,当我尝试创建熔断器映射并且名为 le 的 1 位端口无法分配给引脚 23(GAL22V10-15LP 有 24引脚)

这是我的 vhdl 代码

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;

entity alarm is port (
    clk: IN std_logic;
    le : OUT std_logic;
    a: IN std_logic_vector(3 downto 0);
    b: IN std_logic_vector(3 downto 0);
    x: OUT std_logic_vector(1 downto 0));
end alarm;

architecture arch_alarm of alarm is
    type states is (state0, state1, state2, state3 );
    signal stado_pres, stado_fut: states;
begin

p_estados: process(stado_pres,a,b) begin 
    case stado_pres is
                when state0 => 
                    x <= "00";
                    le <= '0';
                    if a = NOT(b) then
                        stado_fut <= state1;
                    else
                        stado_fut <= state0;
                    end if;
                when state1 => 
                    x <= "01";
                    if a = NOT(b) then
                        stado_fut <= state2;
                    else
                        stado_fut <= state0;
                    end if;
                when state2 => 
                    x <= "10";
                    if a = NOT(b) then
                        stado_fut <= state3;
                    else
                        stado_fut <= state0;
                    end if;
                when state3 => 
                    x <= "11";
                    if a = NOT(b) then
                        le <= '1';
                    end if;
                    stado_fut <= state0;
            end case;
    end process p_estados;

    p_reloj: process(clk) begin
        if(clk'event and clk= '1') then
            stado_pres <= stado_fut;
        end if;
    end process p_reloj;
end arch_alarm;

出现的错误是: Input file: 'untitled.tt2' Device 'p22v10g' Note 4068: Signal le cannot be assigned (to pin 23) because the register type of 'le' pin 23 is invalid.

设计不适合

散客完成。时间:1秒。

完成:失败,退出代码:0001

编辑我已将文件添加到所有状态,但现在它向我显示另一个错误这是代码

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use work.std_arith.all;

entity alarm is port (
    clk: IN std_logic;
    le : OUT std_logic;
    a: IN std_logic_vector(3 downto 0);
    b: IN std_logic_vector(3 downto 0);
    x: OUT std_logic_vector(1 downto 0));
end alarm;

architecture arch_alarm of alarm is
    type states is (state0, state1, state2, state3 );
    signal stado_pres, stado_fut: states;
begin

p_estados: process(stado_pres,a,b) begin 
    case stado_pres is
                when state0 => 
                    x <= "00";
                    le <= '0';
                    if a = NOT(b) then
                        stado_fut <= state1;
                    else
                        stado_fut <= state0;
                    end if;
                when state1 => 
                    x <= "01";
                    le <= '0';
                    if a = NOT(b) then
                        stado_fut <= state2;
                    else
                        stado_fut <= state0;
                    end if;
                when state2 => 
                    x <= "10";
                    le <= '0';
                    if a = NOT(b) then
                        stado_fut <= state3;
                    else
                        stado_fut <= state0;
                    end if;
                when state3 => 
                    x <= "11";
                    if a = NOT(b) then
                        le <= '1';
                    end if;
                    stado_fut <= state0;
            end case;
    end process p_estados;

    p_reloj: process(clk) begin
        if(clk'event and clk= '1') then
            stado_pres <= stado_fut;
        end if;
    end process p_reloj;
end arch_alarm;

错误是:注 4059:信号 le 无法分配(到引脚 23),因为输出 le 引脚 23 的术语太多。注 4068:信号 le 无法分配(到引脚 23),因为寄存器类型为 'le ' 引脚 23 无效。

4

2 回答 2

0

您的le信号推断出一个锁存器。它仅在两种状态下分配。在所有四个中分配它。

输出 le 引脚 23" 的术语太多

这样做之后,您现在对 Pin 23 有太多的术语。这是因为

            if a = NOT(b) then
                le <= '1';
            end if;

`a 和 not b' 的比较。

你能移动le到一个有 10 个术语的输出(引脚 23 有 8 个)吗?(stado_pres应该是两个触发器的输出,而是触发器stado_fut的输入)。

你能用一个引脚将这个比较作为一个单独的信号吗?影响将是 PAL 延迟下降的两倍。

您是否被告知您的状态是如何编码的?(如它们在x? 中重复,是 ?x的同义词stado_pres

正如 pwolf 指出的那样

我只是心烦意乱地看着你的第二条错误消息。 le基于. else_state3

确定与 PAL 关联的时间是微不足道的。这是干什么用的?

于 2014-11-28T06:41:59.387 回答
0

与@David Koontz 的回答保持一致,lestate3. 尝试完成 if 语句以完全定义le

   when state3 => 
     x <= "11";
     if a = NOT(b) then
       le <= '1';
     else
       le <= '0';
     end if;
     stado_fut <= state0;

如果您的输入a与您的输入b同步clk,我建议您重写状态机以同步运行,而不是异步运行。例如

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use work.std_arith.all;

entity alarm is port (
    clk: IN std_logic;
    le : OUT std_logic;
    a: IN std_logic_vector(3 downto 0);
    b: IN std_logic_vector(3 downto 0);
    x: OUT std_logic_vector(1 downto 0));
end alarm;

architecture arch_alarm of alarm is
    type states is (state0, state1, state2, state3 );
    signal stado_pres : states := state0; -- Initial condition    
begin

p_estados: process(clk) 
begin 
  if rising_edge(clk) then
    case stado_pres is
      when state0 => 
        x <= "00";
        le <= '0';
        if a = NOT(b) then
          stado_pres <= state1;
        else
          stado_pres <= state0;
        end if;
      when state1 => 
        x <= "01";
        le <= '0';
        if a = NOT(b) then
          stado_pres <= state2;
        else
          stado_pres <= state0;
        end if;
      when state2 => 
        x <= "10";
        le <= '0';
        if a = NOT(b) then
          stado_pres <= state3;
        else
          stado_pres <= state0;
        end if;
      when state3 => 
        x <= "11";
        if a = NOT(b) then
          le <= '1';
        else
          le <= '0';
        end if;
        stado_pres <= state0;
      end case;
    end if;
  end process p_estados;
end arch_alarm;

恕我直言,编写同步逻辑通常优于异步逻辑,因为时序分析更容易,调试也更简单。这还具有从代码中删除所有闩锁的额外好处,这可能是您问题的根源。

即使输入a与输入b不同步clk,您也可以考虑将这些总线适当的时钟域传输到clk域。

于 2014-11-28T19:00:46.973 回答