Forum Discussion
Altera_Forum
Honored Contributor
17 years agoHi Hani,
Your question is perfectly valid and for a start let us agree on the terminology in this complex setting. You write HDL(VHDL, verilog,…etc) or you import a netlist or you draw schematic then you compile your project and end up with firmware(sof,pof…etc) which configures the switches of FPGAs into a functioning hardware. (forget for now that some new tools convert C to firmware directly, others C to HDL but are not mature yet. The fate of this C is completely different from C used as source code for nios). Nios and its peripherals are added as firmware. So when you download the firmware it contains all the necessary configuration data to end up as hardware including that for nios and its peripherals. After reset, hopefully nios will start running its fetch-execute sequences and will continue for ever.These instructions are the software side(designed originally from a source code e.g. C then compiled into exe). The software instructions are either stored completely inside fpga in the form of mif file(for small programs). Or if it is too large to fit(and usually it is, given the tons of today’s code) then it is split up into two sections: a main software stored in flash(or configuration device) and small bootloader stored inside fpga. Assuming a company has two friendly engineers; a firmware engineer and software engineer, the procedural work is as follows. The firmware guy builds a nios module in their project, gets ptf file from sopc, emails this ptf to the software guy who builds up their software in the IDE and then emails the bootloader as mif back to the firmware guy who should recompile.If software is too small then the software engineer only needs to send you the mif file and all is done. The main software program has to be loaded into flash. Interestingly, the software can be used to download “itself” into flash . You run a temporary version of software using sof and use any soft skills as usual including dowloading firmware and main software into flash.(ask your software friend –if you dare- to make a handy utility for you to do that) It is common practice to have a neat documented interface in the form of register stack module. Both firmware and software can read/write to update these registers. Apart from this read/write the software and firmware work independantly; nios fetching slowly through the flash(and internal memory for intermediary variables), clock after clock while firmware banging every clock edge at all active registers everywhere.