-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added gvsoc script to handle verify step
- Loading branch information
Germain Haugou
committed
Jan 22, 2025
1 parent
8c60065
commit 142cef2
Showing
4 changed files
with
104 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import time | ||
import gvsoc.gvsoc_control | ||
import threading | ||
import socket | ||
import struct | ||
|
||
def parse_args(parser, args): | ||
parser.add_argument('--ipc', type=str, | ||
help="IPC socket files") | ||
|
||
def handle_commands(gv, tx_fd, rx_fd): | ||
|
||
axi = gvsoc.gvsoc_control.Router(gv, path='**/chip/soc/narrow_axi') | ||
|
||
gv.run() | ||
|
||
while True: | ||
data = rx_fd.read(8) | ||
if not data: | ||
return | ||
|
||
command = struct.unpack('=Q', data)[0] | ||
|
||
if command == 2: | ||
data = rx_fd.read(16) | ||
addr, mask32, exp32 = struct.unpack('=QLL', data) | ||
|
||
retval = gv.join() | ||
data = struct.pack('=L', retval) | ||
tx_fd.write(data) | ||
|
||
elif command == 0: | ||
data = rx_fd.read(16) | ||
addr, length = struct.unpack('=QQ', data) | ||
data = axi.mem_read(addr, length) | ||
tx_fd.write(data) | ||
|
||
elif command == 1: | ||
data = rx_fd.read(16) | ||
addr, length = struct.unpack('=QQ', data) | ||
data = rx_fd.read(length) | ||
axi.mem_write(addr, data) | ||
data = struct.pack('=L', 0) | ||
tx_fd.write(data) | ||
pass | ||
|
||
def target_control(args, gv=None): | ||
rx, tx = args.ipc.split(',') | ||
|
||
rx_fd = open(rx, 'rb', buffering=0) | ||
tx_fd = open(tx, 'wb', buffering=0) | ||
|
||
handle_commands(gv, tx_fd, rx_fd) | ||
|
||
return 0 |