Pin multiplexer

This allows software to dynamically switch FPGA pins between input and output as well as reassign them for SPI, I2C, UART, etc. The block also allows pad control.

To see the possible mappings, please refer to the top configuration. All selectors are byte addressable, this means that you can write four selectors at a time with a 32-bit write.

There are output pin selectors, which select which block output is connected to a particular FPGA pin. The selector is one-hot, so you need to write 8'b100 if you want to select input 3 for example. The default value for all of these selectors is 'b10.

AddressPin outputPossible block outputs
0x000ser0_tx0, uart_0_tx
0x001ser1_tx0, uart_1_tx, uart_2_tx
0x002rs232_tx0, uart_2_tx
0x003rs485_tx0, uart_2_tx
0x004scl00, i2c_0_scl
0x005sda00, i2c_0_sda
0x006scl10, i2c_1_scl
0x007sda10, i2c_1_sda
0x008rph_g00, i2c_0_sda, gpio_0_ios_0
0x009rph_g10, i2c_0_scl, gpio_0_ios_1
0x00arph_g2_sda0, i2c_1_sda, gpio_0_ios_2
0x00brph_g3_scl0, i2c_1_scl, gpio_0_ios_3
0x00crph_g40, gpio_0_ios_4
0x00drph_g50, gpio_0_ios_5
0x00erph_g60, gpio_0_ios_6
0x00frph_g70, spi_1_cs_1, gpio_0_ios_7
0x010rph_g80, spi_1_cs_0, gpio_0_ios_8
0x011rph_g90, gpio_0_ios_9
0x012rph_g100, spi_1_copi, gpio_0_ios_10
0x013rph_g110, spi_1_sclk, gpio_0_ios_11
0x014rph_g120, gpio_0_ios_12, pwm_out_0
0x015rph_g130, gpio_0_ios_13, pwm_out_1
0x016rph_txd00, uart_1_tx, gpio_0_ios_14
0x017rph_rxd00, gpio_0_ios_15
0x018rph_g160, spi_2_cs_2, gpio_0_ios_16
0x019rph_g170, spi_2_cs_1, gpio_0_ios_17
0x01arph_g180, spi_2_cs_0, gpio_0_ios_18, pwm_out_2
0x01brph_g190, gpio_0_ios_19, pwm_out_3
0x01crph_g200, spi_2_copi, gpio_0_ios_20, pwm_out_4
0x01drph_g210, spi_2_sclk, gpio_0_ios_21, pwm_out_5
0x01erph_g220, gpio_0_ios_22
0x01frph_g230, gpio_0_ios_23
0x020rph_g240, gpio_0_ios_24
0x021rph_g250, gpio_0_ios_25
0x022rph_g260, gpio_0_ios_26
0x023rph_g270, gpio_0_ios_27
0x024ah_tmpio00, gpio_1_ios_0
0x025ah_tmpio10, uart_1_tx, gpio_1_ios_1
0x026ah_tmpio20, gpio_1_ios_2
0x027ah_tmpio30, gpio_1_ios_3, pwm_out_0
0x028ah_tmpio40, gpio_1_ios_4
0x029ah_tmpio50, gpio_1_ios_5, pwm_out_1
0x02aah_tmpio60, gpio_1_ios_6, pwm_out_2
0x02bah_tmpio70, gpio_1_ios_7
0x02cah_tmpio80, gpio_1_ios_8
0x02dah_tmpio90, gpio_1_ios_9, pwm_out_3
0x02eah_tmpio100, spi_1_cs_3, gpio_1_ios_10, pwm_out_4
0x02fah_tmpio110, spi_1_copi, gpio_1_ios_11, pwm_out_5
0x030ah_tmpio120, gpio_1_ios_12
0x031ah_tmpio130, spi_1_sclk, gpio_1_ios_13
0x032mb10, spi_2_cs_3
0x033mb20, spi_2_sclk
0x034mb40, spi_2_copi
0x035mb50, i2c_1_sda
0x036mb60, i2c_1_scl
0x037mb70, uart_1_tx
0x038mb100, pwm_out_0
0x039pmod0_10, gpio_2_ios_0, spi_1_cs_0
0x03apmod0_20, gpio_2_ios_1, spi_1_copi, pwm_out_1, uart_1_tx
0x03bpmod0_30, gpio_2_ios_2, i2c_0_scl
0x03cpmod0_40, gpio_2_ios_3, spi_1_sclk, i2c_0_sda
0x03dpmod0_70, gpio_2_ios_4
0x03epmod0_80, gpio_2_ios_5, pwm_out_2
0x03fpmod0_90, gpio_2_ios_6, spi_1_cs_1
0x040pmod0_100, gpio_2_ios_7, spi_1_cs_2
0x041pmod1_10, gpio_3_ios_0, spi_2_cs_0
0x042pmod1_20, gpio_3_ios_1, spi_2_copi, pwm_out_3, uart_2_tx
0x043pmod1_30, gpio_3_ios_2, i2c_1_scl
0x044pmod1_40, gpio_3_ios_3, spi_2_sclk, i2c_1_sda
0x045pmod1_70, gpio_3_ios_4
0x046pmod1_80, gpio_3_ios_5, pwm_out_4
0x047pmod1_90, gpio_3_ios_6, spi_2_cs_1
0x048pmod1_100, gpio_3_ios_7, spi_2_cs_2
0x049pmodc_10, gpio_4_ios_0
0x04apmodc_20, gpio_4_ios_1
0x04bpmodc_30, gpio_4_ios_2
0x04cpmodc_40, gpio_4_ios_3
0x04dpmodc_50, gpio_4_ios_4
0x04epmodc_60, gpio_4_ios_5
0x04fappspi_d00, spi_0_copi
0x050appspi_clk0, spi_0_sclk
0x051appspi_cs0, spi_0_cs_0
0x052microsd_cmd0, spi_0_copi
0x053microsd_clk0, spi_0_sclk
0x054microsd_dat30, spi_0_cs_1

