EmbDev.net

Forum: FPGA, VHDL & Verilog [HELP] VHDL "cant infer register."


von Paulo Henrique Silva (Guest)


Rate this post
useful
not useful
The Quartus is detecting an error in my code, the error is this:

Error (10821): HDL error at state_machine.vhd(27): can't infer register 
for "atual" because its behavior does not match any supported register 
model

I do not know how to solve. I need to use "case" and "type" because my 
teacher asked.

I ask for help to solve. The code is below.
Thank you.
1
--DECLARAÇÃO DE BIBLIOTECAS
2
3
LIBRARY IEEE;
4
USE IEEE.STD_LOGIC_1164.ALL;
5
USE IEEE.NUMERIC_STD.ALL;
6
--LIBRARY WORK;
7
--USE work.digital_filter_package.all;
8
9
--DECLARAÇÃO DA ENTIDADE
10
11
ENTITY state_machine IS
12
  PORT(
13
    clk,d: IN STD_LOGIC
14
  );
15
END ENTITY state_machine;
16
17
--DECLARAÇÃO DA ARQUITETURA DA ENTIDADE
18
19
ARCHITECTURE behavioral OF state_machine IS
20
  TYPE estado IS(amostrar,naoamostrar);
21
  SIGNAL cancannot: STD_LOGIC;
22
  SIGNAL atual: estado := naoamostrar;
23
BEGIN
24
  contandoeamostrando: PROCESS(clk,d,atual)
25
    VARIABLE count: INTEGER := 0;
26
  BEGIN
27
    CASE atual IS
28
      WHEN amostrar =>
29
        cancannot <= '1';
30
        IF(RISING_EDGE(clk)) THEN
31
          count := 0;
32
          atual <= naoamostrar;
33
        END IF;
34
      WHEN naoamostrar =>
35
        cancannot <= '0';
36
        IF(RISING_EDGE(clk)) THEN
37
          IF(count<3333333) THEN
38
            count := count + 1;
39
          ELSE
40
            atual <= amostrar;
41
          END IF;
42
        END IF;
43
    END CASE;
44
  END PROCESS;
45
END ARCHITECTURE;

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
Paulo Henrique Silva wrote:
> can't infer register for "atual" because its behavior does not match any
> supported register model
The synthesizer cannot transfer your VHDL description to a hardware 
inside the FPGA.

And thats the problem:
IF(RISING_EDGE(clk)) THEN
Indeed not that line is the problem, but the place where it is located 
inside the code and also that this line is doubled inside the 
description. Where did you see this coding style? Nowhere? Its your 
idea?

If you want describe hardware in a synthesizeable manner you must do it 
in a way the synthesizer understands. And what the synthesizer 
understands is written in the synthesizers user guide. So have a close 
look for XST UG.

Try it a little more the "usual way". This here will be synthesizeable 
for sure, because its a straightforward synchronous design:
1
  contandoeamostrando: PROCESS(clk)
2
    VARIABLE count: INTEGER := 0;
3
  BEGIN
4
    IF(RISING_EDGE(clk)) THEN   -- a totally synchronous design
5
6
      CASE atual IS
7
        WHEN amostrar =>
8
          cancannot <= '1';
9
          count := 0;
10
          atual <= naoamostrar;
11
        WHEN naoamostrar =>
12
          cancannot <= '0';
13
          IF(count<3333333) THEN
14
            count := count + 1;
15
          ELSE
16
            atual <= amostrar;
17
          END IF;
18
       END CASE;
19
20
     END IF; 
21
  END PROCESS;

: Edited by Moderator
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.