Manchester Encoder-Decoder for Xilinx CPLDs



Similar documents
AN2358. Manchester Decoder Using PSoC 1. Introduction. Contents. Manchester Code Principle

How To Encode Data From A Signal To A Signal (Wired) To A Bitcode (Wired Or Coaxial)

Enhancing High-Speed Telecommunications Networks with FEC

a8251 Features General Description Programmable Communications Interface

White Paper Utilizing Leveling Techniques in DDR3 SDRAM Memory Interfaces

SDLC Controller. Documentation. Design File Formats. Verification

Managing High-Speed Clocks

Using Xilinx CPLDs to Interface to a NAND Flash Memory Device

Module 3: Floyd, Digital Fundamental

PLL Dynamic Reconfiguration Author: Karl Kurbjun and Carl Ribbing

5V Tolerance Techniques for CoolRunner-II Devices

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

Modeling Registers and Counters

Physical Layer, Part 2 Digital Transmissions and Multiplexing

Figure 1 FPGA Growth and Usage Trends

Source-Synchronous Serialization and Deserialization (up to 1050 Mb/s) Author: NIck Sawyer

A New Paradigm for Synchronous State Machine Design in Verilog

An Interpretation of MIL-STD-1553B

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

How To Fix A 3 Bit Error In Data From A Data Point To A Bit Code (Data Point) With A Power Source (Data Source) And A Power Cell (Power Source)

NTE2053 Integrated Circuit 8 Bit MPU Compatible A/D Converter

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Using Altera MAX Series as Microcontroller I/O Expanders

Below is a diagram explaining the data packet and the timing related to the mouse clock while receiving a byte from the PS-2 mouse:

Cascaded Counters. Page 1 BYU

MicroMag3 3-Axis Magnetic Sensor Module

Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Implementing an In-Service, Non- Intrusive Measurement Device in Telecommunication Networks Using the TMS320C31

USER GUIDE EDBG. Description

AN3998 Application note

Memory Elements. Combinational logic cannot remember

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

Timing Errors and Jitter

Lecture-3 MEMORY: Development of Memory:

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

RS-485 Protocol Manual

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

Flexible Active Shutter Control Interface using the MC1323x

Aurora 8B/10B Protocol Specification. SP002 (v2.3) October 1, 2014

Objectives. Basics of Serial Communication. Simplex vs Duplex. CMPE328 Microprocessors (Spring ) Serial Interfacing. By Dr.

DS2155 T1/E1/J1 Single-Chip Transceiver

Finite State Machine Design and VHDL Coding Techniques

Wiki Lab Book. This week is practice for wiki usage during the project.

A Verilog HDL Test Bench Primer Application Note

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

2. What is the maximum value of each octet in an IP address? A. 128 B. 255 C. 256 D. None of the above

Data Communications & Networks. Session 3 Main Theme Data Encoding and Transmission. Dr. Jean-Claude Franchitti

MICROPROCESSOR. Exclusive for IACE Students iacehyd.blogspot.in Ph: /422 Page 1

8051 Flash Microcontroller. Application Note. A Digital Thermometer Using the Atmel AT89LP2052 Microcontroller

Counters and Decoders

ECE 451 Verilog Exercises. Sept 14, James Barnes

Reading User Data from Configuration PROMs

PCM Encoding and Decoding:

TIP-VBY1HS Data Sheet

CHAPTER 11: Flip Flops

PART B QUESTIONS AND ANSWERS UNIT I

DATA COMMUNICATION (Basics of data communication, OSI layers.)

Modeling Latches and Flip-flops

Design and Verification of Nine port Network Router

INTEGRATED CIRCUITS I CODE SLI. Smart Label IC SL2 ICS20. Functional Specification. Product Specification Revision 3.1 Public. Philips Semiconductors

COMPUTER HARDWARE. Input- Output and Communication Memory Systems

Post-Configuration Access to SPI Flash Memory with Virtex-5 FPGAs Author: Daniel Cherry

Lab #5: Design Example: Keypad Scanner and Encoder - Part 1 (120 pts)

Decimal Number (base 10) Binary Number (base 2)

Technical Manual. FAN COIL CONTROLLER COOLING or HEATING ANALOG or PWM Art A

Counters. Present State Next State A B A B

DESCRIPTION FEATURES BLOCK DIAGRAM. PT2260 Remote Control Encoder

Elettronica dei Sistemi Digitali Costantino Giaconia SERIAL I/O COMMON PROTOCOLS

Microprocessor & Assembly Language

Simplifying System Design Using the CS4350 PLL DAC

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Digital Transmission (Line Coding)

Token Ring and. Fiber Distributed Data Interface (FDDI) Networks: Token Ring and FDDI 1

