i create a function that generate a random number. That number represent an year. I need to find if that year is a leap-year. The range of generated numbers is between 2000 and 2017, so i think that i could use an case instead of applying a formula to find the leap years.
architecture arh_afisare of afisare is
signal year: integer;
signal leap_year: integer;
begin
process
begin
year <= random_gen(2000, 2017);
case year is
when '2000' => leap_year <='1';
when '2004' => leap_year <='1';
when '2008' => leap_year <='1';
when '2012' => leap_year <='1';
when '2016' => leap_year <='1';
when others => leap_year <='0';
end case;
wait for 100 ns;
end process;
end architecture;
I get this error on every line with 'when' expect the last one.
Error: COMP96_0019: Afisare.vhd : (28, 9): Keyword 'others' expected.
Aucun commentaire:
Enregistrer un commentaire