<@U016EM8L91B> While working on the gpio defaults ...
# caravel
m
@Tim Edwards While working on the gpio defaults check, I came across some questions about the difference between these 2 modes (from https://github.com/efabless/caravel/blob/main/docs/rst/gpio.rst
Copy code
GPIO_MODE_USER_STD_BIDIRECTIONAL:
The user project controls the GPIO pin. Pin is configured as a digital input or output. The input (io_in) is always active. The output (io_out) is applied to the pad only if the corresponding output disable (io_oeb) is set to zero.

GPIO_MODE_USER_STD_OUT_MONITORED:
The user project controls the GPIO pin like the GPIO_MODE_USER_STD_BIDIRECTIONAL mode, above; however, the pad value also appears at the management SoC, so the management SoC can treat this pad as an input pin, monitoring the value seen by the user project.
The values for these constants are
Copy code
#define GPIO_MODE_USER_STD_BIDIRECTIONAL   0x1800
#define GPIO_MODE_USER_STD_OUT_MONITORED   0x1802
the only difference being that bit 1 is high for
GPIO_MODE_USER_STD_OUT_MONITORED
. However, bit 1 is
OUTPUT_DISABLE
. Looking at the verilog
gpio_control_block.v
Copy code
/* Parameters defining the bit offset of each function in the chain */
    localparam MGMT_EN = 0;
    localparam OEB = 1;
...
            mgmt_ena <= gpio_defaults[MGMT_EN];
            gpio_holdover <= gpio_defaults[HLDH];
            gpio_slow_sel <= gpio_defaults[SLOW];
            gpio_vtrip_sel <= gpio_defaults[TRIP];
            gpio_ib_mode_sel <= gpio_defaults[MOD_SEL];
            gpio_inenb <= gpio_defaults[INP_DIS];
            gpio_outenb <= gpio_defaults[OEB];
...
    assign pad_gpio_outenb = (mgmt_ena) ? ((mgmt_gpio_oeb == 1'b1) ?
                        gpio_outenb : 1'b0) : user_gpio_oeb;
it appears that
OUTPUT_DISABLE
is only used when
MGMT_ENABLE
is high and
mgmt_gpio_oeb
is high. When
mgmt_ena
is high, the default value will override a high
mgmt_gpio_oeb
. Is that what was intended? If
MGMT_ENABLE
is low,
pad_gpio_outenb
is controlled solely by the
user_gpio_oeb
. I was expecting gpio modes with
OUTPUT_DISABLE
high to disable any output. Maybe something like
Copy code
assign pad_gpio_outenb = (gpio_outenb) ? 1'b1 : ((mgmt_ena) ? mgmt_gpio_oeb : user_gpio_oeb);
As far as user input versus management input:
Copy code
assign mgmt_gpio_in = pad_gpio_in;
...
    assign user_gpio_in = pad_gpio_in & gpio_logic1;
as long as the user area is powered, they will be the same level. In summary, 1. There appears to be no difference between
GPIO_MODE_USER_STD_BIDIRECTIONAL
and
GPIO_MODE_USER_STD_OUT_MONITORED
. Any enabled input signal appears in both the user area and management area. 2.
DM[2:0]
=
000
or
001
disable the output buffers, so for
INPUT_NOPULL
and
ANALOG
modes,
oeb
and
out
settings do not effect the output. Is that understanding correct?