Proceedings of the Student FEI 2000, Brno 2000, pp

Similar documents
LAB #3 VHDL RECOGNITION AND GAL IC PROGRAMMING USING ALL-11 UNIVERSAL PROGRAMMER

Introduction to Programmable Logic Devices. John Coughlan RAL Technology Department Detector & Electronics Division

Using Xilinx ISE for VHDL Based Design

Quartus II Software Design Series : Foundation. Digitale Signalverarbeitung mit FPGA. Digitale Signalverarbeitung mit FPGA (DSF) Quartus II 1

Introduction. Jim Duckworth ECE Department, WPI. VHDL Short Course - Module 1

Modeling Registers and Counters

Modeling Latches and Flip-flops

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

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

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

Finite State Machine Design and VHDL Coding Techniques

VHDL GUIDELINES FOR SYNTHESIS

Digital Design with VHDL

RAPID PROTOTYPING OF DIGITAL SYSTEMS Second Edition

ECE 3401 Lecture 7. Concurrent Statements & Sequential Statements (Process)

Digital Systems Design! Lecture 1 - Introduction!!

Lecture 12: More on Registers, Multiplexers, Decoders, Comparators and Wot- Nots

Lab 1: Introduction to Xilinx ISE Tutorial

Gray Code Generator and Decoder by Carsten Kristiansen Napier University. November 2004

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

Implementation of Web-Server Using Altera DE2-70 FPGA Development Kit

Digital Circuit Design Using Xilinx ISE Tools

Design of Remote Laboratory dedicated to E2LP board for e-learning courses.

Lecture 8: Synchronous Digital Systems

Counters are sequential circuits which "count" through a specific state sequence.

Life Cycle of a Memory Request. Ring Example: 2 requests for lock 17

12. A B C A B C A B C 1 A B C A B C A B C JK-FF NETr

if-then else : 2-1 mux mux: process (A, B, Select) begin if (select= 1 ) then Z <= A; else Z <= B; end if; end process;

9/14/ :38

VHDL-Testbench as Executable Specification

State Machines in VHDL

Quartus II Introduction for VHDL Users

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

EXPERIMENT 8. Flip-Flops and Sequential Circuits

Module 3: Floyd, Digital Fundamental

Printed Circuit Board Design with HDL Designer

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

Digital Systems. Syllabus 8/18/2010 1

Introduction to Digital Design Using Digilent FPGA Boards Block Diagram / Verilog Examples

Asynchronous & Synchronous Reset Design Techniques - Part Deux

A CPLD VHDL Introduction

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

Step : Create Dependency Graph for Data Path Step b: 8-way Addition? So, the data operations are: 8 multiplications one 8-way addition Balanced binary

Digital Design and Synthesis INTRODUCTION

Hardware Implementation of the Stone Metamorphic Cipher

EC313 - VHDL State Machine Example

Using Altera MAX Series as Microcontroller I/O Expanders

On the use of programmable logic in FabLabs

Technical Aspects of Creating and Assessing a Learning Environment in Digital Electronics for High School Students

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

JTAG-HS2 Programming Cable for Xilinx FPGAs. Overview. Revised January 22, 2015 This manual applies to the HTAG-HS2 rev. A

CHAPTER 11: Flip Flops

AC : PRACTICAL DESIGN PROJECTS UTILIZING COMPLEX PROGRAMMABLE LOGIC DEVICES (CPLD)

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

A Verilog HDL Test Bench Primer Application Note

VHDL programmering H2

CPE 462 VHDL: Simulation and Synthesis

The 104 Duke_ACC Machine

INTRODUCTION TO DIGITAL SYSTEMS. IMPLEMENTATION: MODULES (ICs) AND NETWORKS IMPLEMENTATION OF ALGORITHMS IN HARDWARE

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)

CNC FOR EDM MACHINE TOOL HARDWARE STRUCTURE. Ioan Lemeni

FPGA Implementation of an Advanced Traffic Light Controller using Verilog HDL

AES (Rijndael) IP-Cores

Lenguaje VHDL. Diseño de sistemas digitales secuenciales

Asynchronous counters, except for the first block, work independently from a system clock.

Aims and Objectives. E 3.05 Digital System Design. Course Syllabus. Course Syllabus (1) Programmable Logic

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

Hardware and Software

Rotary Encoder Interface for Spartan-3E Starter Kit

Master s Project Report June, Venugopal Duvvuri Department of Electrical and Computer Engineering University Of Kentucky

Chapter 9 Latches, Flip-Flops, and Timers

ESP-CV Custom Design Formal Equivalence Checking Based on Symbolic Simulation

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

Contents COUNTER. Unit III- Counters

A New Paradigm for Synchronous State Machine Design in Verilog

