10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept Recall Objective: understand computers at machine level interested in software perspective Problem: how can we discuss / explain something that is “unknown” ? One Approach: understand the real machine how do the millions of transistors in a computer support programs? impractical! (too complex) Understanding Computers
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept Alternate Approach: learn and understand an abstract model of the computer’s behaviour emphasize only the important details/attributes have you done this in other courses? programmer’s model abstract model appropriate for explaining software at the machine level no transistor details! widely used in industry models computer as a system System: a set of components that interact to accomplish an objective Programmer’s Model
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept what are the components? how do they interact? what are the objectives? “A Computer System” Computer System Processor Memory I/O Bus Connected Devices keyboard mouse display printer disk drives communication links etc. Diagram of a Simple Computer System
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept manipulates information located in components: (processor, memory, I/O) by executing instructions information in processor held in registers processor characterized by: register set: (more later) instruction set – includes addressing modes (more later) interrupt mechanism – lets other components notify processor when “events” happen (more in !) Processor
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept holds information in cells (or “locations”) each cell has: address: a name that identifies cell contents: the information “value” held in the cell memory supports two operations: write(address, value): causes the cell identified by address to replace its contents with value (i.e. new information held in the cell = value) read(address): returns the value held as the contents of the cell identified by address (contents of the cell are not changed) Memory
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept information exchange between computer and connected devices independent I/O components associated with each connected device e.g. keyboard components are associated with the keyboard, mouse components with the mouse, etc. I/O = Input / Output
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept ports exchange information between bus and I/O components ports are identified by I/O addresses port operations: read and/or write values (not necessarily both) Note: I/O ports memory cells control ports: write values to these – control behaviour of component/device status ports: read values from these – find out about current state of component/device data port: read and/or write values of these – exchange application information (More on ports and I/O later!) Ports
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept Information plays a key role in all components in the computer system How does information exist in a computer system at the machine level? Topic for next few lectures. What sort of information needs encoding? numbers: counting numbers, integers, reals other numbers (fractions, complex, etc.) characters, strings, text graphics days, months, years (Y2K bug?) others? Information Inside Computer
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept There are hardware limitations transistors are switched between two states (more in 257 & 267) on / off or high / low or 0 / 1 information must be encoded in 2-state values! one BInary digiT = one bit = one 2-state value possible value of a bit = 0 or 1 Information Encoding
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept Further Complication: registers, cells and ports are built using fixed numbers of transistors values are encoded in a fixed number of bits! e.g. value that is 8-bits wide = byte finite limitations on range of values! for n-bit width 2 n different values Information Encoding (contd)
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept How can information be represented as fixed length binary values ? Fixed length binary values Information mapping finite set! Information Encoding Problem
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept How can information be represented as fixed length binary values? information is abstract – invented by people binary values are held in fixed width registers, cells and ports computers do not “know” about information computers deal with binary values that have been encoded (by people) to represent information ! Information Encoding Problem (contd)
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept suppose an application must deal with day-of-the- week information (e.g. a day-timer/scheduler) must encode days of the week as binary values how many bits are needed? what values should be used? Encoding Example: Days of the Week
10-Sep Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Sept One Possible Day-Of-The-Week Encoding: Monday 000(binary) Tuesday 001 Wednesday 010 Sunday 110 is this the only possible encoding? would the computer “care” if a different encoding was used? who would care? Encoding Example (contd.)