I'm having some trouble with the following statement
if spi_ctr = 9 then
case spi_op is
when spi_op = op_get_r_count => spi_reg_out <= ref_count_i;
when spi_op = op_get_s_count => spi_reg_out <= sig_count_i;
when spi_op = op_get_g_limit => spi_reg_put <= gate_limit_i;
end case;
Quartus sinthetizer spits the following errors
Error (10500): VHDL syntax error at spi_iface.vhd(93) near text "="; expecting "!", or "=>"
Error (10500): VHDL syntax error at spi_iface.vhd(94) near text "="; expecting "!", or "=>"
Error (10500): VHDL syntax error at spi_iface.vhd(95) near text "="; expecting "!", or "=>"
i don't see a syntax error around however, i also tried using the following
spi_reg_out <= ref_count_i when spi_op = op_get_r_count else
sig_count_i when spi_op = op_get_s_count else
gate_limit_i when spi_op = op_get_g_limit;
and it spits a similar error
the constants are defined as follows
-- read operations
constant op_get_r_count: std_logic_vector(7 downto 0) := "00000001";
constant op_get_s_count: std_logic_vector(7 downto 0) := "00000010";
constant op_get_g_limit: std_logic_vector(7 downto 0) := "00000011";
spi_op is as follows
signal spi_op: std_logic_vector(7 downto 0);
is there something obvious i'm not seeing or you need to use literals in these kind of statements?
--- Edit
after following the recomendations from @Oldfart i changed the code to this
case spi_op is
when op_get_r_count => spi_reg_out <= ref_count_i;
when op_get_s_count => spi_reg_out <= sig_count_i;
when op_get_g_limit => spi_reg_out <= gate_limit_i;
when others => spi_reg_out <= (others => '0');
end case;
and voila! it Almost works
however it outputs quite a weird error that really caught me with my pants off
Error (10344): VHDL expression error at spi_iface.vhd(102): expression has 31 elements, but must have 32 elements
?! shouldn't the last statement take care of that?
--- edit again
actually that error was from an other line, dumb me
Oldfart post your answer if you want the kudos :)
spi_op =
inside the case. The comparison is done by the case statement itself . So instead use:when op_get_r_count => ...
. It seems you are not using all combinations so, depending on where this code is, this may lead to latches in your code. \$\endgroup\$