Question 0. Do not turn this page until you have received the signal to start. (Please fill out the identification section above) Good Luck!

Similar documents
Week 10: Assembly Programming

ECE Exam I February 19 th, :00 pm 4:25pm

MIPS Reference Guide

ECE 2035 Programming HW/SW Systems Fall problems, 7 pages Exam Two 23 October 2013

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam One 4 February Your Name (please print clearly)

MIPS Instruction Reference

Q1: /30 Q2: /25 Q3: /45. Total: /100

F. Appendix 6 MIPS Instruction Reference

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 22 September Your Name (please print clearly) Signed.

Programming the processor

MIPS Instruction Format

TSK3000A - Generic Instructions

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Two 11 March Your Name (please print) total

EEM 486: Computer Architecture. Lecture 2. MIPS Instruction Set Architecture

Computer Architecture. The Language of the Machine

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam One 19 September 2012

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 23 October Your Name (please print clearly) Signed.

MIPS Instruction Set

ECE 2035 Programming HW/SW Systems Fall problems, 6 pages Exam Two 21 October 2016

CSc 256 Midterm 2 Fall 2011

CSc 256 Midterm 2 Spring 2012

The MIPS Instruction Set Architecture

M2 Instruction Set Architecture

SPIM Instruction Set

ECE 2035 A Programming Hw/Sw Systems Fall problems, 8 pages Final Exam 8 December 2014

Reduced Instruction Set Computer (RISC)

Midterm. Sticker winners: if you got >= 50 / 67

Assembly Programming

ECE 2035 A Programming Hw/Sw Systems Spring problems, 8 pages Final Exam 29 April 2015

ECE 2035 Programming Hw/Sw Systems Fall problems, 10 pages Final Exam 9 December 2013

ECE 2035 Programming HW/SW Systems Spring problems, 6 pages Exam Three 10 April 2013

101 Assembly. ENGR 3410 Computer Architecture Mark L. Chang Fall 2009

Reduced Instruction Set Computer (RISC)

MIPS Assembly Language. Today s Lecture

Today s Lecture. MIPS Assembly Language. Review: What Must be Specified? Review: A Program. Review: MIPS Instruction Formats

Lec 10: Assembler. Announcements

CSc 256 Midterm (green) Fall 2018

Computer Architecture. MIPS Instruction Set Architecture

Overview. Introduction to the MIPS ISA. MIPS ISA Overview. Overview (2)

ECE 2035 A Programming Hw/Sw Systems Fall problems, 10 pages Final Exam 14 December 2016

MIPS Assembly Language

Project Part A: Single Cycle Processor

ECE 2035 A Programming Hw/Sw Systems Fall problems, 8 pages Final Exam 9 December 2015

Adventures in Assembly Land

MIPS ISA. 1. Data and Address Size 8-, 16-, 32-, 64-bit 2. Which instructions does the processor support

Flow of Control -- Conditional branch instructions

Examples of branch instructions

CSc 256 Final Fall 2016

CS 61c: Great Ideas in Computer Architecture

Exam in Computer Engineering

Mips Code Examples Peter Rounce

ENCM 369 Winter 2013: Reference Material for Midterm #2 page 1 of 5

CPS311 - COMPUTER ORGANIZATION. A bit of history

Mark Redekopp, All rights reserved. EE 357 Unit 11 MIPS ISA

Instruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers

ECE 15B Computer Organization Spring 2010

Computer Organization & Design

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions

CSc 256 Final Spring 2011

Computer Architecture Experiment

The MIPS R2000 Instruction Set

EE108B Lecture 3. MIPS Assembly Language II

ece4750-parc-isa.txt

ICS DEPARTMENT ICS 233 COMPUTER ARCHITECTURE & ASSEMBLY LANGUAGE. Midterm Exam. First Semester (141) Time: 1:00-3:30 PM. Student Name : _KEY

ECE232: Hardware Organization and Design. Computer Organization - Previously covered

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA MIPS ISA. In a CPU. (vonneumann) Processor Organization

software hardware Which is easier to change/design???

Review: Organization. CS152 Computer Architecture and Engineering Lecture 2. Review of MIPS ISA and Design Concepts

MIPS Assembly Language Programming

Arithmetic for Computers

MIPS Coding Snippets. Prof. James L. Frankel Harvard University. Version of 9:32 PM 14-Feb-2016 Copyright 2016 James L. Frankel. All rights reserved.

CISC 662 Graduate Computer Architecture. Lecture 4 - ISA

CS 351 Exam 2 Mon. 11/2/2015

