Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
en:verilog:uart:readme [2014/11/09 09:01]
alex [uart_rx module]
en:verilog:uart:readme [2014/11/09 09:29]
alex [Signals and Parameters]
Line 9: Line 9:
 ==== Source Files ==== ==== Source Files ====
  
-  * ''​rtl/uart.v''​ - Wrapper for complete UART +<​code>​ 
-  * ''​rtl/​uart_rx.v''​ - UART receiver implementation +    ​rtl/​uart.v ​    : Wrapper for complete UART 
-  * ''​rtl/​uart_tx.v''​ - UART transmitter implementation+    rtl/​uart_rx.v ​ : ​UART receiver implementation 
 +    rtl/​uart_tx.v ​ : ​UART transmitter implementation 
 +</​code>​
  
-==== uart module ====+===== uart module ​===== 
 + 
 +==== Signals and Parameters ==== 
 + 
 +<​code>​ 
 +    Parameters 
 +      parameter DATA_WIDTH = 8 - define width of data bus and transferred words in bits 
 +    Clock and reset 
 +      input wire clk - clock input 
 +      input wire rst - reset input 
 +    AXI Stream Interface (TX) 
 +      input  wire [DATA_WIDTH-1:​0] input_axis_tdata - data input 
 +      input  wire input_axis_tvalid - data valid input 
 +      output wire input_axis_tready - ready for data output 
 +    AXI Stream Interface (RX) 
 +      output wire [DATA_WIDTH-1:​0] output_axis_tdata - data output 
 +      output wire output_axis_tvalid - data valid output 
 +      input  wire output_axis_tready - ready for data input 
 +    UART Interface 
 +      input  wire rxd - UART RXD input 
 +      output wire txd - UART TXD output 
 +    Status 
 +      output wire tx_busy - operation in progress signal 
 +      output wire rx_busy - operation in progress signal 
 +      output wire rx_overrun_error - overrun error signal 
 +      output wire rx_frame_error - frame error signal 
 +    Configuration 
 +      input wire [15:0] prescale - BAUD rate prescale value 
 +</​code>​ 
 + 
 +==== Description ==== 
 + 
 +The ''​uart''​ module is simply a wrapper around the ''​uart_rx''​ and ''​uart_tx''​ modules. ​  
 + 
 +===== uart_rx module ===== 
 + 
 +==== Signals and Parameters ​====
  
   * Parameters   * Parameters
     * ''​parameter DATA_WIDTH = 8''​ - define width of data bus and transferred words in bits     * ''​parameter DATA_WIDTH = 8''​ - define width of data bus and transferred words in bits
-  * Clock and reset+  * Clock and Reset
     * ''​input wire clk''​ - clock input     * ''​input wire clk''​ - clock input
     * ''​input wire rst''​ - reset input     * ''​input wire rst''​ - reset input
-  * AXI Stream Interface ​(TX) +  * AXI Stream Interface
-    * ''​input wire [DATA_WIDTH-1:​0] input_axis_tdata''​ - data input +
-    * ''​input wire input_axis_tvalid''​ - data valid input +
-    * ''​output wire input_axis_tready''​ - ready for data output +
-  * AXI Stream Interface (RX)+
     * ''​output wire [DATA_WIDTH-1:​0] output_axis_tdata''​ - data output     * ''​output wire [DATA_WIDTH-1:​0] output_axis_tdata''​ - data output
     * ''​output wire output_axis_tvalid''​ - data valid output     * ''​output wire output_axis_tvalid''​ - data valid output
Line 30: Line 64:
   * UART Interface   * UART Interface
     * ''​input wire rxd''​ - UART RXD input     * ''​input wire rxd''​ - UART RXD input
-    * ''​output wire txd''​ - UART TXD output 
   * Status   * Status
-    * ''​output wire tx_busy''​ - operation in progress signal +    * ''​output wire busy''​ - operation in progress signal 
-    * ''​output wire rx_busy''​ - operation in progress signal +    * ''​output wire overrun_error''​ - overrun error signal 
-    * ''​output wire rx_overrun_error''​ - overrun error signal +    * ''​output wire frame_error''​ - frame error signal
-    * ''​output wire rx_frame_error''​ - frame error signal+
   * Configuration   * Configuration
     * ''​input wire [15:0] prescale''​ - BAUD rate prescale value     * ''​input wire [15:0] prescale''​ - BAUD rate prescale value
  
