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_tx_i(0)
0x001ser1_tx0, uart_tx_i(1)
0x002rs232_tx0, uart_tx_i(4)
0x003scl00, i2c_scl_i(0)
0x004sda00, i2c_sda_i(0)
0x005scl10, i2c_scl_i(1)
0x006sda10, i2c_sda_i(1)
0x007appspi_d00, spi_tx_i(0)
0x008appspi_clk0, spi_sck_i(0)
0x009lcd_copi0, spi_tx_i(1)
0x00alcd_clk0, spi_sck_i(1)
0x00bethmac_copi0, spi_tx_i(2)
0x00cethmac_sclk0, spi_sck_i(2)
0x00drph_g00, i2c_sda_i(0), gpio_ios_i(0)(0)
0x00erph_g10, i2c_scl_i(0), gpio_ios_i(0)(1)
0x00frph_g2_sda0, i2c_sda_i(1), gpio_ios_i(0)(2)
0x010rph_g3_scl0, i2c_scl_i(1), gpio_ios_i(0)(3)
0x011rph_g40, gpio_ios_i(0)(4)
0x012rph_g50, gpio_ios_i(0)(5)
0x013rph_g60, gpio_ios_i(0)(6)
0x014rph_g7_ce10, gpio_ios_i(0)(7)
0x015rph_g8_ce00, gpio_ios_i(0)(8)
0x016rph_g9_cipo0, gpio_ios_i(0)(9)
0x017rph_g10_copi0, spi_tx_i(3), gpio_ios_i(0)(10)
0x018rph_g11_sclk0, spi_sck_i(3), gpio_ios_i(0)(11)
0x019rph_g120, gpio_ios_i(0)(12)
0x01arph_g130, gpio_ios_i(0)(13)
0x01brph_txd00, uart_tx_i(2), gpio_ios_i(0)(14)
0x01crph_rxd00, gpio_ios_i(0)(15)
0x01drph_g16_ce20, gpio_ios_i(0)(16)
0x01erph_g170, gpio_ios_i(0)(17)
0x01frph_g180, gpio_ios_i(0)(18)
0x020rph_g19_cipo0, gpio_ios_i(0)(19)
0x021rph_g20_copi0, spi_tx_i(4), gpio_ios_i(0)(20)
0x022rph_g21_sclk0, spi_sck_i(4), gpio_ios_i(0)(21)
0x023rph_g220, gpio_ios_i(0)(22)
0x024rph_g230, gpio_ios_i(0)(23)
0x025rph_g240, gpio_ios_i(0)(24)
0x026rph_g250, gpio_ios_i(0)(25)
0x027rph_g260, gpio_ios_i(0)(26)
0x028rph_g270, gpio_ios_i(0)(27)
0x029ah_tmpio00, gpio_ios_i(1)(0)
0x02aah_tmpio10, gpio_ios_i(1)(1)
0x02bah_tmpio20, gpio_ios_i(1)(2)
0x02cah_tmpio30, gpio_ios_i(1)(3)
0x02dah_tmpio40, gpio_ios_i(1)(4)
0x02eah_tmpio50, gpio_ios_i(1)(5)
0x02fah_tmpio60, gpio_ios_i(1)(6)
0x030ah_tmpio70, gpio_ios_i(1)(7)
0x031ah_tmpio80, gpio_ios_i(1)(8)
0x032ah_tmpio90, gpio_ios_i(1)(9)
0x033ah_tmpio100, gpio_ios_i(1)(10)
0x034ah_tmpio110, spi_tx_i(3), gpio_ios_i(1)(11)
0x035ah_tmpio120, gpio_ios_i(1)(12)
0x036ah_tmpio130, spi_sck_i(3), gpio_ios_i(1)(13)
0x037ah_tmpio140, gpio_ios_i(1)(14)
0x038ah_tmpio150, gpio_ios_i(1)(15)
0x039ah_tmpio160, gpio_ios_i(1)(16)
0x03aah_tmpio170, gpio_ios_i(1)(17)
0x03bmb20, spi_sck_i(4)
0x03cmb40, spi_tx_i(4)
0x03dmb50, i2c_sda_i(1)
0x03emb60, i2c_scl_i(1)
0x03fmb70, uart_tx_i(3)
0x040pmod0[0]0, gpio_ios_i(2)(0)
0x041pmod0[1]0, gpio_ios_i(2)(1)
0x042pmod0[2]0, gpio_ios_i(2)(2)
0x043pmod0[3]0, gpio_ios_i(2)(3)
0x044pmod0[4]0, gpio_ios_i(2)(4)
0x045pmod0[5]0, gpio_ios_i(2)(5)
0x046pmod0[6]0, gpio_ios_i(2)(6)
0x047pmod0[7]0, gpio_ios_i(2)(7)
0x048pmod1[0]0, gpio_ios_i(2)(8)
0x049pmod1[1]0, gpio_ios_i(2)(9)
0x04apmod1[2]0, gpio_ios_i(2)(10)
0x04bpmod1[3]0, gpio_ios_i(2)(11)
0x04cpmod1[4]0, gpio_ios_i(2)(12)
0x04dpmod1[5]0, gpio_ios_i(2)(13)
0x04epmod1[6]0, gpio_ios_i(2)(14)
0x04fpmod1[7]0, gpio_ios_i(2)(15)

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

