ECE/CS 252 Fall 2011 Homework 4 (25 points) // Due in Lecture Mon Oct. 17, 2011

Similar documents
CS/ECE 252 Introduction to Computer Engineering

Intro. to Computer Architecture Homework 4 CSE 240 Autumn 2005 DUE: Mon. 10 October 2005

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON. Instructor: Rahul Nayar TAs: Annie Lin, Mohit Verma

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Review Topics. Midterm Exam Review Slides

2) Using the same instruction set for the TinyProc2, convert the following hex values to assembly language: x0f

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

The LC3's micro-coded controller ("useq") is nothing more than a finite-state machine (FSM). It has these inputs:

EECE.2160: ECE Application Programming

Review Topics. Midterm Exam Review Slides

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Lecture 2: Number Systems

Department of Electrical and Computer Engineering The University of Texas at Austin

ECE Homework 8

ECE2049: Homework 1. Consider the following code to compute the average of your exam grades: #define NUM_EXAMS (3)

15110 PRINCIPLES OF COMPUTING SAMPLE EXAM 2

CSC201, SECTION 002, Fall 2000: Homework Assignment #2

ENCM 369 Winter 2019 Lab 6 for the Week of February 25

Department of Electrical and Computer Engineering The University of Texas at Austin

School of Computer Science

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

COSC121: Computer Systems: Review

Final Exam Solution Sunday, December 15, 10:05-12:05 PM

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

COSC121: Computer Systems: Review

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

11/6/2016. Let s Solve a Problem. ECE 120: Introduction to Computing. Overview of Our Task. Programs are Finite State Machines

Chapter 2 Bits, Data Types, and Operations

(a) What is the denary equivalent of the hexadecimal number A7?

Number Representations

Introduction to Computer Science. Homework 1

Fundamentals of Programming Session 2

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

appendix a The LC-3 ISA A.1 Overview

Chapter 2 Bits, Data Types, and Operations

CSCI 2212: Intermediate Programming / C Chapter 15

CS1800 Discrete Structures Final Version A

CS 202: Introduction to Computation Fall 2010: Exam #1

Programming Studio #1 ECE 190

KING FAHD UNIVERSITY OF PETROLEUM & MINERALS COMPUTER ENGINEERING DEPARTMENT

ECE2049: Homework 1. Due: Thursday, 25 May 2017 by 7pm

Content. Information Coding. Where are we? Where are we? Bit vectors (aka Words )

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

ECE/CS 252 Fall 2011 Homework 7 (25 points) // Due in Lecture on Nov. 30, 2011 (Wed)

Final Examination Semester 2 / Year 2011

Microcontroller Systems

CDA 3103 Computer Organization Exam 1 (Sep. 22th, 2014)

Chapter 2 Bits, Data Types, and Operations

Chapter 2 Bits, Data Types, and Operations

Brock Wilcox CS470 Homework Assignment 2

The MARIE Architecture

Programming Studio #1 ECE 190

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

UNCA CSCI 255 Exam 1 Spring February, This is a closed book and closed notes exam. It is to be turned in by 1:45 PM.

EEL 5722C Field-Programmable Gate Array Design

CARLETON UNIVERSITY. Laboratory 2.0

Computer Organization EE 3755 Midterm Examination

World Inside a Computer is Binary

Trap Vector Table. Interrupt Vector Table. Operating System and Supervisor Stack. Available for User Programs. Device Register Addresses

Machine Language and Assembly Language

QUIZ. Name all the 4 parts of the fetch-execute cycle.

CSCI4211: Introduction to Computer Networks Fall 2017 Homework Assignment 2

Grading: 3 pts each part. If answer is correct but uses more instructions, 1 pt off. Wrong answer 3pts off.

Chapter 10 Binary Arithmetics

Advanced Computer Architecture-CS501

CIT 593: Intro to Computer Systems Homework #4: Assembly Language Due October 18, 2012, 4:30pm. Name

CDS130 Mid-term exam: Sample

QUIZ. Name all the 4 parts of the fetch-execute cycle.

Lecture 17 Bit Operations

2.2: Bitwise Logical Operations

LC-3 ISA - II. Lecture Topics. Lecture materials. Homework. Machine problem. Announcements. ECE 190 Lecture 10 February 17, 2011

CS 151 Quiz 4. Instructions: Student ID. (Last Name) (First Name) Signature

CS 2461: Computer Architecture I

Slide Set 5. for ENCM 369 Winter 2014 Lecture Section 01. Steve Norman, PhD, PEng

