I want to make ram memory that consists of several memory blocks. Number of those blocks is relatively big, so I will use generate statement. Each memory block is a separate entity. I want to initialize whole memory, in other words to initialize each memory block, by using a file. The problem is I can't reach internal architecture of a single memory block in order to assign location values. If I had implemented memory as just one big block, I wouldn't have that problem, but that solution wouldn't be good for some other reasons.
Is there a way to initialize those storage units (memory blocks) later in the memory architecture? Thanks in advance.链接已复制
4 回复数
--- Quote Start --- I want to make ram memory that consists of several memory blocks. Number of those blocks is relatively big, so I will use generate statement. Each memory block is a separate entity. I want to initialize whole memory, in other words to initialize each memory block, by using a file. The problem is I can't reach internal architecture of a single memory block in order to assign location values. If I had implemented memory as just one big block, I wouldn't have that problem, but that solution wouldn't be good for some other reasons. Is there a way to initialize those storage units (memory blocks) later in the memory architecture? Thanks in advance. --- Quote End --- assuming I understood you. when you use megawizard it generates wrapper for ram block, copy/paste the way it is instantiated inside wrapper then use that for your instantion connecting the relevant file as generic per each block (hand editing the init file). There might be other better ways but that is what I do.
Initialization file name is a generic/parameter of the altsyncram block, you can modify it in a generate construct according to the means provided by your HDL.
Alternatively you can infer the RAM in HDL code and use other initialization methods.--- Quote Start --- assuming I understood you. when you use megawizard it generates wrapper for ram block, copy/paste the way it is instantiated inside wrapper then use that for your instantion connecting the relevant file as generic per each block (hand editing the init file). There might be other better ways but that is what I do. --- Quote End --- additionally I suggest you arrange your files into an array so that you can use the generate loop effectively. type filename_array is array(1 to 10) of string(8 downto 1); signal sel_file : filename_array := ("myfile01","myfile02",...,myfile10"); and in the loop: init => sel_file(i);
