--- /dev/null
+#!/bin/sh
+
+# create dummy memory files
+yes 0 | head -128 > mem_1.init
+yes 0 | head -32 > mem_1.init
+touch mem.init mem_1.init mem_2.init mem_3.init mem_4.init
+
+# Only run test in reset state as running CPU takes too much time to simulate
+make \
+ SIM=verilator \
+ TOPLEVEL=ls180 \
+ COCOTB_RESULTS_FILE=results_iverilog_ls180_wb.xml \
+ COCOTB_HDL_TIMEUNIT=100ps \
+ TESTCASE="idcode_reset,idcodesvf_reset,boundary_scan_reset,idcode_run" \
+ VERILATOR_TRACE="1" \
+ NOTUSEDCOMPILE_ARGS="--unroll-count 256 \
+ --output-split 5000 \
+ --output-split-cfuncs 500 \
+ --output-split-ctrace 500 \
+ -Wno-fatal \
+ -Wno-BLKANDNBLK \
+ -Wno-WIDTH" \
+ MODULE="test" \
+ SIM_BUILD=sim_build_iverilator_ls180
+
+
+
ti = dut
ti._discover_all()
self.ti = ti
- self.clk = ti.clk
- self.rst = ti.rst
- self.tck = ti.TAP_bus__tck
- self.tms = ti.TAP_bus__tms
- self.tdi = ti.TAP_bus__tdi
- self.tdo = ti.TAP_bus__tdo
+ self.clk = dut.sys_clk
+ self.rst = dut.sys_rst
+ self.tck = dut.jtag_tck
+ self.tms = dut.jtag_tms
+ self.tdi = dut.jtag_tdi
+ self.tdo = dut.jtag_tdo
def info(self, *args, **kwargs):
return self.dut._log.info(*args, **kwargs)
if False:
# Yield is never executed but it makes this function a generator
yield Timer(0)
+ clk_steps = get_sim_steps(tck_period, "ns")
return JTAG_Master(wrap.tck, wrap.tms, wrap.tdi, wrap.tdo,
- clk_period=tck_period,
+ clk_period=clk_steps,
ir_width=4)
def execute_svf(wrap, *, jtag, svf_filename):
def __init__(self, dut):
self.dut = dut
try:
- ls180 = dut.ls180
+ ti = dut.test_issuer
except AttributeError:
- ls180 = dut
- ls180._discover_all()
- self.ls180 = ls180
+ ti = dut
+ ti._discover_all()
+ self.ti = ti
self.clk = dut.sys_clk
self.rst = dut.sys_rst
self.tck = dut.jtag_tck
self.tdi = dut.jtag_tdi
self.tdo = dut.jtag_tdo
- return
- ls180.test_issuer._discover_all()
- ls180.test_issuer.ti._discover_all()
- ls180.test_issuer.ti.dbg._discover_all()
-
def info(self, *args, **kwargs):
return self.dut._log.info(*args, **kwargs)
wrap = DUTWrapper(dut)
wrap.info(info)
- wrap.clk <= 0
- wrap.rst <= 1
-
clk_steps = get_sim_steps(clk_period, "ns")
cocotb.fork(Clock(wrap.clk, clk_steps).start())
+ wrap.rst <= 1
+ wrap.clk <= 0
if run:
yield Timer(int(10.5*clk_steps))
wrap.rst <= 0
- yield Timer(int(3*clk_steps))
+ yield Timer(int(5*clk_steps))
return wrap
master = yield from setup_jtag(wrap, tck_period = tck_period)
- #clk_steps = get_sim_steps(clk_period, "ns")
- #yield Timer(int(4.5*clk_steps))
- #wrap.rst <= 0
-
- #yield master.reset()
-
- #yield Timer(int(10.5*clk_steps))
-
- #wrap.rst <= 0
-
# Load the memory address
yield master.load_ir(cmd_MEMADDRESS)
dut._log.info("Loading address")
dut._log.info(" input: {}".format(data_in.binstr))
yield master.shift_data(data_in)
dut._log.info(" output: {}".format(master.result.binstr))
- assert master.result.binstr == "000000000000000000000000000000"
+ assert master.result.binstr == "000000000000000000000000000011"
# Do read and write
yield master.load_ir(cmd_MEMREADWRITE)
dut._log.info(" input: {}".format(data_in.binstr))
yield master.shift_data(data_in)
dut._log.info(" output: {}".format(master.result.binstr))
- assert master.result.binstr == "00000000000000000000000000010"
+ assert master.result.binstr == "000000000000000000000000000011"
# Do read
yield master.load_ir(cmd_MEMREAD)
dut._log.info(" input: {}".format(data_in.binstr))
yield master.shift_data(data_in)
dut._log.info(" output: {}".format(master.result.binstr))
- assert master.result.binstr == "00000000000000000000000000010"
+ assert master.result.binstr == "000000000000000000000000000011"
# Do read
yield master.load_ir(cmd_MEMREAD) # MEMREAD
dut._log.info(" output: {}".format(master.result.binstr))
assert master.result.binstr == "01010101" * 4
- dut._log.info("{!r}".format(wbmem))
+ #dut._log.info("{!r}".format(wbmem))
# demo / debug how to get boundary scan names. run "python3 test.py"