SlideServe
Menu
Préférences
© SlideServe · v2026

CPSC 233 Tutorial

lynsey avatar
12 diapositives · 300 Views · Jul 26, 2014

CPSC 233 Tutorial. Xin Liu 2011/01/17. Self-intro. Xin Liu PhD student Email: liuxin@ucalgary.ca Homepage: http://pages.cpsc.ucalgary.ca/~liuxin CT: Thursday 12:00-2:00 @ CT desk. Unix Environment. Working in the lab is suggested Remote access using SSH On Windows:

CPSC 233 Tutorial - slide 1
01 / 12CPSC 233 Tutorial
1 / 17

Télécharger la présentation

CPSC 233 Tutorial
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. CPSC 233 Tutorial Xin Liu 2011/01/17

  2. Self-intro • Xin Liu • PhD student • Email: liuxin@ucalgary.ca • Homepage: http://pages.cpsc.ucalgary.ca/~liuxin • CT: Thursday 12:00-2:00 @ CT desk

  3. Unix Environment • Working in the lab is suggested • Remote access using SSH • On Windows: • Download SSH Client program from http://www.ucalgary.ca/it/software/ssh • Quick Connect • Host Name: csc.cpsc.ucalgary.ca • User Name: xxx • On Mac: • using terminal to connect to the UNIX system • ssh <username>@csc.cpsc.ucalgary.ca

  4. Assignment • Submit your Assignments with “submit” command of UNIX • Submit • submit -c <course number> -a <assignment number> <name of file or files to be submitted> • eg. submit -c233 -a 3 a3.p README • List submitted files • showstuff -c <course number> -a <assignment number> • eg. showstuff -c233 -a 3 • Submit early and update • Avoid plagiarism • MOSS ( Measure of Software Similarity )http://theory.stanford.edu/~aiken/moss/ • Cite if necessary • No marks lost by citing example code from TA/instructor

  5. Binary Numbers Byte: 8 bits Word: 16 bits Double word: 32 bits Quad word: 64 bits Multiples of 4 bits, corresponding to a hexadecimal number

  6. Bin Dec • 101011.0101 • 1*25 + 0*24 + 1*23 + 0*22 + 1*21 + 1*20 + 0*2-1 + 1*2-2 + 0*2-3 + 1*2-4 = 32 + 0 + 8 + 0 + 2 + 1 + 0 + 0.25 + 0 + 0.0625 = 43.3125 • Other examples …

  7. Dec  Bin • Convert Integer and Decimal parts seperately • Example: 37.43  100101.01101b

  8. Negative Integers • Three representations • Regular binary (true code) • 0110 0100 (DEC 100) • 1110 0100 (DEC -100) • One’s complement (flip each bit) • 0110 0100 (DEC 100) • 1001 1011 (DEC -100) • Two’s complement (flip each bit + 1) most useful!!! • 0110 0100 (DEC 100) • 1001 1100 (DEC -100)

  9. Negative integers • Two’s complement • Definition: 2N-x for an N-bit number • Regular binary  two’s complement: • Positive: No change • Negative: flip bitwise + 1 Dec: - 95  10100001 ----------------------------- 95: - 0101 1111 true code 1010 0000 Flip (one’s complement) 1010 0001 +1

  10. Integer Addition • Directly add the numbers, no matter positive or negative • Check left two carry bit • 00 or 11  valid • 01 or 10  invalid (overflow) 11111 111 (carry) 0000 1111 (15) + 1111 1011 (-5) ================== 0000 1010 (10) 0111 (carry)  invalid! 0111 (7) + 0011 (3) ============= 1010 (−6)

  11. Integer Subtraction • x-y=x+ two’s complement of y • Procedures: • Compute the two’s complement ofy(flip bits + 1) • Addition • Check for overflow 01100100 (x, equals decimal 100) - 00010110 (y, equals decimal 22) ========== 11100000 (carry)  valid! 01100100 (x) + 11101010 (two’s complement of y) ========== 101001110 (two’s complement of result) 01001110 (regular binary of result 78)

  12. Integer Subtraction • Another example 01100100 (x, equals decimal 100) --11001000 (y, equals decimal -200) ========== 01100000 (carry)  invalid! 01100100 (x) + 00111000 (two’s complement of y) ========== 010011100 (two’s complement of result) - 01100100 (regular binary of result -196)