傅信豪
contribute by Shin-Hao, Fu
my goal is to analysis raytracer, and this project have already finished some fundamental work of how to support raytrace calculation. In raytracer, usually heavily involved dot product, cosine similarity calculation, and determinate whether a ray have intersection with a object, which may included circle sphere, cub… .
but it shows error
it says the memory is not enough to run this test
evaluate all testbench
evaluate one testbench result
we use Datapath_test.scala
as example, in Datapath_test.scala
it first initialize to test several functionality, each test module in will have answer and test function like testUnifiedIntersection
, which will use several hardware unit to achive the goal.
because some test will involve several hardware unit to generate result. object RaytracerGold
was writed inscala
, use sofeware-implement for testbench
validate the floating pointe operation corrrectness
validate the 33-bit floating point operation correctness. this type fp mainly use for calculation in the whole pipeline.
test quadsort/quadsortRec, which will use in unified datapath stage(10), if we want to judge a ray has intersection with boxes.
this is the main test of whole system, every feature test will initial this
Let's see gen_baseline_or_extended_datapath(extended)
the extended will determinate which length of
unifiedDatapath is the top level module for the ray tracer datapath.
Two type of wrapper, UnifiedDatapath_wrapper_16
and UnifiedDatapath_wrapper
.
according the document from https://github.com/purdue-aalp/raytracer/releases/tag/v1
This allows the Ray Tracer Datapath to be integrated into a larger datapath and propagate back pressure via its valid-ready interfaces. A drawback of this design is increased hardware overhead since each skid buffer contains two registers.
it says this design may cause overhead by adding extra registers, but it can guarantee the dataflow safe by "handshake mechanism"
after run testcase, which is write in scala, we can get the waveform result inraytracer/cached_verilator_backend
we can check the waveform
to make result clear according difference test, i adjust outdir
for UnifiedDatapath_wrapper.vcd.
enable 32 bit datapath. the test incuding euclidean, angular(a.k.a cosin similarity), ray_box_is_ intersection, ray triangle is intersection.
Sequentially feed 100 random testcase to each test .
enable only euclidean test 16bit datapath
overview the toolchain for chisel development.!
cited from Verification of Chisel Hardware Designs with ChiselVerify.
it shows that we can combin sim_main.cpp with our hardware implementation by transfering hardware desing to verilog with verilator, then compile to executeable file.
use
in Makefile
then use
Let's see run-verilator.sh
. it will execute VTop.exe, and take the hello.asmbin as input and other arguments to run.
run $ gtkwave dump.vcd
but it shows error with message below
it shows Chisel (5.0.0) was published against firtool version 1.40.0.
, it depends on firtool 1.40.0
follow chisel page && firtool 1.40.0 release page , download firrtl-bin-macos-11.tar.gz
According to you DevEnv chose the properly version, here i use macOS version
if success download and add to your env
go to project run make verilator
, define in Makefile
check verilog/verilator/obj_dir
Fix the permissions of the uploaded picture.
run make verilator_compile
then run make veriltor_run
if we want to visualize the datapath, first we need to convert Top module into fir format.
use diagrammer, a open source project that help developer transfer fir format into svg format, it depends on graphviz
we can see the input is send into the pipeline. But it still have error , try to find where gone wrong. the result shows all is false.
io_out_bits_output_triangle_hit == false
in raytracer, usually we dont need calculate all the ray in scene, so we need consider the position of camere
/ray
/object
, therefore, we need a cross operation to determin our camera coordinate. furthermore when calculate the reflection also need cross operation.
which can express as
its not much difference to dot product but project owner seem not deal with this.