Forum Discussion
oneAPI on Cyclone10gx
is there an equivalent platform design, module connection for the vectorial add ("naive implementation")?
No, as I mentioned, the naive solution in that link requires some memory-mapped agent to read the input vectors from and write the output vectors to. You can add an on-chip memory IP to the Platform Designer sample. The IP will have one or more Avalon Agent (slave) interfaces. You need to connect the host (master) interface from your vector_add IP to this agent, and then connect the master interface from the jtag avalon IP to the on-chip memory agent as well; you can use the JTAG interface to fill the on-chip memory with data and then configure the vector_add ip to access it. This is of course a lot of JTAG commands!
An easier solution is the design in the Nios® V softcore processor sample that I shared:
https://github.com/oneapi-src/oneAPI-samples/tree/master/DirectProgramming/C%2B%2BSYCL_FPGA/ReferenceDesigns/niosv
This uses a soft CPU in place of all the JTAG commands i mentioned, so it fills the on-chip memory with some data and configures and starts the oneAPI IP. In the niosv sample, the oneAPI IP does a simple memory copy rather than a vector add.
The JTAG UART IP in this design is similar to the JTAG Avalon Master IP in the Platform Designer sample. It allows the Nios soft processor to be controlled through a JTAG interface.
of course, you don't have to use on-chip memory; if you want you can use an EMIF IP to connect to the DRAM chips on your Cyclone 10 GX board (but I have no experience using that so someone else will need to help you with that :))
@whitepau_altera I think the niosV will fit my case, I will give a try today, one last clarification, as that userguide mention "..demonstrates how to simulate an FPGA IP produced with the Intel® oneAPI DPC++/C++" and scrolling down I see that towards the end it actually "Generate Testbench System". Will I be able to synthetize on the fpga rather than just simulate?
thanks!
StefanoC
- StefanoC2 years ago
Occasional Contributor
Forgot to say that Cyclone10gx is not mentioned in the previous niosV thing, as you indicated that link, shall I assume that approach will work on my board? - whitepau_altera2 years ago
Contributor
yeah that project has no board-specific settings.
like I said: watch out for the on-chip block RAM getting too big.
- StefanoC2 years ago
Occasional Contributor
@whitepau_altera I will check it out, assuming simulation will work, I could them synthetize on my board, right?
StefanoC
- whitepau_altera2 years ago
Contributor
If you set the pins and the BRAM size, it should work on a board. You will need to use the nios tools to connect to the niosv and monitor it over the JTAG bus. There are guides for that though
https://cdrdv2-public.intel.com/784469/an-784468-784469.pdf - StefanoC2 years ago
Occasional Contributor
@whitepau_alterathe simulation does work. I will edit the sample dma to actually do something useful rather than copying/comparing elements. You mentioned I will have to use the nios tools to connect to the soft core; however I was planning on running my code on the computer CPU with some part of my algorithm memory mapped to an IP that will result from oneAPI compiler. So in this case, if I understand correctly, I don't need to connect to the niosV (unless I want to inspect/debug), am I right?
thanks!
- StefanoC2 years ago
Occasional Contributor
Hi @whitepau_altera I am still running the plain niosv sample simple dma (as it is in the repository without any modification), trying to run in on the hardware and have the cpu (C) interact with the fpga (I confirm the simulation, as detailed in the github repository works).
I added this top node entity:
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity test_system is port ( clk : in STD_LOGIC; rst : in STD_LOGIC ); end entity test_system; architecture Behavioral of test_system is component pd_system is port ( clk_clk : in std_logic := 'X'; reset_reset : in std_logic := 'X'; simple_dma_accelerator_device_exception_bus_data : out std_logic_vector(63 downto 0) ); end component pd_system; signal pd_system_clk : std_logic; signal pd_system_rst : std_logic; begin u0 : pd_system port map ( clk_clk => pd_system_clk, reset_reset => pd_system_rst, simple_dma_accelerator_device_exception_bus_data => open ); pd_system_clk <= clk; pd_system_rst <= rst; end architecture Behavioral;I synthesized the project onto my board, I got a few warnings:
1) Critical Warning(12677): No exact pin location assignment(s) for 1 pins of 2 total pins. For the list of pins please refer to the I/O Assignment Warnings table in the fitter report
2) No user constrained base clocks found in the design. Calling "derive_clocks -period 1.0"
3)Timing requirements not met
clk -6.334 -18110.791 7371 Slow 900mV 100C Model 1
altera_reserved_tck -1.788 -410.899 380 Slow 900mV 100C Model 2About 1) I think it's referring to the clock/reset signals, I tried to put clock location in the pin planner as you suggested "C10_CLKUSR" but that value it's not accepted, scrolling the dropdown menu I selected "PIN_C10 I/O Bank 2k"; I haven't yet assigned the reset that's why one location is not assigned.
I then used the USB blaster JTAG to program the board (successfully).
then I compiled /kernels/simple_dma/ using "make fpga" rather than "make report" and I got an executable, but when I run it I got this:
tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/niosv/kernels/simple_dma/build$ ./simple_dma.fpga Running on device: SimulatorDevice : Multi-process Simulator (aclmsim0) terminate called after throwing an instance of 'sycl::_V1::runtime_error' what(): Invalid device program image: size is zero -30 (PI_ERROR_INVALID_VALUE) Aborted (core dumped) tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/niosv/kernels/simple_dma/build$ sudo env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" ./simple_dma.fpga terminate called after throwing an instance of 'sycl::_V1::runtime_error' what(): No device of requested type available. Please check https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (PI_ERROR_DEVICE_NOT_FOUND) AbortedI tried with sudo as I suspected it couldn't find the board; I exported a variable because without it could complain about a missing library, however it screams about a runtime error.
Am I missing something to run this sample on the board and have the C interact with it?
thanks!!
- StefanoC2 years ago
Occasional Contributor
I successfully synthesized the niosV example (as it is), adding this top node:
library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.NUMERIC_STD.ALL; entity test_system is port ( clk : in STD_LOGIC; rst : in STD_LOGIC ); end entity test_system; architecture Behavioral of test_system is component pd_system is port ( clk_clk : in std_logic := 'X'; reset_reset : in std_logic := 'X'; simple_dma_accelerator_device_exception_bus_data : out std_logic_vector(63 downto 0) ); end component pd_system; signal pd_system_clk : std_logic; signal pd_system_rst : std_logic; begin u0 : pd_system port map ( clk_clk => pd_system_clk, reset_reset => pd_system_rst, simple_dma_accelerator_device_exception_bus_data => open ); pd_system_clk <= clk; pd_system_rst <= rst; end architecture Behavioral;However when I tried (a few things) to run the software companion produced by oneAPI I got:
tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/niosv/kernels/simple_dma/build$ ./simple_dma.fpga Running on device: SimulatorDevice : Multi-process Simulator (aclmsim0) terminate called after throwing an instance of 'sycl::_V1::runtime_error' tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/niosv/kernels/simple_dma/build$ tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/niosv/kernels/simple_dma/build$ sudo ./simple_dma.fpga [sudo] password for tetto: ./simple_dma.fpga: error while loading shared libraries: libdspba_mpir.so.23: cannot open shared object file: No such file or directory tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/niosv/kernels/simple_dma/build$ sudo LD_LIBRARY_PATH=$LD_LIBRARY_PATH ./simple_dma.fpga terminate called after throwing an instance of 'sycl::_V1::runtime_error' what(): No device of requested type available. Please check https://software.intel.com/content/www/us/en/develop/articles/intel-oneapi-dpcpp-system-requirements.html -1 (PI_ERROR_DEVICE_NOT_FOUND) Aborted tetto@ubuntuoffice:~/oneAPI-samples/DirectProgramming/C++SYCL_FPGA/ReferenceDesigns/niosv/kernels/simple_dma/build$Coming back to this example, I was also playing with:
oneAPI seems to produce a quartus project completed with the top node (that I can compile and synthesize), but again when I run the executable I encounter a runtime error. In that vector_add.src it seems this "unified memory" would just do the job, but I recall you mentioned earlier one has to edit the RTL design (although in this part3 the top node seems properly generated and needed IPs/avalon devices are there and instantiated).
- whitepau_altera2 years ago
Contributor
Stefano, let me refer you once again to this comment: https://community.intel.com/t5/Intel-High-Level-Design/oneAPI-on-Cyclone10gx/m-p/1573813/highlight/true#M3497
The code you got from the code sample is the dark green boxes in this picture (Host code and Application Kernel). without all the other stuff in the middle, that generated executable file will not work.
The executable that oneAPI emits will not work without a supported BSP. Since you have selected -Xstarget=Cyclon10GX, you have created an IP, which is just the Application Kernel in that picture. This means that when you use the Application Kernel, it is treated like any other IP that was written using Verilog or VHDL.
To 'run' your IP, you will need to program the Nios-based design you created onto your board and execute Nios code to control the IP.oneAPI seems to produce a quartus project completed with the top node (that I can compile and synthesize), but again when I run the executable I encounter a runtime error. In that vector_add.src it seems this "unified memory" would just do the job, but I recall you mentioned earlier one has to edit the RTL design (although in this part3 the top node seems properly generated and needed IPs/avalon devices are there and instantiated).
That generated Intel® Quartus® Prime project is only for estimating fMAX of your IP. The point of it is to assign the pins of the IP to virtual pins so that Intel® Quartus® Prime will place and route it without actually connecting it to physical pins. Here is an explanation of virtual pin assignments https://www.youtube.com/watch?v=QET0lC-jdAQ
If you wish to build a custom BSP so that you can install your C10GX PCIe card into a computer and communicate with it through the OpenCL runtime (and have oneAPI host code control it), we have guidance on custom BSP creation here:
Getting started : https://ofs.github.io/latest/hw/common/user_guides/oneapi_asp/ug_oneapi_asp/
Reference Manual: https://ofs.github.io/latest/hw/common/reference_manual/oneapi_asp/oneapi_asp_ref_mnl/