# Altera FPGA Reset System

I having a hard time understanding the best way to setup a NIOS II system with external code and the resets and clocks. One of the reasons why I'd like to figure this out is the JTAG system really struggles and it seems that portions of the system never get reset correctly.

First things first: You need a dual rank synchronizer or some kind of ARST sanitation like this here. So I have that in my HDL code

One question I have is what does the Altera Qsys Clock Source actually do? Does it preform the function of a dual rank syncronizer? Or does it need a sanitized ARST signal? Because in a most systems examples from altera and other suppliers they don't sanitize the ARST and run it straight into the Qsys/NIOS block. (Like in Example 1A below)

The other question that I have is: If I have external code that I connect to the Qsys\NIOS II system what reset signal do I use? Does it need to be reset with the Qsys\NIOS II system? Does the Qsys\NIOS Clock Source do something to the clock signal? Do I have export the Clock and Reset signals from the Qsys system?

Which way is correct? Are there advantages to either way?

simulate this circuit – Schematic created using CircuitLab

simulate this circuit

• In terms of getting the JTAG reset to work properly, have you connected the jtag_debug_module_reset output from the NIOS processor back to the reset_n pin of the NIOS as well as anywhere else you want to be reset by the JTAG? – Tom Carpenter Sep 10 '16 at 1:10
• There was at one point a question about how Qsys handles reset sync, but I can't seem to find it now. – Tom Carpenter Sep 10 '16 at 1:13