+++ /dev/null
-CURDIR=$(realpath .)
-TOPDIR=$(realpath ../../..)
-
-ifeq ($(PYTHONPATH),)
- PYTHONPATH := $(TOPDIR)
-else
- PYTHONPATH := $(TOPDIR):$(PYTHONPATH)
-endif
-export PYTHONPATH
-
-VHDLDIR=$(TOPDIR)/c4m/vhdl/jtag
-VHDL_SOURCES = \
- $(VHDLDIR)/c4m_jtag_pkg.vhdl \
- $(VHDLDIR)/c4m_jtag_tap_fsm.vhdl \
- $(VHDLDIR)/c4m_jtag_irblock.vhdl \
- $(VHDLDIR)/c4m_jtag_iocell.vhdl \
- $(VHDLDIR)/c4m_jtag_ioblock.vhdl \
- $(VHDLDIR)/c4m_jtag_idblock.vhdl \
- $(VHDLDIR)/c4m_jtag_tap_controller.vhdl
-TOPLEVEL=c4m_jtag_tap_controller
-TOPLEVEL_LANG=vhdl
-MODULE=test
-SIM=ghdl
-GPI_IMPL=vhpi
-GHDL_ARGS=--std=08
-SIM_ARGS=--wave=test.ghw
-
-COCOTBMAKEFILESDIR=$(shell cocotb-config --makefiles)
-
-include $(COCOTBMAKEFILESDIR)/Makefile.inc
-include $(COCOTBMAKEFILESDIR)/Makefile.sim
+++ /dev/null
-import cocotb
-from cocotb.utils import get_sim_steps
-from cocotb.binary import BinaryValue
-
-from c4m.cocotb.jtag.c4m_jtag import JTAG_Master
-
-@cocotb.test()
-def test01_idcode(dut):
- """
- Test the IDCODE command
- """
-
- # Run @ 1MHz
- clk_period = get_sim_steps(1, "us")
- master = JTAG_Master(dut.tck, dut.tms, dut.tdi, dut.tdo, dut.trst_n, clk_period)
-
- dut._log.info("Trying to get IDCODE...")
-
- yield master.idcode()
- result1 = master.result
- dut._log.info("IDCODE1: {}".format(result1))
-
- yield master.idcode()
- result2 = master.result
- dut._log.info("IDCODE2: {}".format(result2))
-
- assert(result1 == result2)
-
-@cocotb.test()
-def test02_bypass(dut):
- """
- Test of BYPASS mode
- """
-
- # Run @ 1MHz
- clk_period = get_sim_steps(1, "us")
- master = JTAG_Master(dut.tck, dut.tms, dut.tdi, dut.tdo, dut.trst_n, clk_period)
-
- dut._log.info("Loading BYPASS command")
- yield master.load_ir(master.BYPASS)
-
- dut._log.info("Sending data")
-
- data_in = BinaryValue()
- data_in.binstr = "01001101"
- yield master.shift_data(data_in)
-
- dut._log.info("bypass out: {}".format(master.result.binstr))
- assert(master.result.binstr[:-1] == data_in.binstr[1:])
-
-@cocotb.test()
-def test03_sample(dut):
- """
- Test of SAMPLEPRELOAD and EXTEST
- """
- data_in = BinaryValue()
-
- # Run @ 1MHz
- clk_period = get_sim_steps(1, "us")
- master = JTAG_Master(dut.tck, dut.tms, dut.tdi, dut.tdo, dut.trst_n, clk_period)
-
-
- dut._log.info("Load SAMPLEPRELOAD command")
- yield master.load_ir(master.SAMPLEPRELOAD)
-
- data_in.binstr = "011"
- dut._log.info(" preloading data {}".format(data_in.binstr))
-
- # Set the ios pins
- dut.core_out = 0
- dut.core_en = 0
- dut.pad_in = 1
- yield master.shift_data(data_in)
- dut._log.info(" output: {}".format(master.result.binstr))
- assert(master.result.binstr == "100")
-
-
- dut._log.info("Load EXTEST command")
- yield master.load_ir(master.EXTEST)
-
- data_in.binstr = "100"
- dut._log.info(" input data {}".format(data_in.binstr))
-
- # Set the ios pins
- dut.core_out = 1
- dut.core_en = 1
- dut.pad_in = 0
- yield master.shift_data(data_in)
- dut._log.info(" output: {}".format(master.result.binstr))
- assert(master.result.binstr == "011")
-
- dut._log.info("Do a capture of the last loaded data")
- yield master.shift_data([])
-
+++ /dev/null
-CURDIR=$(realpath .)
-TOPDIR=$(realpath ../../..)
-
-ifeq ($(PYTHONPATH),)
- PYTHONPATH := $(TOPDIR)
-else
- PYTHONPATH := $(TOPDIR):$(PYTHONPATH)
-endif
-export PYTHONPATH
-
-VHDLDIR=$(TOPDIR)/c4m/vhdl/jtag
-VHDL_SOURCES = \
- $(VHDLDIR)/c4m_jtag_pkg.vhdl \
- $(VHDLDIR)/c4m_jtag_tap_fsm.vhdl \
- $(VHDLDIR)/c4m_jtag_irblock.vhdl \
- $(VHDLDIR)/c4m_jtag_iocell.vhdl \
- $(VHDLDIR)/c4m_jtag_ioblock.vhdl \
- $(VHDLDIR)/c4m_jtag_idblock.vhdl \
- $(VHDLDIR)/c4m_jtag_tap_controller.vhdl \
- $(CURDIR)/dual_parallel.vhdl
-TOPLEVEL=dual_parallel
-TOPLEVEL_LANG=vhdl
-MODULE=test
-SIM=ghdl
-GPI_IMPL=vhpi
-GHDL_ARGS=--std=08
-SIM_ARGS=--wave=test.ghw
-
-COCOTBMAKEFILESDIR=$(shell cocotb-config --makefiles)
-
-include $(COCOTBMAKEFILESDIR)/Makefile.inc
-include $(COCOTBMAKEFILESDIR)/Makefile.sim
+++ /dev/null
--- Top cell with two instantiations of the tap_controller with parallel scan chains
-
-library ieee;
-use ieee.std_logic_1164.ALL;
-
-use work.c4m_jtag.ALL;
-
-entity dual_parallel is
- port (
- -- Instance 1
- -- ==========
- -- JTAG
- I1_TCK: in std_logic;
- I1_TMS: in std_logic;
- I1_TDI: in std_logic;
- I1_TDO: out std_logic;
- I1_TRST_N: in std_logic;
-
- -- Instance 2
- -- ==========
- -- JTAG
- I2_TCK: in std_logic;
- I2_TMS: in std_logic;
- I2_TDI: in std_logic;
- I2_TDO: out std_logic;
- I2_TRST_N: in std_logic
- );
-end dual_parallel;
-
-architecture rtl of dual_parallel is
- signal I1_PAD_IN: std_logic;
- signal I1_PAD_EN: std_logic;
- signal I1_PAD_OUT: std_logic;
- signal I2_PAD_IN: std_logic;
- signal I2_PAD_EN: std_logic;
- signal I2_PAD_OUT: std_logic;
-begin
- CTRL1: c4m_jtag_tap_controller
- port map (
- TCK => I1_TCK,
- TMS => I1_TMS,
- TDI => I1_TDI,
- TDO => I1_TDO,
- TRST_N => I1_TRST_N,
- RESET => open,
- CAPTURE => open,
- SHIFT => open,
- UPDATE => open,
- IR => open,
- CORE_IN => open,
- CORE_EN => "1",
- CORE_OUT => "1",
- PAD_IN(0) => I1_PAD_IN,
- PAD_EN(0) => I1_PAD_EN,
- PAD_OUT(0) => I1_PAD_OUT
- );
-
- CTRL2: c4m_jtag_tap_controller
- port map (
- TCK => I2_TCK,
- TMS => I2_TMS,
- TDI => I2_TDI,
- TDO => I2_TDO,
- TRST_N => I2_TRST_N,
- RESET => open,
- CAPTURE => open,
- SHIFT => open,
- UPDATE => open,
- IR => open,
- CORE_IN => open,
- CORE_EN => "1",
- CORE_OUT => "0",
- PAD_IN(0) => I2_PAD_IN,
- PAD_EN(0) => I2_PAD_EN,
- PAD_OUT(0) => I2_PAD_OUT
- );
-
- I1_PAD_IN <= I2_PAD_OUT when I2_PAD_EN = '1' else
- 'Z';
- I2_PAD_IN <= I1_PAD_OUT when I1_PAD_EN = '1' else
- 'Z';
-end rtl;
+++ /dev/null
-import cocotb
-from cocotb.utils import get_sim_steps
-
-from c4m.cocotb.jtag.c4m_jtag import JTAG_Master
-
-@cocotb.test()
-def test01_dual(dut):
- """
- Test the IDCODE command
- """
-
- # TODO: Allow parallel operation of the JTAG chains
-
- # Run @ 1MHz
- clk_period = get_sim_steps(1, "us")
- master1 = JTAG_Master(dut.i1_tck, dut.i1_tms, dut.i1_tdi, dut.i1_tdo, dut.i1_trst_n, clk_period)
- master2 = JTAG_Master(dut.i2_tck, dut.i2_tms, dut.i2_tdi, dut.i2_tdo, dut.i2_trst_n, clk_period)
-
- dut._log.info("Set command to SAMPLEPRELOAD")
- yield master1.load_ir(master1.SAMPLEPRELOAD)
- yield master2.load_ir(master2.SAMPLEPRELOAD)
-
- dut._log.info("Load data, scan out first sample")
- yield master1.shift_data([0, 0, 0])
- dut._log.info(" master1 scan_out: {}".format(master1.result.binstr))
- assert(master1.result.binstr == "011")
- yield master2.shift_data([1, 1, 1])
- dut._log.info(" master2 scan_out: {}".format(master2.result.binstr))
- assert(master2.result.binstr == "101")
-
- dut._log.info("Set command to EXTEST")
- yield master1.load_ir(master1.EXTEST)
- yield master2.load_ir(master2.EXTEST)
-
- dut._log.info("Second scan")
- yield master1.shift_data([0, 0, 0])
- dut._log.info(" master1 scan_out: {}".format(master1.result.binstr))
- assert(master1.result.binstr == "111")
- yield master2.shift_data([1, 1, 1])
- dut._log.info(" master2 scan_out: {}".format(master2.result.binstr))
- assert(master2.result.binstr == "Z01")
+++ /dev/null
-#!/bin/sh
-vhdldir=`realpath ../../../c4m/vhdl/jtag`
-opts=--std=08
-ghdl -a $opts $vhdldir/c4m_jtag_pkg.vhdl
-ghdl -a $opts $vhdldir/c4m_jtag_tap_fsm.vhdl
-ghdl -a $opts $vhdldir/c4m_jtag_irblock.vhdl
-ghdl -a $opts $vhdldir/c4m_jtag_idblock.vhdl
-ghdl -a $opts $vhdldir/c4m_jtag_iocell.vhdl
-ghdl -a $opts $vhdldir/c4m_jtag_ioblock.vhdl
-ghdl -a $opts $vhdldir/c4m_jtag_tap_controller.vhdl
-ghdl -a $opts ./idcode.vhdl
-ghdl -r $opts bench_idcode --wave=bench_idcode.ghw
+++ /dev/null
--- reset JTAG interface and then IDCODE should be shifted out
-
-library ieee;
-use ieee.std_logic_1164.ALL;
-
-use work.c4m_jtag.ALL;
-
-entity bench_idcode is
-end bench_idcode;
-
-architecture rtl of bench_idcode is
- signal TCK: std_logic;
- signal TMS: std_logic;
- signal TDI: std_logic;
- signal TDO: std_logic;
- signal TRST_N: std_logic;
-
- constant CLK_PERIOD: time := 10 ns;
-
- procedure ClkCycle(
- signal CLK: out std_logic;
- CLK_PERIOD: time
- ) is
- begin
- CLK <= '0';
- wait for CLK_PERIOD/4;
- CLK <= '1';
- wait for CLK_PERIOD/2;
- CLK <= '0';
- wait for CLK_PERIOD/4;
- end ClkCycle;
-
- procedure ClkCycles(
- N: integer;
- signal CLK: out std_logic;
- CLK_PERIOD: time
- ) is
- begin
- for i in 1 to N loop
- ClkCycle(CLK, CLK_PERIOD);
- end loop;
- end ClkCycles;
-begin
- JTAG_BLOCK: c4m_jtag_tap_controller
- -- Use default values
- port map (
- TCK => TCK,
- TMS => TMS,
- TDI => TDI,
- TDO => TDO,
- TRST_N => TRST_N,
- RESET => open,
- CAPTURE => open,
- SHIFT => open,
- UPDATE => open,
- IR => open,
- CORE_OUT => "0",
- CORE_IN => open,
- CORE_EN => "0",
- PAD_OUT => open,
- PAD_IN => "0",
- PAD_EN => open
- );
-
- SIM: process
- begin
- -- Reset
- TCK <= '0';
- TMS <= '1';
- TDI <= '0';
- TRST_N <= '0';
- wait for 10*CLK_PERIOD;
-
- TRST_N <= '1';
- wait for CLK_PERIOD;
-
- -- Enter RunTestIdle
- TMS <= '0';
- ClkCycle(TCK, CLK_PERIOD);
- -- Enter SelectDRScan
- TMS <= '1';
- ClkCycle(TCK, CLK_PERIOD);
- -- Enter Capture
- TMS <= '0';
- ClkCycle(TCK, CLK_PERIOD);
- -- Enter Shift, run for 35 CLK cycles
- TMS <= '0';
- ClkCycles(35, TCK, CLK_PERIOD);
- -- Enter Exit1
- TMS <= '1';
- ClkCycle(TCK, CLK_PERIOD);
- -- Enter Update
- TMS <= '1';
- ClkCycle(TCK, CLK_PERIOD);
- -- To TestLogicReset
- TMS <= '1';
- ClkCycles(4, TCK, CLK_PERIOD);
-
- -- end simulation
- wait;
- end process;
-end rtl;
--- /dev/null
+CURDIR=$(realpath .)
+TOPDIR=$(realpath ../../..)
+
+ifeq ($(PYTHONPATH),)
+ PYTHONPATH := $(TOPDIR)
+else
+ PYTHONPATH := $(TOPDIR):$(PYTHONPATH)
+endif
+export PYTHONPATH
+
+VHDLDIR=$(TOPDIR)/c4m/vhdl/jtag
+VHDL_SOURCES = \
+ $(VHDLDIR)/c4m_jtag_pkg.vhdl \
+ $(VHDLDIR)/c4m_jtag_tap_fsm.vhdl \
+ $(VHDLDIR)/c4m_jtag_irblock.vhdl \
+ $(VHDLDIR)/c4m_jtag_iocell.vhdl \
+ $(VHDLDIR)/c4m_jtag_ioblock.vhdl \
+ $(VHDLDIR)/c4m_jtag_idblock.vhdl \
+ $(VHDLDIR)/c4m_jtag_tap_controller.vhdl
+TOPLEVEL=c4m_jtag_tap_controller
+TOPLEVEL_LANG=vhdl
+MODULE=test
+SIM=ghdl
+GPI_IMPL=vhpi
+GHDL_ARGS=--std=08
+SIM_ARGS=--wave=test.ghw
+
+COCOTBMAKEFILESDIR=$(shell cocotb-config --makefiles)
+
+include $(COCOTBMAKEFILESDIR)/Makefile.inc
+include $(COCOTBMAKEFILESDIR)/Makefile.sim
--- /dev/null
+import cocotb
+from cocotb.utils import get_sim_steps
+from cocotb.binary import BinaryValue
+
+from c4m.cocotb.jtag.c4m_jtag import JTAG_Master
+
+@cocotb.test()
+def test01_idcode(dut):
+ """
+ Test the IDCODE command
+ """
+
+ # Run @ 1MHz
+ clk_period = get_sim_steps(1, "us")
+ master = JTAG_Master(dut.tck, dut.tms, dut.tdi, dut.tdo, dut.trst_n, clk_period)
+
+ dut._log.info("Trying to get IDCODE...")
+
+ yield master.idcode()
+ result1 = master.result
+ dut._log.info("IDCODE1: {}".format(result1))
+
+ yield master.idcode()
+ result2 = master.result
+ dut._log.info("IDCODE2: {}".format(result2))
+
+ assert(result1 == result2)
+
+@cocotb.test()
+def test02_bypass(dut):
+ """
+ Test of BYPASS mode
+ """
+
+ # Run @ 1MHz
+ clk_period = get_sim_steps(1, "us")
+ master = JTAG_Master(dut.tck, dut.tms, dut.tdi, dut.tdo, dut.trst_n, clk_period)
+
+ dut._log.info("Loading BYPASS command")
+ yield master.load_ir(master.BYPASS)
+
+ dut._log.info("Sending data")
+
+ data_in = BinaryValue()
+ data_in.binstr = "01001101"
+ yield master.shift_data(data_in)
+
+ dut._log.info("bypass out: {}".format(master.result.binstr))
+ assert(master.result.binstr[:-1] == data_in.binstr[1:])
+
+@cocotb.test()
+def test03_sample(dut):
+ """
+ Test of SAMPLEPRELOAD and EXTEST
+ """
+ data_in = BinaryValue()
+
+ # Run @ 1MHz
+ clk_period = get_sim_steps(1, "us")
+ master = JTAG_Master(dut.tck, dut.tms, dut.tdi, dut.tdo, dut.trst_n, clk_period)
+
+
+ dut._log.info("Load SAMPLEPRELOAD command")
+ yield master.load_ir(master.SAMPLEPRELOAD)
+
+ data_in.binstr = "011"
+ dut._log.info(" preloading data {}".format(data_in.binstr))
+
+ # Set the ios pins
+ dut.core_out = 0
+ dut.core_en = 0
+ dut.pad_in = 1
+ yield master.shift_data(data_in)
+ dut._log.info(" output: {}".format(master.result.binstr))
+ assert(master.result.binstr == "100")
+
+
+ dut._log.info("Load EXTEST command")
+ yield master.load_ir(master.EXTEST)
+
+ data_in.binstr = "100"
+ dut._log.info(" input data {}".format(data_in.binstr))
+
+ # Set the ios pins
+ dut.core_out = 1
+ dut.core_en = 1
+ dut.pad_in = 0
+ yield master.shift_data(data_in)
+ dut._log.info(" output: {}".format(master.result.binstr))
+ assert(master.result.binstr == "011")
+
+ dut._log.info("Do a capture of the last loaded data")
+ yield master.shift_data([])
+
--- /dev/null
+CURDIR=$(realpath .)
+TOPDIR=$(realpath ../../..)
+
+ifeq ($(PYTHONPATH),)
+ PYTHONPATH := $(TOPDIR)
+else
+ PYTHONPATH := $(TOPDIR):$(PYTHONPATH)
+endif
+export PYTHONPATH
+
+VHDLDIR=$(TOPDIR)/c4m/vhdl/jtag
+VHDL_SOURCES = \
+ $(VHDLDIR)/c4m_jtag_pkg.vhdl \
+ $(VHDLDIR)/c4m_jtag_tap_fsm.vhdl \
+ $(VHDLDIR)/c4m_jtag_irblock.vhdl \
+ $(VHDLDIR)/c4m_jtag_iocell.vhdl \
+ $(VHDLDIR)/c4m_jtag_ioblock.vhdl \
+ $(VHDLDIR)/c4m_jtag_idblock.vhdl \
+ $(VHDLDIR)/c4m_jtag_tap_controller.vhdl \
+ $(CURDIR)/dual_parallel.vhdl
+TOPLEVEL=dual_parallel
+TOPLEVEL_LANG=vhdl
+MODULE=test
+SIM=ghdl
+GPI_IMPL=vhpi
+GHDL_ARGS=--std=08
+SIM_ARGS=--wave=test.ghw
+
+COCOTBMAKEFILESDIR=$(shell cocotb-config --makefiles)
+
+include $(COCOTBMAKEFILESDIR)/Makefile.inc
+include $(COCOTBMAKEFILESDIR)/Makefile.sim
--- /dev/null
+-- Top cell with two instantiations of the tap_controller with parallel scan chains
+
+library ieee;
+use ieee.std_logic_1164.ALL;
+
+use work.c4m_jtag.ALL;
+
+entity dual_parallel is
+ port (
+ -- Instance 1
+ -- ==========
+ -- JTAG
+ I1_TCK: in std_logic;
+ I1_TMS: in std_logic;
+ I1_TDI: in std_logic;
+ I1_TDO: out std_logic;
+ I1_TRST_N: in std_logic;
+
+ -- Instance 2
+ -- ==========
+ -- JTAG
+ I2_TCK: in std_logic;
+ I2_TMS: in std_logic;
+ I2_TDI: in std_logic;
+ I2_TDO: out std_logic;
+ I2_TRST_N: in std_logic
+ );
+end dual_parallel;
+
+architecture rtl of dual_parallel is
+ signal I1_PAD_IN: std_logic;
+ signal I1_PAD_EN: std_logic;
+ signal I1_PAD_OUT: std_logic;
+ signal I2_PAD_IN: std_logic;
+ signal I2_PAD_EN: std_logic;
+ signal I2_PAD_OUT: std_logic;
+begin
+ CTRL1: c4m_jtag_tap_controller
+ port map (
+ TCK => I1_TCK,
+ TMS => I1_TMS,
+ TDI => I1_TDI,
+ TDO => I1_TDO,
+ TRST_N => I1_TRST_N,
+ RESET => open,
+ CAPTURE => open,
+ SHIFT => open,
+ UPDATE => open,
+ IR => open,
+ CORE_IN => open,
+ CORE_EN => "1",
+ CORE_OUT => "1",
+ PAD_IN(0) => I1_PAD_IN,
+ PAD_EN(0) => I1_PAD_EN,
+ PAD_OUT(0) => I1_PAD_OUT
+ );
+
+ CTRL2: c4m_jtag_tap_controller
+ port map (
+ TCK => I2_TCK,
+ TMS => I2_TMS,
+ TDI => I2_TDI,
+ TDO => I2_TDO,
+ TRST_N => I2_TRST_N,
+ RESET => open,
+ CAPTURE => open,
+ SHIFT => open,
+ UPDATE => open,
+ IR => open,
+ CORE_IN => open,
+ CORE_EN => "1",
+ CORE_OUT => "0",
+ PAD_IN(0) => I2_PAD_IN,
+ PAD_EN(0) => I2_PAD_EN,
+ PAD_OUT(0) => I2_PAD_OUT
+ );
+
+ I1_PAD_IN <= I2_PAD_OUT when I2_PAD_EN = '1' else
+ 'Z';
+ I2_PAD_IN <= I1_PAD_OUT when I1_PAD_EN = '1' else
+ 'Z';
+end rtl;
--- /dev/null
+import cocotb
+from cocotb.utils import get_sim_steps
+
+from c4m.cocotb.jtag.c4m_jtag import JTAG_Master
+
+@cocotb.test()
+def test01_dual(dut):
+ """
+ Test the IDCODE command
+ """
+
+ # TODO: Allow parallel operation of the JTAG chains
+
+ # Run @ 1MHz
+ clk_period = get_sim_steps(1, "us")
+ master1 = JTAG_Master(dut.i1_tck, dut.i1_tms, dut.i1_tdi, dut.i1_tdo, dut.i1_trst_n, clk_period)
+ master2 = JTAG_Master(dut.i2_tck, dut.i2_tms, dut.i2_tdi, dut.i2_tdo, dut.i2_trst_n, clk_period)
+
+ dut._log.info("Set command to SAMPLEPRELOAD")
+ yield master1.load_ir(master1.SAMPLEPRELOAD)
+ yield master2.load_ir(master2.SAMPLEPRELOAD)
+
+ dut._log.info("Load data, scan out first sample")
+ yield master1.shift_data([0, 0, 0])
+ dut._log.info(" master1 scan_out: {}".format(master1.result.binstr))
+ assert(master1.result.binstr == "011")
+ yield master2.shift_data([1, 1, 1])
+ dut._log.info(" master2 scan_out: {}".format(master2.result.binstr))
+ assert(master2.result.binstr == "101")
+
+ dut._log.info("Set command to EXTEST")
+ yield master1.load_ir(master1.EXTEST)
+ yield master2.load_ir(master2.EXTEST)
+
+ dut._log.info("Second scan")
+ yield master1.shift_data([0, 0, 0])
+ dut._log.info(" master1 scan_out: {}".format(master1.result.binstr))
+ assert(master1.result.binstr == "111")
+ yield master2.shift_data([1, 1, 1])
+ dut._log.info(" master2 scan_out: {}".format(master2.result.binstr))
+ assert(master2.result.binstr == "Z01")
--- /dev/null
+#!/bin/sh
+vhdldir=`realpath ../../../c4m/vhdl/jtag`
+opts=--std=08
+ghdl -a $opts $vhdldir/c4m_jtag_pkg.vhdl
+ghdl -a $opts $vhdldir/c4m_jtag_tap_fsm.vhdl
+ghdl -a $opts $vhdldir/c4m_jtag_irblock.vhdl
+ghdl -a $opts $vhdldir/c4m_jtag_idblock.vhdl
+ghdl -a $opts $vhdldir/c4m_jtag_iocell.vhdl
+ghdl -a $opts $vhdldir/c4m_jtag_ioblock.vhdl
+ghdl -a $opts $vhdldir/c4m_jtag_tap_controller.vhdl
+ghdl -a $opts ./idcode.vhdl
+ghdl -r $opts bench_idcode --wave=bench_idcode.ghw
--- /dev/null
+-- reset JTAG interface and then IDCODE should be shifted out
+
+library ieee;
+use ieee.std_logic_1164.ALL;
+
+use work.c4m_jtag.ALL;
+
+entity bench_idcode is
+end bench_idcode;
+
+architecture rtl of bench_idcode is
+ signal TCK: std_logic;
+ signal TMS: std_logic;
+ signal TDI: std_logic;
+ signal TDO: std_logic;
+ signal TRST_N: std_logic;
+
+ constant CLK_PERIOD: time := 10 ns;
+
+ procedure ClkCycle(
+ signal CLK: out std_logic;
+ CLK_PERIOD: time
+ ) is
+ begin
+ CLK <= '0';
+ wait for CLK_PERIOD/4;
+ CLK <= '1';
+ wait for CLK_PERIOD/2;
+ CLK <= '0';
+ wait for CLK_PERIOD/4;
+ end ClkCycle;
+
+ procedure ClkCycles(
+ N: integer;
+ signal CLK: out std_logic;
+ CLK_PERIOD: time
+ ) is
+ begin
+ for i in 1 to N loop
+ ClkCycle(CLK, CLK_PERIOD);
+ end loop;
+ end ClkCycles;
+begin
+ JTAG_BLOCK: c4m_jtag_tap_controller
+ -- Use default values
+ port map (
+ TCK => TCK,
+ TMS => TMS,
+ TDI => TDI,
+ TDO => TDO,
+ TRST_N => TRST_N,
+ RESET => open,
+ CAPTURE => open,
+ SHIFT => open,
+ UPDATE => open,
+ IR => open,
+ CORE_OUT => "0",
+ CORE_IN => open,
+ CORE_EN => "0",
+ PAD_OUT => open,
+ PAD_IN => "0",
+ PAD_EN => open
+ );
+
+ SIM: process
+ begin
+ -- Reset
+ TCK <= '0';
+ TMS <= '1';
+ TDI <= '0';
+ TRST_N <= '0';
+ wait for 10*CLK_PERIOD;
+
+ TRST_N <= '1';
+ wait for CLK_PERIOD;
+
+ -- Enter RunTestIdle
+ TMS <= '0';
+ ClkCycle(TCK, CLK_PERIOD);
+ -- Enter SelectDRScan
+ TMS <= '1';
+ ClkCycle(TCK, CLK_PERIOD);
+ -- Enter Capture
+ TMS <= '0';
+ ClkCycle(TCK, CLK_PERIOD);
+ -- Enter Shift, run for 35 CLK cycles
+ TMS <= '0';
+ ClkCycles(35, TCK, CLK_PERIOD);
+ -- Enter Exit1
+ TMS <= '1';
+ ClkCycle(TCK, CLK_PERIOD);
+ -- Enter Update
+ TMS <= '1';
+ ClkCycle(TCK, CLK_PERIOD);
+ -- To TestLogicReset
+ TMS <= '1';
+ ClkCycles(4, TCK, CLK_PERIOD);
+
+ -- end simulation
+ wait;
+ end process;
+end rtl;