File: sample_stream_tb.do

package info (click to toggle)
bladerf 0.2022.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 373,752 kB
  • sloc: ansic: 1,186,428; xml: 150,799; vhdl: 24,182; tcl: 15,408; python: 3,409; sh: 1,551; makefile: 1,255; asm: 158; csh: 18; cpp: 9
file content (68 lines) | stat: -rw-r--r-- 1,563 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Start dir
set start_dir [pwd]

# Make sim dir and cd into it
set simdir sample_stream_tb
file mkdir ${simdir}
cd ${simdir}

# Platform settings
set platform "bladerf-micro"

if { ${platform} == "bladerf" } {
    set NUM_MIMO_STREAMS          1
    set FIFO_READER_READ_THROTTLE 1
} elseif { ${platform} == "bladerf-micro" } {
    set NUM_MIMO_STREAMS          2
    set FIFO_READER_READ_THROTTLE 0
} else {
    error "Unknown platform: ${platform}"
}

# Add signals to waveform viewer
proc addwaves { } {
    if { [batch_mode] == 0 } {
        add wave -divider "FIFO WRITER"
        add wave -hexadecimal  sim:/sample_stream_tb/U_fifo_writer/*
        add wave -divider "FIFO READER"
        add wave -hexadecimal  sim:/sample_stream_tb/U_fifo_reader/*
    } else {
        # Command-line mode, log everything to a file
        log -r *
    }
}

# Prettify the wave pane
proc prettify { } {
    if { [batch_mode] == 0 } {
        wave zoom full
        configure wave -namecolwidth     400 -valuecolwidth   150
        configure wave -waveselectenable 1   -waveselectcolor grey20
    }
}

# Post-simulation cleanup tasks
proc cleanup { } {
    global start_dir
    if { [batch_mode] == 1 } {
        quit -sim
        cd ${start_dir}
        quit
    }
}

# Load common functions
do ../nuand.do

# Compile HDL
compile_nuand ../ ${platform}

# Elaborate design
vsim -GNUM_MIMO_STREAMS=${NUM_MIMO_STREAMS} \
    -GFIFO_READER_READ_THROTTLE=${FIFO_READER_READ_THROTTLE} \
    nuand.sample_stream_tb

addwaves
run 4 ms; # May run longer if needed
prettify
cleanup