Gorilla (gorillashaman) wrote in vhdl_forum,
Gorilla
gorillashaman
vhdl_forum

need a little help

I'm teaching myself, so please forgive any dumb questions.

I've got an 8 bit counter. I want a flag to be true if the counter is below some value.

This doesn't work:

signal COUNTER : std_logic_vector(7 downto 0);
signal FLAG : std_logic;

FLAG <= COUNTER < "00110011"; -- what should go here?
Subscribe
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 3 comments
FLAG <= '1' when COUNTER < "00110011" else '0';
Thanks!

if COUNTER < "00110011" then
   FLAG <= '1';
else
   FLAG <= '0';
end if;


also works. Seems the 'type' of a comparison is 'boolean', which cannot be directly assigned to a 'std_logic'.

Seems there out to be a way to make that type conversion happen for you automagically, but I haven't had time to hunt that down yet.
well, the if-else code is used in a process.
and the code i gave is for concurrent statements. both works the same.

about the comparison part, juz add the following line at the top of the vhdl code where the library declaration is.

use IEEE.std_logic_unsigned.all