Hi,I want to instantiate multiple instances of the same Qsys/Nios system but I can't figure out how to distinguish between them when using the command line tools. I need to run a different software image on each instance, so I need to somehow determine which is which in the JTAG chain. One way would be to read CPUID, but I can't see how this can be made unique depending on the instance. One way would be to create a custom memory mapped ID component, with its value set by a Qsys instance parameter, but isn't there a better way built into the tools?
the command line tools (nios2-download and nios2-terminal) have an "instance" parameter that can be used to specify which instance to communicate with. Be careful though, SOPC builder has a weird way of assigning instance numbers. IIRC it gives the number 0 to the last instance, and then give the other numbers in ascending order (i.e. 1 to the first one, 2 to the second one, etc...). I don't know if this was fixed in QSys.
Thanks for replying, I understand that the instance assignment is not fixed or controllable, so I assume that I have to interrogate something using the JTAG interface in order to determine which instance maps to which JTAG instance number. My question was whether there is any built-in way to generate this thing (register) to interrogate.
There is no standard way of doing it on the FPGA side. You could indeed use the CPU ID but I think you need to do this manually. The other way is on the PC side. You should have a .jdi file, generated when you compile the project, that gives you the names of the different JTAG instances. By parsing it you should be able to automatically find out which instance number corresponds to which CPU.It is an xml file that gives all the JTAG instances (including signaltap) so it can be a bit big. What you need to look for is the nodes of this type:
<parameter name="sld_instance_index" type="dec" value="*"/>The component's name is in the hpath attribute two levels above, but is a bit complex because it's the complete Quartus path to the JTAG module itself. Another possibility would be to extract the information from the .sopcinfo file. This is what Eclipse does and it may be easier to pick up the component name. I never had a look to that file format though.