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

Similar documents
EITF35 - Introduction to Structured VLSI Design (Fall 2017) Course projects

How to use the IP generator from Xilinx to instantiate IP cores

Lab Assignment 2. Implementing Combinational and Sequential Logic in VHDL

Lab 3: Standard Combinational Components

Lab Assignment 1. Developing and Using Testbenches

Lab 3 Finite State Machines Automated Teller Machine

EITF35 - Introduction to the Structured VLSI Design (Fall 2016) Interfacing Keyboard with FPGA Board. (FPGA Interfacing) Teacher: Dr.

CSE/ESE 260M Introduction to Digital Logic and Computer Design. Lab 3 Supplement

EITF35: Introduction to Structured VLSI Design

Finite State Machine with Datapath

Verilog introduction. Embedded and Ambient Systems Lab

Least Common Multiple (LCM)

Finite State Machines

Lab 2 Implementing Combinational Logic in VHDL. Advanced Testbenches.

ECE2029: Introduction to Digital Circuit Design Lab 3 Implementing a 4-bit Four Function ALU

HW1 Modeling Concepts

Design of Digital Circuits

VHDL for Synthesis. Course Description. Course Duration. Goals

Chapter 4. Combinational Logic

An easy to read reference is:

Lecture 1: Introduction Course arrangements Recap of basic digital design concepts EDA tool demonstration

N-input EX-NOR gate. N-output inverter. N-input NOR gate

Lab Manual for COE 203: Digital Design Lab

Lab 3 Finite State Machines Movie Ticket Dispensing Machine

World Inside a Computer is Binary

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

Lecture 3: Modeling in VHDL. EE 3610 Digital Systems

Chap.3 3. Chap reduces the complexity required to represent the schematic diagram of a circuit Library

Lab 3 Sequential Logic for Synthesis. FPGA Design Flow.

The functional block diagram of 8085A is shown in fig.4.1.

IA Digital Electronics - Supervision I

Lab 2: Barrel Shifter Design

VHDL. VHDL History. Why VHDL? Introduction to Structured VLSI Design. Very High Speed Integrated Circuit (VHSIC) Hardware Description Language

Finite State Machines

FPGA for Software Engineers

3 Designing Digital Systems with Algorithmic State Machine Charts

Keywords: Soft Core Processor, Arithmetic and Logical Unit, Back End Implementation and Front End Implementation.

Numbering Systems. Number Representations Part 1

Introduction to Verilog and XILINX

Digital Arithmetic. Digital Arithmetic: Operations and Circuits Dr. Farahmand

Memory Controller. System Integration Issues. Encoding numbers 1GB RAM FSM. Communicating FSMs Clocking, theory and practice. Combinational Logic

Two HDLs used today VHDL. Why VHDL? Introduction to Structured VLSI Design

Basic Arithmetic (adding and subtracting)

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

ECE/CS Computer Design Lab Lab 1 - Completion by Sept 13. Lab 2 will be assigned during the 2nd week of September.

Building Combinatorial Circuit Using Behavioral Modeling Lab

EITF35: Introduction to Structured VLSI Design

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

ECE 353 Lab 3 (Verilog Design Approach)

Register Transfer Level in Verilog: Part I

PINE TRAINING ACADEMY

LABORATORY MANUAL VLSI DESIGN LAB EE-330-F

1. Choose a module that you wish to implement. The modules are described in Section 2.4.

TEACHING COMPUTER ARCHITECTURE THROUGH DESIGN PRACTICE. Guoping Wang 1. INTRODUCTION

CPEN 230L: Introduction to Digital Logic Laboratory Lab 7: Multiplexers, Decoders, and Seven Segment Displays

EE209 Lab Change We Can Believe In

Verilog for High Performance

Modeling Concepts. Introduction

VHDL: RTL Synthesis Basics. 1 of 59

VHDL for Logic Synthesis

Circuit Design and Simulation with VHDL 2nd edition Volnei A. Pedroni MIT Press, 2010 Book web:

CSE140L: Components and Design

The assignments will help you learn Verilog as a Hardware Description Language and how hardware circuits can be developed using Verilog and FPGA.

Outline. EECS Components and Design Techniques for Digital Systems. Lec 11 Putting it all together Where are we now?

CS2204 DIGITAL LOGIC & STATE MACHINE DESIGN FALL 2005

ECE2029: Introduction to Digital Circuit Design Lab 4 Building a Sequential Logic Circuit A Four Digit 7-Segment Display Driver

V1 - VHDL Language. FPGA Programming with VHDL and Simulation (through the training Xilinx, Lattice or Actel FPGA are targeted) Objectives

Elec 326: Digital Logic Design

Digital Design with SystemVerilog

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

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

Introduction to Digital Logic Using Logisim

PICOBLAZE INTERRUPT INTERFACE

EE 231 Fall Lab 2: Decoders and Multiplexers. Introduction

ANADOLU UNIVERSITY. EEM Digital Systems II

VHDL for Logic Synthesis

Verilog Design Entry, Synthesis, and Behavioral Simulation

Assignment 01 Computer Architecture Lab ECSE

Number System. Introduction. Decimal Numbers

Method We follow- How to Get Entry Pass in SEMICODUCTOR Industries for 3rd year engineering. Winter/Summer Training

ELEC 326: Class project

EE 231 Fall EE 231 Lab 3

VHDL Essentials Simulation & Synthesis

Digital Systems Laboratory

Advanced Computer Architecture-CS501

CSE140L: Components and Design Techniques for Digital Systems Lab

INF2270 Spring Philipp Häfliger. Lecture 4: Signed Binaries and Arithmetic

Project Gummi. 16-bit Microprocessor

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

EE 231 Fall EE 231 Homework 8 Due October 20, 2010

EECS Components and Design Techniques for Digital Systems. Lec 07 PLAs and FSMs 9/ Big Idea: boolean functions <> gates.

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

Tutorial - Using Xilinx System Generator 14.6 for Co-Simulation on Digilent NEXYS3 (Spartan-6) Board

Lab 7: RPN Calculator

LAB 9 The Performance of MIPS

A-PDF Split DEMO : Purchase from to remove the watermark 56 FIT-LEVEL COMBINATIONAL CIRCUIT

Prachi Sharma 1, Rama Laxmi 2, Arun Kumar Mishra 3 1 Student, 2,3 Assistant Professor, EC Department, Bhabha College of Engineering

Xilinx Vivado/SDK Tutorial

Fundamentals of Programming Session 2

Transcription:

EITF35 - Introduction to Structured VLSI Design (Fall 2018 2016 2015) 7 Assignment 3 - Arithmetic Logic Unit (ALU) v.1.1.0 Introduction In this lab assignment, a simple arithmetic logic unit (ALU) will be designed, synthesized, and downloaded to the FPGA board. The ALU takes in user inputs from on-board push buttons and switches, performs selected operations such as addition and subtraction, and shows final results on a 7-segment display. The lab assignment includes design of controlpath such as finite state machine(s), data-path such as combinational circuits, and other modules like a 7-segment driver. In order to pass the lab, both preparations and fulfillment of all lab tasks are mandatory. Lab Preparation - Go through the manual and try to understand the required functionality and given tasks. Make sure that you have understood what is expected from the lab before you start coding. Consult lab assistants if any functionality or task is unclear to you. - Tasks 1 3 should be done before the preparation deadline. However, you should prepare as much as possible before the lab session. - Go through the files provided in the lab directory and try to figure out how much coding you need to develop to fulfill the tasks. - Draw ASMD graphs of the different system components. Deadlines You have to finish all tasks in before time Oct. in... order 27, 28, to in get order approved to get approved on this lab: on this lab. - Lab preparation: Tuesday, Sept 29, 2015 - Presentation of the completed tasks: during Friday, the October lab 02, 2015 Laboratory provided files are available in S:\assignment 3\, and can also be downloaded from the course web page. 1

Assignments Every input of the ALU is an 8-bit digit which can be set by an arbitrary selection of switches (SW0 SW7) on the FPGA board. The position of every switch represents a binary 0 or 1. Therefore, the range of each of the ALU inputs can be interpreted as an unsigned integer between 0 and 255, or a signed integer between -128 and 127. To simplify the design, we use two s complement number representation in this lab. The required functionalities of the ALU are: - After Reset (push button CPU RESET), the value shown on the 7-segment display is the unsigned representation of an 8-bit binary value set by on-board switches. - When the user has set the first data operand (A), a push button BTNC can be used as an Enter key to send the value to ALU and buffer it in an internal register. - While the first ALU operand is saved, the second operand (B) can be set by rearranging the positions of the switches. The second operand should be saved in a separate register when the Enter button is pressed the second time. During the input of operand B, the 7-segment display should show current unsigned value of the on-board switches. - As soon as the ALU has both its inputs, it can perform the three required operations. The first operation A+B should be shown as soon as the Enter button is pressed the second time. By pressing the button for another time A-B should be performed as the second operation. By pressing the button once more, a modulo operation of A mod 3 should be displayed. Note that operand B is not used during the modulo operation. - The ALU output should cyle between A+B -> A-B -> A mod 3 -> A+B ->... every time the Enter button is pressed. Note that input switches (SW0 SW7) should be locked once the ALU has received both input operands, i.e., toggling the input switches should not affect the result. Because both operands are stored in the internal data registers. - The push button BTNL is used as a Sign key to toggle between unsigned and signed arithmetics for addition and subtraction in ALU. Correspondingly, the displayed ALU results should be updated every time the Sign button is pressed. Default ALU operation should be unsigned arithmetics. Use the left most 7-segment module to show - when the result is negative or F when an overflow has occurred. - The output of the ALU must be continuously shown on the 7-segment display, unless the Reset button (CPU RESET) is pressed, which clears current ALU inputs and starts all over again. Looking at the required functionalities, a possible implementation could involve a controller, i.e., a finite state machine (FSM), a data-path containing an ALU, a register block to keep the ALU input operands, a binary to binary-coded-decimal converter (Bi/BCD), and a driver for the 7-segment display. An example of a possible implementation is shown in Figure 1. 2

Anode [3:0] 7-Seg [6:0] ALU Top 7-Seg Driver [9:0] sign, overflow Bi/BCD Sel Mux Result [7:0] ALU clk 50 MHz [7:0] [7:0] FN [3:0] Arith. mod 3 A [7:0] B [7:0] reset CPU BTN3 Reset RegCtrl Reg. update Reg. A Reg. B BTNC BTN2 BTNL BTN0 (Enter) (Sign) SW7 SW6 Figure 1: ALU top structure... In [7:0] SW0 Task 1 Based on input signals Reset (CPU RESET), Sign (BTNL), and Enter (BTNC), propose a FSM of the ALU controller that provides control signals to the ALU to achieve the required functionalities. Draw a reasonably detailed finite state machine (FSM) on a piece of paper for your solution. Determine what control signals should be applied to the ALU in each state. The FSM can be either of type Moore or Mealy. Task 2 Study Read the paper modulo under operation the Lab and 3 links come(i.e. up Modulo3.pdf) with a hardware-friendly and focus on algorithm Fig. 1 to to calculate understand boththe signed proposed and unsigned architecture modulo of unsigned arithmetics. modulo 3 operation. Then, modify this architecture to be able to calculate both signed and unsigned modulo 3. Try to Task 3 minimize Come up your with additional a hardware-friendly logics to the algorithm architecture to convert in Fig. a1. binary You should value only to BCD use one format. instance of the architecture shown in Fig. 1 for both sign and unsigned modulo 3. 3

1 ALU Block The ALU block is a simple combinational logic circuit that performs the following functions according to the commands from the controller. FN[3:0] Operation 0000 Input A 0001 Input B 0010 Unsigned (A + B) 0011 Unsigned (A - B) 0100 Unsigned (A) mod 3 1010 Signed (A + B) 1011 Signed (A - B) 1100 Signed (A) mod 3 Table 1: ALU block - functions and the corresponding input control signals The ALU performs unsigned & signed addition, subtraction, and modulo operation on a pair of 8-bit binary inputs. Besides the 8-bit output, ALU uses signals sign and overflow to indicate the sign and arithmetic status during computation. The modulo operation is performed as x mod n = x - n floor(x/n), where n is fixed to 3 in this lab. For example, 7 mod 3 = 7-3 floor(7/3) = 7-3 floor(2.33) = 7-3 2 = 7-6 = 1. The result of "mode 3" should be positive and don't implement it only using with add/sub. Task 4 Write VHDL code for the ALU block to perform the required functions as given in Table 1. For this purpose, you can use the file ALU.vhd in the lab directory and complete it with your code. When you have written the functional VHDL code for ALU block you need to make sure that your ALU works as expected. In order to verify the correct functionality of your ALU entity a testbench tb_alu is provided in the lab directory. Task 5 Add ALU.vhd and tb_alu.vhd to your project in Vivado/Questasim. Compile the files and start a simulation. In the wave window, right click on a, b and result signals and choose Radix -> Decimal. Verify your ALU results. 2 ALU Controller According to the required functionalities, a controller, i.e. a finite state machine is necessary. It manages the behaviour of the ALU with respect to user commands input from push buttons. As an example, the ALU behaviour, according to the Enter signal sequence is shown in Figure 2. In the figure, 1 states that the button is pressed and 0 indicates when it is released. Task 6 Design the ALU controller in HDL. Don t integrate it into your design unless you have fully verified its functionalities. 4

Figure 2: Functionality of ALU based on the input commands 3 Register Update Finally, when the whole design is downloaded into the FPGA, the input for operands A and B are provided with 8 switches on the board (SW0 - SW7). Thus, only one register can be updated at any time by the binary value set with the switches. You can use the controller you have designed and tested previously to control when each register should be updated. A possible RTL structure describing the needed sequential and combinatorial processes is shown in Figure 3. Enter reset In Combinatorial Process combinatorial logic Out Register Process Reg A Reg B A B next Reg A next Reg B state state next state Figure 3: The RTL structure describing the processes needed Task 7 Design an entity to provide suitable inputs for the register update in this lab based on the expected functionality described in Figure 2. 4 Binary to BCD Converter BCD or binary-coded-decimal is a method of using four binary digits to represent the decimal digits 0 to 9. For instance, 249 with binary representation 11111001 can be represented by 10 0100 1001 in BCD format. Converting a binary value to BCD is very common, in order to represent each digit separately on a 7-segment display. 5

Task 8 Write a binary to BCD entity VHDL code and a proper testbench to verify its functionality. Compile the converter and simulate it using Vivado/QuestaSim. 5 Synthesizing the whole ALU structure Now that you have written and tested different parts of the whole ALU structure using Vivado/QuestaSim, you are ready to implement a prototype circuit. This is often done using an FPGA technology. To accomplish this, we use Xilinx Nexys-4 FPGA boards available in the lab. To finalize your design before synthesizing and downloading to the FPGA, you need to fulfill two remaining tasks: 1 You need to integrate all the codes you have developed so far together with the 7-segment driver you have designed in lab 2 into a project. 2 Mapping the ports of the top structure of your design to the physical ports on FPGA. Task 9 Add all the required VHDL files you have developed and verified so far in a project in Vivado. To connect the separate components of your design, add a new VHDL source file into the project and develop the VHDL code for the ALU top structure in case you have not done it so far. Use the interface model shown in Figure 4 for the top structure. ALU Top Input [7:0] Anode [3:0] b_enter b_sign seven_seg [6:0] Clk reset Figure 4: ALU_top block Task 10 Use the configuration definition for the physical implementation that was used for Lab 2 and add the additional connections required for this lab using by clicking on the Xilinx design constraints file. Task 11 Synthesize and download the whole design in FPGA using Xilinx Vivado tool. Verify that your design works as expected. If the 7-segment display starts blinking choose a shorter multiplexing time between the segments in your code. 6

Some Questions 6 Approval Questions What are the advantages of using 2 s complement numbers over using a dedicated bit for the sign? Why is it necessary use a de-bouncer for the push buttons? What is the advantage of performing per module verification before all modules are assembled together? 7