Finite State Machine with Datapath

Similar documents
Least Common Multiple (LCM)

Digitaalsüsteemide disain

COMPUTER ARITHMETIC (Part 1)

9 Multiplication and Division

361 div.1. Computer Architecture EECS 361 Lecture 7: ALU Design : Division

COMPUTER ARCHITECTURE AND ORGANIZATION. Operation Add Magnitudes Subtract Magnitudes (+A) + ( B) + (A B) (B A) + (A B)

Chapter 5 : Computer Arithmetic

CPS 104 Computer Organization and Programming

COMP 303 Computer Architecture Lecture 6

Rational numbers as decimals and as integer fractions

ECE260: Fundamentals of Computer Engineering

carry in carry 1101 carry carry

More complicated than addition. Let's look at 3 versions based on grade school algorithm (multiplicand) More time and more area

Organisasi Sistem Komputer

Divide: Paper & Pencil

Number System. Introduction. Natural Numbers (N) Whole Numbers (W) Integers (Z) Prime Numbers (P) Face Value. Place Value

Chapter 5: Computer Arithmetic. In this chapter you will learn about:

Learning Objectives. Binary over Decimal. In this chapter you will learn about:

EECE-4740/5740 Advanced VHDL and FPGA Design Lecture 4. Cristinel Ababei Dept. of Electrical and Computer Engr. Marquette University

Timing for Ripple Carry Adder

Tailoring the 32-Bit ALU to MIPS

(+A) + ( B) + (A B) (B A) + (A B) ( A) + (+ B) (A B) + (B A) + (A B) (+ A) (+ B) + (A - B) (B A) + (A B) ( A) ( B) (A B) + (B A) + (A B)

The Need of Datapath or Register Transfer Logic. Number 1 Number 2 Number 3 Number 4. Numbers from 1 to million. Register

EECS150 - Digital Design Lecture 13 - Combinational Logic & Arithmetic Circuits Part 3

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

Module 2: Computer Arithmetic

Chapter 5: Computer Arithmetic

3 Designing Digital Systems with Algorithmic State Machine Charts

Chapter 3: Arithmetic for Computers

Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition

EITF35 - Introduction to Structured VLSI Design (Fall ) 7. Assignment 3 - Arithmetic Logic Unit (ALU)

Lecture 9. INC and DEC. INC/DEC Examples ADD. Arithmetic Operations Overflow Multiply and Divide

Arithmetic Logic Unit

Lecture 8: Addition, Multiplication & Division

Figure 1: Verilog used to generate divider

Iterative Division Techniques COMPUTER ARITHMETIC: Lecture Notes # 6. University of Illinois at Chicago

An instruction set processor consist of two important units: Data Processing Unit (DataPath) Program Control Unit

CT 229. Java Syntax 26/09/2006 CT229

Chapter 10 - Computer Arithmetic

MCPU - A Minimal 8Bit CPU in a 32 Macrocell CPLD.

Lab 3: Standard Combinational Components

INITIALIZE CLEAR beneath COUNT

University of Illinois at Chicago. Lecture Notes # 13

Computer Organisation CS303

Integer Arithmetic. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

MIPS Integer ALU Requirements

Project Gummi. 16-bit Microprocessor

Binary Adders. Ripple-Carry Adder

Contents. Chapter 9 Datapaths Page 1 of 28

Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

UNIT-III COMPUTER ARTHIMETIC

Register Transfer and Micro-operations

A flow chart is a graphical or symbolic representation of a process.

COMPUTER ORGANIZATION AND. Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

DIGITAL LOGIC DESIGN VHDL Coding for FPGAs Unit 6

Numbering systems. Dr Abu Arqoub

EITF35: Introduction to Structured VLSI Design

UNIT - I: COMPUTER ARITHMETIC, REGISTER TRANSFER LANGUAGE & MICROOPERATIONS

Hardware Description Languages M E 2202 Tutorial Sheet

VHDL: RTL Synthesis Basics. 1 of 59

CSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

CPE300: Digital System Architecture and Design

CS/COE 0447 Example Problems for Exam 2 Spring 2011

CS 151 Midterm. (Last Name) (First Name)

Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

VLSI Based 16 Bit ALU with Interfacing Circuit

GO - OPERATORS. This tutorial will explain the arithmetic, relational, logical, bitwise, assignment and other operators one by one.

Expression and Operator

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Chapter 3 Arithmetic for Computers. ELEC 5200/ From P-H slides

Lecture Topics. Announcements. Today: Integer Arithmetic (P&H ) Next: The MIPS ISA (P&H ) Consulting hours. Milestone #1 (due 1/26)

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Integer Multiplication and Division

EEM336 Microprocessors I. Arithmetic and Logic Instructions

Chapter 4. Operations on Data

Lecture 2: Number Systems

Chapter 3: part 3 Binary Subtraction

BINARY SYSTEM. Binary system is used in digital systems because it is:

Block diagram view. Datapath = functional units + registers

TSEA44 - Design for FPGAs

Review of Last lecture. Review ALU Design. Designing a Multiplier Shifter Design Review. Booth s algorithm. Today s Outline

Unit-2 (Operators) ANAND KR.SRIVASTAVA

Advanced Computer Architecture-CS501

Add Subtract Multiply Divide

ANADOLU UNIVERSITY. EEM Digital Systems II

Floating Point Arithmetic

Number Systems and Computer Arithmetic

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 6

Computer Arithmetic Ch 8

Computer Arithmetic Ch 8

Chapter 4 Section 2 Operations on Decimals

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Chapter 1 An Introduction to Computer Science. INVITATION TO Computer Science 1

VHDL Implementation and Performance Analysis of two Division Algorithms. Salman Khan B.S., Sir Syed University of Engineering and Technology, 2010

