Line 62... |
Line 62... |
localparam [3:0] LCLLGFLEN = (LGFLEN > 4'ha)? 4'ha
|
localparam [3:0] LCLLGFLEN = (LGFLEN > 4'ha)? 4'ha
|
: ((LGFLEN < 4'h2) ? 4'h2 : LGFLEN);
|
: ((LGFLEN < 4'h2) ? 4'h2 : LGFLEN);
|
//
|
//
|
input wire i_clk, i_rst;
|
input wire i_clk, i_rst;
|
// Wishbone inputs
|
// Wishbone inputs
|
input wire i_wb_cyc, i_wb_stb, i_wb_we;
|
input wire i_wb_cyc; // We ignore CYC for efficiency
|
|
input wire i_wb_stb, i_wb_we;
|
input wire [1:0] i_wb_addr;
|
input wire [1:0] i_wb_addr;
|
input wire [31:0] i_wb_data;
|
input wire [31:0] i_wb_data; // and only use 30 lines here
|
output reg o_wb_ack;
|
output reg o_wb_ack;
|
output wire o_wb_stall;
|
output wire o_wb_stall;
|
output reg [31:0] o_wb_data;
|
output reg [31:0] o_wb_data;
|
//
|
//
|
input wire i_uart_rx;
|
input wire i_uart_rx;
|
Line 93... |
Line 94... |
//
|
//
|
// The UART setup parameters: bits per byte, stop bits, parity, and
|
// The UART setup parameters: bits per byte, stop bits, parity, and
|
// baud rate are all captured within this uart_setup register.
|
// baud rate are all captured within this uart_setup register.
|
//
|
//
|
reg [30:0] uart_setup;
|
reg [30:0] uart_setup;
|
initial uart_setup = INITIAL_SETUP;
|
initial uart_setup = INITIAL_SETUP
|
|
| ((HARDWARE_FLOW_CONTROL_PRESENT==1'b0)? 31'h40000000 : 0);
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
// Under wishbone rules, a write takes place any time i_wb_stb
|
// Under wishbone rules, a write takes place any time i_wb_stb
|
// is high. If that's the case, and if the write was to the
|
// is high. If that's the case, and if the write was to the
|
// setup address, then set us up for the new parameters.
|
// setup address, then set us up for the new parameters.
|
if ((i_wb_stb)&&(i_wb_addr == `UART_SETUP)&&(i_wb_we))
|
if ((i_wb_stb)&&(i_wb_addr == `UART_SETUP)&&(i_wb_we))
|
Line 178... |
Line 180... |
// The clear to send line, which may be ignored, but which we set here
|
// The clear to send line, which may be ignored, but which we set here
|
// to be true any time the FIFO has fewer than N-2 items in it.
|
// to be true any time the FIFO has fewer than N-2 items in it.
|
// Why N-1? Because at N-1 we are totally full, but already so full
|
// Why N-1? Because at N-1 we are totally full, but already so full
|
// that if the transmit end starts sending we won't have a location to
|
// that if the transmit end starts sending we won't have a location to
|
// receive it. (Transmit might've started on the next character by the
|
// receive it. (Transmit might've started on the next character by the
|
// time we set this--need to set it to one character before necessary
|
// time we set this--thus we need to set it to one, one character before
|
|
// necessary).
|
|
wire [(LCLLGFLEN-1):0] check_cutoff;
|
|
assign check_cutoff = -3;
|
always @(posedge i_clk)
|
always @(posedge i_clk)
|
o_rts_n = ((HARDWARE_FLOW_CONTROL_PRESENT)
|
o_rts_n <= ((HARDWARE_FLOW_CONTROL_PRESENT)
|
&&(!uart_setup[30])
|
&&(!uart_setup[30])
|
&&(rxf_status[(LCLLGFLEN+1):4]=={(LCLLGFLEN-2){1'b1}}));
|
&&(rxf_status[(LCLLGFLEN+1):2] > check_cutoff));
|
|
|
// If the bus requests that we read from the receive FIFO, we need to
|
// If the bus requests that we read from the receive FIFO, we need to
|
// tell this to the receive FIFO. Note that because we are using a
|
// tell this to the receive FIFO. Note that because we are using a
|
// clock here, the output from the receive FIFO will necessarily be
|
// clock here, the output from the receive FIFO will necessarily be
|
// delayed by an extra clock.
|
// delayed by an extra clock.
|
Line 416... |
Line 421... |
// pipelined, and nothing stalls that pipeline. (Creates FIFO errors,
|
// pipelined, and nothing stalls that pipeline. (Creates FIFO errors,
|
// perhaps, but doesn't stall the pipeline.) Hence, we can just
|
// perhaps, but doesn't stall the pipeline.) Hence, we can just
|
// set this value to zero.
|
// set this value to zero.
|
assign o_wb_stall = 1'b0;
|
assign o_wb_stall = 1'b0;
|
|
|
|
// Make verilator happy
|
|
// verilator lint_off UNUSED
|
|
wire [33:0] unused;
|
|
assign unused = { i_rst, i_wb_cyc, i_wb_data };
|
|
// verilator lint_on UNUSED
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|