Chapter 4 Computer Architecture.

Slides:



Advertisements
Similar presentations
Processor System Architecture
Advertisements

Room: E-3-31 Phone: Dr Masri Ayob TK 2123 COMPUTER ORGANISATION & ARCHITECTURE Lecture 5: CPU and Memory.
Low-Level Programming Languages
CSCE 121, Sec 200, 507, 508 Fall 2010 Prof. Jennifer L. Welch.
Room: E-3-31 Phone: Dr Masri Ayob TK 2633 Microprocessor & Interfacing Lecture 1: Introduction to 8085 Assembly Language.
Chapter 7 Low-Level Programming Languages. 2 Chapter Goals List the operations that a computer can perform Discuss the relationship between levels of.
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
EET 2261 Unit 2 HCS12 Architecture
Computer Architecture
CEG 320/520: Computer Organization and Assembly Language Programming1 CEG 320/520 Computer Organization and Assembly Language Programming.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Computer Organization
CPS120: Introduction to Computer Science
Machine Instruction Characteristics
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Chapter 4 MARIE: An Introduction to a Simple Computer.
Von Neumann Machine Objectives: Explain Von Neumann architecture:  Memory –Organization –Decoding memory addresses, MAR & MDR  ALU and Control Unit –Executing.
Chapter 2-2 Assembly Instructions Number Systems Number Systems Assembly Instructions Assembly Instructions Branch Branch Next Lecture Next Lecture  Addressing.
Computer Architecture And Organization UNIT-II General System Architecture.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Computer Operations A computer is a programmable electronic device that can store, retrieve, and process data Data and instructions to manipulate the data.
Computer Architecture and Organization
Computer Architecture EKT 422
Chapter 7 Low-Level Programming Languages (slides modified by Erin Chambers)
Chapter 7 Low-Level Programming Languages Nell Dale John Lewis.
Electronic Analog Computer Dr. Amin Danial Asham by.
Computer Organization 1 Instruction Fetch and Execute.
Chapter 10 Instruction Sets: Characteristics and Functions Felipe Navarro Luis Gomez Collin Brown.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
What is a program? A sequence of steps
Simple ALU How to perform this C language integer operation in the computer C=A+B; ? The arithmetic/logic unit (ALU) of a processor performs integer arithmetic.
Instruction Sets. Instruction set It is a list of all instructions that a processor can execute. It is a list of all instructions that a processor can.
1 Basic Processor Architecture. 2 Building Blocks of Processor Systems CPU.
8085 INTERNAL ARCHITECTURE.  Upon completing this topic, you should be able to: State all the register available in the 8085 microprocessor and explain.
Instruction Sets: Characteristics and Functions  Software and Hardware interface Machine Instruction Characteristics Types of Operands Types of Operations.
Computer Architecture. Instruction Set “The collection of different instructions that the processor can execute it”. Usually represented by assembly codes,
Computer Architecture and Number Systems
Basic Computer Organization and Design
Control Unit Lecture 6.
A Closer Look at Instruction Set Architectures
Edexcel GCSE Computer Science Topic 15 - The Processor (CPU)
Chapter 4 The Von Neumann Model
Introduction of microprocessor
Chapter 4 The Von Neumann Model
A Closer Look at Instruction Set Architectures
Computer Organization and Assembly Language (COAL)
Chapter 4 The Von Neumann Model
Instructions at the Lowest Level
Number Representations and Basic Processor Architecture
CSCE Fall 2013 Prof. Jennifer L. Welch.
The Von Neumann Model Basic components Instruction processing
MARIE: An Introduction to a Simple Computer
BIC 10503: COMPUTER ARCHITECTURE
ECEG-3202 Computer Architecture and Organization
Chapter 9 Instruction Sets: Characteristics and Functions
Computer Architecture
Computer Architecture
ECEG-3202 Computer Architecture and Organization
CSCE Fall 2012 Prof. Jennifer L. Welch.
Introduction to Microprocessor Programming
CPU has 6 special locations called registers
Chapter 4: Computer Architecture
The Stored Program Computer
8051 ASSEMBLY LANGUAGE PROGRAMMING
The Von Neumann Machine
Information Representation: Machine Instructions
COMPUTER ORGANIZATION AND ARCHITECTURE
Computer Operation 6/22/2019.
Chapter 10 Instruction Sets: Characteristics and Functions
Chapter 4 The Von Neumann Model
Presentation transcript:

