Difference between revisions of "CSC231 Schedule 2012"

From dftwiki3
Jump to: navigation, search
(Misc. Links & Information)
 
(60 intermediate revisions by the same user not shown)
Line 4: Line 4:
 
=Misc. Links & Information=
 
=Misc. Links & Information=
  
* <font color="red">'''NEW'''</font>: [[CSC231 List of All Class Demo Files | All the class demo files, as of 11/6/12]]
+
* <font color="red">'''NEW'''</font>: [[CSC231 List of All Class Demo Files 2012| All the class demo files, as of 12/12/12]]
 +
* [[CSC231 nasmld script | nasmld script]]
 
* [[CSC231 Things to Remember when Writing Assembly Programs | Things to remember while programming in assembly]]
 
* [[CSC231 Things to Remember when Writing Assembly Programs | Things to remember while programming in assembly]]
 
* [http://alien.dowling.edu/~rohit/nasmdoc0.html The NASM Manual] (http://alien.dowling.edu/~rohit/nasmdoc0.html)  
 
* [http://alien.dowling.edu/~rohit/nasmdoc0.html The NASM Manual] (http://alien.dowling.edu/~rohit/nasmdoc0.html)  
Line 167: Line 168:
 
||
 
||
 
* Reading
 
* Reading
**[http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH01/CH01-2.html#HEADING2-86 Logical Operations on Bits], and [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH01/CH01-2.html#HEADING2-96 Signed and Unsigned Numbers] in the ''Art of Assembly'' reference.
+
:* Section 3.2 on Bit operations (AND, OR, NOT, XOR) in [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Carter's eBook].  Look at the section that follows on bit manipulation in C.  The same operations are also [https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op3.html supported in Java].
 +
:*[http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH01/CH01-2.html#HEADING2-86 Logical Operations on Bits], and [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH01/CH01-2.html#HEADING2-96 Signed and Unsigned Numbers] in the ''Art of Assembly'' reference.
 
** [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH06/CH06-1.html#HEADING1-236 The CBW &amp; CWDE instructions] in the ''Art of Assembly'' reference.
 
** [http://cs.smith.edu/~dthiebaut/ArtOfAssembly/CH06/CH06-1.html#HEADING1-236 The CBW &amp; CWDE instructions] in the ''Art of Assembly'' reference.
 
<!-- ================================================================== -->
 
<!-- ================================================================== -->
Line 263: Line 265:
 
** Top-Down example
 
** Top-Down example
 
----
 
----
* [[CSC231 Homework 8 Fall 2012 | Homework 8]]
+
* [[CSC231 Homework 8 Fall 2012 | Homework 8]] and [[CSC231 Homework 8 Solution 2012| solution programs]]
 
||
 
||
 
* Reading
 
* Reading
Line 283: Line 285:
 
  }
 
  }
 
   
 
   
  int sum( x, y ) {  
+
  int sum( int x, int y ) {  
 
     return x+y;  
 
     return x+y;  
 
  }
 
  }
 
    
 
    
 
* '''Wednesday'''  
 
* '''Wednesday'''  
 +
** review passing of ''value'' parameters through the stack
 +
** functions returning values...
 +
 
* '''Friday'''
 
* '''Friday'''
 +
** [[CSC231 Buggy Code 1 | Why is this code buggy? ]]
 +
** local variables...
 +
** Some ideas for exercises
 +
*** write a function that receives 3 dwords and returns the largest (in eax or in the stack)
 +
*** write a function that receives a number and a char and prints a line with that many copies of it.
 +
*** write a function that copies one array into another one.
 +
*** write a function that receives two arrays: scans first one for patterns and updates second one as it does so.
 
----
 
----
*
+
* [[CSC231 Homework 9 2012 | Homework 9]] and [[CSC231 Homework 9 Solutions | solution]]
 
||
 
||
 
* Reading
 
* Reading
Line 299: Line 311:
 
| Week 11 <br /> 11/12<br />
 
| Week 11 <br /> 11/12<br />
 
||
 
||
 +
[[Image:ButtonList.jpg|150px|right|thumb|For Lispers...]]
 +
 
* '''Monday'''
 
* '''Monday'''
 +
** Events: see [http://www.cse.unl.edu/~goddard/Courses/CSCE351/IntelArchitecture/IntelInterupts.pdf info on Interrupts]
 +
** Passing by '''reference'''
 +
** [[CSC231 Java passes objects by reference| Java passes objects by reference]]
 
* '''Wednesday'''  
 
* '''Wednesday'''  
 +
** Some ideas for exercises
 +
*** write a function that receives 3 dwords and returns the largest (in eax or in the stack)
 +
*** write a function that receives a number and a char and prints a line with that many copies of it.
 +
*** write a function that copies one array into another one. (we discovered a new instruction in the process: [[CSC231 helloMovsb.asm | '''movsb''']])
 +
*** write a function that receives two arrays: scans first one for patterns and updates second one as it does so.
 +
*** write a function (in C, we would write it: ''swap( int *x, int *y)'' ) that swaps the values in x and y.
 +
** A look at the [[CSC231 Homework 8 Solution 2012 | solution programs]] for Homework 8.
 
* '''Friday'''
 
* '''Friday'''
 +
** [[CSC231 Review Parameter Passing | Review passing parameters]]
 +
** [[CSC231 Recursion with Factorials | Recursing with Factorials]]
 +
** Recursion
 
----
 
----
*
+
* [[CSC231 Homework 10 2012| Homework 10]] and [[CSC231 Homework 10 Solutions 2012 | solution programs]]
 
||
 
||
 
* Reading
 
* Reading
 
+
** [http://www.cse.unl.edu/~goddard/Courses/CSCE351/IntelArchitecture/IntelInterupts.pdf How the Pentium reacts to interrupts/events]
 
<!-- ================================================================== -->
 
<!-- ================================================================== -->
 
|- style="background:#eeeeff" valign="top"
 
|- style="background:#eeeeff" valign="top"
Line 312: Line 339:
 
||
 
||
 
* '''Monday'''
 
* '''Monday'''
 +
** Continuation of recursion.  "Walking" the factorial example (see [[CSC231 Factorial.lst|listing]])
 +
** [[CSC231_Factorial.lst#Factorial.lst | List of Factorials]]
 +
** Questions:
 +
*** Any limiting factors?
 +
*** Could we have computed the factorial any other way?
 +
*** Unrolling recursion
 +
** Sketching the Towers of Hanoi problem in assembly...
 
* '''Wednesday'''  <font color="magenta">'''Thanksgiving Break'''</font>
 
* '''Wednesday'''  <font color="magenta">'''Thanksgiving Break'''</font>
 
* '''Friday''' <font color="magenta">'''Thanksgiving Break'''</font>
 
* '''Friday''' <font color="magenta">'''Thanksgiving Break'''</font>
Line 318: Line 352:
 
||
 
||
 
* Reading
 
* Reading
 
+
** [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Section 4.8] in Carter's on recursive programs
 +
[[Image:Turkey.gif]]
 
<!-- ================================================================== -->
 
<!-- ================================================================== -->
 
|- style="background:#eeeeff" valign="top"
 
|- style="background:#eeeeff" valign="top"
 
| Week 13 <br /> 11/26<br />
 
| Week 13 <br /> 11/26<br />
 
||
 
||
 +
[[Image:DontBeAChimp.png|150px|right]]
 +
[[Image:BeMechanical.png|150px|right]]
 
* '''Monday'''
 
* '''Monday'''
 +
** Moving disks with the [[CSC231 Towers of Hanoi | Towers of Hanoi]]
 
* '''Wednesday'''  
 
* '''Wednesday'''  
* '''Friday'''
+
** Q&A
 +
** Continuation with the  [[CSC231 Towers of Hanoi | Towers of Hanoi]]
 +
*** Observe [[CSC231_Towers_of_Hanoi#Enhanced_Version | hanoi2.py]] and its indented output
 +
*** Question 1: how much stack space is used when moving ''N'' disks?
 +
*** Question 2: How large a number of disks can we move with a stack of 1000 bytes?
 +
*** Question 3: Removing the tail recursion.  How does it affect the stack?
 +
** '''Binary Search'''
 +
** What does the recursion tree look like for the ''Binary Search'' algorithm?
 +
*** Would removing the tail recursion help Binary Search?
 +
** Printing an integer in decimal.
 +
*** The '''DIV''' instruction
 +
*** Sketching a solution
 +
*** A [[CSC231 printInt.asm| program]]
 +
*** Limitations of the program?
 +
* '''Friday''': <font color="magenta">No Class</font>
 
----
 
----
*
+
* [[CSC231 Homework 11 2012| Homework 11]] and [[CSC231 Homework 11 Solutions 2012| Solutions]]
 
||
 
||
 
* Reading
 
* Reading
 +
** The '''DIV''' instruction is covered in Page 34 of [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Carter's book]].
 +
** Recursion is still covered in [http://cs.smith.edu/~thiebaut/classes/231_0405/doc/pcasm-book.pdf Section 4.8] of Carter's text.
  
 
<!-- ================================================================== -->
 
<!-- ================================================================== -->
Line 336: Line 390:
 
||
 
||
 
* '''Monday'''
 
* '''Monday'''
 +
** Reminder: '''lunch talk''' by Pippin Wolfe on her research in AI
 +
** A word about making the Fibonacci program of [[CSC231 Homework 10 2012| Homework 10]]  faster
 +
** [[CSC231 An Introduction to Floating-Point Numbers | Floating Point Numbers]]
 
* '''Wednesday'''  
 
* '''Wednesday'''  
 +
** [[CSC231 An Introduction to Floating-Point Numbers | Continuing with Floating Point Numbers]]
 +
*** How to declare a ''U''(8, 8) fixed point number?
 +
*** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Exercises_with_the_Unsigned_Fixed-Point_Format | Exercises with Fixed-Point Notation]]
 +
*** Adding and multiplying Fixed Points
 +
*** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Definitions | Some important definitions]]
 +
*** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Floating-Point_Numbers | Floating-Point Numbers]]
 
* '''Friday''': <font color="magenta">No Class</font>
 
* '''Friday''': <font color="magenta">No Class</font>
 
----
 
----
*
+
* [[CSC231 Homework 12 2012| Homework 12]] and [[CSC231 Homework 12 Solutions 2012| solutions]]
 
||
 
||
 
* Reading
 
* Reading
 
+
**  [[CSC231 An Introduction to Floating-Point Numbers | DT's page on Floating Point]]
 +
** [http://en.wikipedia.org/wiki/Ieee_floating_point Wikipedia's page] on the IEEE floating-point format.
 
<!-- ================================================================== -->
 
<!-- ================================================================== -->
 
|- style="background:#eeeeff" valign="top"
 
|- style="background:#eeeeff" valign="top"
Line 348: Line 412:
 
||
 
||
 
* '''Monday'''
 
* '''Monday'''
 +
** [[CSC231_An_Introduction_to_Floating-Point_Numbers#Floating-Point_Numbers | More on Floating-Point Numbers]]
 +
 
* '''Wednesday''' <font color="magenta">'''Last Class'''</font>
 
* '''Wednesday''' <font color="magenta">'''Last Class'''</font>
** <font color="orange">'''[[CSC231 Final Exam 2012|Final Exam]]''', open books &amp; computers</font>
+
[[File:FloatingPointRangeByte.png|150px|right]]
 +
** Answer to the question:  What does the ''real'' ligne looks like in terms of how the Floating Point format covers it?
 +
** [[CSC231 Unexpected Floating-Point Results  | Examples of Floating Point programs that generate unexpected results]]
 +
** The architecture of the FPU: A stack of 8 80-bit registers: st0, st1, ... st7.
 +
** [[CSC231_An_Introduction_to_Fixed-_and_Floating-Point_Numbers#Programming_with_Floating-Point_Numbers_in_Assembly| Examples of assembly programs using the FPU]] (also available [[CSC231 Floating-Point Assembly Examples| here]])
 +
** How the FPU performs an addition of two floating point numbers
 
----
 
----
*
+
* Take-Home <font color="orange">'''[[CSC231 Final Exam 2012|Final Exam]]''', open books &amp; computers</font>.  [[CSC231 Final Exam Solutoins 2012 | Solution]]
 
||
 
||
 
* Reading
 
* Reading
 +
**  [[CSC231 An Introduction to Floating-Point Numbers | DT's page on Floating Point]]
 +
** [http://en.wikipedia.org/wiki/Ieee_floating_point Wikipedia's page] on the IEEE floating-point format.
 +
** [http://www.lahey.com/float.htm Very good coverage of the unexpected behavior of floating point numbers]
 +
** [http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html What every computer scientist should know about FP]
 
|}
 
|}
 
   
 
   

Latest revision as of 11:19, 28 October 2015

--D. Thiebaut 11:15, 24 August 2012 (EDT)


Misc. Links & Information

Weekly Schedule

Week Topics Reading
Week 1
9/7



Week 2
9/10

  • Reading
Week 3
9/17

JacquardLoom.jpgJacquardLoom2.jpg

    • Get the list of all the assembly programs seen in class:
ls -ltr ~231a/handout
    • Get one of the files into your 231a-xx account:
getcopy movStrings1.asm
    • Or use sftp
sftp 231a-xx@beowulf.csc.smith.edu (and then use put filename or get filename to transfer files)

Week 4
9/24
  • Monday
    • Q&A
    • Solutions to HW #2 posted (see above).
    • The ADD instruction
int a = 3, b = 5, result = 0; 
result = a + b;


  • Reading
    • Sections 2.2, 2.2.1, 2.2.2, 2.2.3, and 2.2.4 in the Nasm Manual
    • Sections 3.1 to 3.2.1 in the Nasm Manual
    • The INC instruction.
Week 5
10/1
  • Monday
    • Review of two-bit Adder




  • Wednesday
  • Friday
    • Review of 2's Complement: Exercise in need of a solution...
    • Extending the sign from byte to word, or word to double-word.
      • CBW: The CBW (convert byte to word) instruction copies the sign (bit 7) in the source operand (AL) into every bit in the AH register.[1]
      • CWDE: The CWDE instruction copies the sign (bit 15) of the word in the AX register into every bit position of the high word of the EAX register[1].
    • Masking with AND, OR, and NOT, an example
CSC231StateDiagramForSoftwareProgram.png

  • Reading
Week 6
10/8
  • Monday: Fall Break
CSC231SummaryAddressingModes.png
  • Wednesday
    • Bitwise operators vs logical operators in Java. Example
    • More Addressing modes:
      • base/indirect
      • base/indirect with diplacement
      • base/inderect indexed
      • base/indirect indexed with displacement
    • The Loop instruction. Exercises with Loops
    • Fibonacci with loops and new addressing modes: Examples
  • Friday

Week 7
10/15

  • No homework assignment this week.
  • Reading
Week 8
10/22
  • Monday
    • Using a Makefile
    • Another trick. Keep the nasm, ld, and run commands in one line in your history:
nasm -f elf -F stabs myProg.asm ; ld -melf_i386 -o myProg myProg.o ; ./myProg
    • The Shift instructions
      • SHL, SHR, SAR, SAL
       shl     reg, 1
       shl     mem, 1
       shl     reg, imm         
       shl     mem, imm        
       shl     reg, cl
       shl     mem, cl

Week 9
10/29
Bad!!!

  • Reading
    • Functions and the topics associated with passing parameters are covered in Carter's Manual on Assembly Language, in Chapter 4, titled Subprograms.
Week 10
11/05
Move quickly!!!
  • Monday
    • Finish the top-down example
    • Review the actions of passing parameters through registers. The concept of functions returning values is directly implementable using registers (in most cases).
    • Using EBP to pass more than 4/6 dword parameters:
int main() { 
   int a=3, b=5, res;
   res = sum( a, b );
   ...
}

int sum( int x, int y ) { 
   return x+y; 
}
 
  • Wednesday
    • review passing of value parameters through the stack
    • functions returning values...
  • Friday
    • Why is this code buggy?
    • local variables...
    • Some ideas for exercises
      • write a function that receives 3 dwords and returns the largest (in eax or in the stack)
      • write a function that receives a number and a char and prints a line with that many copies of it.
      • write a function that copies one array into another one.
      • write a function that receives two arrays: scans first one for patterns and updates second one as it does so.

  • Reading
    • Functions and the topics associated with passing parameters are covered in Carter's Manual on Assembly Language, in Chapter 4, titled Subprograms.
Week 11
11/12
For Lispers...
  • Monday
  • Wednesday
    • Some ideas for exercises
      • write a function that receives 3 dwords and returns the largest (in eax or in the stack)
      • write a function that receives a number and a char and prints a line with that many copies of it.
      • write a function that copies one array into another one. (we discovered a new instruction in the process: movsb)
      • write a function that receives two arrays: scans first one for patterns and updates second one as it does so.
      • write a function (in C, we would write it: swap( int *x, int *y) ) that swaps the values in x and y.
    • A look at the solution programs for Homework 8.
  • Friday

Week 12
11/19
  • Monday
    • Continuation of recursion. "Walking" the factorial example (see listing)
    • List of Factorials
    • Questions:
      • Any limiting factors?
      • Could we have computed the factorial any other way?
      • Unrolling recursion
    • Sketching the Towers of Hanoi problem in assembly...
  • Wednesday Thanksgiving Break
  • Friday Thanksgiving Break

Turkey.gif

Week 13
11/26
DontBeAChimp.png
BeMechanical.png
  • Monday
  • Wednesday
    • Q&A
    • Continuation with the Towers of Hanoi
      • Observe hanoi2.py and its indented output
      • Question 1: how much stack space is used when moving N disks?
      • Question 2: How large a number of disks can we move with a stack of 1000 bytes?
      • Question 3: Removing the tail recursion. How does it affect the stack?
    • Binary Search
    • What does the recursion tree look like for the Binary Search algorithm?
      • Would removing the tail recursion help Binary Search?
    • Printing an integer in decimal.
      • The DIV instruction
      • Sketching a solution
      • A program
      • Limitations of the program?
  • Friday: No Class

  • Reading
    • The DIV instruction is covered in Page 34 of Carter's book].
    • Recursion is still covered in Section 4.8 of Carter's text.
Week 14
12/03

Week 15
12/10
  • Wednesday Last Class
FloatingPointRangeByte.png





References