Here, We Study Computer Organization
Here, We Study Computer Organization
Here, We Study Computer Organization
• Using high-order interleave, the address is broken into the chip followed by the
location on the chip, giving a layout as shown above
– The advantage of high-order interleave is that two different devices, working on two
different areas of memory, can perform their memory accesses simultaneously
– e.g., one device accesses address 5 and another accesses 31
• In low-order interleave, the address is broken up by location on the chip first, and the
chip number last
– Consecutive memory locations are on consecutive chips
– The advantage of lower-order interleave is that several consecutive memory accesses can
be performed simultaneously
– For instance, fetching 4 consecutive instructions at one time
Interrupts
• The last part of our computer organization is an
interrupting mechanism
– Left to itself, the CPU performs the fetch-execute cycle on your
program repeatedly without pause, until the program terminates
• What happens if an I/O device needs attention?
• What happens if your program tries to do an illegal operation?
– see the list on page 157 of types of illegal operations
• What happens if you want to run 2 or more programs in a multitasking
mode?
– You cannot do this without interrupts
• An interrupt is literally the interruption of the CPU so that
it can switch its attention from your program to something
else
– an I/O device, the operating system, or another user program
The Interrupt Process
• At the end of each fetch-execute cycle, the CPU checks to see
if an interrupt has arisen
– Devices send interrupts to the CPU over the control bus
• If the instruction causes an interrupt, the Interrupt Flag (in the status flags) is
set
– If an interrupt has arisen, the interrupt is handled as follows
• The CPU saves what it was doing (PC and other important registers are saved
to the run-time stack in memory)
• The CPU figures out who raised the interrupt and executes an interrupt
handler to handle that type of interrupt
• The interrupt handler is a set of code (part of the OS) stored in memory
• While the interrupt is being handled, the CPU may choose to ignore or disable
interrupts from interrupting the interrupt handler (known as a maskable
interrupt) or may choose to handle a future interrupt (non-maskable interrupt)
• Once the interrupt has been handled, the CPU restores the interrupted
program by retrieving the values from the run-time stack
MARIE: A Simple Computer
• We now put all of these elements together into a
reduced computer
– MARIE: Machine Architecture that is Really
Intuitive and Easy
• Unfortunately we will find that MARIE is too easy, it is not
very realistic, so we will go beyond MARIE as well
• We will explore MARIE’s
– CPU (registers, ALU, structure)
– Instruction set (the instructions, their format – how you specify the
instruction, addressing modes used, data types available
– Interrupts, I/O
– Some simple programs in MARIE
MARIE’s Architecture
• Data stored in binary, two’s • Registers:
complement – AC (accumulator) – this is the
• Stored programs only data register (16 bits)
• 16-bit word size with word – PC (12 bits)
– IR (16 bits)
addressing (you can only get
– Status flags
words from memory, not bytes)
– MAR (memory address register)
• 4K of main memory using 12 – stores the address to be sent to
bit addresses, 16-bit data memory, 12 bits
• 16-bit instructions (4 bits for – MBR (memory buffer register) –
the op code, 12 bits for the stores the datum to be sent to
memory or retrieved from
address of the datum in
memory, 16 bits
memory)
– 8-bit input and 8-bit output
registers
MARIE CPU
The data pathways in the Notice that the MAR sends to memory, the MBR
CPU from register to register stores the datum being sent to memory or retrieved
or to the ALU or memory from memory, the InREG and OutREG receive data
from and send data to I/O respectively
MARIE’s Fetch-Execute Cycle
PC stores the location in memory of the next
Instruction
This code will add the two numbers stored at memory location 104 and 105
Receive an instruction in IR