3 // Simple printout of characters from the UART
4 // Only does 8N1, requires the baud clock
6 module uart_rx (input baudclk, input rxd);
8 reg [3:0] baud_ctr = 4'b0;
11 wire byteclk = baud_ctr[3];
13 always @(posedge baudclk)
16 always @(posedge baudclk)
20 baud_ctr <= baud_ctr + 1;
23 wire byteclk = baudclk;
25 always @(posedge byteclk)
26 sr <= { rxd, sr[8:1] };
29 always @(posedge byteclk)
32 if(~sr[8] & sr[7]) // found start bit
34 1, 2, 3, 4, 5, 6, 7, 8 :
41 $display("Error, no stop bit\n");
45 endcase // case(state)