Full Transcript

CSCI 3130 – Exam 1 Study Guide  Assembly o Number of and names of general-purpose registers o OS system function calls (syscall) vs. standard function calls (call) o Register conventions for passing arguments to standard functions. o Text vs. data segme...

CSCI 3130 – Exam 1 Study Guide  Assembly o Number of and names of general-purpose registers o OS system function calls (syscall) vs. standard function calls (call) o Register conventions for passing arguments to standard functions. o Text vs. data segment o Allocating memory using db, dw, dd, dq o global keyword o Opcode o All x86_64 instructions covered in the lecture slides and code examples. o Be able to write a function in assemble language such as:  factorial function  function to compute product of 6 numbers.  function to compute average of 4 numbers.  function to compute volume of cube.  Identification/Terms o Computer organization o Computer architecture o Computer design o George Boole o John Vincent Atanasoff o Claude Shannon o Boolean o Gate o Logic Diagram o Combinational Logic  Conversion o Be able to perform the two's complement on binary signed integers. o Be able to convert signed integers between binary, octal, and hexadecimal.  Boolean Algebra o Be able to derive an expression given a truth table. o Be able to simplify an expression using algebraic manipulation and Boolean identities.  Combinational Circuits o Know the truth table and symbol for each gate.  NOT, AND, OR, NAND, NOR, XOR, XNOR o Be able to draw a logic diagram for simple Boolean expressions.  Look over your notes, assignment(s), circuit file(s), and any other material given!  Some practice questions:  Assembly Language 1. Major difference between high-level language vs low-level languages? 2. What are the advantages of learning assembly language? 3. What do you mean by abstraction in programming language? 4. How many general-purpose registers are there in x86_64 processor? 5. What is an object file? 6. Why do you need to make register rdx 0 before division? 7. Why do you need to make register rax 0 before calling C inbuilt function: printf? 8. What happens to rdx and rax after the mul instruction? 9. How do we recognize comments in assembly code? 10.What does “global ” assembler directive do? 11.What symbol do we use to represent immediate/constant? 12.What symbol is used for registers? 13.System calls are performed using which instruction? 14. What do the following instructions do? First check if it is a valid instruction or not. a) mov rax, message b) mov rax, rsi c) mov message, rax d) mov rdi, [message] 15. What is LEA and how to use it? 16. Let’s assume the following array “Arr” with 16 64-bit integers: Arr: dq 7, 6, 2, 89, 3, 12, 66, 45, 12, 9, 8, 1, 9, 88, 90, 11 Using the Array “Arr” answer what values are moved to the rax register based on the following instructions: Note: please first check if the instructions are valid. Assume rdi = 5. a) mov rax, Arr[rdi * 8] => ? b) mov rax, Arr => ? c) mov Arr => ? d) mov rax, [Arr] => ? 17. What do the following instructions do? a) CMP rax, 0 JE done b) SUB rax, rdx c) MUL rcx (specify what it does and where is the result stored) d) DIV rcx (specify what it does and where is the result stored) 18.Let’s assume rcx = 5, and rax = 3. Answer the following question. a) MUL rcx i. rax = ? ii. rdx = ? iii. rcx = ? b) DIV rcx i. rax = ? ii. rdx = ? iii. rcx = ? 19.Let’s assume rcx = 0x01F5 and rax= 0x00C3F (Hexadecimal representation) a) OR rax, rcx i. rax = ? ii. rcx = ? b) AND rax, rcx i. rax = ? ii. rcx = ? c) NOT rax i. rax = ? ii. rcx = ? 20.What Netwide assembler keyword is used to make an assembly function visible to foreign codes? 21.What Netwide assembler instruction is used to call an os system function call? 22. The db, dw, dd, dq reserves how many bits of memory? 23. Distinguish between.text and.data section.  Format Translation 24.Compute the 2’s complete of the following binary number: a) 00111101 b) 10001001 c) 11101111 25.Convert the following unsigned binary number into decimal, octal and Hex. a) 00011110 b) 10010001 c) 11100101 26.Convert the following signed binary number into decimal, octal and Hex. a) 00011110 b) 10010001 c) 11100101 27.Convert the following unsigned hexadecimal number into binary, decimal, and octal. a) 2CEF b) D3CB c) EF2 28.Convert the following signed hexadecimal number into binary, decimal, and octal. a) 2CEF b) D3CB c) EF2  Computer Organization 29.Draw the diagram and truth table for AND, OR and NOT gate? 30.Draw the diagram and truth table for NAND, NOR and XNOR gate?  Boolean Algebra 31.Why are NAND and NOR considered universal gates? 32. Simplify following Boolean expressions: a) 𝑥𝑦 𝑥’𝑧 𝑦𝑧 b) 𝑥 𝑦𝑧 𝑥 𝑦𝑧 𝑥𝑧 c) 𝑦 𝑥𝑦 ′ d) 𝑥𝑦 ′ 𝑥 𝑦 𝑦 𝑦 e) 𝐴 𝐵 𝐴 𝐶 f) 𝐴 𝐵𝐶 𝐴 𝐵𝐶 𝐴𝐶 g) 𝑋 𝑌 𝑌 𝑌 h) 𝑥 𝑥 𝑦 i) 𝑥 𝑥𝑦 j) 𝑎 𝑎 𝑏 𝑎 𝑐 𝑎 𝑐𝑑 k) 𝑥 𝑦 𝑥𝑦 𝑥 𝑦 l) 𝑥 𝑥𝑦 𝑥𝑧 𝑥𝑦 𝑧′ m) 𝑎 𝑏 𝑏𝑐 𝑎𝑏 𝑐 33. Write the simplified Boolean expression based on following compact truth table using Kmap: a) 𝐹 𝑥, 𝑦 ∑ 𝑚 1,2,3 b) 𝐹 𝑥, 𝑦 ∑ 𝑚 0,1,2,3 c) 𝐹 𝑥, 𝑦, 𝑧 ∑ 𝑚 0,1,3,5,7 d) 𝐹 𝑥, 𝑦, 𝑧 ∑ 𝑚 0,1,2,3,4,5,6,7 e) 𝐹 𝐴, 𝐵, 𝐶 ∑ 𝑚 0,2,4,5,6,7 f) 𝐹 𝑥, 𝑦, 𝑧 ∑ 𝑚 0,1,3,5,7 g) 𝐹 𝐴, 𝐵, 𝐶 ∑ 𝑚 0,2,4,5,6,7 34. Design a simple combinational circuit which calculates the result of the function F(n) = 2n + 4, where n is any 3-bit unsigned integer. In designing the circuit, draw a truth table, derive expressions for each of the outputs, and draw the circuit. 35. Design a simple combinational circuit which calculates the result of the function F(n) = 2n + 8, where n is any 3-bit signed integer. In designing the circuit, draw a truth ta- ble, derive expressions for each of the outputs, and draw the circuit.

Use Quizgecko on...
Browser
Browser