15.08.2013 Views

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

General Computer Science 320201 GenCS I & II Lecture ... - Kwarc

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

instructions LOADIN 1 and LOADIN 2 (and similarly for MOVE S T ).<br />

Note furthermore, that the addition logic in LOADIN j is simply for convenience (most assembler<br />

languages have it, since working with address offsets is commonplace). We could have always<br />

imitated this by a simpler relative load command and an ADD instruction.<br />

A very important ability we have to add to the language is a set of instructions that allow us to<br />

re-use program fragments multiple times. If we look at the instructions we have seen so far, then<br />

we see that they all increment the program counter. As a consequence, program execution is a<br />

linear walk through the program instructions: every instruction is executed exactly once. The<br />

set of problems we can solve with this is extremely limited. Therefore we add a new kind of<br />

instruction. Jump instructions directly manipulate the program counter by adding the argument<br />

to it (note that this partially invalidates the circuit overview slide above 15 , but we will not worry EdNote:15<br />

about this).<br />

Another very important ability is to be able to change the program execution under certain<br />

conditions. In our simple language, we will only make jump instructions conditional (this is<br />

sufficient, since we can always jump the respective instruction sequence that we wanted to make<br />

conditional). For convenience, we give ourselves a set of comparison relations (two would have<br />

sufficed, e.g. = and

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!