OpenCores
URL https://opencores.org/ocsvn/uart6551/uart6551/trunk

Subversion Repositories uart6551

[/] [uart6551/] [trunk/] [trunk/] [rtl/] [uart6551Tx.sv] - Diff between revs 2 and 3

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 3
Line 22... Line 22...
// ============================================================================
// ============================================================================
//
//
`define IDLE    0
`define IDLE    0
`define CNT             1
`define CNT             1
 
 
 
//`define UART_NO_TX_FIFO       1'b1
 
 
module uart6551Tx(rst, clk, cyc, cs, wr, din, ack,
module uart6551Tx(rst, clk, cyc, cs, wr, din, ack,
        fifoEnable, fifoClear, txBreak,
        fifoEnable, fifoClear, txBreak,
        frameSize, wordLength, parityCtrl, baud16x_ce,
        frameSize, wordLength, parityCtrl, baud16x_ce,
        cts, clear, txd, full, empty, qcnt);
        cts, clear, txd, full, empty, qcnt);
 
 
Line 61... Line 63...
 
 
assign ack = cyc & cs;
assign ack = cyc & cs;
edge_det ued1 (.rst(rst), .clk(clk), .ce(1'b1), .i(ack & wr), .pe(awr), .ne(), .ee());
edge_det ued1 (.rst(rst), .clk(clk), .ce(1'b1), .i(ack & wr), .pe(awr), .ne(), .ee());
 
 
`ifdef UART_NO_TX_FIFO
`ifdef UART_NO_TX_FIFO
reg [7:0] fdo;
reg [7:0] fdo2;
reg empty;
reg empty;
 
 
always @(posedge clk)
always @(posedge clk)
        if (awr) fdo <= {3'd0,din};
        if (awr) fdo2 <= {3'd0,din};
 
 
always @(posedge clk)
always @(posedge clk)
        begin
        begin
                if (awr) empty <= 0;
                if (awr) empty <= 0;
                else if (rd) empty <= 1;
                else if (rd) empty <= 1;
        end
        end
 
 
assign full = ~empty;
assign full = ~empty;
 
wire [7:0] fdo = fdo2;
`else
`else
 
reg [7:0] fdo2;
 
always @(posedge clk)
 
        if (awr) fdo2 <= {3'd0,din};
// generate an empty signal for when the fifo is disabled
// generate an empty signal for when the fifo is disabled
reg fempty2;
reg fempty2;
always @(posedge clk)
always @(posedge clk)
        if (rst)
        if (rst)
                fempty2 <= 1;
                fempty2 <= 1;
Line 86... Line 92...
                if (awr) fempty2 <= 0;
                if (awr) fempty2 <= 0;
                else if (rd) fempty2 <= 1;
                else if (rd) fempty2 <= 1;
        end
        end
 
 
 
 
wire [7:0] fdo;         // fifo data output
wire [7:0] fdo1;                // fifo data output
wire rdf = fifoEnable ? rd : awr;
wire rdf = fifoEnable ? rd : awr;
wire fempty;
wire fempty;
wire ffull;
wire ffull;
uart6551Fifo #(.WID(8)) fifo0
uart6551Fifo #(.WID(8)) fifo0
(
(
  .clk(clk),
  .clk(clk),
  .rst(rst|clear|fifoClear),
  .rst(rst|clear|fifoClear),
  .din(din),
  .din(din),
  .wr(awr),
  .wr(awr),
  .rd(rdf),
  .rd(rdf),
  .dout(fdo),
  .dout(fdo1),
  .full(ffull),
  .full(ffull),
  .empty(fempty),
  .empty(fempty),
  .ctr(qcnt)
  .ctr(qcnt)
);
);
assign empty = fifoEnable ? fempty : fempty2;
assign empty = fifoEnable ? fempty : fempty2;
assign full = fifoEnable ? ffull : ~fempty2;
assign full = fifoEnable ? ffull : ~fempty2;
 
wire [7:0] fdo = fifoEnable ? fdo1 : fdo2;
`endif
`endif
 
 
 
 
// mask transmit data for word length
// mask transmit data for word length
// this mask is needed for proper parity generation
// this mask is needed for proper parity generation
integer n;
integer n;
reg [7:0] mask;
reg [7:0] mask;
always @*
always @*

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.