FPGA システム・デバッグ・ツール "System Console" を使ってみよう - 半導体事業 - マクニカ
準備
・jtag masterが入ったqsysファイルを作る
・system consoleを立ち上げる
・sofをダウンロード
tclコンソール上でのコマンド
get_service_paths master set mpath [lindex [get_service_paths master] 0] claim_service master $mpath "" set master_path [claim_service master $mpath ""]
master_write_8 $master_path 0x00010 0x1F master_read_8 $master_path 0x00010 1
set mpath [lindex [get_service_paths master] 0]
*この番号は制御したいマスターの番号。
複数ある場合は変える必要があるかも。
pythonからsystem consoleをいじる
PythonからSystem Console経由でデバッグしてみた - Qiita
import subprocess system_console_path = '/eda/intel/20.2/quartus/sopc_builder/bin/system-console' class altera_system_console: def __init__(self): sc_path = [system_console_path, '--cli', '--disable_readline'] self.console = subprocess.Popen(sc_path, stdin=subprocess.PIPE, stdout=subprocess.PIPE) self.cmd_count = 1 self.read_output() def __del__(self): self.console.terminate() def read_output(self, print_flag=True): if self.cmd_count == 0: print('cmd_count is zero') return '' txt = '' while True: r = self.console.stdout.read(1) if r == b'%': self.console.stdout.read(1) if print_flag: print(txt) break txt += r.decode("utf8") self.cmd_count -= 1 return txt def cmd(self, cmd_string, print_flag=True): self.console.stdin.write(bytes(cmd_string + '\n', 'utf-8')) self.console.stdin.flush() self.cmd_count += 1 return self.read_output(print_flag) def write(self, addr, data, bits=32, print_flag=True): if not bits in [8, 16, 32]: print('bits is an invalid value') return self.cmd('master_write_{} $master_path 0x{:x} 0x{:x}'.format(bits, addr, data), print_flag=print_flag) def read(self, addr, length, bits=32, print_flag=True): if not bits in [8, 16, 32]: print('bits is an invalid value') self.cmd('master_read_{} $master_path 0x{:x} 0x{:x}'.format(bits, addr, length), print_flag=print_flag) c = altera_system_console()