Skip to content

Commit eb69a3a

Browse files
committed
Added project archieving for Quartus post-flow script
1 parent 002db31 commit eb69a3a

File tree

1 file changed

+31
-12
lines changed

1 file changed

+31
-12
lines changed

scripts/post_flow_quartus.tcl

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,37 @@ set sof_dir "./OUTPUT/"
4848
set sof_arch_dir "./SOF_ARCHIEVE/"
4949
set sof_filename [join [list [lindex $argv 2] ".sof"] ""]
5050
set new_sof_filename [join [list [lindex $argv 2] "_v" [format %02x $ver_hi] [format %02x $ver_lo] ".sof"] ""]
51+
5152
if { [file exists ${sof_dir}${sof_filename}] } {
52-
if { [file exists $sof_arch_dir] } {
53+
if { [file exists ${sof_arch_dir}] } {
54+
if { [file exists ${sof_arch_dir}${new_sof_filename}] } {
5355
post_message "Copying existing .sof file to archieve directory"
5456
file copy ${sof_dir}${sof_filename} ${sof_arch_dir}
5557
post_message "Adding version identifier to archieved .sof file"
5658
file rename ${sof_arch_dir}${sof_filename} ${sof_arch_dir}${new_sof_filename}
59+
} else {
60+
post_message "Destination .sof file already exists. Copying to archieve cancelled"
61+
}
62+
}
63+
}
64+
65+
#===============================================================================
66+
# copying OUTPUT dir to archieve
67+
post_message "=== OUTPUT ARCHIEVE ================================================="
68+
set out_dir "./OUTPUT/"
69+
set out_arch_dir "./OUTPUT_ARCHIEVE/"
70+
set new_out_dirname [join [list "OUTPUT_v" [format %02x $ver_hi] [format %02x $ver_lo] ] ""]
71+
72+
if { [file exists ${out_dir}] } {
73+
if { [file exists ${out_arch_dir}] } {
74+
if { [file exists ${out_arch_dir}${new_out_dirname}] } {
75+
post_message "Destination OUTPUT archeive already exists. Copying to archieve cancelled"
76+
} else {
77+
post_message "Copying existing OUTPUT directory to archieve"
78+
exec cp -r ${out_dir} ${out_arch_dir}${new_out_dirname}
79+
}
5780
}
5881
}
59-
# if { [file exists ${sof_dir}${sof_filename}] } {
60-
# post_message "Adding version identifier to existing .sof file"
61-
# file rename ${sof_dir}${sof_filename} ${sof_dir}${new_sof_filename}
62-
# }
6382

6483
#===============================================================================
6584
# Set warning on implicit nets declaration
@@ -83,7 +102,7 @@ set hs_t 0
83102
set ms_t 0
84103
set ss_t 0
85104

86-
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".map.rpt"]
105+
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".map.rpt"] ""]
87106
if { [file exists $filename] } {
88107
set file [open $filename r]
89108
while {[gets $file line] != -1} {
@@ -100,7 +119,7 @@ if { [file exists $filename] } {
100119
}
101120

102121

103-
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".fit.rpt"]
122+
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".fit.rpt"] ""]
104123
if { [file exists $filename] } {
105124
set file [open $filename r]
106125
while {[gets $file line] != -1} {
@@ -116,7 +135,7 @@ if { [file exists $filename] } {
116135
close $file
117136
}
118137

119-
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".asm.rpt"]
138+
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".asm.rpt"] ""]
120139
if { [file exists $filename] } {
121140
set file [open $filename r]
122141
while {[gets $file line] != -1} {
@@ -133,9 +152,9 @@ if { [file exists $filename] } {
133152
}
134153

135154
# timequest execution time for newer versions of Quartus
136-
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".sta.rpt"]
155+
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".sta.rpt"] ""]
137156
if { [file exists $filename] } {
138-
set file [open $filename ""] r]
157+
set file [open $filename r]
139158
while {[gets $file line] != -1} {
140159
set time [string range $line 24 31]
141160
if {[string first "Info: Elapsed time:" $line] != -1} {
@@ -150,9 +169,9 @@ if { [file exists $filename] } {
150169
}
151170

152171
# classic timing analizer execution time for older versions of Quartus
153-
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".tan.rpt"]
172+
set filename [join [list "./OUTPUT/" [lindex $argv 2] ".tan.rpt"] ""]
154173
if { [file exists $filename] } {
155-
set file [open $filename ""] r]
174+
set file [open $filename r]
156175
while {[gets $file line] != -1} {
157176
set time [string range $line 24 31]
158177
if {[string first "Info: Elapsed time:" $line] != -1} {

0 commit comments

Comments
 (0)