AddressBlock inputPossible pin inputs
0x800uart_rx_o(0)1'b1, ser0_rx,
0x801uart_rx_o(1)1'b1, ser1_rx,
0x802uart_rx_o(2)1'b1, rph_rxd0,
0x803uart_rx_o(3)1'b1, mb8,
0x804uart_rx_o(4)1'b1, rs232_rx,
0x805spi_rx_o(0)1'b0, appspi_d1,
0x806spi_rx_o(1)1'b0, 1'b0,
0x807spi_rx_o(2)1'b0, ethmac_cipo,
0x808spi_rx_o(3)1'b0, rph_g9_cipo, ah_tmpio12,
0x809spi_rx_o(4)1'b0, rph_g19_cipo, mb3,
0x80agpio_ios_o(0)(0)1'b0, rph_g0,
0x80bgpio_ios_o(1)(0)1'b0, ah_tmpio0,
0x80cgpio_ios_o(2)(0)1'b0, pmod0[0],
0x80dgpio_ios_o(0)(1)1'b0, rph_g1,
0x80egpio_ios_o(1)(1)1'b0, ah_tmpio1,
0x80fgpio_ios_o(2)(1)1'b0, pmod0[1],
0x810gpio_ios_o(0)(2)1'b0, rph_g2_sda,
0x811gpio_ios_o(1)(2)1'b0, ah_tmpio2,
0x812gpio_ios_o(2)(2)1'b0, pmod0[2],
0x813gpio_ios_o(0)(3)1'b0, rph_g3_scl,
0x814gpio_ios_o(1)(3)1'b0, ah_tmpio3,
0x815gpio_ios_o(2)(3)1'b0, pmod0[3],
0x816gpio_ios_o(0)(4)1'b0, rph_g4,
0x817gpio_ios_o(1)(4)1'b0, ah_tmpio4,
0x818gpio_ios_o(2)(4)1'b0, pmod0[4],
0x819gpio_ios_o(0)(5)1'b0, rph_g5,
0x81agpio_ios_o(1)(5)1'b0, ah_tmpio5,
0x81bgpio_ios_o(2)(5)1'b0, pmod0[5],
0x81cgpio_ios_o(0)(6)1'b0, rph_g6,
0x81dgpio_ios_o(1)(6)1'b0, ah_tmpio6,
0x81egpio_ios_o(2)(6)1'b0, pmod0[6],
0x81fgpio_ios_o(0)(7)1'b0, rph_g7_ce1,
0x820gpio_ios_o(1)(7)1'b0, ah_tmpio7,
0x821gpio_ios_o(2)(7)1'b0, pmod0[7],
0x822gpio_ios_o(0)(8)1'b0, rph_g8_ce0,
0x823gpio_ios_o(1)(8)1'b0, ah_tmpio8,
0x824gpio_ios_o(2)(8)1'b0, pmod1[0],
0x825gpio_ios_o(0)(9)1'b0, rph_g9_cipo,
0x826gpio_ios_o(1)(9)1'b0, ah_tmpio9,
0x827gpio_ios_o(2)(9)1'b0, pmod1[1],
0x828gpio_ios_o(0)(10)1'b0, rph_g10_copi,
0x829gpio_ios_o(1)(10)1'b0, ah_tmpio10,
0x82agpio_ios_o(2)(10)1'b0, pmod1[2],
0x82bgpio_ios_o(0)(11)1'b0, rph_g11_sclk,
0x82cgpio_ios_o(1)(11)1'b0, ah_tmpio11,
0x82dgpio_ios_o(2)(11)1'b0, pmod1[3],
0x82egpio_ios_o(0)(12)1'b0, rph_g12,
0x82fgpio_ios_o(1)(12)1'b0, ah_tmpio12,
0x830gpio_ios_o(2)(12)1'b0, pmod1[4],
0x831gpio_ios_o(0)(13)1'b0, rph_g13,
0x832gpio_ios_o(1)(13)1'b0, ah_tmpio13,
0x833gpio_ios_o(2)(13)1'b0, pmod1[5],
0x834gpio_ios_o(0)(14)1'b0, rph_txd0,
0x835gpio_ios_o(1)(14)1'b0, ah_tmpio14,
0x836gpio_ios_o(2)(14)1'b0, pmod1[6],
0x837gpio_ios_o(0)(15)1'b0, rph_rxd0,
0x838gpio_ios_o(1)(15)1'b0, ah_tmpio15,
0x839gpio_ios_o(2)(15)1'b0, pmod1[7],
0x83agpio_ios_o(0)(16)1'b0, rph_g16_ce2,
0x83bgpio_ios_o(1)(16)1'b0, ah_tmpio16,
0x83cgpio_ios_o(2)(16)1'b0, 1'b0,
0x83dgpio_ios_o(0)(17)1'b0, rph_g17,
0x83egpio_ios_o(1)(17)1'b0, ah_tmpio17,
0x83fgpio_ios_o(2)(17)1'b0, 1'b0,
0x840gpio_ios_o(0)(18)1'b0, rph_g18,
0x841gpio_ios_o(1)(18)1'b0, 1'b0,
0x842gpio_ios_o(2)(18)1'b0, 1'b0,
0x843gpio_ios_o(0)(19)1'b0, rph_g19_cipo,
0x844gpio_ios_o(1)(19)1'b0, 1'b0,
0x845gpio_ios_o(2)(19)1'b0, 1'b0,
0x846gpio_ios_o(0)(20)1'b0, rph_g20_copi,
0x847gpio_ios_o(1)(20)1'b0, 1'b0,
0x848gpio_ios_o(2)(20)1'b0, 1'b0,
0x849gpio_ios_o(0)(21)1'b0, rph_g21_sclk,
0x84agpio_ios_o(1)(21)1'b0, 1'b0,
0x84bgpio_ios_o(2)(21)1'b0, 1'b0,
0x84cgpio_ios_o(0)(22)1'b0, rph_g22,
0x84dgpio_ios_o(1)(22)1'b0, 1'b0,
0x84egpio_ios_o(2)(22)1'b0, 1'b0,
0x84fgpio_ios_o(0)(23)1'b0, rph_g23,
0x850gpio_ios_o(1)(23)1'b0, 1'b0,
0x851gpio_ios_o(2)(23)1'b0, 1'b0,
0x852gpio_ios_o(0)(24)1'b0, rph_g24,
0x853gpio_ios_o(1)(24)1'b0, 1'b0,
0x854gpio_ios_o(2)(24)1'b0, 1'b0,
0x855gpio_ios_o(0)(25)1'b0, rph_g25,
0x856gpio_ios_o(1)(25)1'b0, 1'b0,
0x857gpio_ios_o(2)(25)1'b0, 1'b0,
0x858gpio_ios_o(0)(26)1'b0, rph_g26,
0x859gpio_ios_o(1)(26)1'b0, 1'b0,
0x85agpio_ios_o(2)(26)1'b0, 1'b0,
0x85bgpio_ios_o(0)(27)1'b0, rph_g27,
0x85cgpio_ios_o(1)(27)1'b0, 1'b0,
0x85dgpio_ios_o(2)(27)1'b0, 1'b0,
0x85egpio_ios_o(0)(28)1'b0, 1'b0,
0x85fgpio_ios_o(1)(28)1'b0, 1'b0,
0x860gpio_ios_o(2)(28)1'b0, 1'b0,
0x861gpio_ios_o(0)(29)1'b0, 1'b0,
0x862gpio_ios_o(1)(29)1'b0, 1'b0,
0x863gpio_ios_o(2)(29)1'b0, 1'b0,
0x864gpio_ios_o(0)(30)1'b0, 1'b0,
0x865gpio_ios_o(1)(30)1'b0, 1'b0,
0x866gpio_ios_o(2)(30)1'b0, 1'b0,
0x867gpio_ios_o(0)(31)1'b0, 1'b0,
0x868gpio_ios_o(1)(31)1'b0, 1'b0,
0x869gpio_ios_o(2)(31)1'b0, 1'b0,

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