21-ISA - Instruction set architectures Last time we built a...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
ISA 1 Instruction set architectures Last time we built a simple, but complete, datapath. The datapath is ultimately controlled by a programmer, so today we’ll look at several aspects of this programming in more detail. How programs are executed on processors An introduction to instruction set architectures Example instructions and programs Next, we’ll see how programs are encoded in a processor. Following that, we’ll finish our processor by designing a control unit , which converts our programs into signals for the datapath.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ISA 2 Programming and CPUs Programs written in a high-level language like C++ must be compiled to produce an executable program. The result is a CPU-specific machine language program. This can be loaded into memory and executed by the processor. CS231 focuses on stuff below the dotted blue line, but machine language serves as the interface between hardware and software. Datapath High-level program Executable file Control words Compiler Control Unit Hardware Software
Background image of page 2
ISA 3 High-level languages High-level languages provide many useful programming constructs. For, while, and do loops If-then-else statements Functions and procedures for code abstraction Variables and arrays for storage Many languages provide safety features as well. Static and dynamic typechecking Garbage collection High-level languages are also relatively portable.Theoretically, you can write one program and compile it on many different processors. It may be hard to understand what’s so “high-level” here, until you compare these languages with. ..
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ISA 4 Low-level languages Each CPU has its own low-level instruction set , or machine language, which closely reflects the CPU’s design. Unfortunately, this means instruction sets are not easy for humans to work with! Control flow is limited to “jump” and “branch” instructions, which you must use to make your own loops and conditionals. Support for functions and procedures may be limited. Memory addresses must be explicitly specified. You can’t just declare new variables and use them! Very little error checking is provided. It’s difficult to convert machine language programs to different processors. Later we’ll look at some rough translations from C to machine language.
Background image of page 4
ISA 5 Compiling Processors can’t execute programs written in high-level languages directly, so a special program called a compiler is needed to translate high-level programs into low-level machine code. In the “good” old days, people often wrote machine language programs by hand to make their programs faster, smaller, or both. Now, compilers almost always do a better job than people.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/19/2011 for the course CS 231 taught by Professor - during the Spring '08 term at University of Illinois at Urbana–Champaign.

Page1 / 27

21-ISA - Instruction set architectures Last time we built a...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online