NOTE: This tool is deprecated! We moved from Node.js to Python for better cross-platform support. Please refer to GitHub - webfpga/cli: Official WebFPGA Command-line Utility for the new tool!
Hi all,
I’m going to briefly describe how to flash the device using our command-line flasher in conjunction with cloud-synthesis or a local IceStorm installation. (You can also use the flasher tool with the official iCECube IDE). This tutorial should work for any operating system that supports Node.js and npm.
First, you need to ensure that Node.js and npm are installed. On Debian systems, you can run sudo apt get install nodejs
.
Then you need to install the webfpga utility with npm install -g webfpga-cli
. Once you have that tool installed, can view the usage by simply typing in webfpga
into your commannd-line prompt.
$ webfpga
Usage: webfpga [options] [command]
Options:
-V, --version output the version number
-h, --help output usage information
Commands:
synth <top.v> [others...] synthesize one or more verilog source files
flash <bitstream.bin> flash webfpga device
help [cmd] display help for [cmd]
Cloud Synthesis + Flashing
# blinky.v
module fpga_top(output reg WF_LED, input wire WF_CLK);
reg [24:0] counter;
// blink LED every 1000 ms
always @ (posedge WF_CLK) begin
if (counter == 8000000) begin
WF_LED <= ~WF_LED;
counter <= 'b0;
end else begin
counter <= counter + 'b1;
end
end
endmodule
$ webfpga synth blinky.v
Synthesizing source files:
- blinky.v
{ id:
'20a2cf13aea4c148a68877788727df962b4e86c4c91ce2f6cda84cc556b5d87b',
cached: false }
Subscribed to stream: 20a2cf13aea4c148a68877788727df962b4e86c4c91ce2f6cda84cc556b5d87b
synthesis-engine has received the request...
Saving blinky.v...
Synthesizing...
Detected modules for file '/tmp/synthesis_worker.2f4137ba-1373-4cdc-ba0b-5c5797455511.20190811-19-17e4xy0/blinky.v':
found the top-level module
====> fpga_top (file /tmp/synthesis_worker.2f4137ba-1373-4cdc-ba0b-5c5797455511.20190811-19-17e4xy0/blinky.v) <====
{
"top_level": "fpga_top",
"io_map": {},
"top_level_found": true,
"error": false,
"pcf_contents": "set_io WF_LED 31nset_io WF_CLK 35nset_io WF_BUTTON 42nset_io WF_NEO 32nset_io WF_CPU1 11nset_io WF_CPU2 12nset_io WF_CPU3 13nset_io WF_CPU4 10n"
}
Top level verilog module is fpga_top.
Synthesis:Verilog to EDIF: LUT4s:32( 0.61%)
FLOPs:24( 0.45%)
IOs :2( 5.13%)
CLOCK:1.000 FREQ: MHz
target: 24 MHz
EDIF Parser: Successful.
PLACER:Run time up to 2:00 minutes. Compute intensive.
5280
Placement of Design: LUT4s:32( 0.61%)
FLOPs:24( 0.45%)
IOs: 2( 5.13%)
CLOCK:fpga_top|WF_CLK FREQ: 114.12 MHz
target: 1.00 MHz
Packer: DRC check was successful. Now doing packing.
Packer: Packing was successful. Logic cells used: 32
Routing of Design: Successful. Nets:57 Iterations:2.
Writing of Design Netlist: Successful.
Static Timing of Design:
Timing completed. See timing report file.
Clock: fpga_top|WF_CLK | Frequency: 82.16 MHz | Target: 1.00 MHz |
Bit File Generation: Successful.
header : E+Sun 11 Aug 2019 09:21:13 PM UTC+shastaplus
header2 : E+Sun_11_Aug_2019_09:21:13_PM_UTC+shastaplus
synthesis complete!
(By default, the tool saves the bitstream as bitstream.bin
, but you can set a custom output filename with the -o
flag.)
$ webfpga flash bitstream.bin
Connected to board.
Cascadia WebUSB FPGA Programmer - Auburn Ventures, LLC
Finding and checking for programmer...
--RECV AT: Hi (pass)
--RECV API: C_WEBUSB+ (pass)
--RECV APR: 000921 (pass)
Found programmer.
Checking for FPGA module and its flash configuration...
--RECV APWE: wren (pass)
--RECV AMQ: SA016WHEe (pass)
--RECV AMBE: DONE (pass)
--RECV AMQ: SA016WHEE (pass)
flashing module...
--RECV AMW: OK (pass)
....................|
....................|
..............
Done.
Offline IceStorm Synthesis + Flashing
This example repository will fade the on-board RGB LED.
This assumes that you have the IceStorm flow installed. You need yosys
, arachne-pnr
, and icepack
. Read the Makefile
for more details. You also need to have the NodeJS/npm installed to run the webfpga
CLI utility.
$ git clone https://github.com/webfpga/webfpga_icestorm_examples
$ cd webfpga_icestorm_examples
$ make
$ make flash