From 48154cb6f452d3bdb4da36cc267b4b6c45588dc9 Mon Sep 17 00:00:00 2001
From: Clifford Wolf
+Project IceStorm aims at documenting the bitstream format of Lattice iCE40
+FPGAs and providing simple tools for analyzing and creating bitstream files.
+This is work in progress.
+
+The image on the right shows the span-wires of a left (or right) io cell (click to enlarge).
+
+A left/right io cell has 16 connections named span4_vert_t_0 to span4_vert_t_15 on its top edge and
+16 connections named span4_vert_b_0 to span4_vert_b_15 on its bottom edge. The nets span4_vert_t_0
+to span4_vert_t_11 are connected to span4_vert_b_4 to span4_vert_b_15. The span-4 and span-12 wires
+of the adjacent logic cell are connected to the nets span4_horz_0 to span4_horz_47 and span12_horz_0
+to span12_horz_23.
+
+A top/bottom io cell has 16 connections named span4_vert_l_0 to span4_vert_l_15 on its top edge and
+16 connections named span4_vert_r_0 to span4_vert_r_15 on its bottom edge. The nets span4_vert_l_0
+to span4_vert_l_11 are connected to span4_vert_r_4 to span4_vert_r_15. The span-4 and span-12 wires
+of the adjacent logic cell are connected to the nets span4_vert_0 to span4_vert_47 and span12_vert_0
+to span12_vert_23.
+
+The vertical span4 wires of left/right io cells are connected "around the corner" to the horizontal span4 wires of the top/bottom
+io cells. For example span4_vert_b_0 of IO cell (0 1) is connected to span4_horz_l_0 (span4_horz_r_4)
+of IO cell (1 0).
+
+Note that unlike the span-wires connection LOGIC and RAM tiles, the span-wires
+connecting IO tiles to each other are not pairwised crossed out.
+
+Each IO tile contains two IO blocks. Each IO block essentially implements the SB_IO
+primitive from the Lattice iCE Technology Library.
+Some inputs are shared between the two IO blocks. The following table lists how the
+wires in the logic tile map to the SB_IO primitive ports:
+
+Project IceStorm – IO Tile Documentation
+
+Span-4 and Span-12 Wires
+
+
+
+IO Blocks
+
+
+
+
+SB_IO Port IO Block 0 IO Block 1
+D_IN_0 io_0/D_IN_0 io_1/D_IN_0
+D_IN_1 io_0/D_IN_1 io_1/D_IN_1
+D_OUT_0 io_0/D_OUT_0 io_1/D_OUT_0
+D_OUT_1 io_0/D_OUT_1 io_1/D_OUT_1
+OUTPUT_ENABLE io_0/OUT_ENB io_1/OUT_ENB
+CLOCK_ENABLE io_global/cen
+INPUT_CLK io_global/inclk
+OUTPUT_CLK io_global/outclk
+LATCH_INPUT_VALUE io_global/latch
+Like the inputs to logic cells, the inputs to IO blocks are routed to the IO block via a two-stage process. A signal +is first routed to one of 16 local tracks in the IO tile and then from the local track to the IO block. +
+ ++The io_global/latch signal is shared among all IO tiles on an edge of the chip and is driven by wire_gbuf/in +from one dedicated IO tile on that edge. For the HX1K chips the tiles driving the io_global/latch signal are: +(0, 7), (13, 10), (5, 0), and (8, 17) +
+ ++A logic tile sends the output of its eight logic cells to its neighbour tiles. An IO tile does the same thing with the four D_IN +signals created by its two IO blocks. The D_IN signals map to logic function indices as follows: +
+ ++
| Function Index | D_IN Wire |
|---|---|
| 0 | io_0/D_IN_0 |
| 1 | io_0/D_IN_1 |
| 2 | io_1/D_IN_0 |
| 3 | io_1/D_IN_1 |
| 4 | io_0/D_IN_0 |
| 5 | io_0/D_IN_1 |
| 6 | io_1/D_IN_0 |
| 7 | io_1/D_IN_1 |
+For example the signal io_1/D_IN_0 in IO tile (0, 5) can be seen as neigh_op_lft_2 and neigh_op_lft_6 in LOGIC tile (1, 5). +
+ ++Each IO Tile has 2 NegClk configuration bits, suggesting that the +clock signals can be inverted independently for the the two IO blocks in the +tile. However, the Lattice tools refuse to pack to IO blocks with different block +polarity into the same IO tile. In our tests we only managed to either set or clear +both NegClk bits. +
+ ++Each IO block has two IoCtrl IE bits that enable the input buffers and +two IoCtrl REN bits that enable the pull up resistors. Both bits are active +low, i.e. an unused IO tile will have both IE bits set and both REN bits cleared (the +default behavior is to enable pullup resistors on all unused pins). Note that +icebox_explain.py will ignore all IO tiles that only have the two IoCtrl +IE bits set. +
+ ++However, the IoCtrl IE_0/IE_1 and IoCtrl REN_0/REN_1 do not +necessarily configure the IO PIN that are connected to the IO block in the same tile, +and if they do the numbers (0/1) do not necessarily match. As a general rule, the pins +on the right and bottom side of the chips match up with the IO blocks and for the pins +on the left and top side the numbers must be swapped. But in some cases the IO block +and the set of IE/REN are not even located in the same tile. The following +table lists the correlation between IO blocks and IE/REN bits for the +1K chip: +
+ ++
+
+
|
+
+
|
+
+
|
+
+
|
+When an input pin pair is used as LVDS pair (IO standard +SB_LVDS_INPUT, bank 3 / left edge only), then the four bits +IoCtrl IE_0/IE_1 and IoCtrl REN_0/REN_1 are all set, as well +as the IoCtrl LVDS bit. +
+ ++In the iCE 8k devices the IoCtrl IE bits are active high. So an unused +IO tile on an 8k chip has all bits cleared. +
+ ++iCE40 FPGAs have 8 global nets. Each global net can be driven directly from an +IO pin. In the FPGA bitstream, routing of external signals to global nets is +not controlled by bits in the IO tile. Instead bits that do not belong to any +tile are used. In IceBox nomenclature such bits are called "extra bits". +
+ ++The following table lists which pins / IO blocks may be used to drive +which global net, and what .extra statements in the IceBox ASCII file +format to represent the corresponding configuration bits: +
+ + ++
| Glb Net | Pin (HX1K-TQ144) | IO Tile + Block # | IceBox Statement |
|---|---|---|---|
| 0 | 93 | 13 8 1 | .extra_bit 0 330 142 |
| 1 | 21 | 0 8 1 | .extra_bit 0 331 142 |
| 2 | 128 | 7 17 0 | .extra_bit 1 330 143 |
| 3 | 50 | 7 0 0 | .extra_bit 1 331 143 |
| 4 | 20 | 0 9 0 | .extra_bit 1 330 142 |
| 5 | 94 | 13 9 0 | .extra_bit 1 331 142 |
| 6 | 49 | 6 0 1 | .extra_bit 0 330 143 |
| 7 | 129 | 6 17 1 | .extra_bit 0 331 143 |
+Signals internal to the FPGA can also be routed to the global nets. This is done by routing the signal +to the wire_gbuf/in net on an IO tile. The same set of I/O tiles is used for this, but in this +case each of the I/O tiles corresponds to a different global net: +
+ ++
| Glb Net | +0 | +1 | +2 | +3 | +4 | +5 | +6 | +7 |
|---|---|---|---|---|---|---|---|---|
| IO Tile | +7 0 | +7 17 | +13 9 | +0 9 | +6 17 | +6 0 | +0 8 | +13 8 |
+Each LOGIC, IO, and RAMB tile has 8 ColBufCtrl bits, one for each global net. In most tiles this +bits have no function, but in tiles in rows 4, 5, 12, and 13 (for RAM columns: rows 3, 5, 11, and 13) this bits +control which global nets are driven to the column of tiles below and/or above that tile (including that tile), +as illustrated in the image to the right (click to enlarge). +
+ ++In 8k chips the rows 8, 9, 24, and 25 contain the column buffers. 8k RAMB and +RAMT tiles can control column buffers, so the pattern looks the same for RAM, LOGIC, and +IO columns. +
+ ++The SB_WARMBOOT primitive in iCE40 FPGAs has three inputs and no outputs. The three inputs of that cell +are driven by the wire_gbuf/in signal from three IO tiles. In HX1K chips the tiles connected to the +SB_WARMBOOT primitive are: +
+ ++
| Warmboot Pin | IO Tile |
|---|---|
| BOOT | 12 0 |
| S0 | 13 1 |
| S1 | 13 2 |
+The PLL primitives in iCE40 FPGAs are configured using the PLLCONFIG_* +bits in the IO tiles. The configuration for a single PLL cell is spread out +over many IO tiles. For example, the PLL cell in the 1K chip are configured as +follows (bits listed from LSB to MSB): +
+ ++
+
+
|
+
+
|
+The PLL inputs are routed to the PLL via the wire_gbuf/in signal from various IO tiles. The non-clock +PLL outputs are routed via otherwise unused neigh_op_* signals in fabric corners. For example in case +of the 1k chip: +
+ ++
| Tile | Net-Segment | SB_PLL40_* Port Name |
|---|---|---|
| 0 1 | wire_gbuf/in | REFERENCECLK |
| 0 2 | wire_gbuf/in | EXTFEEDBACK |
| 0 4 | wire_gbuf/in | DYNAMICDELAY |
| 0 5 | wire_gbuf/in | |
| 0 6 | wire_gbuf/in | |
| 0 10 | wire_gbuf/in | |
| 0 11 | wire_gbuf/in | |
| 0 12 | wire_gbuf/in | |
| 0 13 | wire_gbuf/in | |
| 0 14 | wire_gbuf/in | |
| 1 1 | neigh_op_bnl_1 | LOCK |
| 1 0 | wire_gbuf/in | BYPASS |
| 2 0 | wire_gbuf/in | RESETB |
| 5 0 | wire_gbuf/in | LATCHINPUTVALUE |
| 12 1 | neigh_op_bnl_1 | SDO |
| 4 0 | wire_gbuf/in | SDI |
| 5 0 | wire_gbuf/in | SCLK |
+The PLL clock outputs are fed directly into the input path of certain IO tiles. +In case of the 1k chip the PORTA clock is fed into PIO 1 of IO Tile (6 0) and +the PORTB clock is fed into PIO 0 of IO Tile (7 0). Because of this, those two +PIOs can only be used as output Pins by the FPGA fabric when the PLL ports +are being used. +
+ -- cgit v1.2.3