Measurement and Analysis Introduction of ISO7816 (Smart Card)

74F168*, 74F169 4-bit up/down binary synchronous counter

MicroBlaze Debug Module (MDM) v3.2

plc numbers Encoded values; BCD and ASCII Error detection; parity, gray code and checksums

Systems I: Computer Organization and Architecture

Loop Bandwidth and Clock Data Recovery (CDR) in Oscilloscope Measurements. Application Note

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

1. Overview. 2. F-bit Utilization

11. High-Speed Differential Interfaces in Cyclone II Devices

Streaming Lossless Data Compression Algorithm (SLDC)

Clearing the Way for VoIP

Registers & Counters

Design Note DN002. Practical Sensitivity Testing By Morten Engjom. Keywords. 1 Introduction. Receiver Testing Sensitivity

DDS. 16-bit Direct Digital Synthesizer / Periodic waveform generator Rev Key Design Features. Block Diagram. Generic Parameters.

Arbitration and Switching Between Bus Masters

8B/10B Coding 64B/66B Coding

Lecture 3: Signaling and Clock Recovery. CSE 123: Computer Networks Stefan Savage

The Common Test Patterns described below are used to test DS1 interfaces upon initial installation and after repair.

Finite State Machine. RTL Hardware Design by P. Chu. Chapter 10 1

ASYNCHRONOUS COUNTERS

Rotary Encoder Interface for Spartan-3E Starter Kit

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

Making Basic Measurements. Publication Number August Training Kit for the Agilent Technologies Series Logic Analysis System

Transcription:

Application Note: CoolRunner CPLDs R XAPP339 (v.3) October, 22 Manchester Encoder-Decoder for Xilinx CPLDs Summary This application note provides a functional description of VHDL and Verilog source code for a Manchester Encoder Decoder. The reasons to use Manchester code are discussed. The code can be compiled into either the Xilinx XC9572, XCR364XL, or XC2C64 CPLD. To obtain the VHDL (or Verilog) source code described in this document, go to section VHDL (or Verilog) Code Download, page 6 for instructions. Introduction NRZ and Manchester code defined Manchester code is defined, and the advantages relative to Non-Return to Zero code are given. Target applications of Manchester code are discussed. Verilog and VHDL implementations of the Manchester Encoder-Decoder are available from the Xilinx website. The decoder and encoder are simulated using Verilog and VHDL testbenches. The encoder-decoder function is given in the context of more familiar serial communication circuits as UARTs, with the intent to illustrate some of the issues in designing serial communication functions in CPLDs. Non-return to Zero (NRZ) and Manchester codes are used in digital systems to represent the binary values "" and "". Figure defines how NRZ and Manchester code represent binary values. NRZ is the code most often used. In NRZ, a logic "" is represented as a high level throughout a data cell, and a logic "" is represented by a low level. Manchester code represents binary values by a transition rather than a level. The transition occurs at mid-bit, with a low-to-high transition used to represent a logic "", and a high-to-low to represent a logic "". Depending on the data pattern, there may be a transition at the cell boundary (beginning/end). A pattern of consecutive "s" or "s" results in a transition on the cell boundary. When the data pattern alternates between "" and "", there is no transition on the cell boundary. In NRZ, only one level/data cell is required, while in Manchester, two levels are required. A DC component exist in NRZ when contiguous "s" or contiguous "s" are transmitted. When the data pattern alternates between "s" and "s", the frequency response is equal to / 2 the clock rate.the frequency response for NRZ then ranges from DC to clock/2. The frequency response of Manchester code ranges from clock/2, occurring when the data pattern is alternating "s" and "s", to clock, which occurs when the data pattern is consecutive "s" or "s". The frequency response of Manchester is a single octave vs. 5- octaves for NRZ. 22 Xilinx, Inc. All rights reserved. All Xilinx trademarks, registered trademarks, patents, and further disclaimers are as listed at http://www.xilinx.com/legal.htm. All other trademarks and registered trademarks are the property of their respective owners. All specifications are subject to change without notice. NOTICE OF DISCLAIMER: Xilinx is providing this design, code, or information "as is." By providing the design, code, or information as one possible implementation of this feature, application, or standard, Xilinx makes no representation that this implementation is free from any claims of infringement. You are responsible for obtaining any rights you may require for your implementation. Xilinx expressly disclaims any warranty whatsoever with respect to the adequacy of the implementation, including but not limited to any warranties or representations that this implementation is free from claims of infringement and any implied warranties of merchantability or fitness for a particular purpose. XAPP339 (v.3) October, 22 www.xilinx.com