-The ''​uart''​ module is simply a wrapper around the ''​uart_rx''​ and ''​uart_tx''​ modules.  ​+==== Description ====
  
-==== uart_rx ​module ====+The ''​uart_rx''​ module implements the UART receive function. ​ Bits received over the ''​rxd''​ pin are decoded and output on the AXI Stream interface. ​ The baud rate is determined by the ''​prescale''​ setting, which should be set to Fclk / (baud * 8).  ''​prescale''​ is a port and not a parameter so it can be changed at run time if necessary. ​ The ''​uart_rx''​ module also generates frame and overrun error signals. ​ The ''​frame_error''​ signal indicates that the stop bit was not received correctly, while the ''​overrun_error''​ signal indicates that a byte was received before the previous one was read, causing the older data byte to be overwritten. ​  
 + 
 +===== uart_tx ​module ​===== 
 + 
 +==== Signals and Parameters ​====
  
   * Parameters   * Parameters
Line 49: Line 85:
     * ''​input wire rst''​ - reset input     * ''​input wire rst''​ - reset input
   * AXI Stream Interface   * AXI Stream Interface
-    * ''​output ​wire [DATA_WIDTH-1:​0] ​output_axis_tdata''​ - data output +    * ''​input wire [DATA_WIDTH-1:​0] ​input_axis_tdata''​ - data input 
-    * ''​output ​wire output_axis_tvalid''​ - data valid output +    * ''​input wire input_axis_tvalid''​ - data valid input 
-    * ''​input wire output_axis_tready''​ - ready for data input+    * ''​output ​wire input_axis_tready''​ - ready for data output
   * UART Interface   * UART Interface
-    * ''​input wire rxd''​ - UART RXD input+    * ''​output ​wire txd''​ - UART TXD output
   * Status   * Status
     * ''​output wire busy''​ - operation in progress signal     * ''​output wire busy''​ - operation in progress signal
-    * ''​output wire overrun_error''​ - overrun error signal 
-    * ''​output wire frame_error''​ - frame error signal 
   * Configuration   * Configuration
     * ''​input wire [15:0] prescale''​ - BAUD rate prescale value     * ''​input wire [15:0] prescale''​ - BAUD rate prescale value
  
-==== uart_tx module ==== +===== AXI interface ​=====
- +
-  * ''​parameter DATA_WIDTH = 8''​ - define width of data bus and transferred words in bits +
-  * ''​input wire clk''​ - clock input +
-  * ''​input wire rst''​ - reset input +
-  * ''​input wire [DATA_WIDTH-1:​0] input_axis_tdata''​ - data input +
-  * ''​input wire input_axis_tvalid''​ - data valid input +
-  * ''​output wire input_axis_tready''​ - ready for data output +
-  * ''​output wire txd''​ - UART TXD output +
-  * ''​output wire busy''​ - operation in progress signal +
-  * ''​input wire [15:0] prescale''​ - BAUD rate prescale value +
- +
-==== AXI interface ====+
  
 The main interface to the user design is an AXI4-Stream interface that consists of the tdata, tvalid, and tready signals. ​ tready flows in the opposite direction. ​ tdata is considered valid when tvalid is high.  The destination will accept data only when tready is high.  Data is transferred from the source to the destination only when both tvalid and tready are high, otherwise the bus is stalled. The main interface to the user design is an AXI4-Stream interface that consists of the tdata, tvalid, and tready signals. ​ tready flows in the opposite direction. ​ tdata is considered valid when tvalid is high.  The destination will accept data only when tready is high.  Data is transferred from the source to the destination only when both tvalid and tready are high, otherwise the bus is stalled.
  
-=== AXI Stream Interface Example ===+==== AXI Stream Interface Example ​====
  
 two byte transfer with sink pause after each byte two byte transfer with sink pause after each byte