CS255 Syllabus & Progress

CS255 Syllabus & Progress


Material covered are displayed in blue.


    Search the lecture notes:


  1. Intro to CS255: click here

  2. Intro to Computer Architecture



  3. The Computer System (details of the memory and the CPU)
    • The computer memory (RAM):

    • The Central Processing Unit (CPU):
      • The structure of the Central Processing Unit (CPU): click here
        • Usage of the general purpose registers: click here (***)
        • Program flow and the usage of the special purpose registers: click here (***)
      • The Instruction Execution Cycle of the CPU: click here (I kept an older page: click here)
        • Details of the Instruction Execution Cycle with diagrams: click here (***)
        • Out-of-order program flow - branching: click here (***)

    • Exposition of the program reference concept: click here



  4. The computer program - from the perspective of a Java programmer and a computer

    • The program translation process: click here
    • Program organization (where different parts of the program is put in memory): click here


    Homework 1 re-enforces computer architecture concepts: click here


    Before we can explain how the computer works - i.e., how it manipulates data, we must understand how information are stored inside the computer...



  5. Storing Boolean data inside a computer



  6. Storing numerical data inside a computer

    • Storing unsigned integral values inside the computer:

    • Other number systems that are related to the Binary number system (condensed representation of bit patterns):

    • Storing signed integral values inside the computer:
      • Introduction - signed-magnitude representation: click here

      • Prelude to 2's complement code: the 10's complement encoding: click here

      • The 2's complement number encoding:
        • How are signed numbers encoded inside the computer (2's complement code): click here
        • The int, short and byte data types of Java: click here
        • Converting between the different integer types (int, short and byte): click here

      • The "Excess-n" codes: an alternate binary encoding for signed values: click here
      • So many codes - how to tell which code we are used (context)? click here


    • Storing fractional numerical values inside a computer:


    • Converting between integer and float data representations: click here

    • Data type revisited: what is the value that is stored in these memory cells ? click here

    Homework 2 re-enforces number system concepts: click here




  7. Representing text data inside the computer:

    • ASCII code: click here
    • Unicode: click here

    • Human/Computer communication (explains the need for conversion from ASCII to other representation and vice versa):

    • Boolean input and output:
      • How to enter Boolean inputs - converting between ASCII String representation and Boolean representation: click here
      • How computers print out Boolean outputs - converting between Boolean representation to ASCII String representation: click here

    • Numeric input/output - Converting between ASCII String representation and int 2's complement representation:
      • Introduction: click here

      • Java pre-requisite on Character/String manipulation:
        • Computing with ASCII codes in Java: click here
        • Java statements that manipulate characters and strings: click here

      • How to enter integer inputs - Conversion algorithm ASCII representation -> 2's complement representation:
        • Intro: what is the problem when you enter an integer number ? click here
        • The trivial (but not-practical) solution: click here
        • Converting a string of 1 digit integer to 2's complement representation: click here
        • Converting a TWO DIGIT decimal integer string to 2's complement representation click here
        • Converting any decimal integer string to 2's complement representation click here
      • How computers print out integer values - Conversion algorithm 2's complement representation -> ASCII representation :
        • Intro: what is the problem when the program prints an integer number ? click here
        • The trivial (but not-practical) solution: click here
        • Converting a 1 digit decimal number to ASCII representation: click here
        • Converting a TWO-digits decimal number to ASCII representation: click here
        • Converting any decimal number to ASCII representation: click here


        (My old notes on conversion algorithms: click here)

    Project 3 re-enforces string ⟷ 2's complement conversion: click here




  8. Representing computer instructions inside the computer (intro to hardware):

    • Intro: what kinds of instructions can a computer execute ? click here
    • Encoding computer instructions: click here
    • Fixed length (RISC) vs. variable length (CISC) instruction formats: click here
    • Sample instruction encodings:




  9. Intro to assembler programming using the ARM processor

    • Introduction: click here

    • The ARM processor's CPU architecture:
      • The ARM processor from the point of view of an assembler programmer: click here
      • How are the general purpose registers used in assembler programs: click here
      • EGTAPI's display of the registers: click here

    • The "Hello World" program in assembler programming language: click here
    • Program organization illustrated using the "Hello World" assembler program with the help of EGTAPI: click here
    • What does an assembler program contain ? (directives and instructions): click here




  10. The ARM assembler directives

    • ARM assembler directives used in the CS255 course: click here

    • The .text section of an assembler program (and labels): click here
    • The .data section of an assembler program (and labels): click here






  11. Computing with integer values (integer constants and simple integer variables)

    • Introduction: click here

    • Moving an integer constant into a register
      • Moving a small integer value into a register: click here
        • Moving/copying an integer value from one register into another register: click here
      • Moving any integer value into a register: click here
      • Moving an address into a register: click here

    • Using (the value stored in) a simple memory variable: click here
    • Updating (the value stored in) a simple memory variable: click here
    • Initializing and copying variables - simple high level programming statements in assembler: b = 4 and b = a click here

    • Store-ordering in memory: big and little endian ordering click here


    • What happens when you use an incorrect load/store instruction: click here


    • Arithmetic operations (instructions): click here
    • Assignment statement involving (only) simple variables: the c = a + b statement in assembler click here


    Project 4 re-enforces the use of move, load and store instructions: click here




  12. The array data structure (teach with demo/asm/3-array/demo.s)





  13. The linked list data structure (teach with demo/asm/4-linked-list/demo1.s and demo2.s)

    • How is an object stored in memory: click here
    • How is a linked list stored in memory: click here   (I kept my old note here: old)
    • Defining the head reference variable to a link list in assembler: click here
    • How to access a field in a (specific) list element: click here
    • Assembler programming examples of accessing fields in a linked list: click here


    • An example showing all the accessing techniques to simple variables, arrays and list data structures: click here

    • Inserting a list element at the start of a linked list: click here

    Project 5 re-enforces access technique to structured variables (arrays and linked lists): click here



    • Summary: ARM assembler programming techniques used in CS255: click here
    • A single sheet summary of ARM instruction nmenomic codes : click here
    • Documentation - the complete ARM Instruction set and encoding (not part of syllabus material): click here



    Now you know what the computer actually does when it executes an assignment statement: how it evaluates an expression and assigns the result to a variable in a high level programming language. We will discuss various program flow control structures next.





  14. The Selection (if, if-else) Statements:
    • Introduction: click here

    • Branching - out of order program flow: click here
    • How is the branch instruction implemented ? click here

    • The Compare (cmp) and Branch (beq, bne, blt, ble, bgt, bge, bal) assembler instructions of ARM: click here

    • Coding Selection statements in assembler:





  15. The Loop Statements:


    Project 6 re-enforces the use of compare and branching in writing your first assembler program containing a while loop and if-statements: click here

    The midterm test will cover the material upto this point and will be scheduled soon.


    Now you know what the computer actually does when it runs a program. The only thing that you still do not know is what happens in a function call (there is still a lot to learn...).







  16. Subroutines (a.k.a. methods, procedures, functions)
    • Introduction: click here

    • Leaf subroutines and Non-Leaf subroutines: click here

    • Leaf subroutines: subroutines (= functions) that do not call any function
      • Let's try to use what we have learned (branch) to implement subroutine call: click here
      • Calling a functions - ARM's bl (branch and link) instruction: click here
      • Returning from a leaf subroutine click here

    • Non-leaf functions -- functions that calls another function....
      • What happens when a called function calls another function: click here
      • The program stack of a running program: click here
      • The ARM assembler push and pop instructions: click here
      • Implementing non-leaf methods/functions using the program stack: click here

    • Using the non-leaf function technique to implement leaf functions: click here





  17. Implementing other features of methods/functions: (1) Parameters, (2) Return Values and (3) Local Variables CPU registers
    • Introduction: click here

    • Prelude to using register to pass parameters and store local variables: click here
    • Passing parameters to a function and passing return values using CPU registers:
      • Intro: using CPU registers to pass parameters and return values: click here
      • A skeletal example: click here
      • A fleshed out example - using CPU registers to pass parameters and return values click here
    • Allocating local variables using CPU registers: click here


      Project 7 (Bubblesort) re-enforces the use of registers for passing parameters and storing local variables: click here

    • Problems when using CPU registers to store parameters and local variables: click here

    • Passing parameters and allocating local variables using the program stack:
      • Intro: using the program stack to store parameters and local variables: click here
      • Why can the stack avoid the overwrite problem in registers: click here
      • How a subroutine returns --- tearing down a stack frame: click here
      • Summary and a "How to" guide: click here

      • A skeletal example: click here
      • A fleshed out example of passing parameters and allocating local variables using the program stack: click here

    • Another usage of the program stack - saving registers in an interrupted computation: click here



  18. Recursive subroutines/methods:
    • Introduction: click here

    • First recursive method in assembler, the classic factorial function: click here

    • Second recursive method in assembler, the Fibonacci function: click here


      Programming project pj8 re-enforces storing parameters and local variables on stack with a recursive function: click here



      I inserted some material here to help you understand how to write program using the recursion technique --- these material are not part of CS255 curriculum:

        • Recursion is a divide and conquer technique to solve problems:

      But I will discuss these webpages (quicker than usual) to help you understand the next topic: use recursion to manipulate linked lists



    • Tower of Hanoi in ARM assembler code: click here (skipped for brevity - read through it yourself)





  19. Recursion with linked lists:
    • Introduction: click here

    • Remember how linked lists are stored inside the computer: click here

    • Searching for an element in a linked list using a recursive algorthm:
      • Designing a recursive search algorithm: click here
      • Implementing the recursive search algorithm in ARM assembler code: click here

    • Inserting a new element at the tail of the list using a recursive algorthm:
      • My CS170 page on designing a recursive "insert at tail of list" algorithm: click here
      • Implementing the recursive "insert at tail of list" algorithm in ARM assembler code: click here



    Programming project pj9 re-enforces recursion with inserting in an ordered linked list: click here



  20. Parameter passing techniques:


    If you understand everything so far, you now know exactly what is going on when a computer executes a program. You can apply what you learn and write assembler programs in any assembler language, e.g., Intel Pentium, IBM PowerChip, DEC Alpha, SunMicrosystem SPARC... To program with a new chip, all you need to learn are:

    • its architecture (registers),
    • the addressing modes
    • the instruction mnemonic codes and what they do.

    I have Intel assembler programming material after the C lecture notes to demonstrate this process. (These notes are not part of the CS255 curriculum - it's "for your eyes only")





  21. Introduction to the (System Programming Language) C for Java programmers



  22. C's data types and variables:



  23. Basic input/output:



  24. Operators:



  25. Statements:



  26. Arrays: (C has static arrays, Java has dynamic arrays)



  27. Function (= method) definition:



  28. Function declaration:



  29. Multi-files C programs - the importance of declaring functions:


  30. The make (UNIX) utility: (Make will not be covered in the final)

    Hand out C Project 1: click here





  31. Intermediate topics: language features that are available in C and Java but work differently



  32. C language features that are not found in or different from Java (pointer data type !)



  33. Miscellaneous topics in C


    C documentations:


    That's all, Folks !





  34. Additional Enrichment Material: Intel 80x86 programming (not covered in CS255)


    Rough notes on Intel Assemler programming:

    Other resources:

    • Matloff GNU assembler programming tutorial: click here
    • Sourceforge GNU assembler programming tutorial: click here

    • Free Intel Macro Assembler (if you want to write assembler on your PC): RIGHT click here and SAVE AS
    • Intel Assembler Programming book - this book is like the CS255 course using Intel Assembler code: click here
    • Step by step Windows programming tutorial shows you how to write window programs, menus, call backs, etc: click here
    • The Art of Assembly Programming (a very good online book, but the 32 bit version uses a non-standard assembler called "HLA" - High Level Assemble language) click here