2 from cocotb
.triggers
import Timer
3 from cocotb
.utils
import get_sim_steps
4 from cocotb
.binary
import BinaryValue
6 from c4m_jtag
import JTAG_Master
11 Test the IDCODE command
14 # TODO: Allow parallel operation of the JTAG chains
17 clk_period
= get_sim_steps(1, "us")
18 master1
= JTAG_Master(dut
.i1_tck
, dut
.i1_tms
, dut
.i1_tdi
, dut
.i1_tdo
, dut
.i1_trst_n
, clk_period
)
19 master2
= JTAG_Master(dut
.i2_tck
, dut
.i2_tms
, dut
.i2_tdi
, dut
.i2_tdo
, dut
.i2_trst_n
, clk_period
)
21 dut
._log
.info("Set command to SAMPLEPRELOAD")
22 yield master1
.load_ir(master1
.SAMPLEPRELOAD
)
23 yield master2
.load_ir(master2
.SAMPLEPRELOAD
)
25 dut
._log
.info("Load data, scan out first sample")
26 yield master1
.shift_data([0, 0, 0])
27 dut
._log
.info(" master1 scan_out: {}".format(master1
.result
.binstr
))
28 assert(master1
.result
.binstr
== "011")
29 yield master2
.shift_data([1, 1, 1])
30 dut
._log
.info(" master2 scan_out: {}".format(master2
.result
.binstr
))
31 assert(master2
.result
.binstr
== "101")
33 dut
._log
.info("Set command to EXTEST")
34 yield master1
.load_ir(master1
.EXTEST
)
35 yield master2
.load_ir(master2
.EXTEST
)
37 dut
._log
.info("Second scan")
38 yield master1
.shift_data([0, 0, 0])
39 dut
._log
.info(" master1 scan_out: {}".format(master1
.result
.binstr
))
40 assert(master1
.result
.binstr
== "111")
41 yield master2
.shift_data([1, 1, 1])
42 dut
._log
.info(" master2 scan_out: {}".format(master2
.result
.binstr
))
43 assert(master2
.result
.binstr
== "Z01")