Open Flow Controller and Switch Datasheet

Introduction to Digital System Design

NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY DO NOT COPY

MAX II ISP Update with I/O Control & Register Data Retention

The string of digits in the binary number system represents the quantity

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 16 Timing and Clock Issues

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

VHDL Reference Manual

A Second Undergraduate Course in Digital Logic Design: The Datapath+Controller-Based Approach

Cascaded Counters. Page 1 BYU

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute. 2nd (Spring) term 2012/2013

CMOS Binary Full Adder

(1) D Flip-Flop with Asynchronous Reset. (2) 4:1 Multiplexor. CS/EE120A VHDL Lab Programming Reference

GETTING STARTED WITH PROGRAMMABLE LOGIC DEVICES, THE 16V8 AND 20V8

Design of a High Speed Communications Link Using Field Programmable Gate Arrays

Optimising the resource utilisation in high-speed network intrusion detection systems.

Digitale Signalverarbeitung mit FPGA (DSF) Soft Core Prozessor NIOS II Stand Mai Jens Onno Krah

DEPARTMENT OF INFORMATION TECHNLOGY

Counters and Decoders

Implementation Details

Sistemas Digitais I LESI - 2º ano

ASYNCHRONOUS COUNTERS

Combinational Logic Design Process

Quartus II Introduction Using VHDL Design

VHDL Test Bench Tutorial

Transcription:

Gray counter in VHDL Ing. Ivo Viščor, 2 nd year of PhD study, (ivovi@isibrno.cz) worked out on the IREL FEE BUT Supervisor: Doc. Ing. Jaromír Kolouch, CSc. Abstract: This paper presents the simple structural description of the Gray counter with variable width in VHDL. Introduction Programmable logic devices (PLDs) and field programmable gate arrays (FPGAs) can be used to integrate large amounts of logic in a single IC. As the capacity of PLDs and FPGAs is grooving, designers can no longer use Boolean equations or gate-level descriptions to quickly and efficiently complete a design. The solution is VHDL. Very High Speed Integrated Circuits (VHSIC) Hardware Description Language (VHDL) became standard for designing with programmable logic devices and Application Specific Integrated Circuits (ASICs). VHDL was established as the IEEE 1706 standard in 1987 [1]. The main advantage of VHDL is portability of code across vendors and devices. The main disadvantage is the loosing control of gate level circuit implementation, which is the penalty for portability. Gray code is the code with only one bit transition between adjacent words. The direct description of Gray counter is based on the equation extraction from the truth table. Such solution of n-bit counter demands 2 n-2 product terms [2]. Implementation may be difficult for greater width of counter. The alternative is the using of the auxiliary bit [2]. This bit is changed every clock period and corresponds to bit 0 of a binary counter. With assumption that the auxiliary bit extends Gray code word to the right, the particular bit is changed whenever the less significant bits create word 1,0, 0. The exception is MSB which is changed in addition by word 0, 0. Another description of Gray counter use conversion of Gray code to binary code. After the increment is done in binary code, the back conversion follows. Description of the Gray counter in VHDL The forms of VHDL circuit design are: behavioural description (e.g. if..than statement), dataflow description (e.g. Boolean equations) and structural description (netlist of blocks). The good VHDL synthesis tools find near optimal solution regardless of the form of description [2]. Although all of the forms are used in proposed description, the structural description is the most important. The main requirements on the design were code simplicity and adjustable width of the counter. The design is based on the auxiliary bit generation, series of one-bit blocks and glue logic for MSB generation. The basic block of the counter is one-bit block (Fig.1.). This block is encapsulated into a package and used repeatedly in top-level module gray_n (Fig.2.). The top-level module is figured with counter width parameter of 3. The one-bit block generates the particular bit of Gray code from input signals qin and zin in a T-type flip-flop (Fig.1). The qin is connected to the less significant bit in the chain. Second generated signal is. The represents expression: All the less significant bits (including auxiliary bit) are zero. Each one-bit block shares the same asynchronous reset and clock signals (Fig.2.). The q(1) to q(3) outputs are 1

valuable bits of the Gray code. The D-type flip-flop generates q(0) signal which represents the auxiliary (parity) bit. The MSB reset at the end of the cycle is assured by the OR gate. Q T & qin CLK RST & zin arst clk Fig.1. Schematic of one-bit block package gray_n q(3) q(2) q(1) q(0) z(3) QOUT QIN ZOUT ZIN qx 1 QOUT QIN z(2) z(1) ZOUT ZIN QOUT ZOUT ARST CLK ARST CLK ARST CLK ZIN z(0) 1 Q\ D Q CLK SET async_rst clock Fig.2. Schematic of top-level module gray_n (width = 3) Although pictured schematics provide sufficient information to write the VHDL code, it is not easy to fulfil the VHDL syntax, especially for the beginners. The great helper is the VHDL help [3]. Full listing of code exceeds size of this contribution and will be presented on the poster. Fig.3. Functional simulation of the VHDL code in the ModelSimXE Starter tool (width = 3) 2

