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/Uart.lvt

namespace Livt.IO

/**
 * Low-level UART that combines `UartReceiver` and
 * `UartTransmitter` behind explicit control and status signals.
 */
component Uart<DATA_BITS: UartDataBits = UartDataBits.Eight,
	PARITY: UartParity = UartParity.None,
	STOP_BITS: UartStopBits = UartStopBits.One,
	BAUD: Frequency = 115200Hz>
{
	// Independent receive and transmit paths share the selected format and context.
	receiver: UartReceiver<DATA_BITS, PARITY, STOP_BITS, BAUD>
	transmitter: UartTransmitter<DATA_BITS, PARITY, STOP_BITS, BAUD>

	/**
	 * Binds RX and TX to the same compile-time baud and inherited clock context.
	 */
	new(
		rx: in logic,
		tx: out logic,
		tx_dv: in logic,
		tx_byte: in logic[8],
		tx_active: out logic,
		tx_done: out logic,
		rx_dv: out logic,
		rx_byte: out logic[8],
		rx_frame_error: out logic
	)
	{
		this.receiver = new UartReceiver<DATA_BITS, PARITY, STOP_BITS, BAUD>(
			rx,
			rx_dv,
			rx_byte,
			rx_frame_error
		)
		this.transmitter = new UartTransmitter<DATA_BITS, PARITY, STOP_BITS, BAUD>(
			tx,
			tx_dv,
			tx_byte,
			tx_active,
			tx_done
		)
	}
}