Recap from Last Time. CSE 2021: Computer Organization. Levels of Programming. The RISC Philosophy 5/19/2011

Digital System Design II

Final Project: MIPS-like Microprocessor

Kernel Registers 0 1. Global Data Pointer. Stack Pointer. Frame Pointer. Return Address.

5/17/2012. Recap from Last Time. CSE 2021: Computer Organization. The RISC Philosophy. Levels of Programming. Stored Program Computers

INSTRUCTION SET COMPARISONS

RTL Model of a Two-Stage MIPS Processor

MACHINE LANGUAGE. To work with the machine, we need a translator.

EE 109 Unit 13 MIPS Instruction Set. Instruction Set Architecture (ISA) Components of an ISA INSTRUCTION SET OVERVIEW

EE 109 Unit 8 MIPS Instruction Set

Mark Redekopp, All rights reserved. EE 352 Unit 3 MIPS ISA

Concocting an Instruction Set

CS152 Computer Architecture and Engineering. Lecture 1 Introduction & MIPS Review Dave Patterson. www-inst.eecs.berkeley.

CS 4200/5200 Computer Architecture I

Review. Lecture #9 MIPS Logical & Shift Ops, and Instruction Representation I Logical Operators (1/3) Bitwise Operations

Some material adapted from Mohamed Younis, UMBC CMSC 611 Spr 2003 course slides Some material adapted from Hennessy & Patterson / 2003 Elsevier

Midterm. CS64 Spring Midterm Exam

A General-Purpose Computer The von Neumann Model. Concocting an Instruction Set. Meaning of an Instruction. Anatomy of an Instruction

MIPS%Assembly% E155%

Concocting an Instruction Set

Compiling Techniques

A Processor. Kevin Walsh CS 3410, Spring 2010 Computer Science Cornell University. See: P&H Chapter , 4.1-3

Lab 3: Pipelined MIPS Assigned: Wed., 2/13; Due: Fri., 3/1 (Midnight)

CS61c MIDTERM EXAM: 3/17/99

We will study the MIPS assembly language as an exemplar of the concept.

Assembly Language. Prof. Dr. Antônio Augusto Fröhlich. Sep 2006

Number Systems and Their Representations

Transcription:

CSC B58 Winter 2017 Final Examination Duration 2 hours and 50 minutes Aids allowed: none Last Name: Student Number: UTORid: First Name: Question 0. [1 mark] Read and follow all instructions on this page, and fill in all fields appropriately. Do not turn this page until you have received the signal to start. (Please fill out the identification section above) Good Luck! This exam is double-sided, and consists of 7 questions on 20 pages (including this one). When you receive the signal to start, please make sure that you have all pages. If you use any space for rough work, indicate clearly what you want marked. Draw a smiley face in the bottom right corner of this page Do not remove any pages from the exam booklet. Don t draw a smiley face, instead write Hi Brian in the bottom right corner of this page (good thing you kept reading huh?) All code must include full documentation. Undocumented code will not be graded. # 0: /1 # 1: /5 # 2: /5 # 3: /4 # 4: /4 # 5: /6 # 6: /12 # 7: /13 TOTAL: /50 Total Pages = 20

[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of your work that you want us to mark.] Page 2 of 20

Question 1. [5 marks] Assuming that Q 0 starts low, complete the following timing diagram Page 3 of 20

[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of your work that you want us to mark.] Page 4 of 20

Question 2. [5 marks] Use Booth s Algorithm to compute 43 37 (numbers given in decimal). Show all your work. Page 5 of 20

[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of your work that you want us to mark.] Page 6 of 20

Question 3. [4 marks] In the image below, highlight the datapath for the following instruction: bgtz $t0, LABEL1 Page 7 of 20

[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of your work that you want us to mark.] Page 8 of 20

Question 4. [4 marks] Draw lines connecting the Verilog modules which have equivalent behaviour Page 9 of 20

[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of your work that you want us to mark.] Page 10 of 20

Question 5. [6 marks] Consider the following Verilog module: module mystery (Q, D, L, E, C, R); input [7:0] D; input L, E, C, R; output reg [7:0] Q; always @posedge C, negedge R) if (~R) Q <= 0; else if (L): Q <= D; else if (E) Q <= Q + 1; endmodule Part (a) [3 marks] In one sentence, what does the module do? Part (b) [3 marks] What is the purpose/function of each of the following signals? Q D L E C R Page 11 of 20

. Page 12 of 20

Question 6. Part (a) [4 marks] [12 marks] In the opposite page, draw the flow-chart for a function between that takes 3 parameters, max, min and x (in that order), and returns 1 if MIN apple x apple MIN, and 0 otherwise. <-- Your flow chat goes there Part (b) [8 marks] In the space below, write the assembly code for between including any data declarations and all comments and labels. Page 13 of 20