Chapter 4 Computer Architecture

Pep/9 virtual machine

Figure 4.1 The Pep/9 hardware consists of three major components at the instruction set architecture level, ISA3: The bus is a group of wires that connects the three major components. It carries the data signals and control signals sent between the blocks.

The CPU contains 6 registers. Figure 4.2 The CPU contains 6 registers.  X, PC, and SP—help the CPU access information in main memory.  negative, zero, overflow, and carry bits An index register in a computer's CPU is a processor register used for modifying operand addresses during the run of a program, typically for doing vector/array operations. An accumulator is a register for short-term, intermediate storage of arithmetic and logic data in a computer's CPU

Main memory of Pep/9 Computer Figure 4.3 65,536 eight-bit(byte) storage locations Each byte has an address (dec:0 to 65,535; hex:0000 to FFFF.) Main memory is sometimes called core memory. byte1 byte2 byte3 Main memory of Pep/9 Computer

Figure 4.4 Even though the lines have equal widths visually in the block, a single line may represent one or several bytes. The address on the side of the block is the address of the leftmost byte in the line. You can tell how many bytes the line contains by the sequence of addresses (3 bytes here). top  bottom

A Pep/9 word word is a certain number of bytes In the Pep/9 computer, a word is two adjacent bytes (16 bits). Most of the registers in the Pep/9 CPU are word registers.

Figure 4.5 In main memory, the address of a word is the address of the first byte of the word.   Two adjacent bytes at addresses 000B and 000C. The address of the 16-bit word is 000B. To save space on the page, the content of a byte or word is usually written in hexadecimal

Input/Output Devices The Pep/9 system simulates two input/output (I/O) modes— interactive and batch. Before executing a program, you must specify the I/O mode. If you specify interactive: the input comes from the keyboard both input and output appear in a terminal window. If you specify batch: the input comes from an input pane and the output goes to an output pane. simulates input from a file because the input pane must have data in it before the program executes

Pep/9 use Memory-mapped I/O input device is wired into main memory at one fixed address (FC15 in Pep/9) output device is wired into main memory at another fixed address (FC16 in Pep/9). DMA-Direct Memory Access allows data to flow between the disk and main memory directly without going through the CPU Pep/9 does not use this

Data and Control Data flow from the input device at address FC15 on the bus to the CPU. Data can also flow from the CPU on the bus to the output device at address FC16 FC15 FC16

Instruction Format Figure 4.6 Each computer has its own set of instructions wired into its CPU The Pep/9 computer has 40 instructions in its instruction set. Each instruction consists of either a single byte called the instruction specifier, or the instruction specifier followed immediately by a word called the operand specifier.  Instructions that do not have an operand specifier are called unary instructions. 

Figure 4.7

Instruction Format Figure 4.6 The Pep/9 computer has 40 instructions in its instruction set:

Figure 4.6 (continued)

Figure 4.6 (continued)

The opcode The eight-bit instruction specifier can have several parts: Part1:operation code (opcode):  may consist of as many as eight bits and as few as four. E.g. instruction to move the stack pointer to the accumulator eight-bit opcode of 0000 0011. five-bit opcode 01010.

Instructions with fewer than eight bits in the opcode subdivide their instruction specifier into several fields depending on the instruction.  indicates these fields with the letters a, r, and n. Each one of these letters can be either 0 or 1. E.g. 2 versions of instruction: 0001-1000 and 0001-1001 How many version in following?:

