fix: work around ghdl#2077

https://github.com/ghdl/ghdl/issues/2077
This commit is contained in:
Xiretza 2022-06-20 13:15:06 +02:00
parent a9a1797236
commit 498089d468

View file

@ -29,6 +29,8 @@ architecture a of splink is
constant BITS_PER_LED: natural := 24;
signal led_addr : std_logic_vector(7 downto 0);
signal led_data_a : std_logic_vector(BITS_PER_LED * NUM_STRANDS - 1 downto 0);
signal led_data_b : std_logic_vector(BITS_PER_LED * NUM_STRANDS - 1 downto 0);
signal led_data : std_logic_vector(BITS_PER_LED * NUM_STRANDS - 1 downto 0);
signal led_colors : colors_vector(NUM_STRANDS-1 downto 0);
@ -94,17 +96,23 @@ begin
end loop;
end process;
-- memory inference help
with output_bank select led_data <=
led_data_a when BANK_A,
led_data_b when BANK_B;
fsm: process(clk)
type strand_buffer_t is array(0 to MAX_STRAND_LEN-1) of std_logic_vector(BITS_PER_LED * NUM_STRANDS - 1 downto 0);
type strand_banks_t is array(bank_t) of strand_buffer_t;
variable strand_banks : strand_banks_t;
variable strand_buffer_a : strand_buffer_t;
variable strand_buffer_b : strand_buffer_t;
variable received_strands : std_logic_vector(NUM_STRANDS-1 downto 0);
variable input_bank : bank_t;
begin
if rising_edge(clk) then
led_data <= strand_banks(output_bank)(to_integer(unsigned(led_addr)));
led_data_a <= strand_buffer_a(to_integer(unsigned(led_addr)));
led_data_b <= strand_buffer_b(to_integer(unsigned(led_addr)));
if (and received_strands) and sender_done then
output_bank <= input_bank;
@ -160,7 +168,11 @@ begin
receive_state <= DATA;
when DATA =>
strand_banks(input_bank)(pixels_received)((active_strand+1) * BITS_PER_LED - 1 downto active_strand * BITS_PER_LED) := udp_data(23 downto 0);
if input_bank = BANK_A then
strand_buffer_a(pixels_received)((active_strand+1) * BITS_PER_LED - 1 downto active_strand * BITS_PER_LED) := udp_data(23 downto 0);
else
strand_buffer_b(pixels_received)((active_strand+1) * BITS_PER_LED - 1 downto active_strand * BITS_PER_LED) := udp_data(23 downto 0);
end if;
if pixels_received /= num_pixels - 1 then
pixels_received <= pixels_received + 1;