Commit 98b0786f authored by Andrey Filippov's avatar Andrey Filippov

Cleaned up after changes in VDT

parent 5210ad53
...@@ -2,11 +2,14 @@ cocotb_@_COCOTB_DEBUG=true ...@@ -2,11 +2,14 @@ cocotb_@_COCOTB_DEBUG=true
cocotb_@_CocotbDutTopFile=cocotb/x393_dut.v cocotb_@_CocotbDutTopFile=cocotb/x393_dut.v
cocotb_@_CocotbExtraFiles=glbl.v<-@\#\#@-> cocotb_@_CocotbExtraFiles=glbl.v<-@\#\#@->
cocotb_@_CocotbIncludeDir=${verilog_project_loc}/includes<-@\#\#@->${verilog_project_loc}/ddr3<-@\#\#@->${verilog_project_loc}/x393_sata<-@\#\#@->${verilog_project_loc}/x393_sata/host<-@\#\#@-> cocotb_@_CocotbIncludeDir=${verilog_project_loc}/includes<-@\#\#@->${verilog_project_loc}/ddr3<-@\#\#@->${verilog_project_loc}/x393_sata<-@\#\#@->${verilog_project_loc}/x393_sata/host<-@\#\#@->
cocotb_@_CocotbMODULE=x393coco_03<-@\#\#@-> cocotb_@_CocotbMODULE=x393_cocotb_server<-@\#\#@->
cocotb_@_CocotbTESTCASE=run_test<-@\#\#@-> cocotb_@_CocotbTESTCASE=run_test<-@\#\#@->
cocotb_@_GTKWaveSavFile=x393_cocotb_02.sav cocotb_@_GTKWaveSavFile=x393_cocotb_02.sav
cocotb_@_GrepFindErrWarn=error|warning cocotb_@_GrepFindErr=error|ERROR
cocotb_@_ShowWarnings=false cocotb_@_GrepFindErrWarn=error|warning|ERROR|WARNING
com.elphel.store.context.cocotb=cocotb_@_CocotbExtraFiles<-@\#\#@->cocotb_@_CocotbMODULE<-@\#\#@->cocotb_@_GTKWaveSavFile<-@\#\#@->cocotb_@_CocotbIncludeDir<-@\#\#@->cocotb_@_CocotbDutTopFile<-@\#\#@->cocotb_@_CocotbTESTCASE<-@\#\#@->cocotb_@_ShowWarnings<-@\#\#@->cocotb_@_GrepFindErrWarn<-@\#\#@->cocotb_@_COCOTB_DEBUG<-@\#\#@-> cocotb_@_PatternInfo=.*[\\s.](\\w*\\.py)\:([0-9]+)\\s*\\S*\\s*\\S*\\s*(.*)
cocotb_@_SaveLogsPreprocessor=true
cocotb_@_SaveLogsSimulator=true
com.elphel.store.context.cocotb=cocotb_@_CocotbExtraFiles<-@\#\#@->cocotb_@_CocotbMODULE<-@\#\#@->cocotb_@_GTKWaveSavFile<-@\#\#@->cocotb_@_CocotbIncludeDir<-@\#\#@->cocotb_@_CocotbDutTopFile<-@\#\#@->cocotb_@_CocotbTESTCASE<-@\#\#@->cocotb_@_GrepFindErrWarn<-@\#\#@->cocotb_@_COCOTB_DEBUG<-@\#\#@->cocotb_@_SaveLogsPreprocessor<-@\#\#@->cocotb_@_SaveLogsSimulator<-@\#\#@->cocotb_@_GrepFindErr<-@\#\#@->cocotb_@_PatternInfo<-@\#\#@->
com.elphel.store.version.cocotb=0.8 com.elphel.store.version.cocotb=0.8
eclipse.preferences.version=1 eclipse.preferences.version=1
...@@ -2,11 +2,14 @@ cocotb_@_COCOTB_DEBUG=true ...@@ -2,11 +2,14 @@ cocotb_@_COCOTB_DEBUG=true
cocotb_@_CocotbDutTopFile=cocotb/x393_dut.v cocotb_@_CocotbDutTopFile=cocotb/x393_dut.v
cocotb_@_CocotbExtraFiles=glbl.v<-@\#\#@-> cocotb_@_CocotbExtraFiles=glbl.v<-@\#\#@->
cocotb_@_CocotbIncludeDir=${verilog_project_loc}/includes<-@\#\#@->${verilog_project_loc}/ddr3<-@\#\#@->${verilog_project_loc}/x393_sata<-@\#\#@->${verilog_project_loc}/x393_sata/host<-@\#\#@-> cocotb_@_CocotbIncludeDir=${verilog_project_loc}/includes<-@\#\#@->${verilog_project_loc}/ddr3<-@\#\#@->${verilog_project_loc}/x393_sata<-@\#\#@->${verilog_project_loc}/x393_sata/host<-@\#\#@->
cocotb_@_CocotbMODULE=x393coco_03<-@\#\#@-> cocotb_@_CocotbMODULE=x393_cocotb_server<-@\#\#@->
cocotb_@_CocotbTESTCASE=run_test<-@\#\#@-> cocotb_@_CocotbTESTCASE=run_test<-@\#\#@->
cocotb_@_GTKWaveSavFile=x393_cocotb_02.sav cocotb_@_GTKWaveSavFile=x393_cocotb_02.sav
cocotb_@_GrepFindErrWarn=error|warning cocotb_@_GrepFindErr=error|ERROR
cocotb_@_ShowWarnings=false cocotb_@_GrepFindErrWarn=error|warning|ERROR|WARNING
com.elphel.store.context.cocotb=cocotb_@_CocotbExtraFiles<-@\#\#@->cocotb_@_CocotbMODULE<-@\#\#@->cocotb_@_GTKWaveSavFile<-@\#\#@->cocotb_@_CocotbIncludeDir<-@\#\#@->cocotb_@_CocotbDutTopFile<-@\#\#@->cocotb_@_CocotbTESTCASE<-@\#\#@->cocotb_@_ShowWarnings<-@\#\#@->cocotb_@_GrepFindErrWarn<-@\#\#@->cocotb_@_COCOTB_DEBUG<-@\#\#@-> cocotb_@_PatternInfo=.*[\\s.](\\w*\\.py)\:([0-9]+)\\s*\\S*\\s*\\S*\\s*(.*)
cocotb_@_SaveLogsPreprocessor=true
cocotb_@_SaveLogsSimulator=true
com.elphel.store.context.cocotb=cocotb_@_CocotbExtraFiles<-@\#\#@->cocotb_@_CocotbMODULE<-@\#\#@->cocotb_@_GTKWaveSavFile<-@\#\#@->cocotb_@_CocotbIncludeDir<-@\#\#@->cocotb_@_CocotbDutTopFile<-@\#\#@->cocotb_@_CocotbTESTCASE<-@\#\#@->cocotb_@_GrepFindErrWarn<-@\#\#@->cocotb_@_COCOTB_DEBUG<-@\#\#@->cocotb_@_SaveLogsPreprocessor<-@\#\#@->cocotb_@_SaveLogsSimulator<-@\#\#@->cocotb_@_GrepFindErr<-@\#\#@->cocotb_@_PatternInfo<-@\#\#@->
com.elphel.store.version.cocotb=0.8 com.elphel.store.version.cocotb=0.8
eclipse.preferences.version=1 eclipse.preferences.version=1
[*]
[*] GTKWave Analyzer v3.3.66 (w)1999-2015 BSI
[*] Mon Jul 4 03:19:05 2016
[*]
[dumpfile] "/home/eyesis/git/x393-neon/simulation/x393_dut-20160703211758949.fst"
[dumpfile_mtime] "Mon Jul 4 03:18:33 2016"
[dumpfile_size] 639043
[savefile] "/home/eyesis/git/x393-neon/cocotb/x393_cocotb_02.sav"
[timestart] 10924700
[size] 1836 1171
[pos] 1920 0
*-16.699684 11530000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[sst_width] 204
[signals_width] 238
[sst_expanded] 1
[sst_vpaned_height] 344
@821
x393_dut.TEST_TITLE[639:0]
@28
x393_dut.dutm0_aclk
@22
x393_dut.dutm0_araddr[31:0]
x393_dut.dutm0_araddr_w[31:0]
@28
x393_dut.dutm0_arburst[1:0]
x393_dut.dutm0_arburst_w[1:0]
@22
x393_dut.dutm0_arcache[3:0]
x393_dut.dutm0_arid[11:0]
x393_dut.dutm0_arid_w[11:0]
x393_dut.dutm0_arlen[3:0]
x393_dut.dutm0_arlen_w[3:0]
@28
x393_dut.dutm0_arlock[1:0]
x393_dut.dutm0_arprot[2:0]
@22
x393_dut.dutm0_arqos[3:0]
@28
x393_dut.dutm0_arready
x393_dut.dutm0_arsize[1:0]
x393_dut.dutm0_arsize_w[1:0]
x393_dut.dutm0_arvalid
@22
x393_dut.dutm0_awaddr[31:0]
x393_dut.dutm0_awaddr_w[31:0]
@28
x393_dut.dutm0_awburst[1:0]
x393_dut.dutm0_awburst_w[1:0]
@22
x393_dut.dutm0_awcache[3:0]
x393_dut.dutm0_awid[11:0]
x393_dut.dutm0_awid_w[11:0]
x393_dut.dutm0_awlen[3:0]
x393_dut.dutm0_awlen_w[3:0]
@28
x393_dut.dutm0_awlock[1:0]
x393_dut.dutm0_awprot[2:0]
@22
x393_dut.dutm0_awqos[3:0]
@28
x393_dut.dutm0_awready
x393_dut.dutm0_awsize[1:0]
x393_dut.dutm0_awsize_w[1:0]
x393_dut.dutm0_awvalid
x393_dut.dutm0_awvalid_w
@22
x393_dut.dutm0_bid[11:0]
@28
x393_dut.dutm0_bready
x393_dut.dutm0_bresp[1:0]
x393_dut.dutm0_bvalid
@22
x393_dut.dutm0_rdata[31:0]
x393_dut.dutm0_rid[11:0]
@28
x393_dut.dutm0_rlast
x393_dut.dutm0_rready
x393_dut.dutm0_rresp[1:0]
x393_dut.dutm0_rvalid
@22
x393_dut.dutm0_wdata[31:0]
x393_dut.dutm0_wdata_w[31:0]
x393_dut.dutm0_wid[11:0]
x393_dut.dutm0_wid_w[11:0]
@28
x393_dut.dutm0_wlast
x393_dut.dutm0_wlast_w
x393_dut.dutm0_wready
@22
x393_dut.dutm0_wstb[3:0]
x393_dut.dutm0_wstb_w[3:0]
@28
x393_dut.dutm0_wvalid
x393_dut.dutm0_wvalid_w
@22
x393_dut.dutm0_xtra_blag[3:0]
x393_dut.dutm0_xtra_rdlag[3:0]
[pattern_trace] 1
[pattern_trace] 0
...@@ -28,25 +28,18 @@ import select ...@@ -28,25 +28,18 @@ import select
from socket_command import SocketCommand from socket_command import SocketCommand
from cocotb.triggers import Timer from cocotb.triggers import Timer
from x393buses import MAXIGPMaster from x393interfaces import MAXIGPMaster
from cocotb.drivers import BitDriver from cocotb.drivers import BitDriver
from cocotb.triggers import Timer, RisingEdge, ReadOnly from cocotb.triggers import Timer, RisingEdge, ReadOnly
from cocotb.result import ReturnValue, TestFailure, TestError, TestSuccess from cocotb.result import ReturnValue, TestFailure, TestError, TestSuccess
import logging import logging
class X393_cocotb(object): class X393_cocotb_server(object):
writeIDMask = (1 <<12) -1 writeIDMask = (1 <<12) -1
readIDMask = (1 <<12) -1 readIDMask = (1 <<12) -1
def __init__(self, dut, port, host): # , debug=False): def __init__(self, dut, port, host): # , debug=False):
"""
print("os.getenv('SIM_ROOT'",os.getenv('SIM_ROOT'))
print("os.getenv('COCOTB_DEBUG'",os.getenv('COCOTB_DEBUG'))
print("os.getenv('RANDOM_SEED'",os.getenv('RANDOM_SEED'))
print("os.getenv('MODULE'",os.getenv('MODULE'))
print("os.getenv('TESTCASE'",os.getenv('TESTCASE'))
print("os.getenv('COCOTB_ANSI_OUTPUT'",os.getenv('COCOTB_ANSI_OUTPUT'))
"""
debug = os.getenv('COCOTB_DEBUG') # None/1 debug = os.getenv('COCOTB_DEBUG') # None/1
self.cmd= SocketCommand() self.cmd= SocketCommand()
self.dut = dut self.dut = dut
...@@ -54,7 +47,6 @@ class X393_cocotb(object): ...@@ -54,7 +47,6 @@ class X393_cocotb(object):
self.writeID=0 self.writeID=0
self.readID=0 self.readID=0
# self.clock = dut.dutm0_aclk
level = logging.DEBUG if debug else logging.WARNING level = logging.DEBUG if debug else logging.WARNING
self.maxigp0.log.setLevel(level) self.maxigp0.log.setLevel(level)
...@@ -82,14 +74,11 @@ class X393_cocotb(object): ...@@ -82,14 +74,11 @@ class X393_cocotb(object):
self.soc_conn, soc_addr = self.socket_conn.accept() self.soc_conn, soc_addr = self.socket_conn.accept()
self.dut._log.debug ("Connected with %s"%(soc_addr[0] + ':' + str(soc_addr[1]))) self.dut._log.debug ("Connected with %s"%(soc_addr[0] + ':' + str(soc_addr[1])))
#Sending message to connected client #Sending message to connected client
#self.soc_conn.send('Welcome to the server. Type something and hit enter\n') #send only takes string
line = self.soc_conn.recv(4096) # or make it unlimited? line = self.soc_conn.recv(4096) # or make it unlimited?
self.dut._log.info("Received from socket: %s"%(line)) self.dut._log.info("Received from socket: %s"%(line))
except: except:
self.logErrorTerminate("Socket seems to have died :-(") self.logErrorTerminate("Socket seems to have died :-(")
self.dut._log.info("1.Received from socket: %s"%(line)) self.dut._log.info("1.Received from socket: %s"%(line))
# yield Timer(10000)
# self.dut._log.debug("2.Received from socket: %s"%(line))
yield self.executeCommand(line) yield self.executeCommand(line)
self.dut._log.debug("3.Received from socket: %s"%(line)) self.dut._log.debug("3.Received from socket: %s"%(line))
...@@ -160,8 +149,8 @@ def convert_string(txt): ...@@ -160,8 +149,8 @@ def convert_string(txt):
@cocotb.coroutine @cocotb.coroutine
def run_test(dut, port=7777): def run_test(dut, port=7777):
tb = X393_cocotb(dut=dut, host = "", port=7777) tb = X393_cocotb_server(dut=dut, host = "", port=7777)
dut._log.info("Waiting for commnad on socket port %s"%(port)) dut._log.warn("Waiting for commnad on socket port %s"%(port))
while True: while True:
try: try:
rslt= yield tb.receiveCommandFromSocket() rslt= yield tb.receiveCommandFromSocket()
...@@ -170,69 +159,6 @@ def run_test(dut, port=7777): ...@@ -170,69 +159,6 @@ def run_test(dut, port=7777):
line = rv.retval; line = rv.retval;
dut._log.info("rv = %s"%(str(rv))) dut._log.info("rv = %s"%(str(rv)))
dut._log.info("line = %s"%(str(line))) dut._log.info("line = %s"%(str(line)))
# try:
# rslt = yield tb.executeCommand(command_line)
# except:
# break;
tb.socket_conn.close() tb.socket_conn.close()
cocotb.regression.tear_down() cocotb.regression.tear_down()
def run_test_0(dut):
tb = X393_cocotb(dut=dut, host = "", port=7777)
# tb.logErrorTerminate('Test error terminate')
yield Timer(10000)
while dut.reset_out.value.get_binstr() != "1":
yield Timer(10000)
while dut.reset_out.value:
yield Timer(10000)
# dut.TEST_TITLE.buff = "WRITE"
dut.TEST_TITLE = convert_string("WRITE")
val = yield tb.maxigp0.axi_write(address = 0x1234,
value = [8,7,6,5,4,3,2,1,0],
byte_enable = None,
id = 0,
dsize = 2,
burst = 1,
address_latency = 0,
data_latency = 0)
# dut.TEST_TITLE.buff = "---"
dut.TEST_TITLE = 0
dut._log.info("axi_write returned => " +str(val))
# yield Timer(1000)
print("*******************************************")
yield Timer(11000)
dut.TEST_TITLE = convert_string("WRITE1")
val = yield tb.maxigp0.axi_write(address = 0x5678,
value = [1,2,3,4],
byte_enable = None,
id = 0,
dsize = 2,
burst = 1,
address_latency = 0,
data_latency = 0)
# dut.TEST_TITLE.buff = "---"
dut.TEST_TITLE = 0
dut._log.info("axi_write returned => " +str(val))
# yield Timer(1000)
print("*******************************************")
yield Timer(10000)
# dval = yield tb.maxigp0.axi_read(0x1234, 0, 4, 2, 0, 0 )
# dut.TEST_TITLE.buff = "READ"
dut.TEST_TITLE <= convert_string("READ")
dval = yield tb.maxigp0.axi_read(address = 0x1234,
id = 0,
dlen = 4,
dsize = 2,
address_latency = 0,
data_latency = 0 )
dut._log.info("axi_read returned => " +str(dval))
# dut.TEST_TITLE.buff = "---"
dut.TEST_TITLE <= 0
yield Timer(100000)
print("*******************************************")
cocotb.regression.tear_down()
from __future__ import print_function
"""
# Copyright (C) 2016, Elphel.inc.
# Simulation code for cocotb simulation for x393 project
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
@author: Andrey Filippov
@copyright: 2016 Elphel, Inc.
@license: GPLv3.0+
@contact: andrey@elphel.coml
"""
import os
import cocotb
from cocotb.triggers import Timer
from x393buses import MAXIGPMaster
from cocotb.drivers import BitDriver
from cocotb.triggers import Timer, RisingEdge, ReadOnly
from cocotb.result import ReturnValue, TestFailure, TestError, TestSuccess
import logging
class X393_cocotb_02(object):
def __init__(self, dut): # , debug=False):
"""
print("os.getenv('SIM_ROOT'",os.getenv('SIM_ROOT'))
print("os.getenv('COCOTB_DEBUG'",os.getenv('COCOTB_DEBUG'))
print("os.getenv('RANDOM_SEED'",os.getenv('RANDOM_SEED'))
print("os.getenv('MODULE'",os.getenv('MODULE'))
print("os.getenv('TESTCASE'",os.getenv('TESTCASE'))
print("os.getenv('COCOTB_ANSI_OUTPUT'",os.getenv('COCOTB_ANSI_OUTPUT'))
"""
debug = os.getenv('COCOTB_DEBUG') # None/1
self.dut = dut
self.axiwr = MAXIGPMaster(entity=dut, name="dutm0", clock=dut.dutm0_aclk, rdlag=0, blag=0)
# self.clock = dut.dutm0_aclk
level = logging.DEBUG if debug else logging.WARNING
self.axiwr.log.setLevel(level)
def convert_string(txt):
number=0
for c in txt:
number = (number << 8) + ord(c)
return number
@cocotb.coroutine
def run_test(dut):
tb = X393_cocotb_02(dut)
yield Timer(10000)
while dut.reset_out.value.get_binstr() != "1":
yield Timer(10000)
while dut.reset_out.value:
yield Timer(10000)
# dut.TEST_TITLE.buff = "WRITE"
dut.TEST_TITLE = convert_string("WRITE")
val = yield tb.axiwr.axi_write(address = 0x1234,
value = [8,7,6,5,4,3,2,1,0],
byte_enable = None,
id = 0,
dsize = 2,
burst = 1,
address_latency = 0,
data_latency = 0)
# dut.TEST_TITLE.buff = "---"
dut.TEST_TITLE = 0
dut._log.info("axi_write returned => " +str(val))
# yield Timer(1000)
print("*******************************************")
yield Timer(11000)
dut.TEST_TITLE = convert_string("WRITE1")
val = yield tb.axiwr.axi_write(address = 0x5678,
value = [1,2,3,4],
byte_enable = None,
id = 0,
dsize = 2,
burst = 1,
address_latency = 0,
data_latency = 0)
# dut.TEST_TITLE.buff = "---"
dut.TEST_TITLE = 0
dut._log.info("axi_write returned => " +str(val))
# yield Timer(1000)
print("*******************************************")
yield Timer(10000)
# dval = yield tb.axiwr.axi_read(0x1234, 0, 4, 2, 0, 0 )
# dut.TEST_TITLE.buff = "READ"
dut.TEST_TITLE <= convert_string("READ")
dval = yield tb.axiwr.axi_read(address = 0x1234,
id = 0,
dlen = 4,
dsize = 2,
address_latency = 0,
data_latency = 0 )
dut._log.info("axi_read returned => " +str(dval))
# dut.TEST_TITLE.buff = "---"
dut.TEST_TITLE <= 0
yield Timer(100000)
print("*******************************************")
cocotb.regression.tear_down()
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