Bug 1004 - FPGA bring up for platform definitions
Summary: FPGA bring up for platform definitions
Status: CONFIRMED
Alias: None
Product: Libre-SOC's first SoC
Classification: Unclassified
Component: Source Code (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- enhancement
Assignee: Andrey Miroshnikov
URL:
Depends on:
Blocks: 961
  Show dependency treegraph
 
Reported: 2023-02-21 20:51 GMT by Luke Kenneth Casson Leighton
Modified: 2023-11-05 17:06 GMT (History)
5 users (show)

See Also:
NLnet milestone: NLnet.2022-08-107.ongoing
total budget (EUR) for completion of task and all subtasks: 1500
budget (EUR) for this task, excluding subtasks' budget: 1500
parent task for budget allocation: 1037
child tasks for budget allocation:
The table of payments (in EUR) for this task; TOML format:
andrey=600 cesar=500 lkcl=400


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Kenneth Casson Leighton 2023-02-21 20:51:31 GMT
the digilent nexys-video board is one of the few that has a 200k LUTs Xilinx A7.
however it needs a nmigen-boards platform definition for the pinouts, converted
from migen.  also, nextpnr-xilinx (and associated devscripts) need to be
updated to add the 200k xilinx A7 FPGA, at present only the xc7100t and xc35t
are compiled up: the xc7200t database is also needed
Comment 2 Cesar Strauss 2023-09-08 02:31:38 BST
Summary of experimentation done so far:

1) Added support, to the developer script, for the FPGA chip on the Nexys Video  

commit b2dc3deced1a94d7305adc3301c6d9f076787652
Author: Cesar Strauss <cestrauss@gmail.com>
Date:   Mon Jul 10 18:00:24 2023 +0000

    nextpnr-xilinx-install: generate database for XC7A200T
    
    Enables bit file support for the FPGA in the Nexys Video board.

2) Patched nmigen-boards to add a small board definition, sufficient to run a "Blinky lights" design. Untested patch was not submitted upstream, pending a successful confirmation in hardware.

https://libre-soc.org/irclog/%23libre-soc.2023-08-11.log.html#t2023-08-11T10:30:46

3) Konstantinos reported upload failure, xc3prog found buggy

https://libre-soc.org/irclog/%23libre-soc.2023-08-11.log.html#t2023-08-11T11:41:05

4) Konstantinos tried it over USB. Done led lights up, but no blinking lights

https://libre-soc.org/irclog/%23libre-soc.2023-08-13.log.html#t2023-08-13T12:27:13

5) Compiled a Digilent demo with the Vivado toolchain. Konstantinos successfully
uploaded it with openocd. It means we can reliably upload a bit file, the problem does not lie there.

https://libre-soc.org/irclog/%23libre-soc.2023-08-26.log.html#t2023-08-26T13:36:10

6) Compiled a simpler verilog file, still with Vivado. Konstantinos reported it to work. Also, openFPGALoader is also able to upload a bit file, which is more convenient than openOCD.

https://libre-soc.org/irclog/%23libre-soc.2023-08-27.log.html#t2023-08-27T12:44:25

7) Compiled the previous verilog file (without nMigen) with yosys+next-pnr-xilinx. Didn't work. Toolchain confirmed non functional for the XC7A200T.

https://libre-soc.org/irclog/%23libre-soc.2023-08-27.log.html#t2023-08-27T17:57:58

8) Installed Symbiflow, an alternative toolchain. Compiled a Symbiflow demo. Konstantinos reported it to work.

https://libre-soc.org/irclog/%23libre-soc.2023-09-07.log.html#t2023-09-07T18:20:59

Conclusion: Use Symbiflow+openFPGALoader for boards with XC7A200T FPGA.

Next steps:

1) Update Symbiflow dev script to include support for XC7A200T
2) Konstantinos to reproduce the build
3) Update nmigen-boards to use the Symbiflow toolchain
4) Try nMigen Blinky
5) Try a UART demo
6) Submit pull request to include board definition on upstream nmigen-boards
7) Extend board definition to remaining peripherals
8) Try microwatt and ls2
Comment 3 Luke Kenneth Casson Leighton 2023-09-08 06:40:20 BST
(In reply to Cesar Strauss from comment #2)
> Summary of experimentation done so far:

good report.

> 44:25
> 
> 7) Compiled the previous verilog file (without nMigen) with
> yosys+next-pnr-xilinx. Didn't work. Toolchain confirmed non functional for
> the XC7A200T.

it really should not fail. if it does that needs a report upstream with a
suitable repro case. please keep interaction with upstream developers to
an absolute minimum.

> https://libre-soc.org/irclog/%23libre-soc.2023-08-27.log.html#t2023-08-27T17:
> 57:58
> 
> 8) Installed Symbiflow, an alternative toolchain. Compiled a Symbiflow demo.
> Konstantinos reported it to work.

last i checked symbiflow was awful.  many Cells within the FPGA are
unsupported (including some IO pads!), vtr was made multi-threaded and
spends 95% of its time contending for a global lock, resulting in a 7x
performance slowdown compared to nextpnr, and there are the most awful
hacks exporting multi-gigabyte files into JSON, parsing them in *python*
scripts then *re-importing* them as workarounds on carry-save propagation
which don't do the job.

then it was also incapable of
dealing with add/sub/cmp (anything using the Xilinx CARRY4 block)
greater than 96 bits in length because in each "Tile" of a XIlinx
FPGA there are ony 25 such CARRY4 blocks and symbiflow fails to
take that into account.

