-
Notifications
You must be signed in to change notification settings - Fork 0
/
hostapp_exmaple_ddr.py
executable file
·35 lines (29 loc) · 1.27 KB
/
hostapp_exmaple_ddr.py
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# Host application example using libficmgr
#------------------------------------------------------------------------------
import os
import sys, traceback
import libficmgr
#------------------------------------------------------------------------------
MK1_FPGA_BITSTREAM = '/home/hlab/nyacom/project/fic/ficmgr/mk1_ficbd_ddr4_20201017.bin'
SAMPLE_FILE = '/home/hlab/nyacom/project/fic/libfic2/1G'
#------------------------------------------------------------------------------
if __name__ == '__main__':
ficmgr = libficmgr.libficmgr()
# Configure target FPGA
print('TEST: Prog FPGA')
ficmgr.fic_prog('fic11', 'sm8', True, MK1_FPGA_BITSTREAM, "Host app example")
# Reset Start HLS
print('TEST: HLS reset start')
ficmgr.fic_hls_cmd('fic11', 'reset')
ficmgr.fic_hls_cmd('fic11', 'start')
# Read data file and transfer to DDR
print('TEST: DDR write')
with open(SAMPLE_FILE, 'rb') as f:
buf = f.read(1024*1024*10) # Read 10MB
ficmgr.fic_hls_ddr_write('fic11', buf, 0)
print('TEST: DDR read')
ret = ficmgr.fic_hls_ddr_read('fic11', 1024*1024*1, 0) # Readout 1MB
print(len(ret['data']))