DSD Ta Report
DSD Ta Report
DSD Ta Report
Submitted By Group 3
Introduction to UART
UART means Universal Asynchronous Receiver Transmitter Protocol. UART is used for serial communication from the name
itself we can understand the functions of UART, where U stands for Universal which means this protocol can be applied to any
transmitter and receiver, and A is for Asynchronous which means one cannot use clock signal for communication of data
and R and T refers to Receiver and Transmitter hence UART refers to a protocol in which serial data communication will
happen without clock signal.
UART is established for serial communication
UART is a Universal Asynchronous Receiver Transmitter protocol that is used for serial communication. Two wires are
established here in which only one wire is used for transmission whereas the second wire is used for reception. Data format
and transmission speeds can be configured here. So, before starting with the communication define the data format and
transmission speed. Data format and transmission speed for communication will be defined here and we do not have a clock
over here that’s why it is referred to as asynchronous communication with UART protocol.
Code:-
module uart_reciever(
input i_Clock,
input i_Rx_Serial,
output o_Rx_DV,
);
parameter CLKS_PER_BIT=30;
reg r_Rx_DV = 0;
begin
end
begin
case (r_SM_Main)
s_IDLE :
begin
r_Clock_Count <= 0;
r_Bit_Index <= 0;
else
end
s_RX_START_BIT :
begin
if (r_Clock_Count == (CLKS_PER_BIT-1)/2)
begin
if (r_Rx_Data == 1'b0)
begin
r_Clock_Count <= 0; // reset counter, found the middle
end
else
end
else
begin
end
s_RX_DATA_BITS :
begin
begin
r_Clock_Count <= r_Clock_Count + 1;
end
else
begin
r_Clock_Count <= 0;
if (r_Bit_Index < 7)
begin
end
else
begin
r_Bit_Index <= 0;
end
end
s_RX_STOP_BIT :
begin
begin
end
else
begin
r_Clock_Count <= 0;
s_CLEANUP :
begin
end
default :
endcase
end
endmodule // uart_rx
uart_reciever is a module with clock input (i_Clock), serial input (i_Rx_Serial), and two outputs (o_Rx_DV and
o_Rx_Byte).
2. Parameters:
s_IDLE, s_RX_START_BIT, s_RX_DATA_BITS, s_RX_STOP_BIT, s_CLEANUP: These are states in a finite state
machine (FSM) for UART reception.
3. Registers:
r_Rx_Data_R and r_Rx_Data: These registers double-register the incoming serial data to handle metastability
issues.
r_Bit_Index: Keeps track of the current bit being received (0 to 7 for 8 data bits).
4. Always Blocks:
Double-registering Data:
Resets some registers and checks for the start bit. If start bit detected, transitions to
s_RX_START_BIT.
Checks the middle of the start bit to ensure it's still low. If yes, transitions to s_RX_DATA_BITS;
otherwise, back to s_IDLE.
Waits for CLKS_PER_BIT-1 clock cycles for the stop bit to finish.
s_CLEANUP:
Stays here for 1 clock cycle, then transitions back to s_IDLE and resets r_Rx_DV.
5. Assign Statements:
assign o_Rx_DV = r_Rx_DV;: Connects the internal signal r_Rx_DV to the output signal o_Rx_DV.
assign o_Rx_Byte = r_Rx_Byte;: Connects the internal signal r_Rx_Byte to the output bus o_Rx_Byte.
In summary, this module implements a UART receiver using a finite state machine. It synchronizes with the incoming serial data,
detects the start bit, receives data bits, checks the stop bit, and outputs the received byte when valid.
Code Output:-
The code is designed to receive serial data and output a valid byte (o_Rx_Byte) along with a data valid signal (o_Rx_DV). The
output signals will reflect the received data when a valid byte has been successfully received. Let's break down the expected
behavior:
It will be asserted (1) when a complete byte has been received, including start and stop bits.
The actual output values for o_Rx_DV and o_Rx_Byte will depend on the serial data input (i_Rx_Serial) and the configuration of
the UART sender. If the received data follows the UART protocol with correct start and stop bits, the module will recognize the
byte and assert o_Rx_DV with the valid byte present in o_Rx_Byte. Otherwise, o_Rx_DV will remain deasserted, and o_Rx_Byte
should not be considered valid.
Please note that the behavior also depends on the clock signal (i_Clock) and the configuration of CLKS_PER_BIT. If the clock
frequency and CLKS_PER_BIT are properly set for the baud rate of the incoming serial data, the module should be able to
correctly receive and interpret the data.