IT T35 Digital system desigm y - ii /s - iii

Fast Arithmetic. Philipp Koehn. 19 October 2016

ECE 341 Midterm Exam

CS 5803 Introduction to High Performance Computer Architecture: Arithmetic Logic Unit. A.R. Hurson 323 CS Building, Missouri S&T

Transcription:

Finite State Machine with Datapath Task: Implement a GCD algorithm that is able to handle any combination of -bit (sign bit included) numbers. Use two's complement format to represent negative values. Provide the circuit with an interface for repetitive data input (using buttons and switches) and result output (using LEDs). The design should be developed in accordance with the same methodology as described in the example below, but the algorithm itself can be different: develop GCD computation method and prepare flowchart for the selected algorithm. The algorithm should incorporate all the necessary steps, including data input, any input data preprocessing, the GCD calculation itself and the output of the result. devise GSA and state transition table for the control part of the design (use Mealy FSM type) and develop a suitable datapath for it. Simulate and implement the design on FPGA development board. Greatest Common Divisor Example The greatest common divisor of two non-zero integers is the largest positive integer that divides both numbers without remainder. One way to compute GCD is to use Euclidean algorithm. The flowchart of Euclidean algorithm is presented on Figure. For this example it is assumed that input operands are unsigned 8-bit numbers and none of them is zero. GCD circuit includes a control unit (FSM), which is complemented with a datapath. On this stage the datapath consists of two registers (RG and RG2), multiplexers for selecting the source of data to be stored in these registers and comparator logic. The remainder computation is treated as black box. As most of the basic FPGAs do not feature any dedicated logic for performing division, it must be synthesized separately. A simple division algorithm is presented on Figure 2. At each step it checks whether divisor, which is multiplied by corresponding power of two

(starting from the maximum possible), fits into dividend. If it doesn t, then the dividend is restored. BEGIN START RG := OP; RG2 := OP2; RG = RG2 RG < RG2 RG := RG2; RG2 := RG; Remainder Computation Remainder = READY := ; ANSW := RG2; END Figure : GCD Algorithm Register RG is loaded with dividend, while register RG2 with divisor. At first the divisor is normalized. As the quotient is of no interest, its computation is omitted from the

algorithm. After the final run, RG should contain the remainder, while divisor in RG2 is back to normal. te, that RG is a 9-bit registers, as it should include a sign bit as well. Remainder computation algorithm invokes additional elements in the datapath: Arithmetic Logic Unit (ALU) and up/down counter. ALU is, in a sense, a custom block, its functionality is design specific. For this particular algorithm ALU should handle addition, subtraction and right/left shift operations, as well as comparison. The block scheme of the complete datapath is presented on Figure 3. Remainder Computation RG2(7) = L(RG2.); C := C + ; RG := RG - RG2; RG(8) = RG := RG + RG2; C = R(.RG2); C := C - ; Figure 2: Remainder Computation Algorithm Elements of the datapath are controlled via eleven (Y-Y) signals a control word. Y, Y and Y2 are enable signals for the registers (RG and RG2) and the counter. Y3 signal

selects the counting direction. Y7-Y4 control the multiplexers, which feed data to registers RG and RG2. Y8 and Y9 select the ALU operation (addition, subtraction or right/left shift). Y enables the ANSW output, when the result is ready. The control unit gets feedback from datapath via six (X6-X) signals. X indicates whether the content of RG equals the content of RG2. X2 signals whether the value stored in RG is greater than the value of RG2. X3 is the most significant bit of RG2. X4 is the sign bit of RG. Signals X5 and X6 indicate when content of counter and RG equal zero. y5 y4 y x4 x6 y9 y8 OP RG ALU x x2 OP2 RG2 y7 y6 y x3 Counter y3 y2 x5 DATA PATH UNIT y ANSW Figure 3: Datapath Of GCD Circuit At this stage it is possible to represent the control unit by means of graph-scheme of algorithm (GSA). In this GSA the computational statements (actions of ALU and counter) are replaced with the corresponding control signals (Y-s) and the conditions - with binary conditions signals (X-s). Simultaneously executed statements are grouped into common blocks. The resultant GSA is presented on Figure 4. It can be synthesized as either Moore or Mealy FSM to form a control unit for the GCD circuit.

BEGIN x y7 y5 y y x x2 y6 y4 y y x3 y9 y2 y y8 y x4 y x5 y9 y8 y3 y2 y x6 y END Figure 4: GSA of GCD Algorithm VHDL descriptions of the ALU and up/down counter are provided in Listing and Listing 2, respectively. ALU is a purely combinational circuit, thus it reacts to the change on any of its inputs. It performs all the necessary arithmetical/logical operation (addition, subtraction

and right/left shift) and does the comparison of the operands. The counter can both decrement and increment. The counter should definitely be implemented as a signal, because its value must be available to other processes (components in the datapath). Listing : VHDL Description of ALU process (OP, OP2, op_sel) begin case op_sel is when "" => result <= std_logic_vector(unsigned(op) + unsigned(op2)); when "" => result <= std_logic_vector(unsigned(op) - unsigned(op2)); when "" => result <= OP2(7 downto )&''; when "" => result <= ''&OP2(8 downto ); when others => result <= (others => ''); end case; if OP = OP2 then equal <= ''; else equal <= ''; if OP < OP2 then greater <= ''; else greater <= ''; end process; Listing 2: VHDL Description of Up/Down Counter process (clk) begin if clk'event and clk = '' then if counter_en = '' then if count_direction = '' then counter_value <= std_logic_vector(unsigned(counter_value) - ); else counter_value <= std_logic_vector(unsigned(counter_value) + ); end process;