Docstoc

Lecture01

Document Sample
Lecture01 Powered By Docstoc
					             CS 271    Summer 2011
Computer Architecture and Assembly Language
         MTWRF 9:00 – 9:50 AM
              KEC 1003

  Instructor:     Justin Goins
    Office hours (KEC Atrium):
      Monday: 10:00 – 10:50 AM
      Wednesday: 10:00 – 10:50 AM
      Friday: 10:00 – 10:50 AM
      Other times by appointment
                     Web pages
Course:
  http://classes.engr.oregonstate.edu/eecs/summer2011/cs271

Textbook supplemental material:
  http://kipirvine.com/asm/

Get an engr account (if you don’t have one already):
  http://engr.oregonstate.edu/teach
            Required Textbook
Irvine, Kip R., Assembly
  Language for x86
  Processors (6th edition),
  Prentice-Hall, 2011.
ISBN
  Print: 978-0-13-602212-1
  Electronic: 978-0-13-602213-8
More …
             Assembler, Linker, IDE
   http://kipirvine.com/asm

   Install Visual Studio or Visual C++
       Visual Studio 2010 is free at
        http://engr.oregonstate.edu/teach
            MSDNAA Site Login
       If you use Visual C++, you can install the
        Microsoft Assembler free
   Install the textbook libraries !!
           Prerequisites
Official: CS 161, MTH 231
    Algorithms, modularity, programming
        Conditions, decisions, repetition
    Data types, constants, variables, arrays
    Procedures (methods, functions), parameter
     passing
    Binary / hexadecimal number systems
        Decimal  Binary  Hexadecimal conversions
    Boolean logic
        Truth tables, Boolean operations
              Prerequisites

Actual:
    Analytical skills, problem-solving ability
    "Teaching" ability
    Flexibility, patience, persistence
    Integrity, responsibility
        Academic Honesty
For group work:
  Each team member does his/her share.
  Each member works toward the team goal.
For individual work:
  Discussion is encouraged, but each student
  is expected to produce and understand
  all aspects of his her own programs and
  solutions.
For quizzes and exams:
  No sharing of information is permitted.
               Academic Honesty
   If you are having trouble with an assignment …
       discuss it with other students, TAs, the instructor, or
        anyone else who will listen
       don’t just have someone else tell you how to solve
        the problem!
   It is possible to discuss problems without
    plagiarizing
   One of the best methods of debugging is to
    explain your solution to someone else.
   If other students ask you for help, don’t just let
    them copy your work!
               Academic Honesty
   If you get help from someone …
       you must (in the program header block) list that
        person as a reference and describe the help
   If you get help from printed or online sources,
    you must cite your references
   Programs that are very similar will be subjected
    to review
   The bottom line is:
       Each student is expected to produce and
        understand all aspects of his/her own
        programs and solutions.
                    Course calendar
    http://classes.engr.oregonstate.edu/eecs/summer2011/cs271/schedule.php
   Check here every week; the syllabus may be
    adjusted if it becomes apparent that
    more/less time is needed for some of the
    topics.
   PowerPoint slides will be available here after
    the actual lecture.
        Do not depend solely on these slides for the
         course material; much of the lecture material
         will be covered using other media.
     Course Learning Objectives
1. Identify the major components of a computer
   architecture, and explain their purposes and
   interactions.
2. Simulate the internal representation of data, and
   show how data is stored and accessed in memory.
3. Explain the relationships between a hardware
   architecture and its instruction set, and simulate
   micro-programs.
4. Create and simplify circuits that produce specified
   output for given inputs (e.g., adders, multiplexers,
   etc.).
5. Explain the Instruction Execution Cycle.
6. Explain the differences and relationships among
   high-level, assembly, and machine languages.
    Course Learning Objectives
7. Write well-modularized computer programs in an
    assembly language, implementing decision,
    repetition, and procedure structures.
8. Use a debugger, and explain register contents.
9. Simulate the system stack as it is used for procedure
    calls and parameter passing.
10. Explain how editors, assemblers, linkers, and
    operating systems enable computer programming.
11. Explain various mechanisms for implementing
    parallelism in hardware/software.
                            Grading
4 homework sets @ 2.5%                                          10%
5 programming projects @ 5%                                     25%
3 quizzes @ 8%                                                  24%
     (4 quizzes given, lowest score dropped.)
Midterm exam                                                    15%
Final exam                                                      26%

