Survey. Motivation 29.5 / 40 class is required
|
|
- Georgiana Norris
- 5 years ago
- Views:
Transcription
1 Survey Motivation 29.5 / 40 class is required Concerns 6 / 40 not good at examination That s why we have 3 examinations 6 / 40 this class sounds difficult 8 / 40 understand the instructor Want class to be 27 / 40 challenging 8 / 40 easy
2 overview bit, byte and int float point [C] basics, bitwise operator, control flow [C] scopes rules, pointers, arrays [C] structs, mallocs [C] large program (linked list) Machine Prog: ISA, Compile, movq Machine Prog: Control Code (condition, jump instruction) Machine Prog: Array allocation and access Machine Prog: Procedure calls Machine Prog: Structure, Memory Layout Machine Prog: Buffer Overflow Code optimizations Virtual memory: Address Spaces/ Translation, Goal Virtual memory: Page table/physcial to virtual Process Dynamic Memory Allocation I: malloc, free Dynamic Memory Allocation II: design allocator Dynamic Memory Allocation III: futher optimization Concurrent Programming I: thread, race Concurrent Programming II: lock Concurrent Programming III: conditional variable Concurrent Programming IV: Other primitives Basic (Easy) Advanced (Hard)
3 Bits, Bytes, Ints, Word Zhaoguo Wang
4 Bit 0 /
5 The world has moved away from analog signal to Analog signals: smooth and continuous Problems. Difficult to design 2. Susceptible to noise Analog components: resistors, capacitors, inductors, diodes, e.t.c
6 to digital Digital signals: discrete (encode sequence of 0s and s) Advantages Digital components: transistors, logic gates. Easier to design Simple Integrate millions on a single chip 2. Reliable Robust to noise
7 Using bits to represent everything A bit is too small to be much used In English, there are 26 characters and plenty words in the vocabulary Using bits instead of bit Group bits together Apply some interpretation to the different possible bit patterns Represent elements of any limit set
8 Represent nonnegative integer bits: b n- b n-2 b 2 b b 0 b i : bit b in i-th position (from right to left) 0 <= i < n b * 2 i (b is 0 or ) Bits 000 Value 0*2 4 +*2 3 +0*2 2 +*2 +0*2 0 = 0 Bits 000 Value?
9 Represent nonnegative integer bits: b n- b n-2 b 2 b b 0 b i : bit b in i-th position (from right to left) 0 <= i < n b * 2 i (b is 0 or ) Bits 000 Value 0*2 4 +*2 3 +0*2 2 +*2 +0*2 0 = 0 Bits 000 Value 28
10 Most significant bit (MSB) The bit position has the greatest value Bits 000 MSB? Bits 000 MSB?
11 Most significant bit (MSB) The bit position has the greatest value The leftmost bit Bits 000 MSB 0 Bits 000 MSB
12 Least significant bit (LSB) The bit position has the least value The rightmost bit Bits 000 MSB 0 Bits 000 MSB 0
13 Your Mental Model CPU Arithmetic Logic Unit Memory Memory is a continuous array. Each unit of the array has one bit.
14 Your Mental Model * 2 7 CPU Arithmetic Logic Unit Memory
15 Your Mental Model * * 2 6 CPU Arithmetic Logic Unit Memory
16 Your Mental Model CPU Arithmetic Logic Unit * * * 2 5 Memory
17 Your Mental Model CPU Arithmetic Logic Unit * * * * 2 4 Memory
18 Your Mental Model CPU Arithmetic Logic Unit * * * * * 2 3 Memory
19 Your Mental Model CPU Arithmetic Logic Unit * * * * * * 2 2 Memory
20 Your Mental Model CPU Arithmetic Logic Unit * * * * * * * 2 Memory
21 Your Mental Model CPU Arithmetic Logic Unit * * * * * * * Memory
22 Your Mental Model Memory CPU Arithmetic Logic Unit * * * * * * * Low efficiency
23 Byte Each memory unit has multiple bits Dr. Werner Buchholz in July 956 Byte sizes from bit to 48 bits have been used in the history
24 Byte Each memory unit has multiple bits Dr. Werner Buchholz in July 956 Byte sizes from bit to 48 bits have been used in the history CPU Arithmetic Logic Unit Memory is a continuous array. Each unit is a byte. Memory
25 Byte 8 bits chunk IBM System/360, 964 Introduce Intel 8080, 974 Modern processors Widely adopted Standard
26 Your current mental model Bits addresses addr addr 2 addr 3 addr Memory addr 000 Each byte has 8 bits CPU Arithmetic Logic Unit
27 Your current mental model Bits addresses addresses addr 4 addr 3 addr 2 addr Memory addr 000 Each byte has 8 bits CPU Arithmetic Logic Unit
28 Range of Single Byte Maximum Minimum
29 Range of Single Byte Maximum 2 à 255 Minimum
30 Range of Single Byte Maximum 2 à 255 Minimum à 0
31 Bit pattern description intuitive way Binary notation Bits bytes
32 Bit pattern description intuitive way Binary notation Too verbose Bits bytes 5 cm on my laptop
33 Bit pattern description strawman Decimal Notation 3 decimal digits to represent one byte Bits Decimal
34 Bit pattern description strawman Decimal Notation 3 decimal digits to represent one byte Bits Decimal too tedious to do the conversion
35 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers
36 Hexadecimal Notation Byte / 8 bits Binary: to 2 Decimal: 0 0 to Hex: 00 6 to FF A 0 00 B 0 C 2 00 D 3 0 E 4 0 F 5
37 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex Hex(C) 00 =
38 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A Hex(C) 00 = * * * = 0 = A 6
39 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A Hex(C) 0 =
40 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E Hex(C) 0 = * * * = 4 = E 6
41 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E Hex(C) 00 =
42 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C Hex(C) 00 = * * * = 2 = C 6
43 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C Hex(C) 00 =
44 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C A Hex(C) 00 = * * * = 0 = A 6
45 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C A 0 Hex(C) 0000 = 0 * * * = 0 = 0 6
46 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C A 0 E Hex(C) 0 = * * * = 4 = E 6
47 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C A 0 E Hex(C) 000 = 0 * * * 2 + = = 6
48 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C A 0 E A Hex(C) 00 = * * * = 0 = A 6
49 Hexadecimal Notation Write bit patterns as base-6 (hex) numbers 0-9 and a-f (0-5) Each number can represent a 4 bits chunk Each byte is represented with 2 hex numbers ( FF 6 ) Bits Decimal Hex A E C A 0 E A Hex(C) 0xAECA0EA
50 Exercises Time Hexadecimal Decimal Binary 0xBC 0xF
51 Answers Hexadecimal Decimal Binary 0xA7 0*6 + 7 = x3E 3*6 + 4 = xBC *6 + 2 = x37 3*6+7= xF3 5*6+3=243 00
52 Unsigned addition + 0 0xB + 0xA
53 Unsigned addition + 0 0xB + 0xA
54 Unsigned addition + 0 0xB + 0xA
55 Unsigned addition + 0 0xB + 0xA
56 Unsigned addition + 0 0xB + 0xA
57 Unsigned addition + 0 0xB + 0xA
58 Unsigned addition + 0 0xB + 0xA
59 Unsigned subtraction - 0 0xB - 0xA
60 Unsigned subtraction - 0 0xB - 0xA
61 Unsigned subtraction 0-0xA 0xB ???
62 Question N: How to represent negative numbers?
63 Strawman Most significant bit (MSB) represent the sign
64 Strawman Most significant bit (MSB) represent the sign
65 Strawman Most significant bit (MSB) represent the sign ???
66 Two s complement Byte 0000 Unsigned number * * * * * * * * 2 0
67 Two s complement Byte 0000 Unsigned number * * * * * * * * 2 0 Signed number - * * * * * * * * 2 0
68 Two s complement b! = [ b w, b w,..., b ] 0 val! b w i=0 ( ) = b w 2 w + b i 2 i MSB: val( b w ) = -b w * 2w Other: val ( b i ) = b i * 2i, 0 <= i < w
69 Two s complement b! = [ b w, b w,..., b ] 0 val! b w i=0 ( ) = b w 2 w + b i 2 i Binary Value
70 Two s complement b! = [ b w, b w,..., b ] 0 val! b w i=0 ( ) = b w 2 w + b i 2 i Binary Value *
71 Two s complement b! = [ b w, b w,..., b ] 0 val! b w i=0 ( ) = b w 2 w + b i 2 i Binary Value * *
72 Two s complement b! = [ b w, b w,..., b ] 0 val! b w i=0 ( ) = b w 2 w + b i 2 i Binary Value * *
73 Two s complement b! = [ b w, b w,..., b ] 0 val! b w i=0 ( ) = b w 2 w + b i 2 i
74 Two s complement b! = [ b w, b w,..., b ] 0 val! b w i=0 ( ) = b w 2 w + b i 2 i * *
75 Find 2 s complement quickly With a negative number, how to give its binary representation? e.g. -40
76 Find 2 s complement quickly With a negative number, how to give its binary representation? e.g. -40 Step. represent 40 in binary
77 Find 2 s complement quickly With a negative number, how to give its binary representation? e.g. -40 Step 2. flip all bits
78 Find 2 s complement quickly With a negative number, how to give its binary representation? e.g. -40 Step 3. add
79 Find 2 s complement quickly With a negative number, how to give its binary representation? e.g. -40 Step 3. add
80 Find 2 s complement quickly With a negative number, how to give its binary representation? e.g. -40 Step 3. add
81 Exercise Time II Hexadecimal Decimal Binary 0xce
82 Answers Hexadecimal Decimal Binary 0xce x9c x7f x xa
83 Ranges Range Min Max byte unsigned [0, 2 8 ] byte signed
84 Ranges Range Min Max byte unsigned [0, 2 8 ] byte signed [-2 7, 2 7 ] Min: Max: 0
85 Overflow Range Min Max byte unsigned [0, 2 8 ] byte signed [-2 7, 2 7 ]
86 Overflow ??? Range Min Max byte unsigned [0, 2 8 ] byte signed [-2 7, 2 7 ]
87 Intel xb0 0xa9 0xa8 0xa7 0xa6 0xa5 0xa4 0xa3 0xa2 0xa 0x0f 0xaf 0xe 0x4c 0xea 0xcb 0xba 0x00 0xff 0x8c 0x4c CPU Arithmetic Logic Unit registers 0x4c Memory
88 Intel xb0 0xa9 0xa8 0xa7 0xa6 0xa5 0xa4 0xa3 0xa2 0xa 0x0f 0xaf 0xe 0x4c 0xea 0xcb 0xba 0x00 0xff 0x8c Memory 0x4c CPU Arithmetic Logic Unit registers 0x4c 8 bits machine 8 bits length of Memory processor transfer CPU Register Memory Address Instruction
89 Intel 386 0x000000b0 0x000000a9 0x000000a8 0x000000a7 0x000000a6 0x000000a5 0x000000a4 0x000000a3 0x000000a2 0x000000a 0x0f 0xaf 0xe 0x4c 0xea 0xcb 0xba 0x00 0xff 0x8c Memory 0x4ceaf0f CPU Arithmetic Logic Unit registers 0x4ceaf0f 32 bits machine 32 bits length of Memory processor transfer CPU Register Memory Address Instruction
90 Intel Opteron à i7 0x00 00b0 0x00 00a9 0x00 00a8 0x00 00a7 0x00 00a6 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x0f 0xaf 0xe 0x4c 0xea 0xcb 0xba 0x00 0xff 0x8c Memory 0x00bacbea4ceaf0f CPU Arithmetic Logic Unit registers 0x00bacbea4ceaf0f 64 bits machine 64 bits length of Memory processor transfer CPU Register Memory Address Instruction
91 Intel Opteron à i7 0x00 00b0 0x00 00a9 0x00 00a8 0x00 00a7 0x00 00a6 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x0f 0xaf 0xe 0x4c 0xea 0xcb 0xba 0x00 0xff 0x8c Memory 0x00bacbea4ceaf0f CPU Arithmetic Logic Unit registers 0x00bacbea4ceaf0f Word Memory processor transfer CPU Register Memory Address Instruction
92 Word Definition Fixed size of data handled as a unit by the instruction set or processor Length 8 for 8 bits machine 32 for 32 bits machine 64 for 64 bits machine
93 Integral data types on 64 bits machine Length Min Max [signed] char byte unsigned char byte short 2 bytes unsigned short 2 bytes int 4 bytes unsigned int 4 bytes long 8 bytes unsigned long 8 bytes
94 Integral data types on 64 bits machine Length Min Max [signed] char byte unsigned char byte short 2 bytes unsigned short 2 bytes int 4 bytes unsigned int 4 bytes long 8 bytes unsigned long 8 bytes
95 Integral data types on 64 bits machine Length Min Max [signed] char byte unsigned char byte short 2 bytes unsigned short 2 bytes int 4 bytes unsigned int 4 bytes long 8 bytes unsigned long 8 bytes
96 Integral data types on 64 bits machine Length Min Max [signed] char byte unsigned char byte short 2 bytes unsigned short 2 bytes int 4 bytes unsigned int 4 bytes long 8 bytes unsigned long 8 bytes
97 Memory layout 0x00 00b0 0x00 00a9 0x00 00a8 CPU Arithmetic Logic Unit 0x00 00a7 0x00 00a6 registers 0x00 00a5 0x00 00a4 0x00 00a3 int a = 0x x00 00a2 0x00 00a int a address: 0x00 00a2 Memory
98 Memory layout Intuition 0x00 00b0 0x00 00a9 0x00 00a8 CPU Arithmetic Logic Unit 0x00 00a7 0x00 00a6 registers 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x78 0x56 0x34 0x2 int a int a = 0x address: 0x00 00a2 Memory
99 Memory layout Little Endian 0x00 00b0 0x00 00a9 0x00 00a8 CPU Arithmetic Logic Unit 0x00 00a7 0x00 00a6 registers 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x2 0x34 0x56 0x78 Memory int a int a = 0x address: 0x00 00a2 Least significant byte in smallest address, e.g, laptops, and server machines
100 Advantages of Little Endian + 0x x2345 Processor performs the calculation from the least significant bit Processor can simultaneously perform memory transfer and calculation.
101 Advantages of Little Endian 0x00 00b0 0x00 00a9 0x00 00a8 0x00 00a7 0x00 00a6 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a Memory CPU Arithmetic Logic Unit registers long a = 0x abcdef address: 0x00 00a2 long a
102 Advantages of Little Endian 0x00 00b0 0x00 00a9 0x00 00a8 0x00 00a7 0x00 00a6 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x00 0x00 0x00 0x00 0x90 0xab 0xcd 0xef Memory CPU Arithmetic Logic Unit registers long a = 0x abcdef address: 0x00 00a2 long a
103 Advantages of Little Endian 0x00 00b0 0x00 00a9 0x00 00a8 0x00 00a7 0x00 00a6 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x00 0x00 0x00 0x00 0x90 0xab 0xcd 0xef Memory CPU Arithmetic Logic Unit registers long a = 0x abcdef address: 0x00 00a2 long a int b = (int)a Directly get the data from 0x00 00a2
104 Memory layout Intuition 0x00 00b0 0x00 00a9 0x00 00a8 CPU Arithmetic Logic Unit 0x00 00a7 0x00 00a6 registers 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x78 0x56 0x34 0x2 int a int a = 0x address: 0x00 00a2 Is this wrong? Memory
105 Memory layout Intuition 0x00 00b0 0x00 00a9 0x00 00a8 CPU Arithmetic Logic Unit 0x00 00a7 0x00 00a6 registers 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x78 0x56 0x34 0x2 int a int a = 0x address: 0x00 00a2 Is this wrong? Memory
106 Memory layout Big Endian 0x00 00b0 0x00 00a9 0x00 00a8 0x00 00a7 0x00 00a6 0x00 00a5 0x00 00a4 0x00 00a3 0x00 00a2 0x00 00a 0x78 0x56 0x34 0x2 Memory int a CPU Arithmetic Logic Unit registers int a = 0x address: 0x00 00a2 Most significant byte in smallest address, e.g, ARM architecture >v3 (cellphones, ipads)
107 Advantages of Big Endian. Easy to read 2. Test whether the number is positive or negative by looking at the byte at offset zero.
Representation of Information
Representation of Information CS61, Lecture 2 Prof. Stephen Chong September 6, 2011 Announcements Assignment 1 released Posted on http://cs61.seas.harvard.edu/ Due one week from today, Tuesday 13 Sept
More informationM1 Computers and Data
M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed
More informationDecimal & Binary Representation Systems. Decimal & Binary Representation Systems
Decimal & Binary Representation Systems Decimal & binary are positional representation systems each position has a value: d*base i for example: 321 10 = 3*10 2 + 2*10 1 + 1*10 0 for example: 101000001
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 informationData Storage. August 9, Indiana University. Geoffrey Brown, Bryce Himebaugh 2015 August 9, / 19
Data Storage Geoffrey Brown Bryce Himebaugh Indiana University August 9, 2016 Geoffrey Brown, Bryce Himebaugh 2015 August 9, 2016 1 / 19 Outline Bits, Bytes, Words Word Size Byte Addressable Memory Byte
More informationCPS 104 Computer Organization and Programming
CPS 104 Computer Organization and Programming Lecture-3 : Memory, Bit Operations. Sep. 3, 1999 Dietolf (Dee) Ramm http://www.cs.duke.edu/~dr/cps104.html CPS104 Lec3.1 GK&DR Fall 1999 Administrivia Homework
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 informationCS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.
CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits
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 informationNumber System. Introduction. Decimal Numbers
Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26
More informationBeginning C Programming for Engineers
Beginning Programming for Engineers R. Lindsay Todd Lecture 6: Bit Operations R. Lindsay Todd () Beginning Programming for Engineers Beg 6 1 / 32 Outline Outline 1 Place Value Octal Hexadecimal Binary
More informationCSE 351: The Hardware/Software Interface. Section 2 Integer representations, two s complement, and bitwise operators
CSE 351: The Hardware/Software Interface Section 2 Integer representations, two s complement, and bitwise operators Integer representations In addition to decimal notation, it s important to be able to
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 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 informationWorld Inside a Computer is Binary
C Programming 1 Representation of int data World Inside a Computer is Binary C Programming 2 Decimal Number System Basic symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Radix-10 positional number system. The radix
More informationdata within a computer system are stored in one of 2 physical states (hence the use of binary digits)
Binary Digits (bits) data within a computer system are stored in one of 2 physical states (hence the use of binary digits) 0V and 5V charge / NO charge on a transistor gate ferrite core magnetised clockwise
More informationComputer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK
Computer (Literacy Skills Number representations and memory Lubomír Bulej KDSS MFF UK Number representations? What for? Recall: computer works with binary numbers Groups of zeroes and ones 8 bits (byte,
More informationUNIT 7A Data Representation: Numbers and Text. Digital Data
UNIT 7A Data Representation: Numbers and Text 1 Digital Data 10010101011110101010110101001110 What does this binary sequence represent? It could be: an integer a floating point number text encoded with
More informationCOMP Overview of Tutorial #2
COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,
More informationGroups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...
Chapter 9 Computer Arithmetic Reading: Section 9.1 on pp. 290-296 Computer Representation of Data Groups of two-state devices are used to represent data in a computer. In general, we say the states are
More informationCSCI 2212: Intermediate Programming / C Chapter 15
... /34 CSCI 222: Intermediate Programming / C Chapter 5 Alice E. Fischer October 9 and 2, 25 ... 2/34 Outline Integer Representations Binary Integers Integer Types Bit Operations Applying Bit Operations
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 informationAnnouncements HW1 is due on this Friday (Sept 12th) Appendix A is very helpful to HW1. Check out system calls
Announcements HW1 is due on this Friday (Sept 12 th ) Appendix A is very helpful to HW1. Check out system calls on Page A-48. Ask TA (Liquan chen: liquan@ece.rutgers.edu) about homework related questions.
More informationNumber Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column
1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's
More informationECE 250 / CS 250 Computer Architecture. C to Binary: Memory & Data Representations. Benjamin Lee
ECE 250 / CS 250 Computer Architecture C to Binary: Memory & Data Representations Benjamin Lee Slides based on those from Alvin Lebeck, Daniel Sorin, Andrew Hilton, Amir Roth, Gershon Kedem Administrivia
More informationNumber Systems for Computers. Outline of Introduction. Binary, Octal and Hexadecimal numbers. Issues for Binary Representation of Numbers
Outline of Introduction Administrivia What is computer architecture? What do computers do? Representing high level things in binary Data objects: integers, decimals, characters, etc. Memory locations (We
More informationFinal Labs and Tutors
ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South
More informationFinal Exam. 11 May 2018, 120 minutes, 26 questions, 100 points
Name: CS520 Final Exam 11 May 2018, 120 minutes, 26 questions, 100 points The exam is closed book and notes. Please keep all electronic devices turned off and out of reach. Note that a question may require
More informationNumber Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example
Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,
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 informationData Representation 1
1 Data Representation Outline Binary Numbers Adding Binary Numbers Negative Integers Other Operations with Binary Numbers Floating Point Numbers Character Representation Image Representation Sound Representation
More informationCS 261 Fall Binary Information (convert to hex) Mike Lam, Professor
CS 261 Fall 2018 Mike Lam, Professor 3735928559 (convert to hex) Binary Information Binary information Topics Base conversions (bin/dec/hex) Data sizes Byte ordering Character and program encodings Bitwise
More informationCTT MODBUS-RTU COMMUNICATION PROTOCOL TEMPERATURE MONITOR DEVICE
INSTRUCTION MANUAL IM149-U v0.92 CTT MODBUS-RTU COMMUNICATION PROTOCOL TEMPERATURE MONITOR DEVICE Firmware version: v3.0 or higher MODBUS PROTOCOL Modbus is a master-slave communication protocol able to
More informationTechnical Specification. Third Party Control Protocol. AV Revolution
Technical Specification Third Party Control Protocol AV Revolution Document AM-TS-120308 Version 1.0 Page 1 of 31 DOCUMENT DETAILS Document Title: Technical Specification, Third Party Control Protocol,
More informationComputer Organization & Systems Exam I Example Questions
Computer Organization & Systems Exam I Example Questions 1. Pointer Question. Write a function char *circle(char *str) that receives a character pointer (which points to an array that is in standard C
More informationDRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.
Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic 0 (0 volts) and one for logic
More informationimetos LoRa Data payload structure
imetos LoRa Data payload structure Pessl Instruments, GmbH Version 1.0, 06-2018 Content 1. SCOPE OF THIS DOCUMENT... 2 2. PARSING THE DATA FROM THE PAYLOAD VERSUS API DATA ACCESS... 3 3. IMETOS LORA FIRMWARE
More informationHarry H. Porter, 2006
The SPARC Computer Architecture Harry Porter Portland State University 1 CS-321 Lexer Parser Type Checking Intermediate Code Generation All semantic error checking finished in this phase IR - Intermediate
More informationComputer Organization MIPS ISA
CPE 335 Computer Organization MIPS ISA Dr. Iyad Jafar Adapted from Dr. Gheith Abandah Slides http://www.abandah.com/gheith/courses/cpe335_s08/index.html CPE 232 MIPS ISA 1 (vonneumann) Processor Organization
More informationComputer Systems Organization
Carnegie Mellon Computer Systems Organization Shuai Mu Slides are based on Tiger Wang s and Jinyang Li s class Why study CSO? The path of your next few years graduation interview programmer The path of
More informationMCW Application Notes 24 th February 2017
MCW Application Notes 24 th February 2017 www.motorcontrolwarehouse.co.uk Document number MCW-HEDY-001 Revision 0.1 Author Gareth Lloyd Product HEDY HD700 Title Summary HEDY HD700 Modbus Serial Communications
More informationIEEE-754 floating-point
IEEE-754 floating-point Real and floating-point numbers Real numbers R form a continuum - Rational numbers are a subset of the reals - Some numbers are irrational, e.g. π Floating-point numbers are an
More informationl l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers
198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information
More informationMemory, Data, & Addressing I
Memory, Data, & Addressing I 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/953/
More informationGNetPlus Communication Protocol
Basic Package (BINARY VERSION) Master Query Package (HOST) Field Header Address Query Function Data length DATA BYTES Error Check Desc SOH 0~255 0~255 0~255 CRC16_Low CRC16_Hi Size 1 BYTE 1 BYTE 1 BYTE
More informationBinary Representations and Arithmetic
Binary Representations and Arithmetic 9--26 Common number systems. Base : decimal Base 2: binary Base 6: hexadecimal (memory addresses) Base 8: octal (obsolete computer systems) Base 64 (email attachments,
More informationMath 230 Assembly Programming (AKA Computer Organization) Spring 2008
Math 230 Assembly Programming (AKA Computer Organization) Spring 2008 MIPS Intro II Lect 10 Feb 15, 2008 Adapted from slides developed for: Mary J. Irwin PSU CSE331 Dave Patterson s UCB CS152 M230 L10.1
More informationData Representation. DRAM uses a single capacitor to store and a transistor to select. SRAM typically uses 6 transistors.
Data Representation Data Representation Goal: Store numbers, characters, sets, database records in the computer. What we got: Circuit that stores 2 voltages, one for logic ( volts) and one for logic (3.3
More informationChapter 2 Number System
Chapter 2 Number System Embedded Systems with ARM Cortext-M Updated: Tuesday, January 16, 2018 What you should know.. Before coming to this class Decimal Binary Octal Hex 0 0000 00 0x0 1 0001 01 0x1 2
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 4: MIPS Instructions Adapted from Computer Organization and Design, Patterson & Hennessy, UCB From Last Time Two values enter from the left (A and B) Need
More informationLAB A Translating Data to Binary
LAB A Translating Data to Binary Create a directory for this lab and perform in it the following groups of tasks: LabA1.java 1. Write the Java app LabA1 that takes an int via a command-line argument args[0]
More informationFinal Exam. 12 December 2018, 120 minutes, 26 questions, 100 points
Name: CS520 Final Exam 12 December 2018, 120 minutes, 26 questions, 100 points The exam is closed book and notes. Please keep all electronic devices turned off and out of reach. Note that a question may
More informationRecap from Last Time. CSE 2021: Computer Organization. It s All about Numbers! 5/12/2011. Text Pictures Video clips Audio
CSE 2021: Computer Organization Recap from Last Time load from disk High-Level Program Lecture-2(a) Data Translation Binary patterns, signed and unsigned integers Today s topic Data Translation Code Translation
More informationSigned/Unsigned Integer Arithmetic in C. Vineel Kovvuri
Signed/Unsigned Integer Arithmetic in C Vineel Kovvuri http://vineelkovvuri.com Contents 1 Introduction 2 2 How signed-ness is represented in the hardware? 2 3 How signed-ness is interpreted in assembly?
More informationLearning the Binary System
Learning the Binary System www.brainlubeonline.com/counting_on_binary/ Formated to L A TEX: /25/22 Abstract This is a document on the base-2 abstract numerical system, or Binary system. This is a VERY
More informationBinary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018
Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Fall 2018 Ziad Matni, Ph.D. Dept. of Computer Science, UCSB Administrative Stuff The class is full I will not be adding more ppl
More informationThe MARIE Architecture
The MARIE Machine Architecture that is Really Intuitive and Easy. We now define the ISA (Instruction Set Architecture) of the MARIE. This forms the functional specifications for the CPU. Basic specifications
More informationSolutions - Homework 2 (Due date: October 4 5:30 pm) Presentation and clarity are very important! Show your procedure!
Solutions - Homework 2 (Due date: October 4 th @ 5:30 pm) Presentation and clarity are very important! Show your procedure! PROBLEM 1 (28 PTS) a) What is the minimum number of bits required to represent:
More informationSigned Binary Numbers
Signed Binary Numbers Unsigned Binary Numbers We write numbers with as many digits as we need: 0, 99, 65536, 15000, 1979, However, memory locations and CPU registers always hold a constant, fixed number
More informationNumbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras
Numbers and Computers Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras 1 Think of a number between 1 and 15 8 9 10 11 12 13 14 15 4 5 6 7 12 13 14 15 2 3 6 7 10 11 14 15
More informationCS 241 Data Organization Binary
CS 241 Data Organization Binary Brooke Chenoweth University of New Mexico Fall 2017 Combinations and Permutations In English we use the word combination loosely, without thinking if the order of things
More informationChapter 10 Binary Arithmetics
27..27 Chapter Binary Arithmetics Dr.-Ing. Stefan Werner Table of content Chapter : Switching Algebra Chapter 2: Logical Levels, Timing & Delays Chapter 3: Karnaugh-Veitch-Maps Chapter 4: Combinational
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 informationECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014
Problem 1 (4 parts, 21 points) Encoders and Pass Gates Part A (8 points) Suppose the circuit below has the following input priority: I 1 > I 3 > I 0 > I 2. Complete the truth table by filling in the input
More informationNumber Representations
Simple Arithmetic [Arithm Notes] Number representations Signed numbers Sign-magnitude, ones and twos complement Arithmetic Addition, subtraction, negation, overflow MIPS instructions Logic operations MIPS
More information//
----------------------------------------------------------------------------------- Filename: FixedMath.h ----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
More informationIT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1
IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose
More informationDMTME Multimeters. Communication protocol. Technical specification V1.2 ABB
DMTME Multimeters Communication protocol ABB 1 Setting up DMTME serial communication.3 1.1 Serial network ID programming...3 1.2 RS-485 communication interface...3 1.3 Serial line connection...3 2 Communication
More information1 Digital tools. 1.1 Introduction
1 Digital tools 1.1 Introduction In the past few years, enormous advances have been made in the cost, power, and ease of use of microcomputers and associated analog and digital circuits. It is now possible,
More informationSISTEMI EMBEDDED. Basic Concepts about Computers. Federico Baronti Last version:
SISTEMI EMBEDDED Basic Concepts about Computers Federico Baronti Last version: 20170307 Embedded System Block Diagram Embedded Computer Embedded System Input Memory Output Sensor Sensor Sensor SENSOR CONDITIONING
More informationInteger Representation
Integer Representation Announcements assign0 due tonight assign1 out tomorrow Labs start this week SCPD Note on ofce hours on Piazza Will get an email tonight about labs Goals for Today Introduction to
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 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 informationBinary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2
Binary Arithmetic CS 64: Computer Organization and Design Logic Lecture #2 Ziad Matni Dept. of Computer Science, UCSB Adding this Class The class is full I will not be adding more ppl L Even if others
More informationContent. Information Coding. Where are we? Where are we? Bit vectors (aka Words )
Information Coding Lecturer: Guillaume Beslon Original Author: Lionel Morel Computer Science and Information Technology - INSA Lyon Fall 2018 1 / 36 2 / 36 Where are we? Where are we? Programmers......
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 informationGoals for this Week. CSC 2400: Computer Systems. Bits, Bytes and Data Types. Binary number system. Finite representations of binary integers
CSC 2400: Computer Systems Bits, Bytes and Data Types 1 Goals for this Week Binary number system Why binary? Converting between decimal and binary and octal and hexadecimal number systems Finite representations
More informationKeywords: CRC, CRC-7, cyclic redundancy check, industrial output, PLC, programmable logic controller, C code, CRC generation, microprocessor, switch
Keywords: CRC, CRC-7, cyclic redundancy check, industrial output, PLC, programmable logic controller, C code, CRC generation, microprocessor, switch APPLICATION NOTE 6002 CRC PROGRAMMING FOR THE MAX14900E
More informationData Representation COE 301. Computer Organization Prof. Muhamed Mudawar
Data Representation COE 30 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Positional Number
More informationA complement number system is used to represent positive and negative integers. A complement number system is based on a fixed length representation
Complement Number Systems A complement number system is used to represent positive and negative integers A complement number system is based on a fixed length representation of numbers Pretend that integers
More informationChapter 2A Instructions: Language of the Computer
Chapter 2A Instructions: Language of the Computer Copyright 2009 Elsevier, Inc. All rights reserved. Instruction Set The repertoire of instructions of a computer Different computers have different instruction
More informationC-string format with scanf/printf
CSI333 Lecture 4 C-string format with scanf/printf char mycstring[4]; int intvar; scanf("%3s", &intvar ); /*reads up to 3 chars and stores them PLUS \ in the 4-byte var. intvar*/ scanf("%3s", mycstring);
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 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 informationCENG3420 Lecture 03 Review
CENG3420 Lecture 03 Review Bei Yu byu@cse.cuhk.edu.hk 2017 Spring 1 / 38 CISC vs. RISC Complex Instruction Set Computer (CISC) Lots of instructions of variable size, very memory optimal, typically less
More informationInstructions: Language of the Computer
CS359: Computer Architecture Instructions: Language of the Computer Yanyan Shen Department of Computer Science and Engineering 1 The Language a Computer Understands Word a computer understands: instruction
More informationNumber Systems CHAPTER Positional Number Systems
CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of
More informationCS 107 Lecture 2: Bits and Bytes (continued)
CS 107 Lecture 2: Bits and Bytes (continued) Friday, January 12, 2018 Computer Systems Winter 2018 Stanford University Computer Science Department Reading: Reader: Number Formats Used in CS 107 and Bits
More informationCS 61C: Great Ideas in Computer Architecture. (Brief) Review Lecture
CS 61C: Great Ideas in Computer Architecture (Brief) Review Lecture Instructor: Justin Hsia 7/16/2013 Summer 2013 Lecture #13 1 Topic List So Far (1/2) Number Representation Signed/unsigned, Floating Point
More informationCHAPTER 1 Numerical Representation
CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to
More informationInf2C - Computer Systems Lecture 2 Data Representation
Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack
More informationIntroduction to Computer Science-103. Midterm
Introduction to Computer Science-103 Midterm 1. Convert the following hexadecimal and octal numbers to decimal without using a calculator, showing your work. (6%) a. (ABC.D) 16 2748.8125 b. (411) 8 265
More informationNumber representations
Number representations Number bases Three number bases are of interest: Binary, Octal and Hexadecimal. We look briefly at conversions among them and between each of them and decimal. Binary Base-two, or
More information9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation
Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit
More informationCS61, Fall 2012 Midterm Review Section
CS61, Fall 2012 Midterm Review Section (10/16/2012) Q1: Hexadecimal and Binary Notation - Solve the following equations and put your answers in hex, decimal and binary. Hexadecimal Decimal Binary 15 +
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 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 informationThe Design of C: A Rational Reconstruction
The Design of C: A Rational Reconstruction 1 Goals of this Lecture Help you learn about: The decisions that were available to the designers of C The decisions that were made by the designers of C and thereby
More informationRS-232 Control of the Advantage EQ281/8, EQ282/8 and Advantage SMS200
RS-232 Control of the Advantage EQ281/8, EQ282/8 and Advantage SMS200 Biamp Systems, 14130 N.W. Science Park, Portland, Oregon 97229 U.S.A. (503) 641-7287 an affiliate of Rauland-Borg Corp. Introduction
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 information