I know you can set your own custom SystemID, but can the Nios processor get the *device* id, so it can work out what actual chip the core is running on ?I have a design that is used on both EP3C16 and EP3C25 parts, and I'd like to be able to have my code report back what device it's running on. Is this possible ?
SystemID is like a normal MM slave.You can simply read the 32bit device id with IORD(SYSID_BASE, 0) At offset 1 (IORD(SYSID_BASE, 1) you also find a timestamp of the core generation date and time.
I had a quick look at the qsys component tcl interface reference (http://www.altera.com/literature/hb/qts/qsys_tcl.pdf) and it seems that you can get the FPGA family name through the SYSTEM_INFO property (table 9-5 page 9-27) but not explicitely the device part number.I think you'll have to create a PIO port on your SOPC system and add a Quartus TCL script that will get the device name during compilation and use it to fix a value on the PIO port so that the CPU can read it.
Sorry. I misunderstood your question yesterday.I try now to give you the correct answer. Some time ago I had found this information in another thread. It's a bit tricky but it works. The (hardware) device id is stored in the epcs configuration data. You can retrieve it with the following procedure: - read the config data in EPCS memory a byte at a time, starting at offset zero - discard 0xFF for an arbitrarily long time - if you find anything other than 0x56, this is not config data - extracting bit 4 (mask 0x10) from EPCS bytes 52 to 59 and packing them (LSB first) will give the device ID (e.g. 0xF1 to 0xF6 for Cyclone III) - like searching for the Software-Device ID code, the configuration bitstream length is encoded in a particular bit of a run of bytes: Total length field is 32 bits; the 7 most significant bits are encoded in bit 4 (mask 0x10) of EPCS bytes 33 to 39; the remaining 25 bits are encoded in bit 5 (mask 0x20) of EPCS bytes 48 to 72 (LSB first in each run). The length is expressed in bits, so we must discard the last 3 bits to get the byte length This algorithm is implemented in Nios bootloader in order to find out the firmware location in epcs.
Does anyone know were Altera publishes these Device ID codes?In the bootloader source files supplied with Quartus 9.0, the device IDs up to Cyclone III and Stratix III is shown, but not in the newer versions of Quartus. I have tested on a Cyclone IV and then I read the code 0xf7.