SerialRx.v

This module implements an asynchronous serial receiver with variable data rate, variable number of data bits, variable stop bits, and optional parity. It is compatible with SerialTx.v.

Ports

clkinputThe clock input.
sininputThe serial data stream.
outoutputData word out in parallel.
validoutput    When asserted, indicates that data are valid on the out port.
erroroutputIndicates a parity error occurred.

Parameters

dwidth8The number of data bits in the serial frame.
parity"n"Parity: "n", "e", and "o" for none, even and odd, respectively.
stop1The number of stop bits.
factor44The number of clock cycles per serial period.
sampledelay66The number of clocks after the detected edge of the start bit to the start of data sampling.

Notes

Example instantiation in Verilog:

wire		[11:0]	data;

SerialRx
    #(.dwidth(12), .parity("e"), .stop(2), .sampledelay(66), .factor(44))
    recv_inst (
        .clk(clk), 
        .sin(serialdata),
        .out(data)
        .valid(valid),		// received a serial frame
        .error(e)
    );