Difference between revisions of "CSC231 Class Page 2015"

From dftwiki3
Jump to: navigation, search
( )
( )
Line 678: Line 678:
 
* Homework
 
* Homework
 
|
 
|
*  
+
* [[CSC231_An_Introduction_to_Fixed-_and_Floating-Point_Numbers | Introduction to Fixed- and Floating-Point Numbers]]
 
|}
 
|}
  

Revision as of 09:47, 30 November 2015

--D. Thiebaut (talk) 11:28, 26 August 2015 (EDT)



Main Page | Syllabus | Weekly Schedule | Links & Resources |Piazza





 


Week 1 Sept 7    


Topics: Introduction, Python, Idle, Piazza, Moodle submission Lab/Hw Reading
  • Reading
    • Chapter 1 in the Art of Assembly.
    • Also Chapter 3, Sections 0 to 3.1.2.
    • Sections 1.3.1, 1.3.2, 1.3.3, 1.3.4, and 1.3.5 in Carter's PC Assembly Language. Note, Carter uses 1A92h to represent a hexadecimal number. I prefer 0x1A92.




 


Week 2 Sept. 14    


Topics: Processor and Memory, working with the shell, and emacs. Lab/Hw Reading
  • Monday:
RichardTuttle.png
  • Review PC destruction lab. Main players: Processor, cores, RAM, motherboard, crystal
  • How would Richard Tuttle see a computer motherboard? This is some of his artwork.
  • First diagram of a computer as seen by an assembly language programmer
  • Review Hello World program with this new knowledge

Notice how the main character uses all kinds of software packages to solve his problem. It includes working in a shell, using shell commands, and mixing the results with various programming techniques.

  • Wednesday
  • ls, cd, pwd, mkdir, rm, rmdir, cp
  • history, !, !!, alias, w, ps, who am i
  • grep, wc, head, tail
  • Redirection
  • Pipes
  • Emacs
  • quick overview (see this page)
  • set of commands
  • Lab
  • Homework




 


Week 3 Sept. 21    


Topics: Number Systems, the MOV instruction Lab/Hw Reading
  • Monday:
Crystal.jpg
ProcessorSpeedOverYears.jpg
  • Let's talk about the crystal
  • Relationship with instructions
  • Power-law for increase in processor speed
  • Ray Kurzweil on Power Laws (go to marker 3:30 min in video)
  • Playing a game of numbers
  • Hexadecimal system:
for i in range( 256 ): 
     print( i, format( i, '02X' ) )
  • Assembly:
  • Review nasm, ld
  • Understanding how data fits in memory: printing strings defined by db
  • Size of a program: data + code
  
   size helloWorld2
   text	   data	    bss	    dec	    hex	filename
     34	     14	      0	     48	     30	helloWorld2

  • Listing of the assembly and its code:
 
   nasm -f elf -l helloWorld2.lst helloWorld2.asm
   ls 
   ...
   helloWorld2.lst 
   ...

  • Wednesday
   hexdump -v -C helloWorld2
 
   00000000  7f 45 4c 46 01 01 01 00 ...
   ...
   000002b0  74 61 00 5f 65 6e 64 00    |ta._end.|
   000002b8
Observe the output of hexdump command




 


Week 4 Sept. 28    


Topics: The Mov instruction. Arithmetic instructions. Addressing Modes. Lab/Hw Reading
  • Monday:

  • Wednesday




 


Week 5 Oct 5    


Topics: Lab/Hw Reading
  • Monday:
Pentium.gif
MultiCore.jpg
  • Arithmetic instructions: ADD, SUB, INC, DEC. Skip MUL and DIV for right now.
  • A quick introduction to calling functions: CALL and RET
  • Printing decimal numbers in assembly
  • A first look at what is behind code like this:
int a;
int b;
int c;

a = 3;
b = 5;
c = a + b;
int a;
int b;
int c;
int d;

a = 3;
b = 5;
c = a*2 + b;
d = (a + b + 10 + 2*c ) * 2 - 20;
  • Exercise 2: translate the following code in assembly. If you need to refresh your memory on Java types, check this document out:
int a = 3, b = 5, c;
short d = 10, e = 0xff, f = 0;

c = ( a * 2  + b ) * 3;
f = d + (e-1);
c = a * 2* d;

  • Wednesday
  • Mountain Day?




 


Week 6 Oct. 12    


Topics: call/ret, looping, mul/div Lab/Hw Reading
  • Monday: Fall Break

  • Wednesday
  • Back to call and ret instructions: defining and using functions.
  • Exercise 1: Create a function that adds two int variables together
  • Exercise 2: Add a function that prints the two variables and their sum
  • mul and div: multi-register instructions. EDX:EAX used as default registers.
  • Exercise 3: Write a Teller-Machine program
  • The loop instruction: ECX is the counter
  • Program 1: function computes sum of 2 ints
  • Program 2: compute sum of 2 ints and print sum




 


