fusesoc icon indicating copy to clipboard operation
fusesoc copied to clipboard

parameter datatype file: missing path prefix

Open nopeslide opened this issue 3 years ago • 3 comments

According to the parameter CAPI2 reference the value of a file datatype should be prefixed with the path in which fusesoc was started. I have a firmware file that needs to be loaded on simulation start:

...
targets:
  ...
  jump_loop_tb:
    ...
    parameters:
      - g_FILE_PATH=firmware/jump_loop.mem

parameters:
  g_FILE_PATH:
    datatype: file
    description: Firmware file to load
    paramtype: generic
...

but in the resulting *.eda.yml files it is not prefixed:

...
parameters:
  g_FILE_PATH:
    datatype: file
    default: firmware/jump_loop.mem
    description: Firmware file to load
    paramtype: generic
...

and also not in the resulting Makefile for modelsim:

...
PARAMETERS    ?= g_FILE_PATH=firmware/jump_loop.mem ...
...

Needless to say, the simulation fails, because the file can't be found.

Furthermore, does it really make sense to prefix the path with the path fusesoc is started in? Shouldn't this be the location of the core file or what the provider returns?

nopeslide avatar Nov 12 '21 15:11 nopeslide

Yes. I can see that the docs are a bit unclear about this. The file datatype is more intended for when you specify it as a parameter on the command-line, like fusesoc run --target=some_target some_core --g_FILE_PATH=path/to/firmware.mem

What you probably want to do is to use the copyto attribute for the firmware file, i.e. specify it as - firmware/jump_loop.mem : {file_type : user, copyto : jump_loop.mem} This will copy the file to a file called jump_loop.mem in the work directory which is where the EDA tool will be launched.

You can find an example of this here where hello.vh uses copyto. A bit further down here you can see that it can now be referred to using that path

olofk avatar Dec 22 '21 22:12 olofk

Is there anything else we want to do here, or can we close the issue?

olofk avatar Dec 18 '22 13:12 olofk

Thanks a lot for clearing this up for me and sorry I didn't answer. I thought the docs could be made clearer at this point, but I'm also fine if this issue is closed

nopeslide avatar Dec 19 '22 07:12 nopeslide