Commit 860b1594 authored by Andrey Filippov's avatar Andrey Filippov

minor fixes

parent 05a118d9
...@@ -15,6 +15,11 @@ from __future__ import print_function ...@@ -15,6 +15,11 @@ from __future__ import print_function
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>. # along with this program. If not, see <http:#www.gnu.org/licenses/>.
@brief: Provides sockets-related functionality for both the simulation server
and tghe client. Server is linked to the Cocotb and custom modules and controls
the simulation, server is used to replace memory read/write functionality in the
target system
@author: Andrey Filippov @author: Andrey Filippov
@copyright: 2016 Elphel, Inc. @copyright: 2016 Elphel, Inc.
@license: GPLv3.0+ @license: GPLv3.0+
...@@ -97,19 +102,13 @@ class x393Client(): ...@@ -97,19 +102,13 @@ class x393Client():
def write(self, address, data): def write(self, address, data):
self.cmd.setWrite([address,data]) self.cmd.setWrite([address,data])
rslt = self.communicate(self.cmd.toJSON()) rslt = self.communicate(self.cmd.toJSON())
# print("write->",rslt)
def waitIrq(self, irqMask,wait_ns): def waitIrq(self, irqMask,wait_ns):
self.cmd.setWait([irqMask,wait_ns]) self.cmd.setWait([irqMask,wait_ns])
rslt = self.communicate(self.cmd.toJSON()) rslt = self.communicate(self.cmd.toJSON())
# print("waitIrq->",rslt)
def flush(self): def flush(self):
self.cmd.setFlush() self.cmd.setFlush()
# print("flush->",self.communicate(self.cmd.toJSON()))
def read(self, address): def read(self, address):
self.cmd.setRead(address) self.cmd.setRead(address)
# print("read->args",self.cmd.getArgs())
rslt = self.communicate(self.cmd.toJSON()) rslt = self.communicate(self.cmd.toJSON())
#print("read->",rslt)
return json.loads(rslt) return json.loads(rslt)
...@@ -15,6 +15,9 @@ from __future__ import print_function ...@@ -15,6 +15,9 @@ from __future__ import print_function
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>. # along with this program. If not, see <http:#www.gnu.org/licenses/>.
@brief: Simulation server for x393_dut.v top Verilog module.
Listens to the socket connection, accepts incoming commands, applies them
to the simulator and sends back data from the model.
@author: Andrey Filippov @author: Andrey Filippov
@copyright: 2016 Elphel, Inc. @copyright: 2016 Elphel, Inc.
@license: GPLv3.0+ @license: GPLv3.0+
......
This diff is collapsed.
...@@ -17,10 +17,11 @@ from __future__ import print_function ...@@ -17,10 +17,11 @@ from __future__ import print_function
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>. # along with this program. If not, see <http:#www.gnu.org/licenses/>.
@author: Andrey Filippov @brief I/O Interfaces of the x393 project for simulation using cocotb
@copyright: 2016 Elphel, Inc. @author Andrey Filippov
@license: GPLv3.0+ @copyright 2016 Elphel, Inc.
@contact: andrey@elphel.coml @license GPLv3.0+
@contact andrey@elphel.coml
Uses code from https://github.com/potentialventures/cocotb/blob/master/cocotb/drivers/amba.py Uses code from https://github.com/potentialventures/cocotb/blob/master/cocotb/drivers/amba.py
Below are the copyright/license notices of the amba.py Below are the copyright/license notices of the amba.py
......
...@@ -80,7 +80,7 @@ class X393Mem(object): ...@@ -80,7 +80,7 @@ class X393Mem(object):
try: try:
X393_CLIENT.start() X393_CLIENT.start()
except: except:
print ("Failed to communicate to the server. Is it started? Swithching to dry tun mode") print ("Failed to communicate to the server. Is it started? Switching to dry run mode")
X393_CLIENT = True X393_CLIENT = True
...@@ -170,7 +170,6 @@ class X393Mem(object): ...@@ -170,7 +170,6 @@ class X393Mem(object):
@param quiet - reduce output @param quiet - reduce output
""" """
if X393_CLIENT is True: if X393_CLIENT is True:
# if self.DRY_MODE:
print ("simulated: write_mem(0x%x,0x%x)"%(addr,data)) print ("simulated: write_mem(0x%x,0x%x)"%(addr,data))
return return
elif not X393_CLIENT is None: elif not X393_CLIENT is None:
...@@ -184,23 +183,11 @@ class X393Mem(object): ...@@ -184,23 +183,11 @@ class X393Mem(object):
page_addr=addr & (~(self.PAGE_SIZE-1)) page_addr=addr & (~(self.PAGE_SIZE-1))
page_offs=addr-page_addr page_offs=addr-page_addr
mm = self.wrap_mm(f, page_addr) mm = self.wrap_mm(f, page_addr)
# if (page_addr>=0x80000000):
# page_addr-= (1<<32)
# mm = mmap.mmap(f.fileno(), self.PAGE_SIZE, offset=page_addr)
packedData=struct.pack(self.ENDIAN+"L",data) packedData=struct.pack(self.ENDIAN+"L",data)
d=struct.unpack(self.ENDIAN+"L",packedData)[0] d=struct.unpack(self.ENDIAN+"L",packedData)[0]
mm[page_offs:page_offs+4]=packedData mm[page_offs:page_offs+4]=packedData
if quiet <2: if quiet <2:
print ("0x%08x <== 0x%08x (%d)"%(addr,d,d)) print ("0x%08x <== 0x%08x (%d)"%(addr,d,d))
'''
if MONITOR_EMIO and VEBOSE:
gpio0=read_mem (0xe000a068)
gpio1=read_mem (0xe000a06c)
print("GPIO: %04x %04x %04x %04x"%(gpio1>>16, gpio1 & 0xffff, gpio0>>16, gpio0 & 0xffff))
if ((gpio0 & 0xc) != 0xc) or ((gpio0 & 0xff00) != 0):
print("******** AXI STUCK ************")
exit (0)
'''
def read_mem (self,addr,quiet=1): def read_mem (self,addr,quiet=1):
''' '''
......
...@@ -104,7 +104,7 @@ WARN_LOGFILE = log.txt ...@@ -104,7 +104,7 @@ WARN_LOGFILE = log.txt
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the input files # Configuration options related to the input files
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = . axi compressor_jp dsp includes logger memctrl sensor simulation_modules timing util_modules wrap x393_sata py393 helpers INPUT = . axi compressor_jp dsp includes logger memctrl sensor simulation_modules timing util_modules wrap x393_sata helpers
INPUT_ENCODING = UTF-8 INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.v *.vh *.ucf *.qsf *.tcl *.py FILE_PATTERNS = *.v *.vh *.ucf *.qsf *.tcl *.py
......
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