OK-CMPE-30121-INTRODUCTION-TO-HARDWARE-DESCRIPTION-LANGUAGE.pdf

Full Transcript

POLYTECHNIC UNIVERSITY OF THE PHILIPPINES College of Engineering DEPARTMENT OF COMPUTER ENGINEERING CMPE30121 INTRODUCTION TO HARDWARE DESCRIPTION LANGUAGE (HDL) DR. ARVIN R. DE LA...

POLYTECHNIC UNIVERSITY OF THE PHILIPPINES College of Engineering DEPARTMENT OF COMPUTER ENGINEERING CMPE30121 INTRODUCTION TO HARDWARE DESCRIPTION LANGUAGE (HDL) DR. ARVIN R. DE LA CRUZ /CpE/CMPE300121 Page 1 of 62 POLYTECHNIC UNIVERSITY OF THE PHILIPPINES College of Engineering DEPARTMENT OF COMPUTER ENGINEERING Table of Contents Title Page 1 Table of Contents 2 Module 1 Digital Systems, FPGAs and the Design Flow 3 Module 2 HDL Based Designs 11 Module 3 Hierarchical Design 17 Module 4 Multiplexer and Demultiplexer 21 Module 5 Code Converters 24 Module 6 Sequential Circuits, Latches and Flip-Flops 31 Module 7 Synthesis of Finite State Machines 38 Module 8 Using Finite State Machines as Controllers 43 Module 9 More on Processes and Registers 49 Module 10 Arithmetic Circuits 53 Module 11 Writing Synthesizable VHDL Code for FPGAs 58 Module 12 Project Design and Development 61 Suggested Readings and References 62 A. Readings and References B. Online Resources C. Course Grading System /CpE/CMPE300121 Page 2 of 62 POLYTECHNIC UNIVERSITY OF THE PHILIPPINES College of Engineering DEPARTMENT OF COMPUTER ENGINEERING Module 1 Digital Systems, FPGAs and the Design Flow  Digital Systems, Field Programmable Gate Array, FPGA Internal Organization, Configurable Logic Block, Electronic Design Automation and the FPGA Design Flow, FPGA Devices and Platforms  Writing Software for Microprocessors and VHDL Code for FPGAs, and Logic Gates Learning Outcomes:  Describe the FPGA technology and the basic logic gates operation;  Design a logic circuit using a schematic editor tool;  Simulate and test a digital circuit;  Explain the basic flow of an Electronic Design Automation (EDA) tool. Introduction This module introduces the target technology used in the laboratory sessions, and provides a step-by-step guide for the design and simulation of a digital circuit. At the end of these modules, the reader should be able to: have a basic understanding of the FPGA technology (internal blocks, applications); understand the basic logic gates operation; design a logic circuit using a schematic editor tool; simulate and test a digital circuit; understand the basic flow of an Electronic Design Automation (EDA) tool. A signal, as referred to in electrical engineering, communications and signal processing, represents a function which gives information about specific phenomena from the physical world. In other words, signals provide information about the variation in time and space of the physical systems. In mathematical terms, signals can be defined as continuous-valued or discrete-valued functions which correspond to the analog or the digital signals, respectively. A digital system is composed of interconnected modules designed to handle digital (discrete) signals in order to analyze and describe specific physical phenomena. Digital systems are composed of two basic components: Datapath and Control Unit. As shown in Fig. 1.1, the control unit has as its main function the generation of control signals to the datapath unit (also known as ‗‗operational block‘‘).The control signals ‗‗command‘‘ the desired operations in the datapath. Furthermore, the control unit may receive control inputs from the external environment; for instance, it can be a simple ‗‗start‘‘ or even an operation code (‗‗opcode‘‘ in microprocessors). Finally, this unit can also generate one or more output control signals to communicate with other digital systems. The datapath unit performs operations on data received, usually, from the external environment. The operations are performed in one or more steps, where each step takes a clock cycle. The datapath generates ‗‗status‘‘ signals (sometimes also called as ‗‗flags‘‘) that are used by the control block to define the sequence of operations to be performed. /CpE/CMPE300121 Page 3 of 62 POLYTECHNIC UNIVERSITY OF THE PHILIPPINES College of Engineering DEPARTMENT OF COMPUTER ENGINEERING Fig. 1.1 Digital system Examples of datapath blocks include:  Interconnection network—wires, multiplexers, buses, and tri-state buffers;  Functional units—adders, subtractors, shifters, multipliers, and Arithmetic and  Logic Unit (ALU);  Memory elements—registers, and Random Access Memory (RAM).  Interconnection circuit—e.g. multiplexers, demultiplexers, encoders, and decoders;  Logical and arithmetic circuit—e.g. adders, subtractors, multipliers, shifters,  comparators, and ALUs Fig. 1.2 Combinational circuit Fig. 1.3 Sequential circuit Field Programmable Gate Array The concept behind the Field Programmable Gate Array (FPGA) technology is better understood through a digital circuit design example. Problem: You are asked to design a circuit that implements the following logic function: f(A,B) = A AND B In this circuit, inputs A, B, and output f are all 4 bits wide. Solution 1: Using a 7408 TTL device (Application-specific Integrated Circuit— ASIC solution) The operations to be performed are: f(1) = A(1) AND B(1) f(2) = A(2) AND B(2) f(3) = A(3) AND B(3) f(4) = A(4) AND B(4) The 7408 TTL device, shown in Fig. 1.4, has four 1-bit AND gates. Therefore, a single 7408 chip is sufficient to implement the 4 bits function. In Fig. 1.4, the A inputs are connected to pins 1, 4, 9 and 12. The B inputs are connected to pins 2, 5, 10 and 13. The f output can be obtained from pins 3, 6, 8 and 11. The chip must be placed (soldered) on a /CpE/CMPE300121 Page 4 of 62 POLYTECHNIC UNIVERSITY OF THE PHILIPPINES College of Engineering DEPARTMENT OF COMPUTER ENGINEERING printed circuit board (PCB) or protoboard, and all pin connections should be made, including the power lines (Vcc and GND). Fig. 1.4 7408 TTL chip Solution 2: Microprocessor (software solution) A microprocessor (or microcontroller) based system is not the best solution for this sort of ‗‗simple problem‘‘, but it has been included here in order to show the differences between the hardware and software approaches. A possible solution for the problem is shown in the C language program as follows: int main() { int A, B, F; F = A & B; //F = A AND B } Solution 3: FPGA An FPGA device could be seen as an intermediary solution, between the hardware and the software approaches. In a similar way to the hardware (TTL chip) and the software (microprocessor chip) approaches, the FPGA chip also has to be placed on a PCB, and all its input and output pins should be connected. An important difference from the microprocessor approach is that the solution for the problem is not implemented in software. It is a hardware solution, similar to the 7408 chip, but with the same flexibility for changes as the microprocessor based approach. In case of bugs or design changes, a new circuit can be ‗‗placed‘‘ inside the FPGA, with no need for PCB modifications. A solution for the problem could be written in the VHDL language as follows library IEEE; use ieee.std_logic_1164.all; entity AND_VHDL is port (A, B : in std_logic_vector (3 downto 0); F : out std_logic_vector (3 downto 0) ); end entity; architecture rtl of AND_VHDL is begin F ‗1‘, others=> ‗0‘);  Logical and Shift Operators Logical operators AND, OR, NAND, NOR, XOR, XNOR, NOT Shift operators SLL, SRL, SLA, SRA, ROL, ROR Example 1 SLL: Shift Left Logical If x

Use Quizgecko on...
Browser
Browser