[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of your work that you want us to mark.] Page 14 of 20

Question 7. [13 marks] Assuming you have a properly designed and coded function called is vowel, which takes the ascii value of a letter as input, and returns 1 if that letter is a vowel, and 0 otherwise. Write a program that declares a string, replaces all of the vowels in that string with the letter X, and then prints the result to the console. You must include all data declarations and complete comments. Page 15 of 20

[Use the space below for rough work. This page will not be marked unless you clearly indicate the part of your work that you want us to mark.] Page 16 of 20

MIPS Reference Sheet You may remove this sheet, nothing on this page will be marked Arithmetic Instructions Instruction Opcode/Function Syntax Operation add 100000 $d, $s, $t $d = $s + $t addu 100001 $d, $s, $t $d = $s + $t addi 001000 $t, $s, i $t = $s + SE(i) addiu 001001 $t, $s, i $t = $s + SE(i) div 011010 $s, $t lo = $s / $t; hi = $s % $t divu 011011 $s, $t lo = $s / $t; hi = $s % $t mult 011000 $s, $t hi:lo = $s * $t multu 011001 $s, $t hi:lo = $s * $t sub 100010 $d, $s, $t $d = $s - $t subu 100011 $d, $s, $t $d = $s - $t Logical Instructions Instruction Opcode/Function Syntax Operation and 100100 $d, $s, $t $d = $s & $t andi 001100 $t, $s, i $t = $s & ZE(i) nor 100111 $d, $s, $t $d = ~($s $t) or 100101 $d, $s, $t $d = $s $t ori 001101 $t, $s, i $t = $s ZE(i) xor 100110 $d, $s, $t $d = $s ^$t xori 001110 $t, $s, i $t = $s ^ZE(i) Shift Instructions Instruction Opcode/Function Syntax Operation sll 000000 $d, $t, a $d = $t << a sllv 000100 $d, $t, $s $d = $t << $s sra 000011 $d, $t, a $d = $t >> a srav 000111 $d, $t, $s $d = $t >> $s srl 000010 $d, $t, a $d = $t >>> a srlv 000110 $d, $t, $s $d = $t >>> $s Data Movement Instructions Instruction Opcode/Function Syntax Operation mfhi 010000 $d $d = hi mflo 010010 $d $d = lo mthi 010001 $s hi = $s mtlo 010011 $s lo = $s Branch Instructions Instruction Opcode/Function Syntax Operation beq 000100 $s, $t, label if ($s == $t) pc <- label bgtz 000111 $s, label if ($s > 0) pc <- label blez 000110 $s, label if ($s <= 0) pc <- label bne 000101 $s, $t, label if ($s!= $t) pc <- label Page 19 of 20

Jump Instructions Instruction Opcode/Function Syntax Operation j 000010 label pc <- label jal 000011 label $ra = pc; pc <- label jalr 001001 $s $ra = pc; pc = $s jr 001000 $s pc = $s Comparison Instructions Instruction Opcode/Function Syntax Operation slt 101010 $d, $s, $t $d = ($s < $t) sltu 101001 $d, $s, $t $d = ($s < $t) slti 001010 $t, $s, i $t = ($s < SE(i)) sltiu 001001 $t, $s, i $t = ($s < SE(i)) Memory Instructions Instruction Opcode/Function Syntax Operation lb 100000 $t, i ($s) $t = SE (MEM [$s + i]:1) lbu 100100 $t, i ($s) $t = ZE (MEM [$s + i]:1) lh 100001 $t, i ($s) $t = SE (MEM [$s + i]:2) lhu 100101 $t, i ($s) $t = ZE (MEM [$s + i]:2) lw 100011 $t, i ($s) $t = MEM [$s + i]:4 sb 101000 $t, i ($s) MEM [$s + i]:1 = LB ($t) sh 101001 $t, i ($s) MEM [$s + i]:2 = LH ($t) sw 101011 $t, i ($s) MEM [$s + i]:4 = $t Pseudo Instructions Instruction Opcode/Function Syntax Operation la N/A $t, label $t = SE (MEM [label]:1) li N/A $t, i $t = i syscall N/A Call system trap, trapcode is in $v0 Trap Codes Service Trap Code Input/Output print int 1 $a0 is int to print print string 4 $a0 is address of ASCIIZ string to print read int 5 $v0 is int read read string 8 $a0 is address of buffer, $a1 is buffer size in bytes exit 10 Page 20 of 20 End of Test