Dynamic Array in VHDL

want to use dynamic range of array , so using "N" for converting an incoming vector signal to integer. Using the specifc incoming port "Size" gives me an error, while fixed vector produces perfect output.

architecture EXAMPLE of Computation is

signal size :std_logic_vector (7 downto 0);

process (ACLK, SLAVE_ARESETN) is variable N: integer:=conv_integer ("00000111") ; ---WORKING

--variable N: integer:=conv_integer (size) ; -- Not working type memory is array (N downto 0 ) of std_logic_vector (31 downto 0 );

variable RAM :memory;

Only reason to do this type of coding is send as much data as possible to FPGA .As I need to send Data from DDR to Custom IP via DMA in vivado may be more than 100 MB. so kindly guide me if I am trying to implement in wrong way as stated above.

I am thinking to make a counter to address ram, and have it reset when it's greater than size but confused how to do it . Can anyone provide me some example.

Thanks

--------------------------------------- Posted through

formatting link

Reply to
live4perfection
Loading thread data ...

Remember, VHDL describes hardware. Though it can also be used for test benches and simulation. In hardware, you have to know how big things are.

When you buy RAM chips from the store, you have to say how many bits you want. That can't be a variable.

That might mean an interface to an external DRAM. You write the inteface, not the DRAM.

-- glen

Reply to
glen herrmannsfeldt

You didn't mention whether this is purely for simulation (e.g for architecture exploration) or for synthesis (building and FPGA).

I am not sure that referencing a variable for a type declaration is correct, but some synthesis tools may allow it anyway (since the variable could not have changed value except at run time.)

Declarations must be based on static information, known at compile time.

Your entity could use a generic (a static kind of "port") to pass this size information in at compile/synthesis time, but that is about as dynamic as it gets for architecture or process declarative regions.

Most tools allow specifying the value of top level generics on the command line and/or in a project file.

For simulation, subprograms can declare items based on argument values, but for synthesis, this places constraints on how the subprogram is called, and whether those argument values can be known at synthesis time.

VHDL (for simulation only) has dynamic memory allocation, and pointers (called access types) with which you can dynamically create data structures. But they are not synthesizable.

Andy

Reply to
jonesandy

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.