-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.tcl
101 lines (78 loc) · 3.55 KB
/
test.tcl
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
proc run_ariane {input_file {jtag_mem 0x40000000}} {
if {[file exists $input_file]} {
puts "The file $input_file exists."
} else {
exec sh make_hex_file.sh $input_file
}
# Read the input bit file and
# seperate the commands
set input [split [read [open $input_file r]] "\n"]
# count the lines ( #instructions of input file) and subtract the last line
global num_lines
set num_lines [expr {[llength $input] - 1}]
set num_lines_copy $num_lines
while {$num_lines_copy > 0} {
# Calculate the number of lines to process in this iteration
set lines_to_process [expr {$num_lines_copy > 256 ? 256 : $num_lines_copy}]
# Get the subset of lines to process in this iteration
set input_subset [lrange $input 0 [expr {$lines_to_process - 1}]]
set input_subset [lreverse $input_subset ]
# Process the lines in this iteration
set output [join $input_subset "_"]
# Update the variables for the next iteration
set input [lrange $input $lines_to_process end]
# create the axi transaction for the memory data that we will write
create_hw_axi_txn wr_txnm [get_hw_axis hw_axi_1] -type write -address $jtag_mem -data $output -len $lines_to_process -size 32
# write these data
run_hw_axi [get_hw_axi_txns wr_txnm]
delete_hw_axi_txn wr_txnm
puts "Output for iteration: $output"
puts "jtag_mem for iteration: $jtag_mem"
puts "num_lines_copy for iteration: $num_lines_copy"
# Increase jtag_mem
set increment_hex [format "0x%x" [expr {$lines_to_process * 4}]]
set jtag_mem [format "0x%08x" [expr {($jtag_mem) + $increment_hex}]]
set num_lines_copy [expr {$num_lines_copy - $lines_to_process}]
puts "increment_hex for iteration: $increment_hex"
}
# The base memory address for Ariane is 0x0000800000000000
# here we create 2 transactions (32 bit each) for writing the base address to Ariane core
# wr2 is the MSB, wr1 is the LSB
create_hw_axi_txn wr1 [get_hw_axis hw_axi_1] -type write -address 0x80002000 -data {80000000}
create_hw_axi_txn wr2 [get_hw_axis hw_axi_1] -type write -address 0x80002008 -data {00000000}
# write base address
run_hw_axi [get_hw_axi_txns wr1]
run_hw_axi [get_hw_axi_txns wr2]
set address 0x00010000
# Create transactions one for reset=1
create_hw_axi_txn wr_txn4 [get_hw_axis hw_axi_1] -type write -address $address -data {00000000}
# Run reset transactions (Reset Debug)
run_hw_axi [get_hw_axi_txns wr_txn4]
# set the address of ariane reset
set address 0x80000000
# Create 2 transactions one for reset=1 and one for reset=0
create_hw_axi_txn wr_txn1 [get_hw_axis hw_axi_1] -type write -address $address -data {00000001}
create_hw_axi_txn wr_txn3 [get_hw_axis hw_axi_1] -type write -address $address -data {00000000}
# Run reset transactions (Reset Ariane)
run_hw_axi [get_hw_axi_txns wr_txn3]
run_hw_axi [get_hw_axi_txns wr_txn1]
}
proc delete_ariane {{jtag_mem 0x40000000}} {
global num_lines
set num_lines_copy $num_lines
while {$num_lines_copy > 0} {
# Calculate the number of lines to process in this iteration
set lines_to_process [expr {$num_lines_copy > 256 ? 256 : $num_lines_copy}]
# Erase Ram data
set era [join [lrepeat $lines_to_process "00000000"] "_"]
create_hw_axi_txn wr_er [get_hw_axis hw_axi_1] -type write -address $jtag_mem -data $era -len $lines_to_process -size 32
# write these data
run_hw_axi [get_hw_axi_txns wr_er]
delete_hw_axi_txn wr_er
# Increase jtag_mem
set jtag_mem [expr { $jtag_mem + ($lines_to_process * 32) } ]
set num_lines_copy [expr {$num_lines_copy - $lines_to_process}]
}
# delete all transactions that were created
delete_hw_axi_txn [get_hw_axi_txns *]
}