CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK
|
|
- Anissa Brown
- 6 years ago
- Views:
Transcription
1 CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK Question 1: Choose the most appropriate answer 1. In which of the following gates the output is 1 if and only if all the inputs are 0? a. AND b. OR c. NAND d. NOR 2. A truth table has 512 rows when complete. The number of input variables that determine the Boolean function of this truth table is a. 512/2 b c. 8 d How many different numbers can a 6-bit binary word represent? a. 63 b. 64 c. 124 d Which of the following gates are added to the two inputs of an AND gate to convert it to a NOR gate? a. NOT b. AND c. OR d. XOR 5. Which gate connected to a NOT gate produces a NOR gate? a. NOT b. AND c. OR d. XOR 6. The following possible equivalencies have been derived for the Boolean expression X+YZ: I. (X+Y)(X+Z) II. X + Y(X+Z) III. X + (Y +Z ) Which is the correct set of equivalent Boolean expressions? a. I only b. I and II c. I and III d. II and III e. None of I, II or III is equivalent to X +YZ 7. The expression for sum of A, B in the half adder is given by a. AB b. A+B c. A B d. None of the above 8. Which of the following is the binary representation of the hexadecimal number 3B7F? a b c d What is the equivalent of binary ( ) in base 32? 1
2 a b c d The 2's complement of the binary number is a b c d In 2's complement representation, a certain negative number -N is The representation of +N is a b c d The 1's complement of the binary number is a b c d The octal equivalent of is a. 81 b. 72 c. 71 d. all of these 14. In an x86 32-bit architecture stack frame, suppose ebp contains 00f8 and esp contains 00f0, then the size of the stack frame is a. 2 bytes b. 4 bytes c. 8 bytes d. 16 bytes 15. In the above example, what is stored in the memory location 00f8? a. The return address of the stack frame s function b. The starting address of the stack frame s function c. The current value of ebp d. The previous value of ebp 16. In the above example, if the function of the stack frame calls another function, a. The return address of the calling function is saved in the memory location 00f0 b. The return address of the calling function is saved in the memory location 00ec c. The return address of the calling function is saved in the memory location 00e8 d. The return address of the calling function is saved in the memory location 00f8 2
3 Question 2: Minimize the following Boolean functions using the K-map method. (Note: In the truth table specification, for example, 8-11 means minterms 8, 9, 10 and 11; φ represents don t care. a. f1(a, b, c) = Σ ( 0, 3, 4, 6) b. f2(a, b, c, d) = Σ ( 1, 8-11, 13, 15) c. f3(a, B, C, D) = Σ ( 2, 4, 6, 8, 11, 12, 13, 15) +φ (0, 1, 3, 5, 7) d. f4(a, B, C, D) = Σ ( 0, 2, 7, 8, 10, 13, 15) +φ (11, 12, 14) Question 3: Using DeMorgan s theorems, find the complement of the following Boolean function. a. f1 = (a + b )(c + d e )(a + b) (c +de) Question 4: Using the identities in Boolean Algebra, prove the following: a) ABC + ABC + AB C + A BC = AB + AC + BC b) A + A B = A + B Question 5: A combinational circuit has three input lines and two output lines. It takes a 3-bit number and counts the number of 1 s in binary. For example, if the input is 000, the output is 00; if the input is 011, the output is 10, etc. a) Write the truth table b) Minimize the Boolean functions for each output, wherever possible. c) Design the circuit using a two-level AND-OR logic. Question 6: Design a 8-1 multiplexer circuit from the specification and truth table. Redesign the 8-1 multiplexer using 4-1 and/or 2-1 multiplexers as building blocks. Question 7: Draw the state transition diagram for a 3-bit count-down counter with a RESET input. When RESET=0, the counter goes from 111 to 110 to 101, etc. When RESET=1, the counter resets to 111 from any state. Draw the block diagram indicating the number of D flip flops required. Question 8: A computer with 512K memory locations has an instruction format with five fields: an opcode field specifying one of 128 instructions, two register fields specifying one of 40 registers, one memory address field and a constant operand field that can hold 2 HEX digits. What is the total length of the instruction in bits? Show the number of bits in each field in the instruction format. Question 9: Write codes using 3-address, 2-address, 1-address and 0-address instructions for the following arithmetic statement: X = A * (B/C + D) Assume the availability of ADD, SUB, MUL and DIV instructions in addition to LOAD, STORE, PUSH and POP as appropriate. Assume that the memory locations for A, B, etc. are MA, MB, etc. If opcodes are 5 bits long and each memory address is 32 bits, compare the sizes of each code set. Question 10: A computer with 256K memory locations has an instruction format with four fields: an opcode field specifying one of 32 instructions, two register fields specifying one of 24 registers, and one memory address field. What is the total length of the instruction in bits? Show the number of bits in each field in the instruction format. Question 11: The Reference Sheet supplied to you shows the instruction formats of the SRC. Study the formats and write SRC codes to perform each of the following high-level language codes: (a) SUM = 0 SUM = SUM + A + B DIF = DIF - C SUM = SUM + DIF 3
4 (b) IF (A-B) 10,20,30 (that is, the program branches to statement 10 if A-B <0; to statement 20 if A-B=0; and to statement 30 if A-B >0) Question 12: You are given a reference sheet showing the relevant portion of the data path logic of the SRC architecture. The necessary control signals activating various points in the data path logic are also shown. Study the logic and write the concrete RTN and the control signals necessary to enable each of the following operations. Use a neat tabular format showing the time steps, the operations and the control signals in each step. NOTE: You can skip the Instruction Fetch steps. (a) sub ra,rb,rc (b) ori ra,rb,c2 (c) Load into register rb the content of the memory location whose address is in ra (assume that this instruction is already fetched and is in IR) Question 13: Suppose we add another SRC instruction swap ra, rb that exchanges the contents of registers ra and rb. Develop a concrete RTN and a control sequence for this instruction. Note that you cannot use any other register from the register set for temporary data storage because it will destroy the register contents. NOTE: You can skip the Instruction Fetch steps. Question 14: 1. Convert decimal to binary. 2. Convert decimal 153 to binary. 3. Convert decimal 153 to octal. 4. Convert decimal to octal. 5. Convert binary to decimal. 6. Convert Hex 16.5 to decimal. 7. Convert decimal 431 to binary in two ways: (a) convert directly to binary and (b) convert to Hex and then from Hex to binary. Which method is faster? 8. Perform (+13), (-13), (+13), and 6 + (-13) using 2 complement arithmetic. What is the minimum number of bits you need in the representation to fit all the answers? 9. Decode the following two s complement numbers: , , Question No. 15: Write the meanings of each of the following x86 instructions: Instruction movl $0, %eax movb $0x05, al movl (%ecx), %edx movl -4(%ebp), %eax movl -4(%ebp, %edx, 4), %eax leal 8(,%eax,4), %eax leal (%edx,%eax,2), %eax Meaning Question 16: The following C code was assembled in x86 Gnu Assembler. The partial output of the assembly is shown. Complete the missing code. Draw the stack showing its contents. 4
5 int main() { int a = 5; int b = 3; int c = a*2 + b; } _main: pushl %ebp movl %esp, %ebp subl $12, %esp #Add missing code here addl popl retl $12, %esp %ebp Question 17: Write the core part of the assembly code for the C function shown below. Assume that -4(%ebp) has the value of x, -8(%ebp) has the value of y, and -12(%ebp) will hold the value of result. int larger(int x, int y) { int result; if (x > y) result= x; else result= y; return result; } 5
6 Question 18: Assume eax holds 0x100, ecx holds 0x1 and edx holds 0x3. The four memory locations 0x100 to 0x10C hold 0xFF, 0xAB, 0x11 and 0x13, respectively. Show the result of each of the following x86 operations (note: these operations are separate and not in sequence): (Note: a quick reference guide to x86 assembly instructions will be made available). a) add %ecx, (%eax) b) sub %edx, 4 (%eax) c) imul 16, (%eax, %edx, 4) Question 19: A computer system has 256K words of main memory and 16K words of direct-mapped cache memory. The block size is 256 words. The access time for the main memory is 15 times that of the cache memory. a) What is the size of the tag field? b) If a fully associative mapping scheme were used instead, what would be size of the tag field? c) Determine the efficiency of the system assuming a cache hit ratio of 0.9. d) If the cache access time is 200 nanoseconds, what hit ratio would be required to achieve an average access time equal to 500 nanoseconds? Question 20: A set associative cache has a total of 128 blocks divided into sets of 8 blocks each. Main memory has 2048 blocks with 16 words per block. How many bits are needed for the tag field? Question 21: A computer system has 64K words of main memory and a set associative cache. The block size is 16 words and the tag field of the memory address is 5 bits. If the same cache were direct mapped, the main memory address will have a 3-bit tag field. How many words are there in the cache? How many blocks are there in each cache set? Question 22: A computer system has 64K words of main memory and 4K words of fully associative cache. The block size is 16 words. The access time for the Main Memory is 10 times that of the cache memory. (a) Determine the efficiency of the system assuming a cache hit ratio of 0.8. (b) If the cache access time is 100 nanoseconds, what hit ratio would be required to achieve an average access time of 250 nanoseconds? (c) What is the size of the tag field? (d)if a direct mapping scheme were used instead, what would be the size of the tag field? (e)suppose that it has to be converted into a set associative cache with a tag field size equal to 8 bits, how many sets are there? How many blocks are there in each set? 6
7 Some Reference Sheets that you will be given during the exam. Additional reference sheet with the SRC data path logic (simplified) may also be given. REFERENCE SHEET NO. 1 n-bit Binary Numbers n = 1 n = 2 n = 3 n = Boolean Algebra Identities No. Identity 1 a + 0 = a 2 a. 0 = 0 3 a + 1 = 1 4 a.1 = a 5 a + a = a 6 a.a = a 7 a + a = 1 8 a.a = 0 9 a + b = b + a 10 ab = ba 11 a + (b + c) = (a + b) + c 12 a(bc) = (ab)c 13 a(b+c) = ab + ac 14 a + bc = (a+b)(a+c) 15 a =a 16 a + ab = a 17 a + a b = a+b 18 (a+b) = a.b (ab) = a + b 7
8 REFERENCE SHEET NO. 2 SRC Instruction Set Symbolic Meaning representation ld ra, c2 Load register ra with M[c2] (content of memory with address c2) ld ra, c2 (rb) Load register ra with M[c2 + R[rb]] st ra, c2 Store content of ra into M[c2] st ra, c2 (rb) Store content of ra into M[c2 + R[rb]] la ra, c2 Load ra with c2 la ra, c2 (rb) Load ra with c2 + R[rb] addi ra, rb, c2 R[rb] + c2 and store result in ra andi ra, rb, c2 R[rb] AND c2 and store result in ra ori ra, rb, c2 R[rb] OR c2 and store result in ra ldr ra, c1 Load ra with M[[PC] + c1] str ra, c1 Store content of ra in M[[PC] + c1] lar ra, c1 Load ra with [PC] + c1 neg ra, rc not ra, rc add ra, rb, rc sub ra, rb, rc and ra, rb, rc or ra, rb, rc Negate the rc and put it in ra Put the complement of rc in ra Add the contents of rb and rc and put it in ra R[rb] R[rc] into register ra R[rb] AND R[rc] into register ra R[rb] OR R[rc] into regiser ra brzr rb, rc 010 Branch to address in rb if content in rc is zero brnz rb, rc 011 Branch to address in rb if content in rc is not zero brpl rb, rc 100 Branch to address in rb if content in rc is positive brmi rb, rc 101 Branch to address in rb if content in rc is negative br rb 001 Branch always brnv rb 000 Branch never Branch and Link Example: brzrl ra, rb, rc Meaning: Save PC value in ra. Then branch to address in rb if content in rc is zero. brnzl,brpll, brmil, brl and brnvl have similar meanings. shr ra, rb, c2 shl ra, rb, c2 shc ra, rb, c2 shra ra, rb, c2 Shift right the content of rb into ra by c2 bits Shift left the content of rb into ra by c2 bits Circular shift left the content of rb into ra by c2 bits Arithmetic shift right the content of rb into ra by c2 bits shr ra, rb, rc Shift right the content of rb into ra by count in rc Similar meanings for shl ra, rb, rc; shc ra, rb, rc; and shra ra, rb, rc nop stop No operation End
9 REFERENCE SHEET NO. 3 Quick Reference Guide to x86 instructions Instruction Format mov src, dst mov imm, dst push src pop dst add src, dst sub src, dst and src, dst xor src, dst mul src imul src cmp a, b jl label lea src, dst call func ret shr src, dst Purpose Move data between registers, and between registers and memory Move immediate data imm into registers Push the value in src onto the stack Pop the value in the stack onto dst dst = [src] + [dst] dst = [dst]-[src] dst = [src] AND [dst] dst = [src] XOR [dst] Multiply eax and src as unsigned integers, put the product in eax. Same as mul, but sign of the numbers will be maintained. Compare two values. Sets flags used by the conditional jumps given below. NOTE: Compare is relative to the second argument, so jl jumps if b<a. Jump to label if the previous comparison came out true for less than. Other conditions are jle (<=), jge (>=), jeq(==), jge(>=), jg (>), jne (!=) Computes the effective address given by src and stores it in dst Push the address of the next instruction and start executing func Pop the return program counter and jump there. Ends a subroutine. Logical Shift Right dst by src bits Also shl (logical shift left), sar (arithmetic shift right), etc. All registers are prefixed by % All immediate operands are prefixed by $ Operands are suffixed by l for 32 bit instructions: example movl %eax, %ecx moves the content of register eax to register ecx # is the comment marker. Memory address format in an instruction: displacement(base reg, offset reg, scale) where displacement is a constant (positive, negative or zero) Address = content of base reg + displacement + content of offset reg*scale For example, movl -4(%ebp), %eax moves the content of the memory location given the content of ebp register minus 4 to register eax.
QUESTION BANK FOR TEST
CSCI 2121 Computer Organization and Assembly Language PRACTICE QUESTION BANK FOR TEST 1 Note: This represents a sample set. Please study all the topics from the lecture notes. Question 1. Multiple Choice
More informationAdvanced Computer Architecture-CS501. Vincent P. Heuring&Harry F. Jordan Chapter 2 Computer Systems Design and Architecture
Lecture Handout Computer Architecture Lecture No. 4 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2 Computer Systems Design and Architecture 2.3, 2.4,slides Summary 1) Introduction to ISA
More information2 1.1 הקדמה
1 מבוא למחשבים חוברת שקפים ערך: ד"ר אורי סןיסה 2 1.1 הקדמה 3 4 Addressing modes 5 6 7 8 9 10 11 12 13 14 15 16 RTN Description of SRC 17 18 19 *****SRC Simulator Help***** The program simulates a RISC
More informationCPS104 Recitation: Assembly Programming
CPS104 Recitation: Assembly Programming Alexandru Duțu 1 Facts OS kernel and embedded software engineers use assembly for some parts of their code some OSes had their entire GUIs written in assembly in
More informationCS241 Computer Organization Spring 2015 IA
CS241 Computer Organization Spring 2015 IA-32 2-10 2015 Outline! Review HW#3 and Quiz#1! More on Assembly (IA32) move instruction (mov) memory address computation arithmetic & logic instructions (add,
More informationComputer Organization Chapter 4. Prof. Qi Tian Fall 2013
Computer Organization Chapter 4 Prof. Qi Tian Fall 2013 1 Topics Dec. 6 (Friday) Final Exam Review Record Check Dec. 4 (Wednesday) 5 variable Karnaugh Map Quiz 5 Dec. 2 (Monday) 3, 4 variables Karnaugh
More informationUW CSE 351, Winter 2013 Midterm Exam
Full Name: Student ID: UW CSE 351, Winter 2013 Midterm Exam February 15, 2013 Instructions: Make sure that your exam is not missing any of the 9 pages, then write your full name and UW student ID on the
More informationCSE351 Spring 2018, Midterm Exam April 27, 2018
CSE351 Spring 2018, Midterm Exam April 27, 2018 Please do not turn the page until 11:30. Last Name: First Name: Student ID Number: Name of person to your left: Name of person to your right: Signature indicating:
More informationSample Exam I PAC II ANSWERS
Sample Exam I PAC II ANSWERS Please answer questions 1 and 2 on this paper and put all other answers in the blue book. 1. True/False. Please circle the correct response. a. T In the C and assembly calling
More informationSecond Part of the Course
CSC 2400: Computer Systems Towards the Hardware 1 Second Part of the Course Toward the hardware High-level language (C) assembly language machine language (IA-32) 2 High-Level Language g Make programming
More informationCSE351 Autumn 2014 Midterm Exam (29 October 2014)
CSE351 Autumn 2014 Midterm Exam (29 October 2014) (Version A) Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate
More informationRTN (Register Transfer Notation)
RTN (Register Transfer Notation) A formal means of describing machine structure & function. Is at the just right level for machine descriptions. Does not replace hardware description languages. RTN is
More informationProcess Layout and Function Calls
Process Layout and Function Calls CS 6 Spring 07 / 8 Process Layout in Memory Stack grows towards decreasing addresses. is initialized at run-time. Heap grow towards increasing addresses. is initialized
More informationCS61 Section Solutions 3
CS61 Section Solutions 3 (Week of 10/1-10/5) 1. Assembly Operand Specifiers 2. Condition Codes 3. Jumps 4. Control Flow Loops 5. Procedure Calls 1. Assembly Operand Specifiers Q1 Operand Value %eax 0x104
More informationCSE351 Autumn 2014 Midterm Exam (29 October 2014)
CSE351 Autumn 2014 Midterm Exam (29 October 2014) Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate will prove
More informationSOEN228, Winter Revision 1.2 Date: October 25,
SOEN228, Winter 2003 Revision 1.2 Date: October 25, 2003 1 Contents Flags Mnemonics Basic I/O Exercises Overview of sample programs 2 Flag Register The flag register stores the condition flags that retain
More informationCSE2421 FINAL EXAM SPRING Name KEY. Instructions: Signature
CSE2421 FINAL EXAM SPRING 2013 Name KEY Instructions: This is a closed-book, closed-notes, closed-neighbor exam. Only a writing utensil is needed for this exam. No calculators allowed. If you need to go
More informationAssembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction
Assembly Programmer s View Lecture 4A Machine-Level Programming I: Introduction E I P CPU isters Condition Codes Addresses Data Instructions Memory Object Code Program Data OS Data Topics Assembly Programmer
More informationAssembly level Programming. 198:211 Computer Architecture. (recall) Von Neumann Architecture. Simplified hardware view. Lecture 10 Fall 2012
19:211 Computer Architecture Lecture 10 Fall 20 Topics:Chapter 3 Assembly Language 3.2 Register Transfer 3. ALU 3.5 Assembly level Programming We are now familiar with high level programming languages
More informationX86 Addressing Modes Chapter 3" Review: Instructions to Recognize"
X86 Addressing Modes Chapter 3" Review: Instructions to Recognize" 1 Arithmetic Instructions (1)! Two Operand Instructions" ADD Dest, Src Dest = Dest + Src SUB Dest, Src Dest = Dest - Src MUL Dest, Src
More informationadministrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions?
administrivia today start assembly probably won t finish all these slides Assignment 4 due tomorrow any questions? exam on Wednesday today s material not on the exam 1 Assembly Assembly is programming
More informationDo not turn the page until 5:10.
University of Washington Computer Science & Engineering Autumn 2018 Instructor: Justin Hsia 2018-10-29 Last Name: First Name: Student ID Number: Name of person to your Left Right All work is my own. I
More informationCSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs
CSC 2400: Computer Systems Towards the Hardware: Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32)
More informationCSC 8400: Computer Systems. Machine-Level Representation of Programs
CSC 8400: Computer Systems Machine-Level Representation of Programs Towards the Hardware High-level language (Java) High-level language (C) assembly language machine language (IA-32) 1 Compilation Stages
More informationChapter 5 (a) Overview
Chapter 5 (a) Overview (a) The principles of pipelining (a) A pipelined design of SRC (b) Pipeline hazards (b) Instruction-level parallelism (ILP) Superscalar processors Very Long Instruction Word (VLIW)
More information4) C = 96 * B 5) 1 and 3 only 6) 2 and 4 only
Instructions: The following questions use the AT&T (GNU) syntax for x86-32 assembly code, as in the course notes. Submit your answers to these questions to the Curator as OQ05 by the posted due date and
More information6.1 Combinational Circuits. George Boole ( ) Claude Shannon ( )
6. Combinational Circuits George Boole (85 864) Claude Shannon (96 2) Signals and Wires Digital signals Binary (or logical ) values: or, on or off, high or low voltage Wires. Propagate digital signals
More informationCS 31: Intro to Systems Functions and the Stack. Martin Gagne Swarthmore College February 23, 2016
CS 31: Intro to Systems Functions and the Stack Martin Gagne Swarthmore College February 23, 2016 Reminders Late policy: you do not have to send me an email to inform me of a late submission before the
More informationAssembly Language: IA-32 Instructions
Assembly Language: IA-32 Instructions 1 Goals of this Lecture Help you learn how to: Manipulate data of various sizes Leverage more sophisticated addressing modes Use condition codes and jumps to change
More informationTurning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p
Turning C into Object Code Code in files p1.c p2.c Compile with command: gcc -O p1.c p2.c -o p Use optimizations (-O) Put resulting binary in file p text C program (p1.c p2.c) Compiler (gcc -S) text Asm
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College February 9, 2016
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College February 9, 2016 Reading Quiz Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between
More informationcomplement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]
The following pages contain references for use during the exam: tables containing the x86 instruction set (covered so far) and condition codes. You do not need to submit these pages when you finish your
More informationCS 31: Intro to Systems ISAs and Assembly. Kevin Webb Swarthmore College September 25, 2018
CS 31: Intro to Systems ISAs and Assembly Kevin Webb Swarthmore College September 25, 2018 Overview How to directly interact with hardware Instruction set architecture (ISA) Interface between programmer
More informationCS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2016 Lecture 12
CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2016 Lecture 12 CS24 MIDTERM Midterm format: 6 hour overall time limit, multiple sittings (If you are focused on midterm, clock should be running.) Open book
More informationCompiler Construction D7011E
Compiler Construction D7011E Lecture 8: Introduction to code generation Viktor Leijon Slides largely by Johan Nordlander with material generously provided by Mark P. Jones. 1 What is a Compiler? Compilers
More informationIt is possible to define a number using a character or multiple numbers (see instruction DB) by using a string.
1 od 5 17. 12. 2017 23:53 (https://github.com/schweigi/assembler-simulator) Introduction This simulator provides a simplified assembler syntax (based on NASM (http://www.nasm.us)) and is simulating a x86
More informationQuestion 4.2 2: (Solution, p 5) Suppose that the HYMN CPU begins with the following in memory. addr data (translation) LOAD 11110
Questions 1 Question 4.1 1: (Solution, p 5) Define the fetch-execute cycle as it relates to a computer processing a program. Your definition should describe the primary purpose of each phase. Question
More informationSungkyunkwan University
- 2 - Complete addressing mode, address computation (leal) Arithmetic operations Control: Condition codes Conditional branches While loops - 3 - Most General Form D(Rb,Ri,S) Mem[ Reg[ R b ] + S Reg[ R
More informationCS241 Computer Organization Spring Addresses & Pointers
CS241 Computer Organization Spring 2015 Addresses & Pointers 2-24 2015 Outline! Addresses & Pointers! leal - load effective address! Condition Codes & Jumps! conditional statements: if-then-else! conditional
More information2. (a) Compare the characteristics of a floppy disk and a hard disk. (b) Discuss in detail memory interleaving. [8+7]
Code No: A109211202 R09 Set No. 2 1. (a) Explain the purpose of the following registers: i. IR ii. PC iii. MDR iv. MAR. (b) Explain with an example the steps in subtraction of two n-digit unsigned numbers.
More informationComputer Science 104:! Y86 & Single Cycle Processor Design!
Computer Science 104: Y86 & Single Cycle Processor Design Alvin R. Lebeck Slides based on those from Randy Bryant 1 CS:APP Administrative Homework #4 My office hours today 11:30-12:30 Reading: text 4.3
More informationCode No: R Set No. 1
Code No: R059210504 Set No. 1 II B.Tech I Semester Regular Examinations, November 2007 DIGITAL LOGIC DESIGN ( Common to Computer Science & Engineering, Information Technology and Computer Science & Systems
More informationChapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary
Chapter 4 Processor Architecture: Y86 (Sections 4.1 & 4.3) with material from Dr. Bin Ren, College of William & Mary 1 Outline Introduction to assembly programing Introduction to Y86 Y86 instructions,
More informationBasic Pentium Instructions. October 18
Basic Pentium Instructions October 18 CSC201 Section 002 Fall, 2000 The EFLAGS Register Bit 11 = Overflow Flag Bit 7 = Sign Flag Bit 6 = Zero Flag Bit 0 = Carry Flag "Sets the flags" means sets OF, ZF,
More informationCS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 21: Generating Pentium Code 10 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 21: Generating Pentium Code 10 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Simple Code Generation Three-address code makes it
More informationCMSC 313 Lecture 07. Short vs Near Jumps Logical (bit manipulation) Instructions AND, OR, NOT, SHL, SHR, SAL, SAR, ROL, ROR, RCL, RCR
CMSC 313 Lecture 07 Short vs Near Jumps Logical (bit manipulation) Instructions AND, OR, NOT, SHL, SHR, SAL, SAR, ROL, ROR, RCL, RCR More Arithmetic Instructions NEG, MUL, IMUL, DIV Indexed Addressing:
More informationCSE P 501 Compilers. x86 Lite for Compiler Writers Hal Perkins Autumn /25/ Hal Perkins & UW CSE J-1
CSE P 501 Compilers x86 Lite for Compiler Writers Hal Perkins Autumn 2011 10/25/2011 2002-11 Hal Perkins & UW CSE J-1 Agenda Learn/review x86 architecture Core 32-bit part only for now Ignore crufty, backward-compatible
More informationEECE.3170: Microprocessor Systems Design I Summer 2017 Homework 4 Solution
1. (40 points) Write the following subroutine in x86 assembly: Recall that: int f(int v1, int v2, int v3) { int x = v1 + v2; urn (x + v3) * (x v3); Subroutine arguments are passed on the stack, and can
More informationCSE 351 Midterm Exam
University of Washington Computer Science & Engineering Winter 2018 Instructor: Mark Wyse February 5, 2018 CSE 351 Midterm Exam Last Name: First Name: SOLUTIONS UW Student ID Number: UW NetID (username):
More informationAnnouncements. Class 7: Intro to SRC Simulator Procedure Calls HLL -> Assembly. Agenda. SRC Procedure Calls. SRC Memory Layout. High Level Program
Fall 2006 CS333: Computer Architecture University of Virginia Computer Science Michele Co Announcements Class 7: Intro to SRC Simulator Procedure Calls HLL -> Assembly Homework #2 Due next Wednesday, Sept.
More informationCS 3843 Final Exam Fall 2012
CS 3843 Final Exam Fall 2012 Name (Last), (First) ID Please indicate your session: Morning Afternoon You may use a calculator and two sheets of notes on this exam, but no other materials and no computer.
More informationBinghamton University. CS-220 Spring x86 Assembler. Computer Systems: Sections
x86 Assembler Computer Systems: Sections 3.1-3.5 Disclaimer I am not an x86 assembler expert. I have never written an x86 assembler program. (I am proficient in IBM S/360 Assembler and LC3 Assembler.)
More informationProcedure Calls. Young W. Lim Sat. Young W. Lim Procedure Calls Sat 1 / 27
Procedure Calls Young W. Lim 2016-11-05 Sat Young W. Lim Procedure Calls 2016-11-05 Sat 1 / 27 Outline 1 Introduction References Stack Background Transferring Control Register Usage Conventions Procedure
More informationInstruction Set Architecture
CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Instruction Set Architecture Assembly Language View! Processor
More informationCode No: R Set No. 1
Code No: R059210504 Set No. 1 II B.Tech I Semester Regular Examinations, November 2006 DIGITAL LOGIC DESIGN ( Common to Computer Science & Engineering, Information Technology and Computer Science & Systems
More informationInstruction Set Architecture
CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant Carnegie Mellon University http://csapp.cs.cmu.edu CS:APP Instruction Set Architecture Assembly Language View Processor
More informationWhat is a Compiler? Compiler Construction SMD163. Why Translation is Needed: Know your Target: Lecture 8: Introduction to code generation
Compiler Construction SMD163 Lecture 8: Introduction to code generation Viktor Leijon & Peter Jonsson with slides by Johan Nordlander Contains material generously provided by Mark P. Jones What is a Compiler?
More informationComputer Systems Organization V Fall 2009
Computer Systems Organization V22.0201 Fall 2009 Sample Midterm Exam ANSWERS 1. True/False. Circle the appropriate choice. (a) T (b) F At most one operand of an x86 assembly instruction can be an memory
More informationCENG 450: Instruction Set (16-bit)
CENG 450: Instruction Set (16-bit) In this lab, you will design and implement a pipelined 16-bit processor on FPGA. The instructions set of the processor is as follows: Instructions Set We use a RISC-like
More informationMachine-Level Programming II: Control and Arithmetic
Machine-Level Programming II: Control and Arithmetic CSCI 2400: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides 1 Today Complete addressing mode, address
More informationY86 Processor State. Instruction Example. Encoding Registers. Lecture 7A. Computer Architecture I Instruction Set Architecture Assembly Language View
Computer Architecture I Instruction Set Architecture Assembly Language View Processor state Registers, memory, Instructions addl, movl, andl, How instructions are encoded as bytes Layer of Abstraction
More informationB.Tech II Year I Semester (R13) Regular Examinations December 2014 DIGITAL LOGIC DESIGN
B.Tech II Year I Semester () Regular Examinations December 2014 (Common to IT and CSE) (a) If 1010 2 + 10 2 = X 10, then X is ----- Write the first 9 decimal digits in base 3. (c) What is meant by don
More informationSystem Programming and Computer Architecture (Fall 2009)
System Programming and Computer Architecture (Fall 2009) Recitation 2 October 8 th, 2009 Zaheer Chothia Email: zchothia@student.ethz.ch Web: http://n.ethz.ch/~zchothia/ Topics for Today Classroom Exercise
More informationIntel x86-64 and Y86-64 Instruction Set Architecture
CSE 2421: Systems I Low-Level Programming and Computer Organization Intel x86-64 and Y86-64 Instruction Set Architecture Presentation J Read/Study: Bryant 3.1 3.5, 4.1 Gojko Babić 03-07-2018 Intel x86
More informationCSc 256 Final Fall 2016
CSc 256 Final Fall 2016 NAME: Problem 1 (25 points) Translate the C/C++ function func() into MIPS assembly language. The prototype is: void func(int arg0, int *arg1); arg0-arg1 are in $a0- $a1 respectively.
More informationThe Hardware/Software Interface CSE351 Spring 2013
The Hardware/Software Interface CSE351 Spring 2013 x86 Programming II 2 Today s Topics: control flow Condition codes Conditional and unconditional branches Loops 3 Conditionals and Control Flow A conditional
More informationProgram Exploitation Intro
Program Exploitation Intro x86 Assembly 04//2018 Security 1 Univeristà Ca Foscari, Venezia What is Program Exploitation "Making a program do something unexpected and not planned" The right bugs can be
More informationCS 33: Week 3 Discussion. x86 Assembly (v1.0) Section 1G
CS 33: Week 3 Discussion x86 Assembly (v1.0) Section 1G Announcements - HW2 due Sunday - MT1 this Thursday! - Lab2 out Info Name: Eric Kim (Section 1G, 2-4 PM, BH 5419) Office Hours (Boelter 2432) - Wed
More informationChapter 2: Machine Languages and Digital Logic
Chapter 2: Machine Languages and igital Logic Computer ystems esign and rchitecture What are the components of an I? ometimes known as The Programmers Model of the machine torage cells General and special
More informationSistemi Operativi. Lez. 16 Elementi del linguaggio Assembler AT&T
Sistemi Operativi Lez. 16 Elementi del linguaggio Assembler AT&T Data Sizes Three main data sizes Byte (b): 1 byte Word (w): 2 bytes Long (l): 4 bytes Separate assembly-language instructions E.g., addb,
More informationCode No: R Set No. 1
Code No: R059210504 Set No. 1 II B.Tech I Semester Supplementary Examinations, February 2007 DIGITAL LOGIC DESIGN ( Common to Computer Science & Engineering, Information Technology and Computer Science
More information1 /* file cpuid2.s */ 4.asciz "The processor Vendor ID is %s \n" 5.section.bss. 6.lcomm buffer, section.text. 8.globl _start.
1 /* file cpuid2.s */ 2.section.data 3 output: 4.asciz "The processor Vendor ID is %s \n" 5.section.bss 6.lcomm buffer, 12 7.section.text 8.globl _start 9 _start: 10 movl $0, %eax 11 cpuid 12 movl $buffer,
More informationCSE 351 Midterm - Winter 2015 Solutions
CSE 351 Midterm - Winter 2015 Solutions February 09, 2015 Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate
More informationCSE 351 Midterm Exam Spring 2016 May 2, 2015
Name: CSE 351 Midterm Exam Spring 2016 May 2, 2015 UWNetID: Solution Please do not turn the page until 11:30. Instructions The exam is closed book, closed notes (no calculators, no mobile phones, no laptops,
More informationIntroduction to Computer Systems. Exam 1. February 22, This is an open-book exam. Notes are permitted, but not computers.
15-213 Introduction to Computer Systems Exam 1 February 22, 2005 Name: Andrew User ID: Recitation Section: This is an open-book exam. Notes are permitted, but not computers. Write your answer legibly in
More informationProcedure Calls. Young W. Lim Mon. Young W. Lim Procedure Calls Mon 1 / 29
Procedure Calls Young W. Lim 2017-08-21 Mon Young W. Lim Procedure Calls 2017-08-21 Mon 1 / 29 Outline 1 Introduction Based on Stack Background Transferring Control Register Usage Conventions Procedure
More informationFunction Calls COS 217. Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site)
Function Calls COS 217 Reading: Chapter 4 of Programming From the Ground Up (available online from the course Web site) 1 Goals of Today s Lecture Finishing introduction to assembly language o EFLAGS register
More informationIntel Instruction Set (gas)
Intel Instruction Set (gas) These slides provide the gas format for a subset of the Intel processor instruction set, including: Operation Mnemonic Name of Operation Syntax Operation Examples Effect on
More information10-1 C D Pearson Education, Inc. M. Morris Mano & Charles R. Kime LOGIC AND COMPUTER DESIGN FUNDAMENTALS, 4e
10-1 C D E A B 10-2 A B A B C (A B) C D A A B (A B) C E D (A B) C D E (A B) C + D E (A B) C 10-3 Opcode Mode Address or operand 10-4 Memory 250 Opcode Mode PC = 250 251 ADRS 252 Next instruction ACC Opcode:
More informationHow Software Executes
How Software Executes CS-576 Systems Security Instructor: Georgios Portokalidis Overview Introduction Anatomy of a program Basic assembly Anatomy of function calls (and returns) Memory Safety Intel x86
More informationCredits and Disclaimers
Credits and Disclaimers 1 The examples and discussion in the following slides have been adapted from a variety of sources, including: Chapter 3 of Computer Systems 2 nd Edition by Bryant and O'Hallaron
More informationMachine Level Programming II: Arithmetic &Control
Machine Level Programming II: Arithmetic &Control Arithmetic operations Control: Condition codes Conditional branches Loops Switch Kai Shen 1 2 Some Arithmetic Operations Two Operand Instructions: Format
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Warren Hunt, Jr. and Bill Young Department of Computer Sciences University of Texas at Austin Last updated: October 1, 2014 at 12:03 CS429 Slideset 6: 1 Topics
More informationCS , Spring 2004 Exam 1
Andrew login ID: Full Name: CS 15-213, Spring 2004 Exam 1 February 26, 2004 Instructions: Make sure that your exam is not missing any sheets (there should be 15), then write your full name and Andrew login
More informationDo not turn the page until 11:30.
University of Washington Computer Science & Engineering Autumn 2016 Instructor: Justin Hsia 2016-11-02 Last Name: First Name: Perfect Perry Student ID Number: 1234567 Section you attend (circle): Chris
More informationIntroduction to Computer Systems. Exam 1. February 22, Model Solution fp
15-213 Introduction to Computer Systems Exam 1 February 22, 2005 Name: Andrew User ID: Recitation Section: Model Solution fp This is an open-book exam. Notes are permitted, but not computers. Write your
More information16.317: Microprocessor Systems Design I Fall 2014
16.317: Microprocessor Systems Design I Fall 2014 Exam 2 Solution 1. (16 points, 4 points per part) Multiple choice For each of the multiple choice questions below, clearly indicate your response by circling
More informationInstruction Set Architecture
CISC 360 Instruction Set Architecture Michela Taufer October 9, 2008 Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective, R. Bryant and D. O'Hallaron, Prentice Hall, 2003 Chapter
More informationCISC 360 Instruction Set Architecture
CISC 360 Instruction Set Architecture Michela Taufer October 9, 2008 Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective, R. Bryant and D. O'Hallaron, Prentice Hall, 2003 Chapter
More informationInstruction Set Architecture
CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant adapted by Jason Fritts http://csapp.cs.cmu.edu CS:APP2e Hardware Architecture - using Y86 ISA For learning aspects
More informationInjntu.com Injntu.com Injntu.com R16
1. a) What are the three methods of obtaining the 2 s complement of a given binary (3M) number? b) What do you mean by K-map? Name it advantages and disadvantages. (3M) c) Distinguish between a half-adder
More informationComputer Science 104:! Y86 & Single Cycle Processor Design!
Computer Science 104:! Y86 & Single Cycle Processor Design! Alvin R. Lebeck! Slides based on those from Randy Bryant 1! CS:APP! CS:APP! Administrative! 2! CS:APP! Instruction Set Architecture! Application!
More informationThe Assembly Language of the Boz 5
The Assembly Language of the Boz 5 The Boz 5 uses bits 31 27 of the IR as a five bit opcode. Of the possible 32 opcodes, only 26 are implemented. Op-Code Mnemonic Description 00000 HLT Halt the Computer
More informationHomework. In-line Assembly Code Machine Language Program Efficiency Tricks Reading PAL, pp 3-6, Practice Exam 1
Homework In-line Assembly Code Machine Language Program Efficiency Tricks Reading PAL, pp 3-6, 361-367 Practice Exam 1 1 In-line Assembly Code The gcc compiler allows you to put assembly instructions in-line
More informationMachine-Level Programming II: Control Flow
Machine-Level Programming II: Control Flow Today Condition codes Control flow structures Next time Procedures Fabián E. Bustamante, Spring 2010 Processor state (ia32, partial) Information about currently
More informationRISC Processor Simulator (SRC) INEL 4215: Computer Architecture and Organization Feb 14, 2005
General Project Description RISC Processor Simulator (SRC) INEL 4215: Computer Architecture and Organization Feb 14, 2005 In the textbook, Computer Systems Design and Architecture by Heuring, we have the
More informationReverse Engineering Low Level Software. CS5375 Software Reverse Engineering Dr. Jaime C. Acosta
1 Reverse Engineering Low Level Software CS5375 Software Reverse Engineering Dr. Jaime C. Acosta Machine code 2 3 Machine code Assembly compile Machine Code disassemble 4 Machine code Assembly compile
More information3.1 DATA MOVEMENT INSTRUCTIONS 45
3.1.1 General-Purpose Data Movement s 45 3.1.2 Stack Manipulation... 46 3.1.3 Type Conversion... 48 3.2.1 Addition and Subtraction... 51 3.1 DATA MOVEMENT INSTRUCTIONS 45 MOV (Move) transfers a byte, word,
More informationComputer Architecture Programming the Basic Computer
4. The Execution of the EXCHANGE Instruction The EXCHANGE routine reads the operand from the effective address and places it in DR. The contents of DR and AC are interchanged in the third microinstruction.
More informationCSE 351 Midterm - Winter 2015
CSE 351 Midterm - Winter 2015 February 09, 2015 Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate will prove
More information