NOTE: Extra credit may be available in any of the evaluation categories,
    but excess points in one category can not be transferred to another
    category.
            Scores will be posted
   I will use Blackboard to post scores
   Available online at my.oregonstate.edu
   It is your responsibility to check the
    posting frequently and report any errors
    with your scores.
       The deadline for reporting an error is 2 weeks
        after a score is posted.
   CS 271 covers topics from the Computer
    Systems option courses (ECE 271, ECE
    375, CS 472)
   CS 271 provides breadth of coverage
       Ask if you want more depth in any topic
            Extra reading, projects, etc. are available


   End administrative stuff
   Begin CS 271
                         FHCs
           (Frequently Heard Complaints)

   “I’ve never seen any of this stuff before!”
       “I didn’t know Computer Science included this.”
   “This is waaaaay beyond boring!”
   “I know for sure that I will never use this
    stuff!”
       (… so why should I learn it?)
        Introduction to Languages
   Viewed by "levels"
       Natural languages
            Used by humans
            Many interpretations
            E.G.: English, Spanish, Chinese
       High-level programming languages
            English-like, translated for computer by compilers
            Strict rules of syntax and semantics
            E.G.: Java, C++, Perl, Python
       Low-level programming languages
            Mnemonic instructions for specific architecture
            Translated for computer by assemblers
            E.G.: Intel assembly, Mac assembly
       Machine-level computer languages
            Actual binary code instructions for specific architecture
            Can be represented numerically
            E.G.: Intel machine instructions, Microcontroller machine
             instructions
     Programming environments for
         various language levels
   Natural language
       word processors
   High-level programming languages
       Text editor, compiler, linker, loader (debugger)
       E.G.: Eclipse, Visual C++, etc.
   Low-level programming languages
       Text editor, assembler, (debugger)
       E.G.: any text editor together with MASM, Visual C++, etc.
   Machine-level computer languages
       Some way to assign machine instructions directly into memory
       E.G.: set individual bits (switches)
           Introduction to Computer
                 Architecture
   Viewed by "levels"
   Each level has an associated language
       Lowest level (level 0) is the actual hardware with its
        associated machine language
       Highest level is a "virtual machine" with its associated
        high-level language
   Program statements at level k (k > 0) are
    translated or interpreted into statements in the
    language that can be executed by level k-1.
Virtual Machine Views
           User Level



     Applications Programmer
               Level

     System Programmer Level



       OS Developer Level



         Hardware Level
             Relationship:
    Instruction Set  Architecture
   A computer's instruction set is defined by the
    computer's architecture.
       I.E.: each computer architecture has its own machine
        language.
            E.G.: Mac machine instructions (on older Macs) will not work
             on an Intel architecture.


   Cross-assemblers can be used to convert a
    machine language to another machine language.
   Virtual machines can be used to simulate
    another computer's architecture.
                 Relationship:
             Hardware  Software
   Hardware: Physical devices
       E.G.: circuits, chips, disk drives, printers, etc.
   Software: Instructions that control hardware
       E.G.: games, word processors, compilers, operating systems, etc.

   Sometimes the line between hardware and software is not
    clear
       E.G.: Parts of an operating system might be implemented in
        hardware
   Anything that can be implemented in software could be
    implemented in hardware … and it would execute much
    faster
       Why is this not always done?
              System Architectures
   Super-computer
   Mainframe
   Multiprocessor/Parallel
   Server
   Distributed (Collection of Workstations)
       Network
   Personal computer
       Desktop, laptop, netbook, etc.
   Micro-controller (Real-time/Embedded system)
       Phone, car, appliance, watch, etc.
   etc.
          Two architecture tracks

   Build more powerful machines
       Multi-core, etc.
   Build same machine smaller/cheaper
       Nanotech
       Embedded devices
       Etc.
           Operating Systems

   Operating systems provide interfaces
    among users, programs, and devices
    (including the computer itself).
   An operating system is implemented in the
    host computer's machine language.
                   Relationship:
         Assembly Language  Hardware

   Assembly language is hardware-specific
       Assembler converts to machine language
   Assembly language allows direct control of
    hardware components
       Most high-level languages do not
       Provides a good way to really understand
        architecture and how the hardware works.
   We will use assembly language to
    implement some software.
      Assembler and assembly
  An assembler is a software system that takes
  assembly language as input and produces
  machine language as output



Assembly
language program                  Target machine
(text)             Assembler      code (binary)

source code                       object code
    Other uses for assembly language

   Embedded systems
        Efficiency is critical
   Real-time applications
        Timing is critical
   Interactive games
        Speed is critical
   Low-level tasks
        Direct control is critical
   Device drivers
        Direct control is critical
         Metrics (measurements)
   Speed (distance/time) is measured in
    electronic units:
       K = 103, M = 106, G = 109, etc.
   Size in bits, bytes is measured in binary
    units
       K = 210, M = 220, G = 230, etc.
       We use Ki, Mi, Gi for clarity
            E.G., 200 GiB hard disk
   E.G.,         100 K = 100,000
                  100 Ki = 102,400
           Questions?


Read:   Irvine Chapter 1

				
xumiaomaio xumiaomaio http://
About