Line 105... |
Line 105... |
`define RXU_BREAK 4'hd
|
`define RXU_BREAK 4'hd
|
`define RXU_RESET_IDLE 4'he
|
`define RXU_RESET_IDLE 4'he
|
`define RXU_IDLE 4'hf
|
`define RXU_IDLE 4'hf
|
|
|
module rxuart(i_clk, i_reset, i_setup, i_uart, o_wr, o_data, o_break,
|
module rxuart(i_clk, i_reset, i_setup, i_uart, o_wr, o_data, o_break,
|
o_parity_err, o_frame_err, o_ck_uart);
|
o_parity_err, o_frame_err);
|
// parameter // CLOCKS_PER_BAUD = 25'd004340,
|
// parameter // CLOCKS_PER_BAUD = 25'd004340,
|
// BREAK_CONDITION = CLOCKS_PER_BAUD * 12,
|
// BREAK_CONDITION = CLOCKS_PER_BAUD * 12,
|
// CLOCKS_PER_HALF_BAUD = CLOCKS_PER_BAUD/2;
|
// CLOCKS_PER_HALF_BAUD = CLOCKS_PER_BAUD/2;
|
// 8 data bits, no parity, (at least 1) stop bit
|
// 8 data bits, no parity, (at least 1) stop bit
|
input i_clk, i_reset;
|
input i_clk, i_reset;
|
Line 117... |
Line 117... |
input i_uart;
|
input i_uart;
|
output reg o_wr;
|
output reg o_wr;
|
output reg [7:0] o_data;
|
output reg [7:0] o_data;
|
output reg o_break;
|
output reg o_break;
|
output reg o_parity_err, o_frame_err;
|
output reg o_parity_err, o_frame_err;
|
output wire o_ck_uart;
|
|
|
|
|
|
wire [27:0] clocks_per_baud, break_condition, half_baud;
|
wire [27:0] clocks_per_baud, break_condition, half_baud;
|
wire [1:0] data_bits;
|
wire [1:0] data_bits;
|
wire use_parity, parity_even, dblstop, fixd_parity;
|
wire use_parity, parity_even, dblstop, fixd_parity;
|
Line 143... |
Line 142... |
begin
|
begin
|
q_uart <= i_uart;
|
q_uart <= i_uart;
|
qq_uart <= q_uart;
|
qq_uart <= q_uart;
|
ck_uart <= qq_uart;
|
ck_uart <= qq_uart;
|
end
|
end
|
assign o_ck_uart = ck_uart;
|
// assign o_ck_uart = ck_uart;
|
|
|
reg [27:0] chg_counter;
|
reg [27:0] chg_counter;
|
initial chg_counter = 28'h00;
|
initial chg_counter = 28'h00;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
if (i_reset)
|
if (i_reset)
|