Presentation is loading. Please wait.

Presentation is loading. Please wait.

23/07/2016CSE1303 Part B lecture notes 1 Introduction to computer systems Lecture B01 Lecture notes section B01.

Similar presentations


Presentation on theme: "23/07/2016CSE1303 Part B lecture notes 1 Introduction to computer systems Lecture B01 Lecture notes section B01."— Presentation transcript:

1 23/07/2016CSE1303 Part B lecture notes 1 Introduction to computer systems Lecture B01 Lecture notes section B01

2 23/07/2016CSE1303 Part B lecture notes 2 In this lecture  Outline of course  Bits  what a bit is and what it does  Memory  how bits are used to store information

3 23/07/2016CSE1303 Part B lecture notes 3 Outline  Bits and memory (1 lecture)  Numbers (4 lectures)  binary  unsigned  signed  floating point  Bit manipulation (1 lecture)  shifting  masking

4 23/07/2016CSE1303 Part B lecture notes 4 Outline  Characters and strings (1 lecture)  ASCII  command-line arguments  Compilers (1 lecture)  code generation  how compilers work  comparison with interpreters

5 23/07/2016CSE1303 Part B lecture notes 5 Outline  Assembly language (2 lectures)  MIPS  SPIM simulator  From C to MIPS (6 lectures)  control and data constructs  Analysis (1 lecture)  Computer hardware (1 lecture)

6 23/07/2016CSE1303 Part B lecture notes 6 Why?  To write good C, need to know how C works  how are pointers and arrays related? int foo(char *x) {... *(x+i)...... *(x+i)...} int foo(char x[]) {... x[i]...... x[i]...} =

7 23/07/2016CSE1303 Part B lecture notes 7 Why?  To write good C, need to know how C works  why do you use * and & to pass function parameters by reference? void func(int *ref) {... *ref...... *ref...} int main() { int x; int x;... func(&x)...... func(&x)...}

8 23/07/2016CSE1303 Part B lecture notes 8 Why?  To write good C, need to know how C works  how much time does it take to call a function? int main() {......... something...... something.........} void func() { something something} int main() {......... func()...... func().........}

9 23/07/2016CSE1303 Part B lecture notes 9 Why?  To write good C, need to know how C works  how does a recursive function keep track of its local variables and parameters? int factorial(int n) { int result = 1; int result = 1; if (n > 1) if (n > 1) result = n * factorial(n - 1); result = n * factorial(n - 1); return result; return result;}

10 23/07/2016CSE1303 Part B lecture notes 10 Organization hierarchy Document Application High-level language (C) what happens here? Hardware more abstract

11 23/07/2016CSE1303 Part B lecture notes 11 What we’ll cover  Things you need to know as a programmer  efficiency  complexity  memory organization  representing data structures  Simple hardware implementation  digital logic and low-level architecture

12 23/07/2016CSE1303 Part B lecture notes 12 What we won’t cover  Advanced hardware implementation  Advanced computer architecture  interrupts  memory mapping and caching  pipelining for these, do CSE2302 and CSE2324/CSE3324for these, do CSE2302 and CSE2324/CSE3324

13 23/07/2016CSE1303 Part B lecture notes 13 Bits  The fundamental component of computer storage  Can hold one single binary piece of information onyestruehigh1offnofalselow0

14 23/07/2016CSE1303 Part B lecture notes 14 Grouping bits  One bit cannot hold much information  Bits are usually grouped to form larger sized “containers” of information  a byte = 8 bits of information  a word = 16, or 32, or 64 bits in size depending on computerdepending on computer a word size of 32 bits is used in this unit as this is the word size of the MIPS R2000 CPU)a word size of 32 bits is used in this unit as this is the word size of the MIPS R2000 CPU) so halfword = 16 bits, doubleword = 64 bitsso halfword = 16 bits, doubleword = 64 bits

15 23/07/2016CSE1303 Part B lecture notes 15 Addressing memory 01101110 01011010 00000000 01011010 11010011  To refer to a byte, need to distinguish it from other bytes one bit a byte (8 bits) another byte the byte we wish to access millions more in either direction

16 23/07/2016CSE1303 Part B lecture notes 16 Addressing: an analogy MEMORY LANE 41 43 is for sale 42 44

17 23/07/2016CSE1303 Part B lecture notes 17 Addressing memory  Each memory location has a unique address  an address is an integer  no two memory locations have the same address  Addresses are sequential  lowest address 0  adjacent locations have consecutive addresses  highest address depends on the memory capacity of the computer  A location’s address is independent of its contents  changing the contents of a memory location does not alter its address

18 23/07/2016CSE1303 Part B lecture notes 18 Addressing memory 01101110 01011010 00000000 01011010 11010011 11011110 11011001010430 10431 10432 10433 10434 16777215 Addresses 1 to 10,429 omitted from diagram for space Addresses 10,435 to 16,777,214 omitted from diagram for space This computer has 16,777,216 bytes (16 megabytes) of memory lower addresses higher addresses

19 23/07/2016CSE1303 Part B lecture notes 19 Addressing memory 01101110 01011010 00000000 01011010 11010011 11011110 11011001 lower addresses higher addresses 0 10431 10432 10433 10434 16777215 byte at address 10433 contains 01011010 10430

20 23/07/2016CSE1303 Part B lecture notes 20 Looking for meaning  What does “01011010” mean?  number 90?  ASCII character ‘Z’?  instruction DECB for Motorola 6800 CPU?  just bits?  Depends on context  bits have no intrinsic meaning  value depends on how it is being used  if interpreting as number, has value 90  if interpreting as character, has value ‘Z’  This is why C variables have types

21 23/07/2016CSE1303 Part B lecture notes 21 Encoding data structures  Memory is made up of bits  data structures must be encoded for storage  Numbers (integers)  encoded using the binary number system  Characters  encoded as numbers using ASCII code  Program code  instructions encoded as patterns of numbers and bits  Other structures ( struct s, float s,...)  usually converted to numbers

22 23/07/2016CSE1303 Part B lecture notes 22 Implementation of memory  A computer’s main (or high-speed) memory unit is implemented by semi- conductor based electronic circuits  simple logic gate circuits with feedback allow a 1-bit input value to be sampled and held into the future. (ie. bit value is remembered and can be read back later)  can group above into “byte” sized cells  can individually address (or access) each cell within a vast array of memory cells

23 23/07/2016CSE1303 Part B lecture notes 23 Covered in this lecture  Outline  Bits  bytes  words  Memory  used to store numbersnumbers program codeprogram code characterscharacters  access to each cell is by a unique address

24 23/07/2016CSE1303 Part B lecture notes 24 Next time  Numbers  binary representation  unsigned integers Reading: Lecture notes section B02


Download ppt "23/07/2016CSE1303 Part B lecture notes 1 Introduction to computer systems Lecture B01 Lecture notes section B01."

Similar presentations


Ads by Google