2020-08-23 09:40:21 -04:00
|
|
|
#
|
|
|
|
# This file is part of LiteX.
|
|
|
|
#
|
|
|
|
# Copyright (c) 2019 Florent Kermarrec <florent@enjoy-digital.fr>
|
|
|
|
# SPDX-License-Identifier: BSD-2-Clause
|
2019-07-05 12:30:34 -04:00
|
|
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from migen import *
|
|
|
|
|
2021-10-04 08:14:03 -04:00
|
|
|
from litex.soc.cores.icap import *
|
2019-07-05 12:30:34 -04:00
|
|
|
|
|
|
|
|
|
|
|
class TestICAP(unittest.TestCase):
|
2019-10-01 15:30:14 -04:00
|
|
|
def test_icap_command_reload(self):
|
2019-07-05 12:30:34 -04:00
|
|
|
def generator(dut):
|
2021-10-04 08:14:03 -04:00
|
|
|
yield dut.addr.eq(ICAPRegisters.CMD)
|
|
|
|
yield dut.data.eq(ICAPCMDs.IPROG)
|
2019-07-05 12:30:34 -04:00
|
|
|
for i in range(16):
|
|
|
|
yield
|
2020-10-07 06:36:08 -04:00
|
|
|
yield dut.send.eq(1)
|
2019-07-05 12:30:34 -04:00
|
|
|
yield
|
2020-10-07 06:36:08 -04:00
|
|
|
yield dut.send.eq(0)
|
2021-10-04 08:14:03 -04:00
|
|
|
for i in range(32):
|
|
|
|
print(f"{(yield dut._i):08x}")
|
2019-07-05 12:30:34 -04:00
|
|
|
yield
|
|
|
|
|
2020-10-07 06:36:08 -04:00
|
|
|
dut = ICAP(with_csr=False, simulation=True)
|
2021-10-04 08:14:03 -04:00
|
|
|
clocks = {"sys": 10, "icap": 10}
|
2019-07-05 12:30:34 -04:00
|
|
|
run_simulation(dut, generator(dut), clocks, vcd_name="icap.vcd")
|
2019-10-01 15:30:14 -04:00
|
|
|
|
|
|
|
def test_icap_bitstream_syntax(self):
|
|
|
|
dut = ICAPBitstream(simulation=True)
|