Embedded Design Handbook

ID 683689
Date 8/28/2023
Public
Document Table of Contents

5.3.9.2.4. One-Bit PIO Peripheral

A one-bit PIO peripheral is needed to control the Nios® II cpu_resetrequest signal from the external processor. The external processor accesses the Avalon® -mapped PIO peripheral through the external processor bridge. The external processor writes the value 1 to the PIO to assert the cpu_resetrequest pin, or the value 0 to de-assert it.

The external processor can also read the state of the cpu_resettaken signal using the same PIO peripheral. However, the Nios® II processor asserts the cpu_resettaken signal for only one clock cycle at a time. Therefore, sampling this signal from software to see when reset has been achieved does not work. The signal can easily assert and de-assert again between samples, so that a valid assertion of cpu_resettaken by the Nios® II processor might never be captured by the external processor.

The PIO component included with Platform Designer includes an edge-capture feature to use in this situation. The edge-capture feature sets a bit in the edge-capture register of the PIO whenever an edge of the predefined type is seen on that bit of the PIO’s input port. The external processor can read the edge-capture register any time after it asserts cpu_resetrequest. If the cpu_resettaken signal was asserted any time since the cpu_resetrequest assertion, the relevant bit in the PIO’s edge-capture register is set.

To add a PIO component configured to use the edge-capture feature to detect assertions of cpu_resettaken to your system, perform the following steps:

  1. Open your system in Platform Designer.
  2. On the System Contents tab, under Peripherals, and then under Microcontroller Peripherals, click the PIO (Parallel I/O) component.
  3. Click Add.
  4. In the PIO MegaWizard interface, set the width to one bit and select InOut for Directions.
  5. Under the Edge capture register section, check the Synchronously Capture box, and then select RISING for Edge type.
  6. Click Finish to add the PIO component to your system.
Your system now contains a PIO component capable of asserting the Nios® II cpu_resetrequest signal and detecting rising edges on the cpu_resettaken signal.
Note: Platform Designer does not automatically connect the input and output ports of the PIO component to the Nios® II cpu_resettaken and cpu_resetrequest signals. After Platform Designer generation, you must make these connections at the top level in the Intel® Quartus® Prime project.