Description
This project provides a full-function UART. The UART provides direct support for a two-wire or a four-wire RS-232 style full-duplex serial interface, but it also provides direct support for a half-duplex RS-485 serial interface. In the RS-232 mode, automatic flow control can be enabled, and the UART will assert RTS when data is available to transmit and wait for CTS to be returned before the transmitter is enabled. In the RS-485 mode, the drive enable of the RS-485 driver is asserted and deasserted automatically.
In both operating modes, the UART supports the use of receive timeouts, RTO. In the RS-485 mode, the RTO function will also inhibit the transmitter until the timeout is asserted. This feature allows easy use of the UART with industrial automation protocols such as Modbus RTU and Profibus that specify minimum inter-packet gaps. The RTO unit of the UART provides a means by which the inter-packet gap can be programmed in multiples of the serial frame size. In other words, the UART RTO unit is programmed in character times to delay, and the programmed frame size is used in the implementation of the delay. For example, if a the serial format is set as 8E1, i.e. Profibus, then the serial frame is 11 bits in length: start, 8 data, 1 parity, and 1 stop. An inter-packet delay of 3 character times is set for the RTO count, so the total delay from the trailing edge of the last received character's stop bit to the leading edge of the start bit of the next transmit character is 33 bit times. This UART automatically sets the frame size to 11 and then uses a counter to generate count down pulses to a second counter which is set for 3. The result is an accurate 33 bit time delay.
The UART also allows independently set FIFO depths for the transmit and receive FIFOs. Interrupts based on various FIFO depth thresholds can also be set so that the interrupt rate can be controlled by the application. Interrupts can be enabled for various conditions: Receive Timeout, Receive FIFO Half Full, Transmit FIFO Half Empty, and Transmit FIFO Empty. The values used for generating FIFO half full interrupts are actually programmable. External user-supplied logic is required to map the interrupt requests onto the interrupt service bus of the application in which the UART is being used; the UART interrupt status registers are available over the communications interface, but are also outputs of the module.
Full documentation of the UART is available in the descriptions provided in SSP_UART module header and those of the functional sub-modules which are used to construct it. A detailed specification and user's guide is included in the Docs section of the SVN repository. Finally, rudimentary testbenches for the SSP_UART and critical sub-modules are also included.
Updates
Updated comments and removed dead code.
Synthesis/PAR Results
The SSP_UART is used in a number of commercial projects. (A demonstration of its use in a system-on-chip project is contained in the M16C5x project elsewhere on opencores.org.) As indicated above, it is a full function UART with capabilities similar to those of a 16C550 UART, but extended with independently configurable FIFO depths for transmit and receive, an interface specifically designed so that it can function as Synchronous Serial Peripheral to an NXP LPC 21xx ARM microcontroller, and additional test and monitoring capabilities.
The synthesis/PAR results for the UART provided in this section provide only typical results with regards to size and speed. These characteristics of the SSP_UART are very much dependent on the synthesis and PAR settings of the application/system-on-chip in which the module is being instantiated. For the particular values shown below, the FIFO depths are set to 64 bytes for both the transmit and receive signal paths. Furthermore, the FIFOs are implemented using the DPSFmcCE module, also found here on opencores.org, which uses distributed RAM in a dual-port configuration. If there are sufficient block RAM resources, and LUTs are in short supply, the DPSFmnCE FIFOs can be replaced with block RAM FIFOs. The BRSFmnCE project here on opencores.org is an example of a compatible FIFO implementation that uses block RAMs rather than distrubuted LUT RAM for the FIFO memory.
Module Level Utilization
Module Level Utilization | Sat Nov 2 11:56:38 2013 |
Module | Partition | Slices | Slice Reg | LUTs | LUTRAM | BRAM | MULT18X18 | BUFG | DCM |
[-] SSP_UART/ |
| 217/477 | 81/255 | 195/543 | 0/136 | 0/0 | 0/0 | 2/2 | 0/0 |
BRG |
| 16/16 | 17/17 | 24/24 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
[-] INT |
| 6/24 | 4/23 | 5/11 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
FE1 |
| 4/4 | 4/4 | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
FE2 |
| 2/2 | 3/3 | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RE1 |
| 3/3 | 3/3 | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RE2 |
| 3/3 | 3/3 | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RE3 |
| 3/3 | 3/3 | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RE4 |
| 3/3 | 3/3 | 1/1 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RCV |
| 43/43 | 34/34 | 59/59 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RED1 |
| 4/4 | 4/4 | 2/2 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RED2 |
| 4/4 | 4/4 | 2/2 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RED3 |
| 5/5 | 4/4 | 2/2 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RED4 |
| 4/4 | 4/4 | 2/2 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RED5 |
| 4/4 | 4/4 | 2/2 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
RF1 |
| 55/55 | 20/20 | 93/93 | 72/72 | 0/0 | 0/0 | 0/0 | 0/0 |
TF1 |
| 49/49 | 20/20 | 85/85 | 64/64 | 0/0 | 0/0 | 0/0 | 0/0 |
TMR |
| 21/21 | 17/17 | 27/27 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
XMT |
| 31/31 | 23/23 | 39/39 | 0/0 | 0/0 | 0/0 | 0/0 | 0/0 |
Timing Constraints
Met |
Constraint |
Check | Worst Case Slack |
Best Case Achievable |
Timing Errors |
Timing Score |
Yes |
Autotimespec constraint for clock net Clk_BUFGP |
SETUP/HOLD |
N/A / 0.726ns |
5.547ns |
N/A / 0 |
0/0 |
Yes |
Autotimespec constraint for clock net SSP_SCK_BUFGP |
SETUP/HOLD |
N/A / 1.244ns |
5.415ns |
N/A / 0 |
0/0 |
Xilinx Design Summary
M16C5x Project Status (11/02/2013 - 10:20:16) |
Project File: |
M16C5x.ise |
Current State: |
Placed and Routed |
Module Name: |
SSP_UART |
|
|
Target Device: |
xc3s50a-4vq100 |
|
|
Product Version: |
ISE 10.1.03 - Foundation |
|
All Signals Completely Routed |
Design Goal: |
Balanced |
|
All Constraints Met |
Design Strategy: |
Xilinx Default (unlocked) |
|
0 |
M16C5x Partition Summary | [-] |
No partition information was found. |
Device Utilization Summary | [-] |
Logic Utilization | Used | Available | Utilization | Note(s) |
Number of Slice Flip Flops |
255 |
1,408 |
18% |
|
Number of 4 input LUTs |
542 |
1,408 |
38% |
|
Logic Distribution | | | | |
Number of occupied Slices |
352 |
704 |
50% |
|
Number of Slices containing only related logic |
352 |
352 |
100% |
|
Number of Slices containing unrelated logic |
0 |
352 |
0% |
|
Total Number of 4 input LUTs |
543 |
1,408 |
38% |
|
Number used as logic |
406 |
|
|
|
Number used as a route-thru |
1 |
|
|
|
Number used for Dual Port RAMs |
136 |
|
|
|
Number of bonded IOBs |
Number of bonded |
44 |
68 |
64% |
|
Number of BUFGMUXs |
2 |
24 |
8% |
|
Date Generated: 11/02/2013 - 10:20:16