File: build.tcl

package info (click to toggle)
bladerf 0.2017.12~rc1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 14,620 kB
  • sloc: ansic: 50,123; vhdl: 12,873; python: 1,062; tcl: 1,060; xml: 1,017; makefile: 657; sh: 589; csh: 18; cpp: 9
file content (147 lines) | stat: -rw-r--r-- 4,578 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
load_package flow
package require cmdline

set options {\
    { "size.arg" "40" "FPGA Size - 40 or 115" } \
    { "rev.arg" "" "Revision name" } \
    { "stp.arg" "" "SignalTap II File to use" } \
    { "force" "" "Force using SignalTap II" }
}

# Read the revision from the commandline
array set opts [::cmdline::getoptions quartus(args) $options]

proc print_revisions { } {
    project_open -force bladerf -revision base
    puts stderr "Revisions"
    puts stderr "---------"
    foreach $rev [get_project_revisions] {
        if { $rev == "base" } {
            continue
        }
        puts stderr "    $rev"
    }
    project_close
}

# Check to make sure the project exists
if { ![project_exists bladerf] } {
    puts stderr "ERROR: bladeRF project does not exist.  Please run:"
    puts stderr "  $ quartus_sh -t ../bladerf.tcl"
    exit 1
}

# Check to make sure the revison was used on the commandline.
# If it wasn't, print out the revisions available.
if { $opts(rev) == "" } {
    puts stderr "ERROR: Revision required to build\n"
    print_revisions
    exit 1
}

# Check to make sure the revision exists
if { ![revision_exists -project bladerf $opts(rev)] } {
    puts stderr "ERROR: No revision named $opts(rev) in bladeRF project\n"
    print_revisions
    exit 1
}

# Open the project with the specific revision
project_open -revision $opts(rev) bladerf

# Check the size of the FPGA
if { $opts(size) != 115 && $opts(size) != 40 } {
    puts stderr "ERROR: Size must be either 40 or 115, not $opts(size)"
    exit 1
}

# Add signaltap file
set forced_talkback 0
set enable_stp 0
if { $opts(stp) != "" } {
    if { ([get_user_option -name TALKBACK_ENABLED] == off || [get_user_option -name TALKBACK_ENABLED] == "") && $opts(force) } {
        puts "Enabling TalkBack to include SignalTap file"
        set_user_option -name TALKBACK_ENABLED on
        set forced_talkback 1
    }
    # SignalTap requires either TalkBack to be enabled or a non-Web Edition of Quartus (e.g. Standard, Pro)
    if { ([get_user_option -name TALKBACK_ENABLED] == on) || (![string match "*Web Edition*" $quartus(version)]) } {
        puts "Adding SignalTap file: [file normalize $opts(stp)]"
        set_global_assignment -name ENABLE_SIGNALTAP on
        set_global_assignment -name USE_SIGNALTAP_FILE [file normalize $opts(stp)]
        set_global_assignment -name SIGNALTAP_FILE [file normalize $opts(stp)]
        set enable_stp 1
    } else {
        puts stderr "\nERROR: Cannot add $opts(stp) to project without enabling TalkBack."
        puts stderr "         Use -force to enable and add SignalTap to project."
        exit 1
    }
} else {
    set_global_assignment -name ENABLE_SIGNALTAP off
}

set_global_assignment -name DEVICE EP4CE$opts(size)F23C8
set failed 0

# Save all the options
export_assignments
project_close

# The quartus_stp executable creates/edits a Quartus Setting File (.qsf)
# based on the SignalTap II File specified if enabled. It must be run
# successfully before running Analysis & Synthesis.
if { $enable_stp == 1 } {
    if { $failed == 0 && [catch {qexec "quartus_stp --stp_file [file normalize $opts(stp)] --enable bladerf --rev $opts(rev)"} result] } {
        puts "Result: $result"
        puts stderr "ERROR: Adding SignalTap settings to QSF failed."
        set failed 1
    }
}

# Open the project with the specific revision
project_open -revision $opts(rev) bladerf

# Run Analysis and Synthesis
if { $failed == 0 && [catch {execute_module -tool map} result] } {
    puts "Result: $result"
    puts stderr "ERROR: Analysis & Synthesis Failed"
    set failed 1
}

# Run Fitter
if { $failed == 0 && [catch {execute_module -tool fit} result ] } {
    puts "Result: $result"
    puts stderr "ERROR: Fitter failed"
    set failed 1
}

# Run Static Timing Analysis
if { $failed == 0 && [catch {execute_module -tool sta} result] } {
    puts "Result: $result"
    puts stderr "ERROR: Timing Analysis Failed!"
    set failed 1
}

# Run Assembler
if { $failed == 0 && [catch {execute_module -tool asm} result] } {
    puts "Result: $result"
    puts stderr "ERROR: Assembler Failed!"
    set failed 1
}

# Run EDA Output
#if { $failed == 0 && [catch {execute_module -tool eda} result] } {
#    puts "Result: $result"
#    puts stderr "ERROR: EDA failed!"
#    set failed 1
#} elseif { $failed == 0 } {
#    puts "INFO: EDA OK!"
#}

# If we were forced to turn on TALKBACK .. turn it back off
if { $forced_talkback == 1 } {
    puts "Disabling TalkBack back to original state"
    set_user_option -name TALKBACK_ENABLED off
}

project_close