This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

XDC config array length

I have a number of modules with config arrays:

module foo

{

config Int16 buffer[];

config Int bufferMaxSize;

etc...

Then in my .cfg file I have the following code:

 

foo = xdc.useModule('foo');

foo.bufferMaxSize = 16;

foo.buffer.length = foo.bufferSize;

etc...

 

My question is: Can you remove this dependance on setting the buffer length in the config file, as well as saving that length in another config value? Is there another meta domain init function where I can set foo.buffer.length = foo.bufferMaxSize so that I don't have to force the module user to do this in the .cfg file?

Thanks

  • It seems you want users to set the buffer length, right? So, they either have to set foo.bufferMaxSize or foo.buffer.length in the config file. I am not sure then, what do you mean by "removing this dependance on setting the buffer length in the config file". There is no other place where a user could set the buffer length.

    If you allow a user to set foo.bufferMaxSize in the config file, then you can create a function module$use in foo.xs, and do

    foo.buffer.length = foo.bufferMaxSize

    Here is a doc with more about different functions that a module producer can implement.

  • Sasha Slijepcevic said:

     

    If you allow a user to set foo.bufferMaxSize in the config file, then you can create a function module$use in foo.xs, and do

    foo.buffer.length = foo.bufferMaxSize

    That answers my question. I was looking for a way to not have to set the value twice, and it looks like module$use will allow me to do that.

    I was looking to avoid this:

    foo.bufferMaxSize = 128;

    foo.buffer.length = 64;