unless there has been a massive amount of work done, counting on symbiflow
for large designs such as ours would be a serious mistake.
Comment 4 Cesar Strauss 2023-10-03 10:15:41 BST
Konstantinos, please do:

cd ~/src/nmigen-boards
git pull
cd nmigen_boards/test/nexys_video/ledon
./prog-symbiflow.sh

Check that two leds turn on, the DONE led, and the LD0(T14) led. Then:

./prog-nextpnr-xilinx-master.sh

Please tell if these same leds still turn on, or not.

This is a minimal test case (just a led pin tied to VCC), but I need to check against nextpnr-xilinx git master before I can submit a bug report.
Comment 5 Cesar Strauss 2023-10-11 10:57:47 BST
Andrey, glad to hear you got a Nexys Video as well. Please do:

cd ~/src/nmigen-boards
git remote add cesar https://gitlab.com/cestrauss/nmigen-boards.git
git fetch cesar
git checkout digilent-gpio
cd ~/src/nmigen-boards/nmigen_boards/test/nexys_video/symbiflow

Now, make sure that the jumper JP1 is in the JTAG position and the Nexys Video is plugged into your computer via micro-USB cable into the PROG port. Turn on the board, and run:

./prog.sh

You should see a binary counter on four leds.

If it works, follow the steps on comment 4.
Comment 6 Andrey Miroshnikov 2023-10-24 17:52:04 BST
(In reply to Cesar Strauss from comment #5)
> Andrey, glad to hear you got a Nexys Video as well. Please do:
> ...

Just for clarity, I setup the chroot environment with the usual mk-deb-chroot, then inside the chroot run the following:
install-hdl-apt-reqs
hdl-dev-repos
fpga-boot-load-prog-install

After which I added your nmigen-boards digilen-gpio branch.

> Now, make sure that the jumper JP1 is in the JTAG position and the Nexys
> Video is plugged into your computer via micro-USB cable into the PROG port.

Just to clarify, I set JP4 (that's the silkscreen on my board) to connect the QSPI and JTAG. I may be wrong, so let me know (but the example worked, so my jumpers must be in right place).


> Turn on the board, and run:
> 
> ./prog.sh
> 
> You should see a binary counter on four leds.

Yep, worked well.

> 
> If it works, follow the steps on comment 4.

Will continue on to the other example.
Comment 7 Andrey Miroshnikov 2023-10-24 21:12:03 BST
(In reply to Andrey Miroshnikov from comment #6)
> Will continue on to the other example.

(In reply to Cesar Strauss from comment #4)
> Check that two leds turn on, the DONE led, and the LD0(T14) led. Then:

Both LEDs turn on.

> 
> ./prog-nextpnr-xilinx-master.sh
> 
> Please tell if these same leds still turn on, or not.

Both LEDs turn on.

> 
> This is a minimal test case (just a led pin tied to VCC), but I need to
> check against nextpnr-xilinx git master before I can submit a bug report.

Looks like these examples are working as expected.
Comment 8 Cesar Strauss 2023-10-26 11:33:58 BST
(In reply to Andrey Miroshnikov from comment #7)
> Just to clarify, I set JP4 (that's the silkscreen on my board) to connect the
> QSPI and JTAG. I may be wrong, so let me know (but the example worked, so my 
> jumpers must be in right place).

Indeed, seems correct. See the entry "JTAG", on the "Programming mode" table, on the picture:

https://digilent.com/reference/_detail/nexys-video/config_options.png?id=programmable-logic%3Anexys-video%3Areference-manual

> Looks like these examples are working as expected.

Excellent!

This might mean that we don't need Symbiflow after all, and that updating nextpnr-xilinx is all that's needed.

Let's just check that this test design doesn't really work with the outdated nextpnr-xilinx version provided by the developer scripts.

Please try:

cd ~/src/nmigen-boards
git pull
cd nmigen_boards/test/nexys_video/ledon
./build.sh
./prog.sh

I expect it not to work (just the DONE led turns on), but we never know...
Comment 9 Andrey Miroshnikov 2023-11-01 09:54:08 GMT
(In reply to Cesar Strauss from comment #8)
> Let's just check that this test design doesn't really work with the outdated
> nextpnr-xilinx version provided by the developer scripts.
> 
> Please try:
> 
> cd ~/src/nmigen-boards
> git pull
> cd nmigen_boards/test/nexys_video/ledon
> ./build.sh
> ./prog.sh
> 
> I expect it not to work (just the DONE led turns on), but we never know...

Had to run the yosys and nextpnr-xilinx devscripts as well:
hdl-tool-yosys
nextpnr-xilinx-install
As user, export variables for prjxray toolchain:
export PATH=/usr/local/nextpnr-xilinx/bin:$PATH
export XRAY_DIR=/usr/local/nextpnr-xilinx


And it worked! Both LEDs go on (DONE and LD0).
Comment 10 Cesar Strauss 2023-11-04 14:48:13 GMT
(In reply to Andrey Miroshnikov from comment #9)
> And it worked! Both LEDs go on (DONE and LD0).

Interesting.

As it turns out, I made a mistake. The schematics show the LED voltage being 2,5V not 3,3V. I fixed it in the branch. Let's see if it still works:

cd ~/src/nmigen-boards
git pull
cd nmigen_boards/test/nexys_video/ledon
./build.sh
./prog.sh
Comment 11 Andrey Miroshnikov 2023-11-05 17:06:03 GMT
(In reply to Cesar Strauss from comment #10)
> As it turns out, I made a mistake. The schematics show the LED voltage being
> 2,5V not 3,3V. I fixed it in the branch. Let's see if it still works:
Now just DONE LED lights up, looks like the fix worked.