gpi HDL Worker

Detail

The GPI device worker reads GPIO pins and stores the values in the property mask_data and send the values to its (optional) output port.

It’s (optional) output port uses a protocol that has one opcode and contains data and a mask. It sends data regardless of whether or not the worker downstream is ready, so it is something that cannot be piped directly to software. See gpio_protocol.xml in ocpi.core/specs/gpio_protocol.xml for further details on the protocol.

For the mask_data property and the output port data, the MSW is a mask and the LSW are the values read from the GPIO pins.

The mask allows knowledge of which GPIO pins changed since the previous read cycle. The mask is the current data XOR the previous data.

There are parameter properties that enable/disable build-time inclusion of 3 different circuits.

The USE_DEBOUNCE property enables/disables build-time inclusion of a debounce circuit which debounces input from mechanical switches. There are the CLK_RATE_HZ and DEBOUNCE_TIME_SEC properties used by the GPI device worker to calculate the width of the debounce circuit’s counter. The counter width is calculated by using the formula: \(\mathrm{ceil(log2(CLK\_RATE\_HZ * DEBOUNCE\_TIME\_SEC))}\).

It takes \(2^{\mathrm{counter width}}\) + 3 clock cycles until the input is ready at the debounce circuit’s output. If the debounce circuit is not enabled, metastability flip flops are used instead. These metastability flip flops have a latency of two clock cycles.

The EDGE_MODE property enables/disables build-time inclusion of an edge detector circuit. The edge detector detects rising and falling edge of an input on the rising edge of the clock. There is a RISING property that is used to select between using the rising edge output of the edge detector or the falling edge. If RISING is true the rising edge is used otherwise the falling edge is used. The outputs of the edge detector have a latency of one clock cycle. The output of either the debounce circuit or metastability flip flops is fed to the edge detector. If the edge detector is not used, the output of debounce circuit or metastability flip flops is used instead.

The USE_TOGGLE property enables/disables build-time inclusion of a toggle circuit. The toggle circuit has a register that stores the result of XOR’ing the output of the edge detector, debounce circuit, or metastability flip flops with the current value of the register. If toggle circuit is not used the output of the edge detector, debounce circuit, or metastability flops is used instead.

The output of these chain of circuits is fed to device worker’s output port.

There is a parameter property called EVENT_MODE. If EVENT_MODE is set to true the output port’s valid signal is driven high only when there is a change in the data to be sent to the output port. If it is set to false, the output port valid signal is always high and the data is valid every clock cycle.

Control Timing and Signals

The GPI device worker uses the clock from the Control Plane and standard Control Plane signals.

Worker Properties

  • NUM_INPUTS

    • Type: uchar

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • USE_DEBOUNCE

    • Type: bool

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • CLK_RATE_HZ

    • Type: double

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • DEBOUNCE_TIME_PSEC

    • Type: double

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • EDGE_MODE

    • Type: bool

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • RISING

    • Type: bool

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • USE_TOGGLE

    • Type: bool

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • EVENT_MODE

    • Type: bool

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • mask_data

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

  • ocpi_buffer_size_out

    • Type: ushort

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: True

      • Volatile: False

      • Read back: False

    • Default value: 0

  • ocpi_blocked_out

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

  • ocpi_max_latency_out

    • Type: ushort

    • Access:

      • Parameter: True

      • Writable: False

      • Initial: False

      • Volatile: False

      • Read back: False

    • Default value: None

  • ocpi_latency_out

    • Type: ushort

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

  • ocpi_messages_out

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

  • ocpi_bytes_out

    • Type: ulong

    • Access:

      • Parameter: False

      • Writable: False

      • Initial: False

      • Volatile: True

      • Read back: False

    • Default value: None

Worker Ports

    Outputs:

  • out

    • Protocol: gpio

    • Optional: True

Worker Signals

  • gpi_pin

    • Direction: in

    • Width: NUM_INPUTS

    • Differential: false

    • Pin: false

Utilization

Utilization reporting is not currently implemented.