OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [perl_gui/] [lib/] [tcl/] [mem.tcl] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 alirezamon
#!/usr/bin/tclsh
2
 
3
## Setup USB hardware - assumes only USB Blaster is installed and
4
## an FPGA is the only device in the JTAG chain
5
 
6
 
7
set usb [lindex [get_hardware_names] 0]
8
set device_name [lindex [get_device_names -hardware_name $usb] 0]
9
 
10
 
11
 
12
proc hold_reset {} {
13
 
14
        global device_name usb
15
        start_insystem_source_probe -device_name $device_name -hardware_name $usb
16
        write_source_data -instance_index 127 -value 0x1 -value_in_hex
17
        end_insystem_source_probe
18
}
19
 
20
proc release_reset {} {
21
 
22
        global device_name usb
23
        start_insystem_source_probe -device_name $device_name -hardware_name $usb
24
        write_source_data -instance_index 127 -value 0x0 -value_in_hex
25
        end_insystem_source_probe
26
}
27
 
28
 
29
 
30
 
31
 
32
proc update_memory { mem_name  mem_word_addr mem_content } {
33
        global device_name usb
34
 
35
        foreach instance [get_editable_mem_instances -hardware_name $usb -device_name $device_name] {
36
                set inst_name   [lindex $instance 5]
37
                set inst_index  [lindex $instance 0]
38
                #puts $inst_name 
39
                #puts $inst_index
40
                #set xx [string range  $inst_name 0 1]
41
                #set yy [string range  $inst_name 2 end]
42
                #puts $xx
43
                #puts $yy
44
                if { $inst_name eq $mem_name } {
45
                        write_content_to_memory -instance_index $inst_index -start_address $mem_word_addr -word_count 1 -content $mem_content -content_in_hex
46
                        puts "memory ${inst_name} is programed with  $mem_content value"
47
                }
48
 
49
        }
50
 
51
 
52
}
53
 
54
 
55
 
56
 
57
 
58
 
59
if { [lindex $::argv 0] eq "reset" } {
60
        hold_reset
61
        puts "reset the system!\n"
62
 
63
} elseif { [lindex $::argv 0] eq "unreset" } {
64
        release_reset
65
        puts "unreset the system!\n"
66
 
67
}  elseif { $::argc > 0 } {
68
 
69
                puts $usb
70
                puts $device_name
71
                # Initiate a editing sequence
72
                begin_memory_edit -hardware_name $usb -device_name $device_name
73
 
74
                set write_num  $::argc
75
                for {set i 0} {$i < $write_num} {incr i 3 } {
76
                        set mem_name [lindex $::argv $i]
77
                        set mem_word_addr  [lindex $::argv $i+1]
78
                        set mem_content  [lindex $::argv $i+2]
79
                        update_memory   $mem_name $mem_word_addr $mem_content
80
                }
81
                # End of editing sequence
82
                end_memory_edit
83
 
84
 
85
} else {
86
    puts "no command line argument passed"
87
}
88
 
89
 
90
 
91
 
92
 
93
 
94
 
95
 
96
 
97
 
98
 
99
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.