Debian Codegraph @

hdl/fpga/ip/nuand/sample_stream_tb.do

raw
1 # Start dir
2 set start_dir [pwd]
3
4 # Make sim dir and cd into it
5 set simdir sample_stream_tb
6 file mkdir ${simdir}
7 cd ${simdir}
8
9 # Platform settings
10 set platform "bladerf-micro"
11
12 if { ${platform} == "bladerf" } {
13 set NUM_MIMO_STREAMS 1
14 set FIFO_READER_READ_THROTTLE 1
15 } elseif { ${platform} == "bladerf-micro" } {
16 set NUM_MIMO_STREAMS 2
17 set FIFO_READER_READ_THROTTLE 0
18 } else {
19 error "Unknown platform: ${platform}"
20 }
21
22 # Add signals to waveform viewer
23 proc addwaves { } {
24 if { [batch_mode] == 0 } {
25 add wave -divider "FIFO WRITER"
26 add wave -hexadecimal sim:/sample_stream_tb/U_fifo_writer/*
27 add wave -divider "FIFO READER"
28 add wave -hexadecimal sim:/sample_stream_tb/U_fifo_reader/*
29 } else {
30 # Command-line mode, log everything to a file
31 log -r *
32 }
33 }
34
35 # Prettify the wave pane
36 proc prettify { } {
37 if { [batch_mode] == 0 } {
38 wave zoom full
39 configure wave -namecolwidth 400 -valuecolwidth 150
40 configure wave -waveselectenable 1 -waveselectcolor grey20
41 }
42 }
43
44 # Post-simulation cleanup tasks
45 proc cleanup { } {
46 global start_dir
47 if { [batch_mode] == 1 } {
48 quit -sim
49 cd ${start_dir}
50 quit
51 }
52 }
53
54 # Load common functions
55 do ../nuand.do
56
57 # Compile HDL
58 compile_nuand ../ ${platform}
59
60 # Elaborate design
61 vsim -GNUM_MIMO_STREAMS=${NUM_MIMO_STREAMS} \
62 -GFIFO_READER_READ_THROTTLE=${FIFO_READER_READ_THROTTLE} \
63 nuand.sample_stream_tb
64
65 addwaves
66 run 4 ms; # May run longer if needed
67 prettify
68 cleanup