R Manchester Encoder-Decoder for Xilinx CPLDs Data Cell 2 3 4 5 Clock NRZ Manchester X339 327 Figure : Binary Values for NRZ and Manchester Codes Relative Advantages of NRZ/Mancheste r Code Two advantages of NRZ are that it does not require encoding/decoding, and it makes the most efficient use of a communication channels bandwidth. Manchester requires a modulation rate twice that of NRZ to transmit the same amount of information. This can be important in bandwidth limited communication channels. On the other hand, the receiver of NRZ requires a true DC response. Since, Manchester code has no DC component, it can be transformer coupled. The mid-bit transition in Manchester code provides a self-clocking feature of code. This can be used to improve synchronization over non-self clocking codes as NRZ. The transition also allows additional error detection to be done with relatively little circuitry. Synchronization In serial communication, clocks are used to define the size/boundary of a data cell. With a nonself clocking code, since the clock and data are distinct, there can be skew between clock and data. In magnetic media applications, skew may be due to variations in the tape drive speed. In serial communication, skew results from differences in the transit delay between clock and data lines on long serial links. One design objective in serial communication is to decode data correctly in the presence of noise, or an otherwise degraded signal. Signals have non-zero rise and fall times during which the signal value is indeterminate. In a receiver, sampling, or the decoding of the value of a signal, should occur as far from the signal transition as possible. Sampling at the time furthest from the signal transition is known as center sampling. A UART is a serial communication circuit which uses NRZ code. To sample at mid-bit of the data cell, the receiver in a UARTs uses a local clock which is 6X the received data rate. The data format of a UART consists of a high idle state, and a character format consisting of a start bit, five to eight data bits, optional parity, and one or more stop bits. After detecting the edge of a start bit, the receiver validates the start bit by counting the 6X clock to 8 and verifying that it is still Low. Subsequent center samples are reached by counting the 6X clock to 6. In a Manchester decoder, center sampling occurs at points /4 and 3/4 through the cell, since transitions occur always at mid-bit and sometimes on the cell boundary. In addition to center sampling, the receiver in a Manchester decoder does clock recovery. Since Manchester has transitions at least once each data cell, the receiver has known references to which it can resynchronize at each bit. 2 www.xilinx.com XAPP339 (v.3) October, 22

Manchester Encoder-Decoder for Xilinx CPLDs R To synchronize to an incoming serial data stream, the receiving ciruitry in a Manchester decoder can use a digital phase lock loop or a counter algorithm. Digital phase lock loops are most often used in networks with a ring topology while counter algorithms are common in point to point links. An example of a counter algorithm which uses a 6x clock is:. After receiving the initial transition on manchester data in, count the 6x clock to 4 and sample. The count of 4 is known as end count. At this time, end count is /4 through the data cell. 2. Reset the counter to. Begin counting the 6x clock with an end count of 8, and sample. If there is a transition on manchester data, reset the counter and go to (). When initialized correctly to the manchester data, this algorithm causes the counter to use an end count equal to 4 when consecutive "s" or "s" are transmitted, and an end count equal to 8 when alternating "s" and "s". In summary, UARTs synchronize on a character basis while MEDs synchronize on a bit basis. In a UART, the timing jitter for the each bit in the character is cumulative until the end of the character. MEDs resynchronize at each bit, or at least once each bit. Error Detection The most commonly used error detection schemes in serial communication are parity and cyclic redundancy check codes. When Manchester code is used, a small amount of additional circuitry can detect bit errors. Figure 2 illustrates how the mid-bit transitions of Manchester code allow error detection. Figure 2 shows four rows of transmitted data, with the first row the valid Manchester representation for a logic "". The three lower rows are waveforms of a corrupted form of the first row, and are erroneously transmitted data. When Manchester data is shifted in serially into a shift register in the decoder, an exclusive OR can monitor for different values on each side of the data cell (since there is a mid-bit transition) With this error detection, an error is undetected only if each half of a data cell transitions from its original state. X339_2_ Figure 2: Manchester Code Mid-bit Transitions XAPP339 (v.3) October, 22 www.xilinx.com 3

