URL
https://opencores.org/ocsvn/wbuart32/wbuart32/trunk
[/] [wbuart32/] [trunk/] [rtl/] [rxuartlite.v] - Diff between revs 17 and 18
Go to most recent revision |
Show entire file |
Details |
Blame |
View Log
Rev 17 |
Rev 18 |
Line 64... |
Line 64... |
input wire i_uart_rx;
|
input wire i_uart_rx;
|
output reg o_wr;
|
output reg o_wr;
|
output reg [7:0] o_data;
|
output reg [7:0] o_data;
|
|
|
|
|
wire [23:0] clocks_per_baud, half_baud;
|
wire [23:0] half_baud;
|
reg [3:0] state;
|
reg [3:0] state;
|
|
|
assign half_baud = { 1'b0, CLOCKS_PER_BAUD[23:1] } - 24'h1;
|
assign half_baud = { 1'b0, CLOCKS_PER_BAUD[23:1] } - 24'h1;
|
reg [23:0] baud_counter;
|
reg [23:0] baud_counter;
|
reg zero_baud_counter;
|
reg zero_baud_counter;
|
Line 150... |
Line 150... |
// a stop bit, in which case we copy the data_reg into our output
|
// a stop bit, in which case we copy the data_reg into our output
|
// data register, o_data, and tell others (for one clock) that data is
|
// data register, o_data, and tell others (for one clock) that data is
|
// available.
|
// available.
|
//
|
//
|
initial o_data = 8'h00;
|
initial o_data = 8'h00;
|
reg pre_wr;
|
|
initial pre_wr = 1'b0;
|
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if ((zero_baud_counter)&&(state == `RXUL_STOP))
|
if ((zero_baud_counter)&&(state == `RXUL_STOP))
|
begin
|
begin
|
o_wr <= 1'b1;
|
o_wr <= 1'b1;
|
o_data <= data_reg;
|
o_data <= data_reg;
|
Line 164... |
Line 162... |
|
|
// The baud counter
|
// The baud counter
|
//
|
//
|
// This is used as a "clock divider" if you will, but the clock needs
|
// This is used as a "clock divider" if you will, but the clock needs
|
// to be reset before any byte can be decoded. In all other respects,
|
// to be reset before any byte can be decoded. In all other respects,
|
// we set ourselves up for clocks_per_baud counts between baud
|
// we set ourselves up for CLOCKS_PER_BAUD counts between baud
|
// intervals.
|
// intervals.
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if ((zero_baud_counter)|||(state == `RXUL_IDLE))
|
if ((zero_baud_counter)|||(state == `RXUL_IDLE))
|
baud_counter <= CLOCKS_PER_BAUD-1'b1;
|
baud_counter <= CLOCKS_PER_BAUD-1'b1;
|
else
|
else
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.