Wawrzynek & Weaver CS 61C. Sp 2018 Great Ideas in Computer Architecture MT 1. Print your name:,

Lecture 13 Bit Operations

CS/ECE 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Verilog Lab. Two s Complement Add/Sub Unit. TA: Xin-Yu Shi

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm

Finite State Machines: Finite State Transducers; Specifying Control Logic

CS 61C: Great Ideas in Computer Architecture RISC-V Instruction Formats

9/14/17. Levels of Representation/Interpretation. Big Idea: Stored-Program Computer

Logistics. IIT CS 350 S '17 - Hale

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

Moodle WILLINGDON COLLEGE SANGLI. ELECTRONICS (B. Sc.-I) Introduction to Number System

ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

Number systems and binary

11/22/1999 7pm - 9pm. Name: Login Name: Preceptor Name: Precept Number:

UNIT 7A Data Representation: Numbers and Text. Digital Data

Extra-credit QUIZ Pipelining -due next time-

Lab 1. Warm-up : discovering the target machine, LC-3

Course Syllabus of Microprocessor I (Fall 2006)

Lecture 6: Signed Numbers & Arithmetic Circuits. BCD (Binary Coded Decimal) Points Addressed in this Lecture

Read this before starting!

Decimal & Binary Representation Systems. Decimal & Binary Representation Systems

Low-level software. Components Circuits Gates Transistors

ECE/CS 252: INTRODUCTION TO COMPUTER ENGINEERING UNIVERSITY OF WISCONSIN MADISON

IBM 370 Basic Data Types

The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL

ECE2049 HW #1-- C programming and Binary Number Representations (DUE 1/19/2018 At the BEGINNING of class)

Transcription:

ECE/CS 252 Fall 2011 Homework 4 (25 points) // Due in Lecture Mon Oct. 17, 2011 Instructions: You should do this homework in groups. You should hand in ONE copy of the homework that lists your section number and names and UW ID numbers of all students. You must staple all pages of your homework together to receive full credit. Warning: Most homeworks will use questions from your textbook, Patt and Patel's Introduction to Computing Systems, which we abbreviate (ItCS). First contact for questions is TA Ripudaman Singh: rsingh27@wisc.edu Problem 1 (4+3+2 points) a. In this problem, your task is to design a finite state machine for a simple vending machine. Assume all the items are available for 15 cents and the machine can take in 5 cents or 10 cents as inputs. If at least 15 cents have been put into the machine, it ll output the item selected but no change will be given back. Draw the state machine to model the behavior. Hint: A state should represent how much money has been put in. b. Draw the truth table and corresponding combinational logic for next states and output. c. What changes will you make to the state diagram you made in previous question if you need to return change as well? Draw the updated state diagram. Hint: Another output signal and state needs to be defined. Ideally 2 inputs should be considered but single input cases are also being given credit. Considering 2-inputs: a. State Diagram: Output X = 1 when we have received 15 cents or more. Input 00 means that no coin has been inserted Input 01 means that 5 cents coin has been inserted Input 10 means that 10 cents coin has been inserted Input 11 is not possible and hence ignore.

b. Truth table Input Current State Next State I1 I0 S1 S0 S1 S0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 0 1 1 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1

1 0 1 0 1 1 1 0 1 1 1 0 Current State Output S1 S0 X 0 0 0 0 1 0 1 0 0 1 1 1 X = S1 AND S0 S1 = [(NOT I1) AND (NOT I0) AND (S1) AND (NOT S0)] OR [(NOT I1) AND (I0) AND (S1) AND (NOT S0)] OR [(NOT I1) AND (I0) AND (NOT S1) AND (S0)] OR [(I1) AND (NOT I0) AND (NOT S1) AND (NOT S0)] OR [(I1) AND (NOT I0) AND (NOT S1) AND (S0)] OR [(I1) AND (NOT I0) AND (S1) AND (NOT S0)] OR [(I1) AND (NOT I0) AND (S1) AND (S0)] S0 = [(NOT I1) AND (NOT I0) AND (NOT S1) AND (S0)] OR [(NOT I1) AND (I0) AND (NOT S1) AND (NOT S0)] OR [(NOT I1) AND (I0) AND (S1) AND (NOT S0)] OR [(NOT I1) AND (I0) AND (S1) AND (S0)] OR [(I1) AND (NOT I0) AND (NOT S1) AND (S0)] OR [(I1) AND (NOT I0) AND (S1) AND (NOT S0)] There can be other solutions to S1 and S0 for the state diagram given. c. Output Y denotes if change is to be given or not Y = 0 means no change Y = 1 means change to be provided Output X denotes if item is to be given out or not X=1 only when we have 15 cents or more.