letter a : addressing mode Figure 4.8 letter a : addressing mode Pep/9 executes each nonunary instruction in one of eight addressing modes: Later chapters describe the meaning of the addressing modes. For now, it is important only that you know how to use the tables of Figures 4.7 and 4.8 to determine which register and addressing mode a given instruction uses

Figure 4.8 (continued)

letter r : register. Figure 4.8 (continued) instruction operates on the accumulator  instruction operates on the index register

Question Determine the opcode, register, and addressing mode of the 1100 1011 instruction

Answer Starting from the left, determine with the help of Figure 4.6 that the: opcode is 1100 r = 1   index register. aaa = 011  stack relative addressing Therefore, the instruction loads a word from memory into the index register using stack-relative addressing.

Instructions: operand specifier: are stored in main memory. The address of an instruction in main memory is the address of the first byte of the instruction. operand specifier: For non-unary instructions, indicates the operand to be processed by the instruction.

Figure 4.9 Example two adjacent instructions stored in main memory at locations 01A3 and 01A6 The instruction at 01A3 is not-unary The instruction at 01A6 is unary

the instruction at 01A3 has Opcode: 0111 subtraction 1101 = raaa Register-r field: 1 instruction operates on the index register Addressing-aaa field: 101 indexed addressing (to interpret operand specifier ) Operand specifier: 0000 0011 0100 1110

The unary instruction at 01A6 has Opcode: 0000 110 arithmetic shift right Register-r field: 0 operation done on accumulator

Machine language binary sequence that CPU interprets according to the opcodes of its instruction set. 0111 1101 0000 0011 0100 1110 0000 1100  two instructions in hexadecimal, preceded by their memory addresses: 01A3 7D034E 01A6 0C

The stop instruction Instruction specifier: 0000 0000 Causes the computer to stop

Direct addressing An addressing-aaa field of 001 indicates direct addressing. The operand specifier is the memory address of the operand. In mathematical notation, Oprnd = Mem[OprndSpec]

The load word instruction Instruction specifier: 1100 raaa Loads one word (two bytes) from memory to register r

Figure 4.10, 4.11 Example load word instruction: C1004A Address of operand in memory = 004A (where data read from) Load Word From memory Accumulator A Direct Addressing SEND_DATA DATA 1 in sign bit = negative The V and C bits are unaffected by the load word instruction. bit pattern is not all 0’s 92EF = 1001-0010 1110-1111

The store word instruction Instruction specifier: 1110 raaa Stores one word (two bytes) from register r to memory

Address of memory where data needs Figure 4.12, 4.13 Example store word instruction: E9004A Address of memory where data needs To be stored = 004A Store Word To memory Index Register X Direct Addressing

The add instruction Instruction specifier: 0110 raaa Adds one word (two bytes) from memory to register r

Example add word instruction: 69004A Figure 4.14, 4.15 Example add word instruction: 69004A Address of operand in memory = 004A (where data read from) Instruction Register X Add Word From memory Direct Addressing 5 + (–7) = –2(dec), = FFFE (hex) –7 (dec) = FFF9 (hex) N = 1 because the sum is negative. Z = 0 because the sum is not all 0’s. V = 0 because an overflow did not occur, C = 0 because a carry did not occur out of the most significant bit.

The subtract instruction Instruction specifier: 0111 raaa Subtracts one word (two bytes) in memory from register r

Address of operand in memory = 004A Figure 4.16, 4.17 Example subtract instruction: 71004A Address of operand in memory = 004A (where data read from) Accumulator A Subtract Word In memory from r Direct Addressing 3 – 9 = 3 + -9 3 = 0003(Hex) +9 = 0000-0000 0000-1001 -9 2’s comp = 1111-1111 1111-0111 = FFF7(Hex) 3 + (-9) = 0003 + FFF7 = FFFA(Hex)  3 – 9 = –6(dec) = FFFA (hex)

