# Configurer l'encodage en UTF-8 pour supporter les caractères spéciaux encoding system utf-8 # Section 1: Identify Programming Hardware puts "Debug: Checking for available programming hardware..." set hardware_list [get_hardware_names] set usbblaster_name "" foreach hardware_name $hardware_list { puts "Debug: Found hardware: $hardware_name" if {[string match "DE-SoC*" $hardware_name]} { set usbblaster_name $hardware_name break } } # Error handling: Check if matching hardware was found if {$usbblaster_name == ""} { error "Error: No matching hardware found. Please ensure 'DE-SoC*' hardware is connected." } puts "Debug: Selected JTAG chain connected to $usbblaster_name." # Section 2: Identify Devices on JTAG Chain puts "Debug: Checking for devices on the JTAG chain..." set device_list [get_device_names -hardware_name $usbblaster_name] set test_device "" foreach device_name $device_list { puts "Debug: Found device: $device_name" if {[string match "@1*" $device_name]} { set test_device $device_name break } } # Error handling: Check if a device was found if {$test_device == ""} { error "Error: No devices found on JTAG chain for $usbblaster_name." } puts "Debug: Selected device: $test_device." # Section 3: Open the Selected Device puts "Debug: Opening device $test_device on $usbblaster_name..." open_device -hardware_name $usbblaster_name -device_name $test_device puts "Debug: Device $test_device opened successfully." # Section 4: Lock the Device puts "Debug: Locking the device for exclusive communication..." device_lock -timeout 10000 ; # Timeout set to 10 seconds (10000 milliseconds) puts "Debug: Device locked successfully." # Section 5: Read Data from FPGA Memory puts "Debug: Reading data from FPGA memory..." set memory_address 0x00000000 ; # Example memory address (replace with your actual address) # Read data from FPGA memory using JTAG # Correct usage of device_dr_shift # Note: You need to replace with the actual length of the data register set dr_length 32 ; # Example length in bits (replace with actual length) # Example: Read a 32-bit word from the data register # Ensure dr_value is a 32-bit binary string to match the length puts "Debug: Performing device_dr_shift operation..." set data_from_fpga "" catch { set data_from_fpga [device_dr_shift -dr_value "00000000000000000000000000000000" -length $dr_length] } result # Error handling: Check if data was read successfully if {$data_from_fpga == ""} { error "Error: Failed to read data from FPGA memory. Result: $result" } else { puts "Debug: Data read from FPGA at address $memory_address: $data_from_fpga" } # Section 6: Unlock the Device puts "Debug: Unlocking the device..." device_unlock puts "Debug: Device unlocked successfully." # Section 7: Close the Device puts "Debug: Closing device $test_device..." close_device puts "Debug: Device closed successfully. Execution complete."