fpga-research-manchester / fos Goto Github PK
View Code? Open in Web Editor NEWFOS - FPGA Operating System
License: Other
FOS - FPGA Operating System
License: Other
Hello,
I'm trying to make FOS working on my board since I have neither the ultra96, zcu102 nor the ultrazed. However I fail to write my bin files to /sys/class/fpga_manager/fpga0/firmware.
Since the project relies on PYNQ libraries, I'm using a PYNQ-Z2 board with Xilinx's pre-compiled Pynq 2.3 SD card image (version choice based on compatibilities with FOS).
So far, those were my steps:
I then created a Vivado 2018.2 static project that consists of a Zynq PS communicating with a AXIS FIFO in PL via DMA (this project has already been tested with the PYNQ Overlay libraries and works just fine). The bitstream has been generated without compression nor encryption.
I used the template accelerator json files from your tutorial to create my own. I had to write a repo.json and a shell json files as the Ponq library kept asking for it. The following code has been working so far as the bin files has been copied to the relevant bin folder, but the last line from the python code always fail:
repo.json
{
"shell": "PYNQ_Z2",
"accelerators": [
"static_full_vadd"
]
}
static_full_add.json
{
"name": "static_full_add",
"address": "0x40400000",
"bitfiles": [
{"name": "static_full_vadd.bit", "region": "full"}
],
"registers":[
{"name":"MM2S_DMACR", "offset":"0x0"},
{"name":"MM2S_DMASR", "offset":"0x4"},
{"name":"MM2S_CURDESC", "offset":"0x8"},
{"name":"MM2S_CURDESC_MSB", "offset":"0xC"},
{"name":"MM2S_TAILDESC", "offset":"0x10"},
{"name":"MM2S_TAILDESC_MSB", "offset":"0x14"},
{"name":"SG_CTL", "offset":"0x2C"},
{"name":"S2MM_DMACR", "offset":"0x30"},
{"name":"S2MM_DMASR", "offset":"0x34"},
{"name":"S2MM_CURDESC", "offset":"0x38"},
{"name":"S2MM_CURDESC_MSB", "offset":"0x3C"},
{"name":"S2MM_TAILDESC", "offset":"0x40"},
{"name":"S2MM_TAILDESC_MSB", "offset":"0x44"}
]
}
PYNQ_Z2.json
{
"name": "PYNQ_Z2",
"bitfile": "static_full_vadd.bin",
"regions": [
{"name": "full", "blank": "static_full_vadd.bin", "bridge": "0x4040FFFF", "addr": "0x40400000"}
]
}
# Jupyter Notebook Python code
# Loading dependencies
import mmap, os, random, time, numpy as np
from ponq import Ponq
# Initialising Ponq bitstream repository
manager = Ponq(repository="./bitstreams")
acc = manager.load("static_full_vadd")
The ponq library fails to load the binary file as I get the following error: OSError: [Errno 22] Invalid argument.
The /sys/class/fpga_manager/fpga0/firmware exists and all users have write access on it. I am not able to echo the bin file in fpga0/firmware though (echo: write error: invalid argument). The Pynq overlay PCAP manager works fine however.
Do you have any fix or pointer to help me out?
Have a good day,
Alexis.
Hello,
I've started working again with FOS and a PYNQ Z2 board, but I haven't managed to successfuly make my own accelerators communicate with the CPU via Ponq so far.
The tools I used are: Vivado 2018.2 +SDK, Current version of FOS + Pynq v2.3 (v2.3 being the version used in your compilation guide, proof here, line 325)
As I mentionned in Issue #7, I first had some trouble working with the library and the PCAP manager. Eventually thanks to khoapham I've been able to seemingly make it work as I was able to write to the PCAP port via CLI, and use PONQ's acc.load(accel_name)
function to load it. I wasn't able to properly check my IP however, as FOS is based on PYNQ v2.3 and there seem to be an odd behaviour with DMA compared with v2.6 which I'm more used to.
Since I'm more experienced with VHDL than HLS, I wrote my own AXI IP to instanciate with the PS which has been verified with PYNQ v2.6 Overlay library. The IP has a slave and master AXIS interface and is connected to the PS via DMA, since as introduced in your Vivado tutorial you are using Ultrascale boards which has both a Slave and Master HP AXI ports, whereas the non-Ultrascale only has a Slave HP AXI port, and Master GP AXI ports. Is this an issue?
I then used the DMA IP to communicate with my IP, the registers as described within SDK (hardware description file) to write my accelerator are the following, written in my accelerator json file:
{
"name": "static_full_add",
"address": "0x40400000",
"bitfiles": [
{"name": "static_full_vadd.bit", "region": "full"}
],
"registers":[
{"name":"MM2S_DMACR", "offset":"0x0"},
{"name":"MM2S_DMASR", "offset":"0x4"},
{"name":"MM2S_CURDESC", "offset":"0x8"},
{"name":"MM2S_CURDESC_MSB", "offset":"0xC"},
{"name":"MM2S_TAILDESC", "offset":"0x10"},
{"name":"MM2S_TAILDESC_MSB", "offset":"0x14"},
{"name":"SG_CTL", "offset":"0x2C"},
{"name":"S2MM_DMACR", "offset":"0x30"},
{"name":"S2MM_DMASR", "offset":"0x34"},
{"name":"S2MM_CURDESC", "offset":"0x38"},
{"name":"S2MM_CURDESC_MSB", "offset":"0x3C"},
{"name":"S2MM_TAILDESC", "offset":"0x40"},
{"name":"S2MM_TAILDESC_MSB", "offset":"0x44"}
]
}
This has caused me lots of trouble figuring how to properly initiate communication with the accelerator without making the jupyter notebook not responding, and as I was basically starting to writing a whole DMA driver in python I figured I was doing things wrong, since your examples are much more straight forward.
I then backtracked and started over. Below is my workflow for a static design using a Vivado AXIS Fifo IP, connected to the Slave HP port with an AXI-S to Memory Mapped adaptator. I carefully mapped everything on 32 bits bus width as the readme mention this might be an issue. My workflow is based on the tutorial about creating hls ips and usage of static design.
I generated the bin file manually within the SDK by running bootgen -image output.bif -arch zynq -process_bitstream bin
, after having created the output.bif file as the tutorial.
Finally, after having reset the board, I uploaded the bit file, bin file, and the following json files to configure the shell and accelerator:
repo.json
{
"shell": "PYNQ_Z2",
"accelerators": [
"design_1_wrapper"
]
}
PYNQ_Z2.json
{
"name": "PYNQ_Z2",
"bitfile": "design_1_wrapper.bin",
"regions": [
{"name": "full", "blank": "design_1_wrapper.bin", "bridge": "0x00000000", "addr": "0x60010000"}
]
}
design_1_wrapper.json
"name": "design_1_wrapper",
"address": "0x60010000",
"bitfiles": [
{"name": "design_1_wrapper.bin", "region": "full"}
],
"registers":[
{"name":"data", "offset":"0x0"},
{"name":"control", "offset":"0x4"}
]
Register map is that of the axi memory map to stream. According to the Vivado Address Editor, I should expect output data in the DDR memory space.
At this point I was able to load the bin files:
But once I try to write in the registers, the kernel dies and restarts:
acc.writeReg("data", 0x00010001) # Data to store
acc.writeReg("control", 0xFFFFFFFF) # WSTRB = FF, TLAST need to be set to 1, other bytes can be left as 1
I'm sure there is something that I'm missing here, or maybe non-ultrascale boards aren't compatible as all your tests seem to be conducted on ultrascale boards. Could you please tell me what am I doing wrong?
Kind regards,
Alexis
Hello, ubuntu has evolved and i had to install version 16.04.6, so what are the changes to do for the SD card Linux image generation script to work?. Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.