vhdl - VHDL 综合工具不会推断 FSM
问题描述
我正在尝试用 VHDL 创建一个 FSM。但是,我使用的综合工具 (Vivado) 不会推断它,而是认为我创建了很多寄存器和多路复用器。
我正在设计的硬件的目标是在 FPGA 上实现一个储物柜。为了不创建任何闩锁,我已经更改了很多东西,所以如果您发现有问题,请告诉我。另外,我是西班牙人,所以有些名字是西班牙语;如果你不明白的东西,请告诉我。我不知道你是否需要其他的东西,比如综合报告。(请不要告诉我只创建一个流程,我必须使用一个顺序流程和一个组合流程来设计它)。
这是代码:
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity cerrojo is
port ( boton : in std_logic;
rst : in std_logic;
clk : in std_logic;
clave : in std_logic_vector(7 downto 0);
leds : out std_logic_vector(15 downto 0);
intentos: out std_logic_vector(6 downto 0));
end cerrojo;
architecture archCerrojo of cerrojo is
signal intentos_binario : unsigned(3 downto 0);
signal sin_rebote : std_logic;
signal guardado : unsigned(7 downto 0);
type estado is(inicial, tres, dos, uno, final);
signal estado_actual, estado_siguiente : estado;
component conv_7seg is
port (x : in std_logic_vector (3 downto 0);
display : out std_logic_vector (6 downto 0));
end component conv_7seg;
component debouncer is
port (
rst : in std_logic;
clk : in std_logic;
x : in std_logic;
xdeb : out std_logic;
xdebfallingedge : out std_logic;
xdebrisingedge : out std_logic);
end component debouncer;
begin
sieteSeg : conv_7seg
port map ( x => std_logic_vector(intentos_binario(3 downto 0)),
display => intentos);
rebotes : debouncer
port map (rst => rst, clk => clk, x => boton, xdeb => sin_rebote);
p_reg : process(clk, rst)
begin
if rst = '1' then
guardado <= "00000000";
estado_actual <= inicial;
elsif rising_edge(clk) and estado_actual = inicial then
guardado <= unsigned(clave);
estado_actual <= estado_siguiente;
elsif rising_edge(clk) then
guardado <= guardado;
estado_actual <= estado_siguiente;
end if;
end process p_reg;
p_comb : process(estado_actual, sin_rebote, clave, guardado)
begin
case estado_actual is
when inicial =>
intentos_binario <= "1000";
leds <= "1111111111111111";
--guardado <= unsigned(clave);
if (sin_rebote = '1') then
estado_siguiente <= tres;
else
estado_siguiente <= inicial;
end if;
when tres =>
intentos_binario <= "0011";
leds <= "0000000000000000";
-- guardado <= guardado;
if (sin_rebote = '1' and guardado = unsigned(clave)) then
estado_siguiente <= inicial;
elsif (sin_rebote = '1' and guardado /= unsigned(clave)) then
estado_siguiente <= dos;
else
estado_siguiente <= tres;
end if;
when dos =>
intentos_binario <= "0010";
leds <= "0000000000000000";
--guardado <= guardado;
if (sin_rebote = '1' and guardado = unsigned(clave)) then
estado_siguiente <= inicial;
elsif (sin_rebote = '1' and guardado /= unsigned(clave)) then
estado_siguiente <= uno;
else
estado_siguiente <= dos;
end if;
when uno =>
intentos_binario <= "0001";
leds <= "0000000000000000";
--guardado <= guardado;
if (sin_rebote = '1' and guardado = unsigned(clave)) then
estado_siguiente <= inicial;
elsif (sin_rebote = '1' and guardado /= unsigned(clave)) then
estado_siguiente <= final;
else
estado_siguiente <= uno;
end if;
when final =>
intentos_binario <= "0000";
leds <= "0000000000000000";
--guardado <= guardado;
estado_siguiente <= final;
end case;
end process p_comb;
end architecture archCerrojo;
先感谢您!
解决方案
推荐阅读
- php - 如何在 Google 数据洞察中嵌入报告过滤器?
- vuejs2 - 我可以在所见即所得组件中使用 v-validate 必需选项吗?
- rest - WinHTTP Open 方法导致延迟?
- swift - CloudKit 正在工作,但突然出现权限错误
- matlab - 基于最大值索引到 MAtlab 表
- ruby - 如何解决在 Ruby 中调用函数的问题?
- python - 是否有在 _init_ 方法中定义变量的最佳实践
- macos - `kAFAssistantErrorDomain` 代码记录在哪里?
- html - 在网站上查找特定 ID 标签的递归函数
- jquery - 从 HTML 解析值