FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5949 Discussions

How to read FPGA serial number programmatically?

Altera_Forum
Honored Contributor II
1,288 Views

Using Nios II, there is a need to read serial number of let's say Cyclone II. Can it be done, and how?

0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
223 Views

Only if you add an avalon slave (or custom instruction) to return the value from somewhere. 

Possibly you could set the 'cpuid' register (control register 5) to some useful value.
Altera_Forum
Honored Contributor II
223 Views

I used to do this to cook build numbers into the FPGA image so I could read it back if I ever needed to know what's currently operating in the FPGA. If you want something that you manually set once you can make a simple SOPC Builder/Qsys component that hardcodes the readdata line to whatever parameter setting you want. i.e. something like this: 

 

module serial_number_reader (clk, reset, address, read, readdata); 

input clk; 

input reset; 

input address; 

input read; 

output wire readdata; 

 

parameter SERIAL_NUMBER = 32'hDEADBEEF; 

 

assign readdata = SERIAL_NUMBER; 

 

endmodule 

 

 

Then when you instantiate it you type the serial number into it as a parameter and every time you read from the component that value is returned. If you want something more programmatic for a build system you can use an pre-initialized on-chip RAM where your build system spits out a new .hex/.mif file before the hardware is compiled. If you want a true 'serial number' system (where each FPGA/board has it's own serial number programmed at the factory) you'll need something programmable on the board that Nios II can read from with the serial number burned into it.
Altera_Forum
Honored Contributor II
223 Views

There are some chips with unique serial numbers, such as MAXIM's DS2401.

Reply