Bits, Bytes, and Integer
|
|
- Olivia Chambers
- 6 years ago
- Views:
Transcription
1 19.3 Compter Architectre Spring 1 Bits, Bytes, and Integers Nmber Representations Bits, Bytes, and Integer Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed Conversion, casting Expanding, trncating Addition, negation, mltiplication, shifting Smmary Acknowledgement: slides based on the cs:appe material Binary Representations Encoding Byte Vales Byte = bits 3.3V.V.5V.V 1 Binary to Decimal: 1 to 551 Hexadecimal 1 to 1 Base 1 nmber representation Use characters to 9 and A to F Write FA1D37B1 in C as xfa1d37b xfa1d37b A 1 11 B C 1 11 D E F Byte-Oriented Memory Organization Machine Words Programs Refer to Virtal Addresses Conceptally very large array of bytes Actally implemented with hierarchy of different memory types System provides address space private to particlar process Program being exected Program can clobber its own data, bt not that of others Compiler + Rn-Time System Control Allocation Where different program objects shold be stored All allocation within single virtal address space Machine Has Word Size Nominal size of integer-valed data Inclding addresses Most crrent machines se 3 bits ( bytes) words Limits addresses to GB Becoming too small for memory-intensive applications High-end systems se bits ( bytes) words Potential address space 1. X 1 19 bytes x- machines spport -bit addresses: 5 Terabytes Machines spport mltiple data formats Fractions or mltiples of word size Always integral nmber of bytes 5 1
2 19.3 Compter Architectre Spring 1 Word-Oriented Memory Organization Addresses Specify Byte Locations Address of first byte in word Addresses of sccessive words differ by (3-bit) or (-bit) 3-bit Words Addr =?? Addr =?? Addr =?? Addr = 1?? -bit Words Addr =?? Addr =?? Bytes Addr Data Representations C Data Type Typical 3-bit Intel IA3 x- char short int long long long float doble long doble 1/1 1/1 pointer 7 Byte Ordering Byte Ordering Example How shold bytes within a mlti-byte word be ordered in memory? Conventions Big Endian: Sn, PPC Mac, Internet Least significant byte has highest address Little Endian: x Least significant byte has lowest address Big Endian Least significant byte has highest address Little Endian Least significant byte has lowest address Example Variable x has -byte representation x1357 Address given by &x is x1 Big Endian x1 x11 x1 x Little Endian x1 x11 x1 x Reading Byte-Reversed Listings Examining Data Representations Disassembly Text representation of binary machine code Generated by program that reads the machine code Example Fragment Address Instrction Code Assembly Rendition 35: 5b pop %ebx 3: 1 c3 ab 1 add $x1ab,%ebx 3c: 3 bb cmpl $x,x(%ebx) Deciphering Nmbers Vale: x1ab Pad to 3 bits: x1ab Split into bytes: 1 ab Reverse: ab 1 Code to Print Byte Representation of Data Casting pointer to nsigned char * creates byte array void show_bytes(char *start, int len){ int i; for (i = ; i < len; i++) { printf( %p\tx%.x\n", start+i, start[i]); printf("\n"); printf directives: %p: print pointer %x: print hexadecimal 11 1
3 19.3 Compter Architectre Spring 1 show_bytes Exection Example int a = 1513; printf("int a = 1513;\n"); show_bytes((char *) &a, sizeof(int)); Reslt (Linx): int a = 1513; x11ffffcb xd x11ffffcb9 x3b x11ffffcba x x11ffffcbb x 13 Representing Integers int A = 1513; IA3, x- D 3B IA3, x- 93 C Sn 3B D int B = -1513; (= xffffc93) Sn C 93 1 Decimal: 1513 long int C = 1513; IA3 D 3B Binary: Hex: 3 B D x- D 3B Two s complement representation (Covered later) Sn 3B D Representing Pointers int B = -1513; int *P = &B; Sn IA3 x- different compilers & machines assign different locations to objects EF FB C D F BF C 9 EC 7F Representing Strings char S[] = "13"; Strings in C Represented by array of characters Linx/Alpha Sn Each character encoded in ASCII format Standard 7-bit encoding of character set Character has code x Digit i has code x3+i String shold be nll-terminated Final character = Compatibility Byte ordering not an isse 15 1 Bits, Bytes, and Integers Boolean Algebra Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed Conversion, casting Expanding, trncating Addition, negation, mltiplication, shifting Smmary Developed by George Boole in 19th Centry Algebraic representation of logic Encode Tre as 1 and False as And Or A&B = 1 when both A=1 and B=1 A B = 1 when either A=1 or B=1 Not ~A = 1 when A= Exclsive-Or (Xor) A^B = 1 when either A=1 or B=1, bt not both
4 19.3 Compter Architectre Spring 1 Application of Boolean Algebra General Boolean Algebras Applied to Digital Systems by Clade Shannon 1937 MIT Master s Thesis Reason abot networks of relay switches Encode closed switch as 1, open switch as A&~B Connection when A ~B A&~B ~A&B Operate on Bit Vectors Operations applied bitwise 1111 & All of the Properties of Boolean Algebra Apply 1111 ^ ~ ~A B ~A&B = A^B 19 Representing & Maniplating Sets Representation Width w bit vector represents sbsets of {,, w 1 a j = 1 if j A 1111 {, 3, 5, {,,, 7531 Operations & Intersection 11 {, Union {,, 3,, 5, ^ Symmetric difference 1111 {, 3,, 5 ~ Complement 1111 { 1, 3, 5, 7 Bit-Level Operations in C Operations &,, ~, ^ available in C Apply to any integral data type long, int, short, char, nsigned View argments as bit vectors Argments applied bit-wise Examples (Char data type) ~x1 xbe ~ ~x x ~ x9 & x55 x & x9 x55 x7d Contrast: Logic Operations in C Shift Operations Contrast to Logical Operators &&,,! View as False Anything nonzero as Tre Always retrn or 1 Early termination Examples (char data type)!x1 x!x x1!!x1 x1 x9 && x55 x1 x9 x55 x1 p && *p (avoids nll pointer access) Left Shift: x << y Shift bit-vector x left y positions Throw away extra bits on left Fill with s on right Right Shift: x >> y Shift bit-vector x right y positions Throw away extra bits on right Logical shift Fill with s on left Arithmetic shift Replicate most significant bit on right Undefined Behavior Shift amont < or word size Argment x 111 << 3 1 Log. >> 11 Arith. >> 11 Argment x 111 << 3 1 Log. >> 11 Arith. >>
5 19.3 Compter Architectre Spring 1 Bits, Bytes, and Integers Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed Conversion, casting Expanding, trncating Addition, negation, mltiplication, shifting Smmary Encoding Integers BU(X) w 1 x i i i C short bytes long short int x = 1513; short int y = -1513; Two s Complement BT(X) x w 1 w 1 w x i i i Decimal Hex Binary x B D y C Sign Bit Sign Bit For s complement, most significant bit indicates sign for nonnegative 1 for negative 5 Encoding Example (Cont.) x = 1513: y = -1513: Weight Sm Encoding Example Visalized Two s Complement BU(X) w 1 x i i BT(X) x w 1 w 1 w x i i i i 3 = 3 = = = 1 = 1 = = 1 = [1] [1] [11] [11] [111] [111] [1111] [1111] 7 Nmeric Ranges Vales UMin = UMax = w Two s Complement Vales TMin = w 1 1 TMax = w Other Vales Mins 1 Vales for W = Decimal Hex Binary UMax TMax 377 7F TMin Vales for Different Word Sizes W 1 3 UMax 55 5,535,9,97,95 1,,7,73,79,551,15 TMax 17 3,77,17,3,7 9,3,37,3,5,775,7 TMin -1-3,7 -,17,3, -9,3,37,3,5,775, Observations TMin = TMax + 1 Asymmetric range UMax = * TMax + 1 C Programming #inclde <limits.h> Declares constants, e.g., ULONG_MAX LONG_MAX LONG_MIN Vales platform specific 9 3 5
6 19.3 Compter Architectre Spring 1 & Signed Nmeric Vales X BU(X) BT(X) Eqivalence Same encodings for nonnegative vales Uniqeness Every bit pattern represents niqe integer vale Each representable integer has niqe bit encoding Can Invert Mappings UB(x) = BU -1 (x) Bit pattern for nsigned integer TB(x) = BT -1 (x) Bit pattern for two s comp integer An (Easier) Way To Look At It 11 BU(X) w 1 x i i i Two s Complement BT(X) x w 1 w 1 w x i i i UMax TMin TMax Bits, Bytes, and Integers Mapping Between Signed & Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed Conversion, casting Expanding, trncating Addition, negation, mltiplication, shifting Smmary Two s Complement TU x TB X BU Maintain Same Bit Pattern UT x UB X BT x Two s Complement x Maintain Same Bit Pattern Mappings between nsigned and two s complement nmbers: keep bit representations and reinterpret 33 3 Mapping Signed Mapping Signed Bits Signed Bits Signed TU UT = +/
7 19.3 Compter Architectre Spring 1 Relation between Signed & Conversion Visalized Two s Complement x TU TB X BU x s Comp. Ordering Inversion Negative Big Positive UMax UMax 1 w 1 x x Large negative weight becomes Large positive weight Maintain Same Bit Pattern x x x x w x s Complement Range TMax 1 TMin TMax + 1 TMax Range 37 3 Conversion Visalized () UMax Signed vs. in C s Comp. Ordering Inversion Negative Big Positive s Comp. Ordering Inversion Big Positive Negative Conversion Nmber <= TMax: == s Comp Otherwise: = s Comp + w +/- 1 == -1 1 TMin TMax Constants By defalt are considered to be signed integers if have U as sffix U, 99759U Casting Explicit casting between signed & nsigned same as UT and TU int tx, ty; nsigned x, y; tx = (int) x; y = (nsigned) ty; Implicit casting also occrs via assignments and procedre calls tx = x; y = ty; 39 Casting Srprises Expression Evalation If there is a mix of nsigned and signed in single expression, signed vales implicitly cast to nsigned Inclding comparison operations <, >, ==, <=, >= Examples for W = 3: TMIN = -,17,3,, TMAX =,17,3,7 Constant 1 Constant Relation Evalation U == nsigned -1-1 < signed -1-1 U > nsigned > signed 1737U 1737U < nsigned > signed (nsigned) > nsigned U < nsigned (int) 173U > signed Code Secrity Example /* Kernel memory region holding ser-accessible data */ #define KSIZE 1 char kbf[ksize]; /* Copy at most maxlen bytes from kernel region to ser bffer */ int copy_from_kernel(void *ser_dest, int maxlen) { /* Byte cont len is minimm of bffer size and maxlen */ int len = KSIZE < maxlen? KSIZE : maxlen; memcpy(ser_dest, kbf, len); retrn len; /* memcpy definition */ void *memcpy(void *dest, const void *src, size_t n); Similar to code fond in FreeBSD s implementation of getpeername There are legions of smart people trying to find vlnerabilities in programs 1 7
8 19.3 Compter Architectre Spring 1 Carnegie Mello Carnegie Mello Typical Usage Malicios Usage /* Kernel memory region holding ser-accessible data */ #define KSIZE 1 char kbf[ksize]; /* Kernel memory region holding ser-accessible data */ #define KSIZE 1 char kbf[ksize]; /* Copy at most maxlen bytes from kernel region to ser bffer */ int copy_from_kernel(void *ser_dest, int maxlen) { /* Byte cont len is minimm of bffer size and maxlen */ int len = KSIZE < maxlen? KSIZE : maxlen; memcpy(ser_dest, kbf, len); retrn len; /* Copy at most maxlen bytes from kernel region to ser bffer */ int copy_from_kernel(void *ser_dest, int maxlen) { /* Byte cont len is minimm of bffer size and maxlen */ int len = KSIZE < maxlen? KSIZE : maxlen; memcpy(ser_dest, kbf, len); retrn len; /* memcpy definition */ void *memcpy(void *dest, const void *src, size_t n); /* memcpy definition */ void *memcpy(void *dest, const void *src, size_t n); #define MSIZE 5 #define MSIZE 5 void getstff() { char mybf[msize]; copy_from_kernel(mybf, MSIZE); printf( %s\n, mybf); void getstff() { char mybf[msize]; copy_from_kernel(mybf, -MSIZE);... 3 Understanding What Can Go Wrong /* Kernel memory region holding ser-accessible data */ #define KSIZE 1 char kbf[ksize]; /* Copy at most maxlen bytes from kernel region to ser bffer */ int copy_from_kernel(void *ser_dest, int maxlen) { /* Byte cont len is minimm of bffer size and maxlen */ int len = KSIZE < maxlen? KSIZE : maxlen; memcpy(ser_dest, kbf, len); retrn len; /* memcpy definition */ void *memcpy(void *dest, const void *src, size_t n); Carnegie Mello Smmary Casting Signed : Basic Rles Bit pattern is maintained Bt reinterpreted Can have nexpected effects: adding or sbtracting w Expression containing signed and nsigned int int is cast to nsigned!! #define MSIZE 5 void getstff() { char mybf[msize]; copy_from_kernel(mybf, -MSIZE);... determine type of size_t: $ echo "#inclde <stdio.h>" \ gcc -E - \ grep -E "typedef.* size_t;" 5 Bits, Bytes, and Integers Sign Extension Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed Conversion, casting Expanding, trncating Addition, negation, mltiplication, shifting Smmary Task: Given w-bit signed integer x Convert it to w+k-bit integer with same vale Rle: Make k copies of sign bit: X = x w 1,, x w 1, x w 1, x w,, x k copies of MSB w X X 7 k w
9 19.3 Compter Architectre Spring 1 Sign Extension Example Smmary: Expanding, Trncating: Basic Rles short int x = 1513; int ix = (int) x; short int y = -1513; int iy = (int) y; Decimal Hex Binary x B D ix B D y C iy C Converting from smaller to larger integer data type C atomatically performs sign extension Expanding (e.g., short int to int) : zeros added Signed: sign extension Both yield expected reslt Trncating (e.g., nsigned to nsigned short) /signed: bits are trncated Reslt reinterpreted : mod operation Signed: similar to mod For small nmbers yields expected behavior 9 5 Bits, Bytes, and Integers Negation: Complement & Increment Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed Conversion, casting Expanding, trncating Addition, negation, mltiplication, shifting Smmary Claim: Following Holds for s Complement ~x + 1 == -x Complement Observation: ~x + x == == -1 + x ~x Complement & Increment Examples Addition x = 1513 Decimal Hex Binary x B D ~x -151 C ~x C y C Operands: w bits + v Tre Sm: w+1 bits + v Discard Carry: w bits UAdd w (, v) x = Decimal Hex Binary ~ ~+1 Standard Addition Fnction Ignores carry otpt Implements Modlar Arithmetic s = UAdd w (, v) = + v mod w UAdd w (,v) v v w v w v w
10 19.3 Compter Architectre Spring 1 Visalizing (Mathematical) Integer Addition Visalizing Addition Integer Addition -bit integers, v Compte tre sm Add (, v) Vales increase linearly with and v Forms planar srface Add (, v) Integer Addition v Wraps Arond If tre sm w At most once Tre Sm w+1 Overflow w Modlar Sm Overflow UAdd (, v) v 55 5 Mathematical Properties Modlar Addition Forms an Abelian Grop Closed nder addition UAdd w (, v) w 1 Commtative UAdd w (, v) = UAdd w (v, ) Associative UAdd w (t, UAdd w (, v)) = UAdd w (UAdd w (t, ), v) is additive identity UAdd w (, ) = Every element has additive inverse Let UComp w ( ) = w UAdd w (, UComp w ( )) = Two s Complement Addition Operands: w bits + v Tre Sm: w+1 bits + v Discard Carry: w bits TAdd w (, v) TAdd and UAdd have Identical Bit-Level Behavior Signed vs. nsigned addition in C: int s, t,, v; s = (int) ((nsigned) + (nsigned) v); t = + v Will give s == t 57 5 TAdd Overflow Visalizing s Complement Addition Fnctionality Tre sm reqires w+1 bits Drop off MSB Treat remaining bits as s comp. integer w 1 w 1 w 1 1 w Tre Sm PosOver NegOver TAdd Reslt Vales -bit two s comp. Range from - to +7 Wraps Arond If sm w 1 Becomes negative At most once If sm < w 1 Becomes positive At most once NegOver TAdd (, v) v - PosOver 59 1
11 19.3 Compter Architectre Spring 1 Characterizing TAdd Mathematical Properties of TAdd Fnctionality Tre sm reqires w+1 bits Drop off MSB Treat remaining bits as s c omp. integer Positive Overflow TAdd(, v) > v < < > Negative Overflow Isomorphic Grop to nsigneds with UAdd TAdd w (, v) = UT(UAdd w (TU( ), TU(v))) Since both have identical bit patterns Two s Complement Under TAdd Forms a Grop Closed, Commtative, Associative, is additive identity Every element has additive inverse TAdd w (,v) v w 1 w v v w 1 w v TMin (NegOver) w TMin w v TMax w TMax w v (PosOver) TComp w () TMin w TMin w TMin w 1 Mltiplication Mltiplication in C Compting Exact Prodct of w-bit nmbers x, y Either signed or nsigned Ranges : x * y ( w 1) = w w Up to w bits Operands: w bits Tre Prodct: *w bits Discard w bits: w bits v * v UMlt w (, v) Two s complement min: x * y ( w 1 )*( w 1 1) = w + w 1 Up to w 1 bits Two s complement max: x * y ( w 1 ) = w Standard Mltiplication Fnction Ignores high order w bits Up to w bits, bt only for (TMin w ) Maintaining Exact Reslts Wold need to keep expanding word size with each prodct compted Done in software by arbitrary precision arithmetic packages Implements Modlar Arithmetic UMlt w (, v) = v mod w 3 Signed Mltiplication in C Operands: w bits Tre Prodct: *w bits Discard w bits: w bits v Standard Mltiplication Fnction Ignores high order w bits Some of which are different for signed vs. nsigned mltiplication Lower bits are the same * v TMlt w (, v) Power-of- Mltiply with Shift Operation << k gives * k Both signed and nsigned Operands: w bits Tre Prodct: w+k bits Examples k Discard k bits: w bits UMlt w (, k ) TMlt w (, k ) << 3 == * << 5 - << 3 == * Most machines shift and add faster than mltiply Compiler generates this code atomatically * k 1 k 5 11
12 19.3 Compter Architectre Spring 1 Compiled Mltiplication Code Power-of- Divide with Shift C Fnction Qotient of by Power of int ml1(int x) { retrn x*1; Compiled Arithmetic Operations leal (%eax,%eax,), %eax sall $, %eax Explanation t <- x+x* retrn t << ; >> k gives / k Uses logical shift Operands: Division: Reslt: / k / k / k k 1. Binary Point C compiler atomatically generates shift/add code when mltiplying by a constant Division Compted Hex Binary x B D x >> D B x >> B x >> B Compiled Division Code Signed Power-of- Divide with Shift C Fnction nsigned div(nsigned x) { retrn x/; Compiled Arithmetic Operations shrl $3, %eax Uses logical shift for nsigned For Java Users Logical shift written as >>> Explanation # Logical shift retrn x >> 3; Qotient of Signed by Power of x >> k gives x / k Uses arithmetic shift Ronds wrong direction when < k x Binary Point Operands: / k 1 Division: Reslt: x / k RondDown(x / k ). Division Compted Hex Binary y C y >> E y >> FC y >> C Correct Power-of- Divide Qotient of Negative Nmber by Power of Want x / k (Rond Toward ) Compte as (x+ k -1)/ k In C: (x + (1<<k)-1) >> k Biases dividend toward Case 1: No ronding Dividend: Divisor: / Biasing has no effect k / k k 1 + k Binary Point Correct Power-of- Divide (Cont.) Case : Ronding Dividend: Divisor: / x k x / k Biasing adds 1 to final reslt k 1 + k Incremented by Incremented by 1 Binary Point
13 19.3 Compter Architectre Spring 1 Compiled Signed Division Code C Fnction int idiv(int x) { retrn x/; Compiled Arithmetic Operations testl %eax, %eax js L L3: sarl $3, %eax ret L: addl $7, %eax jmp L3 Explanation if x < x += 7; # Arithmetic shift retrn x >> 3; Uses arithmetic shift for int For Java Users Arith. shift written as >> Arithmetic: Basic Rles Addition: /signed: Normal addition followed by trncate, same operation on bit level : addition mod w Mathematical addition + possible sbtraction of w Signed: modified addition mod w (reslt in proper range) Mathematical addition + possible addition or sbtraction of w Mltiplication: /signed: Normal mltiplication followed by trncate, same operation on bit level : mltiplication mod w Signed: modified mltiplication mod w (reslt in proper range) 73 7 Arithmetic: Basic Rles Bits, Bytes, and Integers ints, s complement ints are isomorphic rings: isomorphism = casting Left shift /signed: mltiplication by k Always logical shift Right shift : logical shift, div (division + rond to zero) by k Signed: arithmetic shift Positive nmbers: div (division + rond to zero) by k Negative nmbers: div (division + rond away from zero) by k Use biasing to fix Representing information as bits Bit-level maniplations Integers Representation: nsigned and signed Conversion, casting Expanding, trncating Addition, negation, mltiplication, shifting Smmary 75 7 Properties of Arithmetic Mltiplication with Addition Forms Commtative Ring Addition is commtative grop Closed nder mltiplication UMlt w (, v) w 1 Mltiplication Commtative UMlt w (, v) = UMlt w (v, ) Mltiplication is Associative UMlt w (t, UMlt w (, v)) = UMlt w (UMlt w (t, ), v) 1 is mltiplicative identity UMlt w (, 1) = Mltiplication distribtes over addtion UMlt w (t, UAdd w (, v)) = UAdd w (UMlt w (t, ), UMlt w (t, v)) Properties of Two s Comp. Arithmetic Isomorphic Algebras mltiplication and addition Trncating to w bits Two s complement mltiplication and addition Trncating to w bits Both Form Rings Isomorphic to ring of integers mod w Comparison to (Mathematical) Integer Arithmetic Both are rings Integers obey ordering properties, e.g., > + v > v >, v > v > These properties are not obeyed by two s comp. arithmetic TMax + 1 == TMin 1513 * 3 == -13 (1-bit words)
14 19.3 Compter Architectre Spring 1 Why Shold I Use? Don t Use Jst Becase Nmber Nonnegative Easy to make mistakes nsigned i; for (i = cnt-; i >= ; i--) a[i] += a[i+1]; Can be very sbtle #define DELTA sizeof(int) int i; for (i = CNT; i-delta >= ; i-= DELTA)... Do Use When Performing Modlar Arithmetic Mltiprecision arithmetic Do Use When Using Bits to Represent Sets Logical right shift, no sign extension 79 1
Bits, Bytes, and Integers. Bits, Bytes, and Integers. The Decimal System and Bases. Everything is bits. Converting from Decimal to Binary
with contribtions from Dr. Bin Ren, College of William & Mary Addition, negation, mltiplication, shifting 1 Everything is bits The Decimal System and Bases Each bit is or 1 By encoding/interpreting sets
More informationPage # CISC360. Integers Sep 11, Encoding Integers Unsigned. Encoding Example (Cont.) Topics. Twoʼs Complement. Sign Bit
Topics CISC3 Integers Sep 11, 28 Nmeric Encodings Unsigned & Twoʼs complement Programming Implications C promotion rles Basic operations Addition, negation, mltiplication Programming Implications Conseqences
More informationCS140 Lecture 08: Data Representation: Bits and Ints. John Magee 13 February 2017
CS140 Lecture 08: Data Representation: Bits and Ints John Magee 13 February 2017 Material From Computer Systems: A Programmer's Perspective, 3/E (CS:APP3e) Randal E. Bryant and David R. O'Hallaron, Carnegie
More informationLecture 5-6: Bits, Bytes, and Integers
CSCI-UA.0201-003 Computer Systems Organization Lecture 5-6: Bits, Bytes, and Integers Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Slides adapted from: Jinyang Li Bryant and O Hallaron
More informationBits, Bytes, and Integers August 26, 2009
15-213 The Class That Gives CMU Its Zip! Bits, Bytes, and Integers August 26, 2009 Topics Representing information as bits Bit-level manipulations Boolean algebra Expressing in C Representations of Integers
More informationSystems Programming and Computer Architecture ( )
Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 1 3: Integers in C Computer Architecture and Systems
More informationComputer Systems CEN591(502) Fall 2011
Computer Systems CEN591(502) Fall 2011 Sandeep K. S. Gupta Arizona State University 4 th lecture Data representation in computer systems (Slides adapted from CSAPP book) Announcements Programming assignment
More informationC Puzzles! Taken from old exams. Integers Sep 3, Encoding Integers Unsigned. Encoding Example (Cont.) The course that gives CMU its Zip!
15-13 The corse that gies CMU its Zip! Topics class3.ppt Integers Sep 3,! Nmeric Encodings " Unsigned & Two s complement! Programming Implications " C promotion rles! Basic operations " Addition, negation,
More informationBits, Bytes, and Integers
Bits, Bytes, and Integers with contributions from Dr. Bin Ren, College of William & Mary 1 Bits, Bytes, and Integers Representing information as bits Bit-level manipulations Integers Representation: unsigned
More informationToday: Bits, Bytes, and Integers. Bits, Bytes, and Integers. For example, can count in binary. Everything is bits. Encoding Byte Values
Today: Bits, Bytes, and Integers Representing information as bits Bits, Bytes, and Integers CSci : Machine Architectre and Organization September th-9th, Yor instrctor: Stephen McCamant Bit-level maniplations
More informationBits, Bytes, and Integers. Data Representa+on: Base- 2 number representa+on. Binary Representa+ons. Encoding Byte Values. Example Data Representa+ons
Bits, Bytes, and Data Representa+on: Bits, Bytes, and CSci 1 - Machine Architectre and Organiza+on Professor Pen- Chng Yew Bit- level manipla+ons Representa9on: nsigned and signed Expanding, trnca9ng Addi9on,
More informationBits, Bytes, and Integers Part 2
Bits, Bytes, and Integers Part 2 15-213: Introduction to Computer Systems 3 rd Lecture, Jan. 23, 2018 Instructors: Franz Franchetti, Seth Copen Goldstein, Brian Railing 1 First Assignment: Data Lab Due:
More informationPage 1 CISC360. Encoding Integers Unsigned. Integers Sep 8, Numeric Ranges. Encoding Example (Cont.)
CISC3 Integers Sep, 9 Encoding Integers Unsigned w 1 BU(X) = x i i i= short int x = 1513; short int y = -1513; Twoʼs Complement w BT(X) = x w 1 w 1 + x i i i= Sign Bit Decimal Hex Binary x 1513 3B D 11111
More informationICS Instructor: Aleksandar Kuzmanovic TA: Ionut Trestian Recitation 2
ICS 2008 Instructor: Aleksandar Kuzmanovic TA: Ionut Trestian Recitation 2 Data Representations Sizes of C Objects (in Bytes) C Data Type Compaq Alpha Typical 32-bit Intel IA32 int 4 4 4 long int 8 4 4
More informationIntegers. Dr. Steve Goddard Giving credit where credit is due
CSCE 23J Computer Organization Integers Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce23j Giving credit where credit is due Most of slides for this lecture are based on
More informationIntegers Sep 3, 2002
15-213 The course that gives CMU its Zip! Topics Numeric Encodings Unsigned & Two s complement Programming Implications C promotion rules Basic operations Integers Sep 3, 2002 Addition, negation, multiplication
More informationRepresenta7on of integers: unsigned and signed Conversion, cas7ng Expanding, trunca7ng Addi7on, nega7on, mul7plica7on, shiaing
Today s Topics Representa7on of integers: unsigned and signed Conversion, cas7ng Expanding, trunca7ng Addi7on, nega7on, mul7plica7on, shiaing CSE351 Inaugural Edi7on Spring 2010 1 Encoding Integers C short
More informationSystems 1. Integers. Unsigned & Twoʼs complement. Addition, negation, multiplication
Systems 1 Integers Topics Numeric Encodings Unsigned & Twoʼs complement Programming Implications C promotion rules Basic operations Addition, negation, multiplication Programming Implications Consequences
More informationBits and Bytes. Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions
Bits and Bytes Topics Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions Bit-level manipulations Boolean algebra Expressing
More informationCarnegie Mellon. Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition
Carnegie Mellon 1 Bits, Bytes and Integers Part 1 15-213/18-213/15-513: Introduction to Computer Systems 2 nd Lecture, Aug. 31, 2017 Today s Instructor: Randy Bryant 2 Announcements Recitations are on
More informationC Puzzles The course that gives CMU its Zip! Integer Arithmetic Operations Jan. 25, Unsigned Addition. Visualizing Integer Addition
1513 The corse that gies CMU its Zip! Integer Arithmetic Operations Jan. 5, 1 Topics Basic operations Addition, negation, mltiplication Programming Implications Conseqences of oerflow Using shifts to perform
More informationRepresenting and Manipulating Integers. Jo, Heeseung
Representing and Manipulating Integers Jo, Heeseung Unsigned Integers Encoding unsigned integers B [ bw 1, bw 2,..., b0 ] x = 0000 0111 1101 0011 2 D( B) w 1 b i i 0 2 i D(x) = 2 10 + 2 9 + 2 8 + 2 7 +
More informationBits and Bytes: Data Presentation Mohamed Zahran (aka Z)
CSCI-UA.0201 Computer Systems Organization Bits and Bytes: Data Presentation Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted and modified from: Clark Barrett Jinyang
More informationIntegers. Today. Next time. ! Numeric Encodings! Programming Implications! Basic operations. ! Floats
Integers Today! Numeric Encodings! Programming Implications! Basic operations! Programming Implications Next time! Floats Fabián E. Bustamante, 2007 Integers in C! C supports several integral data types
More informationComputer Organization: A Programmer's Perspective
A Programmer's Perspective Bits, Bytes, Nibbles, Words and Strings Gal A. Kaminka galk@cs.biu.ac.il Topics Why bits? Why 0/1? Basic terms: Bits, Bytes, Nibbles, Words Representing information as bits Characters
More informationBits and Bytes January 13, 2005
15-213 The Class That Gives CMU Its Zip! Topics Bits and Bytes January 13, 25 Why bits? Representing information as bits Binary / Hexadecimal Byte representations» Numbers» Characters and strings» Instructions
More informationBits, Bytes and Integers Part 1
Bits, Bytes and Integers Part 1 15-213/18-213/15-513: Introduction to Computer Systems 2 nd Lecture, Jan. 18, 2018 Instructors: Franz Franchetti Seth Copen Goldstein Brian Railing 1 Announcements Waitlist
More informationTopics of this Slideset. CS429: Computer Organization and Architecture. Encoding Integers: Unsigned. C Puzzles. Integers
Topics of this Slideset CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Science University of Texas at Austin Last updated: July 5, 2018 at 11:55 Numeric Encodings:
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Science University of Texas at Austin Last updated: July 5, 2018 at 11:55 CS429 Slideset 3: 1 Topics of this Slideset
More informationWhy Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation
Lecture 2 Bits and Bytes Topics Why bits? Representing information as bits Binary/Hexadecimal Byte representations» numbers» characters and strings» Instructions Bit-level manipulations Boolean algebra
More informationWhy Don t Computers Use Base 10? Lecture 2 Bits and Bytes. Binary Representations. Byte-Oriented Memory Organization. Base 10 Number Representation
Lecture 2 Bits and Bytes Topics! Why bits?! Representing information as bits " Binary/Hexadecimal " Byte representations» numbers» characters and strings» Instructions! Bit-level manipulations " Boolean
More informationCS 270: Computer Organization. Integer Arithmetic Operations
CS 270: Computer Organization Integer Arithmetic Operations Instructor: Professor Stephen P. Carl Unsigned Addition Operands: w bits True Sum: w+1 bits u + v u + v Discard Carry UAdd w (u, v) Standard
More informationInteger Arithmetic. CS 347 Lecture 03. January 20, 1998
Integer Arithmetic CS 347 Lecture 03 January 20, 1998 Topics Numeric Encodings Unsigned & Two s complement Programming Implications C promotion rules Consequences of overflow Basic operations Addition,
More informationBits, Bytes and Integers
Bits, Bytes and Integers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran
More informationManipulating Integers
Manipulating Integers Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)
More informationCsci 2021 Class Web Pages. Data Representa?on: Bits, Bytes, and Integers. Binary Representa?ons. Bits, Bytes, and Integers
Csci 1 Class Web Pages Departmental Class Web Page: Pblic access withot login Corse syllabs, schedle, lectre notes, other sefl info h7p://www- sers.cselabs.mn.ed/classes/spring- 1/csci1/ Yo shold read
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 2400: Computer Architecture ECE 3217: Computer Architecture and Organization Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides
More informationCS 33. Data Representation, Part 2. CS33 Intro to Computer Systems VIII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation, Part 2 CS33 Intro to Computer Systems VIII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Numeric Ranges Unsigned Values UMin = 0 000 0 UMax = 2 w 1 111 1 Two s Complement
More informationPage 1. Where Have We Been? Chapter 2 Representing and Manipulating Information. Why Don t Computers Use Base 10?
Where Have We Been? Class Introduction Great Realities of Computing Int s are not Integers, Float s are not Reals You must know assembly Memory Matters Performance! Asymptotic Complexity It s more than
More informationFoundations of Computer Systems
18-600 Foundations of Computer Systems Lecture 3: Bits, Bytes, and Integers September 6, 2017 Required Reading Assignment: Chapter 2 of CS:APP (3 rd edition) by Randy Bryant & Dave O Hallaron Assignments
More informationJin-Soo Kim Systems Software & Architecture Lab. Seoul National University. Integers. Spring 2019
Jin-Soo Kim (jinsoo.kim@snu.ac.kr) Systems Software & Architecture Lab. Seoul National University Integers Spring 2019 4190.308: Computer Architecture Spring 2019 Jin-Soo Kim (jinsoo.kim@snu.ac.kr) 2 A
More informationBITS, BYTES, AND INTEGERS
BITS, BYTES, AND INTEGERS CS 045 Computer Organization and Architecture Prof. Donald J. Patterson Adapted from Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition ORIGINS
More informationArithmetic and Bitwise Operations on Binary Data
Arithmetic and Bitwise Operations on Binary Data CSCI 224 / ECE 317: Computer Architecture Instructor: Prof. Jason Fritts Slides adapted from Bryant & O Hallaron s slides 1 Boolean Algebra Developed by
More informationBits, Bytes, and Integers
Bits, Bytes, and Integers CENG331 - Computer Organization Instructors: Murat Manguoglu (Section 1) Adapted from slides of the textbook: http://csapp.cs.cmu.edu/ Hello World! What happens under the hood?
More informationCS 33. Data Representation, Part 2. CS33 Intro to Computer Systems VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation, Part 2 CS33 Intro to Computer Systems VII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Signed Integers Two s complement b w-1 = 0 Þ non-negative number value = b
More informationBits, Bytes, and Integers
Bits, Bytes, and Integers B&O Readings: 2.1-2.3 CSE 361: Introduc=on to Systems So@ware Instructor: I- Ting Angelina Le e Note: these slides were originally created by Markus Püschel at Carnegie Mellon
More informationByte Ordering. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Byte Ordering Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Memory Model Physical memory DRAM chips can read/write 4, 8, 16 bits DRAM modules
More informationByte Ordering. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University
Byte Ordering Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)
More informationHardware: Logical View
Hardware: Logical View CPU Memory Bus Disks Net USB Etc. 1 Hardware: Physical View USB I/O controller Storage connections CPU Memory 2 Hardware: 351 View (version 0) instructions? Memory CPU data CPU executes
More informationInteger Encoding and Manipulation
CSE 2421: Systems I Low-Level Programming and Computer Organization Integer Encoding and Manipulation Presentation D Study: Bryant Chapter 2.1 2.3 Gojko Babić 01-24-2018 Unsigned & Signed Integer Encoding
More informationCS429: Computer Organization and Architecture
CS429: Computer Organization and Architecture Dr. Bill Young Department of Computer Sciences University of Texas at Austin Last updated: September 11, 2017 at 08:58 CS429 Slideset 2: 1 Topics of this Slideset
More informationTopics of this Slideset. CS429: Computer Organization and Architecture. It s Bits All the Way Down. Why Binary? Why Not Decimal?
Topics of this Slideset CS429: Computer Organization and Architecture There are 10 kinds of people in the world: those who understand binary, and those who don t! Dr. Bill Young Department of Computer
More informationRepresenting and Manipulating Integers Part I
Representing and Manipulating Integers Part I Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Introduction The advent of the digital age Analog
More informationRepresenting Integers. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Representing Integers Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Unsigned Integers Encoding unsigned integers B [ bw 1, bw2,..., b0 ] x = 0000
More informationBut first, encode deck of cards. Integer Representation. Two possible representations. Two better representations WELLESLEY CS 240 9/8/15
Integer Representation Representation of integers: unsigned and signed Sign extension Arithmetic and shifting Casting But first, encode deck of cards. cards in suits How do we encode suits, face cards?
More informationRepresenting Integers
Representing Integers Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu SSE2030: Introduction to Computer Systems, Spring 2018, Jinkyu Jeong (jinkyu@skku.edu)
More informationCS 33. Data Representation, Part 1. CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation, Part 1 CS33 Intro to Computer Systems VII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved. Number Representation Hindu-Arabic numerals developed by Hindus starting in
More informationCSCI2467: Systems Programming Concepts
CSCI2467: Systems Programming Concepts Slideset 2: Information as Data (CS:APP Chap. 2) Instructor: M. Toups Spring 2018 Course updates datalab out today! - due after Mardi gras... - do not wait until
More informationCAPL Scripting Quickstart
CAPL Scripting Qickstart CAPL (Commnication Access Programming Langage) For CANalyzer and CANoe V1.01 2015-12-03 Agenda Important information before getting started 3 Visal Seqencer (GUI based programming
More informationIntegers II. CSE 351 Autumn Instructor: Justin Hsia
Integers II CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun http://xkcd.com/571/
More informationIntegers II. CSE 351 Autumn Instructor: Justin Hsia
Integers II CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/557/
More informationSystems Programming and Computer Architecture ( )
(252-0061-00) Timothy Roscoe Herbstsemester 2013 Systems Group Department of Computer Science ETH Zürich 1 1: Introduction 252-0061-00, Herbstsemester 2013 Timothy Roscoe 2 This course covers in depth
More informationComputer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2
Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2 Instructor: Rob Bergen Applied Computer Science University of Winnipeg Announcements Website is up
More informationBitwise Data Manipulation. Bitwise operations More on integers
Bitwise Data Manipulation Bitwise operations More on integers bitwise operators ex Bitwise operators on fixed-width bit vectors. AND & OR XOR ^ NOT ~ 01101001 & 01010101 01000001 01101001 01010101 01101001
More informationMemory, Data, & Addressing II CSE 351 Spring
Memory, Data, & Addressing II CSE 351 Spring 2018 http://xkcd.com/138/ Review Questions 1) If the word size of a machine is 64-bits, which of the following is usually true? (pick all that apply) a) 64
More informationIntegers II. CSE 351 Autumn 2018
Integers II CSE 351 Autumn 2018 Instructor: Teaching Assistants: Justin Hsia Akshat Aggarwal An Wang Andrew Hu Brian Dai Britt Henderson James Shin Kevin Bi Kory Watson Riley Germundson Sophie Tian Teagan
More informationCSE351: Memory, Data, & Addressing I
CSE351: Memory, Data, & Addressing I CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis http://xkcd.com/138/
More information2.1. Unit 2. Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting)
2.1 Unit 2 Integer Operations (Arithmetic, Overflow, Bitwise Logic, Shifting) 2.2 Skills & Outcomes You should know and be able to apply the following skills with confidence Perform addition & subtraction
More informationData III & Integers I
Data III & Integers I CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Everyone has VM
More informationReview. How to represent real numbers
PCWrite PC IorD Review ALUSrcA emread Address Write data emory emwrite em Data IRWrite [3-26] [25-2] [2-6] [5-] [5-] RegDst Read register Read register 2 Write register Write data RegWrite Read data Read
More informationPOWER-OF-2 BOUNDARIES
Warren.3.fm Page 5 Monday, Jne 17, 5:6 PM CHAPTER 3 POWER-OF- BOUNDARIES 3 1 Ronding Up/Down to a Mltiple of a Known Power of Ronding an nsigned integer down to, for eample, the net smaller mltiple of
More informationCS367 Test 1 Review Guide
CS367 Test 1 Review Guide This guide tries to revisit what topics we've covered, and also to briefly suggest/hint at types of questions that might show up on the test. Anything on slides, assigned reading,
More informationSimple Data Types in C. Alan L. Cox
Simple Data Types in C Alan L. Cox alc@rice.edu Objectives Be able to explain to others what a data type is Be able to use basic data types in C programs Be able to see the inaccuracies and limitations
More informationSystems Programming and Computer Architecture ( )
Systems Group Department of Computer Science ETH Zürich Systems Programming and Computer Architecture (252-0061-00) Timothy Roscoe Herbstsemester 2016 1 1: Introduction Systems Programming and Computer
More informationCS 153 Design of Operating Systems
CS 153 Design of Operating Systems Spring 18 Lectre 3: OS model and Architectral Spport Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Last time/today
More informationReview. A single-cycle MIPS processor
Review If three instrctions have opcodes, 7 and 5 are they all of the same type? If we were to add an instrction to IPS of the form OD $t, $t2, $t3, which performs $t = $t2 OD $t3, what wold be its opcode?
More informationREMEMBER TO REGISTER FOR THE EXAM.
REMEMBER TO REGISTER FOR THE EXAM http://tenta.angstrom.uu.se/tenta/ Floating point representation How are numbers actually stored? Some performance consequences and tricks Encoding Byte Values Byte =
More informationIntroduction to C. Why C? Difference between Python and C C compiler stages Basic syntax in C
Final Review CS304 Introduction to C Why C? Difference between Python and C C compiler stages Basic syntax in C Pointers What is a pointer? declaration, &, dereference... Pointer & dynamic memory allocation
More informationData III & Integers I
Data III & Integers I CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun
More informationCS 153 Design of Operating Systems
CS 53 Design of Operating Systems Spring 8 Lectre 6: Paging Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals by Dave
More informationBasic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators. JAVA Standard Edition
Basic operators, Arithmetic, Relational, Bitwise, Logical, Assignment, Conditional operators JAVA Standard Edition Java - Basic Operators Java provides a rich set of operators to manipulate variables.
More informationCOMP2611: Computer Organization. Data Representation
COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How
More informationSIGNED AND UNSIGNED SYSTEMS
EE 357 Unit 1 Fixed Point Systems and Arithmetic Learning Objectives Understand the size and systems used by the underlying HW when a variable is declared in a SW program Understand and be able to find
More informationArithmetic Operators. Portability: Printing Numbers
Arithmetic Operators Normal binary arithmetic operators: + - * / Modulus or remainder operator: % x%y is the remainder when x is divided by y well defined only when x > 0 and y > 0 Unary operators: - +
More informationInteger Representation
Integer Representation Representation of integers: unsigned and signed Modular arithmetic and overflow Sign extension Shifting and arithmetic Multiplication Casting 1 Fixed- width integer encodings Unsigned
More informationPutting the dynamic into software security testing
Ptting the dynamic into software secrity testing Detecting and Addressing Cybersecrity Isses V1.1 2018-03-05 Code ahead! 2 Atomated vlnerability detection and triage + = 3 How did we get here? Vector was
More informationCSE 351 Midterm - Winter 2015 Solutions
CSE 351 Midterm - Winter 2015 Solutions February 09, 2015 Please read through the entire examination first! We designed this exam so that it can be completed in 50 minutes and, hopefully, this estimate
More informationCSE 351 Midterm - Winter 2017
CSE 351 Midterm - Winter 2017 February 08, 2017 Please read through the entire examination first, and make sure you write your name and NetID on all pages! We designed this exam so that it can be completed
More informationCOMP2121: Microprocessors and Interfacing. Number Systems
COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting
More informationCS , Fall 2001 Exam 1
Andrew login ID: Full Name: CS 15-213, Fall 2001 Exam 1 October 9, 2001 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the front. Write
More informationThe course that gives CMU its Zip! Floating Point Arithmetic Feb 17, 2000
15-213 The course that gives CMU its Zip! Floating Point Arithmetic Feb 17, 2000 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IA32 floating point Floating
More informationEXAMINATIONS 2003 END-YEAR COMP 203. Computer Organisation
EXAINATIONS 2003 COP203 END-YEAR Compter Organisation Time Allowed: 3 Hors (180 mintes) Instrctions: Answer all qestions. There are 180 possible marks on the eam. Calclators and foreign langage dictionaries
More informationOutline. x86 Architecture
Data Representation Code Representation Summary Data Representation Code Representation Summary Code Representation Summary Outline CS 6V81-05: System Security and Malicious Code Analysis 1 2 Data Representation
More informationComputer System and programming in C
1 Basic Data Types Integral Types Integers are stored in various sizes. They can be signed or unsigned. Example Suppose an integer is represented by a byte (8 bits). Leftmost bit is sign bit. If the sign
More informationCourse overview. Computer Organization and Assembly Languages Yung-Yu Chuang 2006/09/18. with slides by Kip Irvine
Course overview Computer Organization and Assembly Languages Yung-Yu Chuang 2006/09/18 with slides by Kip Irvine Logistics Meeting time: 9:10am-12:10pm, Monday Classroom: CSIE Room 102 Instructor: Yung-Yu
More informationCS 153 Design of Operating Systems Spring 18
CS 153 Design of Operating Systems Spring 18 Lectre 2: Historical Perspective Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Last time What is an OS?
More informationThe extra single-cycle adders
lticycle Datapath As an added bons, we can eliminate some of the etra hardware from the single-cycle path. We will restrict orselves to sing each fnctional nit once per cycle, jst like before. Bt since
More informationThe Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and
The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y
More informationThe Arithmetic Operators
The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Examples: Op. Use Description + x + y adds x
More informationCS 153 Design of Operating Systems Spring 18
CS 153 Design of Operating Systems Spring 18 Lectre 9: Synchronization (1) Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Cooperation between Threads
More information