The and instruction Instruction specifier: 1000 raaa ANDs one word (two bytes) from memory to register r

Address of operand in memory = 004A Figure 4.18, 4.19 Example AND word instruction: 89004A Address of operand in memory = 004A (where data read from) Instruction Register X Bitwise AND To r Direct Addressing The N bit is 0 because the quantity in the index register is not negative when interpreted as a signed integer. The Z bit is 0 because the index register is not all 0’s. 5DC3 AND 00FF = 00C3

The or instruction Instruction specifier: 1001 raaa ORs one word (two bytes) from memory to register r

Address of operand in memory = 004A Figure 4.20 Example OR word instruction: 99004A Address of operand in memory = 004A (where data read from) Instruction Register X Bitwise OR To r Direct Addressing 1 9 5DC3 OR 00FF = 5DFF

The invert instruction Instruction specifier: 0000 011r Bit-wise NOT operation on register r Each 0 changed to 1, each 1 changed to 0

Figure 4.21, 4.22 Accumulator A Invert bits in r NOT 0003 = FFFC

The negate instruction Instruction specifier: 0000 100r Negate (take two’s complement of) register r

- 3(dec) = 1111 1111 1111 1101 (bin) = FFFD (hex) Figure 4.23 Accumulator A negate r 1 0 0 8 - 3(dec) = 1111 1111 1111 1101 (bin) = FFFD (hex)

The load byte instruction Byte instruction: operate on a single byte of information Instruction specifier: 1101 raaa Loads one byte from memory to the right half of register r

92 loaded to right byte of A Figure 4.24, 4.25 Load byte to r Accumulator A Memory address 4A Direct Addressing 92 loaded to right byte of A

The store byte instruction Instruction specifier: 1111 raaa Stores one byte from the right half of register r to memory

F Figure 4.26 1 1 1 1 Accumulator A Store byte from r to mem Memory address 4A 1 1 1 1 Direct Addressing F

Load byte from input device Figure 4.27 Load byte from input device input device(e.g. keyboard) at address FC15 To get user input (e.g. character from keyboard): execute the load byte instruction from address FC15.

Load byte from input device Figure 4.27 Load byte from input device instruction = D1FC15 (hex) 1101-0001 1111-1100 0001-0101 next character in the input stream is W. Load Byte from memory to A (0001 raaa) FC15 Input Device The character from the input stream can come from the keyboard or from a file. ASCII value of the letter W is 57 (hex)

Store byte to output device Figure 4.27 Store byte to output device The output device(e.g. screen) at address FC16. To send a character to the output device: execute the store byte instruction to address FC16.

Store byte to output device Figure 4.28 Store byte to output device instruction = F1FC16 (hex) 1111-0001 1111-1100 0001-0110 ASCII value for the letter H FC16 Output Device Store Byte to memory from A (1111 raaa) ASCII value for the letter i

QUESTION  Answer the following questions for the machine language instructions 6AF82C and 623D0.  (a) What is the opcode in binary?  (b) What does the instruction do?  (c) What is the register-r field in binary?  (d) Which register does it specify?  (e) What is the addressing-aaa field in binary?  (f) Which addressing mode does it specify?  (g) What is the operand specifier in hexadecimal?

ANSWER

QUESTION  Answer the following questions for the machine language instructions 6AF82C.  (a) What is the opcode in binary?  (b) What does the instruction do?  (c) What is the register-r field in binary?  (d) Which register does it specify?  (e) What is the addressing-aaa field in binary?  (f) Which addressing mode does it specify?  (g) What is the operand specifier in hexadecimal?

ANSWER

