Can anyone tell me how this object is used? I'm particularly interested in what the 'init' attribute is for. I can't work it out from looking at the object code, and the description isn't very enlightening...
a|x
Can anyone tell me how this object is used? I'm particularly interested in what the 'init' attribute is for. I can't work it out from looking at the object code, and the description isn't very enlightening...
a|x
The init attribute lets you write a bit of code which gets run when the module initializes, see attr_init in the init section. The typical use of the init code attribute would be be to fill the allocated table with some values.
The module is a general table that can be referenced by name and read/written from other modules, like you do with delay write and read modules.
Ah, that makes sense.
I saw the reference to 'attr_init', but didn't realise that meant 'run init string as code'.
a|x
Sorry, silly question, but how would an init function get a handle on the SDRAM array, in order to load data into it?
a|x
Sorry, answered my own question, looking at the help patch for the object.
int i;
for(i=0;i<LENGTH;i++)
array[i]=(1<<21)*i;
a|x
Is it possible to define and init an array like
int16_t array[length] = {val0, val1, etc.};
I'm attempting to do the above with the 8b version of the object, but it seems to take a reallllly long time to compile, when going live, and also doesn't seem to work - i.e. I don't seem to be able to extract any values from the array using a table read object.
Could anyone take a look at the attached, and tell me if I'm doing anything silly.
TableAllocRead_test01.axp (84.2 KB)
a|x
You have to do the combined declaration and init in Local Data as far as I can tell. I'm doing it this way for my NES objects I am working on, but they're just initialised with static lookups.
Hmm.. can't get this to work at all, currently.
I think I'll ask in the Object Coding thread, as it's looking like this is going to have to be a custom object, now.
a|x