Livt packages

Livt.Bus

Version 2.0.1

Configurable Avalon, AXI4-Lite, and Wishbone memory-mapped masters, interfaces, bridges, and test components.

Published files (67)

tests/Axi4LiteTimeoutTest.lvt

namespace Livt.Bus.Tests

using Livt.Bus.Axi4Lite
using Livt.Bus.Axi4Lite.Testing

@Test
component Axi4LiteWriteResponseTimeoutTest
{
	master: Axi4LiteTestMaster32
	slave: Axi4LiteTestSlave32

	new()
	{
		this.master = new Axi4LiteTestMaster32()
		this.slave = new Axi4LiteTestSlave32(this.master)
	}

	@Test
	fn TimesOutWhileWaitingForWriteResponse()
	{
		master.SetTimeoutTicks(2 as uint)
		slave.ConfigureDelays(0, 0, 20, 0, 0)
		var completed = master.TryWrite32(0x00 as uint, 0x12345678 as uint, 0b1111)
		assert completed == false
		assert master.LastTimedOut() == true
		assert master.awvalid == 0b0
		assert master.wvalid == 0b0
		assert master.bready == 0b0
		slave.ConfigureDelays(0, 0, 0, 0, 0)
		master.SetTimeoutTicks(10 as uint)
		assert master.TryRead32(0x00 as uint) == true
		assert master.LastReadValue() == (0x12345678 as uint)
	}
}

@Test
component Axi4LiteReadAddressTimeoutTest
{
	master: Axi4LiteTestMaster32
	slave: Axi4LiteTestSlave32

	new()
	{
		master = new Axi4LiteTestMaster32()
		slave = new Axi4LiteTestSlave32(master)
	}

	@Test
	fn TimesOutWhileWaitingForReadAddress()
	{
		master.SetTimeoutTicks(2 as uint)
		slave.ConfigureDelays(0, 0, 0, 20, 0)
		var completed = master.TryRead32(0x00 as uint)
		assert completed == false
		assert master.LastTimedOut() == true
		assert master.arvalid == 0b0
		assert master.rready == 0b0
		slave.ConfigureDelays(0, 0, 0, 0, 0)
		master.SetTimeoutTicks(10 as uint)
		assert master.TryRead32(0x00 as uint) == true
		assert master.LastTimedOut() == false
	}
}

@Test
component Axi4LiteReadDataTimeoutTest
{
	master: Axi4LiteTestMaster32
	slave: Axi4LiteTestSlave32

	new()
	{
		master = new Axi4LiteTestMaster32()
		slave = new Axi4LiteTestSlave32(master)
	}

	@Test
	fn TimesOutWhileWaitingForReadData()
	{
		master.SetTimeoutTicks(2 as uint)
		slave.ConfigureDelays(0, 0, 0, 0, 20)
		var completed = master.TryRead32(0x00 as uint)
		assert completed == false
		assert master.LastTimedOut() == true
		assert master.arvalid == 0b0
		assert master.rready == 0b0
		slave.ConfigureDelays(0, 0, 0, 0, 0)
		master.SetTimeoutTicks(10 as uint)
		assert master.TryRead32(0x00 as uint) == true
		assert master.LastTimedOut() == false
	}
}