CLASS 2

Levels in a Modern Computer.

Once we accept that we need layering to bridge the semantic gap between high level languages and the digital logic, the question becomes: What should each layer look like? That is, what are the instructions we should define for L2, L3, etc.? This is the basic question in computer design.

We will get some answers to that question by examining the layering in a modern computer, which looks like this:

                                Language                Translator/Interpreter
                                ---------------------   ---------------------
High Level Language level       C, Fortran, Lisp, etc   Compiler
Assembly level                  Assembly                Assembler
OS level                        OS "Instructions"       Operating System
Machine level                   Machine language        Instruction cycle
Digital Logic level             Gates and Wires         Physics (? :)

Each level is implemented in terms of the level immediately below it, except the Assembly level which is implemented in terms of both the OS level and the Machine level.

Software vs. Hardware - which should we use? Hardware is faster, but harder to modify. Software is slower, but easier to modify. The important thing is that they're interchangeable - anything one can do, can be done by the other one too.

The Software vs. Hardware distinction is the first example of a tradeoff - to get one thing, you have to give up another. Making tradeoffs is a basic part of computer design, and we will encounter a number of tradeoffs. The important thing is that the decision made about a tradeoff must be justified. In this case, we use hardware for the Digital logic level, and software for the levels above that. The justification for this tradeoff is that all programs are eventually executed at the Digital logic level, so we need that to be hardware to make it fast. However, all the higher levels are subject to frequent change, as when a new program or new operating system is run on the computer, so those levels need to be software.

Moving up the Levels from Lowest to Highest.

The interpreter that translates machine level into digital logic level was the first part of the computer (chronologically) that was ever designed. It was first done by Eckert & Mauchly at Penn in 1945. They are credited with building the first general purpose computer; it was programmed with wires.

The machine level interpreter that current machines use was designed by John von Neumann and implemented by Maurice Wilkes in 1949; it is called the von Neumann architecture.

Von Neumann architecture: Programs are encoded and stored in memory along with data. Machine model is memory + CPU. Program counter is a location within the CPU that stores an address. Memory is set of locations, each has an address and each stores a data item ("number").

Instruction cycle. Discussed in more detail later in the course.

Assembler. The assembler is the program that translates assembly language to machine language. It turns out that the assembler has a fairly simple task. It takes each line of the assembly language program and translates it to one machine language instruction.

Compiler. The compiler is the program that translates a high level language (HLL) to assembly. It translates each HLL instruction, like a loop or an "if" statement, into a large number of assembly language instructions.

Machine Independent/Dependent Levels.

One way to distinguish the top layer of the machine hierarchy (the high level language layer) is that it is the only level that is machine-independent. That is, programs written in C or Fortran run essentially unchanged on machines as different as the PC (based on the 486 or Pentium) or the Macintosh (based on the 68040 or PowerPC) or the Sun workstation (based on the SPARC).

However, below the HLL layer all the rest of the levels are machine dependent. For example a program written in SPARC assembly language will not run on a Pentium or a PowerPC or anything other than a SPARC machine.

So to study the lower levels of the machine hierarchy we have to pick a particular architecture to study. In this course we will use the SPARC architecture. SPARC CPUs are used in machines built by Sun Microsystems (as well as some other manufacturers). In this course we'll use the SPARC as our example of all the lower layers of the machine hierarchy.

You should also realize that the details of SPARC assembly language are not the same as the details of Pentium assembly language or PowerPC assembly language. However, in this course you'll learn the common principles behind all assembly languages so that if you have program in a different assembly language in the future, you will be able to pick it up quickly.

Organization of the computer - Von Neumann architecture

Six logical units

Evolution of computers

How do we run a program ?


Typical layers of a Computer

For class 3 notes, click here

For more information, contact me at tvohra@mtu.edu