Skip to content

๐Ÿ’พ fpga study with open source tools (on macos)

Notifications You must be signed in to change notification settings

buhe/study_fpga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

cc91541 ยท Jun 5, 2022

History

88 Commits
Jan 27, 2022
Jun 5, 2022
May 28, 2022
Feb 6, 2022
Feb 5, 2022
Feb 5, 2022
May 30, 2022
Jan 27, 2022
Jan 27, 2022

Repository files navigation

Fpga study with open source software (on macos)

Target

  • yosys: flash to hardware
  • add logic
  • blink: chisel to verilog
  • blink: use yosys flah to hardware
  • a clock: i2c
  • riscv64 cpu

Hardware

  • tang nano 4k
  • tang nano 9k

Resources

pip install -U apio

Simulate

Tools

brew install icarus-verilog
brew install --cask gtkwave

Execute

iverilog -o sample_tb.vvp sample_tb.v
vvp sample_tb.vvp

open -a gtkwave

โœ… Flash to fpga

brew install yosys
pip install apycula
brew install openfpgaloader --HEAD

# install nextpnr
brew install eigen
# https://github.com/YosysHQ/nextpnr#nextpnr-gowin
cmake . -DARCH=gowin
make -j$(nproc)
sudo make install

โœ… Verilog

yosys -D LEDS_NR=8 -p "read_verilog blinky.v; synth_gowin -json blinky.json"
nextpnr-gowin --json blinky.json --write pnrblinky.json --device GW1NSR-LV4CQN48PC6/I5 --cst tangnano4k.cst
gowin_pack -d GW1NSR-LV4CQN48PC6/I5 -o pack.fs pnrblinky.json
openFPGALoader -b tangnano4k pack.fs

video

Chisel

make led_v
yosys -p "synth_gowin -top Led -json blinky.json" output/Led.v

nextpnr-gowin --json blinky.json --write pnrblinky.json --device GW1NSR-LV4CQN48PC7/I6 --cst examples/tangnano4k.cst

gowin_pack -d GW1NSR-LV4CQN48PC7/I6 -o pack.fs pnrblinky.json

just need to specify how many LEDs your board has. For example for my TangNano with three LEDs:

yosys -D LEDS_NR=3 -p "synth_gowin -json blinky.json" blinky.v

so,9k is LEDS_NR=6,look up 9k.cst

About

๐Ÿ’พ fpga study with open source tools (on macos)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published