R Manchester Encoder-Decoder for Xilinx CPLDs Manchester Encoder/ Decoder Functionality The functions of the encoder section of the MED include a microprocessor interface, parallel to serial conversion, frame generation, and NRZ to Manchester encoding. This circuitry can run very fast since it does not require a high-frequency clock. The frame format used is similar to that of a UART. The Manchester decoder limits the maximum frequency of operation of the MED, since it uses a high-frequency clock. The receiver circuitry is more complex, since clock recovery and center sampling is done. Additional receiver functions are frame detection, decoding of Manchester to NRZ, serial to parallel conversion, and a microprocessor interface. Manchester Decoder The mdi and mdi2 registers (Table ) have decoding circuitry which detects an incoming edge on mdi and activates the clkx_enable. The clkx_enable signal is used as a clock enable for various registers clocked by the clkx clock. This significantly reduces power consumption when data is not being received. The no_bits_rcvd keeps track of the number of bits received and sequences the decoder through its operations. To vary the word size, change the value of no_bits_rcvd. The decoder does clock recovery using the first variable, clkdiv register, and sample signal.the Manchester data is decoded at the sample signal. Table : Manchester Decoder Pinout Functionality Signal Direction Function rst Input Resets clkx, no_bits_rcvd, nrz registers clk6x Input 6x clock input used as reference for clock recovery, center sampling mdi Input Serial manchester data input dout[7:] Output Parallel NRZ data bus out mdi, mdi2 Internal Internal registers used to detect edge on mdi no_bits_rcvd Internal Controls word size and sequences decoder through operations clkx_enable Internal Enables x clock upon receipt of a word clkx Internal Internal x clock sample Internal Determines time at which the receiver is to decode data first Internal Variable used by the counter to determine end count data_ready Output Status signal indicating data is present on the data bus dout. rdn Input Control signal initiates a read operation The following should be verified from running a simulation.. The clkx_enable signal is High upon receipt of data on mdi, and Low during the idle state of the line. 2. NRZ is all "s" for first byte, all "s" second byte, alternating data third byte (not visible) 3. A read operation on rdn resets the data_ready status signal. The simulation waveform shows the center sampling done by the manchester decoder shows the sample pulse occurring midway between the transitions on the mdi2 signal. 4 www.xilinx.com XAPP339 (v.3) October, 22

Manchester Encoder-Decoder for Xilinx CPLDs R Manchester Encoder Table 2 defines the Manchester encoder pinout functionality. The following should be verified in a simulation.. The pattern on manchester data out (mdo) when input data is consecutive "s" (ff), and again when input data is alternating "s" and "s" (aa). 2. The ready status signal goes High after word is transmitted, and is reset by a strobe on wr. Table 2: Manchester Encoder Pinout Functionality Pin/signal Direction Function din[7:] Input Input data bus clk Input Clock wr Input Control signal input used to strobe data into the buffer register through din[7:] mdo Output Serial Manchester data out rst Input Resets mdi, mdi2, data[7:], clk, ready registers ready Output Status signal indicating the encoder can accept data. Other Manchester Encoder Decoder Functions The functions discussed in the remainder of this application note can be used in addition to or in place of those described earlier. They include: Sync pulse and manchester error detection Adding a buffer register to the decoder Sync pulse and manchester error detection The design above uses a frame format similar to that of a UART. Additional noise immunity can be provided by substituting a 3-bit wide sync pulse for the -bit start bit. The sync pulse used in this section is -/2 bits at one level followed by -/2 bits at the opposite level. The reason for allowing either polarity (High/Low or Low/High) is that it provides a very efficient method for the transmitter and receiver to distinguish between a command and data. Since the 3-bit wide pattern is a relatively long pattern without a valid Manchester, and one which is unlikely to occur randomly, the decoder is unlikely to start erroneously. When this pattern is detected, a -bit register md is used. The Manchester data in (mdi) input is routed in serially into the -bit md register, which is clocked by a 2X clock clk2x. There is pattern detection circuitry monitoring md[9:]. Since md is clocked by clk2x, the detection circuitry is actually continuously monitoring 5-bit data patterns. In the scheme given below, the pattern detection asserts the sync_ pulse signal if the 3-bit wide sync pulse is followed by two valid Manchester bits. The pulse on sync_pulse can trigger the decode operation. XAPP339 (v.3) October, 22 www.xilinx.com 5

R Manchester Encoder-Decoder for Xilinx CPLDs VHDL (or Verilog) Code Download VHDL (or Verilog) source code and test benches are available for this design. THE DESIGN IS PROVIDED TO YOU "AS IS". XILINX MAKES AND YOU RECEIVE NO WARRANTIES OR CONDITIONS, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, AND XILINX SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, NON- INFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. This design has not been verified on hardware (as opposed to simulations), and it should be used only as an example design, not as a fully functional core. XILINX does not warrant the performance, functionality, or operation of this Design will meet your requirements, or that the operation of the Design will be uninterrupted or error free, or that defects in the Design will be corrected. Furthermore, XILINX does not warrant or make any representations regarding use or the results of the use of the Design in terms of correctness, accuracy, reliability or otherwise. XAPP339 - http://www.xilinx.com/products/xaw/coolvhdlq.htm Revision History The following table shows the revision history for this document. Date Version Revision 3/27/. Initial Xilinx release. 4/7/. Added VHDL Code Download link. //.2 Changed Figure 2 levels 3 and 4. //2.3 Minor revisions 6 www.xilinx.com XAPP339 (v.3) October, 22