Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Is it possible to fill an array with a single operation?

In C, you can do this:

int a[5] = {1, 2, 3, 4, 5};

On VHDL, I need to do about the same thing in a function. Now it looks like this:

type rom_type is array (0 to 1) of std_logic_vector(1 downto 0);

function get_rom return rom_type is
    variable rom: rom_type;
begin
    rom(0) := "10";
    rom(1) := "01";

    return rom;
end;

Is there a way to make the array filling the same as in c? Something like this:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

rom := {"10", "01"};

>Solution :

Yes

rom := ("10", "01");
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading