efabless / caravel

Caravel is a standard SoC harness with on chip resources to control and read/write operations from a user-dedicated space.
https://caravel-harness.readthedocs.io/
Apache License 2.0
283 stars 66 forks source link

Caravel GPIO documentation corrections. #483

Open d-m-bailey opened 1 year ago

d-m-bailey commented 1 year ago

The documentation at docs/rst/gpio.rst and docs/rst/gpio_configuration.rst appears to be out of sync with the verilog files.

Sorry, but I don't know enough to submit a pull request.

  1. Pull-up, pull-down constants Verilog
    
    `define GPIO_MODE_MGMT_STD_INPUT_NOPULL    13'h0403
    `define GPIO_MODE_MGMT_STD_INPUT_PULLDOWN  13'h0c01
    `define GPIO_MODE_MGMT_STD_INPUT_PULLUP    13'h0801
    `define GPIO_MODE_MGMT_STD_OUTPUT          13'h1809
    `define GPIO_MODE_MGMT_STD_BIDIRECTIONAL   13'h1801
    `define GPIO_MODE_MGMT_STD_ANALOG          13'h000b

define GPIO_MODE_USER_STD_INPUT_NOPULL 13'h0402 define GPIO_MODE_USER_STD_INPUT_PULLDOWN 13'h0c00 define GPIO_MODE_USER_STD_INPUT_PULLUP 13'h0800 define GPIO_MODE_USER_STD_OUTPUT 13'h1808 define GPIO_MODE_USER_STD_BIDIRECTIONAL 13'h1800 define GPIO_MODE_USER_STD_OUT_MONITORED 13'h1802 `define GPIO_MODE_USER_STD_ANALOG 13'h000a

Documentation

define GPIO_MODE_MGMT_STD_INPUT_NOPULL 0x0403

define GPIO_MODE_MGMT_STD_INPUT_PULLDOWN 0x0803

define GPIO_MODE_MGMT_STD_INPUT_PULLUP 0x0c03

define GPIO_MODE_MGMT_STD_OUTPUT 0x1809

define GPIO_MODE_MGMT_STD_BIDIRECTIONAL 0x1801

define GPIO_MODE_MGMT_STD_ANALOG 0x000b

define GPIO_MODE_USER_STD_INPUT_NOPULL 0x0402

define GPIO_MODE_USER_STD_INPUT_PULLDOWN 0x0802

define GPIO_MODE_USER_STD_INPUT_PULLUP 0x0c02

define GPIO_MODE_USER_STD_OUTPUT 0x1808

define GPIO_MODE_USER_STD_BIDIRECTIONAL 0x1800

define GPIO_MODE_USER_STD_OUT_MONITORED 0x1802

define GPIO_MODE_USER_STD_ANALOG 0x000a


2. Analog select an polarity explanation uses a 3-bit `value` field, but the definition of `value` is a 4-bit field - there's an extra `out`.

bits 6-7: Analog select and polarity (bit field ANALOG_SELECT | ANALOG_POLARITY) (value = {out, bit[7], bit[6], out} in the list below) value 000 = connect pad to VSSIO value 001 = connect pad to analog A bus value 010 = connect pad to VSSIO value 011 = connect pad to analog B bus value 100 = connect pad to analog A bus value 101 = connect pad to VDDIO value 110 = connect pad to analog B bus value 111 = connect pad to VDDIO


3. The digital mode explanation includes duplicates.

bits 10-12: Digital mode (bit field DIGITAL_MODE_MASK) (value = {bit[12], bit[11], bit[10]} in the list below) value 000 = analog mode value 001 = analog mode value 010 = digital input, 5kohm pull-up value 011 = digital input, 5kohm pull-up value 100 = open drain to power value 101 = open drain to ground value 110 = digital output value 111 = digital output (weak)


`value 001` should probably be `digital input, no pull-up, no pull-down`
`value 011` should probably be `digital input, 5kohm pull-down`