Forum: FPGA, VHDL & Verilog VHDL bit_vector overload problem

von Parsons B. (blueblack)

Rate this post
0 useful
not useful

This is a beginner problem.
I don't know how to compare these 2 types.
I got overload error when trying to compare
if keypad(1) = 1 then 
next_state <= 1;
keypad is a bit_vector(9 downto 0).

von Gustl B. (-gb-)

Rate this post
0 useful
not useful
keypad(1) = '1'

beim ganzen Keypad wäre es dann

keypad = "xxxxxxxxxx" wobei x entweder eine 1 oder eine 0 sein kann. 
Also einzelne Bitwerte in ' ' und mehrere in " ".

von Parsons B. (blueblack)

Attached files:

Rate this post
0 useful
not useful
thanks, I saw my error.
But my program won't work still.

I added it into the attachment.

von Gustl B. (-gb-)

Rate this post
0 useful
not useful
Sorry for the german ...

Ok you wrote

when 0 =>
  if input = "0000000001" then
  next_state <= 1;
        next_state <= 0;
  end if;

so it depends on the input - how ist the input connected? How long is 
the input provided? I mean, if the input is only for a very short time 
not 0, then it is most of the time 0. And then your next_state = 2 and 
also current_state, because current_state is updated every clock.

The process depends on current_state and input.

So if we step along, say current_state=0 and input= "0000000001" then 
the process assigns next_state to 1.
BUT: in the next clockcycle, current_state is updated to next_state, in 
this case to 1.
Because current_state ist updated, the process runs again and now with 
input still "0000000001" it goes to

when 1 =>
and because input is not "0000000000" the next_state = 0.

And so on. Now current_state is updated to 0 and it begins again even if 
the input doesn't change.

I don't know if it helps, but i would test if it works woth only input 
in the sensitivity list



Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.