g2384 / VHDLFormatter

VHDL formatter web online written in typescript
https://g2384.github.io/VHDLFormatter/
MIT License
52 stars 20 forks source link

Formatting silently fails on specific constant declaration #73

Open diarmuidcwc opened 1 month ago

diarmuidcwc commented 1 month ago

Report a bug

I have some code that in isolation, passes the formatter, But when part of a bigger block of code, fails to format

Input

So if I pass this code into the (online) formatter it does nothing.


LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.std_logic_unsigned.ALL;
USE IEEE.std_logic_arith.conv_std_logic_vector;
USE IEEE.numeric_std.ALL;

ENTITY ch10_pkt_wrap IS

  PORT (
  );
END;

ARCHITECTURE rtl OF ch10_pkt_wrap IS

  CONSTANT WRAP_SIZE_WRDS : INTEGER := 6;

  TYPE t_gre_wrapper IS ARRAY (0 TO WRAP_SIZE_WRDS - 1) OF t_internal_datapath_format;

  CONSTANT C_GRE_WRAP : t_gre_wrapper := (
    ('1', "1111", '1', '0', x"0005E555"),
    ('1', "1111", '0', '0', x"555555D5"),
    ('1', "1111", '0', '0', x"01005E00"),
    ('1', "1111", '0', '0', x"00000000"),
    ('1', "1111", '0', '0', x"00012345"),
    ('1', "1111", '0', '0', x"88b588b5")
  );

BEGIN

  gmii_out <= gmii_out_sr(C_OUT_PIPE_DEPTH - 1) WHEN cfg_bypass_ch10_wrap = '0' ELSE gmii_in;

END ARCHITECTURE rtl;

However if I remove the following lines it works.

  CONSTANT C_GRE_WRAP : t_gre_wrapper := (
    ('1', "1111", '1', '0', x"0005E555"),
    ('1', "1111", '0', '0', x"555555D5"),
    ('1', "1111", '0', '0', x"01005E00"),
    ('1', "1111", '0', '0', x"00000000"),
    ('1', "1111", '0', '0', x"00012345"),
    ('1', "1111", '0', '0', x"88b588b5")
  );

Also if I take the removed lines in isolation, they format correctly!

Expected Behavior

The code should be formatted correctly

Actual Behavior

The formatter silently fails