Commit f92b8da3 authored by Andrey Filippov's avatar Andrey Filippov

more testing

parent 5fc79880
This diff is collapsed.
...@@ -84,11 +84,16 @@ class X393Utils(object): ...@@ -84,11 +84,16 @@ class X393Utils(object):
else: else:
for d in data: for d in data:
self.x393_mem.write_mem(FPGA_RST_CTRL,d) self.x393_mem.write_mem(FPGA_RST_CTRL,d)
def bitstream(self,bitfile=DEFAULT_BITFILE): def bitstream(self,
bitfile=None,
quiet=1):
""" """
Turn FPGA clock OFF, reset ON, load bitfile, turn clock ON and reset OFF Turn FPGA clock OFF, reset ON, load bitfile, turn clock ON and reset OFF
<bitfile> path to bitfile if provided, otherwise default bitfile will be used @param bitfile path to bitfile if provided, otherwise default bitfile will be used
@param quiet Reduce output
""" """
if bitfile is None:
bitfile=DEFAULT_BITFILE
print ("FPGA clock OFF") print ("FPGA clock OFF")
self.x393_mem.write_mem(FPGA0_THR_CTRL,1) self.x393_mem.write_mem(FPGA0_THR_CTRL,1)
print ("Reset ON") print ("Reset ON")
...@@ -104,10 +109,12 @@ class X393Utils(object): ...@@ -104,10 +109,12 @@ class X393Utils(object):
break break
dst.write(copy_buffer) dst.write(copy_buffer)
l+=len(copy_buffer) l+=len(copy_buffer)
if quiet < 4 :
print("sent %d bytes to FPGA"%l) print("sent %d bytes to FPGA"%l)
print("Loaded %d bytes to FPGA"%l) print("Loaded %d bytes to FPGA"%l)
# call(("cat",bitfile,">"+FPGA_LOAD_BITSTREAM)) # call(("cat",bitfile,">"+FPGA_LOAD_BITSTREAM))
if quiet < 4 :
print("Wait for DONE") print("Wait for DONE")
if not self.DRY_MODE: if not self.DRY_MODE:
for _ in range(100): for _ in range(100):
...@@ -117,8 +124,10 @@ class X393Utils(object): ...@@ -117,8 +124,10 @@ class X393Utils(object):
else: else:
print("Timeout waiting for DONE, [0x%x]=0x%x"%(INT_STS,self.x393_mem.read_mem(INT_STS))) print("Timeout waiting for DONE, [0x%x]=0x%x"%(INT_STS,self.x393_mem.read_mem(INT_STS)))
return return
if quiet < 4 :
print ("FPGA clock ON") print ("FPGA clock ON")
self.x393_mem.write_mem(FPGA0_THR_CTRL,0) self.x393_mem.write_mem(FPGA0_THR_CTRL,0)
if quiet < 4 :
print ("Reset OFF") print ("Reset OFF")
self.reset(0xa) self.reset(0xa)
self.x393_axi_tasks.init_state() self.x393_axi_tasks.init_state()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment