EE 231 Fall EE 231 Lab 3

Similar documents
EE 231 Fall EE 231 Lab 3. Decoders and Multiplexers. Figure 1: 7-Segment Display. Memory: where the program is stored.

EE 231 Fall Lab 2: Decoders and Multiplexers. Introduction

Lab 3: Standard Combinational Components

Spring 2017 EE 3613: Computer Organization Chapter 5: Processor: Datapath & Control - 2 Verilog Tutorial

Workshop on Digital Circuit Design in FPGA

EE 231 Fall EE 231 Lab 2

To design a 4-bit ALU To experimentally check the operation of the ALU

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

EECS 270 Midterm Exam

Lab 5: Arithmetic Logic Unit (ALU)

Introduction. Why Use HDL? Simulation output. Explanation

EE 231 Fall Lab 1: Introduction to Verilog HDL and Altera IDE

Finite State Machine Lab

Lab 4: Arithmetic Logic Unit (ALU)

Verilog Module 1 Introduction and Combinational Logic

Introduction to Verilog/System Verilog

CSCB58 - Lab 3. Prelab /3 Part I (in-lab) /2 Part II (in-lab) /2 TOTAL /8

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

University of Hawaii EE 361L. Getting Started with Spartan 3E Digilent Basys2 Board. Lab 4.1


Combinational Logic II

Brief Introduction to Verilog HDL (Part 1)

EE 8351 Digital Logic Circuits Ms.J.Jayaudhaya, ASP/EEE

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

structure syntax different levels of abstraction

Here is a list of lecture objectives. They are provided for you to reflect on what you are supposed to learn, rather than an introduction to this

Verilog Design Principles

Introduction to Verilog

Register Transfer and Micro-operations

Workshop on Digital Circuit Design in FPGA

PRELAB! Read the entire lab, and complete the prelab questions (Q1-Q3) on the answer sheet before coming to the laboratory.

Computer Aided Design Basic Syntax Gate Level Modeling Behavioral Modeling. Verilog

Verilog introduction. Embedded and Ambient Systems Lab

Lab 0: Wire Wrapping Project: Counter Board

Introduction to Verilog HDL

ECE 574: Modeling and Synthesis of Digital Systems using Verilog and VHDL. Fall 2017 Final Exam (6.00 to 8.30pm) Verilog SOLUTIONS

Introduction to Verilog HDL. Verilog 1

Experiment 9: Binary Arithmetic Circuits. In-Lab Procedure and Report (30 points)

CSC 220: Computer Organization Unit 10 Arithmetic-logic units

Course Topics - Outline

EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS

HW1 Modeling Concepts

Lab 2: Introduction to Verilog HDL and Quartus

EEL 4783: Hardware/Software Co-design with FPGAs

EE 3170 Microcontroller Applications

Programmable machines

ELEC 2200 Digital Logic Circuits

Verilog. Like VHDL, Verilog HDL is like a programming language but:

General FSM design procedure

EECS150, Fall 2004, Midterm 1, Prof. Culler. Problem 1 (15 points) 1.a. Circle the gate-level circuits that DO NOT implement a Boolean AND function.

Register-Level Design

General FSM design procedure

PART 1. Simplification Using Boolean Algebra

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

Lab Manual for COE 203: Digital Design Lab

Verilog. Verilog for Synthesis

Lecture #2: Verilog HDL

IA Digital Electronics - Supervision I

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

Verilog Design Principles

Microcomputer Architecture and Programming

Department of Computer and Mathematical Sciences. Lab 4: Introduction to MARIE

VERILOG. Deepjyoti Borah, Diwahar Jawahar

ASSIGNMENT ECE514 (COMPUTER ORGANIZATION) ASSIGNMENT NO. 3

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

Arithmetic-logic units

ENEE245 Digital Circuits and Systems Lab Manual

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

General FSM design procedure

Pre-Laboratory #Boolean Expressions ECE 332

Graduate Institute of Electronics Engineering, NTU. Lecturer: Chihhao Chao Date:

14:332:231 DIGITAL LOGIC DESIGN. Hardware Description Languages

Speaker: Kayting Adviser: Prof. An-Yeu Wu Date: 2009/11/23

Chapter 3 Part 2 Combinational Logic Design

A B A+B

8051 Interfacing: Address Map Generation

Nikhil Gupta. FPGA Challenge Takneek 2012

Chapter 10. case studies in sequential logic design

Lab 7 (All Sections) Prelab: Introduction to Verilog

ECE 313 Computer Organization EXAM 2 November 11, 2000

Homework deadline extended to next friday

Chap 6 Introduction to HDL (d)

7 8 9 C. PRELAB REQUIREMENTS You must adhere to the Lab Rules and Policies document for every lab.

Verilog Tutorial - Edited for CS141

Verilog 1 - Fundamentals

Modeling Concepts. Introduction

Input/Output Ports and Interfacing

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

Digital Design with FPGAs. By Neeraj Kulkarni

Chapter 1: Basics of Microprocessor [08 M]

University of California, Davis Department of Electrical and Computer Engineering. Lab 1: Implementing Combinational Logic in the MAX10 FPGA

CPE 200L LABORATORY 4: INTRODUCTION TO DE2 BOARD UNIVERSITY OF NEVADA, LAS VEGAS GOALS: BACKGROUND:

ENEE245 Digital Circuits and Systems Lab Manual

ES611 FPGA Based System Design. Behavioral Model

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Contents. Appendix D Verilog Summary Page 1 of 16

EN2911X: Reconfigurable Computing Lecture 05: Verilog (2)

ECE Digital System Design & Synthesis Exercise 1 - Logic Values, Data Types & Operators - With Answers

Lab 7 (Sections 300, 301 and 302) Prelab: Introduction to Verilog

Transcription:

EE 231 Lab 3 Decoders and Multiplexers Decoders and multiplexers are important combinational circuits in many logic designs. Decoders convert n inputs to a maximum of unique 2 n outputs. A special case is the BCDto-seven-segment decoder, where a four-bit decimal digit (represented in BCD) is decoded into the corresponding seven segment code used as an input to the seven-segment display (Figure 1). 1. Prelab Figure 1. 7-Segment Display 1. Wire wrap the two 7-segment displays along with the pin header needed on a perf board. Schematics of MAN74 7-segment display. 2. Fill in the truth table for the BCD-to-7-segment decoder shown in Table 1, e.g., if the input is 0011, LEDs a,b,c,d and g should be on while LEDs f and e will be off (see Figure 1). For inputs 0xA through 0xF, naturally they don t correspond to any number in the range 0-9, therefore output the corresponding hex value instead, i.e., for 0xA the display should show the letter A. 3. A simple computer has several main blocks, e.g., Arithmetic logic unit (ALU): performs arithmetic operations on numbers. Memory: where the program is stored. Multiplexers: select which piece of information to be passed on. Decoders: to determine, based on the input, whether to read from memory or input/output lines. 1

Computer control unit: outputs the control signals that direct the operation of the rest of the computer. Even though we are not building a computer, this information gives you some prospective on the different components that you will be building and what they may be used for. In this lab we will focus on the multiplexer that chooses either a reset address ( RST ADDR), program counter (PC), memory address register (MAR), or Index Register X (IRX). These signals are used to determine the information required to enter the arithmetic logic unit component of the computer. (a) Design a multiplexer with ADDR SEL as the select signal, RST ADDR (we will use address 0xFF), PC, MAR, and X as 8-bit input signals. (b) Design a Verilog program to implement this multiplexer. Table 1. Truth table for 7-segment-display decoder ( 1 LED is on, and 0 it is off). 2. Lab 1. Place a block of 8 DIP switches on your breadboard, see Figure 2. 2. Connect each lead on one side to VCC. 3. Put a 1k resistor from each of the leads on the other side to ground. Also on this side, place a row of 8 pin headers so that you have outputs from all of these switches. 2

4. In order to be able to connect to the board you will need to solder pin headers to one of the prototyping areas (see Figure 3). Use area A. For now solder the first two rows (Figure 4). 5. Use Figure 5 for the pin labels. 6. Now that you have all the hardware setup. Design the BCD-to-sevensegment decoder and test it using different inputs using the dip switches. 7. Implement the multiplexer program that you developed in the prelab, as shown in Figure 6. To test the multiplexer we need to hard wire (in Verilog) RST ADDR to 0xFF, PC to address 0x0A, and MAR to 0x10. Connect IR to the 8 DIP switches, and MEM SEL to 2 push-button switches on the board. Figure 2. Dip Switches Figure 3. MAX II Micro Board 3

Figure 4. MAXII Micro Board With PIN Headers Figure 5. I/O Map of Prototyping Areas. 4

Figure 6. Implementation of a simple multiplexer 3. Supplementary Material 3.1 More on Verilog 3.1.1 Three-State Gates If the control signal is 1, the output is enabled, and if the control signal is 0, the output is disabled and the gate is in high-impedance mode. There are three types of three-state gates. 1. bufif1(output, input, control): output equals the input if the control signal is 1, and high-impedance state,z, if the control signal is 0. 2. bufif0(output, input, control): the control signal is the complement of bufif1. 3. notif1(output, input, control): same as bufif1 except the output is the complement of the input if the control signal is 1. 4. notif0(output, input, control): same as bufif0 except the output is the complement of the input if the control signal is 0. 3.1.2 Logic Levels 0 Logic zero, false condition 1 logic one, true condition x unknown logic value z high impedance 3.2 Verilog Behavioral Modeling 5

3.2.1 always and reg 1. Behavioral modeling uses the keywords always. Figure 6. Three-state Gate 2. Target output is a type reg. Unlike a wire, reg is updated only when a new value is assigned. In other words, it is not continuously updated as wire data types. 3. always may be followed by an event control expression. 4. always is followed by the symbol @ followed by a list of variables. Each time there is a change in those variables, the always block is executed. 5. There is no semicolon at the end of the always block. 6. The list of variables are separated by logical operator or and not bitwise OR operator. 7. Below is an example of an always block. always @(A or B) 3.2.2 if-else Statements if-else statements provide a means for conditional outputs based on the arguments of the if statement. 3.2.3 case Statements 6

case Statements provide an easy way to represent a multi-branch conditional statement. 1. The first statement that makes a match is executed. 2. Unspecified bit patterns could be treated sing default keyword. output out; input s,a,b; reg out; if(s) out=a; else out=b; // if select is 1 then out is A // else output is B Program 1 Four-to-one Line Multiplexer module mux_4x1_example( output reg out, input [1:0] s, // select represented by 2 bits input in_0, in_1, in_2, in_3); always @(in_0, in_1, in_2, in_3, s) case(s) 2 b00: out = in_0; // if s is 00 then output is in_0 2 b01: out = in_1; // if s is 01 then output is in_1 2 b10: out = in_2; // 2 b11: out = in_3; endcase endmodule 7