Considering 1 input a. State diagram Output X=1 when we have 15 cents or more Input I0 = 0 means 5 cents were inserted Input I0 = 1 means 10 cents were inserted

b. Truth Table and logic expression Input Current State Next State I0 S1 S0 S1 S0 0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 0 1 1 0 0 1 0 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 1 0 0 Current State Output S1 S0 X

0 0 0 0 1 0 1 0 0 1 1 1 S1 = [(NOT I0) AND (NOT S1) AND (S0)] OR [(NOT I0) AND (S1) AND (NOT S0)] OR [(I0) AND (NOT S1) AND (NOT S0)] OR [(I0) AND (NOT S1) AND (S0)] OR [(I0) AND (S1) AND (NOT S0)] S0 = [(NOT I0) AND (NOT S1) AND (NOT S0)] OR [(NOT I0) AND (S1) AND (NOT S0)] OR [(I0) AND (NOT S1) AND (S0)] OR [(I0) AND (S1) AND (NOT S0)] X = S1 AND S0 c. Enhanced state diagram X = 1 when we have 15 cents or more i.e. item needs to be given out Y = 1 when we need to give change

Problem 2 (3 points) Suppose a 32-bit instruction has a following format: Opcode DR SR1 SR2 UNUSED If there are 225 opcodes and 120 registers, a. What is the minimum number of bits required to represent the OPCODE? b. What is the minimum number of bits required to represent Destination reg? c. What is the maximum number of UNUSED bits in the encoding? a. Minimum number of bits for opcodes: 8 (225 lies between 2 7 = 128 and 2 8 = 256) b. Minimum number of bits required for Destination Reg: 7 (120 lies between 2 6 = 64 and 2 7 = 128) c. Maximum number of UNUSED bits in the encoding: 32-8 - 7 7-7 = 32-29 = 3 (total bits = 32; opcode bits = 8; DR bits = 7; SR1 bits = 7; SR2 bits = 7) Problem 3 (5 points) Consider the following circuit: Assuming that initially X = 0 and Y = 1, show the waveforms for X and Y if the following inputs are applied: First recognize that the circuit is D-latch

Problem 4 (2 points) Given a memory that is addressed by 22 bits and is 3-bit addressable, how many bits of storage does memory contain? Address Bits = 22 Number of entries = 2 22 Addressability = number of bits in each entry = 3 bits Total number of bits of storage = Number of entries * Number of bits in each entry = 2 22 * 3 Problem 5 (6 points)

The following table represents a small memory. Refer to this table for the following questions: Address (in hex) Data 0000 0000 0000 0000 0001 1110 0100 0011 0000 0000 0000 0001 0101 1010 0110 0101 0000 0000 0000 0010 1111 1010 1100 1110 0000 0000 0000 0011 1111 1111 0011 0001 0000 0000 0000 0100 0000 0100 1100 1111 0000 0000 0000 0101 0101 0100 0110 1111 0000 0000 0000 0110 0000 0010 0001 1001 0000 0000 0000 0111 0000 0000 0000 0001 a. What hexadecimal value does address 0x2 contain? What about address 0x5? b. Interpret value at address 0x3 as a 2's complement integer. c. Interpret value at address 0x1 as an ASCII value. d. Interpret value at address 0x4 as an unsigned integer. e. In the von Neumann model, the contents of an entry in memory can be interpreted as an instruction. If the binary patterns in address 0x6 and address 0x0 were interpreted as a LC-3 instruction, what instructions would they represent? Hint: Refer to appendix A.3 for complete instruction set of LC-3 (Page 525 of ltcs). f. A binary value can also be interpreted as a memory address. If the value stored in address 0x7 is a memory address, to what address does it refer? What binary value is stored in that memory address? a. Hexadecimal at address 0x2: 0xFACE Hexadecimal at address 0x5: 0x546F b. Address 3 contains 1111 1111 0011 0001 2 s complement integer representation: -207 c. Address 1 contains in hex: 0x5A65 ASCII value: Ze d. Address 4 contains: 0000 0100 1100 1111 Unsigned integer representation: 1231 e. Address 6: 0000 0010 0001 1001 which corresponds to BRp 0x019 or BRp 33 Address 0: 0001 1110 0100 0011 which corresponds to ADD R7, R1, R3 f. Address 7 contains: 0x0001 If Address 7 contains an address, then value contained at that address (i.e. at 0x0001) is 0x5A65 or 0101 1010 0110 0101