Arthur BrownSam Kristoff
Published © MIT

Estimating Pi with the Monte Carlo Method

How much faster can an algorithm run in FPGA fabric than in a processor? It depends on the algorithm, but often, much, much, faster.

AdvancedShowcase (no instructions)8 hours1,662
Estimating Pi with the Monte Carlo Method

Things used in this project

Hardware components

Cora Z7-10
Digilent Cora Z7-10
This project can be recreated with either the Cora Z7-10 or the Z7-07S, both are not required,
×1
Cora Z7-07S
Digilent Cora Z7-07S
This project can be recreated with either the Cora Z7-10 or the Z7-07S, both are not required,
×1

Story

Read more

Code

addPiEstimators.tcl

Tcl
This is a script that can be called in Vivado to add as many instances of the AXI_PiEstimator to an existing block design as can fit on the board that the project targets.
startgroup
set dsp_per_inst 2
set board_part [get_property BOARD_PART [get_projects]]
set part_name [get_property PART_NAME [get_board_parts -filter "NAME==$board_part"]]
set dsp [get_property DSP [get_parts -filter "NAME==$part_name"]]
set num_instances [expr $dsp / $dsp_per_inst]

create_bd_cell -type module -reference AXI_PiEstimator_Control control
for {set i 0} {$i < $num_instances} {incr i} {
   create_bd_cell -type module -reference AXI_PiEstimator inst_$i
   connect_bd_net [get_bd_pins control/enable] [get_bd_pins inst_$i/enable]
}
endgroup

Cora Z7-10 Pi Estimator

Repository containing the Vivado project targeting the Cora Z7-10 that was used to benchmark the board. To clone this repo, use "git clone --recursive (URL)" in a command shell (git bash is recommended on Windows). Call "python3 git_vivado.py checkout" in the digilent_vivado_scripts subfolder in order to generate a usable Vivado project, which will be placed in the proj subfolder of the repo.

Cora Z7-07S Pi Estimator

Repository containing the Vivado project targeting the Cora Z7-07S that was used to benchmark the board. To clone this repo, use "git clone --recursive (URL)" in a command shell (git bash is recommended on Windows). Call "python3 git_vivado.py checkout" in the digilent_vivado_scripts subfolder in order to generate a usable Vivado project, which will be placed in the proj subfolder of the repo.

Credits

Arthur Brown

Arthur Brown

14 projects • 30 followers
Applications engineer and digital logic geek
Sam Kristoff

Sam Kristoff

35 projects • 53 followers
R&D Director at NI
Thanks to Arvin Tang.

Comments