Livt packages

Livt.IO

Version 1.8.1

Memory, UART, I2C, SPI, and Ethernet input/output components for Livt hardware designs.

Published files (126)

src/uart/LoopbackUart.lvt

namespace Livt.IO

/**
 * Internally looped-back UART with compile-time receive and transmit capacities.
 * Scheduled methods report transaction results; they are not single-cycle ports.
 */
component LoopbackUart<RX_CAPACITY: int = 64,
	TX_CAPACITY: int = 64,
	DATA_BITS: UartDataBits = UartDataBits.Eight,
	PARITY: UartParity = UartParity.None,
	STOP_BITS: UartStopBits = UartStopBits.One,
	BAUD: Frequency = 115200Hz> : IBufferedUart by buffered
{
	// Shared scheduled implementation and the serial wire joining TX to RX.
	buffered: BufferedUart<RX_CAPACITY, TX_CAPACITY, DATA_BITS, PARITY, STOP_BITS, BAUD>
	wire: logic

	/**
	 * Inherits clock/reset from the selected context and specializes the baud rate.
	 */
	new()
	{
		this.buffered = new BufferedUart<RX_CAPACITY, TX_CAPACITY, DATA_BITS, PARITY, STOP_BITS, BAUD>(
			wire, wire)
	}
}