rust_hdl icon indicating copy to clipboard operation
rust_hdl copied to clipboard

[Feature Request] Recursive Symbol Hover extraction

Open SethGower opened this issue 6 months ago • 0 comments

I don't know if the title is a great description, I can change it after. It would be nice if when you hover over a constant value that is used somewhere, if it continues recursing up the tree to a concrete value. For example, take the following example

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity test is
    generic (
        G_INPUT_SIZE : natural := 32
    );
    port (
        i_clk    : in std_logic;
        i_input  : in std_logic_vector(G_INPUT_SIZE - 1 downto 0);
        o_output : out std_logic
    );
end entity test;
architecture behav of test is

    constant C_CONSTANT_A : natural := G_INPUT_SIZE;
    constant C_CONSTANT_B : natural := C_CONSTANT_A / 2;

begin

    o_output <= i_input(C_CONSTANT_B);

end behav;

If you were to hover over the C_CONSTANT_B in the o_output assignment, it would return C_CONSTANT_A / 2. This isn't super helpful, it would be nice if it would (as best as possible) land on a concrete value, in this case it would be 16. If it were to show the different steps it took, that'd be nice. Something like showing

16
C_CONSTANT_B = C_CONSTANT_A / 2
C_CONSTANT_A = G_INPUT_SIZE
G_INPUT_SIZE = 32

That might be as far as you could go, since the module could be instantiated multiple times, with different values of G_INPUT_SIZE.

SethGower avatar Feb 28 '24 20:02 SethGower