Week 7 Oct 19    


Topics: Lab/Hw Reading
  • Monday:
  • Exercise 1: Write a Teller-Machine program
  • The loop instruction: ECX is the counter
  • Exercise 2: Compute the sum of all ints between 1 and n. (There are many possible answers)
  • Exercise 4: What is the largest amount of looping we can do with the loop instructions?
  • Exercise 5: How long does it take a loop to accumulate the sum of all the ints between 1 and 1,000,000? Any particular issues one should be worried about?
  • Program 3: Teller machine program.
  • Program 4: Teller machine with function.

  • Wednesday
The user time is how long your program was running on the processor. The sys time is how long your program was waiting for the OS to perform tasks for it. In general, (user time + sys time) is a good approximation of the time your program needs to run to completion. The real time contains the time that other processes took out of the CPU while your program was running.
  • How many processes are running at the same time? ps and top commands.
  • Addressing modes: the response of processor designers to the complexity of high-level languages.
Slides on addressing modes
  • No homework this week. Prepare for the midterm!




 


Week 8 Oct. 26    


Topics: Lab/Hw Reading
  • Monday: Midterm Exam: in class, on paper, closed everything.

  • Wednesday
  • Logic Instructions: OR, AND, XOR, NOT: they work in binary!
  • Using logic instruction to mask various bit sections.
  • Exercise:
  • Clear the upper 16 bits of eax
  • Set the upper 4 bits of al to 0
  • Set the lower 4 bits of al to 1
  • Print AL in hex.
  • Reading




 


Week 9 Nov. 2    


Topics: And, Or, and Not gates. Signed Integer format. Lab/Hw Reading
  • Monday:



// signedUnsigned.cpp
// compile and run:
// g++ signedUnsigned.cpp
// ./a.out
//

#include <iostream>
#include <stdio.h>
using namespace std;

int main( int argc, char *argv[] ) {
        unsigned u = 1;  // unsigned int variable
        int      i = 1;    // signed int

        while ( 1 ) {  // forever
            i = i*3;
            u = u*3;
            cout <<  " u = " << u << endl;
            cout <<  " i = " << i <<endl;
            getchar(); // wait for user to press ENTER
        }
}

  • Wednesday

XkcdCan'tSleep.png




 


Week 10 Nov 9    


Topics: Conditional Jumps, Push & Pop Lab/Hw Reading
  • Monday:
  • Unconditional Jump: JMP
  • Review ALU, Flag bits, Instructions that set flag bits.
  • CMP is a SUB that does not store the result of the subtraction.
  • Typical compare/jump instructions:


       cmp     op1, op2
       jne     notEqual
       ...
       jmp     done    
notEqual:
       ...
done:
       ...



  • Wednesday
  • Video lecture.



  • Information about the current homework is given at the end of the video.




 


Week 11 Nov 16    


Topics: Lab/Hw Reading
  • Monday:
  • Passing Parameters via registers (and bits)
  • Passing parameters via the stack: we need a new register: EBP!
  • Passing by value
JavaStackTrace.png

  • Wednesday
  • No new homework this week. Homework 7 extended.
  • Procedures and Functions. They are basically the same. Procedure is often used to refer to a function that does not return anything.
  • Push and Pop instructions.
  • Call and Ret instruction.
  • Functions and the topics associated with passing parameters are covered in Carter's Manual on Assembly Language, in Chapter 4, titled Subprograms.




 


Week 12 Nov 23    


Topics: Lab/Hw Reading
  • Monday:
  • Review passing parameters, by value, by reference, functions returning values, and local variables.
  • Review stack frame.
  • Writing the recursive function for the Factorial problem.

  • Wednesday: Thankgiving Break


Turkey.gif





 


Week 13 Nov 30    


Topics: Lab/Hw Reading
  • Monday:
  • How much stack space is required for computing the factorial of 1000? What else, besides the stack, should we be worried about?
  • How much stack space, at least, and at most, would we need to recursively visit a 1000x1000 maze? You can find a Java maze traversing program here.

  • Wednesday
  • Lab
  • Homework




 


Week 14 Dec 7    


Topics: Lab/Hw Reading
  • Monday:

  • Wednesday
  • Lab
  • Homework




 


Week 15 Dec 14    


Topics: Lab/Hw Reading
  • Monday: Last Class: Presentation of the take-home final exam. The exam will be due at 4:00 p.m. on the last day of exams.
  • Final Exam







Links and Resources