您好我正试图通过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;
出现的错误是: 输入文件:'untitled.tt2' 设备'p22v10g' 注4068:无法分配信号文件(到引脚23),因为 “le”引脚23的寄存器类型无效。
设计不适合
FIT完成。时间:1秒。
完成:退出代码失败:0001
EDIT 我已将le添加到所有状态,但现在它显示另一个错误 这是代码
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:无法分配信号文件(到引脚23),因为 输出le pin 23的术语太多了。 注4068:无法分配信号文件(到引脚23),因为 “le”引脚23的寄存器类型无效。
答案 0 :(得分:0)
你的le
信号推断出一个锁存器。它仅在两个州分配。全部分配它。
输出le pin 23“
的条款太多这样做之后你现在对Pin 23的条款太多了。这是因为
if a = NOT(b) then
le <= '1';
end if;
“a和非b”的比较。
你可以将le
移动到10个术语的输出(引脚23有8个)吗? (stado_pres
应该是两个触发器的输出,而stado_fut
是触发器的输入。)
你能用引脚将这个比较作为一个单独的信号吗?影响将是PAL延迟下降的两倍。
您是否获得了有关状态编码的任何指示? (如同在x
中重复一样?,x
是[{1}}的同义词吗?)
正如pwolf指出
我只是分心地看着你的第二条错误信息。基于stado_pres
中缺少le
作业,else
仍然容易出现问题。
确定与PAL相关的时序是微不足道的。这是用来做什么的?
答案 1 :(得分:0)
保持@David Koontz回答,le
仍未完全定义state3
。尝试完成if语句以完全定义le
:
when state3 =>
x <= "11";
if a = NOT(b) then
le <= '1';
else
le <= '0';
end if;
stado_fut <= state0;
如果您的输入a
和b
与输入clk
同步,我建议您重写状态机以异步方式同步运行。 E.g。
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
域。