Described VHDL code was successfully tested in two simulators. The Warp 4.0 software provides only postlayout ( timing ) simulation. The VHDL code had to be fitted to a particular device first. The Webpack from Xilinx on the opposite side provides only the source code ( functional ) simulation. This simulation tool is free licensed and is restricted up to 500 rows of code. The snapshot from the functional simulation of the Gray counter is figured at Fig.3. Implementation of the Gray counter The implementation of the proposed VHDL code (Tab.1.) illustrates the fact, that small counter designs are only I/O pin limited, whilst large counters are device architecture limited. No speed performance and compile options was explored. These results are in no way the device benchmarks, the far more complex and definite benchmarks failed (e.g. PREP [1]). Type Part # Description Available I/O Package Max. width of Note counter (gray_n) FPGA C388P 8k gates 172 144 TQFP 170 1) CPLD C375 128 MCells 128 160 TQFP 34 1) PLD 22V10 10 MCells 10 24 DIP 9 1), 3) CPLD XC95144XL 144 MCells 117 144 TQFP 103 2) CPLD XCR3320 320 MCells 112 160 TQFP 72 2) CPLD XCR3032A 32 MCells 28 (32) 44 TQFP 27 2), 4) Note: 1) Vendor: CYPRESS, software: Warp 4.0. 2) Vendor: XILINX, software: WebPack (May 2000). 3) Modified VHDL code without asynchronous reset or without auxiliary bit pinout. 4) Dedicated pins for JTAG ISP lowers available I/O pins by 4. Tab. 1. Examples of the Gray counter implementation Conclusion The presented VHDL design of the Gray counter with variable width is as simple as possible and uses all main technique of VHDL programming. The design is therefore suitable for education purposes. Implementation examples demonstrate fact, that even the VHDL software at no charge (Webpack) can be applicable for the first VHDL experiments. Acknowledgement This work was supported by the grant no. 102/00/1262 of the Grant Agency of the Czech Republic. References [1] Skahill, K.: VHDL for programmable logic. Menlo Park, CA: Addison-Wesley Publishing Company, 1996 [2] Kolouch, J.: Čítače pracující v Grayově kódu realizované v obvodech PLD. Brno: IREL FEE BUT, 1999 [3] VHDL Language Reference Guide, ver. 1.06., windows help file, 1998 3

Appendix A: VHDL code listing of the one-bit block () -- File:.vhd -- One bit block for the Gray counter gray_n.vhd -- 2/2000 IVOVI -- : One bit output of the counter -- : 1, if all the less significant bits are zero PACKAGE pkg IS COMPONENT PORT( arst, clk, qin, zin : IN STD_LOGIC; END COMPONENT; END pkg; ENTITY IS PORT( arst, clk, qin, zin : IN STD_LOGIC; END ; ARCHITECTURE arch OF IS PROCESS(arst, clk) IF arst='1' THEN <= '0'; ELSIF clk'event AND clk='1' THEN <= XOR (qin AND zin); END IF; END PROCESS; <= zin AND NOT qin; END arch; 4

Appendix B: VHDL code listing of the top-level of Gray counter (gray_n) -- File: gray_n.vhd -- Gray counter with variable width (generic width) -- 2/2000 IVOVI ENTITY gray_n IS GENERIC(width: INTEGER:=3); PORT( async_rst, clock : IN STD_LOGIC; q : INOUT STD_LOGIC_VECTOR(width DOWNTO 0)); END gray_n; ARCHITECTURE archgray_n OF gray_n IS COMPONENT PORT( arst, clk, qin, zin : IN STD_LOGIC; END COMPONENT; -- inner interconnection of 1-bit sections SIGNAL z : STD_LOGIC_VECTOR(width DOWNTO 0); -- auxiliary signal for MSB SIGNAL qx : STD_LOGIC; -- less significant bits create_lsb: FOR i IN 1 TO width-1 GENERATE createbit: PORT MAP( async_rst, clock, q(i-1), z(i-1), q(i), z(i)); END GENERATE; -- most significant bit create_msb: PORT MAP( async_rst, clock, qx, z(width-1), q(width), z(width)); -- auxiliary signal for MSB qx <= q(width-1) OR q(width); -- parity bit generation PROCESS(async_rst, clock) IF async_rst='1' THEN q(0) <= '1'; ELSIF clock'event AND clock='1' THEN q(0) <= NOT q(0); END IF; END PROCESS; z(0) <= '1'; END archgray_n; 5