Big Endian Versus Little Endian In what order should the sequence of bytes be stored in main memory? CHOICE1: Big-endian Order The CPU store the most significant byte at the lowest address CHOICE2: Little-endian Order CPU store the least significant byte at the lowest address Pep/9 is a big-endian CPU. There is no dominant standard in the computing industry. Some processors use big-endian order, some use little-endian order, and some can use either order depending on a switch that is set by low-level software

A Big-endian CPU E.g The most significant byte of the register gets 92, (address004A) The next byte gets EF (next higher address at 004B)

A little-endian CPU Figure 4.29 The byte at the lowest address, 004A, is 92 and is put in the least significant byte of the register. The byte from the next higher address, 004B, is put to the left of the low-order byte in the register.

A 32-bit register load Figure 4.30 Effect of a load instruction in a CPU with 32-bit registers for both big-endian and little-endian ordering. A 32-bit register holds four bytes, which are loaded into the accumulator

QUESTION Suppose Pep/9 contains the following four hexadecimal values: A: 19AC X: FE20 Mem[0A3F]: FF00 Mem[0A41]: 103D If it has these values before each of the following statements executes, what are the four hexadecimal values after each statement executes? (a) C10A3F (b) D10A3F (c) D90A41 (d) F10A41 (e) E90A3F (f) 790A41 (g) 710A3F (h) 910A3F (i) 07

ANSWER

Von Neumann Computers stored program concept: In 1945, John von Neumann proposed to build a computer that would store in main memory not only the data, but the program as well. The stored-program concept was a radical idea at the time.  Practically all commercial computers today are based on the stored-program concept, with programs and data sharing the same main memory. The Pep/9 computer is a classic von Neumann machine.

The von Neumann execution cycle Fetch instruction at Mem[PC]. Decode instruction fetched. Increment PC. Execute the instruction fetched. Repeat.

