vhdl: implement bounds checking for strand number

This commit is contained in:
Xiretza 2022-06-06 18:25:27 +02:00
parent fcfa9eb7d0
commit 0f497e76e8

View file

@ -146,10 +146,12 @@ begin
-- TODO udp_length, range check with MAX_STRAND_LEN
num_pixels <= MAX_STRAND_LEN;
-- FIXME bounds check
active_strand <= to_integer(unsigned(udp_data));
receive_state <= FRAME_NUM;
if unsigned(udp_data) >= NUM_STRANDS then
receive_state <= DROP;
else
active_strand <= to_integer(unsigned(udp_data));
receive_state <= FRAME_NUM;
end if;
when FRAME_NUM =>
if not some_strands_written then