UART receiver

Hi, I am working on UART receiver. As of now, I am stucked at
formatting link
I could not find a proper hardware writing style to continue with line 14
the overall hierarchy :
formatting link

module sampling_strobe_generator(clk, start_detected, sampling_strobe); // produces sampling signal for the incoming Rx
input clk, start_detected;
output reg sampling_strobe = 0;
localparam CLOCKS_PER_BIT = 5000; // number of system clock in one UART bit, or equivalently 1/9600Hz divided by 1/48MHz
reg [($clog2(CLOCKS_PER_BIT)-1) : 0] counter = 0;
always @(posedge clk)
begin
if(start_detected)
counter
Reply to
promach
Loading thread data ...
promach wrote on 10/11/2017 10:06 AM: > Hi, I am working on UART receiver. As of now, I am stucked at
formatting link
I could not find a proper hardware writing style to continue with line 14 > > the overall hierarchy :
formatting link
> > > > > > module sampling_strobe_generator(clk, start_detected, sampling_strobe); // produces sampling signal for the incoming Rx > > input clk, start_detected; > output reg sampling_strobe = 0; > > localparam CLOCKS_PER_BIT = 5000; // number of system clock in one UART bit, or equivalently 1/9600Hz divided by 1/48MHz > > reg [($clog2(CLOCKS_PER_BIT)-1) : 0] counter = 0; > > always @(posedge clk) > begin > if(start_detected) > counter else > > end > > always @(posedge clk) > begin > counter end > > endmodule > > > > module rx_state(clk, start_detected, sampling_strobe, data_is_available, data_is_valid, is_parity_stage); // FSM for UART Rx > > input clk, start_detected, sampling_strobe; > output reg data_is_available = 0; > output reg data_is_valid = 0; > output reg is_parity_stage = 0; > > reg [3:0] state = 0; > > localparam Rx_IDLE = 4'b0000 > localparam Rx_START_BIT = 4'b0001 > localparam Rx_DATA_BIT_0 = 4'b0010 > localparam Rx_DATA_BIT_1 = 4'b0011 > localparam Rx_DATA_BIT_2 = 4'b0100 > localparam Rx_DATA_BIT_3 = 4'b0101 > localparam Rx_DATA_BIT_4 = 4'b0110 > localparam Rx_DATA_BIT_5 = 4'b0111 > localparam Rx_DATA_BIT_6 = 4'b1000 > localparam Rx_DATA_BIT_7 = 4'b1001 > localparam Rx_PARITY_BIT = 4'b1010 > localparam Rx_STOP_BIT = 4'b1011 > > always @(posedge clk) > begin > data_is_valid is_parity_stage data_is_available = Rx_DATA_BIT_0) && (state end > > always @(posedge clk) > begin > if (sampling_strobe) begin > case(state) > Rx_IDLE : state > Rx_START_BIT : state > Rx_DATA_BIT_0, > Rx_DATA_BIT_1, > Rx_DATA_BIT_2, > Rx_DATA_BIT_3, > Rx_DATA_BIT_4, > Rx_DATA_BIT_5, > Rx_DATA_BIT_6, > Rx_DATA_BIT_7 : state
Reply to
rickman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.