Leo Moser
11/05/2023, 12:42 PMuser_defines.v
.
Taking a look at the individual bit fields for the GPIO pad control:
#define MGMT_ENABLE 0x001
#define OE_OVERRIDE 0x002
#define INPUT_ENABLE 0x004
#define OUTPUT_ENABLE 0x008
#define SCHMITT_SELECT 0x010
#define SLEW_SELECT 0x020
#define PULLUP_SELECT 0x040
#define PULLDOWN_SELECT 0x080
#define DRIVE_SELECT_MASK 0x300
This means that all of the following user configurations basically ignore the io_oeb
signal from user_project_wrapper
, right?
GPIO_MODE_USER_STD_INPUT_*
GPIO_MODE_USER_STD_OUTPUT
For GPIO_MODE_USER_STD_BIDIRECTIONAL
the OE_OVERRIDE
bit is not set, therefore io_oeb
is used. It only has the OUTPUT_ENABLE
bit set, but shouldn't the INPUT_ENABLE
bit also be set?Mitch Bailey
11/05/2023, 1:53 PMgpio_control_block
combines the gpio “constant” (they’re reprogrammable) inputs from gpio_defaults_block
as defined in verilog/rtl/user_defines.v
with the signals from the user_project_wrapper
(io_out
, io_oeb
, io_in
).Tim Edwards
11/05/2023, 3:03 PMio_oeb
bit is for use with management control of the GPIO, because the management has a simpler interface to each GPIO, with just two signal lines per GPIO (data in and data out). So the "OEB" bit of the GPIO is controlled by the configuration, not by an active signal. The user project has a three-signal interface for each GPIO (data in, data out, and OEB), so the io_oeb
configuration bit doesn't have any useful function.
Note that these comments apply to the sky130 version of caravel only. For the GF version I made a better interface with configuration overrides on the signals.Mitch Bailey
11/05/2023, 3:19 PMgpio_control_block
/* These pad configuration signals are static and do not change */
/* after setup. */
assign pad_gpio_inen = gpio_inen;
assign pad_gpio_slew_sel = gpio_slew_sel;
assign pad_gpio_schmitt_sel = gpio_schmitt_sel;
assign pad_gpio_drive_sel = gpio_drive_sel;
assign pad_gpio_pullup_sel = gpio_pullup_sel;
assign pad_gpio_pulldown_sel = gpio_pulldown_sel;
/* Implement pad control behavior depending on state of mgmt_ena */
assign user_gpio_in = pad_gpio_in;
assign mgmt_gpio_in = pad_gpio_in;
/* OE override signal takes precedence over the state of output enable
* at the GPIO pad. Otherwise, the OE signal comes directly from the
* management SoC or the user project depending on the state of
* the management enable signal.
*/
assign pad_gpio_outen = (gpio_oe_override) ? gpio_outen :
((mgmt_ena) ? ~mgmt_gpio_oeb : ~user_gpio_oeb);
assign pad_gpio_out = (mgmt_ena) ? mgmt_gpio_out : user_gpio_out;
gpio_inen
is static and zero in the BIDIRECTIONAL
modes. It should probably be the opposite of pad_gpio_outen
in BIDIRECTIONAL
mode only.Leo Moser
11/05/2023, 3:35 PMio_oeb
has an effect when the GPIOs are set to GPIO_MODE_USER_STD_BIDIRECTIONAL
?Mitch Bailey
11/05/2023, 3:56 PMio_out
is output, but I don’t see the effect on io_in
. 😬Tim Edwards
11/05/2023, 4:21 PMMitch Bailey
11/05/2023, 5:06 PMio_oeb
is low, correct?
If that’s correct, I can log an issue and create a PR.Leo Moser
11/05/2023, 5:41 PMINPUT_ENABLE
for GPIO_MODE_USER_STD_BIDIRECTIONAL
and run a caravel-level simulation for my design. Thanks for your help 😃️