Besides the output pin selectors, there are also selectors for which pin should drive block inputs:

AddressBlock inputPossible pin inputs
0x800gpio_0_ios_00, rph_g0
0x801gpio_0_ios_10, rph_g1
0x802gpio_0_ios_20, rph_g2_sda
0x803gpio_0_ios_30, rph_g3_scl
0x804gpio_0_ios_40, rph_g4
0x805gpio_0_ios_50, rph_g5
0x806gpio_0_ios_60, rph_g6
0x807gpio_0_ios_70, rph_g7
0x808gpio_0_ios_80, rph_g8
0x809gpio_0_ios_90, rph_g9
0x80agpio_0_ios_100, rph_g10
0x80bgpio_0_ios_110, rph_g11
0x80cgpio_0_ios_120, rph_g12
0x80dgpio_0_ios_130, rph_g13
0x80egpio_0_ios_140, rph_txd0
0x80fgpio_0_ios_150, rph_rxd0
0x810gpio_0_ios_160, rph_g16
0x811gpio_0_ios_170, rph_g17
0x812gpio_0_ios_180, rph_g18
0x813gpio_0_ios_190, rph_g19
0x814gpio_0_ios_200, rph_g20
0x815gpio_0_ios_210, rph_g21
0x816gpio_0_ios_220, rph_g22
0x817gpio_0_ios_230, rph_g23
0x818gpio_0_ios_240, rph_g24
0x819gpio_0_ios_250, rph_g25
0x81agpio_0_ios_260, rph_g26
0x81bgpio_0_ios_270, rph_g27
0x81cgpio_1_ios_00, ah_tmpio0
0x81dgpio_1_ios_10, ah_tmpio1
0x81egpio_1_ios_20, ah_tmpio2
0x81fgpio_1_ios_30, ah_tmpio3
0x820gpio_1_ios_40, ah_tmpio4
0x821gpio_1_ios_50, ah_tmpio5
0x822gpio_1_ios_60, ah_tmpio6
0x823gpio_1_ios_70, ah_tmpio7
0x824gpio_1_ios_80, ah_tmpio8
0x825gpio_1_ios_90, ah_tmpio9
0x826gpio_1_ios_100, ah_tmpio10
0x827gpio_1_ios_110, ah_tmpio11
0x828gpio_1_ios_120, ah_tmpio12
0x829gpio_1_ios_130, ah_tmpio13
0x82agpio_2_ios_00, pmod0_1
0x82bgpio_2_ios_10, pmod0_2
0x82cgpio_2_ios_20, pmod0_3
0x82dgpio_2_ios_30, pmod0_4
0x82egpio_2_ios_40, pmod0_7
0x82fgpio_2_ios_50, pmod0_8
0x830gpio_2_ios_60, pmod0_9
0x831gpio_2_ios_70, pmod0_10
0x832gpio_3_ios_00, pmod1_1
0x833gpio_3_ios_10, pmod1_2
0x834gpio_3_ios_20, pmod1_3
0x835gpio_3_ios_30, pmod1_4
0x836gpio_3_ios_40, pmod1_7
0x837gpio_3_ios_50, pmod1_8
0x838gpio_3_ios_60, pmod1_9
0x839gpio_3_ios_70, pmod1_10
0x83agpio_4_ios_00, pmodc_1
0x83bgpio_4_ios_10, pmodc_2
0x83cgpio_4_ios_20, pmodc_3
0x83dgpio_4_ios_30, pmodc_4
0x83egpio_4_ios_40, pmodc_5
0x83fgpio_4_ios_50, pmodc_6
0x840uart_0_rx1, ser0_rx
0x841uart_1_rx1, ser1_rx, rph_rxd0, ah_tmpio0, mb8, pmod0_3
0x842uart_2_rx1, ser1_rx, rs232_rx, rs485_rx, pmod1_3
0x843spi_0_cipo0, appspi_d1, microsd_dat0
0x844spi_1_cipo0, rph_g9, ah_tmpio12, pmod0_3
0x845spi_2_cipo0, rph_g19, mb3, pmod1_3

Regeneration

If any changes are made to the top configuration, the templates or the bus, you must regenerate the top. You can do so using the top generation utility, which regenerates the pinmux, the bus and the sonata package which is used by the SystemVerilog generate statements throughout the project.

./util/top_gen.py