More detailed view Figure 4.31 first instruction is placed at address 0000 (hex). second instruction is placed adjacent to the first: (0001(hex) if first instruction is unary, 0003(hex) if not PC: To initialize the program counter and stack pointer, PC is set to 0000 (hex), and SP is set to Mem[FFF4]. The purpose of the program counter is to hold the address of the next instruction to be executed. Because the first instruction was loaded into main memory at address 0000, the PC must be set initially to 0000. The purpose of the stack pointer is to hold the address of the top of the run-time stack. A later section explains why SP is set to Mem[FFF4].

Figure 4.32 Initialize PC and SP PC : - hold the address of the next instruction to be executed. SP: -hold the address of the top of the run-time stack

Figure 4.32 FETCH: first operation in the von Neumann execution cycle. -CPU examines PC to get an address. It then goes to that address in main memory to fetch the instruction specifier (one byte) of the next instruction. and holds them in the first byte of the instruction register (IR).

Figure 4.32 DECODE: -The CPU extracts the opcode from the instruction specifier to determine which instruction to execute. -Depending on the opcode, the CPU extracts the register specifier if there is one and the addressing field if there is one. -Now the CPU knows from the opcode whether the instruction is unary. If it is not unary, the CPU fetches the operand specifier (one word) from memory and stores it in the last two bytes of the IR.

Figure 4.32 Increment PC (to next instruction to fetch) The CPU adds 0001 to the PC if the instruction was unary. Otherwise it adds 0003.

Figure 4.32 The CPU executes the instruction that is stored in the IR. The opcode tells the CPU which of the 40 instructions to execute.

Figure 4.32 CPU returns to the fetch operation unless the instruction just executed was the stop instruction. Pep/9 will also terminate at this point if the instruction attempts an illegal operation. (e.g. attempting execution of an instruction with a forbidden addressing mode)

A Character Output Program Pep/9 system is a character I/O system: take its input from the keyboard and send its output to the screen I/O devices are based on the ASCII character set. input device at Mem[FC15] load byte instruction from Mem[FC15] to CPU register output device at Mem[FC16] Store byte instruction to Mem[FC16] from CPU register

Figure 4.33  simple machine-language program that outputs the characters Hi on the output device 1101 H@Mem(1101) i@Mem(1110)

help Display settings CPU Write object code here in hex I/O

Run Program Memory dump Systemclear memory Program (each byte separated by space, no leading / trailing spaces in a line) BuildLoadExecute = BuildRun Object

The Pep/9 loader is extremely particular about the format of your machine-language program. To work correctly: The very first character in your text file must be a hexadecimal character. No leading blank lines or spaces are allowed. There must be exactly one space between bytes. If you wish to continue your byte stream on another line, you must not leave trailing spaces on the preceding line.

Step through Build  start debugging object

Figure 4.34 (a) Initial state before loading. (b) Program loaded into main memory.

Figure 4.34 (continued) (c) PC ← 0000 (hex). (d) Fetch instruction at Mem[PC].

Figure 4.34 (continued) (e) Increment PC. (f) Execute. Load byte for H to accumulator.

Figure 4.34 (continued) (g) Fetch instruction at Mem[PC]. (h) Increment PC.

Figure 4.34 (continued) (i) Execute. Store byte from accumulator to output device. (j) Fetch instruction at Mem[PC].

Figure 4.34 (continued) (k) Increment PC. (l) Execute. Load byte for i to accumulator.

A Character Input Program Figure 4.35 A Character Input Program FC15- Input Store byte from the accumulator to Mem[0013] FC16- Output Machine language program to input two characters and output them in reverse order

Terminal I/O input output

step4 step1 step2 step3 Address Algorithm Instruction Unary? 0000 Load word Non-U (3 bytes) 0003 A = + 3 Add Word 0006 Convert sum to character Bitwise OR with MASK 0009 Output the Character Store Byte 000C STOP stop U (1 byte) 000D Decimal 5 Data - word 2 bytes 000F Decimal 3 0011 Mask for ASCII character

step4 step1 step2 step3 Address Algorithm Instruction Unary? 0000 Load Word Non-unary (3 bytes) 0003 A = + 3 Add Word 0006 Convert sum to character Bitwise OR with Mask 0009 Output the Character Store Byte 000C STOP Stop Unary (1 byte) 000D Decimal 5 Data –word 2 bytes 000F Decimal 3 Data – word 0011 Mask for ASCII character Data -word

step5 step6 Address Algorithm Instruction Instruction –binary Instruction-Hex 0000 A = 5 Load Word 0003 A = + 3 Add Word 0006 Convert sum to character Bitwise OR with Mask 0009 Output the Character Store Byte 000C STOP Stop 000D Decimal 5 Data –word 000F Decimal 3 0011 Mask for ASCII character

step5 step6 Address Algorithm Instruction Instruction –binary Instruction-Hex 0000 A = 5 Load Word 1100-0001-0000-0000-0000-1101 C1000D 0003 A = + 3 Add Word 0110-0001-0000-0000-0000-1111 61000F 0006 Convert sum to character Bitwise OR with Mask 1001-0001-0000-0000-0001-0001 910011 0009 Output the Character Store Byte 1111-0001-1111-1100-0001-0110 F1FC16 000C STOP Stop 0000-0000 00 000D Decimal 5 Data –word 0000-0000-0000-0101 0005 000F Decimal 3 0000-0000-0000-0011 0011 Mask for ASCII character 0000-0000-0011-0000 0030

Converting Decimal to ASCII Figure 4.36 Converting Decimal to ASCII 000D(hex)  Illustrates the inconvenience of dealing with output at the machine level. OR with MASK 3(dec) 5(dec) Works only if output is single digit  loads the 5 into the accumulator adds the 3  8 is interpreted as ASCII Backspace We need to print 8 instead So, the program must convert the decimal number 8, 0000 1000 (bin), to the ASCII character 8, 0011 1000 (bin) 8(dec) MASK “8” ASCII

From ASCII Table: 0000 0000 0011 0000

Question  Write a machine language program to add the three numbers 2, –3, and 6 and output the sum on the output device. Store the numbers in hexadecimal. Do not use the subtract, negate, or invert instructions. Write the program in a format suitable for the loader and execute it on the Pep/9 simulator.

Answer

Question Write a machine language program to input two one-digit numbers, add them, and output the one-digit sum. There can be no space between the two one-digit numbers on input. Write the program in a format suitable for the loader and execute it on the Pep/9 simulator.

Answer

Question  Write a machine language program to output the three characters Cat on the output device. Write it in a format suitable for the loader and execute it on the Pep/9 simulator.

Answer algorithm load byte A<- ‘C’ output value in A load byte A<- ‘a’ load byte A<- ‘t’ Stop ’C’ ‘a’ ‘t’

Answer algorithm 0000 load byte A<- ‘C’ 0003 output value in A 0006 load byte A<- ‘a’ 0009 output value in A 000C load byte A<- ‘t’ 000F output value in A 0012 Stop 0013 ’C’ ‘a’ ‘t’

Answer cat.pepo 0000 D1 00 13 ; load byte A<- Mem[0013] =43=‘C’ 0003 F1 FC 16 ; output value in A 0006 D1 00 14 ; load byte A<- Mem[0014]=61=‘a’ 0009 F1 FC 16 ; output value in A 000C D1 00 15 ; load byte A<- Mem[0015]=74=‘t’ 000F F1 FC 16 ; output value in A 0012 00 ;stop 0013 43 61 74 ;’C’ ‘a’ ‘t’ zz

QUESTION Determine the output of the following Pep/9 machine language program. The left column in each part is the memory address of the first byte on the line: (a) 0000 C1000A 0003 81000C 0006 F1FC16 0009 00 000A A94F 000C FFFD

ANSWER 0000 C1000A load word to A from mem[000A] =A94F Answer: M 0000 C1000A load word to A from mem[000A] =A94F 0003 81000C Bitwise AND to A mem[000C] = FFFD(A94F AND FFFD = A94D) 0006 F1FC16 Store byte (4D = ‘M’) to output device from A 0009 00 Stop 000A A94F 000C FFFD

Programming at Level ISA3 To program at Level ISA3 is to write a set of instructions in binary. An operating system is a program.  In the Pep/9 computer, the bottom part of main memory—that is, the part with high memory addresses—is reserved for the operating system.

Figure 4.41

Pep/9 operating system consists of two programs Figure 4.41  run-time stack for the operating system begins at memory location FC0F. Grows upwards. SP store  address of the top of the system stack when the operating system executes  user stack, is at memory location FB8F, just above the operating system. The stack pointer register in the CPU contains the address of the top of the stack’ stack “grows upward” in memory toward the smaller addresses (procedure call params,local vars, return addresses).  loads the application program into main memory On the Pep/9, you invoke the loader by choosing the loader option from the menu of the simulator program. Stack is used for static memory allocation and Heap for dynamic memory allocation Pep/9 operating system consists of two programs  machine vectors (6 words in ROM) instructions with opcodes 0010 011 through 0010 1 are unimplemented at Level ISA3. The trap handler implements these instructions for the assembly language programmer.

Memory devices Read/Write memory(RAM) Also called Random-Access Memory (RAM) Can load from RAM and store to RAM Read-Only memory (ROM) Can load from ROM Cannot store to ROM

The load option When you choose the load option from the Pep/9 simulator menu, the following two events occur: SP ← Mem[FFF6] PC ← Mem[FFFC] After these , the execution cycle begins

Pep/9 load option  FC0F is the value the stack pointer should have when the system stack is empty FC17 is the address of the first instruction to be executed in the loader

The execute option After you write your machine-language program and load it with the loader option, you must select the execute option to run it.  The following events occur when you select the execute option: SP ← Mem[FFF4] PC ← 0000 Start the von Neumann cycle

Figure 4.43

Project Discussion