Skip to content

Commit 66f0de4

Browse files
authored
Merge pull request #254 from yrabbit/bsram-doc-3
BSRAM BLKSEL fix
2 parents 665633c + 39712ff commit 66f0de4

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

apycula/chipdb.py

+2
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,8 @@ def set_chip_flags(dev, device):
16561656
dev.chip_flags.append("NEED_SP_FIX")
16571657
if device in {'GW1N-9C', 'GW2A-18C'}:
16581658
dev.chip_flags.append("NEED_BSRAM_OUTREG_FIX")
1659+
if device in {'GW1N-1', 'GW1NZ-1', 'GW1NS-2', 'GW1N-4', 'GW1NS-4', 'GW1N-9', 'GW1N-9C', 'GW2A-18', 'GW2A-18C'}:
1660+
dev.chip_flags.append("NEED_BLKSEL_FIX")
16591661

16601662
def from_fse(device, fse, dat: Datfile):
16611663
dev = Device()

doc/bsram-fix.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,21 @@ One more note for the future - if these additional things are intended to correc
4040

4141
![READ_MODE=1'b0, WRITE_MODE=2'b10](fig/sp-rmode-1-wmode-10.png)
4242

43-
<<<<<<< HEAD
44-
4543
### Tangnano9k and Tangnano20k
4644
For chips on these boards, no new elements are formed around the BSRAM, that is, we can conclude that whatever was broken in the previous families was fixed here. However, now the built-in output registers only work with 32 or 36 bits - with a different bit size, the internal registers are disabled (read mode is forced to switch to 1'b0 bypass) and external DFFs are added.
4745

4846
Which type is added, DFFCE or DFFRE, is determined by the SYNC parameter.
4947

5048
![Tangnano9k and Tangnano20k with READ_MODE=1'b1](fig/sp-rmode-1-9c-20c.png)
5149

50+
### BSRAM block selection
51+
It seems that block selection using the `BLKSEL[2:0]` signals does not work as expected because the images generated by the Gowin IDE show an interesting re-communication of these signals.
52+
53+
The principle is this: instead of using the `BLKSEL[2:0]` ports, we connect them to constants, thereby making the BSRAM block statically selected, but add a LUT-based `BLKSEL[2:0]` signal decoder that manipulates the Clock Enable port. Of course, the decoder uses only dynamically changing `BLKSEL` networks - there’s no point in bothering with constant bits.
54+
55+
Here is an example of two blocks with a simple decoder:
56+
![LUT2 decoder](fig/sp-blksel.png)
57+
5258

5359
# TODO
5460
- Explore DPB, SDPB and pROM

doc/fig/sp-blksel.dia

2.82 KB
Binary file not shown.

doc/fig/sp-blksel.png

20.2 KB
Loading

0 commit comments

Comments
 (0)